zili_zq
zili_zq
2017-12-08 08:17

NRF 52832 蓝牙 如何发送自定义广播报文

10
  • nrf52382
  • 广播数据
  • ble
  • 蓝牙

这个是我下载nordic_template 程序到开发板上 用nrf connect 工具 获取的数据,
现在我需要发送自定义的广播报文,该怎么修改呢,
这个是广播初始化函数:

static void advertising_init(void)
{
uint32_t err_code;
ble_advdata_t advdata;
ble_adv_modes_config_t options;

// Build advertising data struct to pass into @ref ble_advertising_init.
memset(&advdata, 0, sizeof(advdata));

advdata.name_type               = BLE_ADVDATA_FULL_NAME;
advdata.include_appearance      = false;
advdata.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;

// advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
// advdata.uuids_complete.p_uuids = m_adv_uuids;

  static ble_advdata_manuf_data_t manuf_data;
static uint8_t mydata = 0;  //?????????
                        //?????????????????
                        //?,???????????????1
manuf_data.company_identifier = 0xC7;
manuf_data.data.size = 1;
manuf_data.data.p_data = &mydata;

//mydata++; //??????1
advdata.p_manuf_specific_data = &manuf_data;


memset(&options, 0, sizeof(options));
options.ble_adv_fast_enabled  = true;
options.ble_adv_fast_interval = APP_ADV_INTERVAL;
options.ble_adv_fast_timeout  = APP_ADV_TIMEOUT_IN_SECONDS;

err_code = ble_advertising_init(&advdata, NULL, &options, on_adv_evt, NULL);
APP_ERROR_CHECK(err_code);

}

没有在广播初始化中代码中找到 关于第三行数据 2 0x09 0x4E ,的定义
自定义的广播报文应该放在什么地方?
请大神支招

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

3条回答

为你推荐