leo hendrickson / Mbed OS example-Ethernet-mbed-Cloud-connect
Embed: (wiki syntax)

« Back to documentation index

WizFi310Interface Class Reference

WizFi310Interface Class Reference

WizFi310Interface class Implementation of the NetworkStack for the WizFi310. More...

#include <WizFi310Interface.h>

Public Member Functions

virtual int connect ()
 Start the interface.
virtual int connect (const char *ssid, const char *pass, nsapi_security_t security=NSAPI_SECURITY_NONE, uint8_t channel=0)
 Start the interface.
virtual int set_credentials (const char *ssid, const char *pass, nsapi_security_t security=NSAPI_SECURITY_NONE)
 Set the WiFi network credentials.
virtual int set_channel (uint8_t channel)
 Set the WiFi network channel - NOT SUPPORTED.
virtual int disconnect ()
 Stop the interface.
virtual int8_t get_rssi ()
 Gets the current radio signal strength for active connection.

Protected Member Functions

virtual int socket_open (void **handle, nsapi_protocol_t proto)
 Open a socket.
virtual int socket_close (void *handle)
 Close the socket.
virtual int socket_bind (void *handle, const SocketAddress &address)
 Bind a server socket to a specific port.
virtual int socket_listen (void *handle, int backlog)
 Start listening for incoming connections.
virtual int socket_connect (void *handle, const SocketAddress &address)
 Connects this TCP socket to the server.
virtual int socket_accept (void *handle, void **socket, SocketAddress *address)
 Accept a new connection.
virtual int socket_send (void *handle, const void *data, unsigned size)
 Send data to the remote host.
virtual int socket_recv (void *handle, void *data, unsigned size)
 Receive data from the remote host.
virtual int socket_sendto (void *handle, const SocketAddress &address, const void *data, unsigned size)
 Send a packet to a remote endpoint.
virtual int socket_recvfrom (void *handle, SocketAddress *address, void *buffer, unsigned size)
 Receive a packet from a remote endpoint.
virtual void socket_attach (void *handle, void(*callback)(void *), void *data)
 Register a callback on state change of the socket.
virtual NetworkStack * get_stack ()
 Provide access to the NetworkStack object.

Detailed Description

WizFi310Interface class Implementation of the NetworkStack for the WizFi310.

Definition at line 47 of file WizFi310Interface.h.


Member Function Documentation

nsapi_error_t connect (  ) [virtual]

Start the interface.

Attempts to connect to a WiFi network. Requires ssid and passphrase to be set. If passphrase is invalid, NSAPI_ERROR_AUTH_ERROR is returned.

Returns:
0 on success, negative error code on failure

Definition at line 132 of file WizFi310Interface.cpp.

nsapi_error_t connect ( const char *  ssid,
const char *  pass,
nsapi_security_t  security = NSAPI_SECURITY_NONE,
uint8_t  channel = 0 
) [virtual]

Start the interface.

Attempts to connect to a WiFi network.

Parameters:
ssidName of the network to connect to
passSecurity passphrase to connect to the network
securityType of encryption for connection (Default: NSAPI_SECURITY_NONE)
channelThis parameter is not supported, setting it to anything else than 0 will result in NSAPI_ERROR_UNSUPPORTED
Returns:
0 on success, or error code on failure

Definition at line 114 of file WizFi310Interface.cpp.

int disconnect ( void   ) [virtual]

Stop the interface.

Returns:
0 on success, negative on failure

Definition at line 205 of file WizFi310Interface.cpp.

int8_t get_rssi (  ) [virtual]

Gets the current radio signal strength for active connection.

Returns:
Connection strength in dBm (negative value)

Definition at line 236 of file WizFi310Interface.cpp.

virtual NetworkStack* get_stack (  ) [protected, virtual]

Provide access to the NetworkStack object.

Returns:
The underlying NetworkStack object

Definition at line 218 of file WizFi310Interface.h.

nsapi_error_t set_channel ( uint8_t  channel ) [virtual]

Set the WiFi network channel - NOT SUPPORTED.

This function is not supported and will return NSAPI_ERROR_UNSUPPORTED

Parameters:
channelChannel on which the connection is to be made, or 0 for any (Default: 0)
Returns:
Not supported, returns NSAPI_ERROR_UNSUPPORTED

Definition at line 173 of file WizFi310Interface.cpp.

int set_credentials ( const char *  ssid,
const char *  pass,
nsapi_security_t  security = NSAPI_SECURITY_NONE 
) [virtual]

Set the WiFi network credentials.

