takashi kadono / Mbed OS Nucleo_446

Dependencies:   ssd1331

Embed: (wiki syntax)

« Back to documentation index

AT_CellularStack Class Reference

Class AT_CellularStack. More...

#include <AT_CellularStack.h>

Inherits NetworkStack, and mbed::AT_CellularBase.

Inherited by GEMALTO_CINTERION_CellularStack, QUECTEL_BC95_CellularStack, QUECTEL_BG96_CellularStack, UBLOX_AT_CellularStack, my_stack, and MyStack.

Public Types

typedef mbed::Callback< void(nsapi_error_t
result, SocketAddress *address) 
hostbyname_cb_t )
 Hostname translation callback (asynchronous)
enum  SupportedFeature
 

Cellular module need to define an array of unsupported features if any, by default all features are supported.

More...

Public Member Functions

virtual const char * get_ip_address ()
 NetworkStack.
virtual nsapi_error_t gethostbyname (const char *host, SocketAddress *address, nsapi_version_t version=NSAPI_UNSPEC)
 Translates a hostname to an IP address with specific version.
virtual nsapi_value_or_error_t gethostbyname_async (const char *host, hostbyname_cb_t callback, nsapi_version_t version=NSAPI_UNSPEC)
 Translates a hostname to an IP address (asynchronous)
virtual nsapi_error_t gethostbyname_async_cancel (int id)
 Cancels asynchronous hostname translation.
virtual nsapi_error_t add_dns_server (const SocketAddress &address)
 Add a domain name server to list of servers to query.
virtual nsapi_error_t get_dns_server (int index, SocketAddress *address)
 Get a domain name server from a list of servers to query.
virtual OnboardNetworkStackonboardNetworkStack ()
 Dynamic downcast to a OnboardNetworkStack.
ATHandlerget_at_handler ()
 Getter for at handler.
device_err_t get_device_error () const
 Gets the device error that happened when using AT commands/responses.

Protected Member Functions

virtual nsapi_error_t socket_stack_init ()
 Modem specific socket stack initialization.
virtual int get_max_socket_count ()=0
 Gets maximum number of sockets modem supports.
virtual bool is_protocol_supported (nsapi_protocol_t protocol)=0
 Checks if modem supports the given protocol.
virtual nsapi_error_t socket_close_impl (int sock_id)=0
 Implements modem specific AT command set for socket closing.
virtual nsapi_error_t create_socket_impl (CellularSocket *socket)=0
 Implements modem specific AT command set for creating socket.
virtual nsapi_size_or_error_t socket_sendto_impl (CellularSocket *socket, const SocketAddress &address, const void *data, nsapi_size_t size)=0
 Implements modem specific AT command set for sending data.
virtual nsapi_size_or_error_t socket_recvfrom_impl (CellularSocket *socket, SocketAddress *address, void *buffer, nsapi_size_t size)=0
 Implements modem specific AT command set for receiving data.

Static Protected Attributes

static const SupportedFeature_unsupported_features
 Check if some functionality is supported by a cellular module.

Friends

class InternetSocket
class UDPSocket
class TCPSocket

Detailed Description

Class AT_CellularStack.

Implements NetworkStack and introduces interface for modem specific stack implementations.

Definition at line 37 of file AT_CellularStack.h.


Member Typedef Documentation

typedef mbed::Callback<void (nsapi_error_t result, SocketAddress *address) hostbyname_cb_t) [inherited]

Hostname translation callback (asynchronous)

Callback will be called after DNS resolution completes or a failure occurs.

Callback should not take more than 10ms to execute, otherwise it might prevent underlying thread processing. A portable user of the callback should not make calls to network operations due to stack size limitations. The callback should not perform expensive operations such as socket recv/send calls or blocking operations.

Parameters:
status0 on success, negative error code on failure
addressOn success, destination for the host SocketAddress

Definition at line 78 of file NetworkStack.h.


Member Enumeration Documentation

enum SupportedFeature [inherited]

Cellular module need to define an array of unsupported features if any, by default all features are supported.

Parameters:
featuresArray of type SupportedFeature with last element FEATURE_END_MARK

Definition at line 50 of file AT_CellularBase.h.


Member Function Documentation

nsapi_error_t add_dns_server ( const SocketAddress &  address ) [virtual, inherited]

Add a domain name server to list of servers to query.

Parameters:
addressDestination for the host address
Returns:
0 on success, negative error code on failure

Definition at line 93 of file NetworkStack.cpp.

virtual nsapi_error_t create_socket_impl ( CellularSocket *  socket ) [protected, pure virtual]

Implements modem specific AT command set for creating socket.

Parameters:
socketCellular socket handle
ATHandler & get_at_handler (  ) [inherited]

Getter for at handler.

Common method for all AT-classes.

Returns:
reference to ATHandler

Definition at line 27 of file AT_CellularBase.cpp.

device_err_t get_device_error (  ) const [inherited]

Gets the device error that happened when using AT commands/responses.

