now this shit works

Dependencies:   BufferedSerial

Dependents:   IoTWeatherStation

Fork of ESP8266NodeMCUInterface by ESP8266

Committer:
krbng4180
Date:
Mon Mar 14 02:40:12 2016 +0000
Revision:
50:7c4a5bdcb624
Parent:
44:16da10e7b3f7
publishing;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
michaeljkoster 13:41098c907200 1 /* ESP8266Interface.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
michaeljkoster 13:41098c907200 20 #ifndef ESP8266INTERFACE_H_
michaeljkoster 13:41098c907200 21 #define ESP8266INTERFACE_H_
mbed_official 0:302ec35139ec 22
michaeljkoster 13:41098c907200 23 #include "ESP8266.h"
michaeljkoster 16:3f0efaa57a12 24 #include "Endpoint.h"
samux 1:fb4494783863 25
screamer 6:5176e0864078 26 /**
michaeljkoster 13:41098c907200 27 * Interface using ESP8266 to connect to an IP-based network
samux 1:fb4494783863 28 */
michaeljkoster 13:41098c907200 29 class ESP8266Interface: public ESP8266 {
samux 1:fb4494783863 30 public:
samux 1:fb4494783863 31
samux 1:fb4494783863 32 /**
samux 1:fb4494783863 33 * Constructor
samux 1:fb4494783863 34 *
geky 44:16da10e7b3f7 35 * @param tx mbed pin to use for tx line of Serial interface
geky 44:16da10e7b3f7 36 * @param rx mbed pin to use for rx line of Serial interface
geky 44:16da10e7b3f7 37 * @param reset reset pin of the wifi module ()
geky 44:16da10e7b3f7 38 * @param baud the baudrate of the serial connection
geky 44:16da10e7b3f7 39 * @param timeout the timeout of the serial connection
samux 1:fb4494783863 40 */
geky 44:16da10e7b3f7 41 ESP8266Interface(PinName tx, PinName rx, PinName reset, int baud = 9600, int timeout = 3000);
geky 44:16da10e7b3f7 42
geky 44:16da10e7b3f7 43 /**
geky 44:16da10e7b3f7 44 * Initialize the wifi hardware
geky 44:16da10e7b3f7 45 *
geky 44:16da10e7b3f7 46 * @return true if successful
geky 44:16da10e7b3f7 47 */
geky 44:16da10e7b3f7 48 bool init();
samux 1:fb4494783863 49
geky 44:16da10e7b3f7 50 /**
geky 44:16da10e7b3f7 51 * Connect the wifi module to the specified ssid.
geky 44:16da10e7b3f7 52 *
geky 44:16da10e7b3f7 53 * @param ssid ssid of the network
geky 44:16da10e7b3f7 54 * @param phrase WEP, WPA or WPA2 key
geky 44:16da10e7b3f7 55 * @return true if successful
geky 44:16da10e7b3f7 56 */
geky 44:16da10e7b3f7 57 bool connect(const char *ssid, const char *phrase);
samux 1:fb4494783863 58
geky 44:16da10e7b3f7 59 /**
geky 44:16da10e7b3f7 60 * Disconnect the ESP8266 module from the access point
geky 44:16da10e7b3f7 61 *
geky 44:16da10e7b3f7 62 * @return true if successful
geky 44:16da10e7b3f7 63 */
geky 44:16da10e7b3f7 64 int disconnect();
samux 1:fb4494783863 65
geky 44:16da10e7b3f7 66 /** Get IP address
geky 44:16da10e7b3f7 67 *
geky 44:16da10e7b3f7 68 * @return Either a pointer to the internally stored IP address or null if not connected
geky 44:16da10e7b3f7 69 */
geky 44:16da10e7b3f7 70 const char *getIPAddress();
samux 1:fb4494783863 71 };
samux 1:fb4494783863 72
samux 1:fb4494783863 73 #include "UDPSocket.h"
samux 1:fb4494783863 74
michaeljkoster 13:41098c907200 75 #endif /* ESP8266INTERFACE_H_ */