Simple IoT Board用のライブラリです。 ESP8266ライブラリの軽量化 送信のみのソフトシリアルライブラリを含んでいます。

Dependents:   SITB_HttpGetSample SITB_IFTTTSample SITB_INA226PRC AmbientExampleSITB ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ESP8266Interface.h Source File

ESP8266Interface.h

00001 /* ESP8266Interface.h */
00002 /* Copyright (C) 2012 mbed.org, MIT License
00003  *
00004  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
00005  * and associated documentation files (the "Software"), to deal in the Software without restriction,
00006  * including without limitation the rights to use, copy, modify, merge, publish, distribute,
00007  * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
00008  * furnished to do so, subject to the following conditions:
00009  *
00010  * The above copyright notice and this permission notice shall be included in all copies or
00011  * substantial portions of the Software.
00012  *
00013  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
00014  * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00015  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
00016  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00017  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00018  */
00019  
00020 #ifndef ESP8266INTERFACE_H_
00021 #define ESP8266INTERFACE_H_
00022 
00023 #include "ESP8266.h"
00024 #include "Endpoint.h"
00025 
00026  /**
00027  * Interface using ESP8266 to connect to an IP-based network
00028  */
00029 class ESP8266Interface: public ESP8266 {
00030 public:
00031 
00032     /**
00033     * Constructor
00034     *
00035     * \param tx mbed pin to use for tx line of Serial interface
00036     * \param rx mbed pin to use for rx line of Serial interface
00037     * \param reset reset pin of the wifi module ()
00038     * \param ssid ssid of the network
00039     * \param phrase WEP or WPA key
00040     * \param baud the baudrate of the serial connection (defaults to 115200, diff revs of the firmware use diff baud rates
00041     */
00042   ESP8266Interface(PinName tx, PinName rx, PinName reset, const char * ssid, const char * phrase, uint32_t baud = 115200 );
00043 
00044   /** Initialize the interface with DHCP.
00045   * Initialize the interface and configure it to use DHCP (no connection at this point).
00046   * \return 0 on success, a negative number on failure
00047   */
00048   int init(); //With DHCP
00049 
00050   /** Connect
00051   * Bring the interface up, start DHCP if needed.
00052   * \return 0 on success, a negative number on failure
00053   */
00054   bool connect();
00055   
00056   /** Disconnect
00057   * Bring the interface down
00058   * \return 0 on success, a negative number on failure
00059   */
00060   int disconnect();
00061   
00062   /** Get IP address
00063   *
00064   * \return ip address
00065   */
00066   char* getIPAddress();
00067   
00068 private:
00069 };
00070 
00071 #include "UDPSocket.h"
00072 
00073 #endif /* ESP8266INTERFACE_H_ */