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 22 10:57:29 2013 +0000
Revision:
26:78a1a09afdc9
Parent:
25:a740eb74a86a
Child:
29:49876a8c445b
Modify the reboot method so it gets back in sync more easily.

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 */
samux 1:fb4494783863 26
samux 1:fb4494783863 27 #ifndef WIFLY_H
samux 1:fb4494783863 28 #define WIFLY_H
samux 1:fb4494783863 29
samux 1:fb4494783863 30 #include "mbed.h"
samux 1:fb4494783863 31 #include "CBuffer.h"
samux 1:fb4494783863 32
WiredHome 14:473d73cb48ee 33 #define DEFAULT_WAIT_RESP_TIMEOUT 1000
samux 1:fb4494783863 34
samux 1:fb4494783863 35 enum Security {
samux 1:fb4494783863 36 NONE = 0,
samux 1:fb4494783863 37 WEP_128 = 1,
samux 1:fb4494783863 38 WPA = 3
samux 1:fb4494783863 39 };
samux 1:fb4494783863 40
samux 1:fb4494783863 41 enum Protocol {
samux 1:fb4494783863 42 UDP = (1 << 0),
samux 1:fb4494783863 43 TCP = (1 << 1)
samux 1:fb4494783863 44 };
samux 1:fb4494783863 45
WiredHome 15:121f473dae3f 46 /** the Wifly object
WiredHome 15:121f473dae3f 47 *
WiredHome 15:121f473dae3f 48 * This object controls the Wifly module.
WiredHome 15:121f473dae3f 49 */
samux 1:fb4494783863 50 class Wifly
samux 1:fb4494783863 51 {
samux 1:fb4494783863 52
samux 1:fb4494783863 53 public:
WiredHome 15:121f473dae3f 54 /**
samux 1:fb4494783863 55 * Constructor
samux 1:fb4494783863 56 *
samux 1:fb4494783863 57 * @param tx mbed pin to use for tx line of Serial interface
samux 1:fb4494783863 58 * @param rx mbed pin to use for rx line of Serial interface
samux 1:fb4494783863 59 * @param reset reset pin of the wifi module ()
samux 1:fb4494783863 60 * @param tcp_status connection status pin of the wifi module (GPIO 6)
samux 1:fb4494783863 61 * @param ssid ssid of the network
samux 1:fb4494783863 62 * @param phrase WEP or WPA key
samux 1:fb4494783863 63 * @param sec Security type (NONE, WEP_128 or WPA)
samux 1:fb4494783863 64 */
WiredHome 25:a740eb74a86a 65 Wifly(PinName tx, PinName rx, PinName reset, PinName tcp_status, const char * ssid, const char * phrase, Security sec);
samux 1:fb4494783863 66
WiredHome 15:121f473dae3f 67 /**
WiredHome 25:a740eb74a86a 68 * Destructor to clean up
WiredHome 25:a740eb74a86a 69 */
WiredHome 25:a740eb74a86a 70 ~Wifly();
WiredHome 25:a740eb74a86a 71
WiredHome 25:a740eb74a86a 72 /**
samux 1:fb4494783863 73 * Connect the wifi module to the ssid contained in the constructor.
samux 1:fb4494783863 74 *
samux 1:fb4494783863 75 * @return true if connected, false otherwise
samux 1:fb4494783863 76 */
samux 1:fb4494783863 77 bool join();
samux 1:fb4494783863 78
WiredHome 15:121f473dae3f 79 /**
samux 1:fb4494783863 80 * Disconnect the wifly module from the access point
samux 1:fb4494783863 81 *
samux 1:fb4494783863 82 * @ returns true if successful
samux 1:fb4494783863 83 */
samux 1:fb4494783863 84 bool disconnect();
samux 1:fb4494783863 85
WiredHome 15:121f473dae3f 86 /**
samux 1:fb4494783863 87 * Open a tcp connection with the specified host on the specified port
samux 1:fb4494783863 88 *
samux 1:fb4494783863 89 * @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 90 * @param port port
samux 1:fb4494783863 91 * @ returns true if successful
samux 1:fb4494783863 92 */
samux 1:fb4494783863 93 bool connect(const char * host, int port);
samux 1:fb4494783863 94
samux 1:fb4494783863 95
WiredHome 15:121f473dae3f 96 /**
samux 1:fb4494783863 97 * Set the protocol (UDP or TCP)
samux 1:fb4494783863 98 *
samux 1:fb4494783863 99 * @param p protocol
samux 1:fb4494783863 100 * @ returns true if successful
samux 1:fb4494783863 101 */
samux 1:fb4494783863 102 bool setProtocol(Protocol p);
samux 1:fb4494783863 103
WiredHome 15:121f473dae3f 104 /**
samux 1:fb4494783863 105 * Reset the wifi module
samux 1:fb4494783863 106 */
samux 1:fb4494783863 107 void reset();
samux 3:9aa05e19c62e 108
WiredHome 15:121f473dae3f 109 /**
samux 3:9aa05e19c62e 110 * Reboot the wifi module
samux 3:9aa05e19c62e 111 */
samux 3:9aa05e19c62e 112 bool reboot();
samux 1:fb4494783863 113
WiredHome 15:121f473dae3f 114 /**
samux 1:fb4494783863 115 * Check if characters are available
samux 1:fb4494783863 116 *
samux 1:fb4494783863 117 * @return number of available characters
samux 1:fb4494783863 118 */
samux 1:fb4494783863 119 int readable();
samux 1:fb4494783863 120
WiredHome 15:121f473dae3f 121 /**
samux 1:fb4494783863 122 * Check if characters are available
samux 1:fb4494783863 123 *
samux 1:fb4494783863 124 * @return number of available characters
samux 1:fb4494783863 125 */
samux 1:fb4494783863 126 int writeable();
samux 1:fb4494783863 127
WiredHome 15:121f473dae3f 128 /**
samux 1:fb4494783863 129 * Check if a tcp link is active
samux 1:fb4494783863 130 *
samux 1:fb4494783863 131 * @returns true if successful
samux 1:fb4494783863 132 */
samux 1:fb4494783863 133 bool is_connected();
samux 1:fb4494783863 134
WiredHome 15:121f473dae3f 135 /**
samux 1:fb4494783863 136 * Read a character
samux 1:fb4494783863 137 *
samux 1:fb4494783863 138 * @return the character read
samux 1:fb4494783863 139 */
samux 1:fb4494783863 140 char getc();
samux 1:fb4494783863 141
WiredHome 15:121f473dae3f 142 /**
samux 1:fb4494783863 143 * Flush the buffer
samux 1:fb4494783863 144 */
samux 1:fb4494783863 145 void flush();
samux 1:fb4494783863 146
WiredHome 15:121f473dae3f 147 /**
samux 1:fb4494783863 148 * Write a character
samux 1:fb4494783863 149 *
samux 1:fb4494783863 150 * @param the character which will be written
samux 1:fb4494783863 151 */
samux 1:fb4494783863 152 int putc(char c);
samux 1:fb4494783863 153
samux 1:fb4494783863 154
WiredHome 15:121f473dae3f 155 /**
samux 1:fb4494783863 156 * To enter in command mode (we can configure the module)
samux 1:fb4494783863 157 *
samux 1:fb4494783863 158 * @return true if successful, false otherwise
samux 1:fb4494783863 159 */
samux 1:fb4494783863 160 bool cmdMode();
samux 1:fb4494783863 161
WiredHome 15:121f473dae3f 162 /**
samux 1:fb4494783863 163 * To exit the command mode
samux 1:fb4494783863 164 *
samux 1:fb4494783863 165 * @return true if successful, false otherwise
samux 1:fb4494783863 166 */
samux 1:fb4494783863 167 bool exit();
samux 1:fb4494783863 168
WiredHome 15:121f473dae3f 169 /**
samux 1:fb4494783863 170 * Close a tcp connection
samux 1:fb4494783863 171 *
samux 1:fb4494783863 172 * @ returns true if successful
samux 1:fb4494783863 173 */
samux 1:fb4494783863 174 bool close();
samux 1:fb4494783863 175
WiredHome 15:121f473dae3f 176 /**
samux 1:fb4494783863 177 * 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 178 * Useful to send a command to the module and wait a response.
samux 1:fb4494783863 179 *
samux 1:fb4494783863 180 *
samux 1:fb4494783863 181 * @param str string to be sent
samux 1:fb4494783863 182 * @param len string length
samux 1:fb4494783863 183 * @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 184 * @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 15:121f473dae3f 185 * @param timeout is the time in msec to wait for the acknowledge
samux 1:fb4494783863 186 *
samux 1:fb4494783863 187 * @return true if ACK has been found in the response from the wifi module. False otherwise or if there is no response in 5s.
samux 1:fb4494783863 188 */
samux 1:fb4494783863 189 int send(const char * str, int len, const char * ACK = NULL, char * res = NULL, int timeout = DEFAULT_WAIT_RESP_TIMEOUT);
samux 1:fb4494783863 190
WiredHome 15:121f473dae3f 191 /**
samux 1:fb4494783863 192 * Send a command to the wify module. Check if the module is in command mode. If not enter in command mode
samux 1:fb4494783863 193 *
samux 1:fb4494783863 194 * @param str string to be sent
samux 1:fb4494783863 195 * @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 196 * @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 15:121f473dae3f 197 * @param timeout is the time in msec to wait for the acknowledge
samux 1:fb4494783863 198 *
samux 1:fb4494783863 199 * @returns true if successful
samux 1:fb4494783863 200 */
samux 1:fb4494783863 201 bool sendCommand(const char * cmd, const char * ack = NULL, char * res = NULL, int timeout = DEFAULT_WAIT_RESP_TIMEOUT);
samux 4:0bcec6272784 202
WiredHome 15:121f473dae3f 203 /**
samux 4:0bcec6272784 204 * Return true if the module is using dhcp
samux 4:0bcec6272784 205 *
samux 4:0bcec6272784 206 * @returns true if the module is using dhcp
samux 4:0bcec6272784 207 */
samux 4:0bcec6272784 208 bool isDHCP() {
samux 4:0bcec6272784 209 return state.dhcp;
samux 4:0bcec6272784 210 }
samux 1:fb4494783863 211
WiredHome 15:121f473dae3f 212 /**
WiredHome 15:121f473dae3f 213 * gets the host ip address
WiredHome 15:121f473dae3f 214 *
WiredHome 15:121f473dae3f 215 * @param host is a pointer to the host string to look up
WiredHome 15:121f473dae3f 216 * @param ip contains the host IP in a string after the lookup.
WiredHome 15:121f473dae3f 217 * @param sizeof_ip is the size of the buffer pointed to by ip
WiredHome 15:121f473dae3f 218 * @returns true if successful
WiredHome 15:121f473dae3f 219 */
samux 1:fb4494783863 220 bool gethostbyname(const char * host, char * ip);
samux 1:fb4494783863 221
WiredHome 20:906b0f951bc3 222 /**
WiredHome 20:906b0f951bc3 223 * Set the baud rate between the ARM and the WiFly.
WiredHome 20:906b0f951bc3 224 *
WiredHome 20:906b0f951bc3 225 * This will set the WiFly module baud rate first and then
WiredHome 20:906b0f951bc3 226 * set the ARM interface to match it. If it cannot get the proper
WiredHome 20:906b0f951bc3 227 * acknowledge response, it will go on a hunt through the range
WiredHome 20:906b0f951bc3 228 * of standard baud rates.
WiredHome 20:906b0f951bc3 229 *
WiredHome 20:906b0f951bc3 230 * @note Baud rate must be one of 2400, 4800, 9600, 19200, 38400, 57600,
WiredHome 20:906b0f951bc3 231 * 115200, 230400, 460800, or 921600. (See Wifly manual 2.3.64)
WiredHome 20:906b0f951bc3 232 * @note Baud rate of 230400 has been seen to be marginal w/o flow control.
WiredHome 20:906b0f951bc3 233 * @note Setting a baud rate to a 460800 or above may be unrecoverable
WiredHome 20:906b0f951bc3 234 * without resetting the Wifly module.
WiredHome 20:906b0f951bc3 235 *
WiredHome 20:906b0f951bc3 236 * @param baudrate is the desired baudrate.
WiredHome 20:906b0f951bc3 237 *
WiredHome 20:906b0f951bc3 238 * @returns true if it succeeded, which means that communications can continue,
WiredHome 20:906b0f951bc3 239 * @returns false if it failed to establish a communication link.
WiredHome 20:906b0f951bc3 240 */
WiredHome 20:906b0f951bc3 241 bool baud(int baudrate);
WiredHome 20:906b0f951bc3 242
WiredHome 25:a740eb74a86a 243
WiredHome 25:a740eb74a86a 244 /**
WiredHome 25:a740eb74a86a 245 * Sets the connection state.
WiredHome 25:a740eb74a86a 246 *
WiredHome 25:a740eb74a86a 247 * Typically used by external apps that detect an incoming connection.
WiredHome 25:a740eb74a86a 248 *
WiredHome 25:a740eb74a86a 249 * @param state sets the connection state to true or false
WiredHome 25:a740eb74a86a 250 */
WiredHome 25:a740eb74a86a 251 void setConnectionState(bool state);
WiredHome 25:a740eb74a86a 252
WiredHome 26:78a1a09afdc9 253
WiredHome 25:a740eb74a86a 254 /**
WiredHome 25:a740eb74a86a 255 * Get the version information from the Wifly module.
WiredHome 25:a740eb74a86a 256 *
WiredHome 25:a740eb74a86a 257 * @returns the version information as a string, or NULL
WiredHome 25:a740eb74a86a 258 */
WiredHome 25:a740eb74a86a 259 char * getWiflyVersionString();
WiredHome 25:a740eb74a86a 260
WiredHome 26:78a1a09afdc9 261
WiredHome 25:a740eb74a86a 262 /**
WiredHome 25:a740eb74a86a 263 * Get the software version from the Wifly module.
WiredHome 25:a740eb74a86a 264 *
WiredHome 25:a740eb74a86a 265 * This extracts the basic version number (e.g. 2.38, 4.00)
WiredHome 25:a740eb74a86a 266 * as a float.
WiredHome 25:a740eb74a86a 267 *
WiredHome 25:a740eb74a86a 268 * @returns the software version number as a float.
WiredHome 25:a740eb74a86a 269 */
WiredHome 25:a740eb74a86a 270 float getWiflyVersion();
WiredHome 25:a740eb74a86a 271
WiredHome 26:78a1a09afdc9 272
WiredHome 26:78a1a09afdc9 273 /**
WiredHome 26:78a1a09afdc9 274 * determine if the module is in command mode
WiredHome 26:78a1a09afdc9 275 *
WiredHome 26:78a1a09afdc9 276 * @return true if in command mode, false otherwise
WiredHome 26:78a1a09afdc9 277 */
WiredHome 26:78a1a09afdc9 278 bool isCmdMode() {
WiredHome 26:78a1a09afdc9 279 return state.cmd_mode;
WiredHome 26:78a1a09afdc9 280 }
WiredHome 26:78a1a09afdc9 281
WiredHome 26:78a1a09afdc9 282
samux 1:fb4494783863 283 static Wifly * getInstance() {
samux 1:fb4494783863 284 return inst;
samux 1:fb4494783863 285 };
samux 1:fb4494783863 286
samux 1:fb4494783863 287 protected:
samux 1:fb4494783863 288 Serial wifi;
samux 1:fb4494783863 289 DigitalOut reset_pin;
samux 1:fb4494783863 290 DigitalIn tcp_status;
WiredHome 20:906b0f951bc3 291 int baudrate;
WiredHome 24:5012a535b1d5 292 char * phrase;
WiredHome 24:5012a535b1d5 293 char * ssid;
WiredHome 25:a740eb74a86a 294 char * wiflyVersionString;
WiredHome 25:a740eb74a86a 295 float swVersion;
samux 1:fb4494783863 296 const char * ip;
samux 1:fb4494783863 297 const char * netmask;
samux 1:fb4494783863 298 const char * gateway;
samux 1:fb4494783863 299 CircBuffer<char> buf_wifly;
samux 1:fb4494783863 300
samux 1:fb4494783863 301 static Wifly * inst;
samux 1:fb4494783863 302
samux 1:fb4494783863 303 void attach_rx(bool null);
samux 1:fb4494783863 304 void handler_rx(void);
WiredHome 18:18ab3993d00d 305 void flushIn(int timeout_ms = 0);
samux 1:fb4494783863 306
samux 1:fb4494783863 307 typedef struct STATE {
samux 1:fb4494783863 308 bool associated;
samux 1:fb4494783863 309 bool tcp;
samux 1:fb4494783863 310 bool dhcp;
samux 1:fb4494783863 311 Security sec;
samux 1:fb4494783863 312 Protocol proto;
samux 1:fb4494783863 313 bool cmd_mode;
samux 1:fb4494783863 314 } State;
samux 1:fb4494783863 315
samux 1:fb4494783863 316 State state;
samux 1:fb4494783863 317 char * getStringSecurity();
WiredHome 20:906b0f951bc3 318
WiredHome 20:906b0f951bc3 319 /**
WiredHome 21:97294686b4a1 320 * Estimates the time needed for the Wifly module to respond
WiredHome 21:97294686b4a1 321 * to some of the simple commands.
WiredHome 20:906b0f951bc3 322 *
WiredHome 20:906b0f951bc3 323 * This should only be used for simple commands, where the module should
WiredHome 20:906b0f951bc3 324 * be able to respond almost immediately.
WiredHome 20:906b0f951bc3 325 *
WiredHome 20:906b0f951bc3 326 * @param stringLen of the command to be sent, in characters.
WiredHome 20:906b0f951bc3 327 *
WiredHome 20:906b0f951bc3 328 * @returns integer number of milliseconds (always rounded up a little)
WiredHome 20:906b0f951bc3 329 */
WiredHome 20:906b0f951bc3 330 int timeToRespond(int stringLen);
WiredHome 20:906b0f951bc3 331
WiredHome 24:5012a535b1d5 332 /**
WiredHome 24:5012a535b1d5 333 * Allocate space for the parameter (ssid or passphrase)
WiredHome 24:5012a535b1d5 334 * and then fix it (change ' ' to '$').
WiredHome 24:5012a535b1d5 335 *
WiredHome 24:5012a535b1d5 336 * @param dst is a reference to the private member pointer.
WiredHome 24:5012a535b1d5 337 * @src is a pointer to a passed in string.
WiredHome 24:5012a535b1d5 338 */
WiredHome 24:5012a535b1d5 339 void FixPhrase(char ** dst, const char * src);
WiredHome 24:5012a535b1d5 340
WiredHome 25:a740eb74a86a 341 /**
WiredHome 25:a740eb74a86a 342 * Gather the Wifly module version information for later queries
WiredHome 25:a740eb74a86a 343 */
WiredHome 25:a740eb74a86a 344 void GatherLogonInfo();
WiredHome 25:a740eb74a86a 345
samux 1:fb4494783863 346 };
samux 1:fb4494783863 347
samux 1:fb4494783863 348 #endif