如何将传感器数据嵌入TI SensorTag cc2650的广告包中? [英] How can sensor data be embedded in the advertising packet of the TI SensorTag cc2650?

查看:73
本文介绍了如何将传感器数据嵌入TI SensorTag cc2650的广告包中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使TI SensorTag(cc2650)无连接(只是不断地宣传传感器,如加速度计,读数).

I'm trying to make the TI SensorTag (cc2650) connectionless (just constantly advertise sensor, like accelerometer, readings).

在基础SensorTag项目的SensorTag.c文件中,我可以看到static uint8_t advertData[],但不确定是否可以在其中放置动态传感器数据(或者这是否是正确的方法或在哪里找到GAP_ADTYPE_*列出(如果需要).

In the SensorTag.c file in the base SensorTag project, I can see the static uint8_t advertData[] but I'm not sure if I can put dynamic sensor data in there (or if that's the right approach or where to find the GAP_ADTYPE_* list if that's needed).

推荐答案

我对此设备一无所知,所以我的回答将是相当笼统的.

I do not know anything about this device so my answer will be quite general.

是的,您可以通过广告广播传感器的数据,这样就无需连接其他设备来查看传感器的价值.

Yes you can broadcast your sensor's data through advertising, this way there is no need for the other devices to connect to see the sensor's value.

这是BLE 4.2核心规范,第3卷,C部分,11.1中显示的广告数据格式.

Here is the advertising data format as shown in the BLE 4.2 Core Spec, Vol 3, Part C, 11.1.

最有趣的是最后嵌套的部分,即AD类型和AD数据,当然还有它们的长度.

Here what is interesting you is the last nested part, the AD Type and AD Data, and of course the length of these.

基本上,您要做的是,如果值是4字节,则将长度设置为5(字节),类型为1,数据为4.

Basically what you want to do is, if you have a 4 bytes value, to set a length of 5 (bytes), 1 for the type and 4 for the data.

类型本身必须是在此定义的GAP类型之一:

The type itself must be one of the GAP types defined here : Generic Access Profile. To advertise your own data you must chose the last one, Manufacturer Specific Data, which is 0xFF.

关于您正在使用的源代码和TI堆栈,我确实无法帮助您,但是,如果它的工作方式与我使用的其他堆栈相同,那么很有可能:

Concerning your source code and the TI stack that you are using I cannot really help you, however if it works the same way than the other stacks I've used then it's very likely that :

  1. 您可以将数据放入advertData []
  2. GAP类型看起来像GAP_ADTYPE_MANUFACTURER_SPECIFIC

当然必须在某个地方指定AD结构的长度.无论您指定整个数据包的长度,还是只是告诉堆栈数据的长度(在advertData中),它都会计算(加1)AD结构的长度.

Of course the length of the AD Structure has to be specified somewhere. Whether you specify the length of the whole packet or you just tell the stack the length of your data (in advertData) and it will compute (add 1) the length of the AD Structure.

这篇关于如何将传感器数据嵌入TI SensorTag cc2650的广告包中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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