Discuz! Board

标题: nrf51822广播数据 [打印本页]

作者: lqab1983    时间: 2016-7-25 16:48
标题: nrf51822广播数据
您好,我是先接触的CC2541再转到的nrf51822.有关广播数据内容我想请教下?
在CC2541里,广播数据在数组里定义,比较直观
static uint8 advertData[] =
{
  0x02,   // length of this data
  GAP_ADTYPE_FLAGS,
  DEFAULT_DISCOVERABLE_MODE | GAP_ADTYPE_FLAGS_BREDR_NOT_SUPPORTED,

  // service UUID, to notify central devices what services are included
  // in this peripheral
  0x0c,   // length of this data
  //GAP_ADTYPE_16BIT_MORE,      // some of the UUID's, but not all
  //LO_UINT16( SIMPLEPROFILE_SERV_UUID ),
  //HI_UINT16( SIMPLEPROFILE_SERV_UUID ),
  0x09,
  0x4d,
  0x54,
  0x4b,
  0x42,
  0x54,
  0x44,
  0x45,
  0x56,
  0x49,
  0x43,
  0x45,
};

但是在Nrf51822l里的static void advertising_init(void)
{
    uint32_t      err_code;
    ble_advdata_t advdata;
    uint8_t       flags = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;

    // YOUR_JOB: Use UUIDs for service(s) used in your application.
    ble_uuid_t adv_uuids[] = {{BLE_UUID_BATTERY_SERVICE, BLE_UUID_TYPE_BLE}};

    // Build and set advertising data
    memset(&advdata, 0, sizeof(advdata));

    advdata.name_type               = BLE_ADVDATA_FULL_NAME;
    advdata.include_appearance      = true;
    advdata.flags.size              = sizeof(flags);
    advdata.flags.p_data            = &flags;
    advdata.uuids_complete.uuid_cnt = sizeof(adv_uuids) / sizeof(adv_uuids[0]);
    advdata.uuids_complete.p_uuids  = adv_uuids;

    err_code = ble_advdata_set(&advdata, NULL);
    APP_ERROR_CHECK(err_code);
}
里我实在没找到具体明确的广播内容,通过抓包数据看ADvdata,真不知道他是怎么组织的广播包内容?请大家帮我看看

作者: lqab1983    时间: 2016-7-26 08:28
请问如何修改广播数据?我想在默认的格式下填几个字段
作者: admin    时间: 2016-7-29 16:37
参考下ibeacon典型的广播设置:
宏定义:
[attach]1436[/attach]
函数:[attach]1435[/attach]

作者: lqab1983    时间: 2016-7-29 16:55
看到了,貌似所有自定义数据都要放到这个manuf_specific_data里吧?

而且我调试发现,如果想动态修改每次广播数据内容,是不是需要先停止广播再重新调用启动广播?因为我发现好像这个广播时初始化里配置好后就不再修改了,不知道哪里按照广播间隔一次次直接播原来内容




欢迎光临 Discuz! Board (http://qfv8.com/) Powered by Discuz! X3