@@ -72,7 +72,7 @@ void ArduinoIoTCloudDevice::handleMessage(Message* m)
72
72
switch (m->id )
73
73
{
74
74
/* We have received a new thing id message */
75
- case AttachThing :
75
+ case ThingGetIdCmdDownId :
76
76
{
77
77
Serial.println (((ThingGetIdCmdDown*)m)->params .thing_id );
78
78
String thing_id_msg = String (((ThingGetIdCmdDown*)m)->params .thing_id );
@@ -88,11 +88,6 @@ void ArduinoIoTCloudDevice::handleMessage(Message* m)
88
88
_state = State::Init;
89
89
break ;
90
90
91
- case SendCapabilities:
92
- case GetThingId:
93
- case GetLastValues:
94
- case LastValues:
95
- case SendProperties:
96
91
default :
97
92
break ;
98
93
}
@@ -113,12 +108,13 @@ ArduinoIoTCloudDevice::State ArduinoIoTCloudDevice::handle_Init()
113
108
ArduinoIoTCloudDevice::State ArduinoIoTCloudDevice::handle_SendCapabilities ()
114
109
{
115
110
/* Now: Sends message into device topic Will: LIB_VERSION? */
116
- _message. id = SendCapabilities ;
117
- deliver (&_message );
111
+ DeviceBeginCmdUp deviceBegin = { DeviceBeginCmdUpId, AIOT_CONFIG_LIB_VERSION } ;
112
+ deliver (reinterpret_cast <Message*>(&deviceBegin) );
118
113
119
114
/* Now: Subscribe to device topic. Will: send Thing.begin() */
120
- _message.id = GetThingId;
121
- deliver (&_message);
115
+ ThingGetIdCmdUp thingBegin = { ThingGetIdCmdUpId };
116
+ strcpy (thingBegin.params .thing_id , _thing_id.begin ());
117
+ deliver (reinterpret_cast <Message*>(&thingBegin));
122
118
123
119
/* No device configuration received. Wait: 4s -> 8s -> 16s -> 32s -> 32s ...*/
124
120
_connection_attempt.retry ();
@@ -182,5 +178,4 @@ ArduinoIoTCloudDevice::State ArduinoIoTCloudDevice::handle_Disconnected()
182
178
{
183
179
return State::Disconnected;
184
180
}
185
-
186
181
#endif
0 commit comments