CHENGQI YANG / SmartLab_MuRata
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers WIFINetwork.cpp Source File

WIFINetwork.cpp

00001 #include "WIFINetwork.h"
00002 
00003 using namespace SmartLabMuRata;
00004 
00005 const char * WIFINetwork::GetSecurityKey()
00006 {
00007     return key;
00008 }
00009 
00010 const char * WIFINetwork::GetBSSID()
00011 {
00012     return bssid;
00013 }
00014 
00015 WIFINetwork::WIFINetwork()
00016 {
00017     bssid = NULL;
00018     key = NULL;
00019 }
00020 
00021 WIFINetwork::WIFINetwork(const char * SSID, const SecurityMode securityMode, const char * securityKey)
00022     : WIFIInfo(SSID, securityMode)
00023 {
00024     bssid = NULL;
00025     key = NULL;
00026     SetSecurityKey(securityKey);
00027 }
00028 
00029 WIFINetwork::~WIFINetwork()
00030 {
00031     if (bssid != NULL)
00032         delete[] bssid;
00033 
00034     if (key != NULL)
00035         delete[] key;
00036 }
00037 
00038 WIFINetwork * WIFINetwork::SetSecurityKey(const char * SecurityKey)
00039 {
00040     if (SecurityKey == NULL)
00041         return this;
00042 
00043     if (key != NULL)
00044         delete[] key;
00045 
00046     int length = strlen(SecurityKey) + 1;
00047 
00048     key = new char[length];
00049     memcpy(key, SecurityKey, length);
00050     return this;
00051 }
00052 
00053 WIFINetwork * WIFINetwork::SetBSSID(const char * BSSID)
00054 {
00055     if (BSSID == NULL)
00056         return this;
00057 
00058     if (bssid != NULL)
00059         delete[] bssid;
00060 
00061     bssid = new char[6];
00062     memcpy(bssid, BSSID, 6);
00063     return this;
00064 }
00065 
00066 WIFINetwork * WIFINetwork::SetSSID(const char * SSID)
00067 {
00068     WIFIInfo::SetSSID(SSID);
00069     return this;
00070 }
00071 
00072 WIFINetwork * WIFINetwork::SetSecurityMode(const SecurityMode securityMode)
00073 {
00074     WIFIInfo::SetSecurityMode(securityMode);
00075     return this;
00076 }
00077 
00078 WIFINetwork * WIFINetwork::SetChannel(const char channel)
00079 {
00080     WIFIInfo::SetChannel(channel);
00081     return this;
00082 }