WebSocket client library
Revision 19:ca8c5ad59850, committed 2011-10-20
- Comitter:
- samux
- Date:
- Thu Oct 20 09:58:16 2011 +0000
- Parent:
- 18:ef44ea603938
- Child:
- 20:bb9d7ba48e6e
- Commit message:
Changed in this revision
Websocket.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/Websocket.cpp Thu Oct 20 09:52:41 2011 +0000 +++ b/Websocket.cpp Thu Oct 20 09:58:16 2011 +0000 @@ -113,9 +113,9 @@ bool Websocket::connect() { char cmd[50]; if (netif == WIF) { - wifi->Send("exit\r", "NO"); + wifi->send("exit\r", "NO"); //enter in cmd mode - while (!wifi->Send("$$$", "CMD")) { + while (!wifi->send("$$$", "CMD")) { #ifdef DEBUG printf("cannot enter in CMD mode\r\n"); #endif @@ -125,7 +125,7 @@ //open the connection sprintf(cmd, "open %s %s\r\n", ip_domain.c_str(), port.c_str()); - if (!wifi->Send(cmd, "OPEN*")) { + if (!wifi->send(cmd, "OPEN*")) { #ifdef DEBUG printf("Websocket::connect cannot open\r\n"); #endif @@ -135,21 +135,21 @@ //send websocket HTTP header sprintf(cmd, "GET /%s HTTP/1.1\r\n", path.c_str()); - wifi->Send(cmd, "NO"); + wifi->send(cmd, "NO"); sprintf(cmd, "Host: %s:%s\r\n", ip_domain.c_str(), port.c_str()); - wifi->Send(cmd, "NO"); + wifi->send(cmd, "NO"); - wifi->Send("Upgrade: WebSocket\r\n", "NO"); + wifi->send("Upgrade: WebSocket\r\n", "NO"); sprintf(cmd, "Origin: http:%s:%s\r\n", ip_domain.c_str(), port.c_str()); - wifi->Send(cmd, "NO"); + wifi->send(cmd, "NO"); - wifi->Send("Connection: Upgrade\r\n", "NO"); - wifi->Send("Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5\r\n", "NO"); - wifi->Send("Sec-WebSocket-key2: 12998 5 Y3 1 .P00\r\n\r\n", "NO"); - if (!wifi->Send("^n:ds[4U", "8jKS'y:G*Co,Wxa-")) + wifi->send("Connection: Upgrade\r\n", "NO"); + wifi->send("Sec-WebSocket-Key1: 4 @1 46546xW%0l 1 5\r\n", "NO"); + wifi->send("Sec-WebSocket-key2: 12998 5 Y3 1 .P00\r\n\r\n", "NO"); + if (!wifi->send("^n:ds[4U", "8jKS'y:G*Co,Wxa-")) return false; #ifdef DEBUG printf("\r\nip_domain: %s\r\npath: /%s\r\nport: %s\r\n\r\n",this->ip_domain.c_str(), this->path.c_str(), this->port.c_str()); @@ -246,7 +246,7 @@ void Websocket::send(char * str) { if (netif == WIF) { wifi->putc('\x00'); - wifi->Send(str, "NO"); + wifi->send(str, "NO"); wifi->putc('\xff'); } else if (netif == ETH) { char c = '\x00'; @@ -306,14 +306,14 @@ bool Websocket::close() { if (netif == WIF) { - if (!wifi->CmdMode()) { + if (!wifi->cmdMode()) { #ifdef DEBUG printf("Websocket::close: cannot enter in cmd mode\r\n"); #endif return false; } - wifi->Send("close\r", "NO"); + wifi->send("close\r", "NO"); if (!wifi->exit()) return false; @@ -334,7 +334,7 @@ char str[10]; wait(0.25); - if (!wifi->CmdMode()) { + if (!wifi->cmdMode()) { #ifdef DEBUG printf("Websocket::connected: cannot enter in cmd mode\r\n"); #endif @@ -342,7 +342,7 @@ } wait(0.25); - wifi->Send("show c\r\n", "NO", str); + wifi->send("show c\r\n", "NO", str); if (str[3] == '1') { if (!wifi->exit()) {