bglib
bglib copied to clipboard
TinyDuino BGLib_stub_slave.ino and ble_cmd_gap_set_adv_data
Hi there, not sure if this is the right place to put this, but here goes.
I'm developing a simple sketch for a TinyDuino with the BLE rev2 board based on the BGLib_stub_slave found here:
http://tiny-circuits.com/learn/using-the-bluetooth-low-energy-tinyshield/
I've adjusted the adv_data to be 30 bytes long, however, when I call
ble112.ble_cmd_gap_set_adv_data(0, 0x1e, adv_data);
none of my devices detect BLE packets from the device. Only when I lower it from 0x1e to 0x1c does the data get (mostly) advertised; obviously, 0x1c cuts off the last two bytes of my data. I'm a mobile app dev by trade, so I'm not familiar with BlueGiga or C++ (which is what it looks like the BGLib is written in), but looking at the code it appears a byte or three are added to the front of the payload to account for length, or some sort of BLE command. Since advertising packets are limited to 31 bytes, I believe that's what's cutting off my packet... how can I fix this issue? I was considering adjusting the BGLib::ble_cmd_gap_set_adv_data or BGLib::sendCommand methods in some way, but I have no idea what I'm doing, so it'd just be trial and error. Am I doing something wrong? Is this use case not supported? How can I get this working?
The company sponsored BGLib is straight C. I've created an example which sets up a BlueGiga in advertisement mode with user data. It is using the BGLib that Jeff created for Python. However, the code looks very, very similar to the C and with some effort you can figure it out, at least to see the sequence of events and sample parameters.
The example is in my fork at: https://github.com/mjbrown/bglib/blob/master/Python/Examples/bglib_test_advertising.py
An example of reading the received advertising data is at: https://github.com/mjbrown/bglib/blob/master/Python/Examples/bglib_test_attribute_write.py
Hello, I have a project to advertise the packets through bluegiga ble112 bluettoth in c# and read the data from the client. Any idea how to do it? please help