ThingPlug Test
Dependents: WizFi310_ThingPlug_Test WizFi310_ThingPlug_Test_P
Fork of WizFi310Interface by
WizFi310Interface.cpp@9:90902218e268, 2017-10-19 (annotated)
- Committer:
- cliff1
- Date:
- Thu Oct 19 04:34:44 2017 +0000
- Revision:
- 9:90902218e268
- Parent:
- 8:08588dd2a66f
- Child:
- 10:ea405bb59143
171019
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jehoon | 0:df571f8f8c03 | 1 | /* WizFi310 implementation of NetworkInterfaceAPI |
jehoon | 0:df571f8f8c03 | 2 | * Copyright (c) 2015 ARM Limited |
jehoon | 0:df571f8f8c03 | 3 | * |
jehoon | 0:df571f8f8c03 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
jehoon | 0:df571f8f8c03 | 5 | * you may not use this file except in compliance with the License. |
jehoon | 0:df571f8f8c03 | 6 | * You may obtain a copy of the License at |
jehoon | 0:df571f8f8c03 | 7 | * |
jehoon | 0:df571f8f8c03 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
jehoon | 0:df571f8f8c03 | 9 | * |
jehoon | 0:df571f8f8c03 | 10 | * Unless required by applicable law or agreed to in writing, software |
jehoon | 0:df571f8f8c03 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
jehoon | 0:df571f8f8c03 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
jehoon | 0:df571f8f8c03 | 13 | * See the License for the specific language governing permissions and |
jehoon | 0:df571f8f8c03 | 14 | * limitations under the License. |
jehoon | 0:df571f8f8c03 | 15 | */ |
jehoon | 0:df571f8f8c03 | 16 | |
jehoon | 0:df571f8f8c03 | 17 | |
jehoon | 0:df571f8f8c03 | 18 | #include "WizFi310Interface.h" |
jehoon | 0:df571f8f8c03 | 19 | |
jehoon | 0:df571f8f8c03 | 20 | // Various timeouts for different WizFi310 operations |
jehoon | 0:df571f8f8c03 | 21 | #define WizFi310_CONNECT_TIMEOUT 15000 |
jehoon | 0:df571f8f8c03 | 22 | #define WizFi310_SEND_TIMEOUT 500 |
jehoon | 0:df571f8f8c03 | 23 | #define WizFi310_RECV_TIMEOUT 0 |
jehoon | 0:df571f8f8c03 | 24 | #define WizFi310_MISC_TIMEOUT 500 |
jehoon | 0:df571f8f8c03 | 25 | |
jehoon | 0:df571f8f8c03 | 26 | #define WizFi310_DELAY_MS 300 |
jehoon | 0:df571f8f8c03 | 27 | |
jehoon | 0:df571f8f8c03 | 28 | |
jehoon | 0:df571f8f8c03 | 29 | // WizFi310Interface implementation |
jehoon | 0:df571f8f8c03 | 30 | WizFi310Interface::WizFi310Interface(PinName tx, PinName rx, PinName cts, PinName rts, PinName reset, PinName alarm, int baud) |
jehoon | 0:df571f8f8c03 | 31 | : _wizfi310(tx, rx, cts, rts, reset, alarm, baud) |
jehoon | 0:df571f8f8c03 | 32 | { |
jehoon | 0:df571f8f8c03 | 33 | memset(_ids, 0, sizeof(_ids)); |
jehoon | 0:df571f8f8c03 | 34 | } |
jehoon | 0:df571f8f8c03 | 35 | |
jehoon | 0:df571f8f8c03 | 36 | int WizFi310Interface::connect( |
jehoon | 0:df571f8f8c03 | 37 | const char *ssid, |
jehoon | 0:df571f8f8c03 | 38 | const char *pass, |
jehoon | 0:df571f8f8c03 | 39 | nsapi_security_t security) |
jehoon | 0:df571f8f8c03 | 40 | { |
jehoon | 0:df571f8f8c03 | 41 | if (!_wizfi310.startup()) |
jehoon | 0:df571f8f8c03 | 42 | { |
jehoon | 0:df571f8f8c03 | 43 | return NSAPI_ERROR_DEVICE_ERROR; |
jehoon | 0:df571f8f8c03 | 44 | } |
jehoon | 0:df571f8f8c03 | 45 | |
jehoon | 0:df571f8f8c03 | 46 | _wizfi310.setSsid(ssid); |
jehoon | 0:df571f8f8c03 | 47 | _wizfi310.setSec(security, pass); |
jehoon | 0:df571f8f8c03 | 48 | _wizfi310.setAddress(""); |
jehoon | 0:df571f8f8c03 | 49 | |
jehoon | 0:df571f8f8c03 | 50 | if( _wizfi310.join(WizFi310::WM_STATION) == -1) |
jehoon | 0:df571f8f8c03 | 51 | { |
jehoon | 0:df571f8f8c03 | 52 | return NSAPI_ERROR_NO_CONNECTION; |
jehoon | 0:df571f8f8c03 | 53 | } |
jehoon | 0:df571f8f8c03 | 54 | |
jehoon | 0:df571f8f8c03 | 55 | return 0; |
jehoon | 0:df571f8f8c03 | 56 | } |
jehoon | 0:df571f8f8c03 | 57 | |
jehoon | 0:df571f8f8c03 | 58 | int WizFi310Interface::disconnect() |
jehoon | 0:df571f8f8c03 | 59 | { |
jehoon | 0:df571f8f8c03 | 60 | if ( _wizfi310.cmdWLEAVE() == -1 ) return NSAPI_ERROR_DEVICE_ERROR; |
jehoon | 0:df571f8f8c03 | 61 | |
jehoon | 0:df571f8f8c03 | 62 | return 0; |
jehoon | 0:df571f8f8c03 | 63 | } |
jehoon | 0:df571f8f8c03 | 64 | |
jehoon | 0:df571f8f8c03 | 65 | const char *WizFi310Interface::get_ip_address() |
jehoon | 0:df571f8f8c03 | 66 | { |
jehoon | 0:df571f8f8c03 | 67 | return _wizfi310.getIPAddress(); |
jehoon | 0:df571f8f8c03 | 68 | } |
jehoon | 0:df571f8f8c03 | 69 | |
jehoon | 0:df571f8f8c03 | 70 | const char *WizFi310Interface::get_mac_address() |
jehoon | 0:df571f8f8c03 | 71 | { |
jehoon | 0:df571f8f8c03 | 72 | return _wizfi310.getMACAddress(); |
jehoon | 0:df571f8f8c03 | 73 | } |
jehoon | 0:df571f8f8c03 | 74 | |
cliff1 | 8:08588dd2a66f | 75 | int WizFi310Interface::conTP( |
cliff1 | 8:08588dd2a66f | 76 | const char *clientId, |
cliff1 | 8:08588dd2a66f | 77 | const char *credentialId, |
cliff1 | 8:08588dd2a66f | 78 | const char *serviceId, |
cliff1 | 8:08588dd2a66f | 79 | const char *devId, |
cliff1 | 8:08588dd2a66f | 80 | const char *containerNm, |
cliff1 | 8:08588dd2a66f | 81 | const char *commandName |
cliff1 | 8:08588dd2a66f | 82 | ) |
cliff1 | 7:b7019399eb1e | 83 | { |
cliff1 | 7:b7019399eb1e | 84 | //if ( _wizfi310.joinTP(clientId, credentialId, serviceId, devId, containerNm) == -1 ) return NSAPI_ERROR_NO_SOCKET; |
cliff1 | 7:b7019399eb1e | 85 | |
cliff1 | 7:b7019399eb1e | 86 | if(_wizfi310.cmdSKTPCON("1", clientId, credentialId, serviceId, devId)) return -1; |
cliff1 | 7:b7019399eb1e | 87 | WIZ_INFO("ThingPlug Connected"); |
cliff1 | 7:b7019399eb1e | 88 | |
cliff1 | 7:b7019399eb1e | 89 | if(_wizfi310.cmdSKTPDEVICE("1", devId)) return -1; |
cliff1 | 7:b7019399eb1e | 90 | WIZ_INFO("Device Registered"); |
cliff1 | 7:b7019399eb1e | 91 | |
cliff1 | 7:b7019399eb1e | 92 | if(_wizfi310.cmdSKTPCONTAINER("1", containerNm)) return -1; |
cliff1 | 7:b7019399eb1e | 93 | WIZ_INFO("Created Container\r\n"); |
cliff1 | 7:b7019399eb1e | 94 | |
cliff1 | 8:08588dd2a66f | 95 | if(_wizfi310.cmdSKTPCMD("1", commandName)) return -1; |
cliff1 | 8:08588dd2a66f | 96 | WIZ_INFO("Created CommandName\r\n"); |
cliff1 | 8:08588dd2a66f | 97 | |
cliff1 | 7:b7019399eb1e | 98 | return 0; |
cliff1 | 7:b7019399eb1e | 99 | } |
cliff1 | 7:b7019399eb1e | 100 | |
cliff1 | 7:b7019399eb1e | 101 | int WizFi310Interface::sendTP(const char *containerNm, const char *sendData) |
cliff1 | 7:b7019399eb1e | 102 | { |
cliff1 | 7:b7019399eb1e | 103 | if(_wizfi310.cmdSKTPSEND(containerNm, sendData)) return -1; |
cliff1 | 7:b7019399eb1e | 104 | WIZ_INFO("Data sent\r\n"); |
cliff1 | 7:b7019399eb1e | 105 | |
cliff1 | 7:b7019399eb1e | 106 | return 0; |
cliff1 | 7:b7019399eb1e | 107 | } |
cliff1 | 7:b7019399eb1e | 108 | |
cliff1 | 8:08588dd2a66f | 109 | int WizFi310Interface::recvTP(const char *commandName, int executeStatus, int executeResult) |
cliff1 | 8:08588dd2a66f | 110 | { |
cliff1 | 9:90902218e268 | 111 | int cnt, cid = 0, ret = 0; |
cliff1 | 8:08588dd2a66f | 112 | char buffer[1024] = ""; |
cliff1 | 9:90902218e268 | 113 | |
cliff1 | 8:08588dd2a66f | 114 | if(_wizfi310.recv(cid, buffer, sizeof(buffer))) |
cliff1 | 8:08588dd2a66f | 115 | { |
cliff1 | 8:08588dd2a66f | 116 | //printf("%s\r\n", buffer); |
cliff1 | 9:90902218e268 | 117 | |
cliff1 | 8:08588dd2a66f | 118 | if(_wizfi310.cmdSKTPRESULT(commandName, executeStatus, executeResult)) |
cliff1 | 8:08588dd2a66f | 119 | { |
cliff1 | 8:08588dd2a66f | 120 | _wizfi310.initCon(cid, true); |
cliff1 | 8:08588dd2a66f | 121 | |
cliff1 | 8:08588dd2a66f | 122 | return -1; |
cliff1 | 8:08588dd2a66f | 123 | } |
cliff1 | 9:90902218e268 | 124 | |
cliff1 | 9:90902218e268 | 125 | for(cnt = 0; cnt < sizeof(buffer); cnt++) |
cliff1 | 9:90902218e268 | 126 | { |
cliff1 | 9:90902218e268 | 127 | if( buffer[cnt] == '8' ) |
cliff1 | 9:90902218e268 | 128 | { |
cliff1 | 9:90902218e268 | 129 | if( buffer[cnt + 1] == '0' ) |
cliff1 | 9:90902218e268 | 130 | { |
cliff1 | 9:90902218e268 | 131 | WIZ_INFO("1!!/r/n/r/n"); |
cliff1 | 9:90902218e268 | 132 | ret = 1; |
cliff1 | 9:90902218e268 | 133 | } |
cliff1 | 9:90902218e268 | 134 | |
cliff1 | 9:90902218e268 | 135 | else if( buffer[cnt + 1] == '1' ) |
cliff1 | 9:90902218e268 | 136 | { |
cliff1 | 9:90902218e268 | 137 | WIZ_INFO("2!!/r/n/r/n"); |
cliff1 | 9:90902218e268 | 138 | ret = 2; |
cliff1 | 9:90902218e268 | 139 | } |
cliff1 | 9:90902218e268 | 140 | } |
cliff1 | 9:90902218e268 | 141 | } |
cliff1 | 8:08588dd2a66f | 142 | |
cliff1 | 8:08588dd2a66f | 143 | WIZ_INFO("Complete/r/n/r/n"); |
cliff1 | 8:08588dd2a66f | 144 | _wizfi310.initCon(cid, true); |
cliff1 | 8:08588dd2a66f | 145 | |
cliff1 | 9:90902218e268 | 146 | return ret; |
cliff1 | 8:08588dd2a66f | 147 | } |
cliff1 | 8:08588dd2a66f | 148 | |
cliff1 | 8:08588dd2a66f | 149 | WIZ_INFO("Incorrect Request\r\n"); |
cliff1 | 8:08588dd2a66f | 150 | _wizfi310.initCon(cid, true); |
cliff1 | 8:08588dd2a66f | 151 | |
cliff1 | 8:08588dd2a66f | 152 | return -1; |
cliff1 | 8:08588dd2a66f | 153 | } |
cliff1 | 8:08588dd2a66f | 154 | |
cliff1 | 7:b7019399eb1e | 155 | int WizFi310Interface::disConTP() |
cliff1 | 7:b7019399eb1e | 156 | { |
cliff1 | 7:b7019399eb1e | 157 | if(_wizfi310.cmdSKTPCON("0")) return -1; |
cliff1 | 7:b7019399eb1e | 158 | WIZ_INFO("ThingPlug Disconnected\r\n"); |
cliff1 | 7:b7019399eb1e | 159 | |
cliff1 | 7:b7019399eb1e | 160 | return 0; |
cliff1 | 7:b7019399eb1e | 161 | } |
cliff1 | 7:b7019399eb1e | 162 | |
jehoon | 0:df571f8f8c03 | 163 | struct wizfi310_socket { |
jehoon | 0:df571f8f8c03 | 164 | int id; |
jehoon | 0:df571f8f8c03 | 165 | nsapi_protocol_t proto; |
jehoon | 0:df571f8f8c03 | 166 | bool connected; |
jehoon | 0:df571f8f8c03 | 167 | }; |
jehoon | 0:df571f8f8c03 | 168 | |
jehoon | 0:df571f8f8c03 | 169 | int WizFi310Interface::socket_open(void **handle, nsapi_protocol_t proto) |
jehoon | 0:df571f8f8c03 | 170 | { |
jehoon | 0:df571f8f8c03 | 171 | // Look for an unused socket |
jehoon | 0:df571f8f8c03 | 172 | |
jehoon | 0:df571f8f8c03 | 173 | /* |
jehoon | 0:df571f8f8c03 | 174 | int id = -1; |
jehoon | 0:df571f8f8c03 | 175 | |
jehoon | 0:df571f8f8c03 | 176 | for (int i = 0; i < WIZFI310_SOCKET_COUNT; i++) { |
jehoon | 0:df571f8f8c03 | 177 | if (_ids[i] == false) { |
jehoon | 0:df571f8f8c03 | 178 | id = i; |
jehoon | 0:df571f8f8c03 | 179 | _ids[i] = true; |
jehoon | 0:df571f8f8c03 | 180 | break; |
jehoon | 0:df571f8f8c03 | 181 | } |
jehoon | 0:df571f8f8c03 | 182 | } |
jehoon | 0:df571f8f8c03 | 183 | |
jehoon | 0:df571f8f8c03 | 184 | if (id == -1) { |
jehoon | 0:df571f8f8c03 | 185 | return NSAPI_ERROR_NO_SOCKET; |
jehoon | 0:df571f8f8c03 | 186 | } |
jehoon | 0:df571f8f8c03 | 187 | */ |
jehoon | 0:df571f8f8c03 | 188 | |
jehoon | 0:df571f8f8c03 | 189 | struct wizfi310_socket *socket = new struct wizfi310_socket; |
jehoon | 0:df571f8f8c03 | 190 | if (!socket) { |
jehoon | 0:df571f8f8c03 | 191 | return NSAPI_ERROR_NO_SOCKET; |
jehoon | 0:df571f8f8c03 | 192 | } |
jehoon | 0:df571f8f8c03 | 193 | |
jehoon | 0:df571f8f8c03 | 194 | socket->id = -1; |
jehoon | 0:df571f8f8c03 | 195 | socket->proto = proto; |
jehoon | 0:df571f8f8c03 | 196 | socket->connected = false; |
jehoon | 0:df571f8f8c03 | 197 | *handle = socket; |
jehoon | 0:df571f8f8c03 | 198 | return 0; |
jehoon | 0:df571f8f8c03 | 199 | } |
jehoon | 0:df571f8f8c03 | 200 | |
jehoon | 0:df571f8f8c03 | 201 | int WizFi310Interface::socket_close(void *handle) |
jehoon | 0:df571f8f8c03 | 202 | { |
jehoon | 0:df571f8f8c03 | 203 | struct wizfi310_socket *socket = (struct wizfi310_socket *)handle; |
jehoon | 0:df571f8f8c03 | 204 | int err = 0; |
jehoon | 0:df571f8f8c03 | 205 | |
jehoon | 0:df571f8f8c03 | 206 | if(socket->id == -1){ |
jehoon | 0:df571f8f8c03 | 207 | err = NSAPI_ERROR_NO_SOCKET; |
jehoon | 0:df571f8f8c03 | 208 | } |
jehoon | 0:df571f8f8c03 | 209 | else if (_wizfi310.close(socket->id) == -1) { |
jehoon | 0:df571f8f8c03 | 210 | err = NSAPI_ERROR_DEVICE_ERROR; |
jehoon | 0:df571f8f8c03 | 211 | } |
jehoon | 0:df571f8f8c03 | 212 | |
jehoon | 0:df571f8f8c03 | 213 | _ids[socket->id] = false; |
jehoon | 0:df571f8f8c03 | 214 | wait_ms(WizFi310_DELAY_MS); |
jehoon | 0:df571f8f8c03 | 215 | delete socket; |
jehoon | 0:df571f8f8c03 | 216 | return err; |
jehoon | 0:df571f8f8c03 | 217 | } |
jehoon | 0:df571f8f8c03 | 218 | |
jehoon | 0:df571f8f8c03 | 219 | int WizFi310Interface::socket_bind(void *handle, const SocketAddress &address) |
jehoon | 0:df571f8f8c03 | 220 | { |
jehoon | 0:df571f8f8c03 | 221 | return NSAPI_ERROR_UNSUPPORTED; |
jehoon | 0:df571f8f8c03 | 222 | } |
jehoon | 0:df571f8f8c03 | 223 | |
jehoon | 0:df571f8f8c03 | 224 | int WizFi310Interface::socket_listen(void *handle, int backlog) |
jehoon | 0:df571f8f8c03 | 225 | { |
jehoon | 0:df571f8f8c03 | 226 | return NSAPI_ERROR_UNSUPPORTED; |
jehoon | 0:df571f8f8c03 | 227 | } |
jehoon | 0:df571f8f8c03 | 228 | |
jehoon | 0:df571f8f8c03 | 229 | int WizFi310Interface::socket_connect(void *handle, const SocketAddress &addr) |
jehoon | 0:df571f8f8c03 | 230 | { |
jehoon | 0:df571f8f8c03 | 231 | int cid=-1; |
jehoon | 0:df571f8f8c03 | 232 | struct wizfi310_socket *socket = (struct wizfi310_socket *)handle; |
jehoon | 0:df571f8f8c03 | 233 | |
jehoon | 0:df571f8f8c03 | 234 | WizFi310::Protocol proto = (socket->proto == NSAPI_UDP) ? WizFi310::PROTO_UDP : WizFi310::PROTO_TCP; |
jehoon | 0:df571f8f8c03 | 235 | if((cid = _wizfi310.open(proto, addr.get_ip_address(), addr.get_port())) == -1 ) |
jehoon | 0:df571f8f8c03 | 236 | { |
jehoon | 0:df571f8f8c03 | 237 | return NSAPI_ERROR_DEVICE_ERROR; |
jehoon | 0:df571f8f8c03 | 238 | } |
jehoon | 0:df571f8f8c03 | 239 | |
jehoon | 0:df571f8f8c03 | 240 | if(cid >= WIZFI310_SOCKET_COUNT) |
jehoon | 0:df571f8f8c03 | 241 | { |
jehoon | 0:df571f8f8c03 | 242 | return NSAPI_ERROR_NO_SOCKET; |
jehoon | 0:df571f8f8c03 | 243 | } |
jehoon | 0:df571f8f8c03 | 244 | |
jehoon | 0:df571f8f8c03 | 245 | _ids[cid] = true; |
jehoon | 0:df571f8f8c03 | 246 | socket->id = cid; |
jehoon | 0:df571f8f8c03 | 247 | socket->connected = true; |
jehoon | 0:df571f8f8c03 | 248 | wait_ms(WizFi310_DELAY_MS); |
jehoon | 0:df571f8f8c03 | 249 | return 0; |
jehoon | 0:df571f8f8c03 | 250 | } |
jehoon | 0:df571f8f8c03 | 251 | |
jehoon | 0:df571f8f8c03 | 252 | int WizFi310Interface::socket_accept(void **handle, void *server) |
jehoon | 0:df571f8f8c03 | 253 | { |
jehoon | 0:df571f8f8c03 | 254 | return NSAPI_ERROR_UNSUPPORTED; |
jehoon | 0:df571f8f8c03 | 255 | } |
jehoon | 0:df571f8f8c03 | 256 | |
jehoon | 0:df571f8f8c03 | 257 | int WizFi310Interface::socket_send(void *handle, const void *data, unsigned size) |
jehoon | 0:df571f8f8c03 | 258 | { |
jehoon | 0:df571f8f8c03 | 259 | struct wizfi310_socket *socket = (struct wizfi310_socket *)handle; |
jehoon | 0:df571f8f8c03 | 260 | |
jehoon | 0:df571f8f8c03 | 261 | if ( _wizfi310.send(socket->id, (const char*)data, size) == -1 ) { |
jehoon | 0:df571f8f8c03 | 262 | return NSAPI_ERROR_DEVICE_ERROR; |
jehoon | 0:df571f8f8c03 | 263 | } |
jehoon | 0:df571f8f8c03 | 264 | |
jehoon | 0:df571f8f8c03 | 265 | return size; |
jehoon | 0:df571f8f8c03 | 266 | } |
jehoon | 0:df571f8f8c03 | 267 | |
jehoon | 0:df571f8f8c03 | 268 | int WizFi310Interface::socket_recv(void *handle, void *data, unsigned size) |
jehoon | 0:df571f8f8c03 | 269 | { |
jehoon | 0:df571f8f8c03 | 270 | struct wizfi310_socket *socket = (struct wizfi310_socket *)handle; |
jehoon | 0:df571f8f8c03 | 271 | |
jehoon | 0:df571f8f8c03 | 272 | int32_t recv = _wizfi310.recv(socket->id, (char*)data, size); |
kaizen | 2:04c8d61984a3 | 273 | if (recv <= 0) { |
jehoon | 0:df571f8f8c03 | 274 | return NSAPI_ERROR_WOULD_BLOCK; |
jehoon | 0:df571f8f8c03 | 275 | } |
jehoon | 0:df571f8f8c03 | 276 | |
jehoon | 0:df571f8f8c03 | 277 | return recv; |
jehoon | 0:df571f8f8c03 | 278 | } |
jehoon | 0:df571f8f8c03 | 279 | |
jehoon | 0:df571f8f8c03 | 280 | int WizFi310Interface::socket_sendto(void *handle, const SocketAddress &addr, const void *data, unsigned size) |
jehoon | 0:df571f8f8c03 | 281 | { |
jehoon | 0:df571f8f8c03 | 282 | struct wizfi310_socket *socket = (struct wizfi310_socket *)handle; |
jehoon | 0:df571f8f8c03 | 283 | if (!socket->connected) { |
jehoon | 0:df571f8f8c03 | 284 | int err = socket_connect(socket, addr); |
jehoon | 0:df571f8f8c03 | 285 | if (err < 0) { |
jehoon | 0:df571f8f8c03 | 286 | return err; |
jehoon | 0:df571f8f8c03 | 287 | } |
jehoon | 0:df571f8f8c03 | 288 | } |
jehoon | 0:df571f8f8c03 | 289 | |
jehoon | 0:df571f8f8c03 | 290 | return socket_send(socket, data, size); |
jehoon | 0:df571f8f8c03 | 291 | } |
jehoon | 0:df571f8f8c03 | 292 | |
jehoon | 0:df571f8f8c03 | 293 | int WizFi310Interface::socket_recvfrom(void *handle, SocketAddress *addr, void *data, unsigned size) |
jehoon | 0:df571f8f8c03 | 294 | { |
jehoon | 0:df571f8f8c03 | 295 | struct wizfi310_socket *socket = (struct wizfi310_socket *)handle; |
jehoon | 0:df571f8f8c03 | 296 | return socket_recv(socket, data, size); |
jehoon | 0:df571f8f8c03 | 297 | } |
jehoon | 0:df571f8f8c03 | 298 | |
jehoon | 0:df571f8f8c03 | 299 | void WizFi310Interface::socket_attach(void *handle, void (*callback)(void *), void *data) |
jehoon | 0:df571f8f8c03 | 300 | { |
jehoon | 0:df571f8f8c03 | 301 | } |