This is library for using WizFi250
Dependents: WebSocket_WizFi250_HelloWorld IFTTT_WizFi250 AxedaGo-WizFi250 FANARM_AP_udp_server ... more
WizFi250Interface.cpp@13:0b8e51d3c0e8, 2015-06-26 (annotated)
- Committer:
- kaizen
- Date:
- Fri Jun 26 04:19:01 2015 +0000
- Revision:
- 13:0b8e51d3c0e8
- Parent:
- 8:431172d536ee
- Child:
- 14:1f5121c5efcd
Remove debug member variable for WizFi250.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kaizen | 0:f2039204c8f6 | 1 | /* |
DongEun Koak | 4:085e7efeae47 | 2 | * Copyright (C) 2013 gsfan, MIT License |
kaizen | 0:f2039204c8f6 | 3 | * |
kaizen | 0:f2039204c8f6 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
kaizen | 0:f2039204c8f6 | 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
kaizen | 0:f2039204c8f6 | 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
kaizen | 0:f2039204c8f6 | 7 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
kaizen | 0:f2039204c8f6 | 8 | * furnished to do so, subject to the following conditions: |
kaizen | 0:f2039204c8f6 | 9 | * |
kaizen | 0:f2039204c8f6 | 10 | * The above copyright notice and this permission notice shall be included in all copies or |
kaizen | 0:f2039204c8f6 | 11 | * substantial portions of the Software. |
kaizen | 0:f2039204c8f6 | 12 | * |
kaizen | 0:f2039204c8f6 | 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
kaizen | 0:f2039204c8f6 | 14 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
kaizen | 0:f2039204c8f6 | 15 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
kaizen | 0:f2039204c8f6 | 16 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
kaizen | 0:f2039204c8f6 | 17 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
kaizen | 0:f2039204c8f6 | 18 | */ |
kaizen | 0:f2039204c8f6 | 19 | /* Copyright (C) 2014 Wiznet, MIT License |
kaizen | 0:f2039204c8f6 | 20 | * port to the Wiznet Module WizFi250 |
kaizen | 0:f2039204c8f6 | 21 | */ |
kaizen | 0:f2039204c8f6 | 22 | |
kaizen | 0:f2039204c8f6 | 23 | |
kaizen | 0:f2039204c8f6 | 24 | #include "WizFi250Interface.h" |
kaizen | 0:f2039204c8f6 | 25 | |
kaizen | 13:0b8e51d3c0e8 | 26 | WizFi250Interface::WizFi250Interface(PinName tx, PinName rx, PinName cts, PinName rts, PinName reset, PinName alarm, int baud): |
kaizen | 13:0b8e51d3c0e8 | 27 | WizFi250(tx, rx, cts, rts, reset, alarm, baud) |
kaizen | 0:f2039204c8f6 | 28 | { |
kaizen | 0:f2039204c8f6 | 29 | |
kaizen | 0:f2039204c8f6 | 30 | } |
kaizen | 0:f2039204c8f6 | 31 | |
kaizen | 0:f2039204c8f6 | 32 | int WizFi250Interface::init(const char *name) |
kaizen | 0:f2039204c8f6 | 33 | { |
kaizen | 0:f2039204c8f6 | 34 | return setAddress(name); |
kaizen | 0:f2039204c8f6 | 35 | } |
kaizen | 0:f2039204c8f6 | 36 | |
kaizen | 0:f2039204c8f6 | 37 | int WizFi250Interface::init(const char* ip, const char* netmask, const char* gateway, const char* name) |
kaizen | 0:f2039204c8f6 | 38 | { |
kaizen | 0:f2039204c8f6 | 39 | return setAddress(ip, netmask, gateway, name); |
kaizen | 0:f2039204c8f6 | 40 | } |
kaizen | 0:f2039204c8f6 | 41 | |
kaizen | 0:f2039204c8f6 | 42 | int WizFi250Interface::connect(Security sec, const char* ssid, const char* phrase, WiFiMode mode) |
kaizen | 0:f2039204c8f6 | 43 | { |
kaizen | 0:f2039204c8f6 | 44 | setSsid(ssid); |
kaizen | 0:f2039204c8f6 | 45 | setSec(sec, phrase); |
kaizen | 0:f2039204c8f6 | 46 | |
kaizen | 0:f2039204c8f6 | 47 | switch (mode) |
kaizen | 0:f2039204c8f6 | 48 | { |
kaizen | 0:f2039204c8f6 | 49 | case WM_STATION: |
kaizen | 0:f2039204c8f6 | 50 | return join(); |
kaizen | 0:f2039204c8f6 | 51 | case WM_AP: |
kaizen | 0:f2039204c8f6 | 52 | return 0; |
kaizen | 0:f2039204c8f6 | 53 | } |
DongEun Koak | 7:ba28fe711055 | 54 | |
DongEun Koak | 7:ba28fe711055 | 55 | return 0; |
kaizen | 0:f2039204c8f6 | 56 | } |
kaizen | 0:f2039204c8f6 | 57 | |
kaizen | 0:f2039204c8f6 | 58 | int WizFi250Interface::disconnect() |
kaizen | 0:f2039204c8f6 | 59 | { |
DongEun Koak | 8:431172d536ee | 60 | // kaizen 20141114 It have to modify |
DongEun Koak | 8:431172d536ee | 61 | return 0; |
kaizen | 0:f2039204c8f6 | 62 | } |
kaizen | 0:f2039204c8f6 | 63 | |
kaizen | 0:f2039204c8f6 | 64 | char* WizFi250Interface::getMACAddress() |
kaizen | 0:f2039204c8f6 | 65 | { |
kaizen | 0:f2039204c8f6 | 66 | return _state.mac; |
kaizen | 0:f2039204c8f6 | 67 | } |
kaizen | 0:f2039204c8f6 | 68 | |
kaizen | 0:f2039204c8f6 | 69 | char* WizFi250Interface::getIPAddress() |
kaizen | 0:f2039204c8f6 | 70 | { |
kaizen | 0:f2039204c8f6 | 71 | return _state.ip; |
kaizen | 0:f2039204c8f6 | 72 | } |
kaizen | 0:f2039204c8f6 | 73 | |
kaizen | 0:f2039204c8f6 | 74 | char* WizFi250Interface::getGateway() |
kaizen | 0:f2039204c8f6 | 75 | { |
kaizen | 0:f2039204c8f6 | 76 | return _state.gateway; |
kaizen | 0:f2039204c8f6 | 77 | } |
kaizen | 0:f2039204c8f6 | 78 | |
kaizen | 0:f2039204c8f6 | 79 | //char* getNetworkMask(); |