private fork
Fork of GSwifiInterface by
Diff: GSwifiInterface.cpp
- Revision:
- 8:64184a968e3b
- Parent:
- 5:78943b3945b5
- Child:
- 11:71d67fea5ace
diff -r 6a6396b56405 -r 64184a968e3b GSwifiInterface.cpp --- a/GSwifiInterface.cpp Wed Jan 30 05:52:14 2013 +0000 +++ b/GSwifiInterface.cpp Thu Oct 31 06:41:45 2013 +0000 @@ -4,31 +4,41 @@ #include "GSwifiInterface.h" -GSwifiInterface::GSwifiInterface( PinName tx, PinName rx, PinName cts, PinName rts, PinName reset, - const char * ssid, const char * phrase, Security sec) : - GSwifi(tx, rx, cts, rts, reset, ssid, phrase, sec) +GSwifiInterface::GSwifiInterface( PinName tx, PinName rx, PinName cts, PinName rts, PinName reset, PinName alarm, int baud) : + GSwifi(tx, rx, cts, rts, reset, alarm, baud) { } -int GSwifiInterface::init() +int GSwifiInterface::init(const char* name) { _state.dhcp = true; - return 0; -} - -int GSwifiInterface::init(const char* ip, const char* mask, const char* gateway) -{ - _state.dhcp = false; - strncpy(_ip, ip, sizeof(_ip)); - strncpy(_netmask, mask, sizeof(_netmask)); - strncpy(_gateway, gateway, sizeof(_gateway)); + strncpy(_state.name, name, sizeof(_state.name)); return 0; } -int GSwifiInterface::connect() +int GSwifiInterface::init(const char* ip, const char* mask, const char* gateway, const char* name) { - return join(); + _state.dhcp = false; + strncpy(_state.ip, ip, sizeof(_state.ip)); + strncpy(_state.netmask, mask, sizeof(_state.netmask)); + strncpy(_state.gateway, gateway, sizeof(_state.gateway)); + strncpy(_state.name, name, sizeof(_state.name)); + + return 0; +} + +int GSwifiInterface::connect(Security sec, const char* ssid, const char* phrase, WiFiMode mode) +{ + switch (mode) { + case WM_INFRASTRUCTURE: + return join(sec, ssid, phrase); + case WM_ADHOCK: + return adhock(sec, ssid, phrase); + case WM_LIMITEDAP: + return limitedap(sec, ssid, phrase); + } + return -1; } int GSwifiInterface::disconnect() @@ -36,8 +46,22 @@ return GSwifi::disconnect(); } +char * GSwifiInterface::getMACAddress() +{ + return _state.mac; +} + char * GSwifiInterface::getIPAddress() { + return _state.ip; +} - return _ip; -} \ No newline at end of file +char * GSwifiInterface::getGateway() +{ + return _state.gateway; +} + +char * GSwifiInterface::getNetworkMask() +{ + return _state.netmask; +}