nrf51822, How to use a vendor specific UUID?
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?的更多相关文章
- 《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 ...
- 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 ...
- python中uuid来生成机器唯一标识
摘要: 我们可以使用uuid1的后16位来标识一个机器. # use machine specific uuid, last 16 char will be the same if machine ...
- wpa_supplicant.conf
转自:http://w1.fi/gitweb/gitweb.cgi?p=hostap.git;a=blob_plain;f=wpa_supplicant/wpa_supplicant.conf ### ...
- QEMU KVM Libvirt手册(7): 硬件虚拟化
在openstack中,如果我们启动一个虚拟机,我们会看到非常复杂的参数 qemu-system-x86_64 -enable-kvm -name instance-00000024 -S -mach ...
- [BlueZ] 2、使用bluetoothctl搜索、连接、配对、读写、使能notify蓝牙低功耗设备
星期三, 05. 九月 2018 02:03上午 - beautifulzzzz 1.前言 上一篇讲了如何编译安装BlueZ-5,本篇主要在于玩BlueZ,用命令行去操作BLE设备: [BlueZ] ...
- GRE与VXLAN
一 GRE 1.1 概念 GRE全称是Generic Routing Encapsulation,是一种协议封装的格式,具体格式内容见:https://tools.ietf.org/html/rfc2 ...
- CC254x/CC2540/CC2541库函数速查(转)
hci.h 转自:http://blog.csdn.net/xiaoleiacmer/article/details/44036607#t1 //分配内存,应用程序不应该调用这个函数. void *H ...
- CSR8670的A2DP与AVRCP的应用笔记
1. A2DP1.1. 基本概念阅读A2DP SPEC V12的1.1章,可知: Advanced Audio Distribution Profile(A2DP)典型应用是立体声音乐播放器的音乐到耳 ...
随机推荐
- DNS之XX记录
DNS服务器里有两个比较重要的记录.一个叫SOA记录(起始授权机构) 一个叫NS(Name Server)记录(域名服务器)关于这两个记录,很多文章都有解释,但是很多人还是很糊涂.我现在通俗的解释一下 ...
- copy深浅拷贝
我们在很多方法里都看到copy()方法,这是对变量的复制,赋值,下面来看一下实例: 复制方法调用的是copy模块中的方法: import copy copy.copy() #前拷贝 c ...
- 05 java 基础:运算符、程序结构
赋值运算符 : = 三元运算符 : ? 算术运算符 : +.- .*./.% 自增自减运算符: ++.-- 关系运算符:>.<.==.>=.<=.!= 逻辑运算符 :& ...
- 动态引入js
function loadScript(url, callback){ var script = document.createElement("script") ...
- info.plist文件里面添加描述 -> 配置定位,相册等
<key>NSAppleMusicUsageDescription</key> <string>App需要您的同意,才能访问媒体资料库</string> ...
- 长安大学第四届ACM-ICPC“迎新杯”程序设计竞赛-重现赛 F - 打铁的箱子
题目描述 作为彩虹岛上最擅长打铁的人,
- 【JAVAWEB学习笔记】22_ajax:异步校验用户名和站内查询
Js原生Ajax和Jquery的Ajax 学习目标 案例1-异步校验用户名是否存在 案例2-站内查询 一.Ajax概述 1.什么是同步,什么是异步 同步现象:客户端发送请求到服务器端,当服务器返回响应 ...
- Linux下Makefile学习笔记
makefile 可以用于编译和执行多个C/C++源文件和头文件. (1) #include "file.h" 和 #include <file.h> 的区别 #inc ...
- mySQL 的 2个分类
1.将如下表中的每门成绩都大于80分的人名? 张三 语文 81 张三 数学 75 李四 语文 76 李四 数学 90 王五 语文 81 王五 数学 100 王五 英语 90 select * from ...
- java8新特性——时间日期API
传统的时间 API 存在线程安全的问题,在多线程开发中必须要上锁,所以 java8 现在为我们提供了一套全新的时间日期 API ,今天进来学习一下java8 的时间日期 API. 一.使用 Local ...