Add immediate parameter to BLE connection commands. (#1137)
* Add immediate parameter to BLE connection commands.
When sending a command to read/write a characteristic on a BLE server this adds a new parameter to cause the action to be
performed immediately. This will stop the scan in progress to perform the actions queued.
Example use:
```
mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoBT/config -m '{
"ble_write_address":"AA:BB:CC:DD:EE:FF",
"ble_write_service":"cba20d00-224d-11e6-9fb8-0002a5d5c51b",
"ble_write_char":"cba20002-224d-11e6-9fb8-0002a5d5c51b",
"ble_write_value":"TEST",
"value_type":"STRING",
"ttl":4,
"immediate":true }'
```
Stop BLE processing when immeditate command sent.
* Use a shorter connection timeout.
* Update docs.
* Remove MQTT spam for connection retrys
* Prevent crashing when the normal connection process occurs at the same time as an immediate action.
* Use a semaphore to protect BLE device vector.
This commit is contained in:
1 parent
8d793a8b50
commit
5dac1a7035
4 files changed
+121
-53
No files matched your search
@@ -12,7 +12,10 @@ class zBLEConnect {
|
||||
public:
|
||||
NimBLEClient* m_pClient;
|
||||
TaskHandle_t m_taskHandle = nullptr;
|
||||
zBLEConnect(NimBLEAddress& addr) { m_pClient = NimBLEDevice::createClient(addr); }
|
||||
zBLEConnect(NimBLEAddress& addr) {
|
||||
m_pClient = NimBLEDevice::createClient(addr);
|
||||
m_pClient->setConnectTimeout(5);
|
||||
}
|
||||
virtual ~zBLEConnect() { NimBLEDevice::deleteClient(m_pClient); }
|
||||
virtual bool writeData(BLEAction* action);
|
||||
virtual bool readData(BLEAction* action);
|
||||
|
||||
Reference in new issue
Block a user