Problem encoding and advertising the BT_UUID_NUS_VAL

Hi. I am working on a project trying to encode the BT_UUID_NUS_VAL into advertising packets without success. 

In am using the unicast_server.c file as a reference. There there is the following : 

static uint8_t unicast_server_adv_data[] = {
	BT_UUID_16_ENCODE(BT_UUID_ASCS_VAL),
	BT_AUDIO_UNICAST_ANNOUNCEMENT_TARGETED,
	BT_BYTES_LIST_LE16(AVAILABLE_SINK_CONTEXT),
	BT_BYTES_LIST_LE16(AVAILABLE_SOURCE_CONTEXT),
	0x00, /* Metadata length */
};

This advertises fine as expected. However, instead of advertising BT_UUID_ASCS_VAL which has a simple value of 0x1853, I would like to advertise BT_UUID_NUS_VAL. The problem is that this has a large value of 6e400001-b5a3-f393-e0a9-e50e24dcca9e. 

I tried the following without success :  

static uint8_t unicast_server_adv_data[] = {
	BT_DATA_BYTES(BT_DATA_UUID128_ALL, BT_UUID_NUS_VAL),
	BT_AUDIO_UNICAST_ANNOUNCEMENT_TARGETED,
	BT_BYTES_LIST_LE16(AVAILABLE_SINK_CONTEXT),
	BT_BYTES_LIST_LE16(AVAILABLE_SOURCE_CONTEXT),
	0x00, /* Metadata length */
};

How could I go about possibly solving this? Thank you in advance.

Parents
  • Hi

    What issues exactly did you have with bt_le_adv_start()?

    It seems what you're trying to input in the .type field of your BT_DATA is not recorded or in the union initializer. This should be the type of advertising data field of your application that isn't set correctly it seems. How have you set the advertising type and UUID type in your project?

    Best regards,

    Simon

  •  Sorry for the delay. I'm just back at work now. 

    The problem with using bt_le_adv_start() is that the application sometimes crashes when the receiver disconnects from the central device reporting no valid advertising data.

    It became clear that I needed to call bt_mgmt_adv_start() initially. When bt_mgmt_adv_start() is used, the advertising_process() function gets invoked eventually which uses extended_adv_create() and bt_le_ext_adv_start(). This must use a struct like the unicast_server_adv_data above for containing the advertising data data. 

    How have you set the advertising type and UUID type in your project?

    How do I ? I'm not really sure. Here is how the BT_DATA_BYTES is used in the Peripheral UART sample, but when using bt_le_adv_start(). 

    static const struct bt_data ad[] = {
    	BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
    	BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN),
    };
    
    static const struct bt_data sd[] = {
    	BT_DATA_BYTES(BT_DATA_UUID128_ALL, BT_UUID_NUS_VAL),
    };

Reply
  •  Sorry for the delay. I'm just back at work now. 

    The problem with using bt_le_adv_start() is that the application sometimes crashes when the receiver disconnects from the central device reporting no valid advertising data.

    It became clear that I needed to call bt_mgmt_adv_start() initially. When bt_mgmt_adv_start() is used, the advertising_process() function gets invoked eventually which uses extended_adv_create() and bt_le_ext_adv_start(). This must use a struct like the unicast_server_adv_data above for containing the advertising data data. 

    How have you set the advertising type and UUID type in your project?

    How do I ? I'm not really sure. Here is how the BT_DATA_BYTES is used in the Peripheral UART sample, but when using bt_le_adv_start(). 

    static const struct bt_data ad[] = {
    	BT_DATA_BYTES(BT_DATA_FLAGS, (BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR)),
    	BT_DATA(BT_DATA_NAME_COMPLETE, DEVICE_NAME, DEVICE_NAME_LEN),
    };
    
    static const struct bt_data sd[] = {
    	BT_DATA_BYTES(BT_DATA_UUID128_ALL, BT_UUID_NUS_VAL),
    };

Children
No Data
Related