File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -216,6 +216,7 @@ void ArduinoIoTCloudTCP::update()
216216 switch (_state)
217217 {
218218 case State::ConfigPhy: next_state = handle_ConfigPhy (); break ;
219+ case State::UpdatePhy: next_state = handle_UpdatePhy (); break ;
219220 case State::Init: next_state = handle_Init (); break ;
220221 case State::ConnectPhy: next_state = handle_ConnectPhy (); break ;
221222 case State::SyncTime: next_state = handle_SyncTime (); break ;
@@ -240,7 +241,7 @@ void ArduinoIoTCloudTCP::update()
240241 */
241242 #if NETWORK_CONFIGURATOR_ENABLED
242243 if (_configurator != nullptr && _state > State::Init && _configurator->update () == NetworkConfiguratorStates::UPDATING_CONFIG){
243- _state = State::ConfigPhy ;
244+ _state = State::UpdatePhy ;
244245 }
245246 #endif
246247
@@ -316,6 +317,19 @@ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_ConfigPhy()
316317#endif
317318}
318319
320+ ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_UpdatePhy ()
321+ {
322+ #if NETWORK_CONFIGURATOR_ENABLED
323+ if (_configurator->update () == NetworkConfiguratorStates::CONFIGURED) {
324+ _configurator->disconnectAgent ();
325+ return State::Disconnect;
326+ }
327+ return State::UpdatePhy;
328+ #else
329+ return State::Init;
330+ #endif
331+ }
332+
319333ArduinoIoTCloudTCP::State ArduinoIoTCloudTCP::handle_Init ()
320334{
321335 /* Setup broker TLS client */
Original file line number Diff line number Diff line change @@ -122,6 +122,7 @@ class ArduinoIoTCloudTCP: public ArduinoIoTCloudClass
122122 enum class State
123123 {
124124 ConfigPhy,
125+ UpdatePhy,
125126 Init,
126127 ConnectPhy,
127128 SyncTime,
@@ -178,6 +179,7 @@ class ArduinoIoTCloudTCP: public ArduinoIoTCloudClass
178179 inline String getTopic_datain () { return ( getThingId ().length () == 0 ) ? String (" " ) : String (" /a/t/" + getThingId () + " /e/i" ); }
179180
180181 State handle_ConfigPhy ();
182+ State handle_UpdatePhy ();
181183 State handle_Init ();
182184 State handle_ConnectPhy ();
183185 State handle_SyncTime ();
You can’t perform that action at this time.
0 commit comments