This is at error returned by the device. Returned CME/CMS errors can be found from 3gpp documents 27007 and 27005.

Returns:
at error (CME/CMS) while communicating with the device

Definition at line 32 of file AT_CellularBase.cpp.

nsapi_error_t get_dns_server ( int  index,
SocketAddress *  address 
) [virtual, inherited]

Get a domain name server from a list of servers to query.

Returns a DNS server address for a index. If returns error no more DNS servers to read.

Parameters:
indexIndex of the DNS server, starts from zero
addressDestination for the host address
Returns:
0 on success, negative error code on failure

Definition at line 98 of file NetworkStack.cpp.

const char * get_ip_address (  ) [virtual]

NetworkStack.

Definition at line 47 of file AT_CellularStack.cpp.

virtual int get_max_socket_count (  ) [protected, pure virtual]

Gets maximum number of sockets modem supports.

nsapi_error_t gethostbyname ( const char *  host,
SocketAddress *  address,
nsapi_version_t  version = NSAPI_UNSPEC 
) [virtual, inherited]

Translates a hostname to an IP address with specific version.

The hostname may be either a domain name or an IP address. If the hostname is an IP address, no network transactions will be performed.

If no stack-specific DNS resolution is provided, the hostname will be resolve using a UDP socket on the stack.

Parameters:
hostHostname to resolve
addressDestination for the host SocketAddress
versionIP version of address to resolve, NSAPI_UNSPEC indicates version is chosen by the stack (defaults to NSAPI_UNSPEC)
Returns:
0 on success, negative error code on failure

Definition at line 29 of file NetworkStack.cpp.

nsapi_value_or_error_t gethostbyname_async ( const char *  host,
hostbyname_cb_t  callback,
nsapi_version_t  version = NSAPI_UNSPEC 
) [virtual, inherited]

Translates a hostname to an IP address (asynchronous)

The hostname may be either a domain name or an IP address. If the hostname is an IP address, no network transactions will be performed.

If no stack-specific DNS resolution is provided, the hostname will be resolve using a UDP socket on the stack.

Call is non-blocking. Result of the DNS operation is returned by the callback. If this function returns failure, callback will not be called. In case result is success (IP address was found from DNS cache), callback will be called before function returns.

Parameters:
hostHostname to resolve
callbackCallback that is called for result
versionIP version of address to resolve, NSAPI_UNSPEC indicates version is chosen by the stack (defaults to NSAPI_UNSPEC)
Returns:
0 on immediate success, negative error code on immediate failure or a positive unique id that represents the hostname translation operation and can be passed to cancel

Definition at line 56 of file NetworkStack.cpp.

nsapi_error_t gethostbyname_async_cancel ( int  id ) [virtual, inherited]

Cancels asynchronous hostname translation.

When translation is cancelled, callback will not be called.

Parameters:
idUnique id of the hostname translation operation
Returns:
0 on success, negative error code on failure

Definition at line 88 of file NetworkStack.cpp.

virtual bool is_protocol_supported ( nsapi_protocol_t  protocol ) [protected, pure virtual]

Checks if modem supports the given protocol.

Parameters:
protocolProtocol type
virtual OnboardNetworkStack* onboardNetworkStack (  ) [virtual, inherited]

Dynamic downcast to a OnboardNetworkStack.

Definition at line 164 of file NetworkStack.h.

virtual nsapi_error_t socket_close_impl ( int  sock_id ) [protected, pure virtual]

Implements modem specific AT command set for socket closing.

Parameters:
sock_idSocket id
virtual nsapi_size_or_error_t socket_recvfrom_impl ( CellularSocket *  socket,
SocketAddress *  address,
void *  buffer,
nsapi_size_t  size 
) [protected, pure virtual]

Implements modem specific AT command set for receiving data.

Parameters:
socketSocket handle
addressDestination for the source address or NULL
bufferDestination buffer for data received from the host
sizeSize of the buffer in bytes
Returns:
Number of received bytes on success, negative error code on failure
virtual nsapi_size_or_error_t socket_sendto_impl ( CellularSocket *  socket,
const SocketAddress &  address,
const void *  data,
nsapi_size_t  size 
) [protected, pure virtual]

Implements modem specific AT command set for sending data.

Parameters:
socketCellular socket handle
addressThe SocketAddress of the remote host
dataBuffer of data to send to the host
sizeSize of the buffer in bytes
Returns:
Number of sent bytes on success, negative error code on failure
nsapi_error_t socket_stack_init (  ) [protected, virtual]

Modem specific socket stack initialization.

Returns:
0 on success

Definition at line 85 of file AT_CellularStack.cpp.


Field Documentation

AT_CellularBase::SupportedFeature const * _unsupported_features [static, protected, inherited]

Check if some functionality is supported by a cellular module.

For example, most of standard AT commands are optional and not implemented by all cellular modules.

Parameters:
featurecheck for feature to support
Returns:
true on supported, otherwise false

Definition at line 67 of file AT_CellularBase.h.