Murata RF modules are designed to simplify wireless development and certification by minimizing the amount of RF expertise you need to wirelessly enable a wide range of applications.

Revision:
9:0ce800923eda
Parent:
1:fd19bd683e90
--- a/Type/WIFINetwork.cpp	Mon Feb 15 15:17:50 2016 +0000
+++ b/Type/WIFINetwork.cpp	Wed Mar 16 15:04:46 2016 +0000
@@ -4,40 +4,62 @@
 
 const char * WIFINetwork::GetSecurityKey()
 {
-    return key.c_str();
+    return key;
 }
 
 const char * WIFINetwork::GetBSSID()
 {
-    return BSSID;
+    return bssid;
 }
 
-WIFINetwork::WIFINetwork() { BSSID = NULL; }
+WIFINetwork::WIFINetwork()
+{
+    bssid = NULL;
+    key = NULL;
+}
 
 WIFINetwork::WIFINetwork(const char * SSID, const SecurityMode securityMode, const char * securityKey)
     : WIFIInfo(SSID, securityMode)
 {
-    BSSID = NULL;
+    bssid = NULL;
+    key = NULL;
     SetSecurityKey(securityKey);
 }
 
 WIFINetwork::~WIFINetwork()
 {
-    delete[] BSSID;
+    if (bssid != NULL)
+        delete[] bssid;
+
+    if (key != NULL)
+        delete[] key;
 }
 
 WIFINetwork * WIFINetwork::SetSecurityKey(const char * SecurityKey)
 {
-    key.assign(SecurityKey);
+    if (SecurityKey == NULL)
+        return this;
+
+    if (key != NULL)
+        delete[] key;
+
+    int length = strlen(SecurityKey) + 1;
+
+    key = new char[length];
+    memcpy(key, SecurityKey, length);
     return this;
 }
 
 WIFINetwork * WIFINetwork::SetBSSID(const char * BSSID)
 {
-    if (this->BSSID == NULL)
-        this->BSSID = new char[6];
+    if (BSSID == NULL)
+        return this;
 
-    memcpy(this->BSSID, BSSID, 6);
+    if (bssid != NULL)
+        delete[] bssid;
+
+    bssid = new char[6];
+    memcpy(bssid, BSSID, 6);
     return this;
 }