Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: X_NUCLEO_IKS01A2 mbed-http
WNC14A2AInterface Class Reference
WNC14A2AInterface class Implementation of the NetworkInterface for WNC14A2A. More...
#include <WNC14A2AInterface.h>
Public Member Functions | |
| WNC14A2AInterface (WNCDebug *_dbgUart=NULL) | |
| WNC14A2AInterface Constructor. | |
| virtual | ~WNC14A2AInterface () |
| Standard destructor. | |
| virtual nsapi_error_t | set_credentials (const char *apn=0, const char *username=0, const char *password=0) |
| Set the cellular network credentials. | |
| virtual nsapi_error_t | connect (const char *apn, const char *username=0, const char *password=0) |
| Connect to the network. | |
| virtual nsapi_error_t | connect () |
| Connect to the network (no parameters) | |
| virtual nsapi_error_t | disconnect () |
| disconnect from the network | |
| virtual const char * | get_ip_address () |
| Get the IP address of WNC device. | |
| const char * | get_my_ip_address () |
| Get the network assigned IP address. | |
| virtual const char * | get_mac_address () |
| Get the MAC address of the WNC device. | |
| void | sms_attach (void(*callback)(IOTSMS *)) |
| Attach a callback function for when a SMS is recevied. | |
| void | doDebug (int v) |
| Set the level of Debug output. | |
| const char * | getWNCRev (void) |
| Return the WNC reported Firmware Revision. | |
| bool | registered () |
| Query registered state of WNC. | |
| void | sms_start (void) |
| Start the SMS monitoring service. | |
| void | sms_listen (uint16_t=1000) |
| start listening for incomming SMS messages | |
| int | getSMS (IOTSMS **msg) |
| retrieve a SMS message | |
| int | sendIOTSms (const string &, const string &) |
| send a SMS message | |
| char * | getSMSnbr () |
| return this devices SMS number | |
Protected Member Functions | |
| virtual nsapi_error_t | gethostbyname (const char *name, SocketAddress *address, nsapi_version_t version) |
| Get Host IP by name. | |
| virtual NetworkStack * | get_stack () |
| return a pointer to the NetworkStack object | |
| 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_accept (nsapi_socket_t server, nsapi_socket_t *handle, SocketAddress *address=0) |
| Accept a new connection. | |
| virtual int | socket_connect (void *handle, const SocketAddress &address) |
| Connects this socket to the server. | |
| 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 packet remote endpoint. | |
| virtual void | socket_attach (void *handle, void(*callback)(void *), void *data) |
| Register a callback on state change of the socket. | |
| uint16_t | wnc14a2a_chk_error (void) |
| get the status of internal errors | |
Friends | |
| class | WncControllerK64F |
| WncController Class for interacting with the 14A2a hardware. | |
Detailed Description
WNC14A2AInterface class Implementation of the NetworkInterface for WNC14A2A.
Definition at line 207 of file WNC14A2AInterface.h.
Constructor & Destructor Documentation
| WNC14A2AInterface | ( | WNCDebug * | _dbgUart = NULL ) |
WNC14A2AInterface Constructor.
- Parameters:
-
optionally include a pointer to WNCDEBUG object for debug information to be displayed.
Definition at line 153 of file WNC14A2AInterface.cpp.
| ~WNC14A2AInterface | ( | ) | [virtual] |
Standard destructor.
Definition at line 180 of file WNC14A2AInterface.cpp.
Member Function Documentation
| nsapi_error_t connect | ( | const char * | apn, |
| const char * | username = 0, |
||
| const char * | password = 0 |
||
| ) | [virtual] |
Connect to the network.
- Parameters:
-
apn Optional, APN of network user Optional, username --not used-- pass Optional, password --not used--
- Returns:
- nsapi_error_t
associations for the controller class to use. Order of pins is critical.
Definition at line 326 of file WNC14A2AInterface.cpp.
| nsapi_error_t connect | ( | void | ) | [virtual] |
Connect to the network (no parameters)
- Returns:
- nsapi_error_t
Definition at line 320 of file WNC14A2AInterface.cpp.
| nsapi_error_t disconnect | ( | void | ) | [virtual] |
disconnect from the network
provided for completness, but function does nothing becase WNC part can not disconnect from network once connected.
- Returns:
- nsapi_error_t
Definition at line 452 of file WNC14A2AInterface.cpp.
| void doDebug | ( | int | v ) |
Set the level of Debug output.
- Parameters:
-
bit field basic AT command info= 0x01 more AT command info = 0x02 mbed driver info = 0x04 dump buffers = 0x08 all debug = 0x0f
Definition at line 499 of file WNC14A2AInterface.cpp.
| const char * get_ip_address | ( | void | ) | [virtual] |
Get the IP address of WNC device.
From NetworkStack Class
- Returns:
- IP address string or null
Definition at line 403 of file WNC14A2AInterface.cpp.
| const char * get_mac_address | ( | void | ) | [virtual] |
Get the MAC address of the WNC device.
- Returns:
- MAC address of the interface
Definition at line 425 of file WNC14A2AInterface.cpp.
| const char* get_my_ip_address | ( | ) |
Get the network assigned IP address.
- Returns:
- IP address or null
| NetworkStack * get_stack | ( | ) | [protected, virtual] |
return a pointer to the NetworkStack object
- Returns:
- The underlying NetworkStack object
Definition at line 447 of file WNC14A2AInterface.cpp.
| nsapi_error_t gethostbyname | ( | const char * | name, |
| SocketAddress * | address, | ||
| nsapi_version_t | version | ||
| ) | [protected, virtual] |
| int getSMS | ( | IOTSMS ** | msg ) |
retrieve a SMS message
- Parameters:
-
pointer to an array of IOTSMS messages
Definition at line 269 of file WNC14A2AInterface.cpp.
| char * getSMSnbr | ( | void | ) |
return this devices SMS number
The IOTSMS number used, isn't phone number, it is device ICCID.
- Returns:
- this devices IOTSMS number
Definition at line 190 of file WNC14A2AInterface.cpp.
| const char * getWNCRev | ( | void | ) |
Return the WNC reported Firmware Revision.
- Parameters:
-
none.
Definition at line 392 of file WNC14A2AInterface.cpp.
| bool registered | ( | ) |
Query registered state of WNC.
- Returns:
- true if registerd, false if not
Definition at line 479 of file WNC14A2AInterface.cpp.
| int sendIOTSms | ( | const string & | number, |
| const string & | message | ||
| ) |
send a SMS message
- Parameters:
-
a string containing number to send message to a string containing message to send
- Returns:
- true on success, 0 on failure
Definition at line 299 of file WNC14A2AInterface.cpp.
| nsapi_error_t set_credentials | ( | const char * | apn = 0, |
| const char * | username = 0, |
||
| const char * | password = 0 |
||
| ) | [virtual] |
Set the cellular network credentials.
- Parameters:
-
apn Optional, APN of network user Optional, username --not used-- pass Optional, password --not used--
- Returns:
- nsapi_error_t
Definition at line 458 of file WNC14A2AInterface.cpp.
| void sms_attach | ( | void(*)(IOTSMS *) | callback ) |
Attach a callback function for when a SMS is recevied.
- Parameters:
-
function pointer to call
Definition at line 214 of file WNC14A2AInterface.cpp.
| void sms_listen | ( | uint16_t | pp = 1000 ) |
start listening for incomming SMS messages
- Parameters:
-
time in msec to check
Definition at line 227 of file WNC14A2AInterface.cpp.
| void sms_start | ( | void | ) |
Start the SMS monitoring service.
Definition at line 220 of file WNC14A2AInterface.cpp.
| int socket_accept | ( | nsapi_socket_t | server, |
| nsapi_socket_t * | handle, | ||
| SocketAddress * | address = 0 |
||
| ) | [protected, virtual] |
Accept a new connection.
NOT SUPPORTED
- Returns:
- NSAPI_ERROR_UNSUPPORTED;
Definition at line 749 of file WNC14A2AInterface.cpp.
| void socket_attach | ( | void * | handle, |
| void(*)(void *) | callback, | ||
| void * | data | ||
| ) | [protected, virtual] |
Register a callback on state change of the socket.
- Parameters:
-
handle Socket handle callback Function to call on state change data Argument to pass to callback
- Note:
- Callback may be called in an interrupt context.
Definition at line 703 of file WNC14A2AInterface.cpp.
| int socket_bind | ( | void * | handle, |
| const SocketAddress & | address | ||
| ) | [protected, virtual] |
Bind a server socket to a specific port.
Bind the socket to a specific port
- Parameters:
-
handle Socket handle address address to listen for
- Returns:
- 0;
Definition at line 756 of file WNC14A2AInterface.cpp.
| int socket_close | ( | void * | handle ) | [protected, virtual] |
Close the socket.
- Parameters:
-
handle Socket handle
- Returns:
- 0 on success, negative on failure
Definition at line 662 of file WNC14A2AInterface.cpp.
| int socket_connect | ( | void * | handle, |
| const SocketAddress & | address | ||
| ) | [protected, virtual] |
Connects this socket to the server.
- Parameters:
-
handle Socket handle address SocketAddress
- Returns:
- 0 on success, negative on failure
Definition at line 631 of file WNC14A2AInterface.cpp.
| int socket_listen | ( | void * | handle, |
| int | backlog | ||
| ) | [protected, virtual] |
Start listening for incoming connections.
NOT SUPPORTED
- Parameters:
-
handle Socket handle backlog Number of pending connections that can be queued up at any one time [Default: 1]
- Returns:
- NSAPI_ERROR_UNSUPPORTED;
- Note:
- This function causes the receive time-out to be ignored resulting in continuous monitoring of received data. This is non-standard behaviour but it is how the mbed-cloud servcies use it...
Definition at line 766 of file WNC14A2AInterface.cpp.
| int socket_open | ( | void ** | handle, |
| nsapi_protocol_t | proto | ||
| ) | [protected, virtual] |
Open a socket.
- Parameters:
-
handle Handle in which to store new socket proto Type of socket to open, NSAPI_TCP or NSAPI_UDP
- Returns:
- 0 on success, negative on failure
Definition at line 596 of file WNC14A2AInterface.cpp.
| int socket_recv | ( | void * | handle, |
| void * | data, | ||
| unsigned | size | ||
| ) | [protected, virtual] |
Receive data from the remote host.
- Parameters:
-
handle Socket handle data buffer to store the recived data size bytes to receive
- Returns:
- received bytes received, negative on failure
- Note:
- This call is not-blocking
Definition at line 850 of file WNC14A2AInterface.cpp.
| int socket_recvfrom | ( | void * | handle, |
| SocketAddress * | address, | ||
| void * | buffer, | ||
| unsigned | size | ||
| ) | [protected, virtual] |
Receive packet remote endpoint.
- Parameters:
-
handle Socket handle address SocketAddress buffer buffer to store data to size number of bytes to receive
- Returns:
- the number bytes received or negative on failure
- Note:
- This call is not-blocking.
Definition at line 729 of file WNC14A2AInterface.cpp.
| int socket_send | ( | void * | handle, |
| const void * | data, | ||
| unsigned | size | ||
| ) | [protected, virtual] |
Send data to the remote host.
- Parameters:
-
handle Socket handle data buffer to send size length of buffer
- Returns:
- Number of bytes written or negative on failure
- Note:
- This call is blocking.
Definition at line 774 of file WNC14A2AInterface.cpp.
| int socket_sendto | ( | void * | handle, |
| const SocketAddress & | address, | ||
| const void * | data, | ||
| unsigned | size | ||
| ) | [protected, virtual] |
Send a packet to a remote endpoint.
- Parameters:
-
handle Socket handle address SocketAddress data data to send size number of bytes to send
- Returns:
- the number of bytes sent or negative on failure
- Note:
- This call is blocking.
Definition at line 712 of file WNC14A2AInterface.cpp.
| uint16_t wnc14a2a_chk_error | ( | void | ) | [protected] |
get the status of internal errors
Called after any WNC14A2A operation to determine error specifics
- Parameters:
-
none.
Definition at line 462 of file WNC14A2AInterface.h.
Friends And Related Function Documentation
friend class WncControllerK64F [friend] |
WncController Class for interacting with the 14A2a hardware.
Definition at line 467 of file WNC14A2AInterface.h.
Generated on Tue Jul 12 2022 17:09:12 by
1.7.2