CSR867x — How to modify the name of a Bluetooth device

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

XX Author: ZHS (cultural person)

XX Contact: Chat at the end of the article ( or enter the group: 471144274 )

XX Copyright statement: Original article, welcome to comment and reprint~ It’s best to tell me when reprinting

What XX has to say: The author's level is limited, and it is inevitable that there are deficiencies. Please correct me!

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Written in front: Recently, many people have asked how to modify the name of the Bluetooth device in the ADK of CSR. Here I will make a brief summary of the usual operations;

Q: How many steps does it take to put the elephant in the refrigerator? Answer: 3 steps.

Yes, we need 3 steps to modify the name of the Bluetooth device:

1. Call the connection interface in the lib library and modify the Bluetooth name of the underlying protocol stack through the HCI command:

ConnectionChangeLocalName(nameLength, nameData);

2. Use PSkey to store the device name, and you only need to read it from PSkey next time you boot:

memcpy(at_buff, nameData, nameLength);

PsStore(PS_DEVICE_NAME, at_buff, nameLength);

3. Modify EirData to make the Bluetooth broadcast name of BR/EDR change immediately:

AppWriteEirData ();

       

After the above 3 steps, the broadcast name of the traditional Bluetooth (BR/EDR) has been changed, but the broadcast name of the low energy Bluetooth (BLE) will not change, and it will only change after a reset.

 

    BLE boot broadcast process:

    1) When BLE broadcasts, first read the local device name:

    sinkBleGapStartReadLocalName(ble_gap_read_name_advertising);

      

    2) The event CL_DM_LOCAL_NAME_COMPLETE will be reported after the protocol stack is processed:

         

    3) Set the BLE broadcast name:

       

If you encounter a situation where the BLE broadcast name has not changed after the modification, please click on this blog , and there may be the answer you want. Here, BR/EDR and BLE are set to the same name. Of course, they can be set to different. However, on the Android side, the name will change when the name is different, which is of little significance. Moreover, it can be distinguished by the Bluetooth icon.

Guess you like

Origin blog.csdn.net/zhanghuaishu0/article/details/88077624