Search code examples
bluetoothbluetooth-lowenergybroadcom

how to advertise a specific UUID with Broadcom WICED smart IDE


I'm programming an embedded board using Broadcom's Bluetooth LE device, and Broadcom's WICED smart IDE.

Can't figure out how to change the default UUID that the board advertises at power up.


Solution

  • Following is a sample code to change adverts to have flags, 128-bit UUID and local name.

        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);