| 56 | } |
| 57 | |
| 58 | bool Twitter::checkStatus(Print *debug) |
| 59 | { |
| 60 | if (!client.connected()) { |
| 61 | if (debug) |
| 62 | while(client.available()) |
| 63 | debug->print((char)client.read()); |
| 64 | client.flush(); |
| 65 | client.stop(); |
| 66 | return false; |
| 67 | } |
| 68 | if (!client.available()) |
| 69 | return true; |
| 70 | char c = client.read(); |
| 71 | if (debug) |
| 72 | debug->print(c); |
| 73 | switch(parseStatus) { |
| 74 | case 0: |
| 75 | if (c == ' ') parseStatus++; break; // skip "HTTP/1.1 " |
| 76 | case 1: |
| 77 | if (c >= '0' && c <= '9') { |
| 78 | statusCode *= 10; |
| 79 | statusCode += c - '0'; |
| 80 | } else { |
| 81 | parseStatus++; |
| 82 | } |
| 83 | } |
| 84 | return true; |
| 85 | } |
| 86 | |
| 87 | int Twitter::wait(Print *debug) |
| 88 | { |