Parameters:
ssidName of the network to connect to
passSecurity passphrase to connect to the network
securityType of encryption for connection (defaults to NSAPI_SECURITY_NONE)
Returns:
0 on success, or error code on failure

Definition at line 181 of file WizFi310Interface.cpp.

int socket_accept ( void *  handle,
void **  socket,
SocketAddress *  address 
) [protected, virtual]

Accept a new connection.

Parameters:
handleHandle in which to store new socket
serverSocket handle to server to accept from
Returns:
0 on success, negative on failure
Note:
This call is not-blocking, if this call would block, must immediately return NSAPI_ERROR_WOULD_WAIT

Definition at line 362 of file WizFi310Interface.cpp.

void socket_attach ( void *  handle,
void(*)(void *)  callback,
void *  data 
) [protected, virtual]

Register a callback on state change of the socket.

Parameters:
handleSocket handle
callbackFunction to call on state change
dataArgument to pass to callback
Note:
Callback may be called in an interrupt context.

Definition at line 483 of file WizFi310Interface.cpp.

int socket_bind ( void *  handle,
const SocketAddress &  address 
) [protected, virtual]

Bind a server socket to a specific port.

Parameters:
handleSocket handle
addressLocal address to listen for incoming connections on
Returns:
0 on success, negative on failure.

Definition at line 315 of file WizFi310Interface.cpp.

nsapi_error_t socket_close ( void *  handle ) [protected, virtual]

Close the socket.

Parameters:
handleSocket handle
Returns:
0 on success, negative on failure
Note:
On failure, any memory associated with the socket must still be cleaned up

Definition at line 470 of file WizFi310Interface.cpp.

int socket_connect ( void *  handle,
const SocketAddress &  address 
) [protected, virtual]

Connects this TCP socket to the server.

Parameters:
handleSocket handle
addressSocketAddress to connect to
Returns:
0 on success, negative on failure

Definition at line 325 of file WizFi310Interface.cpp.

int socket_listen ( void *  handle,
int  backlog 
) [protected, virtual]

Start listening for incoming connections.

Parameters:
handleSocket handle
backlogNumber of pending connections that can be queued up at any one time [Default: 1]
Returns:
0 on success, negative on failure

Definition at line 320 of file WizFi310Interface.cpp.

nsapi_error_t socket_open ( void **  handle,
nsapi_protocol_t  proto 
) [protected, virtual]

Open a socket.

Parameters:
handleHandle in which to store new socket
protoType of socket to open, NSAPI_TCP or NSAPI_UDP
Returns:
0 on success, negative on failure

Definition at line 283 of file WizFi310Interface.cpp.

int socket_recv ( void *  handle,
void *  data,
unsigned  size 
) [protected, virtual]

Receive data from the remote host.

Parameters:
handleSocket handle
dataThe buffer in which to store the data received from the host
sizeThe maximum length of the buffer
Returns:
Number of received bytes on success, negative on failure
Note:
This call is not-blocking, if this call would block, must immediately return NSAPI_ERROR_WOULD_WAIT

Definition at line 396 of file WizFi310Interface.cpp.

int socket_recvfrom ( void *  handle,
SocketAddress *  address,
void *  buffer,
unsigned  size 
) [protected, virtual]

Receive a packet from a remote endpoint.

Parameters:
handleSocket handle
addressDestination for the remote SocketAddress or null
bufferThe buffer for storing the incoming packet data If a packet is too long to fit in the supplied buffer, excess bytes are discarded
sizeThe length of the buffer
Returns:
The number of received bytes on success, negative on failure
Note:
This call is not-blocking, if this call would block, must immediately return NSAPI_ERROR_WOULD_WAIT

Definition at line 458 of file WizFi310Interface.cpp.

int socket_send ( void *  handle,
const void *  data,
unsigned  size 
) [protected, virtual]

Send data to the remote host.

Parameters:
handleSocket handle
dataThe buffer to send to the host
sizeThe length of the buffer to send
Returns:
Number of written bytes on success, negative on failure
Note:
This call is not-blocking, if this call would block, must immediately return NSAPI_ERROR_WOULD_WAIT

Definition at line 367 of file WizFi310Interface.cpp.

int socket_sendto ( void *  handle,
const SocketAddress &  address,
const void *  data,
unsigned  size 
) [protected, virtual]

Send a packet to a remote endpoint.

Parameters:
handleSocket handle
addressThe remote SocketAddress
dataThe packet to be sent
sizeThe length of the packet to be sent
Returns:
The number of written bytes on success, negative on failure
Note:
This call is not-blocking, if this call would block, must immediately return NSAPI_ERROR_WOULD_WAIT

Definition at line 431 of file WizFi310Interface.cpp.