This is library for using WizFi250

Dependents:   WebSocket_WizFi250_HelloWorld IFTTT_WizFi250 AxedaGo-WizFi250 FANARM_AP_udp_server ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers WizFi250Interface.cpp Source File

WizFi250Interface.cpp

00001 /*
00002  * Copyright (C) 2013 gsfan, 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 /* Copyright (C) 2014 Wiznet, MIT License
00020  *  port to the Wiznet Module WizFi250
00021  */
00022 
00023 
00024 #include "WizFi250Interface.h"
00025 
00026 WizFi250Interface::WizFi250Interface(PinName tx, PinName rx, PinName cts, PinName rts, PinName reset, PinName alarm, int baud):
00027     WizFi250(tx, rx, cts, rts, reset, alarm, baud)
00028 {
00029 
00030 }
00031 
00032 int WizFi250Interface::init(const char *name)
00033 {
00034     return setAddress(name);
00035 }
00036 
00037 int WizFi250Interface::init(const char* ip, const char* netmask, const char* gateway, const char* name)
00038 {
00039     return setAddress(ip, netmask, gateway, name);
00040 }
00041 
00042 int WizFi250Interface::connect(Security sec, const char* ssid, const char* phrase, WiFiMode mode)
00043 {
00044     setSsid(ssid);
00045     setSec(sec, phrase);
00046 
00047     switch (mode)
00048     {
00049     case WM_STATION:
00050         return join(WizFi250::WM_STATION);
00051     case WM_AP:
00052         return join(WizFi250::WM_AP);
00053     }
00054 
00055     return 0;
00056 }
00057 
00058 int WizFi250Interface::disconnect()
00059 {
00060     // kaizen 20141114 It have to modify
00061     return 0;
00062 }
00063 
00064 char* WizFi250Interface::getMACAddress()
00065 {
00066     return _state.mac;
00067 }
00068 
00069 char* WizFi250Interface::getIPAddress()
00070 {
00071     return _state.ip;
00072 }
00073 
00074 char* WizFi250Interface::getGateway()
00075 {
00076     return _state.gateway;
00077 }
00078 
00079 int WizFi250Interface::setAntMode(AntennaMode mode)
00080 {
00081     return cmdWANT(mode);
00082 }
00083 
00084 //char* getNetworkMask();