You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
AutoConnect/src/AutoConnectCredentail.h

49 lines
1.4 KiB

/**
* Declaration of AutoConnectCredential class.
* @file AutoConnectCredential.h
* @author hieromon@gmail.com
* @version 1.0.0
* @date 2018-02-17
* @copyright MIT license.
*/
#ifndef _AUTOCONNECTCREDENTAIL_H_
#define _AUTOCONNECTCREDENTAIL_H_
#if defined(ARDUINO) && ARDUINO >= 100
#include "arduino.h"
#else
#include "WProgram.h"
#endif
extern "C" {
#include <user_interface.h>
}
/** Credential storage area offset specifier in EEPROM.
* By defining AC_IDENTIFIER_OFFSET macro in the user sketch, the credential
* storage area can be shifted in EEPROM.
*/
#ifndef AC_IDENTIFIER_OFFSET
#define AC_IDENTIFIER_OFFSET 0
#endif
/** AutoConnectCredential class. */
class AutoConnectCredential {
public:
AutoConnectCredential();
~AutoConnectCredential();
uint8_t entries() { return _entries; }
bool del(const char* ssid);
int8_t load(const char* ssid, struct station_config* config);
bool load(int8_t entry, struct station_config* config);
bool save(const struct station_config* config);
private:
void _retrieveEntry(char* ssid, char* password, uint8_t* bssid); /**< Read an available entry. */
uint8_t _entries; /**< Count of the available entry */
uint16_t _containSize; /**< Container size */
int _dp; /**< The current address in EEPROM */
int _ep; /**< The current entry address in EEPROM */
};
#endif // _AUTOCONNECTCREDENTAIL_H_