Skip to content

Fix string property change notifications. #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion Thing.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -603,7 +608,7 @@ class ThingDevice {
break;
}
case STRING:
*(property->getValue().string) = newValue.as<String>();
property->setValue(newValue.as<const char *>());
property->changed(property->getValue());
break;
}
Expand Down
2 changes: 2 additions & 0 deletions examples/AsyncProperty/AsyncProperty.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* thing-url-adapter.
*/

#define LARGE_JSON_BUFFERS 1

#include <Arduino.h>
#include <Thing.h>
#include <WebThingAdapter.h>
Expand Down
2 changes: 2 additions & 0 deletions examples/BME280/BME280.ino
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
updates: dh, kg 2018
*/

#define LARGE_JSON_BUFFERS 1

#include <Arduino.h>
#include <BME280.h>
#include <BME280I2C.h>
Expand Down
2 changes: 2 additions & 0 deletions examples/RGBLamp/RGBLamp.ino
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

#define LARGE_JSON_BUFFERS 1

#include <Arduino.h>
#include <Thing.h>
#include <WebThingAdapter.h>
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"
},
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=webthing-arduino
version=0.11.2
version=0.11.3
author=Mozilla IoT <[email protected]>
maintainer=James Hobin <[email protected]>
sentence=A library for creating Web Things using the Web of Things API
Expand Down