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