如何使用Broadcom WICED智能IDE宣传特定的UUID

时间:2013-10-03 00:36:43

标签: bluetooth bluetooth-lowenergy broadcom

我正在使用Broadcom的蓝牙LE设备和Broadcom的WICED智能IDE编程嵌入式主板。

无法弄清楚如何更改电路板上电时广告的默认UUID。

1 个答案:

答案 0 :(得分:0)

以下是将广告更改为具有标志,128位UUID和本地名称的示例代码。

    BLE_ADV_FIELD adv[3];

    // flags
    adv[0].len     = 1 + 1;
    adv[0].val     = ADV_FLAGS;
    adv[0].data[0] = LE_LIMITED_DISCOVERABLE | BR_EDR_NOT_SUPPORTED;

    adv[1].len     = 16 + 1;
    adv[1].val     = ADV_SERVICE_UUID128_COMP;
    memcpy(adv[1].data, db_pdu.pdu, 16);

    // name
    adv[2].len      = strlen(bleprofile_p_cfg->local_name) + 1;
    adv[2].val      = ADV_LOCAL_NAME_COMP;
    memcpy(adv[2].data, bleprofile_p_cfg->local_name, adv[2].len - 1);

    bleprofile_GenerateADVData(adv, 3);