N
需要自己去修改广播内容,修改服务uuid 那一项。
因为在广播包中有个字段声明了自己是 HID 设备,所以手机扫描到后是键鼠的图标。
代码如下
void at_init_advertising_parameter(void)
{
uint8_t *pos;
uint8_t adv_data[0x1C];
uint8_t adv_data_len = 0;
pos = &adv_data[0];
uint8_t manufacturer_value[] = {0x00,0x00};
*pos++ = sizeof(manufacturer_value) + 1;
*pos++ = '\xff';
memcpy(pos, manufacturer_value, sizeof(manufacturer_value));
pos += sizeof(manufacturer_value);
uint16_t uuid_value = 0xFF03 ; // 将 HID_SERV_UUID 改成你想设置的 任意 2字节 UUID
*pos++ = sizeof(uuid_value) + 1;
*pos++ = '\x03';
memcpy(pos, (uint8_t *)&uuid_value, sizeof(uuid_value));
pos += sizeof(uuid_value);
adv_data_len = ((uint32_t)pos - (uint32_t)(&adv_data[0]));
gap_adv_param_t adv_param;
adv_param.adv_mode = GAP_ADV_MODE_UNDIRECT;
adv_param.adv_addr_type = GAP_ADDR_TYPE_PUBLIC;
adv_param.adv_chnl_map = GAP_ADV_CHAN_ALL;
adv_param.adv_filt_policy = GAP_ADV_ALLOW_SCAN_ANY_CON_ANY;
adv_param.adv_intv_min = adv_int_arr[gAT_buff_env.default_info.adv_int];
adv_param.adv_intv_max = adv_int_arr[gAT_buff_env.default_info.adv_int];
gap_set_advertising_param(&adv_param);
gAT_ctrl_env.curr_adv_int = adv_param.adv_intv_min;
gap_set_advertising_data(adv_data,adv_data_len);
at_init_adv_rsp_parameter();
}