no upgrade or change at this. move to new Library for WIZ550io, W5500 -> http://mbed.org/teams/EthernetInterfaceW5500-makers/code/W5500Interface/

Dependents:   LPC11U68_NTPClient_HelloWorld_WIZ550io

Fork of WIZ550ioInterface by ban4jp -

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers WIZ550ioInterface.h Source File

WIZ550ioInterface.h

00001 // WIZ550ioInterface.h 2013/4/10
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 #pragma once
00021 
00022 #include "WIZ820io.h"
00023 
00024  /** Interface using WIZ820io to connect to an IP-based network
00025  *
00026  */
00027 class WIZ550ioInterface: public WIZ820io {
00028 public:
00029 
00030     /**
00031     * Constructor
00032     *
00033     * \param mosi mbed pin to use for SPI
00034     * \param miso mbed pin to use for SPI
00035     * \param sclk mbed pin to use for SPI
00036     * \param cs
00037     * \param reset reset pin of the WIZ820io module
00038     */
00039   WIZ550ioInterface(PinName mosi, PinName miso, PinName sclk, PinName cs, PinName reset);
00040   WIZ550ioInterface(SPI* spi, PinName cs, PinName reset);
00041 
00042   /** Initialize the interface with DHCP.
00043   * Initialize the interface and configure it to use DHCP (no connection at this point).
00044   * \return 0 on success, a negative number on failure
00045   */
00046   int init(); //With DHCP
00047 
00048   /** Initialize the interface with a static IP address.
00049   * Initialize the interface and configure it with the following static configuration (no connection at this point).
00050   * \param ip the IP address to use
00051   * \param mask the IP address mask
00052   * \param gateway the gateway to use
00053   * \return 0 on success, a negative number on failure
00054   */
00055   int init(const char* ip, const char* mask, const char* gateway);
00056 
00057   /** Initialize the interface with a static IP address with 32bit interger.
00058   * Initialize the interface and configure it with the following static configuration (no connection at this point).
00059   * \param ip the IP address to use
00060   * \param mask the IP address mask
00061   * \param gateway the gateway to use
00062   * \return 0 on success, a negative number on failure
00063   */
00064   int init(uint32_t ip, uint32_t mask, uint32_t gateway);
00065 
00066   /** Connect
00067   * Bring the interface up, start DHCP if needed.
00068   * \return 0 on success, a negative number on failure
00069   */
00070   int connect();
00071   
00072   /** Disconnect
00073   * Bring the interface down
00074   * \return 0 on success, a negative number on failure
00075   */
00076   int disconnect();
00077   
00078   /** Get IP address
00079   *
00080   * @ returns ip address
00081   */
00082   char* getIPAddress();
00083   char* getNetworkMask();
00084   char* getGateway();
00085   char* getMACAddress();
00086 
00087   int IPrenew(int timeout_ms = 15*1000);
00088     
00089 private:
00090     char ip_string[20];
00091     char mask_string[20];
00092     char gw_string[20];
00093     char mac_string[20];
00094     bool ip_set;
00095 };
00096 
00097 #include "TCPSocketConnection.h"
00098 #include "TCPSocketServer.h"
00099 #include "UDPSocket.h"