Skip to content

Commit 71f087f

Browse files
[TMP] adapting ArduinoIotCloud to Cloud utils new encode/decode
1 parent 7cd8937 commit 71f087f

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/ArduinoIoTCloudDevice.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ int ArduinoCloudDevice::connected() {
4848
void ArduinoCloudDevice::handleMessage(Message *m) {
4949
_command = UnknownCmdId;
5050
if (m != nullptr) {
51-
_command = m->id;
51+
_command = static_cast<CommandId>(m->id);
5252
}
5353

5454
/* Run through the state machine. */

src/ArduinoIoTCloudTCP.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -409,10 +409,10 @@ void ArduinoIoTCloudTCP::handleMessage(int length)
409409
if (_messageTopicIn == topic) {
410410
CommandDown command;
411411
DEBUG_VERBOSE("ArduinoIoTCloudTCP::%s [%d] received %d bytes", __FUNCTION__, millis(), length);
412-
CBORMessageDecoder decoder;
412+
// CBORMessageDecoder decoder;
413413

414414
size_t buffer_length = length;
415-
if (decoder.decode((Message*)&command, bytes, buffer_length) != Decoder::Status::Error) {
415+
if (CBORMessageDecoder.decode((Message*)&command, bytes, buffer_length) != Decoder::Status::Error) {
416416
DEBUG_VERBOSE("ArduinoIoTCloudTCP::%s [%d] received command id %d", __FUNCTION__, millis(), command.c.id);
417417
switch (command.c.id)
418418
{
@@ -493,7 +493,7 @@ void ArduinoIoTCloudTCP::sendMessage(Message * msg)
493493
{
494494
uint8_t data[MQTT_TRANSMIT_BUFFER_SIZE];
495495
size_t bytes_encoded = sizeof(data);
496-
CBORMessageEncoder encoder;
496+
// CBORMessageEncoder encoder;
497497

498498
switch (msg->id) {
499499
case PropertiesUpdateCmdId:
@@ -506,7 +506,7 @@ void ArduinoIoTCloudTCP::sendMessage(Message * msg)
506506
break;
507507
}
508508

509-
if (encoder.encode(msg, data, bytes_encoded) == Encoder::Status::Complete &&
509+
if (CBORMessageEncoder.encode(msg, data, bytes_encoded) == Encoder::Status::Complete &&
510510
bytes_encoded > 0) {
511511
write(_messageTopicOut, data, bytes_encoded);
512512
} else {

src/ArduinoIoTCloudThing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ int ArduinoCloudThing::connected() {
6969
void ArduinoCloudThing::handleMessage(Message* m) {
7070
_command = UnknownCmdId;
7171
if (m != nullptr) {
72-
_command = m->id;
72+
_command = static_cast<CommandId>(m->id);
7373
if (_command == TimezoneCommandDownId) {
7474
_utcOffset = reinterpret_cast<TimezoneCommandDown*>(m)->params.offset;
7575
_utcOffsetExpireTime = reinterpret_cast<TimezoneCommandDown*>(m)->params.until;

0 commit comments

Comments
 (0)