This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
configuration:bluetooth-low-energy-ble [2020/06/04 10:27] dodenhoeft created |
configuration:bluetooth-low-energy-ble [2021/08/04 09:14] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Bluetooth Low Energy ====== | ====== Bluetooth Low Energy ====== | ||
+ | Bluetooth is a standardized protocol for sending and receiving data via a 2.4GHz wireless link. It's a secure protocol, and it's perfect for short-range, low-power, low-cost, wireless transmissions between electronic devices. | ||
- | Since Software version 4.4.0.100 all netmodule device supports Bluetooth Low Energy via SDK. The following step by step description will guide you to configure a BLE Scanner on a NB800. | + | {{:configuration:ble1.png?600|}} |
- | ===== Step 1 Change Bluetooth Mode ===== | + | Since Software version 4.4.0.100 all netmodule device support Bluetooth Low Energy via SDK. The following step by step description will guide you to configure a BLE Scanner on a NB800. |
- | Since the latest version 4.4.0.100 all netmodule device provide a Bluetooth Interface on the WEB - GUI. For using Bluetooth via SDK you need to change mode from "Virtualisation" to "SDK" environment: | + | ===== Step 1. Change Bluetooth Mode ===== |
+ | For using bluetooth via SDK you need to enable the interface for the SDK environment via the WEB GUI: | ||
- | Step 2 Run Script | + | {{:configuration:ble.png|}} |
+ | ===== Step 2. Run Script ===== | ||
- | Afterwards you can run the following BLE Script, which is scanning available BLE Tags in the surroundings. | + | Afterwards you can run the following BLE Script. The script is scanning the surrounded available BLE device/tags and will show you the bluetooth advertising data. It will stop automatically after 20 detected devices/tags. |
+ | <code - BLE_Scan.are> | ||
- | '' | ||
nb_bt_mode(BT1, BT_MODE_SCAN); | nb_bt_mode(BT1, BT_MODE_SCAN); | ||
for (i = 0; i < 20; i++) { | for (i = 0; i < 20; i++) { | ||
+ | | ||
devices = nb_bt_dev_list(BT1); | devices = nb_bt_dev_list(BT1); | ||
printf("%d: %d\n", i, length(devices)); | printf("%d: %d\n", i, length(devices)); | ||
for (d = 0; d < length(devices); d++) { | for (d = 0; d < length(devices); d++) { | ||
dev_info = nb_bt_dev_info(BT1, devices[d]); | dev_info = nb_bt_dev_info(BT1, devices[d]); | ||
- | dump(dev_info); | ||
| | ||
} | } | ||
sleep(1); | sleep(1); | ||
} | } | ||
- | nb_bt_mode(BT1, BT_MODE_OFF);'' | + | nb_bt_mode(BT1, BT_MODE_OFF); |
+ | </code> | ||
+ | |||
+ | For more BLE SDK functionality, please check our [[https://share.netmodule.com/public/system-software/latest/NB_SDK_API_Manual.pdf|SDK API]] | ||
+ | |||
+ | You can check the available data details of the surrounded beacons with adding "dump(dev_info);" into the FOR Loop.The Output will look this: | ||
+ | |||
+ | <code - dump(dev_info); Output > | ||
+ | struct(15): { | ||
+ | .Name = string[12]: "ThermoBeacon" | ||
+ | .Trusted = bool: false | ||
+ | .Adapter = int: 0 | ||
+ | .LegacyPairing = bool: false | ||
+ | .Paired = bool: false | ||
+ | .ServicesResolved = bool: false | ||
+ | .Alias = string[12]: "ThermoBeacon" | ||
+ | .Connected = bool: false | ||
+ | .ManufacturerData = array(1): { | ||
+ | [0] struct(2): { | ||
+ | .Value = array(20): { | ||
+ | [0] int: 0 | ||
+ | [1] int: 0 | ||
+ | [2] int: 140 | ||
+ | [3] int: 7 | ||
+ | [4] int: 0 | ||
+ | [5] int: 0 | ||
+ | [6] int: 71 | ||
+ | [7] int: 233 | ||
+ | [8] int: 126 | ||
+ | [9] int: 1 | ||
+ | [10] int: 238 | ||
+ | [11] int: 13 | ||
+ | [12] int: 0 | ||
+ | [13] int: 0 | ||
+ | [14] int: 252 | ||
+ | [15] int: 0 | ||
+ | [16] int: 167 | ||
+ | [17] int: 140 | ||
+ | [18] int: 0 | ||
+ | [19] int: 0 | ||
+ | } | ||
+ | .Key = int: 17 | ||
+ | } | ||
+ | } | ||
+ | .Address = string[17]: "E9:47:00:00:07:8C" | ||
+ | .Blocked = bool: false | ||
+ | .RSSI = int: -68 | ||
+ | .Addresstype = string[6]: "public" | ||
+ | .UUIDs = array(1): { | ||
+ | [0] string[36]: "0000fff0-0000-1000-8000-00805f9b34fb" | ||
+ | } | ||
+ | .TxPower = int: 0 | ||
+ | } | ||
+ | </code> |