Forked mbed official WiflyInterface (interface for Roving Networks Wifly modules) which includes the possibility to use TCPSocketServer::accept as a non-blocking cal.

Dependents:   WiFlyHTTPServerSample MultiThreadingHTTPServer

Fork of WiflyInterface by mbed official

Committer:
leihen
Date:
Wed Jun 05 23:40:17 2013 +0000
Revision:
9:4f6f2f35a21a
Parent:
5:48d55083d2ff
Improved 'Accept' handling.
; Added 'peek' functionality for CBuffer

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 0:302ec35139ec 1 /* WiflyInterface.h */
mbed_official 0:302ec35139ec 2 /* Copyright (C) 2012 mbed.org, MIT License
mbed_official 0:302ec35139ec 3 *
mbed_official 0:302ec35139ec 4 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
mbed_official 0:302ec35139ec 5 * and associated documentation files (the "Software"), to deal in the Software without restriction,
mbed_official 0:302ec35139ec 6 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
mbed_official 0:302ec35139ec 7 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
mbed_official 0:302ec35139ec 8 * furnished to do so, subject to the following conditions:
mbed_official 0:302ec35139ec 9 *
mbed_official 0:302ec35139ec 10 * The above copyright notice and this permission notice shall be included in all copies or
mbed_official 0:302ec35139ec 11 * substantial portions of the Software.
mbed_official 0:302ec35139ec 12 *
mbed_official 0:302ec35139ec 13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
mbed_official 0:302ec35139ec 14 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
mbed_official 0:302ec35139ec 15 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
mbed_official 0:302ec35139ec 16 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
mbed_official 0:302ec35139ec 17 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
mbed_official 0:302ec35139ec 18 */
mbed_official 0:302ec35139ec 19
mbed_official 0:302ec35139ec 20 #ifndef WIFLYINTERFACE_H_
mbed_official 0:302ec35139ec 21 #define WIFLYINTERFACE_H_
mbed_official 0:302ec35139ec 22
samux 1:fb4494783863 23 #include "Wifly.h"
leihen 5:48d55083d2ff 24 #include <string>
samux 1:fb4494783863 25
samux 1:fb4494783863 26 /** Interface using Wifly to connect to an IP-based network
samux 1:fb4494783863 27 *
samux 1:fb4494783863 28 */
samux 1:fb4494783863 29 class WiflyInterface: public Wifly {
samux 1:fb4494783863 30 public:
samux 1:fb4494783863 31
samux 1:fb4494783863 32 /**
samux 1:fb4494783863 33 * Constructor
samux 1:fb4494783863 34 *
samux 1:fb4494783863 35 * \param tx mbed pin to use for tx line of Serial interface
samux 1:fb4494783863 36 * \param rx mbed pin to use for rx line of Serial interface
samux 1:fb4494783863 37 * \param reset reset pin of the wifi module ()
samux 1:fb4494783863 38 * \param tcp_status connection status pin of the wifi module (GPIO 6)
samux 1:fb4494783863 39 * \param ssid ssid of the network
samux 1:fb4494783863 40 * \param phrase WEP or WPA key
samux 1:fb4494783863 41 * \param sec Security type (NONE, WEP_128 or WPA)
samux 1:fb4494783863 42 */
samux 1:fb4494783863 43 WiflyInterface(PinName tx, PinName rx, PinName reset, PinName tcp_status, const char * ssid, const char * phrase, Security sec = NONE);
samux 1:fb4494783863 44
samux 1:fb4494783863 45 /** Initialize the interface with DHCP.
samux 1:fb4494783863 46 * Initialize the interface and configure it to use DHCP (no connection at this point).
samux 1:fb4494783863 47 * \return 0 on success, a negative number on failure
samux 1:fb4494783863 48 */
samux 1:fb4494783863 49 int init(); //With DHCP
samux 1:fb4494783863 50
samux 1:fb4494783863 51 /** Initialize the interface with a static IP address.
samux 1:fb4494783863 52 * Initialize the interface and configure it with the following static configuration (no connection at this point).
samux 1:fb4494783863 53 * \param ip the IP address to use
samux 1:fb4494783863 54 * \param mask the IP address mask
samux 1:fb4494783863 55 * \param gateway the gateway to use
samux 1:fb4494783863 56 * \return 0 on success, a negative number on failure
samux 1:fb4494783863 57 */
samux 1:fb4494783863 58 int init(const char* ip, const char* mask, const char* gateway);
samux 1:fb4494783863 59
samux 1:fb4494783863 60 /** Connect
samux 1:fb4494783863 61 * Bring the interface up, start DHCP if needed.
samux 1:fb4494783863 62 * \return 0 on success, a negative number on failure
samux 1:fb4494783863 63 */
samux 1:fb4494783863 64 int connect();
samux 1:fb4494783863 65
samux 1:fb4494783863 66 /** Disconnect
samux 1:fb4494783863 67 * Bring the interface down
samux 1:fb4494783863 68 * \return 0 on success, a negative number on failure
samux 1:fb4494783863 69 */
samux 1:fb4494783863 70 int disconnect();
samux 1:fb4494783863 71
samux 1:fb4494783863 72 /** Get IP address
samux 1:fb4494783863 73 *
samux 1:fb4494783863 74 * @ returns ip address
samux 1:fb4494783863 75 */
samux 1:fb4494783863 76 char* getIPAddress();
samux 1:fb4494783863 77
samux 1:fb4494783863 78 private:
samux 1:fb4494783863 79 char ip_string[20];
samux 1:fb4494783863 80 bool ip_set;
samux 1:fb4494783863 81 };
samux 1:fb4494783863 82
samux 1:fb4494783863 83 #include "TCPSocketConnection.h"
samux 1:fb4494783863 84 #include "TCPSocketServer.h"
samux 1:fb4494783863 85 #include "UDPSocket.h"
samux 1:fb4494783863 86
samux 1:fb4494783863 87 #endif /* WIFLYINTERFACE_H_ */