-
Notifications
You must be signed in to change notification settings - Fork 82
Implementation of the Shadow Thing mechanism on the device side #36
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
Implementation of the Shadow Thing mechanism on the device side #36
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request looks generally good to me, however, some minor changes are recommended.
I gave a quick look at this, it looks good the only thing I would recommend is that we use a more human friendly way to specify the syncronisation policy i.e. AUTO_SYNC , FORCE_CLOUD_SYNC, FORCE_DEVICE_SYNC could become something lighter like CLOUD_WINS |
Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good by me ;)
…assed to the property is based on syncMode parameter
Co-Authored-By: ilcato <ilcato@yahoo.com>
Co-Authored-By: ilcato <ilcato@yahoo.com>
Co-Authored-By: ilcato <ilcato@yahoo.com>
Restored the initial order of the call sequence. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this workflow works better.
As @ilcato noticed we had things a bit wrong when it came to implementing a fallback :)
If @lxrobotics and @facchinm are good with this I'd merge it into master without yet making a new release |
@ubidefeo I'm good with the changes 👍 |
hi @lxrobotics @ilcato |
It allows the synchronization of property values between cloud and devices, at startup or after a disconnection period, based on synchronization policies configurable at the property level.
It adds a new parameter to the
addProperty
method that specify the synchronization mode to adopt for the property. This parameter is a callback function that will specify the synchronization logic to use. Standard synchronization logic is available by using the following callbacks:A custom synchronization logic may be implemented by setting a custom callback function with the following signature:
void (*)(ArduinoCloudProperty<T> property)
; use one of the specific types supported. The property object exposes several methods which will enable the custom logic to select the appropriate value.Example: assuming a Switch boolean READ_WRITE property is defined the following statement in
thingProperties.h
will specify an AUTO_SYNC mode:ArduinoCloud.addProperty(Switch, READWRITE, ON_CHANGE, onSwitchChange, AUTO_SYNC);