From 6b696c9ccf7bb0dd70141614dcafe034720063a6 Mon Sep 17 00:00:00 2001 From: Hieromon Ikasamo Date: Thu, 27 Jun 2019 11:51:50 +0900 Subject: [PATCH 01/20] Update process_begin.svg --- mkdocs/images/process_begin.svg | 366 ++++++++++++++++++++------------ 1 file changed, 233 insertions(+), 133 deletions(-) diff --git a/mkdocs/images/process_begin.svg b/mkdocs/images/process_begin.svg index f34b54a..9815b95 100644 --- a/mkdocs/images/process_begin.svg +++ b/mkdocs/images/process_begin.svg @@ -9,9 +9,9 @@ xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="99.565193mm" - height="272.12399mm" - viewBox="0 0 99.565193 272.12399" + width="99.56517mm" + height="304.07242mm" + viewBox="0 0 99.56517 304.07241" version="1.1" id="svg8776" inkscape:version="0.92.2 (5c3e80d, 2017-08-06)" @@ -233,12 +233,12 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="1.4142136" - inkscape:cx="350.72493" - inkscape:cy="591.29489" + inkscape:cx="192.80115" + inkscape:cy="364.94967" inkscape:document-units="mm" inkscape:current-layer="layer1" - showgrid="true" - inkscape:snap-global="true" + showgrid="false" + inkscape:snap-global="false" inkscape:snap-bbox="true" inkscape:snap-nodes="true" inkscape:snap-others="true" @@ -261,8 +261,8 @@ + originx="-23.598368" + originy="15.544285" /> @@ -272,7 +272,7 @@ image/svg+xml - + @@ -280,40 +280,15 @@ inkscape:label="レイヤー 1" inkscape:groupmode="layer" id="layer1" - transform="translate(-23.598344,-8.4718652)"> + transform="translate(-23.598368,-8.4718652)"> - - - immediateStart - + transform="translate(-15.875002,-48.749459)"> + transform="translate(-42.333331,28.77345)"> + transform="translate(-1.3229192,-52.718212)"> WiFi.scanNetworks + id="g1026" + transform="translate(0,31.948452)"> matched credential + id="g1014" + transform="translate(0,31.948452)"> + transform="translate(-15.875002,18.719279)"> + transform="translate(-68.285876,50.564436)"> + transform="translate(-78.07551,36.012307)"> WiFi.softAP - - - START Web Server - + + START Web Server + transform="translate(-43.656245,30.757831)"> + transform="translate(-67.492182,16.16855)"> + transform="translate(-79.374976,29.567202)"> portalTimeout + id="g1006" + transform="translate(0,31.948452)"> + style="opacity:0.66000001;fill:none;stroke:#000000;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + style="opacity:0.66000001;fill:none;stroke:#000000;stroke-width:0.26458332;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + transform="translate(-15.875002,120.84858)"> CONNECTED + id="g11043" + transform="translate(0,31.948452)"> + transform="translate(-9.2604205,23.084915)"> + transform="translate(-1.3229224,97.697415)"> + transform="translate(-34.395836,33.271369)"> @@ -967,49 +942,49 @@ xml:space="preserve" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.17499995px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" x="35.860859" - y="69.289612" + y="101.23806" id="text10760-5-4">NO YES NO YES @@ -1017,89 +992,214 @@ xml:space="preserve" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.17499995px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332" x="76.719864" - y="120.88336" + y="152.83147" id="text10760-1-3">YES NO NO YES YES NO YES NO + + + SSID & Password + + + + + immediateStart + + + + + WiFi.disconnect() + + + + + + Notpresented + Specified From a56ce43d8fcdc3174f02c0222788944a57346727 Mon Sep 17 00:00:00 2001 From: Hieromon Ikasamo Date: Thu, 27 Jun 2019 15:22:16 +0900 Subject: [PATCH 02/20] Supports the posterior attribute with each element --- examples/Elements/Elements.ino | 5 ---- src/AutoConnectElementBasis.h | 30 ++++++++++++------- src/AutoConnectElementBasisImpl.h | 48 ++++++++++++++++++++++++----- src/AutoConnectElementJson.h | 46 +++++++++++++++++++++------- src/AutoConnectElementJsonImpl.h | 50 ++++++++++++++++++++++++------- 5 files changed, 134 insertions(+), 45 deletions(-) diff --git a/examples/Elements/Elements.ino b/examples/Elements/Elements.ino index 1aeea49..dd874a6 100644 --- a/examples/Elements/Elements.ino +++ b/examples/Elements/Elements.ino @@ -74,11 +74,6 @@ static const char PAGE_ELEMENTS[] PROGMEM = R"( "label": "Select", "selected": 2 }, - { - "name": "element", - "type": "ACElement", - "value": "
" - }, { "name": "load", "type": "ACSubmit", diff --git a/src/AutoConnectElementBasis.h b/src/AutoConnectElementBasis.h index a7f92e5..77ccb0c 100644 --- a/src/AutoConnectElementBasis.h +++ b/src/AutoConnectElementBasis.h @@ -2,8 +2,8 @@ * Declaration of AutoConnectElement basic class. * @file AutoConnectElementBasis.h * @author hieromon@gmail.com - * @version 0.9.8 - * @date 2019-03-11 + * @version 0.9.11 + * @date 2019-06-25 * @copyright MIT license. */ @@ -38,6 +38,12 @@ typedef enum { AC_File_Extern } ACFile_t; /**< AutoConnectFile media type */ +typedef enum { + AC_Tag_None = 0, + AC_Tag_BR = 1, + AC_Tag_P = 2 +} ACPosterior_t; /**< Tag to be generated following element */ + /** * AutoConnectAux element base. * Placed a raw text that can be added by user sketch. @@ -46,12 +52,13 @@ typedef enum { */ class AutoConnectElementBasis { public: - explicit AutoConnectElementBasis(const char* name = "", const char* value = "") : name(String(name)), value(String(value)), enable(true) { + explicit AutoConnectElementBasis(const char* name = "", const char* value = "", const ACPosterior_t post = AC_Tag_None) : name(String(name)), value(String(value)), post(post), enable(true) { _type = AC_Element; } virtual ~AutoConnectElementBasis() {} virtual const String toHTML(void) const { return enable ? value : String(""); } ACElement_t typeOf(void) const { return _type; } + const String posterior(const String& s) const; #ifndef AUTOCONNECT_USE_JSON template T& as(void); @@ -59,6 +66,7 @@ class AutoConnectElementBasis { String name; /**< Element name */ String value; /**< Element value */ + ACPosterior_t post; /**< Tag to be generated with posterior */ bool enable; /**< Enabling the element */ protected: @@ -74,7 +82,7 @@ class AutoConnectElementBasis { */ class AutoConnectButtonBasis : virtual public AutoConnectElementBasis { public: - explicit AutoConnectButtonBasis(const char* name = "", const char* value = "", const String& action = String("")) : AutoConnectElementBasis(name, value), action(String(action)) { + explicit AutoConnectButtonBasis(const char* name = "", const char* value = "", const String& action = String(""), const ACPosterior_t post = AC_Tag_None) : AutoConnectElementBasis(name, value, post), action(String(action)) { _type = AC_Button; } ~AutoConnectButtonBasis() {} @@ -93,7 +101,7 @@ class AutoConnectButtonBasis : virtual public AutoConnectElementBasis { */ class AutoConnectCheckboxBasis : virtual public AutoConnectElementBasis { public: - explicit AutoConnectCheckboxBasis(const char* name = "", const char* value = "", const char* label = "", const bool checked = false) : AutoConnectElementBasis(name, value), label(String(label)), checked(checked) { + explicit AutoConnectCheckboxBasis(const char* name = "", const char* value = "", const char* label = "", const bool checked = false, const ACPosterior_t post = AC_Tag_BR) : AutoConnectElementBasis(name, value, post), label(String(label)), checked(checked) { _type = AC_Checkbox; } virtual ~AutoConnectCheckboxBasis() {} @@ -113,7 +121,7 @@ class AutoConnectCheckboxBasis : virtual public AutoConnectElementBasis { */ class AutoConnectFileBasis : virtual public AutoConnectElementBasis { public: - explicit AutoConnectFileBasis(const char* name = "", const char* value = "", const char* label = "", const ACFile_t store = AC_File_FS) : AutoConnectElementBasis(name, value), label(String(label)), store(store) { + explicit AutoConnectFileBasis(const char* name = "", const char* value = "", const char* label = "", const ACFile_t store = AC_File_FS, const ACPosterior_t post = AC_Tag_BR) : AutoConnectElementBasis(name, value, post), label(String(label)), store(store), size(0) { _type = AC_File; _upload.reset(); } @@ -142,7 +150,7 @@ class AutoConnectFileBasis : virtual public AutoConnectElementBasis { */ class AutoConnectInputBasis : virtual public AutoConnectElementBasis { public: - explicit AutoConnectInputBasis(const char* name = "", const char* value = "", const char* label = "", const char* pattern = "", const char* placeholder = "") : AutoConnectElementBasis(name, value), label(String(label)), pattern(String(pattern)), placeholder(String(placeholder)) { + explicit AutoConnectInputBasis(const char* name = "", const char* value = "", const char* label = "", const char* pattern = "", const char* placeholder = "", const ACPosterior_t post = AC_Tag_BR) : AutoConnectElementBasis(name, value, post), label(String(label)), pattern(String(pattern)), placeholder(String(placeholder)) { _type = AC_Input; } virtual ~AutoConnectInputBasis() {} @@ -164,7 +172,7 @@ class AutoConnectInputBasis : virtual public AutoConnectElementBasis { */ class AutoConnectRadioBasis : virtual public AutoConnectElementBasis { public: - explicit AutoConnectRadioBasis(const char* name = "", std::vector const& values = {}, const char* label = "", const ACArrange_t order = AC_Vertical, const uint8_t checked = 0) : AutoConnectElementBasis(name, ""), label(label), order(order), checked(checked), _values(values) { + explicit AutoConnectRadioBasis(const char* name = "", std::vector const& values = {}, const char* label = "", const ACArrange_t order = AC_Vertical, const uint8_t checked = 0, const ACPosterior_t post = AC_Tag_BR) : AutoConnectElementBasis(name, "", post), label(label), order(order), checked(checked), _values(values) { _type = AC_Radio; } virtual ~AutoConnectRadioBasis() {} @@ -195,7 +203,7 @@ class AutoConnectRadioBasis : virtual public AutoConnectElementBasis { */ class AutoConnectSelectBasis : virtual public AutoConnectElementBasis { public: - explicit AutoConnectSelectBasis(const char* name = "", std::vector const& options = {}, const char* label = "", const uint8_t selected = 0) : AutoConnectElementBasis(name, ""), label(String(label)), selected(selected), _options(options) { + explicit AutoConnectSelectBasis(const char* name = "", std::vector const& options = {}, const char* label = "", const uint8_t selected = 0, const ACPosterior_t post = AC_Tag_BR) : AutoConnectElementBasis(name, "", post), label(String(label)), selected(selected), _options(options) { _type = AC_Select; } virtual ~AutoConnectSelectBasis() {} @@ -226,7 +234,7 @@ class AutoConnectSelectBasis : virtual public AutoConnectElementBasis { */ class AutoConnectSubmitBasis : virtual public AutoConnectElementBasis { public: - explicit AutoConnectSubmitBasis(const char* name = "", const char* value = "", const char* uri = "") : AutoConnectElementBasis(name, value), uri(String(uri)) { + explicit AutoConnectSubmitBasis(const char* name = "", const char* value = "", const char* uri = "", const ACPosterior_t post = AC_Tag_None) : AutoConnectElementBasis(name, value, post), uri(String(uri)) { _type = AC_Submit; } virtual ~AutoConnectSubmitBasis() {} @@ -247,7 +255,7 @@ class AutoConnectSubmitBasis : virtual public AutoConnectElementBasis { */ class AutoConnectTextBasis : virtual public AutoConnectElementBasis { public: - explicit AutoConnectTextBasis(const char* name = "", const char* value = "", const char* style = "", const char* format = "") : AutoConnectElementBasis(name, value), style(String(style)), format(String(format)) { + explicit AutoConnectTextBasis(const char* name = "", const char* value = "", const char* style = "", const char* format = "", const ACPosterior_t post = AC_Tag_None) : AutoConnectElementBasis(name, value, post), style(String(style)), format(String(format)) { _type = AC_Text; } virtual ~AutoConnectTextBasis() {} diff --git a/src/AutoConnectElementBasisImpl.h b/src/AutoConnectElementBasisImpl.h index 27e488a..ac0ac86 100644 --- a/src/AutoConnectElementBasisImpl.h +++ b/src/AutoConnectElementBasisImpl.h @@ -2,8 +2,8 @@ * Implementation of AutoConnectElementBasis classes. * @file AutoConnectElementImpl.h * @author hieromon@gmail.com - * @version 0.9.9 - * @date 2019-05-23 + * @version 0.9.11 + * @date 2019-06-25 * @copyright MIT license. */ @@ -19,13 +19,35 @@ #endif #include "AutoConnectElementBasis.h" +/** + * Append post-tag accoring by the post attribute. + * @param s An original string + * @return A string that appended the post tag + */ +const String AutoConnectElementBasis::posterior(const String& s) const { + String html; + if (post == AC_Tag_BR) + html = s + String(F("
")); + else if (post == AC_Tag_P) + html = String("

") + s + String(F("

")); + else + html = s; + return html; +} + /** * Generate an HTML ")) : String(""); + String html = String(""); + + if (enable) { + html = String(F("")); + html = AutoConnectElementBasis::posterior(html); + } + return html; } /** @@ -45,7 +67,8 @@ const String AutoConnectCheckboxBasis::toHTML(void) const { html += String(F(" checked")); if (label.length()) html += String(F(" id=\"")) + name + String(F("\">