-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #440 from arduino-libraries/callback-remove
Remove public functions to handle thing_id and timezone
- Loading branch information
Showing
10 changed files
with
134 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
Copyright (c) 2019 Arduino. All rights reserved. | ||
*/ | ||
|
||
/************************************************************************************** | ||
INCLUDE | ||
**************************************************************************************/ | ||
|
||
#include <catch.hpp> | ||
|
||
#include <util/CBORTestUtil.h> | ||
|
||
#include <CBORDecoder.h> | ||
#include <PropertyContainer.h> | ||
|
||
/************************************************************************************** | ||
TEST CODE | ||
**************************************************************************************/ | ||
|
||
SCENARIO("An Arduino cloud property is marked 'write on change'", "[ArduinoCloudThing::decode]") | ||
{ | ||
PropertyContainer property_container; | ||
|
||
CloudInt test = 0; | ||
addPropertyToContainer(property_container, test, "test", Permission::ReadWrite).writeOnChange(); | ||
|
||
/* [{0: "test", 2: 7}] = 81 A2 00 64 74 65 73 74 02 07 */ | ||
uint8_t const payload[] = {0x81, 0xA2, 0x00, 0x64, 0x74, 0x65, 0x73, 0x74, 0x02, 0x07}; | ||
int const payload_length = sizeof(payload) / sizeof(uint8_t); | ||
CBORDecoder::decode(property_container, payload, payload_length); | ||
|
||
REQUIRE(test == 7); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
Copyright (c) 2019 Arduino. All rights reserved. | ||
*/ | ||
|
||
/************************************************************************************** | ||
INCLUDE | ||
**************************************************************************************/ | ||
|
||
#include <catch.hpp> | ||
|
||
#include <util/CBORTestUtil.h> | ||
|
||
#include <CBORDecoder.h> | ||
#include <PropertyContainer.h> | ||
|
||
/************************************************************************************** | ||
TEST CODE | ||
**************************************************************************************/ | ||
|
||
SCENARIO("An Arduino cloud property is marked 'write on demand'", "[ArduinoCloudThing::decode]") | ||
{ | ||
PropertyContainer property_container; | ||
|
||
CloudInt test = 0; | ||
addPropertyToContainer(property_container, test, "test", Permission::ReadWrite).writeOnDemand(); | ||
|
||
/* [{0: "test", 2: 7}] = 81 A2 00 64 74 65 73 74 02 07 */ | ||
uint8_t const payload[] = {0x81, 0xA2, 0x00, 0x64, 0x74, 0x65, 0x73, 0x74, 0x02, 0x07}; | ||
int const payload_length = sizeof(payload) / sizeof(uint8_t); | ||
CBORDecoder::decode(property_container, payload, payload_length); | ||
|
||
REQUIRE(test == 0); | ||
|
||
Property* p = getProperty(property_container, "test"); | ||
p->fromCloudToLocal(); | ||
|
||
REQUIRE(test == 7); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters