jrowberg / bglib

BGLib implementation for Bluegiga BLE Bluetooth Smart modules
Other
240 stars 170 forks source link

TX Power #23

Closed morrowyn closed 8 years ago

morrowyn commented 8 years ago

How do i retrieve the tx power using the bglib?

jrowberg commented 8 years ago

It is not possible to read the current power; the API does not provide a method for doing this. It is only possible to set the power. However, the module never changes the power on its own, so it will always be whatever you set it to last (starting with the <txpower> tag in hardware.xml).

morrowyn commented 8 years ago

Sorry, I meant how do I retrieve the txpower from the ble advertisements using the bled112_scanner.py from the help it seems i only can get the following: 't' (Unix time):\t1364699464.574, 1364699591.128, etc. 'r' (RSSI value):\t-57, -80, -92, etc. 'p' (Packet type):\t0 (advertisement), 4 (scan response) 's' (Sender MAC):\t000780535BB4, 000780814494, etc. 'a' (Address type):\t0 (public), 1 (random) 'b' (Bond status):\t255 (no bond), 0 to 15 if bonded 'd' (Data payload):\t02010603030918, etc.

jrowberg commented 8 years ago

If the power is present in advertisement data (which is not at all guaranteed), then it will be in a properly formed advertisement field contained in the data payload. The value 02010603030918 in your example contains two fields:

There are no other fields to work with. This is the only way to get ad payload data; the Bluetooth LE specification contains more information about different advertisement field types and their formats/values.