MODIFIED from mbed official WiflyInterface (interface for Roving Networks Wifly modules). Numerous performance and reliability improvements (see the detailed documentation). Also, tracking changes in mbed official version to retain functional parity.

Dependents:   Smart-WiFly-WebServer PUB_WiflyInterface_Demo

Fork of WiflyInterface by mbed official

Resources

Derivative from mbed Official

  • Documentation update, improved consistency, documented parameters that were inadvertently omitted.
  • Avoid c++ string handling, which causes dynamic allocation and free, side effect, fewer CPU cycles spent for same purpose.
  • Fixed socket APIs to support non-blocking mode.
  • Increase communication baud-rate to Wifly module
  • sendCommand - added retries for improved robustness.
  • setConnectionState - method to force the connection state (used by TCPSocketServer)
  • gethostbyname - added a length parameter to the size of the buffer being written
  • flushIn - a private method to flush the input buffer
  • Changed the timeout from 500 to 2500 msec for commands - measured some at 700 to 850 msec.
  • Performance improvements - reduced some unnecessary delays.
  • Added additional security options for the wi-fi connection (that are supported by the WiFly module).
  • Added setSecurity API which permits revising the security when connecting to, or selecting from, one of several access points.
  • Improved DEBUG interface (slightly more consistent printout).
  • gathers information from the Wifly module on reboot (SW version info), which permits customizing behavior based on Wifly capabilities (like the improved security).
  • Avoid potential for recursive crash (if exit fails, it calls sendcommand, which calls exit...)
  • Update to support permissible SSID and PassCode lengths.

Robustness testing

I've had some mixed behavior with the Wifly module, some of which seems to be traceable to the module itself, and some in my derivative code. The result, after running for minutes, hours, sometimes days, it hangs and I have to reset the module.

To test, I created a fairly simple test program -

  • check for Watchdog induced reset and count it.
  • initialize the Watchdog for 60 sec timeout.
  • Init the Wifly interface and connect to my network.
  • Wait 10 seconds and force mbed_reset().

If the Watchdog induces the restart, then it is pretty clear that either:

  • The communications hung with the Wifly module causing the failure.
  • The Wifly module decided to go unresponsive.

If it gets to the end, it typically takes about 4 to 6 seconds for the boot and connect, then the 10 second delay.

But I can't really pin down the root cause easily. My strongest theory is that the Wifly module has rebooted, and since I don't store the high baud rate I configure it for, it resets back to 9600.

Also, one of the objectives for my revised send( ) is to avoid the c++ string, as that can fragment memory, and it wasn't very well bounded in behavior.

Latest tests:

Warm BootsWatchdog EventsNotes
100's30An early version of my derivative WiflyInterface, including my derivative of "send( )" API. Let's call this version 0.1.
26684My derivative WiflyInterface, but with the mbed official "send( )" API. Much improved. This was over the course of about 12 hours.
24003Most recent derivative - incremental change to "send( )", but this relative number does not rule out the Wifly module itself.

I think with these numbers, +/- 1 means that the changes have had no measurable effect. Which is good, since this incremental change eliminates the c++ string handling.

Test Software

This is pieces of a test program, clipped and copied to here. What I have compiled and run for hours and hours is almost exactly what you see. This uses this simple Watchdog library.

#include "mbed.h"
#include "WiflyInterface.h"
#include "Watchdog.h"

Serial pc(USBTX, USBRX);

Watchdog wd;
extern "C" void mbed_reset();

// Pinout for SmartBoard
WiflyInterface wifly(p9, p10, p30, p29, "ssid", "pass", WPA);

