|
|
@ -2,8 +2,8 @@ |
|
|
|
* Declaration of AutoConnectElement extended classes using JSON. |
|
|
|
* Declaration of AutoConnectElement extended classes using JSON. |
|
|
|
* @file AutoConnectElementJson.h |
|
|
|
* @file AutoConnectElementJson.h |
|
|
|
* @author hieromon@gmail.com |
|
|
|
* @author hieromon@gmail.com |
|
|
|
* @version 0.9.9 |
|
|
|
* @version 0.9.11 |
|
|
|
* @date 2019-05-23 |
|
|
|
* @date 2019-06-25 |
|
|
|
* @copyright MIT license. |
|
|
|
* @copyright MIT license. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
@ -24,6 +24,7 @@ |
|
|
|
#define AUTOCONNECT_JSON_KEY_OPTION "option" |
|
|
|
#define AUTOCONNECT_JSON_KEY_OPTION "option" |
|
|
|
#define AUTOCONNECT_JSON_KEY_PATTERN "pattern" |
|
|
|
#define AUTOCONNECT_JSON_KEY_PATTERN "pattern" |
|
|
|
#define AUTOCONNECT_JSON_KEY_PLACEHOLDER "placeholder" |
|
|
|
#define AUTOCONNECT_JSON_KEY_PLACEHOLDER "placeholder" |
|
|
|
|
|
|
|
#define AUTOCONNECT_JSON_KEY_POSTERIOR "posterior" |
|
|
|
#define AUTOCONNECT_JSON_KEY_SELECTED "selected" |
|
|
|
#define AUTOCONNECT_JSON_KEY_SELECTED "selected" |
|
|
|
#define AUTOCONNECT_JSON_KEY_STORE "store" |
|
|
|
#define AUTOCONNECT_JSON_KEY_STORE "store" |
|
|
|
#define AUTOCONNECT_JSON_KEY_STYLE "style" |
|
|
|
#define AUTOCONNECT_JSON_KEY_STYLE "style" |
|
|
@ -40,9 +41,12 @@ |
|
|
|
#define AUTOCONNECT_JSON_TYPE_ACSELECT "ACSelect" |
|
|
|
#define AUTOCONNECT_JSON_TYPE_ACSELECT "ACSelect" |
|
|
|
#define AUTOCONNECT_JSON_TYPE_ACSUBMIT "ACSubmit" |
|
|
|
#define AUTOCONNECT_JSON_TYPE_ACSUBMIT "ACSubmit" |
|
|
|
#define AUTOCONNECT_JSON_TYPE_ACTEXT "ACText" |
|
|
|
#define AUTOCONNECT_JSON_TYPE_ACTEXT "ACText" |
|
|
|
|
|
|
|
#define AUTOCONNECT_JSON_VALUE_BR "br" |
|
|
|
#define AUTOCONNECT_JSON_VALUE_EXTERNAL "extern" |
|
|
|
#define AUTOCONNECT_JSON_VALUE_EXTERNAL "extern" |
|
|
|
#define AUTOCONNECT_JSON_VALUE_FS "fs" |
|
|
|
#define AUTOCONNECT_JSON_VALUE_FS "fs" |
|
|
|
#define AUTOCONNECT_JSON_VALUE_HORIZONTAL "horizontal" |
|
|
|
#define AUTOCONNECT_JSON_VALUE_HORIZONTAL "horizontal" |
|
|
|
|
|
|
|
#define AUTOCONNECT_JSON_VALUE_NONE "none" |
|
|
|
|
|
|
|
#define AUTOCONNECT_JSON_VALUE_PAR "par" |
|
|
|
#define AUTOCONNECT_JSON_VALUE_SD "sd" |
|
|
|
#define AUTOCONNECT_JSON_VALUE_SD "sd" |
|
|
|
#define AUTOCONNECT_JSON_VALUE_VERTICAL "vertical" |
|
|
|
#define AUTOCONNECT_JSON_VALUE_VERTICAL "vertical" |
|
|
|
|
|
|
|
|
|
|
@ -104,9 +108,10 @@ using ArduinoJsonBuffer = DynamicJsonDocument; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class AutoConnectElementJson : virtual public AutoConnectElementBasis { |
|
|
|
class AutoConnectElementJson : virtual public AutoConnectElementBasis { |
|
|
|
public: |
|
|
|
public: |
|
|
|
explicit AutoConnectElementJson(const char* name = "", const char* value = "") { |
|
|
|
explicit AutoConnectElementJson(const char* name = "", const char* value = "", const ACPosterior_t post = AC_Tag_None) : _defaultPost(AC_Tag_None) { |
|
|
|
AutoConnectElementBasis::name = String(name); |
|
|
|
AutoConnectElementBasis::name = String(name); |
|
|
|
AutoConnectElementBasis::value = String(value); |
|
|
|
AutoConnectElementBasis::value = String(value); |
|
|
|
|
|
|
|
AutoConnectElementBasis::post = post; |
|
|
|
} |
|
|
|
} |
|
|
|
~AutoConnectElementJson() {} |
|
|
|
~AutoConnectElementJson() {} |
|
|
|
virtual size_t getObjectSize(void) const; |
|
|
|
virtual size_t getObjectSize(void) const; |
|
|
@ -118,6 +123,9 @@ class AutoConnectElementJson : virtual public AutoConnectElementBasis { |
|
|
|
protected: |
|
|
|
protected: |
|
|
|
void _setMember(const JsonObject& json); |
|
|
|
void _setMember(const JsonObject& json); |
|
|
|
void _serialize(JsonObject& json); |
|
|
|
void _serialize(JsonObject& json); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected: |
|
|
|
|
|
|
|
ACPosterior_t _defaultPost; |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -130,10 +138,12 @@ class AutoConnectElementJson : virtual public AutoConnectElementBasis { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class AutoConnectButtonJson : public AutoConnectElementJson, public AutoConnectButtonBasis { |
|
|
|
class AutoConnectButtonJson : public AutoConnectElementJson, public AutoConnectButtonBasis { |
|
|
|
public: |
|
|
|
public: |
|
|
|
explicit AutoConnectButtonJson(const char* name = "", const char* value = "", const String& action = String("")) { |
|
|
|
explicit AutoConnectButtonJson(const char* name = "", const char* value = "", const String& action = String(""), const ACPosterior_t post = AC_Tag_None) { |
|
|
|
AutoConnectButtonBasis::name = String(name); |
|
|
|
AutoConnectButtonBasis::name = String(name); |
|
|
|
AutoConnectButtonBasis::value = String(value); |
|
|
|
AutoConnectButtonBasis::value = String(value); |
|
|
|
AutoConnectButtonBasis::action = String(action); |
|
|
|
AutoConnectButtonBasis::action = String(action); |
|
|
|
|
|
|
|
AutoConnectButtonBasis::post = post; |
|
|
|
|
|
|
|
_defaultPost = AC_Tag_None; |
|
|
|
} |
|
|
|
} |
|
|
|
~AutoConnectButtonJson() {} |
|
|
|
~AutoConnectButtonJson() {} |
|
|
|
size_t getObjectSize(void) const override; |
|
|
|
size_t getObjectSize(void) const override; |
|
|
@ -152,11 +162,13 @@ class AutoConnectButtonJson : public AutoConnectElementJson, public AutoConnectB |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class AutoConnectCheckboxJson : public AutoConnectElementJson, public AutoConnectCheckboxBasis { |
|
|
|
class AutoConnectCheckboxJson : public AutoConnectElementJson, public AutoConnectCheckboxBasis { |
|
|
|
public: |
|
|
|
public: |
|
|
|
explicit AutoConnectCheckboxJson(const char* name = "", const char* value = "", const char* label = "", const bool checked = false) { |
|
|
|
explicit AutoConnectCheckboxJson(const char* name = "", const char* value = "", const char* label = "", const bool checked = false, const ACPosterior_t post = AC_Tag_BR) { |
|
|
|
AutoConnectCheckboxBasis::name = String(name); |
|
|
|
AutoConnectCheckboxBasis::name = String(name); |
|
|
|
AutoConnectCheckboxBasis::value = String(value); |
|
|
|
AutoConnectCheckboxBasis::value = String(value); |
|
|
|
AutoConnectCheckboxBasis::label = String(label); |
|
|
|
AutoConnectCheckboxBasis::label = String(label); |
|
|
|
AutoConnectCheckboxBasis::checked = checked; |
|
|
|
AutoConnectCheckboxBasis::checked = checked; |
|
|
|
|
|
|
|
AutoConnectCheckboxBasis::post = post; |
|
|
|
|
|
|
|
_defaultPost = AC_Tag_BR; |
|
|
|
} |
|
|
|
} |
|
|
|
~AutoConnectCheckboxJson() {} |
|
|
|
~AutoConnectCheckboxJson() {} |
|
|
|
size_t getObjectSize(void) const override; |
|
|
|
size_t getObjectSize(void) const override; |
|
|
@ -175,11 +187,13 @@ class AutoConnectCheckboxJson : public AutoConnectElementJson, public AutoConnec |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class AutoConnectFileJson : public AutoConnectElementJson, public AutoConnectFileBasis { |
|
|
|
class AutoConnectFileJson : public AutoConnectElementJson, public AutoConnectFileBasis { |
|
|
|
public: |
|
|
|
public: |
|
|
|
explicit AutoConnectFileJson(const char* name = "", const char* value= "", const char* label = "", const ACFile_t store = AC_File_FS) { |
|
|
|
explicit AutoConnectFileJson(const char* name = "", const char* value= "", const char* label = "", const ACFile_t store = AC_File_FS, const ACPosterior_t post = AC_Tag_BR) { |
|
|
|
AutoConnectFileBasis::name = String(name); |
|
|
|
AutoConnectFileBasis::name = String(name); |
|
|
|
AutoConnectFileBasis::value = String(value); |
|
|
|
AutoConnectFileBasis::value = String(value); |
|
|
|
AutoConnectFileBasis::label = String(label); |
|
|
|
AutoConnectFileBasis::label = String(label); |
|
|
|
AutoConnectFileBasis::store = store; |
|
|
|
AutoConnectFileBasis::store = store; |
|
|
|
|
|
|
|
AutoConnectFileBasis::post = post; |
|
|
|
|
|
|
|
_defaultPost = AC_Tag_BR; |
|
|
|
} |
|
|
|
} |
|
|
|
~AutoConnectFileJson() {} |
|
|
|
~AutoConnectFileJson() {} |
|
|
|
size_t getObjectSize(void) const override; |
|
|
|
size_t getObjectSize(void) const override; |
|
|
@ -198,12 +212,14 @@ class AutoConnectFileJson : public AutoConnectElementJson, public AutoConnectFil |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class AutoConnectInputJson : public AutoConnectElementJson, public AutoConnectInputBasis { |
|
|
|
class AutoConnectInputJson : public AutoConnectElementJson, public AutoConnectInputBasis { |
|
|
|
public: |
|
|
|
public: |
|
|
|
explicit AutoConnectInputJson(const char* name = "", const char* value = "", const char* label = "", const char* pattern = "", const char* placeholder = "") { |
|
|
|
explicit AutoConnectInputJson(const char* name = "", const char* value = "", const char* label = "", const char* pattern = "", const char* placeholder = "", const ACPosterior_t post = AC_Tag_BR) { |
|
|
|
AutoConnectInputBasis::name = String(name); |
|
|
|
AutoConnectInputBasis::name = String(name); |
|
|
|
AutoConnectInputBasis::value = String(value); |
|
|
|
AutoConnectInputBasis::value = String(value); |
|
|
|
AutoConnectInputBasis::label = String(label); |
|
|
|
AutoConnectInputBasis::label = String(label); |
|
|
|
AutoConnectInputBasis::pattern = String(pattern); |
|
|
|
AutoConnectInputBasis::pattern = String(pattern); |
|
|
|
AutoConnectInputBasis::placeholder = String(placeholder); |
|
|
|
AutoConnectInputBasis::placeholder = String(placeholder); |
|
|
|
|
|
|
|
AutoConnectInputBasis::post = post; |
|
|
|
|
|
|
|
_defaultPost = AC_Tag_BR; |
|
|
|
} |
|
|
|
} |
|
|
|
~AutoConnectInputJson() {} |
|
|
|
~AutoConnectInputJson() {} |
|
|
|
size_t getObjectSize(void) const override; |
|
|
|
size_t getObjectSize(void) const override; |
|
|
@ -221,12 +237,14 @@ class AutoConnectInputJson : public AutoConnectElementJson, public AutoConnectIn |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class AutoConnectRadioJson : public AutoConnectElementJson, public AutoConnectRadioBasis { |
|
|
|
class AutoConnectRadioJson : public AutoConnectElementJson, public AutoConnectRadioBasis { |
|
|
|
public: |
|
|
|
public: |
|
|
|
explicit AutoConnectRadioJson(const char* name = "", std::vector<String> const& values = {}, const char* label = "", const ACArrange_t order = AC_Vertical, const uint8_t checked = 0) { |
|
|
|
explicit AutoConnectRadioJson(const char* name = "", std::vector<String> const& values = {}, const char* label = "", const ACArrange_t order = AC_Vertical, const uint8_t checked = 0, const ACPosterior_t post = AC_Tag_BR) { |
|
|
|
AutoConnectRadioBasis::name = String(name); |
|
|
|
AutoConnectRadioBasis::name = String(name); |
|
|
|
AutoConnectRadioBasis::_values = values; |
|
|
|
AutoConnectRadioBasis::_values = values; |
|
|
|
AutoConnectRadioBasis::label = String(label); |
|
|
|
AutoConnectRadioBasis::label = String(label); |
|
|
|
AutoConnectRadioBasis::order = order; |
|
|
|
AutoConnectRadioBasis::order = order; |
|
|
|
AutoConnectRadioBasis::checked = checked; |
|
|
|
AutoConnectRadioBasis::checked = checked; |
|
|
|
|
|
|
|
AutoConnectRadioBasis::post = post; |
|
|
|
|
|
|
|
_defaultPost = AC_Tag_BR; |
|
|
|
} |
|
|
|
} |
|
|
|
~AutoConnectRadioJson() {} |
|
|
|
~AutoConnectRadioJson() {} |
|
|
|
size_t getObjectSize(void) const override; |
|
|
|
size_t getObjectSize(void) const override; |
|
|
@ -244,11 +262,13 @@ class AutoConnectRadioJson : public AutoConnectElementJson, public AutoConnectRa |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class AutoConnectSelectJson : public AutoConnectElementJson, public AutoConnectSelectBasis { |
|
|
|
class AutoConnectSelectJson : public AutoConnectElementJson, public AutoConnectSelectBasis { |
|
|
|
public: |
|
|
|
public: |
|
|
|
explicit AutoConnectSelectJson(const char* name = "", std::vector<String> const& options = {}, const char* label = "", const uint8_t selected = 0) { |
|
|
|
explicit AutoConnectSelectJson(const char* name = "", std::vector<String> const& options = {}, const char* label = "", const uint8_t selected = 0, const ACPosterior_t post = AC_Tag_BR) { |
|
|
|
AutoConnectSelectBasis::name = String(name); |
|
|
|
AutoConnectSelectBasis::name = String(name); |
|
|
|
AutoConnectSelectBasis::_options = options; |
|
|
|
AutoConnectSelectBasis::_options = options; |
|
|
|
AutoConnectSelectBasis::label = String(label); |
|
|
|
AutoConnectSelectBasis::label = String(label); |
|
|
|
AutoConnectSelectBasis::selected = selected; |
|
|
|
AutoConnectSelectBasis::selected = selected; |
|
|
|
|
|
|
|
AutoConnectSelectBasis::post = post; |
|
|
|
|
|
|
|
_defaultPost = AC_Tag_BR; |
|
|
|
} |
|
|
|
} |
|
|
|
~AutoConnectSelectJson() {} |
|
|
|
~AutoConnectSelectJson() {} |
|
|
|
size_t getObjectSize(void) const override; |
|
|
|
size_t getObjectSize(void) const override; |
|
|
@ -267,10 +287,12 @@ class AutoConnectSelectJson : public AutoConnectElementJson, public AutoConnectS |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class AutoConnectSubmitJson : public AutoConnectElementJson, public AutoConnectSubmitBasis { |
|
|
|
class AutoConnectSubmitJson : public AutoConnectElementJson, public AutoConnectSubmitBasis { |
|
|
|
public: |
|
|
|
public: |
|
|
|
explicit AutoConnectSubmitJson(const char* name = "", const char* value = "", const char* uri = "") { |
|
|
|
explicit AutoConnectSubmitJson(const char* name = "", const char* value = "", const char* uri = "", const ACPosterior_t post = AC_Tag_None) { |
|
|
|
AutoConnectSubmitBasis::name = String(name); |
|
|
|
AutoConnectSubmitBasis::name = String(name); |
|
|
|
AutoConnectSubmitBasis::value = String(value); |
|
|
|
AutoConnectSubmitBasis::value = String(value); |
|
|
|
AutoConnectSubmitBasis::uri = String(uri); |
|
|
|
AutoConnectSubmitBasis::uri = String(uri); |
|
|
|
|
|
|
|
AutoConnectSubmitBasis::post = post; |
|
|
|
|
|
|
|
_defaultPost = AC_Tag_None; |
|
|
|
} |
|
|
|
} |
|
|
|
~AutoConnectSubmitJson() {} |
|
|
|
~AutoConnectSubmitJson() {} |
|
|
|
size_t getObjectSize(void) const override; |
|
|
|
size_t getObjectSize(void) const override; |
|
|
@ -289,11 +311,13 @@ class AutoConnectSubmitJson : public AutoConnectElementJson, public AutoConnectS |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class AutoConnectTextJson : public AutoConnectElementJson, public AutoConnectTextBasis { |
|
|
|
class AutoConnectTextJson : public AutoConnectElementJson, public AutoConnectTextBasis { |
|
|
|
public: |
|
|
|
public: |
|
|
|
explicit AutoConnectTextJson(const char* name = "", const char* value = "", const char* style = "", const char* format = "") { |
|
|
|
explicit AutoConnectTextJson(const char* name = "", const char* value = "", const char* style = "", const char* format = "", const ACPosterior_t post = AC_Tag_None) { |
|
|
|
AutoConnectTextBasis::name = String(name); |
|
|
|
AutoConnectTextBasis::name = String(name); |
|
|
|
AutoConnectTextBasis::value = String(value); |
|
|
|
AutoConnectTextBasis::value = String(value); |
|
|
|
AutoConnectTextBasis::style = String(style); |
|
|
|
AutoConnectTextBasis::style = String(style); |
|
|
|
AutoConnectTextBasis::format = String(format); |
|
|
|
AutoConnectTextBasis::format = String(format); |
|
|
|
|
|
|
|
AutoConnectTextBasis::post = post; |
|
|
|
|
|
|
|
_defaultPost = AC_Tag_None; |
|
|
|
} |
|
|
|
} |
|
|
|
~AutoConnectTextJson() {} |
|
|
|
~AutoConnectTextJson() {} |
|
|
|
size_t getObjectSize(void) const override; |
|
|
|
size_t getObjectSize(void) const override; |
|
|
|