summaryrefslogtreecommitdiff
path: root/sensor/thermostat.ino
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2018-04-03 20:56:09 +0100
committerdakkar <dakkar@thenautilus.net>2018-04-03 20:56:09 +0100
commit4b144f303f0e36a9dd21e88d360193c960ee1572 (patch)
tree17567785a3fed7090d1145dccd89cfaeb0da2a7a /sensor/thermostat.ino
parenttrying to do BLE (diff)
downloadthermostat-4b144f303f0e36a9dd21e88d360193c960ee1572.tar.gz
thermostat-4b144f303f0e36a9dd21e88d360193c960ee1572.tar.bz2
thermostat-4b144f303f0e36a9dd21e88d360193c960ee1572.zip
show more progress info
Diffstat (limited to 'sensor/thermostat.ino')
-rw-r--r--sensor/thermostat.ino16
1 files changed, 15 insertions, 1 deletions
diff --git a/sensor/thermostat.ino b/sensor/thermostat.ino
index ba98158..52eb4b0 100644
--- a/sensor/thermostat.ino
+++ b/sensor/thermostat.ino
@@ -69,13 +69,27 @@ uint32_t send_data_and_get_time(BLEAddress* pAddress,String* data) {
BLEClient* pClient = BLEDevice::createClient();
show("Sc");
pClient->connect(*pAddress);
- show("SC");
+ String status = "SC";
+ status += pClient->getPeerAddress().toString().c_str();
+ show(status);
BLERemoteService* pThermoService = pClient->getService(thermo_service_uuid);
+ if (!pThermoService) {
+ show("NO SERVICE");
+ return 60;
+ }
BLERemoteCharacteristic* pTemp = pThermoService->getCharacteristic(thermo_temp_uuid);
+ if (!pTemp) {
+ show("NO TEMP CHAR");
+ return 60;
+ }
show("SCw");
pTemp->writeValue(data->c_str(),data->length());
show("SCWr");
BLERemoteCharacteristic* pTime = pThermoService->getCharacteristic(thermo_time_uuid);
+ if (!pTime) {
+ show("NO TIME CHAR");
+ return 60;
+ }
std::string next_time = pTime->readValue();
show("SCWRd");
pClient->disconnect();