从通知特征读取(离子-蓝牙) [英] Reading from a Notify Characteristic (Ionic - Bluetooth)

查看:139
本文介绍了从通知特征读取(离子-蓝牙)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用默认的蓝牙配置文件0x1808连接到葡萄糖传感器.我已经连接到设备,发现了所有服务和特性,但是看不到葡萄糖测量0x2A18

I am trying to connect to a glucose sensor using the default bluetooth profile 0x1808. I have already connected to the device, discovered all services and characteristics but I can not read the Glucose Measurement 0x2A18

{
  "service":"1808",
  "characteristic":"2a18",
  "properties":["Notify"],
  "descriptors":[{
    "uuid":"2902"
  }]
},
{
  "service":"1808",
  "characteristic":"2a34",
  "properties":["Notify"],
  "descriptors":[{
    "uuid":"2902"
  }]
},
{
  "service":"1808",
  "characteristic":"2a51",
  "properties":["Read"]
},
{
  "service":"1808",
  "characteristic":"2a52",
  "properties":["Write","Indicate"],
  "descriptors":[{
    "uuid":"2902"
  }]
}

有人可以帮助我如何读取0x2a18的值吗? 我是否必须写任何东西到0x2a52(记录访问控制点)以获取访问权限?

Can anyone help me how to read the value of 0x2a18? Do I have to write anything to 0x2a52 (Record Access Control Point) to gain access?

我是Bluetooth Connection的新手. 预先谢谢你.

I am new to Bluetooth Connection. Thank you in advance.

推荐答案

在葡萄糖服务(

In the Glucose Service (https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.glucose.xml) there is 3 mandatory characteristics. One of them is Glucose Measurement where you get glucose reading notifications. In order to get notifications you have to request for them using Record Access Control Point characteristic. It allows you to get all glucose readings, only the latest, only the first, delete saved readings from the device etc.

例如,

  • 启用有关葡萄糖测量特性的通知.
  • 启用有关记录访问控制点特性的指示.
  • 发送0x0101 =报告存储的记录|所有记录

您应该在葡萄糖测量"字符上收到N条通知.然后在RACP字符上进行指示.值:0x06000101 =对报告存储的记录"的响应|成功.如果血糖仪上未保存任何读数,则N可以为0.

You should get N notifications on Glucose Measurement char. followed by an indication on RACP char. with value: 0x06000101 = Response for "Report stored records" | success. N may be 0 if no readings are saved on the glucose device.

阅读GLS文档: https://www.bluetooth.org/zh-/规格/采用的规格-> GLS-> PDF,以获取有关葡萄糖服务和记录访问控制点格式的更多信息.

Read the GLS documentation: https://www.bluetooth.org/en-us/specification/adopted-specifications -> GLS -> PDF for more information about Glucose Service and Record Access Control Point format.

这篇关于从通知特征读取(离子-蓝牙)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