This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Identifying beacons with 128 bit UUID

Hi,

I am working on a project where I have 4 advertising beacons which will have to trigger some functions in the central side when it gets the advertising data. Now I am currently working on the central(ble_app_uart) side which will have to check each advertising packet, and from this it has to identify which beacon it is. In the beacon program I use the example code ble_app_beacon, what is the best way to identify each beacon? I thought maybe just use the 128 bit UUID but I am unsure how to implement this in the central side or if it is the best solution.

I know about this function: static bool is_uuid_present(const ble_uuid_t *p_target_uuid, const ble_gap_evt_adv_report_t *p_adv_report)

But ble_uuid_t is a 16 bit service UUID for the UART:

typedef struct { uint16_t uuid; /*< 16-bit UUID value or octets 12-13 of 128-bit UUID. */ uint8_t type; /*< UUID type, see @ref BLE_UUID_TYPES. If type is @ref BLE_UUID_TYPE_UNKNOWN, the value of uuid is undefined. */ } ble_uuid_t;

-Erblin

Parents
  • FormerMember
    0 FormerMember

    @Erblin : The function is_uuid_present() is the function you want to use for identifying a 128-bit UUID.

    For custom/vendor specific UUIDs, the UUID should be added to the softdevice using sd_ble_uuid_vs_add(). When using that function, the 128-bit UUID is added to a table internally in the softdevice. The out parameter from sd_ble_uuid_vs_add() is the index in the table where the UUID is located. As stated in the documentation for sd_ble_uuid_vs_add(), the function will disregard byte 12 and 13 of the UUID (they are set to '0' in the internal table).

    The struct ble_uuid_t has two members:

    • type: The index in the table where the UUID can be found.
    • uuid: A 16-bit UUID (2 bytes), corresponding to byte 12 and 13 that were disregarded when the 128-bit UUID was added to the softdevice.

    The example ble_app_uart_c uses is_uuid_present() to identify ble_app_uart peripheral devices.

Reply
  • FormerMember
    0 FormerMember

    @Erblin : The function is_uuid_present() is the function you want to use for identifying a 128-bit UUID.

    For custom/vendor specific UUIDs, the UUID should be added to the softdevice using sd_ble_uuid_vs_add(). When using that function, the 128-bit UUID is added to a table internally in the softdevice. The out parameter from sd_ble_uuid_vs_add() is the index in the table where the UUID is located. As stated in the documentation for sd_ble_uuid_vs_add(), the function will disregard byte 12 and 13 of the UUID (they are set to '0' in the internal table).

    The struct ble_uuid_t has two members:

    • type: The index in the table where the UUID can be found.
    • uuid: A 16-bit UUID (2 bytes), corresponding to byte 12 and 13 that were disregarded when the 128-bit UUID was added to the softdevice.

    The example ble_app_uart_c uses is_uuid_present() to identify ble_app_uart peripheral devices.

Children
No Data
Related