PIR sensor
Fork of WizFi310Interface_Legacy_newv2 by
WizFi310/WizFi310.h@2:3194ebe06182, 2017-09-18 (annotated)
- Committer:
- ajeet3004
- Date:
- Mon Sep 18 08:11:28 2017 +0000
- Revision:
- 2:3194ebe06182
- Parent:
- 0:774ff1e8b26b
bgh
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kaizen | 0:774ff1e8b26b | 1 | /* |
kaizen | 0:774ff1e8b26b | 2 | * Copyright (C) 2013 gsfan, MIT License |
kaizen | 0:774ff1e8b26b | 3 | * |
kaizen | 0:774ff1e8b26b | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy of this software |
kaizen | 0:774ff1e8b26b | 5 | * and associated documentation files (the "Software"), to deal in the Software without restriction, |
kaizen | 0:774ff1e8b26b | 6 | * including without limitation the rights to use, copy, modify, merge, publish, distribute, |
kaizen | 0:774ff1e8b26b | 7 | * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is |
kaizen | 0:774ff1e8b26b | 8 | * furnished to do so, subject to the following conditions: |
kaizen | 0:774ff1e8b26b | 9 | * |
kaizen | 0:774ff1e8b26b | 10 | * The above copyright notice and this permission notice shall be included in all copies or |
kaizen | 0:774ff1e8b26b | 11 | * substantial portions of the Software. |
kaizen | 0:774ff1e8b26b | 12 | * |
kaizen | 0:774ff1e8b26b | 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING |
kaizen | 0:774ff1e8b26b | 14 | * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
kaizen | 0:774ff1e8b26b | 15 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
kaizen | 0:774ff1e8b26b | 16 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
kaizen | 0:774ff1e8b26b | 17 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
kaizen | 0:774ff1e8b26b | 18 | */ |
kaizen | 0:774ff1e8b26b | 19 | /* Copyright (C) 2014 Wiznet, MIT License |
kaizen | 0:774ff1e8b26b | 20 | * port to the Wiznet Module WizFi250 |
kaizen | 0:774ff1e8b26b | 21 | */ |
kaizen | 0:774ff1e8b26b | 22 | /* Copyright (C) 2017 Wiznet, MIT License |
kaizen | 0:774ff1e8b26b | 23 | * port to the Wiznet Module WizFi310 |
kaizen | 0:774ff1e8b26b | 24 | */ |
kaizen | 0:774ff1e8b26b | 25 | |
kaizen | 0:774ff1e8b26b | 26 | #ifndef WIZFI310_H_ |
kaizen | 0:774ff1e8b26b | 27 | #define WIZFI310_H_ |
kaizen | 0:774ff1e8b26b | 28 | |
kaizen | 0:774ff1e8b26b | 29 | #include "WizFi310_conf.h" |
kaizen | 0:774ff1e8b26b | 30 | |
kaizen | 0:774ff1e8b26b | 31 | #include "mbed.h" |
kaizen | 0:774ff1e8b26b | 32 | #include "RawSerial.h" |
kaizen | 0:774ff1e8b26b | 33 | #include "Serial.h" |
kaizen | 0:774ff1e8b26b | 34 | #include "CBuffer.h" |
kaizen | 0:774ff1e8b26b | 35 | #include <ctype.h> |
kaizen | 0:774ff1e8b26b | 36 | #include <stdlib.h> |
kaizen | 0:774ff1e8b26b | 37 | #include <string> |
kaizen | 0:774ff1e8b26b | 38 | |
kaizen | 0:774ff1e8b26b | 39 | using namespace std; |
kaizen | 0:774ff1e8b26b | 40 | |
kaizen | 0:774ff1e8b26b | 41 | #define BUF_SIZE 1600 |
kaizen | 0:774ff1e8b26b | 42 | |
kaizen | 0:774ff1e8b26b | 43 | //Debug is disabled by default |
kaizen | 0:774ff1e8b26b | 44 | #if 1 |
kaizen | 0:774ff1e8b26b | 45 | #define WIZ_DBG(x, ...) std::printf("[WizFi310: DBG]" x "\r\n", ##__VA_ARGS__); |
kaizen | 0:774ff1e8b26b | 46 | #define WIZ_WARN(x, ...) std::printf("[WizFi310: WARN]" x "\r\n", ##__VA_ARGS__); |
kaizen | 0:774ff1e8b26b | 47 | #define WIZ_ERR(x, ...) std::printf("[WizFi310: ERR]" x "\r\n", ##__VA_ARGS__); |
kaizen | 0:774ff1e8b26b | 48 | #define WIZ_INFO(x, ...) std::printf("[WizFi310: INFO]" x "\r\n", ##__VA_ARGS__); |
kaizen | 0:774ff1e8b26b | 49 | #else |
kaizen | 0:774ff1e8b26b | 50 | #define WIZ_DBG(x, ...) |
kaizen | 0:774ff1e8b26b | 51 | #define WIZ_WARN(x, ...) |
kaizen | 0:774ff1e8b26b | 52 | #define WIZ_ERR(x, ...) |
kaizen | 0:774ff1e8b26b | 53 | #define WIZ_INFO(x, ...) |
kaizen | 0:774ff1e8b26b | 54 | #endif |
kaizen | 0:774ff1e8b26b | 55 | |
kaizen | 0:774ff1e8b26b | 56 | |
kaizen | 0:774ff1e8b26b | 57 | class WizFi310 |
kaizen | 0:774ff1e8b26b | 58 | { |
kaizen | 0:774ff1e8b26b | 59 | public: |
kaizen | 0:774ff1e8b26b | 60 | |
kaizen | 0:774ff1e8b26b | 61 | enum AntennaMode{ |
kaizen | 0:774ff1e8b26b | 62 | PCB = 0, |
kaizen | 0:774ff1e8b26b | 63 | UFL = 1, |
kaizen | 0:774ff1e8b26b | 64 | AUTO = 3, |
kaizen | 0:774ff1e8b26b | 65 | }; |
kaizen | 0:774ff1e8b26b | 66 | |
kaizen | 0:774ff1e8b26b | 67 | enum WiFiMode { |
kaizen | 0:774ff1e8b26b | 68 | WM_STATION = 0, |
kaizen | 0:774ff1e8b26b | 69 | WM_AP = 1, |
kaizen | 0:774ff1e8b26b | 70 | }; |
kaizen | 0:774ff1e8b26b | 71 | |
kaizen | 0:774ff1e8b26b | 72 | /** Wi-Fi security |
kaizen | 0:774ff1e8b26b | 73 | */ |
kaizen | 0:774ff1e8b26b | 74 | enum Security { |
kaizen | 0:774ff1e8b26b | 75 | // kaizen need to change |
kaizen | 0:774ff1e8b26b | 76 | SEC_AUTO = 0, |
kaizen | 0:774ff1e8b26b | 77 | SEC_OPEN = 1, |
kaizen | 0:774ff1e8b26b | 78 | SEC_WEP = 2, |
kaizen | 0:774ff1e8b26b | 79 | SEC_WPA_TKIP = 3, |
kaizen | 0:774ff1e8b26b | 80 | SEC_WPA_AES = 4, |
kaizen | 0:774ff1e8b26b | 81 | SEC_WPA2_AES = 5, |
kaizen | 0:774ff1e8b26b | 82 | SEC_WPA2_TKIP = 6, |
kaizen | 0:774ff1e8b26b | 83 | SEC_WPA2_MIXED = 7, |
kaizen | 0:774ff1e8b26b | 84 | }; |
kaizen | 0:774ff1e8b26b | 85 | |
kaizen | 0:774ff1e8b26b | 86 | /** TCP/IP protocol |
kaizen | 0:774ff1e8b26b | 87 | */ |
kaizen | 0:774ff1e8b26b | 88 | enum Protocol { |
kaizen | 0:774ff1e8b26b | 89 | PROTO_UDP = 0, |
kaizen | 0:774ff1e8b26b | 90 | PROTO_TCP = 1, |
kaizen | 0:774ff1e8b26b | 91 | }; |
kaizen | 0:774ff1e8b26b | 92 | |
kaizen | 0:774ff1e8b26b | 93 | /** Client/Server |
kaizen | 0:774ff1e8b26b | 94 | */ |
kaizen | 0:774ff1e8b26b | 95 | enum Type { |
kaizen | 0:774ff1e8b26b | 96 | TYPE_CLIENT = 0, |
kaizen | 0:774ff1e8b26b | 97 | TYPE_SERVER = 1, |
kaizen | 0:774ff1e8b26b | 98 | }; |
kaizen | 0:774ff1e8b26b | 99 | |
kaizen | 0:774ff1e8b26b | 100 | enum Response { |
kaizen | 0:774ff1e8b26b | 101 | RES_NULL, |
kaizen | 0:774ff1e8b26b | 102 | RES_MACADDRESS, |
kaizen | 0:774ff1e8b26b | 103 | RES_WJOIN, |
kaizen | 0:774ff1e8b26b | 104 | RES_CONNECT, |
kaizen | 0:774ff1e8b26b | 105 | RES_SSEND, |
kaizen | 0:774ff1e8b26b | 106 | RES_FDNS, |
kaizen | 0:774ff1e8b26b | 107 | RES_SMGMT, |
kaizen | 0:774ff1e8b26b | 108 | RES_WSTATUS, |
ajeet3004 | 2:3194ebe06182 | 109 | RES_SCON, |
kaizen | 0:774ff1e8b26b | 110 | |
kaizen | 0:774ff1e8b26b | 111 | }; |
kaizen | 0:774ff1e8b26b | 112 | |
kaizen | 0:774ff1e8b26b | 113 | enum Mode { |
kaizen | 0:774ff1e8b26b | 114 | MODE_COMMAND, |
kaizen | 0:774ff1e8b26b | 115 | MODE_CMDRESP, |
kaizen | 0:774ff1e8b26b | 116 | MODE_DATA_RX, |
kaizen | 0:774ff1e8b26b | 117 | MODE_DATA_RXUDP, |
kaizen | 0:774ff1e8b26b | 118 | MODE_DATA_RXUDP_BULK, |
kaizen | 0:774ff1e8b26b | 119 | }; |
kaizen | 0:774ff1e8b26b | 120 | |
kaizen | 0:774ff1e8b26b | 121 | enum Status { |
kaizen | 0:774ff1e8b26b | 122 | STAT_NONE, |
kaizen | 0:774ff1e8b26b | 123 | STAT_READY, |
kaizen | 0:774ff1e8b26b | 124 | STAT_STANDBY, |
kaizen | 0:774ff1e8b26b | 125 | STAT_WAKEUP, |
kaizen | 0:774ff1e8b26b | 126 | STAT_DEEPSLEEP, |
kaizen | 0:774ff1e8b26b | 127 | }; |
kaizen | 0:774ff1e8b26b | 128 | |
kaizen | 0:774ff1e8b26b | 129 | |
kaizen | 0:774ff1e8b26b | 130 | WizFi310 (PinName tx, PinName rx, PinName cts, PinName rts, PinName reset, PinName alarm = NC, int baud = 115200); |
kaizen | 0:774ff1e8b26b | 131 | |
kaizen | 0:774ff1e8b26b | 132 | // --------- WizFi250_at.cpp --------- |
kaizen | 0:774ff1e8b26b | 133 | void clearFlags (); |
kaizen | 0:774ff1e8b26b | 134 | int sendCommand (const char * cmd, Response res = RES_NULL, int timeout = DEFAULT_WAIT_RESP_TIMEOUT, int opt = 1); |
kaizen | 0:774ff1e8b26b | 135 | |
kaizen | 0:774ff1e8b26b | 136 | int cmdAT (); |
kaizen | 0:774ff1e8b26b | 137 | int cmdMECHO (bool flg); |
kaizen | 0:774ff1e8b26b | 138 | int cmdUSET (int baud, char *flow); |
kaizen | 0:774ff1e8b26b | 139 | int cmdMMAC (const char *mac = NULL); |
kaizen | 0:774ff1e8b26b | 140 | int cmdWSET (WiFiMode mode, const char *ssid, const char *bssid = NULL, int channel = 1); |
kaizen | 0:774ff1e8b26b | 141 | int cmdWANT (AntennaMode mode); |
kaizen | 0:774ff1e8b26b | 142 | int cmdWNET (bool is_dhcp); |
kaizen | 0:774ff1e8b26b | 143 | int cmdWSEC (WiFiMode mode, const char *key, const char *sec = NULL); |
kaizen | 0:774ff1e8b26b | 144 | int cmdWJOIN (); |
kaizen | 0:774ff1e8b26b | 145 | int cmdWLEAVE (); |
kaizen | 0:774ff1e8b26b | 146 | int cmdWSTATUS (); |
ajeet3004 | 2:3194ebe06182 | 147 | int cmdSCON (); |
kaizen | 0:774ff1e8b26b | 148 | int cmdSCON ( const char *openType, const char *socketType, int localPort, const char *dataMode = "0"); |
kaizen | 0:774ff1e8b26b | 149 | int cmdSCON ( const char *openType, const char *socketType, const char *remoteIp, int remotePort, int localPort = 0, const char *dataMode = "0"); |
kaizen | 0:774ff1e8b26b | 150 | int cmdSSEND ( const char *data, int cid, int sendSize, const char *remoteIp = NULL, int remotePort = 0, int Timeout = 2000 ); |
kaizen | 0:774ff1e8b26b | 151 | int cmdCLOSE ( int cid ); |
kaizen | 0:774ff1e8b26b | 152 | int cmdFDNS (const char *host); |
kaizen | 0:774ff1e8b26b | 153 | int cmdSMGMT ( int cid ); |
kaizen | 0:774ff1e8b26b | 154 | |
kaizen | 0:774ff1e8b26b | 155 | |
kaizen | 0:774ff1e8b26b | 156 | static WizFi310 * getInstance() { |
kaizen | 0:774ff1e8b26b | 157 | return _inst; |
kaizen | 0:774ff1e8b26b | 158 | }; |
kaizen | 0:774ff1e8b26b | 159 | |
kaizen | 0:774ff1e8b26b | 160 | |
kaizen | 0:774ff1e8b26b | 161 | // --------- WizFi2550_sock.cpp --------- |
kaizen | 0:774ff1e8b26b | 162 | int getHostByName (const char * host, char *ip); |
kaizen | 0:774ff1e8b26b | 163 | int open (Protocol proto, const char *ip, int remotePort, int localPort = 0, void(*func)(int) = NULL); |
kaizen | 0:774ff1e8b26b | 164 | int listen (Protocol proto, int port, void(*func)(int)=NULL); |
kaizen | 0:774ff1e8b26b | 165 | int close (int cid); |
kaizen | 0:774ff1e8b26b | 166 | void initCon (int cid, bool connected); |
kaizen | 0:774ff1e8b26b | 167 | int send (int cid, const char *buf, int len); |
kaizen | 0:774ff1e8b26b | 168 | int sendto (int cid, const char *buf, int len, const char *ip, int port); |
kaizen | 0:774ff1e8b26b | 169 | int recv (int cid, char *buf, int len); |
kaizen | 0:774ff1e8b26b | 170 | int recvfrom (int cid, char *buf, int len, char *ip, int *port); |
kaizen | 0:774ff1e8b26b | 171 | int readable (int cid); |
kaizen | 0:774ff1e8b26b | 172 | bool isConnected (int cid); |
kaizen | 0:774ff1e8b26b | 173 | int accept (int cid); |
kaizen | 0:774ff1e8b26b | 174 | int getRemote (int cid, char **ip, int *port); |
kaizen | 0:774ff1e8b26b | 175 | |
kaizen | 0:774ff1e8b26b | 176 | |
kaizen | 0:774ff1e8b26b | 177 | protected: |
kaizen | 0:774ff1e8b26b | 178 | static WizFi310 * _inst; |
kaizen | 0:774ff1e8b26b | 179 | |
kaizen | 0:774ff1e8b26b | 180 | |
kaizen | 0:774ff1e8b26b | 181 | // Serial _wizfi |
kaizen | 0:774ff1e8b26b | 182 | RawSerial _wizfi; |
kaizen | 0:774ff1e8b26b | 183 | int _baud; |
kaizen | 0:774ff1e8b26b | 184 | DigitalIn *_cts; |
kaizen | 0:774ff1e8b26b | 185 | DigitalOut *_rts; |
kaizen | 0:774ff1e8b26b | 186 | int _flow; |
kaizen | 0:774ff1e8b26b | 187 | |
kaizen | 0:774ff1e8b26b | 188 | DigitalInOut _reset; |
kaizen | 0:774ff1e8b26b | 189 | |
kaizen | 0:774ff1e8b26b | 190 | struct STATE { |
kaizen | 0:774ff1e8b26b | 191 | WiFiMode wm; |
kaizen | 0:774ff1e8b26b | 192 | |
kaizen | 0:774ff1e8b26b | 193 | Security sec; |
kaizen | 0:774ff1e8b26b | 194 | char ssid[35]; |
kaizen | 0:774ff1e8b26b | 195 | char pass[66]; |
kaizen | 0:774ff1e8b26b | 196 | char ip[16]; |
kaizen | 0:774ff1e8b26b | 197 | char netmask[16]; |
kaizen | 0:774ff1e8b26b | 198 | char gateway[16]; |
kaizen | 0:774ff1e8b26b | 199 | char nameserver[16]; |
kaizen | 0:774ff1e8b26b | 200 | char mac[18]; |
kaizen | 0:774ff1e8b26b | 201 | char resolv[16]; |
kaizen | 0:774ff1e8b26b | 202 | char name[32]; |
kaizen | 0:774ff1e8b26b | 203 | int rssi; |
kaizen | 0:774ff1e8b26b | 204 | bool dhcp; |
kaizen | 0:774ff1e8b26b | 205 | time_t time; |
kaizen | 0:774ff1e8b26b | 206 | |
kaizen | 0:774ff1e8b26b | 207 | bool initialized; |
kaizen | 0:774ff1e8b26b | 208 | bool associated; |
kaizen | 0:774ff1e8b26b | 209 | volatile Mode mode; |
kaizen | 0:774ff1e8b26b | 210 | volatile Status status; |
kaizen | 0:774ff1e8b26b | 211 | bool escape; |
kaizen | 0:774ff1e8b26b | 212 | volatile bool ok, failure; |
kaizen | 0:774ff1e8b26b | 213 | volatile Response res; |
kaizen | 0:774ff1e8b26b | 214 | int cid; |
kaizen | 0:774ff1e8b26b | 215 | int n; |
kaizen | 0:774ff1e8b26b | 216 | CircBuffer<char> *buf; |
kaizen | 0:774ff1e8b26b | 217 | char dbgRespBuf[BUF_SIZE]; |
kaizen | 0:774ff1e8b26b | 218 | //char dummyBuf[BUF_SIZE]; |
kaizen | 0:774ff1e8b26b | 219 | } _state; |
kaizen | 0:774ff1e8b26b | 220 | |
kaizen | 0:774ff1e8b26b | 221 | |
kaizen | 0:774ff1e8b26b | 222 | public: |
kaizen | 0:774ff1e8b26b | 223 | struct CONNECTION { |
kaizen | 0:774ff1e8b26b | 224 | Protocol protocol; |
kaizen | 0:774ff1e8b26b | 225 | Type type; |
kaizen | 0:774ff1e8b26b | 226 | bool connected; |
kaizen | 0:774ff1e8b26b | 227 | char ip[16]; |
kaizen | 0:774ff1e8b26b | 228 | int port; |
kaizen | 0:774ff1e8b26b | 229 | int send_length; |
kaizen | 0:774ff1e8b26b | 230 | int recv_length; |
kaizen | 0:774ff1e8b26b | 231 | CircBuffer<char> *buf; |
kaizen | 0:774ff1e8b26b | 232 | volatile bool received; |
kaizen | 0:774ff1e8b26b | 233 | volatile int parent; |
kaizen | 0:774ff1e8b26b | 234 | volatile bool accept; |
kaizen | 0:774ff1e8b26b | 235 | void(*func)(int); |
kaizen | 0:774ff1e8b26b | 236 | } _con[8]; |
kaizen | 0:774ff1e8b26b | 237 | |
kaizen | 0:774ff1e8b26b | 238 | // --------- WizFi310.cpp --------- |
kaizen | 0:774ff1e8b26b | 239 | |
kaizen | 0:774ff1e8b26b | 240 | int join(WiFiMode mode); |
kaizen | 0:774ff1e8b26b | 241 | bool isAssociated(); |
kaizen | 0:774ff1e8b26b | 242 | |
kaizen | 0:774ff1e8b26b | 243 | //int limitedap (); |
kaizen | 0:774ff1e8b26b | 244 | //int dissociate (); |
kaizen | 0:774ff1e8b26b | 245 | /* |
kaizen | 0:774ff1e8b26b | 246 | int disconnect () { |
kaizen | 0:774ff1e8b26b | 247 | return dissociate(); |
kaizen | 0:774ff1e8b26b | 248 | } |
kaizen | 0:774ff1e8b26b | 249 | */ |
kaizen | 0:774ff1e8b26b | 250 | |
kaizen | 0:774ff1e8b26b | 251 | Status getStatus (); |
kaizen | 0:774ff1e8b26b | 252 | |
kaizen | 0:774ff1e8b26b | 253 | int setMacAddress (const char *mac); |
kaizen | 0:774ff1e8b26b | 254 | int getMacAddress (char *mac); |
kaizen | 0:774ff1e8b26b | 255 | int setAddress (const char *name = NULL); |
kaizen | 0:774ff1e8b26b | 256 | int setAddress (const char *ip, const char *netmask, const char *gateway, const char *dns = NULL, const char *name = NULL); |
kaizen | 0:774ff1e8b26b | 257 | int getAddress (char *ip, char *netmask, char *gateway); |
kaizen | 0:774ff1e8b26b | 258 | int setSsid (const char *ssid); |
kaizen | 0:774ff1e8b26b | 259 | int setSec (Security sec, const char *phrase); |
kaizen | 0:774ff1e8b26b | 260 | |
kaizen | 0:774ff1e8b26b | 261 | const char* getIPAddress (void); |
kaizen | 0:774ff1e8b26b | 262 | const char* getMACAddress (void); |
kaizen | 0:774ff1e8b26b | 263 | |
kaizen | 0:774ff1e8b26b | 264 | // --------- WizFi250_msg.cpp --------- |
kaizen | 0:774ff1e8b26b | 265 | void recvData ( char c ); |
kaizen | 0:774ff1e8b26b | 266 | int parseMessage (); |
kaizen | 0:774ff1e8b26b | 267 | void msgOk (const char *buf); |
kaizen | 0:774ff1e8b26b | 268 | void msgError (const char *buf); |
kaizen | 0:774ff1e8b26b | 269 | void msgConnect (const char *buf); |
kaizen | 0:774ff1e8b26b | 270 | void msgDisconnect (const char *buf); |
kaizen | 0:774ff1e8b26b | 271 | void msgListen (const char *buf); |
kaizen | 0:774ff1e8b26b | 272 | //daniel |
kaizen | 0:774ff1e8b26b | 273 | void msgMQTTConnect (const char *buf); |
kaizen | 0:774ff1e8b26b | 274 | void msgMQTTDisconnect (const char *buf); |
kaizen | 0:774ff1e8b26b | 275 | |
kaizen | 0:774ff1e8b26b | 276 | void resMacAddress (const char *buf); |
kaizen | 0:774ff1e8b26b | 277 | void resWJOIN (const char *buf); |
kaizen | 0:774ff1e8b26b | 278 | void resConnect (const char *buf); |
kaizen | 0:774ff1e8b26b | 279 | void resSSEND (const char *buf); |
kaizen | 0:774ff1e8b26b | 280 | void resFDNS (const char *buf); |
kaizen | 0:774ff1e8b26b | 281 | void resSMGMT (const char *buf); |
kaizen | 0:774ff1e8b26b | 282 | void resWSTATUS (const char *buf); |
kaizen | 0:774ff1e8b26b | 283 | |
kaizen | 0:774ff1e8b26b | 284 | |
kaizen | 0:774ff1e8b26b | 285 | // --------- WizFi250_hal.cpp --------- |
kaizen | 0:774ff1e8b26b | 286 | void setReset (bool flg); |
kaizen | 0:774ff1e8b26b | 287 | void isrUart (); |
kaizen | 0:774ff1e8b26b | 288 | int getUart (); |
kaizen | 0:774ff1e8b26b | 289 | void putUart (char c); |
kaizen | 0:774ff1e8b26b | 290 | void setRts (bool flg); |
kaizen | 0:774ff1e8b26b | 291 | int lockUart (int ms); |
kaizen | 0:774ff1e8b26b | 292 | void unlockUart (); |
kaizen | 0:774ff1e8b26b | 293 | void initUart (PinName cts, PinName rts, PinName alarm, int baud); |
kaizen | 0:774ff1e8b26b | 294 | |
kaizen | 0:774ff1e8b26b | 295 | |
kaizen | 0:774ff1e8b26b | 296 | // --------- WizFi2550_util.cpp --------- |
kaizen | 0:774ff1e8b26b | 297 | int x2i (char c); |
kaizen | 0:774ff1e8b26b | 298 | int i2x (int i); |
kaizen | 0:774ff1e8b26b | 299 | |
kaizen | 0:774ff1e8b26b | 300 | // --------- WizFi250_ifc.cpp (For NetworkSocketAPI) --------- |
kaizen | 0:774ff1e8b26b | 301 | /** |
kaizen | 0:774ff1e8b26b | 302 | * Startup the WizFi310 |
kaizen | 0:774ff1e8b26b | 303 | * |
kaizen | 0:774ff1e8b26b | 304 | * @return true only if WizFi310 was setup correctly |
kaizen | 0:774ff1e8b26b | 305 | */ |
kaizen | 0:774ff1e8b26b | 306 | bool startup(void); |
kaizen | 0:774ff1e8b26b | 307 | |
kaizen | 0:774ff1e8b26b | 308 | /** |
kaizen | 0:774ff1e8b26b | 309 | * Reset WizFi310 |
kaizen | 0:774ff1e8b26b | 310 | * |
kaizen | 0:774ff1e8b26b | 311 | * @return true only if WizFi310 resets successfully |
kaizen | 0:774ff1e8b26b | 312 | */ |
kaizen | 0:774ff1e8b26b | 313 | bool reset(void); |
kaizen | 0:774ff1e8b26b | 314 | |
kaizen | 0:774ff1e8b26b | 315 | /** |
kaizen | 0:774ff1e8b26b | 316 | * Disconnect WizFi310 from AP |
kaizen | 0:774ff1e8b26b | 317 | * |
kaizen | 0:774ff1e8b26b | 318 | * @return true only if WizFi310 is disconnected successfully |
kaizen | 0:774ff1e8b26b | 319 | */ |
kaizen | 0:774ff1e8b26b | 320 | bool disconnect(void); |
kaizen | 0:774ff1e8b26b | 321 | |
kaizen | 0:774ff1e8b26b | 322 | /** |
kaizen | 0:774ff1e8b26b | 323 | * Check if WizFi310 is conenected |
kaizen | 0:774ff1e8b26b | 324 | * |
kaizen | 0:774ff1e8b26b | 325 | * @return true only if the chip has an IP address |
kaizen | 0:774ff1e8b26b | 326 | */ |
kaizen | 0:774ff1e8b26b | 327 | bool isConnected(void); |
kaizen | 0:774ff1e8b26b | 328 | |
kaizen | 0:774ff1e8b26b | 329 | |
kaizen | 0:774ff1e8b26b | 330 | //daniel for mqtt |
kaizen | 0:774ff1e8b26b | 331 | char rcvd_mqtt_topic[128]; |
ajeet3004 | 2:3194ebe06182 | 332 | |
ajeet3004 | 2:3194ebe06182 | 333 | bool test(void); |
kaizen | 0:774ff1e8b26b | 334 | |
kaizen | 0:774ff1e8b26b | 335 | }; |
kaizen | 0:774ff1e8b26b | 336 | |
kaizen | 0:774ff1e8b26b | 337 | #endif /* WIZFI250_H_ */ |