nrf51822添加UUID
发布日期:2021-06-30 18:53:58 浏览次数:2 分类:技术文章

本文共 1572 字,大约阅读时间需要 5 分钟。

问题 :添加一个自己的uuid

I’m new to use nordic and I would like to add a new custom service (2320EE58-8654-4132-95F7-0A872AC0958F) with a custom characteristic(23200000-8654-4132-95F7-0A872AC0958F) I’m using nRF51 and mBed compiler. Thank’s for a further reply and for the time. Regardes

添加uuid的步骤

Hi Epasta,

Nordic’s application note nAN-36 is the best guide for implementing custom services and characteristics.

Generally speaking, your service will take the form ABCDxxxx-EF12-3456-7890-ABCDEF123456 as a “base UUID” and then the 16-bits are used to identify the service itself and the characteristics under it. The lowercase x’s are where you specify your service/characteristc. For example, I implemented my service as f30900010-4903-4c71-8d16-549852aba4c5 and added a characteristic to it that had a full UUID as f3090011-4903-4c71-8d16-549852taba4c5 using the following code:

#define PIP_UUID_BASE {0xC5, 0xA4, 0xAB, 0x52, 0x98, 0x54, 0x16, 0x8D, 0x71, 0x4C, 0x03, 0x4A, 0x00, 0x00, 0x09, 0xF3}#define LTES_UUID_SERVICE 0x0010#define LTES_UUID_DISCIP_CHAR 0x0011

From there, you have to add your register your base uuid with softdevice using:

sd_ble_uuid_vs_add(ble_uuid128_t const *p_vs_uuid, uint8_t *p_uuid_type)

Then add your service using:

sd_ble_gatts_service_add(uint8_t type, ble_uuid_t const *p_uuid, uint16_t *p_handle)

Then add your characteristic using:

sd_ble_gatts_characteristic_add(uint16_t service_handle, ble_gatts_char_md_t const *p_char_md, ble_gatts_attr_t const *p_attr_char_value, ble_gatts_char_handles_t *p_handles)

Hope this helps!

Regards, michael

转载地址:https://linus.blog.csdn.net/article/details/50781948 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:Error: file not found: arch/arm/boot/compressed/piggy.lzo
下一篇:ubuntu下面挂载mtp设备的目录位置

发表评论

最新留言

感谢大佬
[***.8.128.20]2024年04月23日 09时37分23秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章