Added AutoConnectCredential size acquisition #209

pull/248/head
Hieromon Ikasamo 5 years ago
parent d39545ce13
commit b8b663d927
  1. 13
      src/AutoConnect.cpp
  2. 5
      src/AutoConnect.h
  3. 7
      src/AutoConnectCredential.h

@ -2,8 +2,8 @@
* AutoConnect class implementation.
* @file AutoConnect.cpp
* @author hieromon@gmail.com
* @version 1.1.5
* @date 2020-04-15
* @version 1.2.0
* @date 2020-04-22
* @copyright MIT license.
*/
@ -746,6 +746,15 @@ bool AutoConnect::_loadAvailCredential(const char* ssid, const AC_PRINCIPLE_t pr
return false;
}
/**
* Get current AutoConnectCredential size
* @return Size of the AutoConnectCredential
*/
uint16_t AutoConnect::getCredentialSize(void) {
AutoConnectCredential credentials(_apConfig.boundaryOffset);
return credentials.dataSize();
}
/**
* Disconnect from the AP and stop the AutoConnect portal.
* Stops DNS server and flush tcp sending.

@ -2,8 +2,8 @@
* Declaration of AutoConnect class and accompanying AutoConnectConfig class.
* @file AutoConnect.h
* @author hieromon@gmail.com
* @version 1.1.5
* @date 2020-04-01
* @version 1.2.0
* @date 2020-04-22
* @copyright MIT license.
*/
@ -252,6 +252,7 @@ class AutoConnect {
String where(void) const { return _auxUri; }
inline void enableMenu(const uint16_t items) { _apConfig.menuItems |= items; }
inline void disableMenu(const uint16_t items) { _apConfig.menuItems &= (0xffff ^ items); }
uint16_t getCredentialSize(void);
/** For AutoConnectAux described in JSON */
#ifdef AUTOCONNECT_USE_JSON

@ -2,8 +2,8 @@
* Declaration of AutoConnectCredential class.
* @file AutoConnectCredential.h
* @author hieromon@gmail.com
* @version 1.1.0
* @date 2019-10-07
* @version 1.2.0
* @date 2020-04-22
* @copyright MIT license.
*/
@ -78,7 +78,8 @@ class AutoConnectCredentialBase {
public:
explicit AutoConnectCredentialBase() : _entries(0), _containSize(0) {}
virtual ~AutoConnectCredentialBase() {}
virtual uint8_t entries(void) { return _entries; }
virtual uint8_t entries(void) const { return _entries; }
virtual uint16_t dataSize(void) const { return sizeof(AC_IDENTIFIER) - 1 + sizeof(uint8_t) + sizeof(uint16_t) + _containSize; }
virtual bool del(const char* ssid) = 0;
virtual int8_t load(const char* ssid, station_config_t* config) = 0;
virtual bool load(int8_t entry, station_config_t* config) = 0;

Loading…
Cancel
Save