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