Mbed OS Reference
|
Socket implementation for cellular Non-IP data delivery(NIDD). More...
#include <CellularNonIPSocket.h>
Public Member Functions | |
~CellularNonIPSocket () override | |
Destroy the socket. More... | |
CellularNonIPSocket () | |
Creates a socket. More... | |
nsapi_error_t | open (mbed::CellularContext *cellular_context) |
Opens a socket on the given cellular context. More... | |
nsapi_error_t | open (mbed::ControlPlane_netif *cp_netif) |
Opens a socket that will use the given control plane interface for data delivery. More... | |
nsapi_error_t | close () override |
Closes socket. More... | |
nsapi_size_or_error_t | send (const void *data, nsapi_size_t size) override |
Send data over a control plane cellular context. More... | |
nsapi_size_or_error_t | recv (void *data, nsapi_size_t size) override |
Receive data from a socket. More... | |
void | set_blocking (bool blocking) override |
Set blocking or non-blocking mode of the socket. More... | |
void | set_timeout (int timeout) override |
Set timeout on blocking socket operations. More... | |
void | sigio (mbed::Callback< void()> func) override |
Register a callback on state change of the socket. More... | |
nsapi_error_t | connect (const SocketAddress &address) override |
NOT APPLICABLE. More... | |
Socket * | accept (nsapi_error_t *error=NULL) override |
NOT APPLICABLE. More... | |
nsapi_error_t | listen (int backlog=1) override |
NOT APPLICABLE. More... | |
nsapi_error_t | setsockopt (int level, int optname, const void *optval, unsigned optlen) override |
NOT APPLICABLE. More... | |
nsapi_error_t | getsockopt (int level, int optname, void *optval, unsigned *optlen) override |
NOT APPLICABLE. More... | |
nsapi_error_t | getpeername (SocketAddress *address) override |
NOT APPLICABLE. More... | |
nsapi_size_or_error_t | sendto (const SocketAddress &address, const void *data, nsapi_size_t size) override |
NOT APPLICABLE. More... | |
nsapi_size_or_error_t | recvfrom (SocketAddress *address, void *data, nsapi_size_t size) override |
NOT APPLICABLE. More... | |
nsapi_size_or_error_t | sendto_control (const SocketAddress &address, const void *data, nsapi_size_t size, nsapi_msghdr_t *control, nsapi_size_t control_size) override |
NOT APPLICABLE. More... | |
nsapi_size_or_error_t | recvfrom_control (SocketAddress *address, void *data, nsapi_size_t size, nsapi_msghdr_t *control, nsapi_size_t control_size) override |
NOT APPLICABLE. More... | |
nsapi_error_t | bind (const SocketAddress &address) override |
NOT APPLICABLE. More... | |
Socket implementation for cellular Non-IP data delivery(NIDD).
Relies on Control Plane CIoT EPS optimization feature, implemented in ControlPlane_netif class.
Definition at line 39 of file CellularNonIPSocket.h.
|
override |
Destroy the socket.
Creates a socket.
nsapi_error_t open | ( | mbed::CellularContext * | cellular_context | ) |
Opens a socket on the given cellular context.
cellular_context | Cellular PDP context over which this socket is sending and receiving data. The context has support for providing a control plane interface for data delivery. |
nsapi_error_t open | ( | mbed::ControlPlane_netif * | cp_netif | ) |
Opens a socket that will use the given control plane interface for data delivery.
Attaches the event as callback to the control plane interface.
cp_netif | Control plane interface for data delivery. |
|
overridevirtual |
|
overridevirtual |
Send data over a control plane cellular context.
By default, send blocks until all data is sent. If socket is set to nonblocking or times out, a partial amount can be written. NSAPI_ERROR_WOULD_BLOCK is returned if no data was written.
data | Buffer of data to be sent. |
size | Size of the buffer in bytes. |
Implements Socket.
|
overridevirtual |
Receive data from a socket.
By default, recv blocks until some data is received. If socket is set to nonblocking or times out, NSAPI_ERROR_WOULD_BLOCK can be returned to indicate no data.
data | Pointer to buffer for received data. |
size | Size of the buffer in bytes. |
Implements Socket.
|
overridevirtual |
Set blocking or non-blocking mode of the socket.
Initially all sockets are in blocking mode. In non-blocking mode blocking operations such as send/recv/accept return NSAPI_ERROR_WOULD_BLOCK if they cannot continue.
set_blocking(false) is equivalent to set_timeout(0) set_blocking(true) is equivalent to set_timeout(-1)
blocking | true for blocking mode, false for non-blocking mode. |
Implements Socket.
|
overridevirtual |
Set timeout on blocking socket operations.
Initially all sockets have unbounded timeouts. NSAPI_ERROR_WOULD_BLOCK is returned if a blocking operation takes longer than the specified timeout. A timeout of 0 removes the timeout from the socket. A negative value gives the socket an unbounded timeout.
set_timeout(0) is equivalent to set_blocking(false) set_timeout(-1) is equivalent to set_blocking(true)
timeout | Timeout in milliseconds |
Implements Socket.
|
overridevirtual |
Register a callback on state change of the socket.
The specified callback is called on state changes, such as when the socket can receive/send/accept successfully and when an error occurs. The callback may also be called spuriously without reason.
The callback may be called in an interrupt context and should not perform expensive operations such as receive/send calls.
Note! This is not intended as a replacement for a poll or attach-like asynchronous API, but rather as a building block for constructing such functionality. The exact timing of the registered function is not guaranteed and susceptible to change.
func | Function to call on state change. |
Implements Socket.
|
overridevirtual |
NOT APPLICABLE.
Implements Socket.
|
overridevirtual |
NOT APPLICABLE.
Implements Socket.
|
overridevirtual |
NOT APPLICABLE.
Implements Socket.
|
overridevirtual |
NOT APPLICABLE.
Implements Socket.
|
overridevirtual |
NOT APPLICABLE.
Implements Socket.
|
overridevirtual |
NOT APPLICABLE.
Implements Socket.
|
overridevirtual |
NOT APPLICABLE.
Implements Socket.
|
overridevirtual |
NOT APPLICABLE.
Implements Socket.
|
overridevirtual |
NOT APPLICABLE.
Implements Socket.
|
overridevirtual |
NOT APPLICABLE.
Implements Socket.
|
overridevirtual |
NOT APPLICABLE.
Implements Socket.