ArduinoIoTCloud icon indicating copy to clipboard operation
ArduinoIoTCloud copied to clipboard

Remove internal global functions and unwanted public functions

Open pennam opened this issue 2 years ago • 2 comments

Issue

To handle timezone and thing-id changes from the cloud UI the following global functions were added:

  • https://github.com/arduino-libraries/ArduinoIoTCloud/blob/6a9acc20ae4c07311ab11c46464901a9fd70dbd1/src/ArduinoIoTCloudTCP.cpp#L63
  • https://github.com/arduino-libraries/ArduinoIoTCloud/blob/6a9acc20ae4c07311ab11c46464901a9fd70dbd1/src/ArduinoIoTCloudTCP.cpp#L68

Together with other public functions that should be only used for internal purposes:

  • https://github.com/arduino-libraries/ArduinoIoTCloud/blob/6a9acc20ae4c07311ab11c46464901a9fd70dbd1/src/ArduinoIoTCloud.h#L99
  • https://github.com/arduino-libraries/ArduinoIoTCloud/blob/6a9acc20ae4c07311ab11c46464901a9fd70dbd1/src/ArduinoIoTCloud.h#L100
  • https://github.com/arduino-libraries/ArduinoIoTCloud/blob/6a9acc20ae4c07311ab11c46464901a9fd70dbd1/src/ArduinoIoTCloud.h#L101
  • https://github.com/arduino-libraries/ArduinoIoTCloud/blob/6a9acc20ae4c07311ab11c46464901a9fd70dbd1/src/ArduinoIoTCloud.h#L103

Changes

This PR removes the global functions and unwanted public methods to handle thing-id and timezone changes.

Other Info

Regarding commit https://github.com/arduino-libraries/ArduinoIoTCloud/commit/19176392365e72c653c2292c6e3f2ce08bb84453 I'm not sure if this behaviour was intended or not, but I've found out that for read-only property the cloud_value is never updated. This change allows to update the cloud_value of a read-only property allowing also the possibility to manually change the local value calling the fromCloudTiLocal() function. This is a bit hacky and not 100% correct. To fix this we should add a local update policy [manual/auto] to add the possibility to handle the property local_value update manually.

pennam avatar Oct 10 '23 07:10 pennam

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (6a9acc2) 95.00% compared to head (c15c145) 94.84%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #387      +/-   ##
==========================================
- Coverage   95.00%   94.84%   -0.16%     
==========================================
  Files          27       27              
  Lines        1220     1223       +3     
==========================================
+ Hits         1159     1160       +1     
- Misses         61       63       +2     
Files Coverage Δ
src/property/PropertyContainer.cpp 87.09% <100.00%> (+0.21%) :arrow_up:
src/property/types/CloudString.h 93.75% <0.00%> (-6.25%) :arrow_down:

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Oct 10 '23 07:10 codecov[bot]

Memory usage change @ c15c14590354664d860d5207d2ca843486981e13

