Denislam Valeev / Mbed OS Nucleo_rtos_basic
Embed: (wiki syntax)

« Back to documentation index

AT_CellularNetwork Class Reference

AT_CellularNetwork Class Reference

Class AT_CellularNetwork. More...

#include <AT_CellularNetwork.h>

Inherits mbed::CellularNetwork, and mbed::AT_CellularBase.

Inherited by QUECTEL_BC95_CellularNetwork, QUECTEL_BG96_CellularNetwork, TELIT_HE910_CellularNetwork, UBLOX_LISA_U_CellularNetwork, and my_AT_CN.

Public Member Functions

virtual nsapi_error_t set_credentials (const char *apn, const char *username=0, const char *password=0)
 Set the cellular network APN and credentials.
virtual nsapi_error_t connect (const char *apn, const char *username=0, const char *password=0)
 Start the interface.
virtual nsapi_error_t connect ()
 Start the interface.
virtual nsapi_error_t disconnect ()
 User initiated disconnect.
virtual nsapi_error_t set_registration (const char *plmn=0)
 Request registering to network.
virtual nsapi_error_t set_attach (int timeout=10 *1000)
 Request attach to network.
virtual nsapi_error_t get_attach (AttachStatus &status)
 Request attach status from network.
virtual nsapi_error_t get_rate_control (CellularNetwork::RateControlExceptionReports &reports, CellularNetwork::RateControlUplinkTimeUnit &time_unit, int &uplink_rate)
 Get APN rate control.
virtual nsapi_error_t get_apn_backoff_timer (int &backoff_timer)
 Get backoff timer value.
virtual nsapi_error_t scan_plmn (operList_t &operators, int &ops_count)
 Scans for operators module can reach.
virtual nsapi_error_t set_ciot_optimization_config (Supported_UE_Opt supported_opt, Preferred_UE_Opt preferred_opt)
 Set CIoT optimizations.
virtual nsapi_error_t get_ciot_optimization_config (Supported_UE_Opt &supported_opt, Preferred_UE_Opt &preferred_opt)
 Get CIoT optimizations.
virtual nsapi_error_t set_stack_type (nsapi_ip_stack_t stack_type)
 Set the pdn type to be used.
virtual nsapi_ip_stack_t get_stack_type ()
 Get the pdn type in use.
virtual nsapi_error_t get_pdpcontext_params (pdpContextList_t &params_list)
 Get the relevant information for an active non secondary PDP context.
virtual nsapi_error_t get_extended_signal_quality (int &rxlev, int &ber, int &rscp, int &ecno, int &rsrq, int &rsrp)
 Get extended signal quality parameters.
virtual nsapi_error_t get_signal_quality (int &rssi, int &ber)
 Get signal quality parameters.
virtual nsapi_error_t get_cell_id (int &cell_id)
 Get cell id.
virtual int get_3gpp_error ()
 Get the last 3GPP error code.
virtual nsapi_error_t get_operator_params (int &format, operator_t &operator_params)
 Get the operator parameters.
virtual nsapi_error_t get_registration_status (RegistrationType type, RegistrationStatus &status)=0
 Gets the network registration status.
virtual nsapi_error_t set_credentials (const char *apn, AuthenticationType type, const char *username=0, const char *password=0)=0
 Set the cellular network APN and credentials.
virtual nsapi_error_t set_access_technology (operator_t::RadioAccessTechnology op_rat)=0
 Sets radio access technology.
virtual const char * get_mac_address ()
 Get the local MAC address.
virtual const char * get_netmask ()
 Get the local network mask.
virtual const char * get_gateway ()
 Get the local gateway.
virtual nsapi_error_t set_network (const char *ip_address, const char *netmask, const char *gateway)
 Set a static IP address.
virtual nsapi_error_t set_dhcp (bool dhcp)
 Enable or disable DHCP on the network.
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_error_t add_dns_server (const SocketAddress &address)
 Add a domain name server to list of servers to query.
