leo hendrickson / Mbed OS example-Ethernet-mbed-Cloud-connect
Committer:
leothedragon
Date:
Tue May 04 08:55:12 2021 +0000
Revision:
0:8f0bb79ddd48
nmn

Who changed what in which revision?

UserRevisionLine numberNew contents of line
leothedragon 0:8f0bb79ddd48 1 /* ISM43362 implementation of NetworkInterfaceAPI
leothedragon 0:8f0bb79ddd48 2 * Copyright (c) STMicroelectronics 2017
leothedragon 0:8f0bb79ddd48 3 *
leothedragon 0:8f0bb79ddd48 4 * Licensed under the Apache License, Version 2.0 (the "License");
leothedragon 0:8f0bb79ddd48 5 * you may not use this file except in compliance with the License.
leothedragon 0:8f0bb79ddd48 6 * You may obtain a copy of the License at
leothedragon 0:8f0bb79ddd48 7 *
leothedragon 0:8f0bb79ddd48 8 * http://www.apache.org/licenses/LICENSE-2.0
leothedragon 0:8f0bb79ddd48 9 *
leothedragon 0:8f0bb79ddd48 10 * Unless required by applicable law or agreed to in writing, software
leothedragon 0:8f0bb79ddd48 11 * distributed under the License is distributed on an "AS IS" BASIS,
leothedragon 0:8f0bb79ddd48 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
leothedragon 0:8f0bb79ddd48 13 * See the License for the specific language governing permissions and
leothedragon 0:8f0bb79ddd48 14 * limitations under the License.
leothedragon 0:8f0bb79ddd48 15 */
leothedragon 0:8f0bb79ddd48 16
leothedragon 0:8f0bb79ddd48 17 #ifndef ISM43362_INTERFACE_H
leothedragon 0:8f0bb79ddd48 18 #define ISM43362_INTERFACE_H
leothedragon 0:8f0bb79ddd48 19
leothedragon 0:8f0bb79ddd48 20 #include "mbed.h"
leothedragon 0:8f0bb79ddd48 21 #include "ISM43362.h"
leothedragon 0:8f0bb79ddd48 22
leothedragon 0:8f0bb79ddd48 23
leothedragon 0:8f0bb79ddd48 24 #define ISM43362_SOCKET_COUNT 4
leothedragon 0:8f0bb79ddd48 25
leothedragon 0:8f0bb79ddd48 26 /** ISM43362Interface class
leothedragon 0:8f0bb79ddd48 27 * Implementation of the NetworkStack for the ISM43362
leothedragon 0:8f0bb79ddd48 28 */
leothedragon 0:8f0bb79ddd48 29 class ISM43362Interface : public NetworkStack, public WiFiInterface
leothedragon 0:8f0bb79ddd48 30 {
leothedragon 0:8f0bb79ddd48 31 public:
leothedragon 0:8f0bb79ddd48 32 /** ISM43362Interface lifetime
leothedragon 0:8f0bb79ddd48 33 * @param debug Enable debugging
leothedragon 0:8f0bb79ddd48 34 */
leothedragon 0:8f0bb79ddd48 35 ISM43362Interface(bool debug = MBED_CONF_ISM43362_WIFI_DEBUG);
leothedragon 0:8f0bb79ddd48 36
leothedragon 0:8f0bb79ddd48 37 /** Start the interface
leothedragon 0:8f0bb79ddd48 38 *
leothedragon 0:8f0bb79ddd48 39 * Attempts to connect to a WiFi network. Requires ssid and passphrase to be set.
leothedragon 0:8f0bb79ddd48 40 * If passphrase is invalid, NSAPI_ERROR_AUTH_ERROR is returned.
leothedragon 0:8f0bb79ddd48 41 *
leothedragon 0:8f0bb79ddd48 42 * @return 0 on success, negative error code on failure
leothedragon 0:8f0bb79ddd48 43 */
leothedragon 0:8f0bb79ddd48 44 virtual nsapi_error_t connect();
leothedragon 0:8f0bb79ddd48 45
leothedragon 0:8f0bb79ddd48 46 /** Start the interface
leothedragon 0:8f0bb79ddd48 47 *
leothedragon 0:8f0bb79ddd48 48 * Attempts to connect to a WiFi network.
leothedragon 0:8f0bb79ddd48 49 *
leothedragon 0:8f0bb79ddd48 50 * @param ssid Name of the network to connect to
leothedragon 0:8f0bb79ddd48 51 * @param pass Security passphrase to connect to the network
leothedragon 0:8f0bb79ddd48 52 * @param security Type of encryption for connection (Default: NSAPI_SECURITY_NONE)
leothedragon 0:8f0bb79ddd48 53 * @param channel This parameter is not supported, setting it to anything else than 0 will result in NSAPI_ERROR_UNSUPPORTED
leothedragon 0:8f0bb79ddd48 54 * @return 0 on success, or error code on failure
leothedragon 0:8f0bb79ddd48 55 */
leothedragon 0:8f0bb79ddd48 56 virtual nsapi_error_t connect(const char *ssid, const char *pass, nsapi_security_t security = NSAPI_SECURITY_NONE,
leothedragon 0:8f0bb79ddd48 57 uint8_t channel = 0);
leothedragon 0:8f0bb79ddd48 58
leothedragon 0:8f0bb79ddd48 59 /** Translates a hostname to an IP address with specific version
leothedragon 0:8f0bb79ddd48 60 *
leothedragon 0:8f0bb79ddd48 61 * The hostname may be either a domain name or an IP address. If the
leothedragon 0:8f0bb79ddd48 62 * hostname is an IP address, no network transactions will be performed.
leothedragon 0:8f0bb79ddd48 63 *
leothedragon 0:8f0bb79ddd48 64 *
leothedragon 0:8f0bb79ddd48 65 * @param host Hostname to resolve
leothedragon 0:8f0bb79ddd48 66 * @param address Destination for the host SocketAddress
leothedragon 0:8f0bb79ddd48 67 * @param version IP version of address to resolve, NSAPI_UNSPEC indicates
leothedragon 0:8f0bb79ddd48 68 * version is chosen by the stack (defaults to NSAPI_UNSPEC)
leothedragon 0:8f0bb79ddd48 69 * @return 0 on success, negative error code on failure
leothedragon 0:8f0bb79ddd48 70 */
leothedragon 0:8f0bb79ddd48 71 virtual nsapi_error_t gethostbyname(const char *name, SocketAddress *address, nsapi_version_t version = NSAPI_UNSPEC);
leothedragon 0:8f0bb79ddd48 72
leothedragon 0:8f0bb79ddd48 73 /** Set the WiFi network credentials
leothedragon 0:8f0bb79ddd48 74 *
leothedragon 0:8f0bb79ddd48 75 * @param ssid Name of the network to connect to
leothedragon 0:8f0bb79ddd48 76 * @param pass Security passphrase to connect to the network
leothedragon 0:8f0bb79ddd48 77 * @param security Type of encryption for connection
leothedragon 0:8f0bb79ddd48 78 * (defaults to NSAPI_SECURITY_NONE)
leothedragon 0:8f0bb79ddd48 79 * @return 0 on success, or error code on failure
leothedragon 0:8f0bb79ddd48 80 */
leothedragon 0:8f0bb79ddd48 81 virtual int set_credentials(const char *ssid, const char *pass, nsapi_security_t security = NSAPI_SECURITY_NONE);
leothedragon 0:8f0bb79ddd48 82
leothedragon 0:8f0bb79ddd48 83 /** Set the WiFi network channel - NOT SUPPORTED
leothedragon 0:8f0bb79ddd48 84 *
leothedragon 0:8f0bb79ddd48 85 * This function is not supported and will return NSAPI_ERROR_UNSUPPORTED
leothedragon 0:8f0bb79ddd48 86 *
leothedragon 0:8f0bb79ddd48 87 * @param channel Channel on which the connection is to be made, or 0 for any (Default: 0)
leothedragon 0:8f0bb79ddd48 88 * @return Not supported, returns NSAPI_ERROR_UNSUPPORTED
leothedragon 0:8f0bb79ddd48 89 */
leothedragon 0:8f0bb79ddd48 90 virtual int set_channel(uint8_t channel);
leothedragon 0:8f0bb79ddd48 91
leothedragon 0:8f0bb79ddd48 92 /** Stop the interface
leothedragon 0:8f0bb79ddd48 93 * @return 0 on success, negative on failure
leothedragon 0:8f0bb79ddd48 94 */
leothedragon 0:8f0bb79ddd48 95 virtual nsapi_error_t disconnect();
leothedragon 0:8f0bb79ddd48 96
leothedragon 0:8f0bb79ddd48 97 /** Get the internally stored IP address
leothedragon 0:8f0bb79ddd48 98 * @return IP address of the interface or null if not yet connected
leothedragon 0:8f0bb79ddd48 99 */
leothedragon 0:8f0bb79ddd48 100 virtual const char *get_ip_address();
leothedragon 0:8f0bb79ddd48 101
leothedragon 0:8f0bb79ddd48 102 /** Get the internally stored MAC address
leothedragon 0:8f0bb79ddd48 103 * @return MAC address of the interface
leothedragon 0:8f0bb79ddd48 104 */
leothedragon 0:8f0bb79ddd48 105 virtual const char *get_mac_address();
leothedragon 0:8f0bb79ddd48 106
leothedragon 0:8f0bb79ddd48 107 /** Get the local gateway
leothedragon 0:8f0bb79ddd48 108 *
leothedragon 0:8f0bb79ddd48 109 * @return Null-terminated representation of the local gateway
leothedragon 0:8f0bb79ddd48 110 * or null if no network mask has been recieved
leothedragon 0:8f0bb79ddd48 111 */
leothedragon 0:8f0bb79ddd48 112 virtual const char *get_gateway();
leothedragon 0:8f0bb79ddd48 113
leothedragon 0:8f0bb79ddd48 114 /** Get the local network mask
leothedragon 0:8f0bb79ddd48 115 *
leothedragon 0:8f0bb79ddd48 116 * @return Null-terminated representation of the local network mask
leothedragon 0:8f0bb79ddd48 117 * or null if no network mask has been recieved
leothedragon 0:8f0bb79ddd48 118 */
leothedragon 0:8f0bb79ddd48 119 virtual const char *get_netmask();
leothedragon 0:8f0bb79ddd48 120
leothedragon 0:8f0bb79ddd48 121 /** Gets the current radio signal strength for active connection
leothedragon 0:8f0bb79ddd48 122 *
leothedragon 0:8f0bb79ddd48 123 * @return Connection strength in dBm (negative value)
leothedragon 0:8f0bb79ddd48 124 */
leothedragon 0:8f0bb79ddd48 125 virtual int8_t get_rssi();
leothedragon 0:8f0bb79ddd48 126
leothedragon 0:8f0bb79ddd48 127 /** Scan for available networks
leothedragon 0:8f0bb79ddd48 128 *
leothedragon 0:8f0bb79ddd48 129 * This function will block.
leothedragon 0:8f0bb79ddd48 130 *
leothedragon 0:8f0bb79ddd48 131 * @param ap Pointer to allocated array to store discovered AP
leothedragon 0:8f0bb79ddd48 132 * @param count Size of allocated @a res array, or 0 to only count available AP
leothedragon 0:8f0bb79ddd48 133 * @return Number of entries in @a, or if @a count was 0 number of available networks, negative on error
leothedragon 0:8f0bb79ddd48 134 * see @a nsapi_error
leothedragon 0:8f0bb79ddd48 135 */
leothedragon 0:8f0bb79ddd48 136 virtual int scan(WiFiAccessPoint *res, unsigned count);
leothedragon 0:8f0bb79ddd48 137
leothedragon 0:8f0bb79ddd48 138 /** Translates a hostname to an IP address with specific version
leothedragon 0:8f0bb79ddd48 139 *
leothedragon 0:8f0bb79ddd48 140 * The hostname may be either a domain name or an IP address. If the
leothedragon 0:8f0bb79ddd48 141 * hostname is an IP address, no network transactions will be performed.
leothedragon 0:8f0bb79ddd48 142 *
leothedragon 0:8f0bb79ddd48 143 * If no stack-specific DNS resolution is provided, the hostname
leothedragon 0:8f0bb79ddd48 144 * will be resolve using a UDP socket on the stack.
leothedragon 0:8f0bb79ddd48 145 *
leothedragon 0:8f0bb79ddd48 146 * @param address Destination for the host SocketAddress
leothedragon 0:8f0bb79ddd48 147 * @param host Hostname to resolve
leothedragon 0:8f0bb79ddd48 148 * @param version IP version of address to resolve, NSAPI_UNSPEC indicates
leothedragon 0:8f0bb79ddd48 149 * version is chosen by the stack (defaults to NSAPI_UNSPEC)
leothedragon 0:8f0bb79ddd48 150 * @return 0 on success, negative error code on failure
leothedragon 0:8f0bb79ddd48 151 */
leothedragon 0:8f0bb79ddd48 152 using NetworkInterface::gethostbyname;
leothedragon 0:8f0bb79ddd48 153
leothedragon 0:8f0bb79ddd48 154 /** Add a domain name server to list of servers to query
leothedragon 0:8f0bb79ddd48 155 *
leothedragon 0:8f0bb79ddd48 156 * @param addr Destination for the host address
leothedragon 0:8f0bb79ddd48 157 * @return 0 on success, negative error code on failure
leothedragon 0:8f0bb79ddd48 158 */
leothedragon 0:8f0bb79ddd48 159 using NetworkInterface::add_dns_server;
leothedragon 0:8f0bb79ddd48 160
leothedragon 0:8f0bb79ddd48 161 /** Register callback for status reporting
leothedragon 0:8f0bb79ddd48 162 *
leothedragon 0:8f0bb79ddd48 163 * The specified status callback function will be called on status changes
leothedragon 0:8f0bb79ddd48 164 * on the network. The parameters on the callback are the event type and
leothedragon 0:8f0bb79ddd48 165 * event-type dependent reason parameter.
leothedragon 0:8f0bb79ddd48 166 *
leothedragon 0:8f0bb79ddd48 167 * @param status_cb The callback for status changes
leothedragon 0:8f0bb79ddd48 168 */
leothedragon 0:8f0bb79ddd48 169 virtual void attach(mbed::Callback<void(nsapi_event_t, intptr_t)> status_cb);
leothedragon 0:8f0bb79ddd48 170
leothedragon 0:8f0bb79ddd48 171 /** Get the connection status
leothedragon 0:8f0bb79ddd48 172 *
leothedragon 0:8f0bb79ddd48 173 * @return The connection status according to ConnectionStatusType
leothedragon 0:8f0bb79ddd48 174 */
leothedragon 0:8f0bb79ddd48 175 virtual nsapi_connection_status_t get_connection_status() const;
leothedragon 0:8f0bb79ddd48 176
leothedragon 0:8f0bb79ddd48 177 protected:
leothedragon 0:8f0bb79ddd48 178 /** Open a socket
leothedragon 0:8f0bb79ddd48 179 * @param handle Handle in which to store new socket
leothedragon 0:8f0bb79ddd48 180 * @param proto Type of socket to open, NSAPI_TCP or NSAPI_UDP
leothedragon 0:8f0bb79ddd48 181 * @return 0 on success, negative on failure
leothedragon 0:8f0bb79ddd48 182 */
leothedragon 0:8f0bb79ddd48 183 virtual int socket_open(void **handle, nsapi_protocol_t proto);
leothedragon 0:8f0bb79ddd48 184
leothedragon 0:8f0bb79ddd48 185 /** Close the socket
leothedragon 0:8f0bb79ddd48 186 * @param handle Socket handle
leothedragon 0:8f0bb79ddd48 187 * @return 0 on success, negative on failure
leothedragon 0:8f0bb79ddd48 188 * @note On failure, any memory associated with the socket must still
leothedragon 0:8f0bb79ddd48 189 * be cleaned up
leothedragon 0:8f0bb79ddd48 190 */
leothedragon 0:8f0bb79ddd48 191 virtual int socket_close(void *handle);
leothedragon 0:8f0bb79ddd48 192
leothedragon 0:8f0bb79ddd48 193 /** Bind a server socket to a specific port
leothedragon 0:8f0bb79ddd48 194 * @param handle Socket handle
leothedragon 0:8f0bb79ddd48 195 * @param address Local address to listen for incoming connections on
leothedragon 0:8f0bb79ddd48 196 * @return 0 on success, negative on failure.
leothedragon 0:8f0bb79ddd48 197 */
leothedragon 0:8f0bb79ddd48 198 virtual int socket_bind(void *handle, const SocketAddress &address);
leothedragon 0:8f0bb79ddd48 199
leothedragon 0:8f0bb79ddd48 200 /** Start listening for incoming connections
leothedragon 0:8f0bb79ddd48 201 * @param handle Socket handle
leothedragon 0:8f0bb79ddd48 202 * @param backlog Number of pending connections that can be queued up at any
leothedragon 0:8f0bb79ddd48 203 * one time [Default: 1]
leothedragon 0:8f0bb79ddd48 204 * @return 0 on success, negative on failure
leothedragon 0:8f0bb79ddd48 205 */
leothedragon 0:8f0bb79ddd48 206 virtual int socket_listen(void *handle, int backlog);
leothedragon 0:8f0bb79ddd48 207
leothedragon 0:8f0bb79ddd48 208 /** Connects this TCP socket to the server
leothedragon 0:8f0bb79ddd48 209 * @param handle Socket handle
leothedragon 0:8f0bb79ddd48 210 * @param address SocketAddress to connect to
leothedragon 0:8f0bb79ddd48 211 * @return 0 on success, negative on failure
leothedragon 0:8f0bb79ddd48 212 */
leothedragon 0:8f0bb79ddd48 213 virtual int socket_connect(void *handle, const SocketAddress &address);
leothedragon 0:8f0bb79ddd48 214
leothedragon 0:8f0bb79ddd48 215 /** Accept a new connection.
leothedragon 0:8f0bb79ddd48 216 * @param handle Handle in which to store new socket
leothedragon 0:8f0bb79ddd48 217 * @param server Socket handle to server to accept from
leothedragon 0:8f0bb79ddd48 218 * @return 0 on success, negative on failure
leothedragon 0:8f0bb79ddd48 219 * @note This call is not-blocking, if this call would block, must
leothedragon 0:8f0bb79ddd48 220 * immediately return NSAPI_ERROR_WOULD_WAIT
leothedragon 0:8f0bb79ddd48 221 */
leothedragon 0:8f0bb79ddd48 222 virtual int socket_accept(void *handle, void **socket, SocketAddress *address);
leothedragon 0:8f0bb79ddd48 223
leothedragon 0:8f0bb79ddd48 224 /** Send data to the remote host
leothedragon 0:8f0bb79ddd48 225 * @param handle Socket handle
leothedragon 0:8f0bb79ddd48 226 * @param data The buffer to send to the host
leothedragon 0:8f0bb79ddd48 227 * @param size The length of the buffer to send
leothedragon 0:8f0bb79ddd48 228 * @return Number of written bytes on success, negative on failure
leothedragon 0:8f0bb79ddd48 229 * @note This call is not-blocking, if this call would block, must
leothedragon 0:8f0bb79ddd48 230 * immediately return NSAPI_ERROR_WOULD_WAIT
leothedragon 0:8f0bb79ddd48 231 */
leothedragon 0:8f0bb79ddd48 232 virtual int socket_send(void *handle, const void *data, unsigned size);
leothedragon 0:8f0bb79ddd48 233
leothedragon 0:8f0bb79ddd48 234 /** Receive data from the remote host
leothedragon 0:8f0bb79ddd48 235 * @param handle Socket handle
leothedragon 0:8f0bb79ddd48 236 * @param data The buffer in which to store the data received from the host
leothedragon 0:8f0bb79ddd48 237 * @param size The maximum length of the buffer
leothedragon 0:8f0bb79ddd48 238 * @return Number of received bytes on success, negative on failure
leothedragon 0:8f0bb79ddd48 239 * @note This call is not-blocking, if this call would block, must
leothedragon 0:8f0bb79ddd48 240 * immediately return NSAPI_ERROR_WOULD_WAIT
leothedragon 0:8f0bb79ddd48 241 */
leothedragon 0:8f0bb79ddd48 242 virtual int socket_recv(void *handle, void *data, unsigned size);
leothedragon 0:8f0bb79ddd48 243
leothedragon 0:8f0bb79ddd48 244 /** Send a packet to a remote endpoint
leothedragon 0:8f0bb79ddd48 245 * @param handle Socket handle
leothedragon 0:8f0bb79ddd48 246 * @param address The remote SocketAddress
leothedragon 0:8f0bb79ddd48 247 * @param data The packet to be sent
leothedragon 0:8f0bb79ddd48 248 * @param size The length of the packet to be sent
leothedragon 0:8f0bb79ddd48 249 * @return The number of written bytes on success, negative on failure
leothedragon 0:8f0bb79ddd48 250 * @note This call is not-blocking, if this call would block, must
leothedragon 0:8f0bb79ddd48 251 * immediately return NSAPI_ERROR_WOULD_WAIT
leothedragon 0:8f0bb79ddd48 252 */
leothedragon 0:8f0bb79ddd48 253 virtual int socket_sendto(void *handle, const SocketAddress &address, const void *data, unsigned size);
leothedragon 0:8f0bb79ddd48 254
leothedragon 0:8f0bb79ddd48 255 /** Receive a packet from a remote endpoint
leothedragon 0:8f0bb79ddd48 256 * @param handle Socket handle
leothedragon 0:8f0bb79ddd48 257 * @param address Destination for the remote SocketAddress or null
leothedragon 0:8f0bb79ddd48 258 * @param buffer The buffer for storing the incoming packet data
leothedragon 0:8f0bb79ddd48 259 * If a packet is too long to fit in the supplied buffer,
leothedragon 0:8f0bb79ddd48 260 * excess bytes are discarded
leothedragon 0:8f0bb79ddd48 261 * @param size The length of the buffer
leothedragon 0:8f0bb79ddd48 262 * @return The number of received bytes on success, negative on failure
leothedragon 0:8f0bb79ddd48 263 * @note This call is not-blocking, if this call would block, must
leothedragon 0:8f0bb79ddd48 264 * immediately return NSAPI_ERROR_WOULD_WAIT
leothedragon 0:8f0bb79ddd48 265 */
leothedragon 0:8f0bb79ddd48 266 virtual int socket_recvfrom(void *handle, SocketAddress *address, void *buffer, unsigned size);
leothedragon 0:8f0bb79ddd48 267
leothedragon 0:8f0bb79ddd48 268 /** Register a callback on state change of the socket
leothedragon 0:8f0bb79ddd48 269 * @param handle Socket handle
leothedragon 0:8f0bb79ddd48 270 * @param callback Function to call on state change
leothedragon 0:8f0bb79ddd48 271 * @param data Argument to pass to callback
leothedragon 0:8f0bb79ddd48 272 * @note Callback may be called in an interrupt context.
leothedragon 0:8f0bb79ddd48 273 */
leothedragon 0:8f0bb79ddd48 274 virtual void socket_attach(void *handle, void (*callback)(void *), void *data);
leothedragon 0:8f0bb79ddd48 275
leothedragon 0:8f0bb79ddd48 276 /** Provide access to the NetworkStack object
leothedragon 0:8f0bb79ddd48 277 *
leothedragon 0:8f0bb79ddd48 278 * @return The underlying NetworkStack object
leothedragon 0:8f0bb79ddd48 279 */
leothedragon 0:8f0bb79ddd48 280 virtual NetworkStack *get_stack()
leothedragon 0:8f0bb79ddd48 281 {
leothedragon 0:8f0bb79ddd48 282 return this;
leothedragon 0:8f0bb79ddd48 283 }
leothedragon 0:8f0bb79ddd48 284
leothedragon 0:8f0bb79ddd48 285 private:
leothedragon 0:8f0bb79ddd48 286 ISM43362 _ism;
leothedragon 0:8f0bb79ddd48 287 bool _ids[ISM43362_SOCKET_COUNT];
leothedragon 0:8f0bb79ddd48 288 uint32_t _socket_obj[ISM43362_SOCKET_COUNT]; // store addresses of socket handles
leothedragon 0:8f0bb79ddd48 289 Mutex _mutex;
leothedragon 0:8f0bb79ddd48 290 Thread thread_read_socket;
leothedragon 0:8f0bb79ddd48 291 char ap_ssid[33]; /* 32 is what 802.11 defines as longest possible name; +1 for the \0 */
leothedragon 0:8f0bb79ddd48 292 ism_security_t ap_sec;
leothedragon 0:8f0bb79ddd48 293 uint8_t ap_ch;
leothedragon 0:8f0bb79ddd48 294 char ap_pass[64]; /* The longest allowed passphrase */
leothedragon 0:8f0bb79ddd48 295 nsapi_error_t _connect_status ;
leothedragon 0:8f0bb79ddd48 296
leothedragon 0:8f0bb79ddd48 297 bool _ism_debug;
leothedragon 0:8f0bb79ddd48 298 uint32_t _FwVersion;
leothedragon 0:8f0bb79ddd48 299
leothedragon 0:8f0bb79ddd48 300 void event();
leothedragon 0:8f0bb79ddd48 301 struct {
leothedragon 0:8f0bb79ddd48 302 void (*callback)(void *);
leothedragon 0:8f0bb79ddd48 303 void *data;
leothedragon 0:8f0bb79ddd48 304 } _cbs[ISM43362_SOCKET_COUNT];
leothedragon 0:8f0bb79ddd48 305
leothedragon 0:8f0bb79ddd48 306 /** Function called by the socket read thread to check if data is available on the wifi module
leothedragon 0:8f0bb79ddd48 307 *
leothedragon 0:8f0bb79ddd48 308 */
leothedragon 0:8f0bb79ddd48 309 virtual void socket_check_read();
leothedragon 0:8f0bb79ddd48 310 int socket_send_nolock(void *handle, const void *data, unsigned size);
leothedragon 0:8f0bb79ddd48 311 int socket_connect_nolock(void *handle, const SocketAddress &addr);
leothedragon 0:8f0bb79ddd48 312
leothedragon 0:8f0bb79ddd48 313 // Connection state reporting to application
leothedragon 0:8f0bb79ddd48 314 void update_conn_state_cb();
leothedragon 0:8f0bb79ddd48 315 nsapi_connection_status_t _conn_stat;
leothedragon 0:8f0bb79ddd48 316 mbed::Callback<void(nsapi_event_t, intptr_t)> _conn_stat_cb;
leothedragon 0:8f0bb79ddd48 317
leothedragon 0:8f0bb79ddd48 318
leothedragon 0:8f0bb79ddd48 319 };
leothedragon 0:8f0bb79ddd48 320
leothedragon 0:8f0bb79ddd48 321 #endif