Fixed an alignment violation

pull/83/head
Hieromon Ikasamo 6 years ago
parent 77ce4bcd27
commit db2733623e
  1. 3
      src/AutoConnect.h
  2. 44
      src/AutoConnectAux.cpp
  3. 9
      src/AutoConnectAux.h

@ -189,8 +189,9 @@ class AutoConnect {
/** For AutoConnectAux described in JSON */
#ifdef AUTOCONNECT_USE_JSON
bool load(const String& aux);
bool load(PGM_P aux);
bool load(const __FlashStringHelper* aux);
bool load(const String& aux);
bool load(Stream& aux);
#endif // !AUTOCONNECT_USE_JSON

@ -495,14 +495,14 @@ void AutoConnectAux::_storeElements(WebServerClass* webServer) {
#ifdef AUTOCONNECT_USE_JSON
/**
* Load AutoConnectAux page from JSON description stored in the sketch.
* Load AutoConnectAux page from JSON description stored in PROGMEM.
* This function can load AutoConnectAux for multiple AUX pages written
* in JSON and is registered in AutoConnect.
* @param aux JSON description to be load.
* @return true Successfully loaded.
*/
bool AutoConnect::load(const String& aux) {
return _parseJson<const String&>(aux);
bool AutoConnect::load(PGM_P aux) {
return _parseJson<const __FlashStringHelper*>(reinterpret_cast<const __FlashStringHelper*>(aux));
}
/**
@ -516,6 +516,17 @@ bool AutoConnect::load(const __FlashStringHelper* aux) {
return _parseJson<const __FlashStringHelper*>(aux);
}
/**
* Load AutoConnectAux page from JSON description stored in the sketch.
* This function can load AutoConnectAux for multiple AUX pages written
* in JSON and is registered in AutoConnect.
* @param aux JSON description to be load.
* @return true Successfully loaded.
*/
bool AutoConnect::load(const String& aux) {
return _parseJson<const String&>(aux);
}
/**
* Load AutoConnectAux page from JSON description from the stream.
* This function can load AutoConnectAux for multiple AUX pages written
@ -622,6 +633,18 @@ bool AutoConnectAux::load(const String& in) {
return _parseJson<const String&>(in);
}
/**
* Constructs an AutoConnectAux instance by reading all the
* AutoConnectElements of the specified URI from the elements passing
* pointer to JSON stored in pgm_data array.
* @param in AutoConnectAux element data which is described by JSON.
* @return true The element collection successfully loaded.
* @return false Invalid JSON data occurred.
*/
bool AutoConnectAux::load(PGM_P in) {
return _parseJson<const __FlashStringHelper*>(reinterpret_cast<const __FlashStringHelper*>(in));
}
/**
* Constructs an AutoConnectAux instance by reading all the
* AutoConnectElements of the specified URI from the elements defined
@ -672,26 +695,33 @@ bool AutoConnectAux::_load(JsonObject& jb) {
* elements are to be loaded.
* @return A reference of loaded AutoConnectElement instance.
*/
bool AutoConnectAux::loadElement(const String& in, const String& name) {
return _parseElement<const String&, const String&>(in, name);
bool AutoConnectAux::loadElement(PGM_P in, const String& name) {
return _parseElement<const __FlashStringHelper*, const String&>(reinterpret_cast<const __FlashStringHelper*>(in), name);
}
bool AutoConnectAux::loadElement(const __FlashStringHelper* in, const String& name) {
return _parseElement<const __FlashStringHelper*, const String&>(in, name);
}
bool AutoConnectAux::loadElement(const String& in, const String& name) {
return _parseElement<const String&, const String&>(in, name);
}
bool AutoConnectAux::loadElement(Stream& in, const String& name) {
return _parseElement<Stream&, const String&>(in, name);
}
bool AutoConnectAux::loadElement(const String& in, std::vector<String> const& names) {
return _parseElement<const String&, std::vector<String> const&>(in, names);
bool AutoConnectAux::loadElement(PGM_P in, std::vector<String> const& names) {
return _parseElement<const __FlashStringHelper*, std::vector<String> const&>(reinterpret_cast<const __FlashStringHelper*>(in), names);
}
bool AutoConnectAux::loadElement(const __FlashStringHelper* in, std::vector<String> const& names) {
return _parseElement<const __FlashStringHelper*, std::vector<String> const&>(in, names);
}
bool AutoConnectAux::loadElement(const String& in, std::vector<String> const& names) {
return _parseElement<const String&, std::vector<String> const&>(in, names);
}
bool AutoConnectAux::loadElement(Stream& in, std::vector<String> const& names) {
return _parseElement<Stream&, std::vector<String> const&>(in, names);
}

@ -71,13 +71,16 @@ class AutoConnectAux : public PageBuilder {
}
#ifdef AUTOCONNECT_USE_JSON
bool load(const String& in); /**< Load whole elements to AutoConnectAux Page */
bool load(PGM_P in); /**< Load whole elements to AutoConnectAux Page */
bool load(const __FlashStringHelper* in); /**< Load whole elements to AutoConnectAux Page */
bool load(const String& in); /**< Load whole elements to AutoConnectAux Page */
bool load(Stream& in); /**< Load whole elements to AutoConnectAux Page */
bool loadElement(const String& in, const String& name = String("")); /**< Load specified element */
bool loadElement(const String& in, std::vector<String> const& names);/**< Load any specified elements */
bool loadElement(PGM_P in, const String& name = String("")); /**< Load specified element */
bool loadElement(PGM_P in, std::vector<String> const& names); /**< Load any specified elements */
bool loadElement(const __FlashStringHelper* in, const String& name = String("")); /**< Load specified element */
bool loadElement(const __FlashStringHelper* in, std::vector<String> const& names); /**< Load any specified elements */
bool loadElement(const String& in, const String& name = String("")); /**< Load specified element */
bool loadElement(const String& in, std::vector<String> const& names);/**< Load any specified elements */
bool loadElement(Stream& in, const String& name = String("")); /**< Load specified element */
bool loadElement(Stream& in, std::vector<String> const& names); /**< Load any specified elements */
size_t saveElement(Stream& out, std::vector<String> const& names = {}); /**< Write elements of AutoConnectAux to the stream */

Loading…
Cancel
Save