virtual void attach (mbed::Callback< void(nsapi_event_t, intptr_t)> status_cb)
 Register callback for status reporting.
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 bool get_modem_stack_type (nsapi_ip_stack_t requested_stack)
 Check if modem supports the given stack type.
virtual bool has_registration (RegistrationType reg_type)
 Check if modem supports given registration type.
virtual nsapi_error_t set_access_technology_impl (operator_t::RadioAccessTechnology op_rat)
 Sets access technology to be scanned.

Friends

class Socket
class UDPSocket
class TCPSocket

Detailed Description

Class AT_CellularNetwork.

Class for connecting to a network and getting information from it.

Definition at line 34 of file AT_CellularNetwork.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 60 of file NetworkInterface_stub.cpp.

void attach ( mbed::Callback< void(nsapi_event_t, intptr_t)>  status_cb ) [virtual, inherited]

Register callback for status reporting.

The specified status callback function will be called on status changes on the network. The parameters on the callback are the event type and event-type dependent reason parameter.

Parameters:
status_cbThe callback for status changes

Definition at line 65 of file NetworkInterface_stub.cpp.

nsapi_error_t connect (  ) [virtual]

Start the interface.

Attempts to connect to a cellular network.

Returns:
0 on success, negative error code on failure

Implements CellularNetwork.

Definition at line 151 of file AT_CellularNetwork.cpp.

nsapi_error_t connect ( const char *  apn,
const char *  username = 0,
const char *  password = 0 
) [virtual]

Start the interface.

Attempts to connect to a cellular network.

Parameters:
apnOptional name of the network to connect to
usernameOptional username for your APN
passwordOptional password for your APN
Returns:
0 on success, negative error code on failure

Implements CellularNetwork.

Definition at line 123 of file AT_CellularNetwork.cpp.

nsapi_error_t disconnect (  ) [virtual]

User initiated disconnect.

Disconnects from PPP connection only and brings down the underlying network interface

Definition at line 263 of file AT_CellularNetwork.cpp.

int get_3gpp_error (  ) [virtual]

Get the last 3GPP error code.

Returns:
see 3GPP TS 27.007 error codes

Implements CellularNetwork.

Definition at line 1033 of file AT_CellularNetwork.cpp.

nsapi_error_t get_apn_backoff_timer ( int &  backoff_timer ) [virtual]

Get backoff timer value.

Parameters:
backoff_timerBackoff timer value associated with PDP APN in seconds
Returns:
zero on success

Implements CellularNetwork.

Definition at line 688 of file AT_CellularNetwork.cpp.

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.

nsapi_error_t get_attach ( AttachStatus &  status ) [virtual]

Request attach status from network.

Parameters:
statussee AttachStatus values
Returns:
zero on success

Implements CellularNetwork.

Definition at line 670 of file AT_CellularNetwork.cpp.

nsapi_error_t get_cell_id ( int &  cell_id ) [virtual]

Get cell id.

Parameters:
cell_idcell id
Returns:
NSAPI_ERROR_OK on success, negative error code on failure

Implements CellularNetwork.

Definition at line 633 of file AT_CellularNetwork.cpp.

nsapi_error_t get_ciot_optimization_config ( Supported_UE_Opt &  supported_opt,
Preferred_UE_Opt &  preferred_opt 
) [virtual]

Get CIoT optimizations.

Parameters:
supported_optSupported CIoT EPS optimizations.
preferred_optPreferred CIoT EPS optimizations.
Returns:
zero on success

Implements CellularNetwork.

Definition at line 835 of file AT_CellularNetwork.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_extended_signal_quality ( int &  rxlev,
int &  ber,
int &  rscp,
int &  ecno,
int &  rsrq,
int &  rsrp 
) [virtual]

Get extended signal quality parameters.

Parameters:
rxlevsignal strength level
berbit error rate
rscpsignal code power
ecnoratio of the received energy per PN chip to the total received power spectral density
rsrqsignal received quality
rsrpsignal received power
Returns:
NSAPI_ERROR_OK on success, negative error code on failure

