nrf51822, how do I use a vendor specific UUID?

Source: Internet
Author: User


Using a vendor specific UUID is basically a two-step process:

1. Add your custom base UUID to the stack by using Sd_ble_uuid_vs_add (). Store the value returned to the P_type parameter for this function call.


2. Set the type of all ble_uuid_t, should use this base to the value returned to the Sd_ble_uuid_vs_add (). When you set this field to your custom type instead from to Ble_uuid_type_ble, the value would be used on top of the custom B ASE UUID specified instead of on top of the Bluetooth SIG base.

Behind the scenes, Sd_ble_uuid_vs_add () would add the base UUID to the Softdevice ' s internal list of base UUIDs, and return The table index for this UUID is in the Type field. When using the type in a ble_uuid_t later, the Softdevice can look up the base used in this same table by using this index .

I ' ve also attached a small pseudo-code snippet that shows the essentials of this scheme.


uint32_t Sd_ble_uuid_vs_add ( ble_uuid128_t Const *CONST P_vs_uuid,
uint8_t *const P_uuid_type
)
ADD a Vendor specific UUID.

This call enables the application to add a vendor specific UUID to the BLE stack ' s table, for later use all other modules and APIs. This-then allows the application-shorter, 24-bitble_uuid_t format when dealing with both 16-bit and 128-bit UUI Ds without has to check for lengths and has split code paths. The the-the-the-is-accomplished is by extending the grouping mechanism, the Bluetooth SIG standard base UUID uses fo R all other 128-bit UUIDs.

Parameters
[In] P_vs_uuid Pointer to a 16-octet (128-bit) little endian Vendor specific UUID disregarding bytes and 13.
[out] P_uuid_type Pointer where the Type field in ble_uuid_t corresponding to this UUID would be stored.
For example:

service_init:uint32_t Err_code;    ble_uuid_t Ble_uuid; ble_uuid128_t Nus_base_uuid = {0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xe5, 0xa9, 0xE0, 0x93, 0xf3, 0xa3, 0xb5, 0x00, 0x00, 0x40, 0        X6E};    ADD Custom base UUID Err_code = Sd_ble_uuid_vs_add (&nus_base_uuid, &p_nus->uuid_type);    if (err_code! = nrf_success) {return err_code;    }//Add Service Ble_uuid.type = p_nus->uuid_type;    Ble_uuid.uuid = Ble_uuid_nus_service;    Err_code = Sd_ble_gatts_service_add (Ble_gatts_srvc_type_primary, &ble_uuid, &p_nus->service_handle);    if (err_code! = nrf_success) {return err_code;    }...char_add:ble_uuid.type = p_nus->uuid_type;    Ble_uuid.uuid = ble_uuid_nus_rx_characteristic;                                               ... return Sd_ble_gatts_characteristic_add (P_nus->service_handle, &CHAR_MD, &attr_char_value, &p_nus->rx_handles)


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

nrf51822, how do I use a vendor specific UUID?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.