WiFi接口析构时自动销毁ssid/pass

This commit is contained in:
大石头X2 2017-03-01 01:19:22 +08:00
parent 29202abaa7
commit c156bc9d34
3 changed files with 22 additions and 17 deletions

View File

@ -50,8 +50,7 @@ Esp8266::Esp8266(COM idx, Pin power, Pin rst)
Esp8266::~Esp8266()
{
delete SSID;
delete Pass;
RemoveLed();
}
void Esp8266::Init(ITransport* port, Pin power, Pin rst)
@ -60,10 +59,10 @@ void Esp8266::Init(ITransport* port, Pin power, Pin rst)
Speed = 54;
Port = port;
if(Port)
if (Port)
{
if(MinSize) MinSize = Port->MinSize;
if(MaxSize) MaxSize = Port->MaxSize;
if (MinSize) MinSize = Port->MinSize;
if (MaxSize) MaxSize = Port->MaxSize;
Port->Register(OnPortReceive, this);
}
@ -80,7 +79,7 @@ void Esp8266::Init(ITransport* port, Pin power, Pin rst)
Buffer(_sockets, 5 * 4).Clear();
Mode = NetworkType::STA_AP;
WorkMode= NetworkType::STA_AP;
WorkMode = NetworkType::STA_AP;
InitConfig();
LoadConfig();

View File

@ -289,6 +289,12 @@ WiFiInterface::WiFiInterface() : NetworkInterface()
Pass = nullptr;
}
WiFiInterface::~WiFiInterface()
{
delete SSID;
delete Pass;
}
bool WiFiInterface::IsStation() const
{
return Mode == NetworkType::Station || Mode == NetworkType::STA_AP;

View File

@ -113,7 +113,7 @@ public:
String* Pass; // 无线密码
WiFiInterface();
virtual ~WiFiInterface() { }
virtual ~WiFiInterface();
bool IsStation() const;
bool IsAP() const;