Implements CellularNetwork.

Definition at line 988 of file AT_CellularNetwork.cpp.

const char * get_gateway (  ) [virtual, inherited]

Get the local gateway.

Returns:
Null-terminated representation of the local gateway or null if no network mask has been recieved

Definition at line 39 of file NetworkInterface_stub.cpp.

const char * get_mac_address (  ) [virtual, inherited]

Get the local MAC address.

Provided MAC address is intended for info or debug purposes and may not be provided if the underlying network interface does not provide a MAC address

Returns:
Null-terminated representation of the local MAC address or null if no MAC address is available

Definition at line 24 of file NetworkInterface_stub.cpp.

bool get_modem_stack_type ( nsapi_ip_stack_t  requested_stack ) [protected, virtual]

Check if modem supports the given stack type.

Returns:
true if supported

Definition at line 751 of file AT_CellularNetwork.cpp.

const char * get_netmask (  ) [virtual, inherited]

Get the local network mask.

Returns:
Null-terminated representation of the local network mask or null if no network mask has been recieved

Definition at line 34 of file NetworkInterface_stub.cpp.

nsapi_error_t get_operator_params ( int &  format,
operator_t &  operator_params 
) [virtual]

Get the operator parameters.

Parameters:
formatformat of the operator field
operator_paramsapplicable operator param fields filled
Returns:
NSAPI_ERROR_OK on success, negative error code on failure

Implements CellularNetwork.

Definition at line 1039 of file AT_CellularNetwork.cpp.

nsapi_error_t get_pdpcontext_params ( pdpContextList_t params_list ) [virtual]

Get the relevant information for an active non secondary PDP context.

Remarks:
optional params are not updated if not received from network.
Parameters:
params_listreference to linked list which is filled on successful call
Returns:
0 on success, negative error code on failure

Implements CellularNetwork.

Definition at line 899 of file AT_CellularNetwork.cpp.

nsapi_error_t get_rate_control ( CellularNetwork::RateControlExceptionReports &  reports,
CellularNetwork::RateControlUplinkTimeUnit &  time_unit,
int &  uplink_rate 
) [virtual]

Get APN rate control.

Remarks:
optional params are not updated if not received from network, so use good defaults
Parameters:
reportsAdditional exception reports at maximum rate reached are allowed to be sent [optional]
time_unitUplink time unit with values 0=unrestricted, 1=minute, 2=hour, 3=day, 4=week [optional]
uplink_rateMaximum number of messages per timeUnit [optional]
Returns:
zero on success

Implements CellularNetwork.

Definition at line 855 of file AT_CellularNetwork.cpp.

virtual nsapi_error_t get_registration_status ( RegistrationType  type,
RegistrationStatus &  status 
) [pure virtual, inherited]

Gets the network registration status.

Parameters:
typesee RegistrationType values
statussee RegistrationStatus values
Returns:
zero on success
nsapi_error_t get_signal_quality ( int &  rssi,
int &  ber 
) [virtual]

Get signal quality parameters.

Parameters:
rssisignal strength level
berbit error rate
Returns:
NSAPI_ERROR_OK on success, negative error code on failure

Implements CellularNetwork.

Definition at line 1011 of file AT_CellularNetwork.cpp.

nsapi_ip_stack_t get_stack_type (  ) [virtual]

Get the pdn type in use.

Returns:
stack type

Implements CellularNetwork.

Definition at line 746 of file AT_CellularNetwork.cpp.

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:
addressDestination for the host SocketAddress
hostHostname to resolve
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 55 of file NetworkInterface_stub.cpp.

virtual bool has_registration ( RegistrationType  reg_type ) [protected, virtual]

Check if modem supports given registration type.

Parameters:
reg_typeenum RegistrationType
Returns:
true if given registration type is supported by modem
nsapi_error_t scan_plmn ( operList_t operators,
int &  ops_count 
) [virtual]

