Added ConnectivityManager class
This commit is contained in:
parent
1f21a807fc
commit
cc8a040596
20
src/app/ConnectivityManager.cpp
Normal file
20
src/app/ConnectivityManager.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
#include "ConnectivityManager.h"
|
||||
|
||||
ConnectivityManager::ConnectivityManager() : _error(0)
|
||||
{
|
||||
persistent(false);
|
||||
|
||||
if(!enableSTAAndAP(false))_error &= AP_AND_STA_ENABLED_ERR;
|
||||
if(!softAP("ESP8266SwissArmyBoard", NULL, 1, false, 8))_error &= AP_SETUP_ERR;
|
||||
}
|
||||
|
||||
boolean ConnectivityManager::enableSTAAndAP(boolean enabled)
|
||||
{
|
||||
return enableSTA(enabled) && enableAP(enabled);
|
||||
}
|
||||
|
||||
unsigned char ConnectivityManager::getError() const
|
||||
{
|
||||
return _error;
|
||||
}
|
||||
|
20
src/app/ConnectivityManager.h
Normal file
20
src/app/ConnectivityManager.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef CONNECTIVITYMANAGER_H
|
||||
#define CONNECTIVITYMANAGER_H
|
||||
|
||||
#include <ESP8266WiFi.h>
|
||||
#include "definition.h"
|
||||
|
||||
class ConnectivityManager : public ESP8266WiFiClass
|
||||
{
|
||||
friend class SAB;
|
||||
public:
|
||||
boolean enableSTAAndAP(boolean enable);
|
||||
|
||||
unsigned char getError() const;
|
||||
protected:
|
||||
ConnectivityManager();
|
||||
private:
|
||||
unsigned char _error;
|
||||
};
|
||||
|
||||
#endif //CONNECTIVITYMANAGER_H
|
Loading…
Reference in New Issue
Block a user