int main() {
    pc.baud(460800);                         // I like a snappy terminal
    
    wd.Configure(60.0);                     // Set time limit for the test to 1 minute
    LPC_RTC->GPREG0++;                      // Count boots here
    if (wd.WatchdogCausedReset()) {
        LPC_RTC->GPREG1++;                  // Count Watchdog events here
        pc.printf("\r\n\r\nWatchdog event.\r\n");
    }
    pc.printf("\r\nWifly Test: %d boots, %d watchdogs. %s %s\r\n", LPC_RTC->GPREG0, LPC_RTC->GPREG1, __DATE__, __TIME__);
    
    wifly.init(); // use DHCP
    pc.printf("Connect...  ");
    while (!wifly.connect());               // join the network
    pc.printf("Address is %s.  ", wifly.getIPAddress());
    pc.printf("Disconnect...  ");
    wifly.disconnect();
    pc.printf("OK. Reset in 10 sec...\r\n");
    wait(10);
    if (pc.readable()) {
        if (pc.getc() == 'r') {             // secret 'r'eset of the counters
            LPC_RTC->GPREG0 = 0;
            LPC_RTC->GPREG1 = 0;
            pc.printf("counters reset\r\n");
        }
    }
    mbed_reset();                           // reset here indicates successful communication
}
Committer:
WiredHome
Date:
Mon Jul 01 04:37:55 2013 +0000
Revision:
12:6270ced02019
Parent:
10:a594fe035b36
Quite a bit of refactoring of the wifly interface. Most of the changes are in the Wifly.cpp file.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
samux 1:fb4494783863 1 /* Copyright (C) 2012 mbed.org, MIT License
samux 1:fb4494783863 2 *
samux 1:fb4494783863 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
samux 1:fb4494783863 4 * and associated documentation files (the "Software"), to deal in the Software without restriction,
samux 1:fb4494783863 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
samux 1:fb4494783863 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
samux 1:fb4494783863 7 * furnished to do so, subject to the following conditions:
samux 1:fb4494783863 8 *
samux 1:fb4494783863 9 * The above copyright notice and this permission notice shall be included in all copies or
samux 1:fb4494783863 10 * substantial portions of the Software.
samux 1:fb4494783863 11 *
samux 1:fb4494783863 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
samux 1:fb4494783863 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
samux 1:fb4494783863 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
samux 1:fb4494783863 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
samux 1:fb4494783863 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
samux 1:fb4494783863 17 *
samux 1:fb4494783863 18 * @section DESCRIPTION
samux 1:fb4494783863 19 *
samux 1:fb4494783863 20 * Wifly RN131-C, wifi module
samux 1:fb4494783863 21 *
samux 1:fb4494783863 22 * Datasheet:
samux 1:fb4494783863 23 *
samux 1:fb4494783863 24 * http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Wireless/WiFi/WiFly-RN-UM.pdf
samux 1:fb4494783863 25 */
WiredHome 5:cc0506dc3565 26 /* Modifications by David Smart
WiredHome 8:79415e982c32 27 * 25 Jun 2013
WiredHome 8:79415e982c32 28 * Added other security values
WiredHome 8:79415e982c32 29 * <prior>
WiredHome 5:cc0506dc3565 30 * baud - added method to crank up the baud rate.
WiredHome 5:cc0506dc3565 31 * isCmdMode - added a method to find out if it is in command mode
WiredHome 5:cc0506dc3565 32 * send - documented the timeout parameter
WiredHome 5:cc0506dc3565 33 * sendCommand - documented the timeout parameter
WiredHome 5:cc0506dc3565 34 * setConnectionState - added method to force the connection state (used by TCPSocketServer when it accepts a connection)
WiredHome 5:cc0506dc3565 35 * gethostbyname - added a length parameter to the size of the buffer being written
WiredHome 5:cc0506dc3565 36 * flushIn - added a private method to flush the input buffer
WiredHome 5:cc0506dc3565 37 */
samux 1:fb4494783863 38 #ifndef WIFLY_H
samux 1:fb4494783863 39 #define WIFLY_H
samux 1:fb4494783863 40
samux 1:fb4494783863 41 #include "mbed.h"
samux 1:fb4494783863 42 #include "CBuffer.h"
samux 1:fb4494783863 43
WiredHome 5:cc0506dc3565 44 #define DEFAULT_WAIT_RESP_TIMEOUT 1000
samux 1:fb4494783863 45
WiredHome 8:79415e982c32 46 enum Security { // See Wifly user manual Table 2-13.
WiredHome 12:6270ced02019 47 NONE = 0,
WiredHome 12:6270ced02019 48 WEP_128 = 1,
WiredHome 8:79415e982c32 49 WPA1 = 2,
WiredHome 8:79415e982c32 50 WPA_MIXED = 3,
WiredHome 8:79415e982c32 51 WPA = 3, // maintained for backward compatibility
WiredHome 8:79415e982c32 52 WPA2_PSK = 4,
WiredHome 8:79415e982c32 53 ADHOC = 6,
WiredHome 10:a594fe035b36 54 WPE_64 = 8,
WiredHome 10:a594fe035b36 55 WEP_64 = 8 // probably what the last one should have been
samux 1:fb4494783863 56 };
samux 1:fb4494783863 57
samux 1:fb4494783863 58 enum Protocol {
samux 1:fb4494783863 59 UDP = (1 << 0),
samux 1:fb4494783863 60 TCP = (1 << 1)
samux 1:fb4494783863 61 };
samux 1:fb4494783863 62
WiredHome 7:b3d740f89f27 63 /** the Wifly object
WiredHome 7:b3d740f89f27 64 *
WiredHome 10:a594fe035b36 65 * This object controls the Wifly module.
WiredHome 7:b3d740f89f27 66 */
samux 1:fb4494783863 67 class Wifly
samux 1:fb4494783863 68 {
WiredHome 12:6270ced02019 69
samux 1:fb4494783863 70 public:
WiredHome 7:b3d740f89f27 71 /**
samux 1:fb4494783863 72 * Constructor
samux 1:fb4494783863 73 *
samux 1:fb4494783863 74 * @param tx mbed pin to use for tx line of Serial interface
samux 1:fb4494783863 75 * @param rx mbed pin to use for rx line of Serial interface
samux 1:fb4494783863 76 * @param reset reset pin of the wifi module ()
samux 1:fb4494783863 77 * @param tcp_status connection status pin of the wifi module (GPIO 6)
samux 1:fb4494783863 78 * @param ssid ssid of the network
samux 1:fb4494783863 79 * @param phrase WEP or WPA key
WiredHome 10:a594fe035b36 80 * @param sec Security type (NONE, WEP_128, WPA1, WPA | WPA_MIXED, WPA2_PSK, WEP_64 )
samux 1:fb4494783863 81 */
WiredHome 12:6270ced02019 82 Wifly( PinName tx, PinName rx, PinName reset, PinName tcp_status, const char * ssid, const char * phrase, Security sec);
WiredHome 5:cc0506dc3565 83
WiredHome 7:b3d740f89f27 84 /**
WiredHome 10:a594fe035b36 85 * Set the baud rate between the ARM and the WiFly.
WiredHome 10:a594fe035b36 86 *
WiredHome 10:a594fe035b36 87 * This will try to set the WiFly module baud rate first and then
WiredHome 10:a594fe035b36 88 * set the ARM to match it. If it cannot get the proper acknowledge
WiredHome 10:a594fe035b36 89 * response, it will go on a hunt through the range of standard
WiredHome 10:a594fe035b36 90 * baud rates.
WiredHome 5:cc0506dc3565 91 *
WiredHome 5:cc0506dc3565 92 * @note Baud rate of 230400 has been tested without using flow
WiredHome 5:cc0506dc3565 93 * control.
WiredHome 5:cc0506dc3565 94 *
WiredHome 5:cc0506dc3565 95 * @param baudrate is the desired baudrate.
WiredHome 10:a594fe035b36 96 * @returns true if it succeeded, which means that communications can continue, or false
WiredHome 10:a594fe035b36 97 * if it failed to establish a communication link.
WiredHome 5:cc0506dc3565 98 */
WiredHome 10:a594fe035b36 99 bool baud(int baudrate);
samux 1:fb4494783863 100
WiredHome 7:b3d740f89f27 101 /**
samux 1:fb4494783863 102 * Connect the wifi module to the ssid contained in the constructor.
samux 1:fb4494783863 103 *
samux 1:fb4494783863 104 * @return true if connected, false otherwise
samux 1:fb4494783863 105 */
samux 1:fb4494783863 106 bool join();
samux 1:fb4494783863 107
WiredHome 7:b3d740f89f27 108 /**
samux 1:fb4494783863 109 * Disconnect the wifly module from the access point
samux 1:fb4494783863 110 *
samux 1:fb4494783863 111 * @ returns true if successful
samux 1:fb4494783863 112 */
samux 1:fb4494783863 113 bool disconnect();
samux 1:fb4494783863 114
WiredHome 7:b3d740f89f27 115 /**
samux 1:fb4494783863 116 * Open a tcp connection with the specified host on the specified port
samux 1:fb4494783863 117 *
samux 1:fb4494783863 118 * @param host host (can be either an ip address or a name. If a name is provided, a dns request will be established)
samux 1:fb4494783863 119 * @param port port
samux 1:fb4494783863 120 * @ returns true if successful
samux 1:fb4494783863 121 */
samux 1:fb4494783863 122 bool connect(const char * host, int port);
samux 1:fb4494783863 123
samux 1:fb4494783863 124
WiredHome 7:b3d740f89f27 125 /**
samux 1:fb4494783863 126 * Set the protocol (UDP or TCP)
samux 1:fb4494783863 127 *
samux 1:fb4494783863 128 * @param p protocol
samux 1:fb4494783863 129 * @ returns true if successful
samux 1:fb4494783863 130 */
samux 1:fb4494783863 131 bool setProtocol(Protocol p);
samux 1:fb4494783863 132
WiredHome 7:b3d740f89f27 133 /**
samux 1:fb4494783863 134 * Reset the wifi module
samux 1:fb4494783863 135 */
samux 1:fb4494783863 136 void reset();
samux 3:9aa05e19c62e 137
WiredHome 7:b3d740f89f27 138 /**
samux 3:9aa05e19c62e 139 * Reboot the wifi module
samux 3:9aa05e19c62e 140 */
samux 3:9aa05e19c62e 141 bool reboot();
samux 1:fb4494783863 142
WiredHome 7:b3d740f89f27 143 /**
samux 1:fb4494783863 144 * Check if characters are available
samux 1:fb4494783863 145 *
samux 1:fb4494783863 146 * @return number of available characters
samux 1:fb4494783863 147 */
samux 1:fb4494783863 148 int readable();
samux 1:fb4494783863 149
WiredHome 7:b3d740f89f27 150 /**
samux 1:fb4494783863 151 * Check if characters are available
samux 1:fb4494783863 152 *
samux 1:fb4494783863 153 * @return number of available characters
samux 1:fb4494783863 154 */
samux 1:fb4494783863 155 int writeable();
samux 1:fb4494783863 156
WiredHome 7:b3d740f89f27 157 /**
samux 1:fb4494783863 158 * Check if a tcp link is active
samux 1:fb4494783863 159 *
samux 1:fb4494783863 160 * @returns true if successful
samux 1:fb4494783863 161 */
samux 1:fb4494783863 162 bool is_connected();
samux 1:fb4494783863 163
WiredHome 7:b3d740f89f27 164 /**
samux 1:fb4494783863 165 * Read a character
samux 1:fb4494783863 166 *
samux 1:fb4494783863 167 * @return the character read
samux 1:fb4494783863 168 */
samux 1:fb4494783863 169 char getc();
samux 1:fb4494783863 170
WiredHome 7:b3d740f89f27 171 /**
samux 1:fb4494783863 172 * Flush the buffer
samux 1:fb4494783863 173 */
samux 1:fb4494783863 174 void flush();
samux 1:fb4494783863 175
WiredHome 7:b3d740f89f27 176 /**
samux 1:fb4494783863 177 * Write a character
samux 1:fb4494783863 178 *
samux 1:fb4494783863 179 * @param the character which will be written
samux 1:fb4494783863 180 */
samux 1:fb4494783863 181 int putc(char c);
samux 1:fb4494783863 182
WiredHome 7:b3d740f89f27 183 /**
samux 1:fb4494783863 184 * To enter in command mode (we can configure the module)
samux 1:fb4494783863 185 *
samux 1:fb4494783863 186 * @return true if successful, false otherwise
samux 1:fb4494783863 187 */
samux 1:fb4494783863 188 bool cmdMode();
samux 1:fb4494783863 189
WiredHome 7:b3d740f89f27 190 /**
WiredHome 5:cc0506dc3565 191 * determine if the module is in command mode
WiredHome 5:cc0506dc3565 192 *
WiredHome 5:cc0506dc3565 193 * @return true if in command mode, false otherwise
WiredHome 5:cc0506dc3565 194 */
WiredHome 5:cc0506dc3565 195 bool isCmdMode() {
WiredHome 5:cc0506dc3565 196 return state.cmd_mode;
WiredHome 5:cc0506dc3565 197 }
WiredHome 5:cc0506dc3565 198
WiredHome 7:b3d740f89f27 199 /**
samux 1:fb4494783863 200 * To exit the command mode
samux 1:fb4494783863 201 *
samux 1:fb4494783863 202 * @return true if successful, false otherwise
samux 1:fb4494783863 203 */
samux 1:fb4494783863 204 bool exit();
samux 1:fb4494783863 205
WiredHome 7:b3d740f89f27 206 /**
samux 1:fb4494783863 207 * Close a tcp connection
samux 1:fb4494783863 208 *
samux 1:fb4494783863 209 * @ returns true if successful
samux 1:fb4494783863 210 */
samux 1:fb4494783863 211 bool close();
samux 1:fb4494783863 212
WiredHome 7:b3d740f89f27 213 /**
samux 1:fb4494783863 214 * Send a string to the wifi module by serial port. This function desactivates the user interrupt handler when a character is received to analyze the response from the wifi module.
samux 1:fb4494783863 215 * Useful to send a command to the module and wait a response.
samux 1:fb4494783863 216 *
samux 1:fb4494783863 217 *
samux 1:fb4494783863 218 * @param str string to be sent
samux 1:fb4494783863 219 * @param len string length
samux 1:fb4494783863 220 * @param ACK string which must be acknowledge by the wifi module. If ACK == NULL, no string has to be acknoledged. (default: "NO")
samux 1:fb4494783863 221 * @param res this field will contain the response from the wifi module, result of a command sent. This field is available only if ACK = "NO" AND res != NULL (default: NULL)
WiredHome 8:79415e982c32 222 * @param resSize is the size of the field that res references, to avoid buffer overrun. If res is != NULL resSize is evaluated.
WiredHome 5:cc0506dc3565 223 * @param timeout is the time in msec to wait for the acknowledge
samux 1:fb4494783863 224 *
WiredHome 10:a594fe035b36 225 * @return >=0 if the message was sent, -1 if there is no response within the timeout.
samux 1:fb4494783863 226 */
WiredHome 8:79415e982c32 227 int send(const char * str, int len, const char * ACK = NULL, char * res = NULL, int resSize = 0, int timeout = DEFAULT_WAIT_RESP_TIMEOUT);
samux 1:fb4494783863 228
WiredHome 7:b3d740f89f27 229 /**
samux 1:fb4494783863 230 * Send a command to the wify module. Check if the module is in command mode. If not enter in command mode
samux 1:fb4494783863 231 *
samux 1:fb4494783863 232 * @param str string to be sent
samux 1:fb4494783863 233 * @param ACK string which must be acknowledge by the wifi module. If ACK == NULL, no string has to be acknoledged. (default: "NO")
samux 1:fb4494783863 234 * @param res this field will contain the response from the wifi module, result of a command sent. This field is available only if ACK = "NO" AND res != NULL (default: NULL)
WiredHome 8:79415e982c32 235 * @param resSize is the size of the field that res references, to avoid buffer overrun. If res is != NULL resSize is evaluated.
WiredHome 5:cc0506dc3565 236 * @param timeout is the time in msec to wait for the acknowledge
samux 1:fb4494783863 237 *
samux 1:fb4494783863 238 * @returns true if successful
samux 1:fb4494783863 239 */
WiredHome 8:79415e982c32 240 bool sendCommand(const char * cmd, const char * ack = NULL, char * res = NULL, int resSize = 0, int timeout = DEFAULT_WAIT_RESP_TIMEOUT);
samux 4:0bcec6272784 241
WiredHome 7:b3d740f89f27 242 /**
WiredHome 10:a594fe035b36 243 * Test if the current configuration is using dhcp
samux 4:0bcec6272784 244 *
WiredHome 10:a594fe035b36 245 * @returns true if the module is using dhcp, false otherwise
samux 4:0bcec6272784 246 */
samux 4:0bcec6272784 247 bool isDHCP() {
samux 4:0bcec6272784 248 return state.dhcp;
samux 4:0bcec6272784 249 }
samux 1:fb4494783863 250
WiredHome 7:b3d740f89f27 251 /**
WiredHome 5:cc0506dc3565 252 * gets the host ip address
WiredHome 5:cc0506dc3565 253 *
WiredHome 5:cc0506dc3565 254 * @param host is a pointer to the host string to look up
WiredHome 5:cc0506dc3565 255 * @param ip contains the host IP in a string after the lookup.
WiredHome 5:cc0506dc3565 256 * @param sizeof_ip is the size of the buffer pointed to by ip
WiredHome 5:cc0506dc3565 257 * @returns true if successful
WiredHome 5:cc0506dc3565 258 */
WiredHome 5:cc0506dc3565 259 bool gethostbyname(const char * host, char * ip, int sizeof_ip);
WiredHome 5:cc0506dc3565 260
WiredHome 7:b3d740f89f27 261 /**
WiredHome 9:86105ba18d96 262 * Sets the connection state.
WiredHome 9:86105ba18d96 263 *
WiredHome 9:86105ba18d96 264 * Typically used by external apps that detect an incoming connection.
WiredHome 5:cc0506dc3565 265 *
WiredHome 5:cc0506dc3565 266 * @param state sets the connection state to true or false
WiredHome 5:cc0506dc3565 267 */
WiredHome 5:cc0506dc3565 268 void setConnectionState(bool state);
samux 1:fb4494783863 269
WiredHome 9:86105ba18d96 270 /**
WiredHome 9:86105ba18d96 271 * Get the version information from the Wifly module.
WiredHome 9:86105ba18d96 272 *
WiredHome 9:86105ba18d96 273 * @returns the version information as a string, or NULL
WiredHome 9:86105ba18d96 274 */
WiredHome 10:a594fe035b36 275 char * getWiflyVersionString();
WiredHome 10:a594fe035b36 276
WiredHome 10:a594fe035b36 277 /**
WiredHome 10:a594fe035b36 278 * Get the software version from the Wifly module.
WiredHome 10:a594fe035b36 279 *
WiredHome 10:a594fe035b36 280 * This extracts the basic version number (e.g. 2.38, 4.00)
WiredHome 10:a594fe035b36 281 * as a float.
WiredHome 10:a594fe035b36 282 *
WiredHome 10:a594fe035b36 283 * @returns the software version number as a float.
WiredHome 10:a594fe035b36 284 */
WiredHome 10:a594fe035b36 285 float getWiflyVersion();
WiredHome 9:86105ba18d96 286
samux 1:fb4494783863 287 static Wifly * getInstance() {
samux 1:fb4494783863 288 return inst;
samux 1:fb4494783863 289 };
samux 1:fb4494783863 290
samux 1:fb4494783863 291 protected:
samux 1:fb4494783863 292 Serial wifi;
samux 1:fb4494783863 293 DigitalOut reset_pin;
samux 1:fb4494783863 294 DigitalIn tcp_status;
WiredHome 5:cc0506dc3565 295 int baudrate; //DS for "instantaneous" shifts in baudrate
WiredHome 9:86105ba18d96 296 char * phrase;
WiredHome 9:86105ba18d96 297 char * ssid;
WiredHome 10:a594fe035b36 298 char * wiflyVersionString;
WiredHome 10:a594fe035b36 299 float swVersion;
samux 1:fb4494783863 300 const char * ip;
samux 1:fb4494783863 301 const char * netmask;
samux 1:fb4494783863 302 const char * gateway;
WiredHome 10:a594fe035b36 303 //int channel;
samux 1:fb4494783863 304 CircBuffer<char> buf_wifly;
samux 1:fb4494783863 305
samux 1:fb4494783863 306 static Wifly * inst;
samux 1:fb4494783863 307
samux 1:fb4494783863 308 void attach_rx(bool null);
samux 1:fb4494783863 309 void handler_rx(void);
WiredHome 5:cc0506dc3565 310 void flushIn(int timeout_ms = 0);
samux 1:fb4494783863 311
samux 1:fb4494783863 312 typedef struct STATE {
samux 1:fb4494783863 313 bool associated;
samux 1:fb4494783863 314 bool tcp;
samux 1:fb4494783863 315 bool dhcp;
samux 1:fb4494783863 316 Security sec;
samux 1:fb4494783863 317 Protocol proto;
samux 1:fb4494783863 318 bool cmd_mode;
samux 1:fb4494783863 319 } State;
samux 1:fb4494783863 320
samux 1:fb4494783863 321 State state;
WiredHome 10:a594fe035b36 322 void GatherLogonInfo();
samux 1:fb4494783863 323 char * getStringSecurity();
WiredHome 10:a594fe035b36 324 void SetPhrase(char ** dst, const char * src);
samux 1:fb4494783863 325 };
samux 1:fb4494783863 326
samux 1:fb4494783863 327 #endif