Scans for operators module can reach.

Parameters:
operatorsContainer of reachable operators and their access technologies
ops_countNumber of found operators
Returns:
zero on success

Implements CellularNetwork.

Definition at line 776 of file AT_CellularNetwork.cpp.

virtual nsapi_error_t set_access_technology ( operator_t::RadioAccessTechnology  op_rat ) [pure virtual, inherited]

Sets radio access technology.

Parameters:
op_ratRadio access technology
Returns:
zero on success
nsapi_error_t set_access_technology_impl ( operator_t::RadioAccessTechnology  op_rat ) [protected, virtual]

Sets access technology to be scanned.

Modem specific implementation.

Parameters:
op_ratAccess technology
Returns:
zero on success

Definition at line 760 of file AT_CellularNetwork.cpp.

nsapi_error_t set_attach ( int  timeout = 10 *1000 ) [virtual]

Request attach to network.

Parameters:
timeoutmilliseconds to wait for attach response
Returns:
zero on success

Implements CellularNetwork.

Definition at line 650 of file AT_CellularNetwork.cpp.

nsapi_error_t set_ciot_optimization_config ( Supported_UE_Opt  supported_opt,
Preferred_UE_Opt  preferred_opt 
) [virtual]

Set CIoT optimizations.

Parameters:
supported_optSupported CIoT EPS optimizations.
preferred_optPreferred CIoT EPS optimizations.
Returns:
zero on success

Implements CellularNetwork.

Definition at line 818 of file AT_CellularNetwork.cpp.

virtual nsapi_error_t set_credentials ( const char *  apn,
AuthenticationType  type,
const char *  username = 0,
const char *  password = 0 
) [pure virtual, inherited]

Set the cellular network APN and credentials.

Parameters:
apnName of the network to connect to
typeAuthentication type to use
usernameOptional username for the APN
passwordOptional password fot the APN
Returns:
0 on success, negative error code on failure
nsapi_error_t set_credentials ( const char *  apn,
const char *  username = 0,
const char *  password = 0 
) [virtual]

Set the cellular network APN and credentials.

Parameters:
apnOptional name of the network to connect to
usernameOptional username for the APN
passwordOptional password fot the APN
Returns:
0 on success, negative error code on failure

Implements CellularNetwork.

Definition at line 76 of file AT_CellularNetwork.cpp.

nsapi_error_t set_dhcp ( bool  dhcp ) [virtual, inherited]

Enable or disable DHCP on the network.

Enables DHCP on connecting the network. Defaults to enabled unless a static IP address has been assigned. Requires that the network is disconnected.

Parameters:
dhcpTrue to enable DHCP
Returns:
0 on success, negative error code on failure

Definition at line 49 of file NetworkInterface_stub.cpp.

nsapi_error_t set_network ( const char *  ip_address,
const char *  netmask,
const char *  gateway 
) [virtual, inherited]

Set a static IP address.

Configures this network interface to use a static IP address. Implicitly disables DHCP, which can be enabled in set_dhcp. Requires that the network is disconnected.

Parameters:
ip_addressNull-terminated representation of the local IP address
netmaskNull-terminated representation of the local network mask
gatewayNull-terminated representation of the local gateway
Returns:
0 on success, negative error code on failure

Definition at line 44 of file NetworkInterface_stub.cpp.

nsapi_error_t set_registration ( const char *  plmn = 0 ) [virtual]

Request registering to network.

Parameters:
plmnformat is in numeric format or 0 for automatic network registration
Returns:
zero on success

Implements CellularNetwork.

Definition at line 537 of file AT_CellularNetwork.cpp.

nsapi_error_t set_stack_type ( nsapi_ip_stack_t  stack_type ) [virtual]

Set the pdn type to be used.

Parameters:
stack_typethe stack type to be used.
Returns:
NSAPI_ERROR_OK on success

Implements CellularNetwork.

Definition at line 734 of file AT_CellularNetwork.cpp.