-
Notifications
You must be signed in to change notification settings - Fork 10
Conversation
Travis tests have failedHey @mirkokurt, 1st Buildmake
2nd Buildfind . -regextype posix-extended -path './.git' -prune -or -path './src/lib' -prune -or -path './test/external' -prune -or \( -iregex '.*\.((ino)|(h)|(hpp)|(hh)|(hxx)|(h\+\+)|(cpp)|(cc)|(cxx)|(c\+\+)|(cp)|(c)|(ipp)|(ii)|(ixx)|(inl)|(tpp)|(txx)|(tpl))$' -and -type f \) -print0 | xargs -0 -L1 bash -c 'if ! diff "$0" <(astyle --options=${HOME}/astyle/examples_formatter.conf --dry-run < "$0"); then echo "Non-compliant code formatting in $0"; false; fi'
TravisBuddy Request Identifier: 6d1159a0-1b62-11ea-b9ce-6f43500ed087 |
Travis tests have failedHey @mirkokurt, 1st Buildmake
TravisBuddy Request Identifier: 219fa960-1b65-11ea-b9ce-6f43500ed087 |
Codecov Report
@@ Coverage Diff @@
## master #48 +/- ##
==========================================
+ Coverage 96.19% 96.28% +0.08%
==========================================
Files 24 24
Lines 815 861 +46
==========================================
+ Hits 784 829 +45
- Misses 31 32 +1
Continue to review full report at Codecov.
|
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.
Hi @mirkokurt 👋 I have a very hard time understanding the changes done within this PR. Please outline how the CBOR protocol was extended/changed and why.
Also I've got a esspecially a big problem with test code were the comment was changed but the actual byte array was not changed (here) with a commit message saying Fix unit tests
. Why were those tests fixed? I'm looking at magic numbers without explanation in the test code. This is unacceptable.
When writing any code please keep in mind that code is written for your fellow programmers first and for the machine second.
src/ArduinoCloudProperty.cpp
Outdated
@@ -23,12 +23,7 @@ | |||
#endif | |||
|
|||
static unsigned long getTimestamp() { | |||
#ifdef ARDUINO_ARCH_SAMD |
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.
Why was the content of this function deleted?
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.
Now the code is restored.
Hi @mirkokurt 👋 I have a very hard time understanding the changes done within this PR. Please outline how the CBOR protocol was extended/changed and why.
Also I've got a esspecially a big problem with test code were the comment was changed but the actual byte array was not changed (here) with a commit message saying
Fix unit tests
. Why were those tests fixed? I'm looking at magic numbers without explanation in the test code. This is unacceptable.When writing any code please keep in mind that code is written for your fellow programmers first and for the machine second.
Hi @lxrobotics, I added many comments in the code to help programmers understanding how the library encode and decode the cbor messages when the option of using "light payloads" has been activated. I also updated the PR description to better explain the purpose of the implementation.
Regarding the commit Fix unit tests
, there are two kind of fixes in the commit:
the first kind is a logic fix:
eg:
-thing.addPropertyReal(color_test, "test", Permission::ReadWrite);
+thing.addPropertyReal(color_test, "test", Permission::ReadWrite, 1);
the addPropertyReal method was invoked without an identifier assigned to the property. So the test was not well written.
The second kind is a fix in the comment that was previously wrong in respect of the byte array.
eg:
-/* [{0: "test", 4: false}] = 81 A2 00 01 04 F4 /
+/ [{0: 1, 4: false}] = 81 A2 00 01 04 F4 */
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.
Why was the content of this function deleted?
By mistake. Now the code is restored.
Travis tests have failedHey @mirkokurt, 1st Buildfind . -regextype posix-extended -path './.git' -prune -or -path './src/lib' -prune -or -path './test/external' -prune -or \( -iregex '.*\.((ino)|(h)|(hpp)|(hh)|(hxx)|(h\+\+)|(cpp)|(cc)|(cxx)|(c\+\+)|(cp)|(c)|(ipp)|(ii)|(ixx)|(inl)|(tpp)|(txx)|(tpl))$' -and -type f \) -print0 | xargs -0 -L1 bash -c 'if ! diff "$0" <(astyle --options=${HOME}/astyle/examples_formatter.conf --dry-run < "$0"); then echo "Non-compliant code formatting in $0"; false; fi'
2nd Buildcodespell --skip="${TRAVIS_BUILD_DIR}/.git","${TRAVIS_BUILD_DIR}/src/lib","${TRAVIS_BUILD_DIR}/test/external" --ignore-words="${TRAVIS_BUILD_DIR}/extras/codespell-ignore-words-list.txt" "${TRAVIS_BUILD_DIR}"
TravisBuddy Request Identifier: 9383c9c0-1c15-11ea-ba59-e12deadb3a4c |
Travis tests have failedHey @mirkokurt, 1st Buildfind . -regextype posix-extended -path './.git' -prune -or -path './src/lib' -prune -or -path './test/external' -prune -or \( -iregex '.*\.((ino)|(h)|(hpp)|(hh)|(hxx)|(h\+\+)|(cpp)|(cc)|(cxx)|(c\+\+)|(cp)|(c)|(ipp)|(ii)|(ixx)|(inl)|(tpp)|(txx)|(tpl))$' -and -type f \) -print0 | xargs -0 -L1 bash -c 'if ! diff "$0" <(astyle --options=${HOME}/astyle/examples_formatter.conf --dry-run < "$0"); then echo "Non-compliant code formatting in $0"; false; fi'
TravisBuddy Request Identifier: 89c3d680-1c17-11ea-ba59-e12deadb3a4c |
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.
LGTM 👍 Because of the convoluted commit history which is not really telling a story I will squash/merge this PR.
ArduinoCloudThing support for LoRaWAN boards. Due to bandwidth constraints of the LoRA protocol, a variant of the current cbor encoding will be supported with the aim of reducing messages payload when the library is used with an Arduino LoRa board.
Encoding and decoding of cbor messages now support the use of a short property identifier instead of the name of the property in order to reduce the message payload. The assignment of the short identifier must be done explicitly in the
addProperty
method for the boards that need to use light message payloads.For simple properties the integer identifier is encoded as an 8-bit integer in the cbor message.
Example
For multi value properties, also every attribute of a property has an integer identifier. The identifier is generated sequentially following the order of invocation of
appendAttributesToCloud()
andsetAttributesFromCloud()
.For multi value properties the integer identifier is encoded as a 16-bit integer, the MSB encode the attribute identifier, the LSB encode the property identifier (eg: property = 1, attribute = 1 ----> MSB: 0x01 =256, LSB: 0x01 = 1 ------> 256 + 1 = 257)
Example
To be used with:
arduino-libraries/Arduino_ConnectionHandler#11
arduino-libraries/ArduinoIoTCloud#83