Format for service UUID list when enabling BLE advertising
I am trying to edit the BLE Sensor Demo app for STM32 micro and BLUENRG-M0 module (using Nucleo boards).
I want to advertise one service in the advertising packet. When I make the call to aci_gap_set_discoverable() I get a response of BLE_STATUS_INVALID_PARAMS( 66 dec ) . The only change I made to the example source code is to add in the HW service UUID as used in the sample code.
void Set_DeviceConnectable(void)
{
uint8_t ret;
const char local_name[] = {AD_TYPE_COMPLETE_LOCAL_NAME,SENSOR_DEMO_NAME};
uint8_t svc_uuid[] = { 0x07,0x00,0x00,0x00,0x00,0x00,0x01,0x11,0xe1,0x9a,0xb4,0x00,0x02,0xa5,0xd5,0xc5,0x1b};
uint8_t manuf_data[] = {
2,0x0A,0x00, /* 0 dBm */ // Trasmission Power
8,0x09,SENSOR_DEMO_NAME, // Complete Name
11,0xFF,0xFF, /* SKD version */
0x52,
0x41,
0x4c,
bdaddr[5], /* BLE MAC start -MSB first- */
bdaddr[4],
bdaddr[3],
bdaddr[2],
bdaddr[1],
bdaddr[0] /* BLE MAC stop */
};
//manuf_data[18] |= 0x01; /* Sensor Fusion */
//COPY_HW_SENS_W2ST_SERVICE_UUID(svc_uuid);
hci_le_set_scan_resp_data(0, NULL);
PRINT_INFO("Set General Discoverable Mode.\n");
ret = aci_gap_set_discoverable(ADV_DATA_TYPE,
(ADV_INTERVAL_MIN_MS*1000)/625,(ADV_INTERVAL_MAX_MS*1000)/625,
STATIC_RANDOM_ADDR, NO_WHITE_LIST_USE,
//sizeof(local_name), local_name, 0, NULL, 0, 0);
sizeof(local_name), local_name, sizeof(svc_uuid), svc_uuid, 0, 0);
aci_gap_update_adv_data(sizeof(manuf_data), manuf_data);
if(ret != BLE_STATUS_SUCCESS)
{
PRINT_ERR("aci_gap_set_discoverable() failed: 0x%02x\r\n", ret);
}
else
{
PRINT_INFO("aci_gap_set_discoverable() --> SUCCESS\r\n");
}
}Inside the aci_gap_set_discoverable() the code successfully passes the buffer overrun check so the error value of BLE_STATUS_INVALID_PARAMS comes after calling the hci_send_req(). Something is wrong is how I am formatting the service uuid and I can't find any example code on how to do this from STM.
Thanks
