Skip to content

Commit 078fc1a

Browse files
pennamandreagilardoni
authored andcommitted
ArduinoIoTCloudThing: switch to messages
1 parent d118491 commit 078fc1a

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/ArduinoIoTCloudThing.cpp

+4-9
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ void ArduinoIoTCloudThing::handleMessage(Message* m)
7575
switch (m->id)
7676
{
7777
/* We have received last values */
78-
case LastValues:
78+
case ThingGetLastValueCmdDownId:
7979
_state = State::Connected;
8080
break;
8181

@@ -84,8 +84,6 @@ void ArduinoIoTCloudThing::handleMessage(Message* m)
8484
_state = State::RequestLastValues;
8585
break;
8686

87-
case GetLastValues:
88-
case SendProperties:
8987
default:
9088
break;
9189
}
@@ -105,18 +103,15 @@ ArduinoIoTCloudThing::State ArduinoIoTCloudThing::handle_RequestLastValues()
105103
*/
106104
if (_connection_attempt.getRetryCount() > AIOT_CONFIG_LASTVALUES_SYNC_MAX_RETRY_CNT)
107105
{
108-
_message.id = Disconnect;
109-
deliver(&_message);
110106
return State::Disconnect;
111107
}
112108

113109
_connection_attempt.retry();
114110

115111
/* Send message upstream to inform infrastructure we need to request thing last values */
116-
117-
_message.id = GetLastValues;
118-
deliver(&_message);
119-
112+
ThingGetLastValueCmdUp getLastValues = { ThingGetLastValueCmdUpId };
113+
deliver(reinterpret_cast<Message*>(&getLastValues));
114+
DEBUG_VERBOSE("CloudThing::%s getLastValues. %d next request in %d ms", __FUNCTION__, _connection_attempt.getRetryCount(), _connection_attempt.getWaitTime());
120115
return State::RequestLastValues;
121116
}
122117

0 commit comments

Comments
 (0)