Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: RN-XV_simple_server
Diff: Wifly.cpp
- Revision:
- 12:fd6874542b28
- Parent:
- 11:6eb90004d92a
- Child:
- 16:f524a28790b1
--- a/Wifly.cpp Wed Sep 21 09:31:47 2011 +0000 +++ b/Wifly.cpp Thu Oct 20 09:28:32 2011 +0000 @@ -68,7 +68,7 @@ -bool Wifly::Send(char * str, char * ACK, char * res) { +bool Wifly::send(char * str, char * ACK, char * res) { char read; @@ -133,12 +133,12 @@ return true; } -bool Wifly::Join() { +bool Wifly::join() { char cmd[30]; exit(); - if (!CmdMode()) { + if (!cmdMode()) { #ifdef DEBUG printf("join: cannot enter in cmd mode\r\n"); #endif @@ -147,7 +147,7 @@ } //auth - if (!Send("set w a 3\r\n", "AOK")) { + if (!send("set w a 3\r\n", "AOK")) { #ifdef DEBUG printf("join: cannot set auth\r\n"); #endif @@ -157,7 +157,7 @@ //dhcp sprintf(cmd, "set i d %d\r\n", (dhcp) ? 1 : 0); - if (!Send(cmd, "AOK")) { + if (!send(cmd, "AOK")) { #ifdef DEBUG printf("join: cannot set dhcp\r\n"); #endif @@ -166,7 +166,7 @@ } //no echo - if (!Send("set u m 1\r\n", "AOK")) { + if (!send("set u m 1\r\n", "AOK")) { #ifdef DEBUG printf("join: cannot set no echo\r\n"); #endif @@ -179,16 +179,16 @@ printf("not dhcp\r\n"); #endif sprintf(cmd, "set i a %s\r\n", ip); - if (!Send(cmd, "AOK")) { + if (!send(cmd, "AOK")) { #ifdef DEBUG - printf("Wifly::Join: cannot set ip address\r\n"); + printf("Wifly::join: cannot set ip address\r\n"); #endif exit(); return false; } sprintf(cmd, "set i n %s\r\n", netmask); - if (!Send(cmd, "AOK")) { + if (!send(cmd, "AOK")) { #ifdef DEBUG printf("Wifly::join: cannot set netmask\r\n"); #endif @@ -204,7 +204,7 @@ else sprintf(cmd, "set w k %s\r\n", phrase); - if (!Send(cmd, "AOK")) { + if (!send(cmd, "AOK")) { #ifdef DEBUG printf("join: cannot set phrase\r\n"); #endif @@ -217,7 +217,7 @@ //join the network sprintf(cmd, "join %s\r\n", ssid); - if (!Send(cmd, "IP=")) { + if (!send(cmd, "IP=")) { #ifdef DEBUG printf("join: cannot join %s\r\n", ssid); #endif @@ -234,13 +234,13 @@ -bool Wifly::CreateAdhocNetwork() { +bool Wifly::createAdhocNetwork() { if (adhoc) { char cmd[50]; exit(); - if (!CmdMode()) { + if (!cmdMode()) { #ifdef DEBUG printf("Wifly::CreateAdhocNetwork: cannot enter in cmd mode\r\n"); #endif @@ -248,7 +248,7 @@ return false; } - if (!Send("set w j 4\r\n", "AOK")) { + if (!send("set w j 4\r\n", "AOK")) { #ifdef DEBUG printf("Wifly::CreateAdhocNetwork: cannot set join 4\r\n"); #endif @@ -257,7 +257,7 @@ } //no echo - if (!Send("set u m 1\r\n", "AOK")) { + if (!send("set u m 1\r\n", "AOK")) { #ifdef DEBUG printf("join: cannot set no echo\r\n"); #endif @@ -267,7 +267,7 @@ //ssid sprintf(cmd, "set w s %s\r\n", ssid); - if (!Send(cmd, "AOK")) { + if (!send(cmd, "AOK")) { #ifdef DEBUG printf("Wifly::CreateAdhocNetwork: cannot set ssid\r\n"); #endif @@ -276,7 +276,7 @@ } sprintf(cmd, "set w c %d\r\n", channel); - if (!Send(cmd, "AOK")) { + if (!send(cmd, "AOK")) { #ifdef DEBUG printf("Wifly::CreateAdhocNetwork: cannot set channel\r\n"); #endif @@ -285,7 +285,7 @@ } sprintf(cmd, "set i a %s\r\n", ip); - if (!Send(cmd, "AOK")) { + if (!send(cmd, "AOK")) { #ifdef DEBUG printf("Wifly::CreateAdhocNetwork: cannot set ip address\r\n"); #endif @@ -294,7 +294,7 @@ } sprintf(cmd, "set i n %s\r\n", netmask); - if (!Send(cmd, "AOK")) { + if (!send(cmd, "AOK")) { #ifdef DEBUG printf("Wifly::CreateAdhocNetwork: cannot set netmask\r\n"); #endif @@ -302,7 +302,7 @@ return false; } - if (!Send("set i d 0\r\n", "AOK")) { + if (!send("set i d 0\r\n", "AOK")) { #ifdef DEBUG printf("Wifly::CreateAdhocNetwork: cannot set dhcp off\r\n"); #endif @@ -310,7 +310,7 @@ return false; } - if (!Send("save\r\n", "Stor")) { + if (!send("save\r\n", "Stor")) { #ifdef DEBUG printf("Wifly::CreateAdhocNetwork: cannot save\r\n"); #endif @@ -318,7 +318,7 @@ return false; } - Send("reboot\r\n", "NO"); + send("reboot\r\n", "NO"); #ifdef DEBUG printf("\r\ncreating an adhoc\r\nnetwork: %s\r\nip: %s\r\nnetmask: %s\r\nchannel: %d\r\n\r\n", ssid, ip, netmask, channel); #endif @@ -331,10 +331,10 @@ } } -bool Wifly::CmdMode() { - if (!Send("$$$", "CMD")) { +bool Wifly::cmdMode() { + if (!send("$$$", "CMD")) { #ifdef DEBUG - printf("Wifly::CmdMode: cannot enter in cmd mode\r\n"); + printf("Wifly::cmdMode: cannot enter in cmd mode\r\n"); #endif return false; } @@ -378,7 +378,7 @@ bool Wifly::exit() { - return Send("exit\r", "EXIT"); + return send("exit\r", "EXIT"); } @@ -390,7 +390,7 @@ bool Wifly::changeBaudrate(int baudrate) { char cmd[20]; exit(); - if (!CmdMode()) { + if (!cmdMode()) { #ifdef DEBUG printf("Wifly::changeBaudrate: cannot enter in cmd mode\r\n"); #endif @@ -398,7 +398,7 @@ } sprintf(cmd, "set u b %d\r\n", baudrate); - if (!Send(cmd, "AOK")) { + if (!send(cmd, "AOK")) { #ifdef DEBUG printf("Wifly::changeBaudrate: cannot set new baudrate\r\n"); #endif @@ -406,7 +406,7 @@ return false; } - if (!Send("save\r\n", "Stor")) { + if (!send("save\r\n", "Stor")) { #ifdef DEBUG printf("Wifly::changeBaudrate: cannot save\r\n"); #endif