SingingCat 0
application
wireless_state_machine.c
1// automatically generated on 30/12/2020 17:16:20!
2// by StateMachine Build #26 on 14/12/2016 16:35:57 by cnw (master)@public
3// qsee http://www.conradwood.net/autobuilder/statemachine/master/latest/
4
5#include "wireless_state_machine.h"
6static void wireless_state_idle(int myev);
7static void wireless_state_nextaponly(int myev);
8static void wireless_state_romcheck(int myev);
9static void wireless_state_resetfailed(int myev);
10static void wireless_state_connectingap(int myev);
11static void wireless_state_connected(int myev);
12static void wireless_state_bridged(int myev);
13static void wireless_state_connectingcloud(int myev);
14static void wireless_state_triggerdefaultsoftap(int myev);
15static void wireless_state_defaultsoftap(int myev);
16static void wireless_state_init(int myev);
17static void wireless_state_nextap(int myev);
18static void wireless_state_disabled(int myev);
19static void wireless_state_romfailed(int myev);
20static void wireless_state_resetting(int myev);
21static void wireless_state_apfailed(int myev);
22static void wireless_state_connectingip(int myev);
23static void wireless_state_ready(int myev);
24
25static int state = 0;
26
27void wireless_set_state(int newstate) {
28 if (newstate == state) {
29 return; // no change ... ignore
30 }
31 int oldstate = state;
32
33 state = newstate;
34 wireless_callback_state_change(newstate, oldstate);
35}
36void wireless_init() {
37 state = WIRELESS_STATE_DISABLED;
38}
39int wireless_get_current_state(void) {
40 return state;
41}
42
43void wireless_new_event(int myev) {
44 switch (state) {
45 case WIRELESS_STATE_DISABLED:
46 wireless_state_disabled(myev);
47 break;
48 case WIRELESS_STATE_BRIDGED:
49 wireless_state_bridged(myev);
50 break;
51 case WIRELESS_STATE_IDLE:
52 wireless_state_idle(myev);
53 break;
54 case WIRELESS_STATE_ROMCHECK:
55 wireless_state_romcheck(myev);
56 break;
57 case WIRELESS_STATE_ROMFAILED:
58 wireless_state_romfailed(myev);
59 break;
60 case WIRELESS_STATE_INIT:
61 wireless_state_init(myev);
62 break;
63 case WIRELESS_STATE_RESETTING:
64 wireless_state_resetting(myev);
65 break;
66 case WIRELESS_STATE_RESETFAILED:
67 wireless_state_resetfailed(myev);
68 break;
69 case WIRELESS_STATE_READY:
70 wireless_state_ready(myev);
71 break;
72 case WIRELESS_STATE_CONNECTINGAP:
73 wireless_state_connectingap(myev);
74 break;
75 case WIRELESS_STATE_DEFAULTSOFTAP:
76 wireless_state_defaultsoftap(myev);
77 break;
78 case WIRELESS_STATE_TRIGGERDEFAULTSOFTAP:
79 wireless_state_triggerdefaultsoftap(myev);
80 break;
81 case WIRELESS_STATE_APFAILED:
82 wireless_state_apfailed(myev);
83 break;
84 case WIRELESS_STATE_CONNECTINGIP:
85 wireless_state_connectingip(myev);
86 break;
87 case WIRELESS_STATE_CONNECTINGCLOUD:
88 wireless_state_connectingcloud(myev);
89 break;
90 case WIRELESS_STATE_CONNECTED:
91 wireless_state_connected(myev);
92 break;
93 case WIRELESS_STATE_NEXTAPONLY:
94 wireless_state_nextaponly(myev);
95 break;
96 case WIRELESS_STATE_NEXTAP:
97 wireless_state_nextap(myev);
98 break;
99 } // end of "switch (state)"
100}
101
102static void wireless_state_disabled(int myev) {
103 switch (myev) {
104 case WIRELESS_EVENT_WIFIENABLED:
105 wireless_set_state(WIRELESS_STATE_IDLE);
106 break;
107 case WIRELESS_EVENT_INITIALSTATE:
108 wireless_set_state(WIRELESS_STATE_DISABLED);
109 break;
110 case WIRELESS_EVENT_ONWIFIDISABLE:
111 wireless_set_state(WIRELESS_STATE_DISABLED);
112 break;
113 case WIRELESS_EVENT_BRIDGEEVENT:
114 wireless_set_state(WIRELESS_STATE_BRIDGED);
115 break;
116 case WIRELESS_EVENT_ONRESET:
117 wireless_set_state(WIRELESS_STATE_IDLE);
118 break;
119 } // end of "switch (myev)"
120}
121static void wireless_state_bridged(int myev) {
122 switch (myev) {
123 case WIRELESS_EVENT_INITIALSTATE:
124 wireless_set_state(WIRELESS_STATE_DISABLED);
125 break;
126 case WIRELESS_EVENT_ONWIFIDISABLE:
127 wireless_set_state(WIRELESS_STATE_DISABLED);
128 break;
129 case WIRELESS_EVENT_ONTIMEOUT:
130 wireless_set_state(WIRELESS_STATE_IDLE);
131 break;
132 case WIRELESS_EVENT_BRIDGEEVENT:
133 wireless_set_state(WIRELESS_STATE_BRIDGED);
134 break;
135 case WIRELESS_EVENT_ONRESET:
136 wireless_set_state(WIRELESS_STATE_IDLE);
137 break;
138 } // end of "switch (myev)"
139}
140static void wireless_state_idle(int myev) {
141 switch (myev) {
142 case WIRELESS_EVENT_INITIALSTATE:
143 wireless_set_state(WIRELESS_STATE_DISABLED);
144 break;
145 case WIRELESS_EVENT_ONWIFIDISABLE:
146 wireless_set_state(WIRELESS_STATE_DISABLED);
147 break;
148 case WIRELESS_EVENT_BRIDGEEVENT:
149 wireless_set_state(WIRELESS_STATE_BRIDGED);
150 break;
151 case WIRELESS_EVENT_WIFIENABLED:
152 wireless_set_state(WIRELESS_STATE_ROMCHECK);
153 break;
154 case WIRELESS_EVENT_ONRESET:
155 wireless_set_state(WIRELESS_STATE_IDLE);
156 break;
157 } // end of "switch (myev)"
158}
159static void wireless_state_romcheck(int myev) {
160 switch (myev) {
161 case WIRELESS_EVENT_INITIALSTATE:
162 wireless_set_state(WIRELESS_STATE_DISABLED);
163 break;
164 case WIRELESS_EVENT_ONWIFIDISABLE:
165 wireless_set_state(WIRELESS_STATE_DISABLED);
166 break;
167 case WIRELESS_EVENT_BRIDGEEVENT:
168 wireless_set_state(WIRELESS_STATE_BRIDGED);
169 break;
170 case WIRELESS_EVENT_ONRESET:
171 wireless_set_state(WIRELESS_STATE_IDLE);
172 break;
173 case WIRELESS_EVENT_ONTIMEOUT:
174 wireless_set_state(WIRELESS_STATE_ROMFAILED);
175 break;
176 case WIRELESS_EVENT_ONROMFAILED:
177 wireless_set_state(WIRELESS_STATE_ROMFAILED);
178 break;
179 case WIRELESS_EVENT_ONROMCHECKED:
180 wireless_set_state(WIRELESS_STATE_INIT);
181 break;
182 } // end of "switch (myev)"
183}
184static void wireless_state_romfailed(int myev) {
185 switch (myev) {
186 case WIRELESS_EVENT_INITIALSTATE:
187 wireless_set_state(WIRELESS_STATE_DISABLED);
188 break;
189 case WIRELESS_EVENT_ONWIFIDISABLE:
190 wireless_set_state(WIRELESS_STATE_DISABLED);
191 break;
192 case WIRELESS_EVENT_BRIDGEEVENT:
193 wireless_set_state(WIRELESS_STATE_BRIDGED);
194 break;
195 case WIRELESS_EVENT_ONRESET:
196 wireless_set_state(WIRELESS_STATE_IDLE);
197 break;
198 case WIRELESS_EVENT_ONTIMEOUT:
199 wireless_set_state(WIRELESS_STATE_IDLE);
200 break;
201 } // end of "switch (myev)"
202}
203static void wireless_state_init(int myev) {
204 switch (myev) {
205 case WIRELESS_EVENT_INITIALSTATE:
206 wireless_set_state(WIRELESS_STATE_DISABLED);
207 break;
208 case WIRELESS_EVENT_ONWIFIDISABLE:
209 wireless_set_state(WIRELESS_STATE_DISABLED);
210 break;
211 case WIRELESS_EVENT_BRIDGEEVENT:
212 wireless_set_state(WIRELESS_STATE_BRIDGED);
213 break;
214 case WIRELESS_EVENT_ONRESET:
215 wireless_set_state(WIRELESS_STATE_IDLE);
216 break;
217 case WIRELESS_EVENT_ONTIMEOUT:
218 wireless_set_state(WIRELESS_STATE_RESETTING);
219 break;
220 } // end of "switch (myev)"
221}
222static void wireless_state_resetting(int myev) {
223 switch (myev) {
224 case WIRELESS_EVENT_INITIALSTATE:
225 wireless_set_state(WIRELESS_STATE_DISABLED);
226 break;
227 case WIRELESS_EVENT_ONWIFIDISABLE:
228 wireless_set_state(WIRELESS_STATE_DISABLED);
229 break;
230 case WIRELESS_EVENT_BRIDGEEVENT:
231 wireless_set_state(WIRELESS_STATE_BRIDGED);
232 break;
233 case WIRELESS_EVENT_ONRESET:
234 wireless_set_state(WIRELESS_STATE_IDLE);
235 break;
236 case WIRELESS_EVENT_ONTIMEOUT:
237 wireless_set_state(WIRELESS_STATE_RESETFAILED);
238 break;
239 case WIRELESS_EVENT_RESETSUCCEEDED:
240 wireless_set_state(WIRELESS_STATE_READY);
241 break;
242 } // end of "switch (myev)"
243}
244static void wireless_state_resetfailed(int myev) {
245 switch (myev) {
246 case WIRELESS_EVENT_INITIALSTATE:
247 wireless_set_state(WIRELESS_STATE_DISABLED);
248 break;
249 case WIRELESS_EVENT_ONWIFIDISABLE:
250 wireless_set_state(WIRELESS_STATE_DISABLED);
251 break;
252 case WIRELESS_EVENT_BRIDGEEVENT:
253 wireless_set_state(WIRELESS_STATE_BRIDGED);
254 break;
255 case WIRELESS_EVENT_ONRESET:
256 wireless_set_state(WIRELESS_STATE_IDLE);
257 break;
258 case WIRELESS_EVENT_ONTIMEOUT:
259 wireless_set_state(WIRELESS_STATE_RESETTING);
260 break;
261 } // end of "switch (myev)"
262}
263static void wireless_state_ready(int myev) {
264 switch (myev) {
265 case WIRELESS_EVENT_INITIALSTATE:
266 wireless_set_state(WIRELESS_STATE_DISABLED);
267 break;
268 case WIRELESS_EVENT_ONWIFIDISABLE:
269 wireless_set_state(WIRELESS_STATE_DISABLED);
270 break;
271 case WIRELESS_EVENT_BRIDGEEVENT:
272 wireless_set_state(WIRELESS_STATE_BRIDGED);
273 break;
274 case WIRELESS_EVENT_ONRESET:
275 wireless_set_state(WIRELESS_STATE_IDLE);
276 break;
277 case WIRELESS_EVENT_ONTIMEOUT:
278 wireless_set_state(WIRELESS_STATE_RESETTING);
279 break;
280 case WIRELESS_EVENT_GOTAP:
281 wireless_set_state(WIRELESS_STATE_CONNECTINGAP);
282 break;
283 case WIRELESS_EVENT_GOTNOAP:
284 wireless_set_state(WIRELESS_STATE_DEFAULTSOFTAP);
285 break;
286 } // end of "switch (myev)"
287}
288static void wireless_state_connectingap(int myev) {
289 switch (myev) {
290 case WIRELESS_EVENT_INITIALSTATE:
291 wireless_set_state(WIRELESS_STATE_DISABLED);
292 break;
293 case WIRELESS_EVENT_ONWIFIDISABLE:
294 wireless_set_state(WIRELESS_STATE_DISABLED);
295 break;
296 case WIRELESS_EVENT_BRIDGEEVENT:
297 wireless_set_state(WIRELESS_STATE_BRIDGED);
298 break;
299 case WIRELESS_EVENT_ONRESET:
300 wireless_set_state(WIRELESS_STATE_IDLE);
301 break;
302 case WIRELESS_EVENT_ONTIMEOUT:
303 wireless_set_state(WIRELESS_STATE_APFAILED);
304 break;
305 case WIRELESS_EVENT_APCONNECTED:
306 wireless_set_state(WIRELESS_STATE_CONNECTINGIP);
307 break;
308 case WIRELESS_EVENT_IPASSIGNED:
309 wireless_set_state(WIRELESS_STATE_CONNECTINGCLOUD);
310 break;
311 case WIRELESS_EVENT_CLOUDISOK:
312 wireless_set_state(WIRELESS_STATE_CONNECTED);
313 break;
314 case WIRELESS_EVENT_APFAILURE:
315 wireless_set_state(WIRELESS_STATE_APFAILED);
316 break;
317 } // end of "switch (myev)"
318}
319static void wireless_state_defaultsoftap(int myev) {
320 switch (myev) {
321 case WIRELESS_EVENT_INITIALSTATE:
322 wireless_set_state(WIRELESS_STATE_DISABLED);
323 break;
324 case WIRELESS_EVENT_ONWIFIDISABLE:
325 wireless_set_state(WIRELESS_STATE_DISABLED);
326 break;
327 case WIRELESS_EVENT_BRIDGEEVENT:
328 wireless_set_state(WIRELESS_STATE_BRIDGED);
329 break;
330 case WIRELESS_EVENT_ONRESET:
331 wireless_set_state(WIRELESS_STATE_IDLE);
332 break;
333 case WIRELESS_EVENT_GOTNEWAP:
334 wireless_set_state(WIRELESS_STATE_INIT);
335 break;
336 case WIRELESS_EVENT_ONTIMEOUT:
337 wireless_set_state(WIRELESS_STATE_INIT);
338 break;
339 } // end of "switch (myev)"
340}
341static void wireless_state_triggerdefaultsoftap(int myev) {
342 switch (myev) {
343 case WIRELESS_EVENT_INITIALSTATE:
344 wireless_set_state(WIRELESS_STATE_DISABLED);
345 break;
346 case WIRELESS_EVENT_ONWIFIDISABLE:
347 wireless_set_state(WIRELESS_STATE_DISABLED);
348 break;
349 case WIRELESS_EVENT_BRIDGEEVENT:
350 wireless_set_state(WIRELESS_STATE_BRIDGED);
351 break;
352 case WIRELESS_EVENT_ONRESET:
353 wireless_set_state(WIRELESS_STATE_IDLE);
354 break;
355 case WIRELESS_EVENT_ONTIMEOUT:
356 wireless_set_state(WIRELESS_STATE_INIT);
357 break;
358 } // end of "switch (myev)"
359}
360static void wireless_state_apfailed(int myev) {
361 switch (myev) {
362 case WIRELESS_EVENT_INITIALSTATE:
363 wireless_set_state(WIRELESS_STATE_DISABLED);
364 break;
365 case WIRELESS_EVENT_ONWIFIDISABLE:
366 wireless_set_state(WIRELESS_STATE_DISABLED);
367 break;
368 case WIRELESS_EVENT_BRIDGEEVENT:
369 wireless_set_state(WIRELESS_STATE_BRIDGED);
370 break;
371 case WIRELESS_EVENT_ONRESET:
372 wireless_set_state(WIRELESS_STATE_IDLE);
373 break;
374 case WIRELESS_EVENT_ONTIMEOUT:
375 wireless_set_state(WIRELESS_STATE_NEXTAP);
376 break;
377 } // end of "switch (myev)"
378}
379static void wireless_state_connectingip(int myev) {
380 switch (myev) {
381 case WIRELESS_EVENT_INITIALSTATE:
382 wireless_set_state(WIRELESS_STATE_DISABLED);
383 break;
384 case WIRELESS_EVENT_ONWIFIDISABLE:
385 wireless_set_state(WIRELESS_STATE_DISABLED);
386 break;
387 case WIRELESS_EVENT_BRIDGEEVENT:
388 wireless_set_state(WIRELESS_STATE_BRIDGED);
389 break;
390 case WIRELESS_EVENT_ONRESET:
391 wireless_set_state(WIRELESS_STATE_IDLE);
392 break;
393 case WIRELESS_EVENT_ONTIMEOUT:
394 wireless_set_state(WIRELESS_STATE_APFAILED);
395 break;
396 case WIRELESS_EVENT_IPISOK:
397 wireless_set_state(WIRELESS_STATE_CONNECTINGCLOUD);
398 break;
399 case WIRELESS_EVENT_CLOUDISOK:
400 wireless_set_state(WIRELESS_STATE_CONNECTED);
401 break;
402 case WIRELESS_EVENT_IPASSIGNED:
403 wireless_set_state(WIRELESS_STATE_CONNECTINGCLOUD);
404 break;
405 } // end of "switch (myev)"
406}
407static void wireless_state_connectingcloud(int myev) {
408 switch (myev) {
409 case WIRELESS_EVENT_INITIALSTATE:
410 wireless_set_state(WIRELESS_STATE_DISABLED);
411 break;
412 case WIRELESS_EVENT_ONWIFIDISABLE:
413 wireless_set_state(WIRELESS_STATE_DISABLED);
414 break;
415 case WIRELESS_EVENT_BRIDGEEVENT:
416 wireless_set_state(WIRELESS_STATE_BRIDGED);
417 break;
418 case WIRELESS_EVENT_ONRESET:
419 wireless_set_state(WIRELESS_STATE_IDLE);
420 break;
421 case WIRELESS_EVENT_ONTIMEOUT:
422 wireless_set_state(WIRELESS_STATE_NEXTAPONLY);
423 break;
424 case WIRELESS_EVENT_CLOUDISOK:
425 wireless_set_state(WIRELESS_STATE_CONNECTED);
426 break;
427 } // end of "switch (myev)"
428}
429static void wireless_state_connected(int myev) {
430 switch (myev) {
431 case WIRELESS_EVENT_INITIALSTATE:
432 wireless_set_state(WIRELESS_STATE_DISABLED);
433 break;
434 case WIRELESS_EVENT_ONWIFIDISABLE:
435 wireless_set_state(WIRELESS_STATE_DISABLED);
436 break;
437 case WIRELESS_EVENT_BRIDGEEVENT:
438 wireless_set_state(WIRELESS_STATE_BRIDGED);
439 break;
440 case WIRELESS_EVENT_ONRESET:
441 wireless_set_state(WIRELESS_STATE_IDLE);
442 break;
443 case WIRELESS_EVENT_CLOUDDISCONNECTED:
444 wireless_set_state(WIRELESS_STATE_CONNECTINGCLOUD);
445 break;
446 case WIRELESS_EVENT_ONRESETDETECTED:
447 wireless_set_state(WIRELESS_STATE_INIT);
448 break;
449 } // end of "switch (myev)"
450}
451static void wireless_state_nextaponly(int myev) {
452 switch (myev) {
453 case WIRELESS_EVENT_INITIALSTATE:
454 wireless_set_state(WIRELESS_STATE_DISABLED);
455 break;
456 case WIRELESS_EVENT_ONWIFIDISABLE:
457 wireless_set_state(WIRELESS_STATE_DISABLED);
458 break;
459 case WIRELESS_EVENT_BRIDGEEVENT:
460 wireless_set_state(WIRELESS_STATE_BRIDGED);
461 break;
462 case WIRELESS_EVENT_ONRESET:
463 wireless_set_state(WIRELESS_STATE_IDLE);
464 break;
465 case WIRELESS_EVENT_ONTIMEOUT:
466 wireless_set_state(WIRELESS_STATE_RESETTING);
467 break;
468 } // end of "switch (myev)"
469}
470static void wireless_state_nextap(int myev) {
471 switch (myev) {
472 case WIRELESS_EVENT_INITIALSTATE:
473 wireless_set_state(WIRELESS_STATE_DISABLED);
474 break;
475 case WIRELESS_EVENT_ONWIFIDISABLE:
476 wireless_set_state(WIRELESS_STATE_DISABLED);
477 break;
478 case WIRELESS_EVENT_BRIDGEEVENT:
479 wireless_set_state(WIRELESS_STATE_BRIDGED);
480 break;
481 case WIRELESS_EVENT_ONRESET:
482 wireless_set_state(WIRELESS_STATE_IDLE);
483 break;
484 case WIRELESS_EVENT_ONTIMEOUT:
485 wireless_set_state(WIRELESS_STATE_RESETTING);
486 break;
487 case WIRELESS_EVENT_ONNOMOREAPS:
488 wireless_set_state(WIRELESS_STATE_TRIGGERDEFAULTSOFTAP);
489 break;
490 } // end of "switch (myev)"
491}
492void wireless_timeout(void) {
493 wireless_new_event(WIRELESS_EVENT_ONTIMEOUT);
494}
495const char *wireless_state_to_string(int state) {
496 if (state == WIRELESS_STATE_DISABLED) {
497 return "WIRELESS_STATE_DISABLED";
498 }
499 if (state == WIRELESS_STATE_BRIDGED) {
500 return "WIRELESS_STATE_BRIDGED";
501 }
502 if (state == WIRELESS_STATE_IDLE) {
503 return "WIRELESS_STATE_IDLE";
504 }
505 if (state == WIRELESS_STATE_ROMCHECK) {
506 return "WIRELESS_STATE_ROMCHECK";
507 }
508 if (state == WIRELESS_STATE_ROMFAILED) {
509 return "WIRELESS_STATE_ROMFAILED";
510 }
511 if (state == WIRELESS_STATE_INIT) {
512 return "WIRELESS_STATE_INIT";
513 }
514 if (state == WIRELESS_STATE_RESETTING) {
515 return "WIRELESS_STATE_RESETTING";
516 }
517 if (state == WIRELESS_STATE_RESETFAILED) {
518 return "WIRELESS_STATE_RESETFAILED";
519 }
520 if (state == WIRELESS_STATE_READY) {
521 return "WIRELESS_STATE_READY";
522 }
523 if (state == WIRELESS_STATE_CONNECTINGAP) {
524 return "WIRELESS_STATE_CONNECTINGAP";
525 }
526 if (state == WIRELESS_STATE_DEFAULTSOFTAP) {
527 return "WIRELESS_STATE_DEFAULTSOFTAP";
528 }
529 if (state == WIRELESS_STATE_TRIGGERDEFAULTSOFTAP) {
530 return "WIRELESS_STATE_TRIGGERDEFAULTSOFTAP";
531 }
532 if (state == WIRELESS_STATE_APFAILED) {
533 return "WIRELESS_STATE_APFAILED";
534 }
535 if (state == WIRELESS_STATE_CONNECTINGIP) {
536 return "WIRELESS_STATE_CONNECTINGIP";
537 }
538 if (state == WIRELESS_STATE_CONNECTINGCLOUD) {
539 return "WIRELESS_STATE_CONNECTINGCLOUD";
540 }
541 if (state == WIRELESS_STATE_CONNECTED) {
542 return "WIRELESS_STATE_CONNECTED";
543 }
544 if (state == WIRELESS_STATE_NEXTAPONLY) {
545 return "WIRELESS_STATE_NEXTAPONLY";
546 }
547 if (state == WIRELESS_STATE_NEXTAP) {
548 return "WIRELESS_STATE_NEXTAP";
549 }
550 return "undefined state";
551}
552const char *wireless_event_to_string(int event) {
553 if (event == WIRELESS_EVENT_INITIALSTATE) {
554 return "WIRELESS_EVENT_INITIALSTATE";
555 }
556 if (event == WIRELESS_EVENT_ONWIFIDISABLE) {
557 return "WIRELESS_EVENT_ONWIFIDISABLE";
558 }
559 if (event == WIRELESS_EVENT_BRIDGEEVENT) {
560 return "WIRELESS_EVENT_BRIDGEEVENT";
561 }
562 if (event == WIRELESS_EVENT_ONRESET) {
563 return "WIRELESS_EVENT_ONRESET";
564 }
565 if (event == WIRELESS_EVENT_WIFIENABLED) {
566 return "WIRELESS_EVENT_WIFIENABLED";
567 }
568 if (event == WIRELESS_EVENT_ONTIMEOUT) {
569 return "WIRELESS_EVENT_ONTIMEOUT";
570 }
571 if (event == WIRELESS_EVENT_ONROMFAILED) {
572 return "WIRELESS_EVENT_ONROMFAILED";
573 }
574 if (event == WIRELESS_EVENT_ONROMCHECKED) {
575 return "WIRELESS_EVENT_ONROMCHECKED";
576 }
577 if (event == WIRELESS_EVENT_RESETSUCCEEDED) {
578 return "WIRELESS_EVENT_RESETSUCCEEDED";
579 }
580 if (event == WIRELESS_EVENT_GOTAP) {
581 return "WIRELESS_EVENT_GOTAP";
582 }
583 if (event == WIRELESS_EVENT_GOTNOAP) {
584 return "WIRELESS_EVENT_GOTNOAP";
585 }
586 if (event == WIRELESS_EVENT_GOTNEWAP) {
587 return "WIRELESS_EVENT_GOTNEWAP";
588 }
589 if (event == WIRELESS_EVENT_APCONNECTED) {
590 return "WIRELESS_EVENT_APCONNECTED";
591 }
592 if (event == WIRELESS_EVENT_IPASSIGNED) {
593 return "WIRELESS_EVENT_IPASSIGNED";
594 }
595 if (event == WIRELESS_EVENT_CLOUDISOK) {
596 return "WIRELESS_EVENT_CLOUDISOK";
597 }
598 if (event == WIRELESS_EVENT_APFAILURE) {
599 return "WIRELESS_EVENT_APFAILURE";
600 }
601 if (event == WIRELESS_EVENT_IPISOK) {
602 return "WIRELESS_EVENT_IPISOK";
603 }
604 if (event == WIRELESS_EVENT_CLOUDDISCONNECTED) {
605 return "WIRELESS_EVENT_CLOUDDISCONNECTED";
606 }
607 if (event == WIRELESS_EVENT_ONRESETDETECTED) {
608 return "WIRELESS_EVENT_ONRESETDETECTED";
609 }
610 if (event == WIRELESS_EVENT_ONNOMOREAPS) {
611 return "WIRELESS_EVENT_ONNOMOREAPS";
612 }
613 return "undefined event";
614}
615const int wireless_get_state_timeout(int state) {
616 if (state == WIRELESS_STATE_DISABLED) {
617 return 0;
618 }
619 if (state == WIRELESS_STATE_BRIDGED) {
620 return 30;
621 }
622 if (state == WIRELESS_STATE_IDLE) {
623 return 0;
624 }
625 if (state == WIRELESS_STATE_ROMCHECK) {
626 return 10;
627 }
628 if (state == WIRELESS_STATE_ROMFAILED) {
629 return 30;
630 }
631 if (state == WIRELESS_STATE_INIT) {
632 return 2;
633 }
634 if (state == WIRELESS_STATE_RESETTING) {
635 return 10;
636 }
637 if (state == WIRELESS_STATE_RESETFAILED) {
638 return 60;
639 }
640 if (state == WIRELESS_STATE_READY) {
641 return 60;
642 }
643 if (state == WIRELESS_STATE_CONNECTINGAP) {
644 return 120;
645 }
646 if (state == WIRELESS_STATE_DEFAULTSOFTAP) {
647 return 120;
648 }
649 if (state == WIRELESS_STATE_TRIGGERDEFAULTSOFTAP) {
650 return 120;
651 }
652 if (state == WIRELESS_STATE_APFAILED) {
653 return 2;
654 }
655 if (state == WIRELESS_STATE_CONNECTINGIP) {
656 return 30;
657 }
658 if (state == WIRELESS_STATE_CONNECTINGCLOUD) {
659 return 30;
660 }
661 if (state == WIRELESS_STATE_CONNECTED) {
662 return 0;
663 }
664 if (state == WIRELESS_STATE_NEXTAPONLY) {
665 return 2;
666 }
667 if (state == WIRELESS_STATE_NEXTAP) {
668 return 2;
669 }
670 return 0;
671}
672const int wireless_get_current_timeout() {
673 return wireless_get_state_timeout(wireless_get_current_state());
674}