对话,
我似乎无法更新设备名称,睡眠已启用。禁用睡眠时,只需重复调用app_easy_gap_update_adv_data即可成功更新设备名称。
以下是更新设备名称的函数:
void bleappendbdddresstodevname(void)
{
uint8_t pccommbdaddress [6];
Blegetbddress(PCCommbdddress);
// 重启
MEMSET(BLESCANRESPONSEDATA + 2,0,14);
BlescanResponsedata [2] = 0x54;
BlescanResponsedata [3] = 0x44;
BlescanResponsedata [4] = 0x4c;
BlescanResponsedata [5] = 0x53;
BlescanResponsedata [6] = 0x2d;
BlescanResponsedata [7] = Bleconverthextoascii(PCCommbdaddress [3] >> 4);
BlescanResponsedata [8] = Bleconverthextoascii(PCCommbdddress [3]&0x0f);
BlescanResponsedata [9] = Bleconverthextoascii(PCCommbdaddress [4] >> 4);
BlescanResponsedata [10] = Bleconverthextoascii(PCCommbdaddress [4]&0x0f);
BlescanResponsedata [11] = Bleconverthextoascii(PCCommbdaddress [5] >> 4);
BlescanResponsedata [12] = Bleconverthextoascii(PCCommbdaddress [5]&0x0F);
blescanresponsedata [13] ='\ 0';
//更新广告/扫描数据
app_easy_gap_update_add_data((uint8_t *)blodvertdata,ble_advert_data_length,(uint8_t *)blescanresponsedata,ble_scan_resp_len);
}
然后调用以下内容来开始广告:
虚空布置(空白)
{
//开始广告
app_easy_gap_undircated_advertise_start();
//更新广告/扫描数据
app_easy_gap_update_add_data((uint8_t *)blodvertdata,ble_advert_data_length,(uint8_t *)blescanresponsedata,ble_scan_resp_len);
//更新包含间隙配置文件状态的本地变量
blegoprofilestate = GapState_Adverting;
//发送连接状态
pccommsendconnectionstatus();
}
嗨jlabuac,
那么在SDK中有一个例子,它将使用app_easy_gap_update_add_data()更新广告字符串,我在运行该fw时,我没有看到任何问题,可以检查吗?
谢谢mt_dialog.