Releases: grandeurdev/arduino-sdk
V1.0.6: Support for PlatformIO is added.
Minor bugs in ESP-12E and PlatformIO are fixed.
Solves the recent ESP8266 crashing issue.
The issue was being caused by the internal EventEmitter::once
function prototype specifying return value as bool
but not returning anything at all.
Examples crashing because of .c_str()
on const char*
variables are also updated.
Docs are fully updated.
This release was all about updating the Readme.md docs with the new features that have been coming in with the last few releases.
A minor addition is however done. Grandeur::Project::loop
function used to require a Valve
, or as you can say, a Boolean statement that, if evaluates to true, runs the SDK, and otherwise (if false) stops it from running, in the current loop. That Valve is no longer a requirement. You can simply wrap the Grandeur::Project::loop
in an if-statement as well. The following two codes are equivalent in every way:
Grandeur::Project project;
void loop() {
project.loop(WiFi.isConnected == true);
}
Grandeur::Project project;
void loop() {
if(WiFi.isConnected == true) project.loop();
}
Issue connecting on new ESP32 is resolved.
Merge pull request #29 from grandeurtech/v1.0.3 Issue connecting on new ESP32 because of outdated websockets library is resolved
Class hierarchies, simplified get/set callbacks for data, and modular event emitter based implementation
This release introduces the following major changes out of which 2 and 3 could be breaking for your code.
1. Event Emitter based Implementation
We've removed the buggy event table and event queue and replaced them with the Node.js styled event emitter to keep the SDKs more integrated and consistent.
2. Class Hierarchies
All classes are now in hierarchical structure. Project class is now Grandeur::Project and Device class is now Grandeur::Project::Device.
3. device.data().get()
and device.data().set()
callbacks simplified
Callbacks to device.data().get()
and device.data().set()
now support the same structure as that of device.data().on()
, i.e.:
// Two overloads for device.data().on() callback:
void onCallback(const char* path);
void onCallback(const char* path, Var data);
// Two overloads for device.data().get() callback:
void getCallback(const char* code);
void getCallback(const char* code, Var data);
// Two overloads for device.data().set() callback:
void setCallback(const char* code);
void setCallback(const char* code, Var data);
path
in device.data().on()
callback refers to the data path at which the update occurred. code
in device.data().get()
and
device.data().set()
refers to the success code of whether the data is successfully fetched or updated, respectively. This means using JSON Object in your Sketch to get and validate code and get data would no longer be a requirement, you'll only have to learn it if you want your data
to be a JSON Object.
4. Examples are updated
Examples are updated to support the Var and Callback ideologies.
Dynamic types, pattern subscribing. and more.
Apart from improving Message Queuing when the device is not connected with Grandeur this release introduces the following major changes:
1. Dynamic Type Var
We added a dynamic type Var
. You can literally do the following in your arduino sketch now:
Var x = true;
Serial.printf("I am a bool: %d.\n", x);
x = 75;
Serial.printf("I am an int: %d.\n", x);
x = "I am a string";
Serial.println(x);
You can use Var
to store JSON objects as well:
Var json;
json["current"] = 10;
json["voltage"]["vpp"] = 440;
json["voltage"]["vpeak"] = 220;
Serial.println(JSON.stringify(json));
/** Prints:
{
"current": 10,
"voltage": {
"vpp": 440.
"vpeak": 220
}
}
*/
2. Update in callback for device.data().on()
function
device.data().on()
function now accepts callback function of void(*)(Var data, const char* path)
type not void(*)(JSONObject)
. In place of Var
, you can use any type (int
, const char*
, String
, bool
, etc). device.data().get()
and device.data().set()
still accept callback function of void(*)(JSONObject)
type.
void handleUpdate(int voltage, const char* path) {
Serial.printf("%s got updated. New voltage is: %d.\n", path, voltage);
}
device.data().on("voltage", handleUpdate);
3. Pattern Subscribing
You can now pattern subscribe device variables. For example, for following device data:
{ "voltage": { "vpp": 440, "vpeak": 220 }, "current": 10 }
You can subscribe to both vpp
and vpeak
by subscribing to the parent, voltage
, that is, by doing:
device.data().on("voltage", /**UpdateHandler**/)
New naming psychology: Grandeur Cloud → Grandeur.
We've updated the naming psychology throughout the platform including all SDKs.
ESP8266 issue caused by solving compile issue for ESP32 is solved.
We created the last release by updating the websockets library to solve the ESP32 compiling issue. But because of the new update, ESP8266 got unable to connect to the cloud because of an SSL error. This release solves that.
Now available for ESP32
Breaking Changes:
Device ID is now accepted in device()
function of Project
class instead of apollo.init()
. The reason for doing this is that the object of Project
class (created on apollo.init()
) refers to your whole project on Grandeur Cloud, not just your device scope. Go through the documentation for a clear view of the updated functions.
Bugs resolved:
- ESP32 compile error is resolved.
- ESP32 examples are added.
- README.md is improved.