forked from SeeedJP/ReButtonApp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHttpServer.cpp
More file actions
1336 lines (1143 loc) · 81.3 KB
/
HttpServer.cpp
File metadata and controls
1336 lines (1143 loc) · 81.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include <vector>
#include <Arduino.h>
#include "Config.h"
#include "HttpServer.h"
#include "AutoShutdown.h"
#include <EEPROMInterface.h>
#include <httpd.h>
#include <mico.h>
#include <EMW10xxInterface.h>
#include <SystemVariables.h>
#include <parson.h>
#include <OTAFirmwareUpdate.h>
#include <AZ3166WiFi.h>
#include <ReButton.h>
#include "Display.h"
#define POWER_OFF_TIME (1000) // [msec.]
#define app_httpd_log(...)
#define HTTPD_HDR_DEFORT (HTTPD_HDR_ADD_SERVER|HTTPD_HDR_ADD_CONN_CLOSE|HTTPD_HDR_ADD_PRAGMA_NO_CACHE)
extern NetworkInterface *network;
static const char* CSS_BOOTSTRAP_GRID = \
"/*!\n" \
" * Bootstrap Grid v4.0.0 (https://getbootstrap.com)\n" \
" * Copyright 2011-2018 The Bootstrap Authors\n" \
" * Copyright 2011-2018 Twitter, Inc.\n" \
" * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n" \
" */@-ms-viewport{width:device-width}html{box-sizing:border-box;-ms-overflow-style:scrollbar}*,::after,::before{box-sizing:inherit}.container{width:100%;padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}@media (min-width:576px){.container{max-width:540px}}@media (min-width:768px){.container{max-width:720px}}@media (min-width:992px){.container{max-width:960px}}@media (min-width:1200px){.container{max-width:1140px}}.container-fluid{width:100%;padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.row{display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-right:-15px;margin-left:-15px}.no-gutters{margin-right:0;margin-left:0}.no-gutters>.col,.no-gutters>[class*=col-]{padding-right:0;padding-left:0}.col,.col-1,.col-10,.col-11,.col-12,.col-2,.col-3,.col-4,.col-5,.col-6,.col-7,.col-8,.col-9,.col-auto,.col-lg,.col-lg-1,.col-lg-10,.col-lg-11,.col-lg-12,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-auto,.col-md,.col-md-1,.col-md-10,.col-md-11,.col-md-12,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-auto,.col-sm,.col-sm-1,.col-sm-10,.col-sm-11,.col-sm-12,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-auto,.col-xl,.col-xl-1,.col-xl-10,.col-xl-11,.col-xl-12,.col-xl-2,.col-xl-3,.col-xl-4,.col-xl-5,.col-xl-6,.col-xl-7,.col-xl-8,.col-xl-9,.col-xl-auto{position:relative;width:100%;min-height:1px;padding-right:15px;padding-left:15px}.col{-ms-flex-preferred-size:0;flex-basis:0;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;max-width:100%}.col-auto{-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto;width:auto;max-width:none}.col-1{-webkit-box-flex:0;-ms-flex:0 0 8.333333%;flex:0 0 8.333333%;max-width:8.333333%}.col-2{-webkit-box-flex:0;-ms-flex:0 0 16.666667%;flex:0 0 16.666667%;max-width:16.666667%}.col-3{-webkit-box-flex:0;-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%}.col-4{-webkit-box-flex:0;-ms-flex:0 0 33.333333%;flex:0 0 33.333333%;max-width:33.333333%}.col-5{-webkit-box-flex:0;-ms-flex:0 0 41.666667%;flex:0 0 41.666667%;max-width:41.666667%}.col-6{-webkit-box-flex:0;-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}.col-7{-webkit-box-flex:0;-ms-flex:0 0 58.333333%;flex:0 0 58.333333%;max-width:58.333333%}.col-8{-webkit-box-flex:0;-ms-flex:0 0 66.666667%;flex:0 0 66.666667%;max-width:66.666667%}.col-9{-webkit-box-flex:0;-ms-flex:0 0 75%;flex:0 0 75%;max-width:75%}.col-10{-webkit-box-flex:0;-ms-flex:0 0 83.333333%;flex:0 0 83.333333%;max-width:83.333333%}.col-11{-webkit-box-flex:0;-ms-flex:0 0 91.666667%;flex:0 0 91.666667%;max-width:91.666667%}.col-12{-webkit-box-flex:0;-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%}.order-first{-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.order-last{-webkit-box-ordinal-group:14;-ms-flex-order:13;order:13}.order-0{-webkit-box-ordinal-group:1;-ms-flex-order:0;order:0}.order-1{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}.order-2{-webkit-box-ordinal-group:3;-ms-flex-order:2;order:2}.order-3{-webkit-box-ordinal-group:4;-ms-flex-order:3;order:3}.order-4{-webkit-box-ordinal-group:5;-ms-flex-order:4;order:4}.order-5{-webkit-box-ordinal-group:6;-ms-flex-order:5;order:5}.order-6{-webkit-box-ordinal-group:7;-ms-flex-order:6;order:6}.order-7{-webkit-box-ordinal-group:8;-ms-flex-order:7;order:7}.order-8{-webkit-box-ordinal-group:9;-ms-flex-order:8;order:8}.order-9{-webkit-box-ordinal-group:10;-ms-flex-order:9;order:9}.order-10{-webkit-box-ordinal-group:11;-ms-flex-order:10;order:10}.order-11{-webkit-box-ordinal-group:12;-ms-flex-order:11;order:11}.order-12{-webkit-box-ordinal-group:13;-ms-flex-order:12;order:12}.offset-1{margin-left:8.333333%}.offset-2{margin-left:16.666667%}.offset-3{margin-left:25%}.offset-4{margin-left:33.333333%}.offset-5{margin-left:41.666667%}.offset-6{margin-left:50%}.offset-7{margin-left:58.333333%}.offset-8{margin-left:66.666667%}.offset-9{margin-left:75%}.offset-10{margin-left:83.333333%}.offset-11{margin-left:91.666667%}@media (min-width:576px){.col-sm{-ms-flex-preferred-size:0;flex-basis:0;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;max-width:100%}.col-sm-auto{-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto;width:auto;max-width:none}.col-sm-1{-webkit-box-flex:0;-ms-flex:0 0 8.333333%;flex:0 0 8.333333%;max-width:8.333333%}.col-sm-2{-webkit-box-flex:0;-ms-flex:0 0 16.666667%;flex:0 0 16.666667%;max-width:16.666667%}.col-sm-3{-webkit-box-flex:0;-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%}.col-sm-4{-webkit-box-flex:0;-ms-flex:0 0 33.333333%;flex:0 0 33.333333%;max-width:33.333333%}.col-sm-5{-webkit-box-flex:0;-ms-flex:0 0 41.666667%;flex:0 0 41.666667%;max-width:41.666667%}.col-sm-6{-webkit-box-flex:0;-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}.col-sm-7{-webkit-box-flex:0;-ms-flex:0 0 58.333333%;flex:0 0 58.333333%;max-width:58.333333%}.col-sm-8{-webkit-box-flex:0;-ms-flex:0 0 66.666667%;flex:0 0 66.666667%;max-width:66.666667%}.col-sm-9{-webkit-box-flex:0;-ms-flex:0 0 75%;flex:0 0 75%;max-width:75%}.col-sm-10{-webkit-box-flex:0;-ms-flex:0 0 83.333333%;flex:0 0 83.333333%;max-width:83.333333%}.col-sm-11{-webkit-box-flex:0;-ms-flex:0 0 91.666667%;flex:0 0 91.666667%;max-width:91.666667%}.col-sm-12{-webkit-box-flex:0;-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%}.order-sm-first{-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.order-sm-last{-webkit-box-ordinal-group:14;-ms-flex-order:13;order:13}.order-sm-0{-webkit-box-ordinal-group:1;-ms-flex-order:0;order:0}.order-sm-1{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}.order-sm-2{-webkit-box-ordinal-group:3;-ms-flex-order:2;order:2}.order-sm-3{-webkit-box-ordinal-group:4;-ms-flex-order:3;order:3}.order-sm-4{-webkit-box-ordinal-group:5;-ms-flex-order:4;order:4}.order-sm-5{-webkit-box-ordinal-group:6;-ms-flex-order:5;order:5}.order-sm-6{-webkit-box-ordinal-group:7;-ms-flex-order:6;order:6}.order-sm-7{-webkit-box-ordinal-group:8;-ms-flex-order:7;order:7}.order-sm-8{-webkit-box-ordinal-group:9;-ms-flex-order:8;order:8}.order-sm-9{-webkit-box-ordinal-group:10;-ms-flex-order:9;order:9}.order-sm-10{-webkit-box-ordinal-group:11;-ms-flex-order:10;order:10}.order-sm-11{-webkit-box-ordinal-group:12;-ms-flex-order:11;order:11}.order-sm-12{-webkit-box-ordinal-group:13;-ms-flex-order:12;order:12}.offset-sm-0{margin-left:0}.offset-sm-1{margin-left:8.333333%}.offset-sm-2{margin-left:16.666667%}.offset-sm-3{margin-left:25%}.offset-sm-4{margin-left:33.333333%}.offset-sm-5{margin-left:41.666667%}.offset-sm-6{margin-left:50%}.offset-sm-7{margin-left:58.333333%}.offset-sm-8{margin-left:66.666667%}.offset-sm-9{margin-left:75%}.offset-sm-10{margin-left:83.333333%}.offset-sm-11{margin-left:91.666667%}}@media (min-width:768px){.col-md{-ms-flex-preferred-size:0;flex-basis:0;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;max-width:100%}.col-md-auto{-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto;width:auto;max-width:none}.col-md-1{-webkit-box-flex:0;-ms-flex:0 0 8.333333%;flex:0 0 8.333333%;max-width:8.333333%}.col-md-2{-webkit-box-flex:0;-ms-flex:0 0 16.666667%;flex:0 0 16.666667%;max-width:16.666667%}.col-md-3{-webkit-box-flex:0;-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%}.col-md-4{-webkit-box-flex:0;-ms-flex:0 0 33.333333%;flex:0 0 33.333333%;max-width:33.333333%}.col-md-5{-webkit-box-flex:0;-ms-flex:0 0 41.666667%;flex:0 0 41.666667%;max-width:41.666667%}.col-md-6{-webkit-box-flex:0;-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}.col-md-7{-webkit-box-flex:0;-ms-flex:0 0 58.333333%;flex:0 0 58.333333%;max-width:58.333333%}.col-md-8{-webkit-box-flex:0;-ms-flex:0 0 66.666667%;flex:0 0 66.666667%;max-width:66.666667%}.col-md-9{-webkit-box-flex:0;-ms-flex:0 0 75%;flex:0 0 75%;max-width:75%}.col-md-10{-webkit-box-flex:0;-ms-flex:0 0 83.333333%;flex:0 0 83.333333%;max-width:83.333333%}.col-md-11{-webkit-box-flex:0;-ms-flex:0 0 91.666667%;flex:0 0 91.666667%;max-width:91.666667%}.col-md-12{-webkit-box-flex:0;-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%}.order-md-first{-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.order-md-last{-webkit-box-ordinal-group:14;-ms-flex-order:13;order:13}.order-md-0{-webkit-box-ordinal-group:1;-ms-flex-order:0;order:0}.order-md-1{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}.order-md-2{-webkit-box-ordinal-group:3;-ms-flex-order:2;order:2}.order-md-3{-webkit-box-ordinal-group:4;-ms-flex-order:3;order:3}.order-md-4{-webkit-box-ordinal-group:5;-ms-flex-order:4;order:4}.order-md-5{-webkit-box-ordinal-group:6;-ms-flex-order:5;order:5}.order-md-6{-webkit-box-ordinal-group:7;-ms-flex-order:6;order:6}.order-md-7{-webkit-box-ordinal-group:8;-ms-flex-order:7;order:7}.order-md-8{-webkit-box-ordinal-group:9;-ms-flex-order:8;order:8}.order-md-9{-webkit-box-ordinal-group:10;-ms-flex-order:9;order:9}.order-md-10{-webkit-box-ordinal-group:11;-ms-flex-order:10;order:10}.order-md-11{-webkit-box-ordinal-group:12;-ms-flex-order:11;order:11}.order-md-12{-webkit-box-ordinal-group:13;-ms-flex-order:12;order:12}.offset-md-0{margin-left:0}.offset-md-1{margin-left:8.333333%}.offset-md-2{margin-left:16.666667%}.offset-md-3{margin-left:25%}.offset-md-4{margin-left:33.333333%}.offset-md-5{margin-left:41.666667%}.offset-md-6{margin-left:50%}.offset-md-7{margin-left:58.333333%}.offset-md-8{margin-left:66.666667%}.offset-md-9{margin-left:75%}.offset-md-10{margin-left:83.333333%}.offset-md-11{margin-left:91.666667%}}@media (min-width:992px){.col-lg{-ms-flex-preferred-size:0;flex-basis:0;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;max-width:100%}.col-lg-auto{-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto;width:auto;max-width:none}.col-lg-1{-webkit-box-flex:0;-ms-flex:0 0 8.333333%;flex:0 0 8.333333%;max-width:8.333333%}.col-lg-2{-webkit-box-flex:0;-ms-flex:0 0 16.666667%;flex:0 0 16.666667%;max-width:16.666667%}.col-lg-3{-webkit-box-flex:0;-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%}.col-lg-4{-webkit-box-flex:0;-ms-flex:0 0 33.333333%;flex:0 0 33.333333%;max-width:33.333333%}.col-lg-5{-webkit-box-flex:0;-ms-flex:0 0 41.666667%;flex:0 0 41.666667%;max-width:41.666667%}.col-lg-6{-webkit-box-flex:0;-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}.col-lg-7{-webkit-box-flex:0;-ms-flex:0 0 58.333333%;flex:0 0 58.333333%;max-width:58.333333%}.col-lg-8{-webkit-box-flex:0;-ms-flex:0 0 66.666667%;flex:0 0 66.666667%;max-width:66.666667%}.col-lg-9{-webkit-box-flex:0;-ms-flex:0 0 75%;flex:0 0 75%;max-width:75%}.col-lg-10{-webkit-box-flex:0;-ms-flex:0 0 83.333333%;flex:0 0 83.333333%;max-width:83.333333%}.col-lg-11{-webkit-box-flex:0;-ms-flex:0 0 91.666667%;flex:0 0 91.666667%;max-width:91.666667%}.col-lg-12{-webkit-box-flex:0;-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%}.order-lg-first{-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.order-lg-last{-webkit-box-ordinal-group:14;-ms-flex-order:13;order:13}.order-lg-0{-webkit-box-ordinal-group:1;-ms-flex-order:0;order:0}.order-lg-1{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}.order-lg-2{-webkit-box-ordinal-group:3;-ms-flex-order:2;order:2}.order-lg-3{-webkit-box-ordinal-group:4;-ms-flex-order:3;order:3}.order-lg-4{-webkit-box-ordinal-group:5;-ms-flex-order:4;order:4}.order-lg-5{-webkit-box-ordinal-group:6;-ms-flex-order:5;order:5}.order-lg-6{-webkit-box-ordinal-group:7;-ms-flex-order:6;order:6}.order-lg-7{-webkit-box-ordinal-group:8;-ms-flex-order:7;order:7}.order-lg-8{-webkit-box-ordinal-group:9;-ms-flex-order:8;order:8}.order-lg-9{-webkit-box-ordinal-group:10;-ms-flex-order:9;order:9}.order-lg-10{-webkit-box-ordinal-group:11;-ms-flex-order:10;order:10}.order-lg-11{-webkit-box-ordinal-group:12;-ms-flex-order:11;order:11}.order-lg-12{-webkit-box-ordinal-group:13;-ms-flex-order:12;order:12}.offset-lg-0{margin-left:0}.offset-lg-1{margin-left:8.333333%}.offset-lg-2{margin-left:16.666667%}.offset-lg-3{margin-left:25%}.offset-lg-4{margin-left:33.333333%}.offset-lg-5{margin-left:41.666667%}.offset-lg-6{margin-left:50%}.offset-lg-7{margin-left:58.333333%}.offset-lg-8{margin-left:66.666667%}.offset-lg-9{margin-left:75%}.offset-lg-10{margin-left:83.333333%}.offset-lg-11{margin-left:91.666667%}}@media (min-width:1200px){.col-xl{-ms-flex-preferred-size:0;flex-basis:0;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;max-width:100%}.col-xl-auto{-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto;width:auto;max-width:none}.col-xl-1{-webkit-box-flex:0;-ms-flex:0 0 8.333333%;flex:0 0 8.333333%;max-width:8.333333%}.col-xl-2{-webkit-box-flex:0;-ms-flex:0 0 16.666667%;flex:0 0 16.666667%;max-width:16.666667%}.col-xl-3{-webkit-box-flex:0;-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%}.col-xl-4{-webkit-box-flex:0;-ms-flex:0 0 33.333333%;flex:0 0 33.333333%;max-width:33.333333%}.col-xl-5{-webkit-box-flex:0;-ms-flex:0 0 41.666667%;flex:0 0 41.666667%;max-width:41.666667%}.col-xl-6{-webkit-box-flex:0;-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}.col-xl-7{-webkit-box-flex:0;-ms-flex:0 0 58.333333%;flex:0 0 58.333333%;max-width:58.333333%}.col-xl-8{-webkit-box-flex:0;-ms-flex:0 0 66.666667%;flex:0 0 66.666667%;max-width:66.666667%}.col-xl-9{-webkit-box-flex:0;-ms-flex:0 0 75%;flex:0 0 75%;max-width:75%}.col-xl-10{-webkit-box-flex:0;-ms-flex:0 0 83.333333%;flex:0 0 83.333333%;max-width:83.333333%}.col-xl-11{-webkit-box-flex:0;-ms-flex:0 0 91.666667%;flex:0 0 91.666667%;max-width:91.666667%}.col-xl-12{-webkit-box-flex:0;-ms-flex:0 0 100%;flex:0 0 100%;max-width:100%}.order-xl-first{-webkit-box-ordinal-group:0;-ms-flex-order:-1;order:-1}.order-xl-last{-webkit-box-ordinal-group:14;-ms-flex-order:13;order:13}.order-xl-0{-webkit-box-ordinal-group:1;-ms-flex-order:0;order:0}.order-xl-1{-webkit-box-ordinal-group:2;-ms-flex-order:1;order:1}.order-xl-2{-webkit-box-ordinal-group:3;-ms-flex-order:2;order:2}.order-xl-3{-webkit-box-ordinal-group:4;-ms-flex-order:3;order:3}.order-xl-4{-webkit-box-ordinal-group:5;-ms-flex-order:4;order:4}.order-xl-5{-webkit-box-ordinal-group:6;-ms-flex-order:5;order:5}.order-xl-6{-webkit-box-ordinal-group:7;-ms-flex-order:6;order:6}.order-xl-7{-webkit-box-ordinal-group:8;-ms-flex-order:7;order:7}.order-xl-8{-webkit-box-ordinal-group:9;-ms-flex-order:8;order:8}.order-xl-9{-webkit-box-ordinal-group:10;-ms-flex-order:9;order:9}.order-xl-10{-webkit-box-ordinal-group:11;-ms-flex-order:10;order:10}.order-xl-11{-webkit-box-ordinal-group:12;-ms-flex-order:11;order:11}.order-xl-12{-webkit-box-ordinal-group:13;-ms-flex-order:12;order:12}.offset-xl-0{margin-left:0}.offset-xl-1{margin-left:8.333333%}.offset-xl-2{margin-left:16.666667%}.offset-xl-3{margin-left:25%}.offset-xl-4{margin-left:33.333333%}.offset-xl-5{margin-left:41.666667%}.offset-xl-6{margin-left:50%}.offset-xl-7{margin-left:58.333333%}.offset-xl-8{margin-left:66.666667%}.offset-xl-9{margin-left:75%}.offset-xl-10{margin-left:83.333333%}.offset-xl-11{margin-left:91.666667%}}.d-none{display:none!important}.d-inline{display:inline!important}.d-inline-block{display:inline-block!important}.d-block{display:block!important}.d-table{display:table!important}.d-table-row{display:table-row!important}.d-table-cell{display:table-cell!important}.d-flex{display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important}.d-inline-flex{display:-webkit-inline-box!important;display:-ms-inline-flexbox!important;display:inline-flex!important}@media (min-width:576px){.d-sm-none{display:none!important}.d-sm-inline{display:inline!important}.d-sm-inline-block{display:inline-block!important}.d-sm-block{display:block!important}.d-sm-table{display:table!important}.d-sm-table-row{display:table-row!important}.d-sm-table-cell{display:table-cell!important}.d-sm-flex{display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important}.d-sm-inline-flex{display:-webkit-inline-box!important;display:-ms-inline-flexbox!important;display:inline-flex!important}}@media (min-width:768px){.d-md-none{display:none!important}.d-md-inline{display:inline!important}.d-md-inline-block{display:inline-block!important}.d-md-block{display:block!important}.d-md-table{display:table!important}.d-md-table-row{display:table-row!important}.d-md-table-cell{display:table-cell!important}.d-md-flex{display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important}.d-md-inline-flex{display:-webkit-inline-box!important;display:-ms-inline-flexbox!important;display:inline-flex!important}}@media (min-width:992px){.d-lg-none{display:none!important}.d-lg-inline{display:inline!important}.d-lg-inline-block{display:inline-block!important}.d-lg-block{display:block!important}.d-lg-table{display:table!important}.d-lg-table-row{display:table-row!important}.d-lg-table-cell{display:table-cell!important}.d-lg-flex{display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important}.d-lg-inline-flex{display:-webkit-inline-box!important;display:-ms-inline-flexbox!important;display:inline-flex!important}}@media (min-width:1200px){.d-xl-none{display:none!important}.d-xl-inline{display:inline!important}.d-xl-inline-block{display:inline-block!important}.d-xl-block{display:block!important}.d-xl-table{display:table!important}.d-xl-table-row{display:table-row!important}.d-xl-table-cell{display:table-cell!important}.d-xl-flex{display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important}.d-xl-inline-flex{display:-webkit-inline-box!important;display:-ms-inline-flexbox!important;display:inline-flex!important}}@media print{.d-print-none{display:none!important}.d-print-inline{display:inline!important}.d-print-inline-block{display:inline-block!important}.d-print-block{display:block!important}.d-print-table{display:table!important}.d-print-table-row{display:table-row!important}.d-print-table-cell{display:table-cell!important}.d-print-flex{display:-webkit-box!important;display:-ms-flexbox!important;display:flex!important}.d-print-inline-flex{display:-webkit-inline-box!important;display:-ms-inline-flexbox!important;display:inline-flex!important}}.flex-row{-webkit-box-orient:horizontal!important;-webkit-box-direction:normal!important;-ms-flex-direction:row!important;flex-direction:row!important}.flex-column{-webkit-box-orient:vertical!important;-webkit-box-direction:normal!important;-ms-flex-direction:column!important;flex-direction:column!important}.flex-row-reverse{-webkit-box-orient:horizontal!important;-webkit-box-direction:reverse!important;-ms-flex-direction:row-reverse!important;flex-direction:row-reverse!important}.flex-column-reverse{-webkit-box-orient:vertical!important;-webkit-box-direction:reverse!important;-ms-flex-direction:column-reverse!important;flex-direction:column-reverse!important}.flex-wrap{-ms-flex-wrap:wrap!important;flex-wrap:wrap!important}.flex-nowrap{-ms-flex-wrap:nowrap!important;flex-wrap:nowrap!important}.flex-wrap-reverse{-ms-flex-wrap:wrap-reverse!important;flex-wrap:wrap-reverse!important}.justify-content-start{-webkit-box-pack:start!important;-ms-flex-pack:start!important;justify-content:flex-start!important}.justify-content-end{-webkit-box-pack:end!important;-ms-flex-pack:end!important;justify-content:flex-end!important}.justify-content-center{-webkit-box-pack:center!important;-ms-flex-pack:center!important;justify-content:center!important}.justify-content-between{-webkit-box-pack:justify!important;-ms-flex-pack:justify!important;justify-content:space-between!important}.justify-content-around{-ms-flex-pack:distribute!important;justify-content:space-around!important}.align-items-start{-webkit-box-align:start!important;-ms-flex-align:start!important;align-items:flex-start!important}.align-items-end{-webkit-box-align:end!important;-ms-flex-align:end!important;align-items:flex-end!important}.align-items-center{-webkit-box-align:center!important;-ms-flex-align:center!important;align-items:center!important}.align-items-baseline{-webkit-box-align:baseline!important;-ms-flex-align:baseline!important;align-items:baseline!important}.align-items-stretch{-webkit-box-align:stretch!important;-ms-flex-align:stretch!important;align-items:stretch!important}.align-content-start{-ms-flex-line-pack:start!important;align-content:flex-start!important}.align-content-end{-ms-flex-line-pack:end!important;align-content:flex-end!important}.align-content-center{-ms-flex-line-pack:center!important;align-content:center!important}.align-content-between{-ms-flex-line-pack:justify!important;align-content:space-between!important}.align-content-around{-ms-flex-line-pack:distribute!important;align-content:space-around!important}.align-content-stretch{-ms-flex-line-pack:stretch!important;align-content:stretch!important}.align-self-auto{-ms-flex-item-align:auto!important;align-self:auto!important}.align-self-start{-ms-flex-item-align:start!important;align-self:flex-start!important}.align-self-end{-ms-flex-item-align:end!important;align-self:flex-end!important}.align-self-center{-ms-flex-item-align:center!important;align-self:center!important}.align-self-baseline{-ms-flex-item-align:baseline!important;align-self:baseline!important}.align-self-stretch{-ms-flex-item-align:stretch!important;align-self:stretch!important}@media (min-width:576px){.flex-sm-row{-webkit-box-orient:horizontal!important;-webkit-box-direction:normal!important;-ms-flex-direction:row!important;flex-direction:row!important}.flex-sm-column{-webkit-box-orient:vertical!important;-webkit-box-direction:normal!important;-ms-flex-direction:column!important;flex-direction:column!important}.flex-sm-row-reverse{-webkit-box-orient:horizontal!important;-webkit-box-direction:reverse!important;-ms-flex-direction:row-reverse!important;flex-direction:row-reverse!important}.flex-sm-column-reverse{-webkit-box-orient:vertical!important;-webkit-box-direction:reverse!important;-ms-flex-direction:column-reverse!important;flex-direction:column-reverse!important}.flex-sm-wrap{-ms-flex-wrap:wrap!important;flex-wrap:wrap!important}.flex-sm-nowrap{-ms-flex-wrap:nowrap!important;flex-wrap:nowrap!important}.flex-sm-wrap-reverse{-ms-flex-wrap:wrap-reverse!important;flex-wrap:wrap-reverse!important}.justify-content-sm-start{-webkit-box-pack:start!important;-ms-flex-pack:start!important;justify-content:flex-start!important}.justify-content-sm-end{-webkit-box-pack:end!important;-ms-flex-pack:end!important;justify-content:flex-end!important}.justify-content-sm-center{-webkit-box-pack:center!important;-ms-flex-pack:center!important;justify-content:center!important}.justify-content-sm-between{-webkit-box-pack:justify!important;-ms-flex-pack:justify!important;justify-content:space-between!important}.justify-content-sm-around{-ms-flex-pack:distribute!important;justify-content:space-around!important}.align-items-sm-start{-webkit-box-align:start!important;-ms-flex-align:start!important;align-items:flex-start!important}.align-items-sm-end{-webkit-box-align:end!important;-ms-flex-align:end!important;align-items:flex-end!important}.align-items-sm-center{-webkit-box-align:center!important;-ms-flex-align:center!important;align-items:center!important}.align-items-sm-baseline{-webkit-box-align:baseline!important;-ms-flex-align:baseline!important;align-items:baseline!important}.align-items-sm-stretch{-webkit-box-align:stretch!important;-ms-flex-align:stretch!important;align-items:stretch!important}.align-content-sm-start{-ms-flex-line-pack:start!important;align-content:flex-start!important}.align-content-sm-end{-ms-flex-line-pack:end!important;align-content:flex-end!important}.align-content-sm-center{-ms-flex-line-pack:center!important;align-content:center!important}.align-content-sm-between{-ms-flex-line-pack:justify!important;align-content:space-between!important}.align-content-sm-around{-ms-flex-line-pack:distribute!important;align-content:space-around!important}.align-content-sm-stretch{-ms-flex-line-pack:stretch!important;align-content:stretch!important}.align-self-sm-auto{-ms-flex-item-align:auto!important;align-self:auto!important}.align-self-sm-start{-ms-flex-item-align:start!important;align-self:flex-start!important}.align-self-sm-end{-ms-flex-item-align:end!important;align-self:flex-end!important}.align-self-sm-center{-ms-flex-item-align:center!important;align-self:center!important}.align-self-sm-baseline{-ms-flex-item-align:baseline!important;align-self:baseline!important}.align-self-sm-stretch{-ms-flex-item-align:stretch!important;align-self:stretch!important}}@media (min-width:768px){.flex-md-row{-webkit-box-orient:horizontal!important;-webkit-box-direction:normal!important;-ms-flex-direction:row!important;flex-direction:row!important}.flex-md-column{-webkit-box-orient:vertical!important;-webkit-box-direction:normal!important;-ms-flex-direction:column!important;flex-direction:column!important}.flex-md-row-reverse{-webkit-box-orient:horizontal!important;-webkit-box-direction:reverse!important;-ms-flex-direction:row-reverse!important;flex-direction:row-reverse!important}.flex-md-column-reverse{-webkit-box-orient:vertical!important;-webkit-box-direction:reverse!important;-ms-flex-direction:column-reverse!important;flex-direction:column-reverse!important}.flex-md-wrap{-ms-flex-wrap:wrap!important;flex-wrap:wrap!important}.flex-md-nowrap{-ms-flex-wrap:nowrap!important;flex-wrap:nowrap!important}.flex-md-wrap-reverse{-ms-flex-wrap:wrap-reverse!important;flex-wrap:wrap-reverse!important}.justify-content-md-start{-webkit-box-pack:start!important;-ms-flex-pack:start!important;justify-content:flex-start!important}.justify-content-md-end{-webkit-box-pack:end!important;-ms-flex-pack:end!important;justify-content:flex-end!important}.justify-content-md-center{-webkit-box-pack:center!important;-ms-flex-pack:center!important;justify-content:center!important}.justify-content-md-between{-webkit-box-pack:justify!important;-ms-flex-pack:justify!important;justify-content:space-between!important}.justify-content-md-around{-ms-flex-pack:distribute!important;justify-content:space-around!important}.align-items-md-start{-webkit-box-align:start!important;-ms-flex-align:start!important;align-items:flex-start!important}.align-items-md-end{-webkit-box-align:end!important;-ms-flex-align:end!important;align-items:flex-end!important}.align-items-md-center{-webkit-box-align:center!important;-ms-flex-align:center!important;align-items:center!important}.align-items-md-baseline{-webkit-box-align:baseline!important;-ms-flex-align:baseline!important;align-items:baseline!important}.align-items-md-stretch{-webkit-box-align:stretch!important;-ms-flex-align:stretch!important;align-items:stretch!important}.align-content-md-start{-ms-flex-line-pack:start!important;align-content:flex-start!important}.align-content-md-end{-ms-flex-line-pack:end!important;align-content:flex-end!important}.align-content-md-center{-ms-flex-line-pack:center!important;align-content:center!important}.align-content-md-between{-ms-flex-line-pack:justify!important;align-content:space-between!important}.align-content-md-around{-ms-flex-line-pack:distribute!important;align-content:space-around!important}.align-content-md-stretch{-ms-flex-line-pack:stretch!important;align-content:stretch!important}.align-self-md-auto{-ms-flex-item-align:auto!important;align-self:auto!important}.align-self-md-start{-ms-flex-item-align:start!important;align-self:flex-start!important}.align-self-md-end{-ms-flex-item-align:end!important;align-self:flex-end!important}.align-self-md-center{-ms-flex-item-align:center!important;align-self:center!important}.align-self-md-baseline{-ms-flex-item-align:baseline!important;align-self:baseline!important}.align-self-md-stretch{-ms-flex-item-align:stretch!important;align-self:stretch!important}}@media (min-width:992px){.flex-lg-row{-webkit-box-orient:horizontal!important;-webkit-box-direction:normal!important;-ms-flex-direction:row!important;flex-direction:row!important}.flex-lg-column{-webkit-box-orient:vertical!important;-webkit-box-direction:normal!important;-ms-flex-direction:column!important;flex-direction:column!important}.flex-lg-row-reverse{-webkit-box-orient:horizontal!important;-webkit-box-direction:reverse!important;-ms-flex-direction:row-reverse!important;flex-direction:row-reverse!important}.flex-lg-column-reverse{-webkit-box-orient:vertical!important;-webkit-box-direction:reverse!important;-ms-flex-direction:column-reverse!important;flex-direction:column-reverse!important}.flex-lg-wrap{-ms-flex-wrap:wrap!important;flex-wrap:wrap!important}.flex-lg-nowrap{-ms-flex-wrap:nowrap!important;flex-wrap:nowrap!important}.flex-lg-wrap-reverse{-ms-flex-wrap:wrap-reverse!important;flex-wrap:wrap-reverse!important}.justify-content-lg-start{-webkit-box-pack:start!important;-ms-flex-pack:start!important;justify-content:flex-start!important}.justify-content-lg-end{-webkit-box-pack:end!important;-ms-flex-pack:end!important;justify-content:flex-end!important}.justify-content-lg-center{-webkit-box-pack:center!important;-ms-flex-pack:center!important;justify-content:center!important}.justify-content-lg-between{-webkit-box-pack:justify!important;-ms-flex-pack:justify!important;justify-content:space-between!important}.justify-content-lg-around{-ms-flex-pack:distribute!important;justify-content:space-around!important}.align-items-lg-start{-webkit-box-align:start!important;-ms-flex-align:start!important;align-items:flex-start!important}.align-items-lg-end{-webkit-box-align:end!important;-ms-flex-align:end!important;align-items:flex-end!important}.align-items-lg-center{-webkit-box-align:center!important;-ms-flex-align:center!important;align-items:center!important}.align-items-lg-baseline{-webkit-box-align:baseline!important;-ms-flex-align:baseline!important;align-items:baseline!important}.align-items-lg-stretch{-webkit-box-align:stretch!important;-ms-flex-align:stretch!important;align-items:stretch!important}.align-content-lg-start{-ms-flex-line-pack:start!important;align-content:flex-start!important}.align-content-lg-end{-ms-flex-line-pack:end!important;align-content:flex-end!important}.align-content-lg-center{-ms-flex-line-pack:center!important;align-content:center!important}.align-content-lg-between{-ms-flex-line-pack:justify!important;align-content:space-between!important}.align-content-lg-around{-ms-flex-line-pack:distribute!important;align-content:space-around!important}.align-content-lg-stretch{-ms-flex-line-pack:stretch!important;align-content:stretch!important}.align-self-lg-auto{-ms-flex-item-align:auto!important;align-self:auto!important}.align-self-lg-start{-ms-flex-item-align:start!important;align-self:flex-start!important}.align-self-lg-end{-ms-flex-item-align:end!important;align-self:flex-end!important}.align-self-lg-center{-ms-flex-item-align:center!important;align-self:center!important}.align-self-lg-baseline{-ms-flex-item-align:baseline!important;align-self:baseline!important}.align-self-lg-stretch{-ms-flex-item-align:stretch!important;align-self:stretch!important}}@media (min-width:1200px){.flex-xl-row{-webkit-box-orient:horizontal!important;-webkit-box-direction:normal!important;-ms-flex-direction:row!important;flex-direction:row!important}.flex-xl-column{-webkit-box-orient:vertical!important;-webkit-box-direction:normal!important;-ms-flex-direction:column!important;flex-direction:column!important}.flex-xl-row-reverse{-webkit-box-orient:horizontal!important;-webkit-box-direction:reverse!important;-ms-flex-direction:row-reverse!important;flex-direction:row-reverse!important}.flex-xl-column-reverse{-webkit-box-orient:vertical!important;-webkit-box-direction:reverse!important;-ms-flex-direction:column-reverse!important;flex-direction:column-reverse!important}.flex-xl-wrap{-ms-flex-wrap:wrap!important;flex-wrap:wrap!important}.flex-xl-nowrap{-ms-flex-wrap:nowrap!important;flex-wrap:nowrap!important}.flex-xl-wrap-reverse{-ms-flex-wrap:wrap-reverse!important;flex-wrap:wrap-reverse!important}.justify-content-xl-start{-webkit-box-pack:start!important;-ms-flex-pack:start!important;justify-content:flex-start!important}.justify-content-xl-end{-webkit-box-pack:end!important;-ms-flex-pack:end!important;justify-content:flex-end!important}.justify-content-xl-center{-webkit-box-pack:center!important;-ms-flex-pack:center!important;justify-content:center!important}.justify-content-xl-between{-webkit-box-pack:justify!important;-ms-flex-pack:justify!important;justify-content:space-between!important}.justify-content-xl-around{-ms-flex-pack:distribute!important;justify-content:space-around!important}.align-items-xl-start{-webkit-box-align:start!important;-ms-flex-align:start!important;align-items:flex-start!important}.align-items-xl-end{-webkit-box-align:end!important;-ms-flex-align:end!important;align-items:flex-end!important}.align-items-xl-center{-webkit-box-align:center!important;-ms-flex-align:center!important;align-items:center!important}.align-items-xl-baseline{-webkit-box-align:baseline!important;-ms-flex-align:baseline!important;align-items:baseline!important}.align-items-xl-stretch{-webkit-box-align:stretch!important;-ms-flex-align:stretch!important;align-items:stretch!important}.align-content-xl-start{-ms-flex-line-pack:start!important;align-content:flex-start!important}.align-content-xl-end{-ms-flex-line-pack:end!important;align-content:flex-end!important}.align-content-xl-center{-ms-flex-line-pack:center!important;align-content:center!important}.align-content-xl-between{-ms-flex-line-pack:justify!important;align-content:space-between!important}.align-content-xl-around{-ms-flex-line-pack:distribute!important;align-content:space-around!important}.align-content-xl-stretch{-ms-flex-line-pack:stretch!important;align-content:stretch!important}.align-self-xl-auto{-ms-flex-item-align:auto!important;align-self:auto!important}.align-self-xl-start{-ms-flex-item-align:start!important;align-self:flex-start!important}.align-self-xl-end{-ms-flex-item-align:end!important;align-self:flex-end!important}.align-self-xl-center{-ms-flex-item-align:center!important;align-self:center!important}.align-self-xl-baseline{-ms-flex-item-align:baseline!important;align-self:baseline!important}.align-self-xl-stretch{-ms-flex-item-align:stretch!important;align-self:stretch!important}}\n" \
"/*# sourceMappingURL=bootstrap-grid.min.css.map */";
static const char* CSS_REBUTTON = \
"html, *{font-size: 16px; font-family: -apple-system, BlinkMacSystemFont,\"Segoe UI\",\"Roboto\", \"Droid Sans\",\"Helvetica Neue\", Helvetica, Arial, sans-serif; line-height: 1.5;}" \
"body{margin: 0; color: #212121; background: #f8f8f8;}" \
"h1, h2, h3{line-height: 1.2rem; margin: 0.75rem; font-weight: 500;}" \
"h1{font-size: 1.5rem; margin: 0rem 0.75rem;}" \
"h2{font-size: 1.25rem;}" \
"h3{font-size: 1rem;}" \
"p{margin: 0.75rem;}" \
"small{font-size: 0.75em;}" \
"header{height: 3rem; background: #8bc31f; color: #f5f5f5;}" \
"header h1{line-height: 3rem;}" \
".row{margin: 0.5rem;}" \
"form{background: #eeeeee; border: 1px solid #c9c9c9; margin: 0.5rem; padding: 1rem;}" \
"input{width:100%;}" \
"button{background: rgba(143, 195, 31, 1); color: #fafafa; border: 0; border-radius: 2px; padding: 0.5rem 0.75rem; margin: 0.5rem; text-decoration: none; transition: background 0.3s; cursor: pointer;}" \
"button:hover{background: #004966; opacity: 1;}";
static const char* HTML_INDEX = \
"<!DOCTYPE html>" \
"<html lang=\"en\">" \
"<head>" \
"<meta charset=\"UTF-8\">" \
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">" \
"<meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">" \
"<title>ReButton</title>" \
"<link rel=\"stylesheet\" href=\"/bootstrap-grid.min.css\" crossorigin=\"anonymous\">" \
"<link rel=\"stylesheet\" href=\"/rebutton.css\" crossorigin=\"anonymous\">" \
"</head>" \
"<body>" \
"<header>" \
"<h1>ReButton - Home</h1>" \
"</header>" \
"<div class=\"container\">" \
"<div class=\"row\"><p style=\"width: 100%%; text-align: center;\"><a href=\"/wifi\" target=\"_self\">Wi-Fi</a></p></div>" \
"<div class=\"row\"><p style=\"width: 100%%; text-align: center;\"><a href=\"/iotcentral\" target=\"_self\">Azure IoT Central</a></p></div>" \
"<div class=\"row\"><p style=\"width: 100%%; text-align: center;\"><a href=\"/iothub\" target=\"_self\">Azure IoT Hub</a></p></div>" \
"<div class=\"row\"><p style=\"width: 100%%; text-align: center;\"><a href=\"/message\" target=\"_self\">Device to Cloud (D2C) Message</a></p></div>" \
"<div class=\"row\"><p style=\"width: 100%%; text-align: center;\"><a href=\"/apmode\" target=\"_self\">Access Point Mode</a></p></div>" \
"<div class=\"row\"><p style=\"width: 100%%; text-align: center;\"><a href=\"/firmware\" target=\"_self\">Firmware Update</a></p></div>" \
"<div class=\"row\">" \
"<button class=\"col-md-2 offset-md-9\" type=\"button\" onclick=\"location.href='/shutdown'\">Shutdown</button>" \
"</div>" \
"<div style=\"background: #e0e0e0;\">" \
"<div class=\"row\">" \
"<small class=\"col-md-2\">Firmware Ver.</small>" \
"<small class=\"col-md-10\">%s</small>" \
"</div>" \
"<div class=\"row\">" \
"<small class=\"col-md-2\">MAC Address</small>" \
"<small class=\"col-md-10\">%s</small>" \
"</div>" \
"<div class=\"row\">" \
"<small class=\"col-md-2\">Wi-Fi SSID</small>" \
"<small class=\"col-md-10\">%s</small>" \
"</div>" \
"<div class=\"row\">" \
"<small class=\"col-md-2\">Time Server</small>" \
"<small class=\"col-md-10\">%s</small>" \
"</div>" \
"<div class=\"row\">" \
"<small class=\"col-md-2\">Product Id</small>" \
"<small class=\"col-md-10\">%s</small>" \
"</div>" \
"</div>" \
"</div>" \
"</body>" \
"</html>";
static const char* HTML_WIFI_A = \
"<!DOCTYPE html>" \
"<html lang=\"en\">" \
"<head>" \
"<meta charset=\"UTF-8\">" \
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">" \
"<meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">" \
"<title>ReButton</title>" \
"<link rel=\"stylesheet\" href=\"/bootstrap-grid.min.css\" crossorigin=\"anonymous\">" \
"<link rel=\"stylesheet\" href=\"/rebutton.css\" crossorigin=\"anonymous\">" \
"</head>" \
"<body>" \
"<header>" \
"<h1>ReButton - Wi-Fi</h1>" \
"</header>" \
"<div class=\"container\">" \
"<form action=\"wifi2\" method=\"post\" enctype=\"multipart/form-data\">" \
"<div class=\"row\">" \
"<label class=\"col-md-2\" for=\"WiFiSSID\">Wi-Fi SSID</label>" \
"<div class=\"col-md-10\">" \
"<select class=\"col-md-10\" name=\"WiFiSSID\" id=\"WiFiSSID\">";
static const char* HTML_WIFI_B = \
"</select>" \
"</div>" \
"<small class=\"col-md-10 offset-md-2\">" \
"Select WiFi SSID to connect<br>" \
"Please refresh browser to re-scan SSID if your SSID is not in the list above" \
"</small>" \
"</div>" \
"<div class=\"row\">" \
"<label class=\"col-md-2\" for=\"WiFiPassword\">Wi-Fi Passphrase</label>" \
"<div class=\"col-md-10\">" \
"<input name=\"WiFiPassword\" id=\"WiFiPassword\" value=\"\" type=\"password\">" \
"</div>" \
"<small class=\"col-md-10 offset-md-2\">Specify passphrase for SSID</small>" \
"</div>" \
"<div class=\"row\">" \
"<label class=\"col-md-2\" for=\"TimeServer\">Time Server</label>" \
"<div class=\"col-md-10\">" \
"<input name=\"TimeServer\" id=\"TimeServer\" value=\"%s\" type=\"text\">" \
"</div>" \
"<small class=\"col-md-10 offset-md-2\">Specify Internet Time Server (Optional)</small>" \
"</div>" \
"<div class=\"row\">" \
"<button class=\"col-md-2 offset-md-1\" type=\"submit\">Save</button>" \
"<button class=\"col-md-2 offset-md-3\" type=\"button\" onclick=\"location.href='/'\">Home</button>" \
"<button class=\"col-md-2\" type=\"button\" onclick=\"location.href='/shutdown'\">Shutdown</button>" \
"</div>" \
"</form>" \
"</div>" \
"</body>" \
"</html>";
static const char* HTML_WIFI2_SUCCESS = \
"<!DOCTYPE html>" \
"<html lang=\"en\">" \
"<head>" \
"<meta charset=\"UTF-8\">" \
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">" \
"<meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">" \
"<title>ReButton</title>" \
"<link rel=\"stylesheet\" href=\"/bootstrap-grid.min.css\" crossorigin=\"anonymous\">" \
"<link rel=\"stylesheet\" href=\"/rebutton.css\" crossorigin=\"anonymous\">" \
"</head>" \
"<body>" \
"<header>" \
"<h1>ReButton - Wi-Fi</h1>" \
"</header>" \
"<div class=\"container\">" \
"<div class=\"row\">" \
"<h2 style=\"width: 100%%; text-align: center;\">Wi-Fi saved.</h2>" \
"</div>" \
"<div class=\"row\">" \
"<button class=\"col-md-2 offset-md-7\" type=\"button\" onclick=\"location.href='/'\">Home</button>" \
"<button class=\"col-md-2\" type=\"button\" onclick=\"location.href='/shutdown'\">Shutdown</button>" \
"</div>" \
"</div>" \
"</body>" \
"</html>";
static const char* HTML_IOTCENTRAL = \
"<!DOCTYPE html>" \
"<html lang=\"en\">" \
"<head>" \
"<meta charset=\"UTF-8\">" \
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">" \
"<meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">" \
"<title>ReButton</title>" \
"<link rel=\"stylesheet\" href=\"/bootstrap-grid.min.css\" crossorigin=\"anonymous\">" \
"<link rel=\"stylesheet\" href=\"/rebutton.css\" crossorigin=\"anonymous\">" \
"</head>" \
"<body>" \
"<header>" \
"<h1>ReButton - Azure IoT Central</h1>" \
"</header>" \
"<div class=\"container\">" \
"<form action=\"iotcentral2\" method=\"post\" enctype=\"multipart/form-data\">" \
"<div class=\"row\">" \
"<h2>Connect ReButton to Azure IoT Central</h2>" \
"</div>" \
"<div class=\"row\">" \
"<p>" \
"More about Azure IoT Central : <a href=\"https://aka.ms/AzureIoTCentral\">https://aka.ms/AzureIoTCentral</a>" \
"</p>" \
"</div>" \
"<div class=\"row\">" \
"<label class=\"col-md-2\" for=\"ScopeId\">Scope ID</label>" \
"<div class=\"col-md-10\">" \
"<input name=\"ScopeId\" id=\"ScopeId\" value=\"%s\" type=\"text\">" \
"</div>" \
"</div>" \
"<div class=\"row\">" \
"<label class=\"col-md-2\" for=\"DeviceId\">Device ID</label>" \
"<div class=\"col-md-10\">" \
"<input name=\"DeviceId\" id=\"DeviceId\" value=\"%s\" type=\"text\">" \
"</div>" \
"</div>" \
"<div class=\"row\">" \
"<label class=\"col-md-2\" for=\"SasKey\">SAS Key</label>" \
"<div class=\"col-md-10\">" \
"<input name=\"SasKey\" id=\"SasKey\" value=\"%s\" type=\"text\">" \
"</div>" \
"<small class=\"col-md-10 offset-md-2\">Please enter either Primary or Secondary key</small>" \
"</div>" \
"<div class=\"row\">" \
"<button class=\"col-md-2 offset-md-1\" type=\"submit\">Save</button>" \
"<button class=\"col-md-2 offset-md-3\" type=\"button\" onclick=\"location.href='/'\">Home</button>" \
"<button class=\"col-md-2\" type=\"button\" onclick=\"location.href='/shutdown'\">Shutdown</button>" \
"</div>" \
"</form>" \
"</div>" \
"</body>" \
"</html>";
static const char* HTML_IOTCENTRAL2_SUCCESS = \
"<!DOCTYPE html>" \
"<html lang=\"en\">" \
"<head>" \
"<meta charset=\"UTF-8\">" \
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">" \
"<meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">" \
"<title>ReButton</title>" \
"<link rel=\"stylesheet\" href=\"/bootstrap-grid.min.css\" crossorigin=\"anonymous\">" \
"<link rel=\"stylesheet\" href=\"/rebutton.css\" crossorigin=\"anonymous\">" \
"</head>" \
"<body>" \
"<header>" \
"<h1>ReButton - Azure IoT Central</h1>" \
"</header>" \
"<div class=\"container\">" \
"<div class=\"row\">" \
"<h2 style=\"width: 100%%; text-align: center;\">Azure IoT Central saved.</h2>" \
"</div>" \
"<div class=\"row\">" \
"<button class=\"col-md-2 offset-md-7\" type=\"button\" onclick=\"location.href='/'\">Home</button>" \
"<button class=\"col-md-2\" type=\"button\" onclick=\"location.href='/shutdown'\">Shutdown</button>" \
"</div>" \
"</div>" \
"</body>" \
"</html>";
static const char* HTML_IOTHUB = \
"<!DOCTYPE html>" \
"<html lang=\"en\">" \
"<head>" \
"<meta charset=\"UTF-8\">" \
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">" \
"<meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">" \
"<title>ReButton</title>" \
"<link rel=\"stylesheet\" href=\"/bootstrap-grid.min.css\" crossorigin=\"anonymous\">" \
"<link rel=\"stylesheet\" href=\"/rebutton.css\" crossorigin=\"anonymous\">" \
"</head>" \
"<body>" \
"<header>" \
"<h1>ReButton - Azure IoT Hub</h1>" \
"</header>" \
"<div class=\"container\">" \
"<form action=\"iothub2\" method=\"post\" enctype=\"multipart/form-data\"> " \
"<div class=\"row\">" \
"<h2>Connect ReButton to Azure IoT Hub</h2>" \
"</div>" \
"<div class=\"row\">" \
"<p>" \
"More about Azure IoT Hub : <a href=\"https://aka.ms/iothub\">https://aka.ms/iothub</a>" \
"</p>" \
"</div>" \
"<div class=\"row\">" \
"<label class=\"col-12\" for=\"IoTHubConnectionString\">Azure IoT Hub connection string</label>" \
"<div class=\"col-12\">" \
"<input name=\"IoTHubConnectionString\" id=\"IoTHubConnectionString\" value=\"%s\" type=\"text\">" \
"</div>" \
"</div>" \
"<div class=\"row\">" \
"<button class=\"col-md-2 offset-md-1\" type=\"submit\">Save</button>" \
"<button class=\"col-md-2 offset-md-3\" type=\"button\" onclick=\"location.href='/'\">Home</button>" \
"<button class=\"col-md-2\" type=\"button\" onclick=\"location.href='/shutdown'\">Shutdown</button>" \
"</div>" \
"</form>" \
"</div>" \
"</body>" \
"</html>";
static const char* HTML_IOTHUB2_SUCCESS = \
"<!DOCTYPE html>" \
"<html lang=\"en\">" \
"<head>" \
"<meta charset=\"UTF-8\">" \
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">" \
"<meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">" \
"<title>ReButton</title>" \
"<link rel=\"stylesheet\" href=\"/bootstrap-grid.min.css\" crossorigin=\"anonymous\">" \
"<link rel=\"stylesheet\" href=\"/rebutton.css\" crossorigin=\"anonymous\">" \
"</head>" \
"<body>" \
"<header>" \
"<h1>ReButton - Azure IoT Hub</h1>" \
"</header>" \
"<div class=\"container\">" \
"<div class=\"row\">" \
"<h2 style=\"width: 100%%; text-align: center;\">Azure IoT Hub saved.</h2>" \
"</div>" \
"<div class=\"row\">" \
"<button class=\"col-md-2 offset-md-7\" type=\"button\" onclick=\"location.href='/'\">Home</button>" \
"<button class=\"col-md-2\" type=\"button\" onclick=\"location.href='/shutdown'\">Shutdown</button>" \
"</div>" \
"</div>" \
"</body>" \
"</html>";
static const char* HTML_MESSAGE = \
"<!DOCTYPE html>" \
"<html lang=\"en\">" \
"<head>" \
"<meta charset=\"UTF-8\">" \
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">" \
"<meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">" \
"<title>ReButton</title>" \
"<link rel=\"stylesheet\" href=\"/bootstrap-grid.min.css\" crossorigin=\"anonymous\">" \
"<link rel=\"stylesheet\" href=\"/rebutton.css\" crossorigin=\"anonymous\">" \
"</head>" \
"<body>" \
"<header>" \
"<h1>ReButton - Message</h1>" \
"</header>" \
"<div class=\"container\">" \
"<form action=\"message2\" method=\"post\" enctype=\"multipart/form-data\">" \
"<div class=\"row\">" \
"<h2>Message Settings</h2>" \
"</div>" \
"<div class=\"row\">" \
"<p>" \
"Customize messages for button press events" \
"</p>" \
"</div>" \
"<div class=\"row\">" \
"<label class=\"col-12\" for=\"Message1\">Single click message</label>" \
"<div class=\"col-12\">" \
"<input name=\"Message1\" id=\"Message1\" value=\"%s\" type=\"text\">" \
"</div>" \
"</div>" \
"<div class=\"row\">" \
"<label class=\"col-12\" for=\"Message2\">Double click message</label>" \
"<div class=\"col-12\">" \
"<input name=\"Message2\" id=\"Message2\" value=\"%s\" type=\"text\">" \
"</div>" \
"</div>" \
"<div class=\"row\">" \
"<label class=\"col-12\" for=\"Message3\">Triple click message</label>" \
"<div class=\"col-12\">" \
"<input name=\"Message3\" id=\"Message3\" value=\"%s\" type=\"text\">" \
"</div>" \
"</div>" \
"<div class=\"row\">" \
"<label class=\"col-12\" for=\"Message10\">Long press message (3 seconds)</label>" \
"<div class=\"col-12\">" \
"<input name=\"Message10\" id=\"Message10\" value=\"%s\" type=\"text\">" \
"</div>" \
"</div>" \
"<div class=\"row\">" \
"<label class=\"col-12\" for=\"Message11\">Super long press message (6 Seconds)</label>" \
"<div class=\"col-12\">" \
"<input name=\"Message11\" id=\"Message11\" value=\"%s\" type=\"text\">" \
"</div>" \
"</div>" \
"<div class=\"row\">" \
"<label class=\"col-12\" for=\"CustomMessageJson\">Custom message (JSON format)</label>" \
"<div class=\"col-12\">" \
"<input name=\"CustomMessageJson\" id=\"CustomMessageJson\" value=\"%s\" type=\"text\">" \
"</div>" \
"</div>" \
"<div class=\"row\">" \
"<label class=\"col-12\" for=\"ProductId\">Product Id</label>" \
"<div class=\"col-12\">" \
"<input name=\"ProductId\" id=\"ProductId\" value=\"%s\" type=\"text\">" \
"</div>" \
"</div>" \
"<div class=\"row\">" \
"<label class=\"col-12\" for=\"CustomMessagePropName\">Custom message property name (Device twins)</label>" \
"<div class=\"col-12\">" \
"<input name=\"CustomMessagePropName\" id=\"CustomMessagePropName\" value=\"%s\" type=\"text\">" \
"</div>" \
"</div>" \
"<div class=\"row\">" \
"<button class=\"col-md-2 offset-md-1\" type=\"submit\">Save</button>" \
"<button class=\"col-md-2 offset-md-3\" type=\"button\" onclick=\"location.href='/'\">Home</button>" \
"<button class=\"col-md-2\" type=\"button\" onclick=\"location.href='/shutdown'\">Shutdown</button>" \
"</div>" \
"</form>" \
"</div>" \
"</body>" \
"</html>";
static const char* HTML_MESSAGE2_SUCCESS = \
"<!DOCTYPE html>" \
"<html lang=\"en\">" \
"<head>" \
"<meta charset=\"UTF-8\">" \
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">" \
"<meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">" \
"<title>ReButton</title>" \
"<link rel=\"stylesheet\" href=\"/bootstrap-grid.min.css\" crossorigin=\"anonymous\">" \
"<link rel=\"stylesheet\" href=\"/rebutton.css\" crossorigin=\"anonymous\">" \
"</head>" \
"<body>" \
"<header>" \
"<h1>ReButton - Message</h1> " \
"</header>" \
"<div class=\"container\">" \
"<div class=\"row\">" \
"<h2 style=\"width: 100%%; text-align: center;\">Message saved.</h2>" \
"</div>" \
"<div class=\"row\">" \
"<button class=\"col-md-2 offset-md-7\" type=\"button\" onclick=\"location.href='/'\">Home</button>" \
"<button class=\"col-md-2\" type=\"button\" onclick=\"location.href='/shutdown'\">Shutdown</button>" \
"</div>" \
"</div>" \
"</body>" \
"</html>";
static const char* HTML_APMODE = \
"<!DOCTYPE html>" \
"<html lang=\"en\">" \
"<head>" \
"<meta charset=\"UTF-8\">" \
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">" \
"<meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">" \
"<title>ReButton</title>" \
"<link rel=\"stylesheet\" href=\"/bootstrap-grid.min.css\" crossorigin=\"anonymous\">" \
"<link rel=\"stylesheet\" href=\"/rebutton.css\" crossorigin=\"anonymous\">" \
"</head>" \
"<body>" \
"<header>" \
"<h1>ReButton - Access Point Mode</h1>" \
"</header>" \
"<div class=\"container\">" \
"<form action=\"apmode2\" method=\"post\" enctype=\"multipart/form-data\">" \
"<div class=\"row\">" \
"<h2>Access Point Mode Settings</h2>" \
"</div>" \
"<div class=\"row\">" \
"<label class=\"col-md-2\" for=\"APmodeSSID\">AP SSID</label>" \
"<div class=\"col-md-10\">" \
"<input name=\"APmodeSSID\" id=\"APmodeSSID\" value=\"%s\" type=\"text\">" \
"</div>" \
"</div>" \
"<div class=\"row\">" \
"<button class=\"col-md-2 offset-md-1\" type=\"submit\">Save</button>" \
"<button class=\"col-md-2 offset-md-3\" type=\"button\" onclick=\"location.href='/'\">Home</button>" \
"<button class=\"col-md-2\" type=\"button\" onclick=\"location.href='/shutdown'\">Shutdown</button>" \
"</div>" \
"</form>" \
"</div>" \
"</body>" \
"</html>";
static const char* HTML_APMODE2_SUCCESS = \
"<!DOCTYPE html>" \
"<html lang=\"en\">" \
"<head>" \
"<meta charset=\"UTF-8\">" \
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">" \
"<meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">" \
"<title>ReButton</title>" \
"<link rel=\"stylesheet\" href=\"/bootstrap-grid.min.css\" crossorigin=\"anonymous\">" \
"<link rel=\"stylesheet\" href=\"/rebutton.css\" crossorigin=\"anonymous\">" \
"</head>" \
"<body>" \
"<header>" \
"<h1>ReButton - Access Point Mode</h1> " \
"</header>" \
"<div class=\"container\">" \
"<div class=\"row\">" \
"<h2 style=\"width: 100%%; text-align: center;\">Access Point Mode saved.</h2>" \
"</div>" \
"<div class=\"row\">" \
"<button class=\"col-md-2 offset-md-7\" type=\"button\" onclick=\"location.href='/'\">Home</button>" \
"<button class=\"col-md-2\" type=\"button\" onclick=\"location.href='/shutdown'\">Shutdown</button>" \
"</div>" \
"</div>" \
"</body>" \
"</html>";
static const char* HTML_FIRMWARE_UPDATE = \
"<!DOCTYPE html>" \
"<html lang=\"en\">" \
"<head>" \
"<meta charset=\"UTF-8\">" \
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">" \
"<meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">" \
"<title>ReButton</title>" \
"<link rel=\"stylesheet\" href=\"/bootstrap-grid.min.css\" crossorigin=\"anonymous\">" \
"<link rel=\"stylesheet\" href=\"/rebutton.css\" crossorigin=\"anonymous\">" \
"</head>" \
"<body>" \
"<header>" \
"<h1>ReButton - Firmware Update</h1>" \
"</header>" \
"<div class=\"container\">" \
"<form action=\"firmware2\" method=\"post\" enctype=\"multipart/form-data\"> " \
"<div class=\"row\">" \
"<h2>Current firmware version : %s</h2>" \
"</div>" \
"<div class=\"row\">" \
"<label class=\"col-md-2\" for=\"PackageURI\">Package URI</label>" \
"<div class=\"col-md-10\">" \
"<input name=\"PackageURI\" id=\"PackageURI\" value=\"\" type=\"url\">" \
"</div>" \
"</div>" \
"<div class=\"row\">" \
"<label class=\"col-md-2\" for=\"PackageCRC\">Package CRC</label>" \
"<div class=\"col-md-10\">" \
"<input name=\"PackageCRC\" id=\"PackageCRC\" value=\"\" type=\"text\">" \
"</div>" \
"</div>" \
"<div class=\"row\">" \
"<label class=\"col-md-2\" for=\"PackageSize\">Package size</label>" \
"<div class=\"col-md-10\">" \
"<input name=\"PackageSize\" id=\"PackageSize\" value=\"\" type=\"number\">" \
"</div>" \
"</div>" \
"<div class=\"row\">" \
"<button class=\"col-md-2 offset-md-1\" type=\"submit\">Update</button>" \
"<button class=\"col-md-2 offset-md-3\" type=\"button\" onclick=\"location.href='/'\">Home</button>" \
"<button class=\"col-md-2\" type=\"button\" onclick=\"location.href='/shutdown'\">Shutdown</button>" \
"</div>" \
"</form>" \
"</div>" \
"</body>" \
"</html>";
static const char* HTML_FIRMWARE_UPDATE2 = \
"<!DOCTYPE html>" \
"<html lang=\"en\">" \
"<head>" \
"<meta charset=\"UTF-8\">" \
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">" \
"<meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">" \
"<title>ReButton</title>" \
"<style>%s</style>" \
"</head>" \
"<body>" \
"<header>" \
"<h1>ReButton - Firmware Update</h1>" \
"</header>" \
"<div class=\"container\">" \
"<div class=\"row\">" \
"<h2 style=\"width: 100%%; text-align: center; color:#2e7d32;\">Firmware updating...</h2>" \
"</div>" \
"<div class=\"row\">" \
"<h5 style=\"width: 100%%; text-align: center;\">Wait a few seconds for the ReButton to shutdown...</h5>" \
"</div>" \
"</div>" \
"</body>" \
"</html>";
static const char* HTML_SHUTDOWN = \
"<!DOCTYPE html>" \
"<html lang=\"en\">" \
"<head>" \
"<meta charset=\"UTF-8\">" \
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">" \
"<meta http-equiv=\"X-UA-Compatible\" content=\"ie=edge\">" \
"<title>ReButton</title>" \
"<style>%s</style>" \
"</head>" \
"<body>" \
"<header>" \
"<h1>ReButton - Shutdown</h1>" \
"</header>" \
"<div class=\"container\">" \
"<div class=\"row\">" \
"<h2 style=\"width: 100%%; text-align: center; color:#2e7d32;\">Shutdown</h2>" \
"</div>" \
"</div>" \
"</body>" \
"</html>";
static bool is_http_init;
static bool is_handlers_registered;
static String stringformat(int maxLength, const char* format, ...)
{
va_list args;
char* buf = new char[maxLength + 1];
va_start(args, format);
vsnprintf(buf, maxLength + 1, format, args);
va_end(args);
String str(buf);
delete[] buf;
return str;
}
static int write_eeprom(char* string, int idxZone)
{
Serial.printf("write_eeprom(\"%s\",%d)\n", string, idxZone);
return 0;
}
static String FormValueEncode(const char* text)
{
String html;
while (*text != '\0')
{
switch (*text)
{
case '"':
html += """;
break;
case '&':
html += "&";
break;
case '<':
html += "<";
break;
case '>':
html += ">";
break;
default:
html += *text;
}
text++;
}
return html;
}
static OSStatus HttpdSend(httpd_request_t* req, const char* content)
{
OSStatus err;
err = httpd_send_all_header(req, HTTP_RES_200, strlen(content), HTTP_CONTENT_HTML_STR);
require_noerr_action(err, exit, app_httpd_log("ERROR: Unable to send http result headers."));
err = httpd_send_body(req->sock, (const unsigned char*)content, strlen(content));
require_noerr_action(err, exit, app_httpd_log("ERROR: Unable to send http result body."));
exit:
return err;
}
static OSStatus HttpdSendCss(httpd_request_t* req, const char* content)
{
OSStatus err;
err = httpd_send_all_header(req, HTTP_RES_200, strlen(content), HTTP_CONTENT_CSS_STR);
require_noerr_action(err, exit, app_httpd_log("ERROR: Unable to send http result headers."));
err = httpd_send_body(req->sock, (const unsigned char*)content, strlen(content));
require_noerr_action(err, exit, app_httpd_log("ERROR: Unable to send http result body."));
exit:
return err;
}
////////////////////////////////////////////////////////////////////////////////////
// HTML handlers
static int CssBootstrapGrid(httpd_request_t* req)
{
OSStatus err;
if ((err = HttpdSendCss(req, CSS_BOOTSTRAP_GRID)) != kNoErr) return err;
return kNoErr;
}
static int CssRebutton(httpd_request_t* req)
{
OSStatus err;
if ((err = HttpdSendCss(req, CSS_REBUTTON)) != kNoErr) return err;
return kNoErr;
}
static int HtmlIndexGetHandler(httpd_request_t* req)
{
AutoShutdownUpdateStartTime();
OSStatus err;
unsigned char macAddress[6];
WiFi.macAddress(macAddress);
char strMacAddress[6 * 3 + 1];
snprintf(strMacAddress, sizeof(strMacAddress), "%02x:%02x:%02x:%02x:%02x:%02x", macAddress[0], macAddress[1], macAddress[2], macAddress[3], macAddress[4], macAddress[5]);
String html = stringformat(
strlen(HTML_INDEX) +
strlen(CONFIG_FIRMWARE_VERSION) +
strlen(strMacAddress) +
strlen(Config.WiFiSSID) +
strlen(Config.TimeServer) +
strlen(Config.ProductId),
HTML_INDEX,
CONFIG_FIRMWARE_VERSION,
strMacAddress,
Config.WiFiSSID,
Config.TimeServer,
Config.ProductId
);
if ((err = HttpdSend(req, html.c_str())) != kNoErr) return err;
return kNoErr;
}
static int HtmlWiFiGetHandler(httpd_request_t *req)
{
AutoShutdownUpdateStartTime();
int err;
// scan network
WiFiAccessPoint wifiScanResult[100];
int wifiCount = ((EMW10xxInterface*)network)->scan(wifiScanResult, 100);
int validWifiIndex[100];
int validWifiCount = 0;
for (int i = 0; i < wifiCount; i++)
{
// too weak
if (wifiScanResult[i].get_rssi() < -100) continue;
char* ssid = (char*)wifiScanResult[i].get_ssid();
int ssidLen = strlen(ssid);
if (strcmp(ssid, Config.APmodeSSID) == 0) continue;
if (ssidLen < 1 || CONFIG_WIFI_SSID_MAX_LEN < ssidLen) continue;
bool shouldSkip = false;
for (int j = 0; j < i; j++)
{
if (strcmp(ssid, wifiScanResult[j].get_ssid()) == 0)
{
// duplicate ap name
shouldSkip = true;
break;
}
}
if (shouldSkip) continue;
validWifiIndex[validWifiCount++] = i;
if (validWifiCount >= sizeof(validWifiIndex) / sizeof(validWifiIndex[0])) break;
}
String html = HTML_WIFI_A;
for (int i = 0; i < validWifiCount; i++)
{
char* ssid = (char*)wifiScanResult[validWifiIndex[i]].get_ssid();
int ssidLen = strlen(ssid);
html += stringformat(15 + ssidLen + 2 + ssidLen + 9, "<option value=\"%s\">%s</option>", ssid, ssid);
}
html += stringformat(strlen(HTML_WIFI_B) + strlen(Config.TimeServer), HTML_WIFI_B, Config.TimeServer);
if ((err = HttpdSend(req, html.c_str())) != kNoErr) return err;
return kNoErr;
}
static int HtmlWiFi2PostHandler(httpd_request_t *req)
{
AutoShutdownUpdateStartTime();
OSStatus err;
std::vector<char> buf(1000);
if ((err = httpd_get_data(req, &buf[0], buf.size())) != kNoErr) return err;
if (strstr(req->content_type, "multipart/form-data") == NULL) return kGeneralErr;
char* boundary = strstr(req->content_type, "boundary=");
boundary += 9;
char wifiSSID[CONFIG_WIFI_SSID_MAX_LEN + 1];
char wifiPassword[CONFIG_WIFI_PASSWORD_MAX_LEN + 1];
char timeServer[CONFIG_TIME_SERVER_MAX_LEN + 1];
if ((err = httpd_get_tag_from_multipart_form(&buf[0], boundary, "WiFiSSID", wifiSSID, CONFIG_WIFI_SSID_MAX_LEN)) != kNoErr) return err;
if (strlen(wifiSSID) <= 0) return kGeneralErr;
if ((err = httpd_get_tag_from_multipart_form(&buf[0], boundary, "WiFiPassword", wifiPassword, CONFIG_WIFI_PASSWORD_MAX_LEN)) != kNoErr) return err;
if ((err = httpd_get_tag_from_multipart_form(&buf[0], boundary, "TimeServer", timeServer, sizeof(timeServer))) != kNoErr) return err;
strncpy(Config.WiFiSSID, wifiSSID, sizeof(Config.WiFiSSID));
strncpy(Config.WiFiPassword, wifiPassword, sizeof(Config.WiFiPassword));
strncpy(Config.TimeServer, timeServer, sizeof(Config.TimeServer));
ConfigWrite();
String html = stringformat(strlen(HTML_WIFI2_SUCCESS), HTML_WIFI2_SUCCESS);
if ((err = HttpdSend(req, html.c_str())) != kNoErr) return err;
return kNoErr;
}
static int HtmlIoTCentralGetHandler(httpd_request_t* req)
{
AutoShutdownUpdateStartTime();
OSStatus err;
String html = stringformat(strlen(HTML_IOTCENTRAL) + strlen(Config.ScopeId) + strlen(Config.DeviceId) + strlen(Config.SasKey), HTML_IOTCENTRAL, Config.ScopeId, Config.DeviceId, Config.SasKey);
if ((err = HttpdSend(req, html.c_str())) != kNoErr) return err;
return kNoErr;
}
static int HtmlIoTCentral2PostHandler(httpd_request_t *req)
{
AutoShutdownUpdateStartTime();
OSStatus err;
std::vector<char> buf(1000);
if ((err = httpd_get_data(req, &buf[0], buf.size())) != kNoErr) return err;
if (strstr(req->content_type, "multipart/form-data") == NULL) return kGeneralErr;
char* boundary = strstr(req->content_type, "boundary=");
boundary += 9;
char scopeId[CONFIG_SCOPE_ID_MAX_LEN + 1];
char deviceId[CONFIG_DEVICE_ID_MAX_LEN + 1];
char sasKey[CONFIG_SAS_KEY_MAX_LEN + 1];
if ((err = httpd_get_tag_from_multipart_form(&buf[0], boundary, "ScopeId", scopeId, CONFIG_SCOPE_ID_MAX_LEN)) != kNoErr) return err;
if ((err = httpd_get_tag_from_multipart_form(&buf[0], boundary, "DeviceId", deviceId, CONFIG_DEVICE_ID_MAX_LEN)) != kNoErr) return err;
if ((err = httpd_get_tag_from_multipart_form(&buf[0], boundary, "SasKey", sasKey, CONFIG_SAS_KEY_MAX_LEN)) != kNoErr) return err;
strncpy(Config.ScopeId, scopeId, sizeof(Config.ScopeId));
strncpy(Config.DeviceId, deviceId, sizeof(Config.DeviceId));
strncpy(Config.SasKey, sasKey, sizeof(Config.SasKey));
strncpy_w_zero(Config.IoTHubConnectionString, "", sizeof(Config.IoTHubConnectionString));
ConfigWrite();
String html = stringformat(strlen(HTML_IOTCENTRAL2_SUCCESS), HTML_IOTCENTRAL2_SUCCESS);
if ((err = HttpdSend(req, html.c_str())) != kNoErr) return err;
return kNoErr;
}
static int HtmlIoTHubGetHandler(httpd_request_t* req)
{
AutoShutdownUpdateStartTime();
OSStatus err;
String html = stringformat(strlen(HTML_IOTHUB) + strlen(Config.IoTHubConnectionString), HTML_IOTHUB, Config.IoTHubConnectionString);
if ((err = HttpdSend(req, html.c_str())) != kNoErr) return err;
return kNoErr;
}
static int HtmlIoTHub2PostHandler(httpd_request_t *req)
{
AutoShutdownUpdateStartTime();
OSStatus err;
std::vector<char> buf(1000);
if ((err = httpd_get_data(req, &buf[0], buf.size())) != kNoErr) return err;
if (strstr(req->content_type, "multipart/form-data") == NULL) return kGeneralErr;
char* boundary = strstr(req->content_type, "boundary=");
boundary += 9;
char connectionString[CONFIG_IOTHUB_CONNECTION_STRING_MAX_LEN + 1];
if ((err = httpd_get_tag_from_multipart_form(&buf[0], boundary, "IoTHubConnectionString", connectionString, CONFIG_IOTHUB_CONNECTION_STRING_MAX_LEN)) != kNoErr) return err;
strncpy(Config.IoTHubConnectionString, connectionString, sizeof(Config.IoTHubConnectionString));
strncpy_w_zero(Config.ScopeId, "", sizeof(Config.ScopeId));
strncpy_w_zero(Config.DeviceId, "", sizeof(Config.DeviceId));
strncpy_w_zero(Config.SasKey, "", sizeof(Config.SasKey));
ConfigWrite();
String html = stringformat(strlen(HTML_IOTHUB2_SUCCESS), HTML_IOTHUB2_SUCCESS);
if ((err = HttpdSend(req, html.c_str())) != kNoErr) return err;
return kNoErr;
}
static int HtmlMessageGetHandler(httpd_request_t* req)
{
AutoShutdownUpdateStartTime();
OSStatus err;
String html = stringformat(
strlen(HTML_MESSAGE) +
strlen(Config.Message1) +
strlen(Config.Message2) +
strlen(Config.Message3) +
strlen(Config.Message10) +
strlen(Config.Message11) +
strlen(Config.CustomMessageJson) +
strlen(Config.ProductId) +
strlen(Config.CustomMessagePropertyName),
HTML_MESSAGE,
FormValueEncode(Config.Message1).c_str(),
FormValueEncode(Config.Message2).c_str(),
FormValueEncode(Config.Message3).c_str(),
FormValueEncode(Config.Message10).c_str(),
FormValueEncode(Config.Message11).c_str(),
FormValueEncode(Config.CustomMessageJson).c_str(),
FormValueEncode(Config.ProductId).c_str(),
FormValueEncode(Config.CustomMessagePropertyName).c_str()
);
if ((err = HttpdSend(req, html.c_str())) != kNoErr) return err;
return kNoErr;
}
static int HtmlMessage2PostHandler(httpd_request_t *req)
{
AutoShutdownUpdateStartTime();
OSStatus err;
std::vector<char> buf(1000);
if ((err = httpd_get_data(req, &buf[0], buf.size())) != kNoErr) return err;
if (strstr(req->content_type, "multipart/form-data") == NULL) return kGeneralErr;
char* boundary = strstr(req->content_type, "boundary=");
boundary += 9;
char message1[CONFIG_MESSAGE_MAX_LEN + 1];
char message2[CONFIG_MESSAGE_MAX_LEN + 1];
char message3[CONFIG_MESSAGE_MAX_LEN + 1];
char message10[CONFIG_MESSAGE_MAX_LEN + 1];
char message11[CONFIG_MESSAGE_MAX_LEN + 1];
char customMessageJson[CONFIG_CUSTOM_MESSAGE_JSON_MAX_LEN + 1];
char productId[CONFIG_PRODUCT_ID_MAX_LEN + 1];
char customMessagePropertyName[CONFIG_PROPERTY_NAME_MAX_LEN + 1];
if ((err = httpd_get_tag_from_multipart_form(&buf[0], boundary, "Message1", message1, CONFIG_MESSAGE_MAX_LEN)) != kNoErr) return err;
if ((err = httpd_get_tag_from_multipart_form(&buf[0], boundary, "Message2", message2, CONFIG_MESSAGE_MAX_LEN)) != kNoErr) return err;
if ((err = httpd_get_tag_from_multipart_form(&buf[0], boundary, "Message3", message3, CONFIG_MESSAGE_MAX_LEN)) != kNoErr) return err;
if ((err = httpd_get_tag_from_multipart_form(&buf[0], boundary, "Message10", message10, CONFIG_MESSAGE_MAX_LEN)) != kNoErr) return err;
if ((err = httpd_get_tag_from_multipart_form(&buf[0], boundary, "Message11", message11, CONFIG_MESSAGE_MAX_LEN)) != kNoErr) return err;
if ((err = httpd_get_tag_from_multipart_form(&buf[0], boundary, "CustomMessageJson", customMessageJson, CONFIG_CUSTOM_MESSAGE_JSON_MAX_LEN)) != kNoErr) return err;
if ((err = httpd_get_tag_from_multipart_form(&buf[0], boundary, "ProductId", productId, CONFIG_PRODUCT_ID_MAX_LEN)) != kNoErr) return err;
if ((err = httpd_get_tag_from_multipart_form(&buf[0], boundary, "CustomMessagePropName", customMessagePropertyName, CONFIG_PROPERTY_NAME_MAX_LEN)) != kNoErr) return err;
strncpy(Config.Message1, message1, sizeof(Config.Message1));
strncpy(Config.Message2, message2, sizeof(Config.Message2));
strncpy(Config.Message3, message3, sizeof(Config.Message3));
strncpy(Config.Message10, message10, sizeof(Config.Message10));
strncpy(Config.Message11, message11, sizeof(Config.Message11));
strncpy(Config.CustomMessageJson, customMessageJson, sizeof(Config.CustomMessageJson));
strncpy(Config.ProductId, productId, sizeof(Config.ProductId));
strncpy(Config.CustomMessagePropertyName, customMessagePropertyName, sizeof(Config.CustomMessagePropertyName));
ConfigWrite();
String html = stringformat(strlen(HTML_MESSAGE2_SUCCESS), HTML_MESSAGE2_SUCCESS);
if ((err = HttpdSend(req, html.c_str())) != kNoErr) return err;
return kNoErr;
}
static int HtmlAPmodeGetHandler(httpd_request_t* req)
{
AutoShutdownUpdateStartTime();
OSStatus err;
String html = stringformat(strlen(HTML_APMODE) + strlen(Config.APmodeSSID), HTML_APMODE, Config.APmodeSSID);
if ((err = HttpdSend(req, html.c_str())) != kNoErr) return err;
return kNoErr;
}
static int HtmlAPmode2PostHandler(httpd_request_t *req)
{
AutoShutdownUpdateStartTime();
OSStatus err;
std::vector<char> buf(1000);