| 14 | static const auto LOGGER = tt::Logger("ApWebServerApp"); |
| 15 | |
| 16 | class ApWebServerApp final : public App { |
| 17 | lv_obj_t* labelSsidValue = nullptr; |
| 18 | lv_obj_t* labelPasswordValue = nullptr; |
| 19 | lv_obj_t* labelIpValue = nullptr; |
| 20 | |
| 21 | bool webServerEnabledChanged = false; |
| 22 | settings::webserver::WebServerSettings wsSettings; |
| 23 | |
| 24 | public: |
| 25 | void onCreate(AppContext& app) override { |
| 26 | wsSettings = settings::webserver::loadOrGetDefault(); |
| 27 | } |
| 28 | |
| 29 | void onShow(AppContext& app, lv_obj_t* parent) override { |
| 30 | lv_obj_set_flex_flow(parent, LV_FLEX_FLOW_COLUMN); |
| 31 | lv_obj_remove_flag(parent, LV_OBJ_FLAG_SCROLLABLE); |
| 32 | |
| 33 | lvgl::toolbar_create(parent, app); |
| 34 | |
| 35 | lv_obj_t* wrapper = lv_obj_create(parent); |
| 36 | lv_obj_set_width(wrapper, LV_PCT(100)); |
| 37 | lv_obj_set_style_pad_all(wrapper, 0, LV_PART_MAIN); |
| 38 | lv_obj_set_style_pad_row(wrapper, 4, LV_PART_MAIN); |
| 39 | lv_obj_set_flex_flow(wrapper, LV_FLEX_FLOW_COLUMN); |
| 40 | lv_obj_set_flex_align(wrapper, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER); |
| 41 | |
| 42 | lv_obj_t* labelSsid = lv_label_create(wrapper); |
| 43 | lv_label_set_text(labelSsid, "SSID:"); |
| 44 | lv_obj_set_style_text_color(labelSsid, lv_palette_main(LV_PALETTE_GREY), LV_PART_MAIN); |
| 45 | |
| 46 | labelSsidValue = lv_label_create(wrapper); |
| 47 | lv_obj_set_style_text_align(labelSsidValue, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN); |
| 48 | lv_obj_set_width(labelSsidValue, LV_PCT(100)); |
| 49 | lv_label_set_long_mode(labelSsidValue, LV_LABEL_LONG_SCROLL); |
| 50 | lv_obj_set_style_margin_hor(labelSsidValue, 2, LV_PART_MAIN); |
| 51 | |
| 52 | lv_obj_t* labelPassword = lv_label_create(wrapper); |
| 53 | lv_label_set_text(labelPassword, "Pass:"); |
| 54 | lv_obj_set_style_text_color(labelPassword, lv_palette_main(LV_PALETTE_GREY), LV_PART_MAIN); |
| 55 | |
| 56 | labelPasswordValue = lv_label_create(wrapper); |
| 57 | lv_obj_set_style_text_align(labelPasswordValue, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN); |
| 58 | lv_obj_set_width(labelPasswordValue, LV_PCT(100)); |
| 59 | lv_label_set_long_mode(labelPasswordValue, LV_LABEL_LONG_SCROLL); |
| 60 | lv_obj_set_style_margin_hor(labelPasswordValue, 2, LV_PART_MAIN); |
| 61 | |
| 62 | lv_obj_t* labelIp = lv_label_create(wrapper); |
| 63 | lv_label_set_text(labelIp, "IP:"); |
| 64 | lv_obj_set_style_text_color(labelIp, lv_palette_main(LV_PALETTE_GREY), LV_PART_MAIN); |
| 65 | |
| 66 | labelIpValue = lv_label_create(wrapper); |
| 67 | lv_obj_set_style_text_align(labelIpValue, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN); |
| 68 | lv_obj_set_width(labelIpValue, LV_PCT(100)); |
| 69 | lv_label_set_long_mode(labelIpValue, LV_LABEL_LONG_SCROLL); |
| 70 | lv_obj_set_style_margin_hor(labelIpValue, 2, LV_PART_MAIN); |
| 71 | |
| 72 | // Start AP Mode and WebServer |
| 73 | settings::webserver::WebServerSettings apSettings = wsSettings; |
nothing calls this directly
no outgoing calls
no test coverage detected