Skip to content

Allow an optional encoding of the timestamp in the CBOR message #137

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 6 commits into from
Jun 9, 2020

Conversation

aentinger
Copy link
Contributor

@aentinger aentinger commented Jun 8, 2020

In order to enable the encoding of the timestamp you can've got to call encodeTimestamp() when adding the property to the cloud within thing_properties.h.

ArduinoCloud.addProperty(seconds, Permission::Read).publishOnDemand().encodeTimestamp();

In order to set the timestamp of the property you call

seconds_timestamp = seconds; /* = 45 in below CBOR */
ArduinoCloud.setTimestamp("seconds", seconds_timestamp);

This is the resulting CBOR

[{0: "seconds", 2: 45, 6: 45}]

@zmoog @manchoz 👋

@aentinger aentinger self-assigned this Jun 8, 2020
@aentinger aentinger added the type: enhancement Proposed improvement label Jun 8, 2020
@codecov-commenter
Copy link

codecov-commenter commented Jun 9, 2020

Codecov Report

Merging #137 into master will decrease coverage by 0.60%.
The diff coverage is 78.37%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #137      +/-   ##
==========================================
- Coverage   96.15%   95.55%   -0.61%     
==========================================
  Files          30       29       -1     
  Lines         988      989       +1     
==========================================
- Hits          950      945       -5     
- Misses         38       44       +6     
Impacted Files Coverage Δ
src/property/Property.h 90.47% <ø> (-9.53%) ⬇️
src/property/Property.cpp 86.16% <36.36%> (-3.17%) ⬇️
src/property/PropertyContainer.cpp 89.58% <95.45%> (+2.31%) ⬆️
src/cbor/ArduinoCloudThing.cpp 96.07% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 419fd32...4959e2b. Read the comment docs.

@arduino-libraries arduino-libraries deleted a comment from github-actions bot Jun 9, 2020
@aentinger aentinger force-pushed the encode-timestamp-opt branch from 5b2ce06 to 4959e2b Compare June 9, 2020 05:37
@arduino-libraries arduino-libraries deleted a comment from github-actions bot Jun 9, 2020
@aentinger
Copy link
Contributor Author

Successfully tested on PROD with

  • Nano 33 IoT ✔️

@aentinger aentinger marked this pull request as ready for review June 9, 2020 05:43
@github-actions
Copy link

github-actions bot commented Jun 9, 2020

Memory usage change @4959e2b08c24e22de72a9ee5ce26f37de7a48c3e

FQBN Flash Usage RAM For Global Variables
arduino:samd:mkr1000 🔺 +32 💚 -8
arduino:samd:mkrgsm1400 🔺 +32 💚 -8
arduino:samd:mkrnb1500 🔺 +32 💚 -8
arduino:samd:mkrwan1300 🔺 +56 💚 -12
arduino:samd:mkrwifi1010 🔺 +32 💚 -8
arduino:samd:nano_33_iot 🔺 +32 💚 -8
esp8266:esp8266:huzzah 🔺 +16 💚 -8

@aentinger aentinger merged commit 1ee31e5 into master Jun 9, 2020
@aentinger aentinger deleted the encode-timestamp-opt branch June 9, 2020 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants