@@ -300,40 +300,22 @@ void ArduinoIoTCloudTCP::printDebugInfo()
300
300
}
301
301
302
302
void ArduinoIoTCloudTCP::decode (){
303
- GenericCommand * message = new GenericCommand ();
304
-
305
- uint8_t const payload[] = {0xDA , 0x00 , 0x01 , 0x03 , 0x00 , 0x81 , 0x78 , 0x24 , 0x65 , 0x34 , 0x34 , 0x39 , 0x34 , 0x64 , 0x35 , 0x35 , 0x2D , 0x38 , 0x37 , 0x32 , 0x61 , 0x2D , 0x34 , 0x66 , 0x64 , 0x32 , 0x2D , 0x39 , 0x36 , 0x34 , 0x36 , 0x2D , 0x39 , 0x32 , 0x66 , 0x38 , 0x37 , 0x39 , 0x34 , 0x39 , 0x33 , 0x39 , 0x34 , 0x63 };
303
+ GenericCommand * msg = new GenericCommand ();
306
304
305
+ uint8_t const payload[] = {0xDA , 0x00 , 0x01 , 0x01 , 0x00 , 0x84 , 0x6C , 0x6F , 0x74 , 0x61 , 0x2D , 0x69 , 0x64 , 0x2D , 0x31 , 0x32 , 0x33 , 0x34 , 0x35 , 0x75 , 0x38 , 0x37 , 0x36 , 0x31 , 0x32 , 0x33 , 0x38 , 0x37 , 0x36 , 0x31 , 0x32 , 0x33 , 0x38 , 0x37 , 0x36 , 0x31 , 0x32 , 0x33 , 0x31 , 0x32 , 0x33 , 0x53 , 0x33 , 0x30 , 0x30 , 0x34 , 0x61 , 0x61 , 0x62 , 0x32 , 0x37 , 0x35 , 0x31 , 0x31 , 0x64 , 0x62 , 0x33 , 0x32 , 0x31 , 0x32 , 0x64 , 0x50 , 0x6A , 0x6B , 0x61 , 0x73 , 0x64 , 0x6B , 0x6A , 0x68 , 0x61 , 0x73 , 0x64 , 0x6B , 0x6A , 0x68 , 0x78 , 0x68 };
306
+
307
307
int payload_length = sizeof (payload) / sizeof (uint8_t );
308
- MessageDecoder::DecoderState err1 = MessageDecoder::decode ((Message*) message , payload, payload_length);
308
+ MessageDecoder::DecoderState err1 = MessageDecoder::decode ((Message*) msg , payload, payload_length);
309
309
310
- DEBUG_INFO (" >Message THING id is %d" , message ->command );
310
+ DEBUG_INFO (" >Message OTA id is %d" , msg ->command );
311
311
312
- ThingGetIdCmdDown * thingCommand = (ThingGetIdCmdDown*) message;
313
- // DEBUG_INFO("Thing id is %s", thingCommand->fields.params.thing_id);
312
+ OtaUpdateCmdDown * otaCommand = (OtaUpdateCmdDown*) msg;
313
+ DEBUG_INFO (" >URL is %s" , otaCommand->fields .params .url );
314
+ DEBUG_INFO (" >ID is %s" , otaCommand->fields .params .id );
314
315
DEBUG_INFO (" >Command status %d" , static_cast <int >(err1));
315
- DEBUG_INFO (" >Command status %d" , static_cast <int >(MessageDecoder::DecoderState::Success));
316
- DEBUG_INFO (" >Command status %d" , static_cast <int >(MessageDecoder::DecoderState::MessageNotSupported));
317
-
318
- delete message;
319
316
320
- /*
321
- uint8_t const payloadLV[] = {0xDA, 0x00, 0x01, 0x06, 0x00, 0x81, 0x4D, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, 0x11, 0x12};
322
- payload_length = sizeof(payloadLV) / sizeof(uint8_t);
323
- MessageDecoder::DecoderState err = MessageDecoder::decode((Message*) message, payloadLV, payload_length);
324
-
325
- DEBUG_INFO("Message LV id is %d", message->command);
326
- DEBUG_INFO("Command status %d", static_cast<int>(err));
327
- DEBUG_INFO("Command status %d", static_cast<int>(MessageDecoder::DecoderState::Success));
328
- ThingGetLastValueCmdDown * lv = (ThingGetLastValueCmdDown*) message;
329
- DEBUG_INFO("LV payload (size: %d)", lv->fields.params.length);
330
- for (int i = 0; i < lv->fields.params.length; i++) {
331
- DEBUG_INFO("%02X", lv->fields.params.last_values[i]);
332
- }
317
+ delete msg;
333
318
334
- delete lv->fields.params.last_values;
335
- delete lv;
336
- */
337
319
}
338
320
339
321
void ArduinoIoTCloudTCP::encode (){
0 commit comments