|Github Repo||C Header||C source||JS source|
This library provides a way to examine and change configuration over Generic Attribute Service (GATT) Bluetooth Low-Energy (BLE) service.
Note: Default BT configuration is permissive. See https://github.com/mongoose-os-libs/bt-common#security for a better idea.
The service UUID is
5f6d4f53-5f43-4647-5f53-56435f49445f, which is a representation of a 16-byte string
The service defines 3 characteristics (attributes):
306d4f53-5f43-4647-5f6b-65795f5f5f30 (0mOS_CFG_key___0)- a write-only attribute that selects the configuration key to be operated on. The key is a string of components separated by period, e.g.
316d4f53-5f43-4647-5f76-616c75655f31 (1mOS_CFG_value_1)- a read-write attribute that returns value of the selected key when read or accepts the value to be set. Note that value is not applied immediately after writing. Instead, consecutive writes to this key are appended to form the value to be set (this is due to small value of the default MTU and differences in how clients handle writes exceeding the MTU). For easy manual entry, attribute values are returned as strings and expected as strings as well. So, to enter value of 123, one should submit string
123, not hex value
0x7b. Boolean values should be entered as strings
326d4f53-5f43-4647-5f73-6176655f5f32 (2mOS_CFG_save__2)- a write-only attribute that applies value submitted to the value attribute to the key selected via the key attribute. The value written to this key can be one of:
0- just set the value, change will not be persisted
1- set and save the config
2- set, save and reboot
Here is an example of the configuration provisioning a device - configuring WiFi station settings (we'll use
save to abbreviate long UUIDs):
Once device is confirmed to have successfully connected to WiFi, BT config can be disabled:
bt.enableto disable Bluetooth entirely.
save# Save and reboot with BT configuration disabled.
See rpc-gatts library, which provides a GATT service that acts as an RPC channel. It accepts incoming RPC frames and can send them as well - or rather, makes them available for collection.