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 you in the p_type parameter of this function call.

2. Set the type of all ble_uuid_t  that should use this base to the value returned to you from sd_ble_uuid_vs_add(). When you set this field to your custom type instead of to BLE_UUID_TYPE_BLE, the value will be used on top of
the custom base UUID you specified instead of on top of the Bluetooth SIG base.

Behind the scenes, sd_ble_uuid_vs_add() will add the base UUID to the softdevice's internal list of base UUIDs, and return the table index for this UUID 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 to use the shorter, 24-bit
ble_uuid_t format when dealing with both 16-bit and 128-bit UUIDs without having to check for lengths and having split code paths. The way that this is accomplished is by extending the grouping mechanism that the Bluetooth
SIG standard base UUID uses for all other 128-bit UUIDs.

Parameters
[in] p_vs_uuid Pointer to a 16-octet (128-bit) little endian Vendor Specific UUID disregarding bytes 12 and 13.
[out] p_uuid_type Pointer where the type field in ble_uuid_t corresponding to this UUID will 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, 0x6E}; // 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)

nrf51822, How to use a vendor specific UUID?的更多相关文章

  1. 《NVM-Express-1_4-2019.06.10-Ratified》学习笔记(8.7)Standard Vendor Specific Command Format

    8.7 Standard Vendor Specific Command Format 标准的厂商特定命令格式 Controller可以支持Figure 106中定义的标准的Vendor Specif ...

  2. How to display SSRS report based on customer/Vendor specific language [AX2012]

    Common requirement is to show the reports in customer’s language. [example : Quotations, sales confi ...

  3. python中uuid来生成机器唯一标识

    摘要: 我们可以使用uuid1的后16位来标识一个机器.  # use machine specific uuid, last 16 char will be the same if machine ...

  4. wpa_supplicant.conf

    转自:http://w1.fi/gitweb/gitweb.cgi?p=hostap.git;a=blob_plain;f=wpa_supplicant/wpa_supplicant.conf ### ...

  5. QEMU KVM Libvirt手册(7): 硬件虚拟化

    在openstack中,如果我们启动一个虚拟机,我们会看到非常复杂的参数 qemu-system-x86_64 -enable-kvm -name instance-00000024 -S -mach ...

  6. [BlueZ] 2、使用bluetoothctl搜索、连接、配对、读写、使能notify蓝牙低功耗设备

    星期三, 05. 九月 2018 02:03上午 - beautifulzzzz 1.前言 上一篇讲了如何编译安装BlueZ-5,本篇主要在于玩BlueZ,用命令行去操作BLE设备: [BlueZ] ...

  7. GRE与VXLAN

    一 GRE 1.1 概念 GRE全称是Generic Routing Encapsulation,是一种协议封装的格式,具体格式内容见:https://tools.ietf.org/html/rfc2 ...

  8. CC254x/CC2540/CC2541库函数速查(转)

    hci.h 转自:http://blog.csdn.net/xiaoleiacmer/article/details/44036607#t1 //分配内存,应用程序不应该调用这个函数. void *H ...

  9. CSR8670的A2DP与AVRCP的应用笔记

    1. A2DP1.1. 基本概念阅读A2DP SPEC V12的1.1章,可知: Advanced Audio Distribution Profile(A2DP)典型应用是立体声音乐播放器的音乐到耳 ...

随机推荐

  1. hdu 1846(巴什博弈)

    Brave Game Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

  2. s12-day03-work01 python修改haproxy配置文件(初级版本)

    #!/usr/local/env python3 ''' Author:@南非波波 Blog:http://www.cnblogs.com/songqingbo/ E-mail:qingbo.song ...

  3. bzoj 1875 矩阵快速幂

    思路:不能走走过来的路,变点交换跑矩阵快速幂. #include<bits/stdc++.h> #define LL long long #define fi first #define ...

  4. Python加密模块-pycryptodome

    这个模块可以避开Pycrypto安装时带来的一系列包依赖问题. 安装命令: pip install pycryptodome 使用实例: from Crypto.Cipher import AES k ...

  5. 【栈模拟dfs】Cells UVALive - 3486

    题目链接:https://cn.vjudge.net/contest/209473#problem/D 题目大意:有一棵树,这棵树的前n个节点拥有子节点,告诉你n的大小,以及这n个节点各有的子节点个数 ...

  6. supervisor控制台运行出错,BACKOFF Exited too quickly

    需要把虚拟环境中的flask路径导入,我这里是 export PYTHONPATH=$PYTHONPATH:/root/FlaskWebDevelopment/venv/lib/python2.7/s ...

  7. [JSOI2007]文本生成器 --- AC自动机 + DP

    [JSOI2007]文本生成器 题目描述: JSOI交给队员ZYX一个任务,编制一个称之为“文本生成器”的电脑软件:该软件的使用者是一些低幼人群,他们现在使用的是GW文本生成器v6版. 该软件可以随机 ...

  8. KMP的小结

    http://www.cnblogs.com/kuangbin/archive/2012/08/14/2638803.html 如果有哪一天不记得模板了就去看看大神的 .  非常清晰易懂.

  9. bzoj 4769: 超级贞鱼 -- 归并排序

    4769: 超级贞鱼 Time Limit: 1 Sec  Memory Limit: 128 MB Description 马达加斯加贞鱼是一种神奇的双脚贞鱼,它们把自己的智慧写在脚上——每只贞鱼的 ...

  10. 检测使用内存memory_get_usage,执行时间microtime

    最近经常用一些扩展,适当比较所占内存,还有一些扩展执行时间长,检测一下每步的执行时间,可以加以修正调整一下源码 查看运行时间 microtime() #返回当前 Unix 时间戳和微秒数. echo ...