@@ -49,6 +49,39 @@ SCENARIO("Test the decoding of command messages") {
49
49
}
50
50
51
51
/* ***************************************************************************/
52
+ WHEN (" Decode the ThingDetachCmdDown message" )
53
+ {
54
+ CommandDown command;
55
+ /*
56
+
57
+ DA 00010300 # tag(66560)
58
+ 81 # array(1)
59
+ 78 24 # text(36)
60
+ 65343439346435352D383732612D346664322D393634362D393266383739343933393463 # "e4494d55-872a-4fd2-9646-92f87949394c"
61
+
62
+ */
63
+ uint8_t const payload[] = {0xDA , 0x00 , 0x01 , 0x04 , 0x00 , 0x81 , 0x78 , 0x24 ,
64
+ 0x65 , 0x34 , 0x34 , 0x39 , 0x34 , 0x64 , 0x35 , 0x35 ,
65
+ 0x2D , 0x38 , 0x37 , 0x32 , 0x61 , 0x2D , 0x34 , 0x66 ,
66
+ 0x64 , 0x32 , 0x2D , 0x39 , 0x36 , 0x34 , 0x36 , 0x2D ,
67
+ 0x39 , 0x32 , 0x66 , 0x38 , 0x37 , 0x39 , 0x34 , 0x39 ,
68
+ 0x33 , 0x39 , 0x34 , 0x63 };
69
+
70
+ int payload_length = sizeof (payload) / sizeof (uint8_t );
71
+ CBORMessageDecoder decoder;
72
+ Decoder::Status err = decoder.decode ((Message*)&command, payload, payload_length);
73
+ const char *thingIdToMatch = " e4494d55-872a-4fd2-9646-92f87949394c" ;
74
+
75
+ THEN (" The decode is successful" ) {
76
+ REQUIRE (err == Decoder::Status::Complete);
77
+ REQUIRE (strcmp (command.thingDetachCmd .params .thing_id , thingIdToMatch) == 0 );
78
+ REQUIRE (command.c .id == ThingDetachCmdId);
79
+ }
80
+
81
+ delete msg;
82
+ }
83
+
84
+ /* ***********************************************************************************/
52
85
53
86
WHEN (" Decode the SetTimezoneCommand message" )
54
87
{
0 commit comments