我最近开始学习开发一个基于镜像控制器的设备,它将有BLE模块。该设备应该将从传感器获取的模拟读数发送到我将要开发的android应用程序。
就我所研究的关贸总协定的运作方式而言:
问题:
我正在使用this BlueGiga BLE112 Module进行开发。
到目前为止,我编写的gatt.xml文件是:
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<!-- 1800: org.bluetooth.service.generic_access -->
<service uuid="1800" id="generic_access">
<description>Generic Access</description>
<!-- 2A00: org.bluetooth.characteristic.gap.device_name -->
<characteristic uuid="2A00" id="c_device_name">
<description>Device Name</description>
<properties read="true" const="true" />
<value>MyBLEDev</value>
</characteristic>
<!-- 2A01: org.bluetooth.characteristic.gap.appearance -->
<characteristic uuid="2A01" id="c_appearance">
<description>Appearance</description>
<properties read="true" const="true" />
<value type="hex">0300</value>
</characteristic>
</service>
<!-- custom service -->
<service uuid="624e957f-cb42-4cd6-bacc-84aeb898f69b" advertise="true">
<description>Custom Device Service</description>
<!-- custom write-only characteristic for Client to send commands to fetch reading -->
<characteristic uuid="a57892fe-4f58-97d4-a5245-78a4125d3e6" id="c_cmd_TxReading">
<description>Request for Reading</description>
<properties write="true" />
<value length="4" />
</characteristic>
<characteristic uuid="8fde302a-56ac-b289-65ed-a577ed66b89c" id="c_reading">
<description>Measurement</description>
<properties read="true" write="true" />
<value length="4" type="float32" />
</characteristic>
</service>
发布于 2014-05-20 13:25:30
我看到GATT服务器就像另一台机器上的一块内存。您可以通过句柄请求特定的块,并获得不同的信息。通过将值写入这些句柄,您可以让另一台机器执行不同的操作或以不同的方式作出响应。与内存空间不同的是,每个句柄可以包含不同大小的信息,每个句柄都有一个UUID来标识如何解释在其中找到的数据。在固定的内存空间中,每个“句柄”将是一个地址,每个块将是一个字节,没有其他信息就无法理解如何解释该数据。
所以..。问题:
1. You can't really define your own commands with GATT. You're restricted to things like "read from handle" or "write to handle" similar to manipulating a chunk of memory. The underlying implementation can be dependent on the hardware, but usually you can trigger some sort of event when a handle is manipulated.
2. You can requests events by subscribing to notifications or indications on a particular attribute.
https://stackoverflow.com/questions/23735307
复制相似问题