Board flash % RAM for global variables %
arduino:esp32:nano_nora :small_red_triangle: +1028 - +1420 +0.03 - +0.05 :small_red_triangle: +288 - +288 +0.09 - +0.09
arduino:mbed_giga:giga :small_red_triangle: +488 - +3272 +0.02 - +0.17 :small_red_triangle: +256 - +288 +0.05 - +0.06
arduino:mbed_nano:nanorp2040connect :small_red_triangle: +324 - +3132 0.0 - +0.02 :small_red_triangle: +272 - +272 +0.1 - +0.1
arduino:mbed_nicla:nicla_vision :small_red_triangle: +480 - +3280 +0.02 - +0.17 :small_red_triangle: +256 - +288 +0.05 - +0.06
arduino:mbed_opta:opta :small_red_triangle: +480 - +3208 +0.02 - +0.16 :small_red_triangle: +256 - +288 +0.05 - +0.06
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A
arduino:renesas_portenta:portenta_c33 :small_red_triangle: +72 - +2840 0.0 - +0.14 :small_red_triangle: +256 - +288 +0.05 - +0.06
arduino:renesas_uno:unor4wifi :small_red_triangle: +304 - +464 +0.12 - +0.18 :small_red_triangle: +272 - +272 +0.83 - +0.83
arduino:samd:mkr1000 :small_red_triangle: +88 - +3536 +0.03 - +1.35 :small_red_triangle: +272 - +272 +0.83 - +0.83
arduino:samd:mkrgsm1400 :small_red_triangle: +312 - +3536 +0.12 - +1.35 :small_red_triangle: +272 - +272 +0.83 - +0.83
arduino:samd:mkrnb1500 :small_red_triangle: +88 - +3536 +0.03 - +1.35 :small_red_triangle: +272 - +272 +0.83 - +0.83
arduino:samd:mkrwan1300 :small_red_triangle: +1120 - +3168 +0.43 - +1.21 :small_red_triangle: +272 - +272 +0.83 - +0.83
arduino:samd:mkrwifi1010 :small_red_triangle: +368 - +3768 +0.14 - +1.44 :small_red_triangle: +272 - +272 +0.83 - +0.83
arduino:samd:nano_33_iot :small_red_triangle: +368 - +3768 +0.14 - +1.44 :small_red_triangle: +272 - +272 +0.83 - +0.83
esp32:esp32:esp32 :small_red_triangle: +1084 - +1400 +0.08 - +0.11 :small_red_triangle: +288 - +288 +0.09 - +0.09
esp8266:esp8266:huzzah :grey_question: -64 - +496 -0.01 - +0.05 :small_red_triangle: +272 - +272 +0.33 - +0.33
Click for full report table
Board examples/ArduinoIoTCloud-Advanced
flash
% examples/ArduinoIoTCloud-Advanced
RAM for global variables
% examples/ArduinoIoTCloud-Basic
flash
% examples/ArduinoIoTCloud-Basic
RAM for global variables
% examples/ArduinoIoTCloud-Callbacks
flash
% examples/ArduinoIoTCloud-Callbacks
RAM for global variables
% examples/ArduinoIoTCloud-Schedule
flash
% examples/ArduinoIoTCloud-Schedule
RAM for global variables
% examples/utility/ArduinoIoTCloud_Travis_CI
flash
% examples/utility/ArduinoIoTCloud_Travis_CI
RAM for global variables
% examples/ArduinoIoTCloud-DeferredOTA
flash
% examples/ArduinoIoTCloud-DeferredOTA
RAM for global variables
% examples/utility/Provisioning
flash
% examples/utility/Provisioning
RAM for global variables
% examples/utility/SelfProvisioning
flash
% examples/utility/SelfProvisioning
RAM for global variables
%
arduino:esp32:nano_nora 1112 0.04 288 0.09 1408 0.04 288 0.09 1028 0.03 288 0.09 1112 0.04 288 0.09 1420 0.05 288 0.09 1096 0.03 288 0.09
arduino:mbed_giga:giga 552 0.03 288 0.06 680 0.03 256 0.05 488 0.02 288 0.06 488 0.02 256 0.05 736 0.04 256 0.05 488 0.02 288 0.06 3272 0.17 256 0.05
arduino:mbed_nano:nanorp2040connect 350 0.0 272 0.1 480 0.0 272 0.1 324 0.0 272 0.1 350 0.0 272 0.1 502 0.0 272 0.1 352 0.0 272 0.1 3132 0.02 272 0.1 3098 0.02 272 0.1
arduino:mbed_nicla:nicla_vision 480 0.02 288 0.06 616 0.03 256 0.05 488 0.02 256 0.05 480 0.02 288 0.06 680 0.03 256 0.05 488 0.02 256 0.05 3280 0.17 256 0.05
arduino:mbed_opta:opta 544 0.03 288 0.06 672 0.03 256 0.05 480 0.02 256 0.05 480 0.02 288 0.06 744 0.04 256 0.05 480 0.02 256 0.05 3208 0.16 288 0.06
arduino:mbed_portenta:envie_m7 N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A N/A
arduino:renesas_portenta:portenta_c33 112 0.01 256 0.05 448 0.02 288 0.06 72 0.0 256 0.05 104 0.0 288 0.06 512 0.02 288 0.06 2840 0.14 256 0.05
arduino:renesas_uno:unor4wifi 320 0.12 272 0.83 448 0.17 272 0.83 304 0.12 272 0.83 336 0.13 272 0.83 464 0.18 272 0.83
arduino:samd:mkr1000 128 0.05 272 0.83 456 0.17 272 0.83 88 0.03 272 0.83 128 0.05 272 0.83 520 0.2 272 0.83 3536 1.35 272 0.83
arduino:samd:mkrgsm1400 352 0.13 272 0.83 472 0.18 272 0.83 312 0.12 272 0.83 352 0.13 272 0.83 496 0.19 272 0.83 3536 1.35 272 0.83
arduino:samd:mkrnb1500 120 0.05 272 0.83 456 0.17 272 0.83 88 0.03 272 0.83 120 0.05 272 0.83 520 0.2 272 0.83 3536 1.35 272 0.83
arduino:samd:mkrwan1300 1808 0.69 272 0.83 1440 0.55 272 0.83 3168 1.21 272 0.83 2104 0.8 272 0.83 1120 0.43 272 0.83
arduino:samd:mkrwifi1010 400 0.15 272 0.83 520 0.2 272 0.83 368 0.14 272 0.83 400 0.15 272 0.83 544 0.21 272 0.83 400 0.15 272 0.83 3768 1.44 272 0.83 3680 1.4 272 0.83
arduino:samd:nano_33_iot 400 0.15 272 0.83 520 0.2 272 0.83 368 0.14 272 0.83 400 0.15 272 0.83 544 0.21 272 0.83 400 0.15 272 0.83 3768 1.44 272 0.83 3672 1.4 272 0.83
esp32:esp32:esp32 1124 0.09 288 0.09 1396 0.11 288 0.09 1084 0.08 288 0.09 1112 0.08 288 0.09 1400 0.11 288 0.09 1120 0.09 288 0.09
esp8266:esp8266:huzzah 0 0.0 272 0.33 400 0.04 272 0.33 -64 -0.01 272 0.33 0 0.0 272 0.33 496 0.05 272 0.33
Click for full report CSV
Board,examples/ArduinoIoTCloud-Advanced<br>flash,%,examples/ArduinoIoTCloud-Advanced<br>RAM for global variables,%,examples/ArduinoIoTCloud-Basic<br>flash,%,examples/ArduinoIoTCloud-Basic<br>RAM for global variables,%,examples/ArduinoIoTCloud-Callbacks<br>flash,%,examples/ArduinoIoTCloud-Callbacks<br>RAM for global variables,%,examples/ArduinoIoTCloud-Schedule<br>flash,%,examples/ArduinoIoTCloud-Schedule<br>RAM for global variables,%,examples/utility/ArduinoIoTCloud_Travis_CI<br>flash,%,examples/utility/ArduinoIoTCloud_Travis_CI<br>RAM for global variables,%,examples/ArduinoIoTCloud-DeferredOTA<br>flash,%,examples/ArduinoIoTCloud-DeferredOTA<br>RAM for global variables,%,examples/utility/Provisioning<br>flash,%,examples/utility/Provisioning<br>RAM for global variables,%,examples/utility/SelfProvisioning<br>flash,%,examples/utility/SelfProvisioning<br>RAM for global variables,%
arduino:esp32:nano_nora,1112,0.04,288,0.09,1408,0.04,288,0.09,1028,0.03,288,0.09,1112,0.04,288,0.09,1420,0.05,288,0.09,1096,0.03,288,0.09
arduino:mbed_giga:giga,552,0.03,288,0.06,680,0.03,256,0.05,488,0.02,288,0.06,488,0.02,256,0.05,736,0.04,256,0.05,488,0.02,288,0.06,3272,0.17,256,0.05
arduino:mbed_nano:nanorp2040connect,350,0.0,272,0.1,480,0.0,272,0.1,324,0.0,272,0.1,350,0.0,272,0.1,502,0.0,272,0.1,352,0.0,272,0.1,3132,0.02,272,0.1,3098,0.02,272,0.1
arduino:mbed_nicla:nicla_vision,480,0.02,288,0.06,616,0.03,256,0.05,488,0.02,256,0.05,480,0.02,288,0.06,680,0.03,256,0.05,488,0.02,256,0.05,3280,0.17,256,0.05,,,,
arduino:mbed_opta:opta,544,0.03,288,0.06,672,0.03,256,0.05,480,0.02,256,0.05,480,0.02,288,0.06,744,0.04,256,0.05,480,0.02,256,0.05,3208,0.16,288,0.06,,,,
arduino:mbed_portenta:envie_m7,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,,,,
arduino:renesas_portenta:portenta_c33,112,0.01,256,0.05,448,0.02,288,0.06,72,0.0,256,0.05,104,0.0,288,0.06,512,0.02,288,0.06,,,,,2840,0.14,256,0.05,,,,
arduino:renesas_uno:unor4wifi,320,0.12,272,0.83,448,0.17,272,0.83,304,0.12,272,0.83,336,0.13,272,0.83,464,0.18,272,0.83,,,,,,,,,,,,
arduino:samd:mkr1000,128,0.05,272,0.83,456,0.17,272,0.83,88,0.03,272,0.83,128,0.05,272,0.83,520,0.2,272,0.83,,,,,3536,1.35,272,0.83,,,,
arduino:samd:mkrgsm1400,352,0.13,272,0.83,472,0.18,272,0.83,312,0.12,272,0.83,352,0.13,272,0.83,496,0.19,272,0.83,,,,,3536,1.35,272,0.83,,,,
arduino:samd:mkrnb1500,120,0.05,272,0.83,456,0.17,272,0.83,88,0.03,272,0.83,120,0.05,272,0.83,520,0.2,272,0.83,,,,,3536,1.35,272,0.83,,,,
arduino:samd:mkrwan1300,1808,0.69,272,0.83,1440,0.55,272,0.83,3168,1.21,272,0.83,2104,0.8,272,0.83,1120,0.43,272,0.83,,,,,,,,,,,,
arduino:samd:mkrwifi1010,400,0.15,272,0.83,520,0.2,272,0.83,368,0.14,272,0.83,400,0.15,272,0.83,544,0.21,272,0.83,400,0.15,272,0.83,3768,1.44,272,0.83,3680,1.4,272,0.83
arduino:samd:nano_33_iot,400,0.15,272,0.83,520,0.2,272,0.83,368,0.14,272,0.83,400,0.15,272,0.83,544,0.21,272,0.83,400,0.15,272,0.83,3768,1.44,272,0.83,3672,1.4,272,0.83
esp32:esp32:esp32,1124,0.09,288,0.09,1396,0.11,288,0.09,1084,0.08,288,0.09,1112,0.08,288,0.09,1400,0.11,288,0.09,1120,0.09,288,0.09,,,,,,,,
esp8266:esp8266:huzzah,0,0.0,272,0.33,400,0.04,272,0.33,-64,-0.01,272,0.33,0,0.0,272,0.33,496,0.05,272,0.33,,,,,,,,,,,,

github-actions[bot] avatar Oct 10 '23 07:10 github-actions[bot]

superseded by #440

pennam avatar Apr 24 '24 08:04 pennam