I'm trying to make the TI SensorTag (cc2650) connectionless (just constantly advertise sensor, like accelerometer, readings).
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.
Here is the advertising data format as shown in the BLE 4.2 Core Spec, Vol 3, Part C, 11.1.
Here what is interesting you is the last nested part, the AD Type and AD Data, and of course the length of these.
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.
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.
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 :
- You can put your data in advertData[]
- The GAP Type looks like GAP_ADTYPE_MANUFACTURER_SPECIFIC
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.
Since you are using TI Stack, please find Simple BLE Observer & Simple BLE Broadcaster examples. If you don't want to create connection to the device it should be the way to go.
As stated in TI documentation
Observer is basically a device which scans for advertisement messages
but cannot initiate connections. On the other hand, a Broadcaster is a
device which sends advertisement messages but non-connectable.
You will find all that you need in example documentation and source code comments.