From 813419722c8960981e3ee208a39e952924fc85cf Mon Sep 17 00:00:00 2001 From: Michael Stegeman Date: Mon, 13 Apr 2020 07:59:02 -0800 Subject: [PATCH] Fix string property change notifications. Fixes #2479 --- Thing.h | 7 ++++++- examples/AsyncProperty/AsyncProperty.ino | 2 ++ examples/BME280/BME280.ino | 2 ++ examples/RGBLamp/RGBLamp.ino | 2 ++ library.json | 2 +- library.properties | 2 +- 6 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Thing.h b/Thing.h index ac9f94e..abec5db 100644 --- a/Thing.h +++ b/Thing.h @@ -226,6 +226,11 @@ class ThingItem { this->hasChanged = true; } + void setValue(const char *s) { + *(this->getValue().string) = s; + this->hasChanged = true; + } + /** * Returns the property value if it has been changed via {@link setValue} * since the last call or returns a nullptr. @@ -603,7 +608,7 @@ class ThingDevice { break; } case STRING: - *(property->getValue().string) = newValue.as(); + property->setValue(newValue.as()); property->changed(property->getValue()); break; } diff --git a/examples/AsyncProperty/AsyncProperty.ino b/examples/AsyncProperty/AsyncProperty.ino index 4890844..cd9d630 100644 --- a/examples/AsyncProperty/AsyncProperty.ino +++ b/examples/AsyncProperty/AsyncProperty.ino @@ -3,6 +3,8 @@ * thing-url-adapter. */ +#define LARGE_JSON_BUFFERS 1 + #include #include #include diff --git a/examples/BME280/BME280.ino b/examples/BME280/BME280.ino index c7fd349..f8056f4 100644 --- a/examples/BME280/BME280.ino +++ b/examples/BME280/BME280.ino @@ -27,6 +27,8 @@ updates: dh, kg 2018 */ +#define LARGE_JSON_BUFFERS 1 + #include #include #include diff --git a/examples/RGBLamp/RGBLamp.ino b/examples/RGBLamp/RGBLamp.ino index b196289..49cdbff 100644 --- a/examples/RGBLamp/RGBLamp.ino +++ b/examples/RGBLamp/RGBLamp.ino @@ -10,6 +10,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#define LARGE_JSON_BUFFERS 1 + #include #include #include diff --git a/library.json b/library.json index a2d180b..16bc64f 100644 --- a/library.json +++ b/library.json @@ -2,7 +2,7 @@ "name": "webthing-arduino", "description": "A library for creating Web Things using the Web of Things API. Runs on ESP8266, ESP32, Ethernet, and WiFi101-compatible boards. Compatible with the Mozilla WebThings Gateway.", "keywords": "Communication", - "version": "0.11.2", + "version": "0.11.3", "authors": { "name": "Mozilla IoT " }, diff --git a/library.properties b/library.properties index cf20a2e..458dfcd 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=webthing-arduino -version=0.11.2 +version=0.11.3 author=Mozilla IoT maintainer=James Hobin sentence=A library for creating Web Things using the Web of Things API