如何使用BLE GATT显示动态数据集 [英] How to use BLE GATT to show dynamic sets of data

查看:68
本文介绍了如何使用BLE GATT显示动态数据集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的目标是这样的:我在通过某种P2P网络连接的现场中有一堆传感器.在现场的一侧,我有一台提供BLE服务器的设备,该设备可在控制器(电话或笔记本电脑)与现场的所有设备之间桥接数据.

My goal is this: I have a bunch of sensors out in a field connected in a sort of P2P network. On one side of the field I have a device that provides a BLE server to bridge data between a controller (phone or laptop) and all the devices out in the field.

其中一项要求是一种网络可视化和管理服务.棘手的是,现场存在数量不定的设备.

One of the requirements is a sort of network visualization and management service. The gotcha with this is that there are a variable number of devices out in the field.

我有一个计划,使桥接设备将广播发送到网络,以连接所有设备.我唯一的问题是,我一般来说对BLE和GATT还是比较陌生,我不确定显示具有动态长度的数据列表的标准是什么.

I have a plan to have the bridge device send a broadcast out to the network to get all the devices connected. My only problem is that I'm relatively new to BLE and GATT in general and I'm not certain what the standard is for showing a list of data with a dynamic length.

有这样的标准吗?你们中的任何人有什么技巧可以帮助我全神贯注于如何将其组织成GATT吗?

Is there such a standard? Do any of you have any tips to help me wrap my head around how to organize this into a GATT?

感谢您的帮助

推荐答案

据我所知,BLE和GATT没有任何适合您要求的最佳实践或模式.所以你必须自己动手.

To the best of my knowledge, BLE and GATT don't have any best practice or pattern that would fit your requirement. So you have to roll your own.

一种选择是实现请求-响应协议:控制器将请求发送到BLE服务器(例如,请求传感器17的数据),然后服务器用数据进行响应.

An option would be to implement a request–response protocol: The controller sends a request to the BLE server (e.g. requesting the data for sensor 17) and the server responds with the data.

按照GATT的术语,服务器提供具有两个特征的服务:

In GATT terms, the server provides a service with two characteristics:

  1. 请求特征(可写)

响应特征(可通过通知读取)

The response characteristic (readable with notifications)

为了与服务器通信,控制器连接到服务器并激活有关 response 特性的通知.然后它将请求写入 request 特征,并等待 response 特征的更新.

For communication with the server, the controller connects to the server and activates notifications for the response characteristics. Then it writes the request to the request characteristic and waits for an update on the response characteristic.

由于BLE具有低带宽,因此您应该使用紧凑的二进制协议(而不是JSON或XML).

As BLE has a low bandwidth, you should use a compact, binary protocol (and not JSON or XML).

这篇关于如何使用BLE GATT显示动态数据集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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