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.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
AT_CellularDevice Class Reference
Class AT_CellularDevice. More...
#include <AT_CellularDevice.h>
Inherits mbed::CellularDevice.
Inherited by GEMALTO_CINTERION, GENERIC_AT3GPP, QUECTEL_BC95, QUECTEL_BG96, QUECTEL_EC2X, QUECTEL_M26, QUECTEL_UG96, RM1000_AT, SARA4_PPP, TELIT_HE910, TELIT_ME910, UBLOX_AT, UBLOX_N2XX, and UBLOX_PPP.
Public Member Functions | |
virtual nsapi_error_t | clear () |
Clear modem to a default initial state. | |
virtual nsapi_error_t | hard_power_on () |
Sets the modem up for powering on This is equivalent to plugging in the device, i.e., attaching power and serial port. | |
virtual nsapi_error_t | hard_power_off () |
Sets the modem in unplugged state. | |
virtual nsapi_error_t | soft_power_on () |
Powers up the modem. | |
virtual nsapi_error_t | soft_power_off () |
Powers down the modem. | |
virtual nsapi_error_t | set_pin (const char *sim_pin) |
Open the SIM card by setting the pin code for SIM. | |
virtual nsapi_error_t | get_sim_state (SimState &state) |
Get SIM card's state. | |
virtual CellularContext * | create_context (FileHandle *fh=NULL, const char *apn=NULL, bool cp_req=false, bool nonip_req=false) |
Creates a new CellularContext interface. | |
virtual CellularContext * | create_context (UARTSerial *serial, const char *const apn, PinName dcd_pin=NC, bool active_high=false, bool cp_req=false, bool nonip_req=false) |
Creates a new CellularContext interface. | |
virtual void | delete_context (CellularContext *context) |
Deletes the given CellularContext instance. | |
virtual CellularNetwork * | open_network (FileHandle *fh=NULL) |
Create new CellularNetwork interface. | |
virtual CellularInformation * | open_information (FileHandle *fh=NULL) |
Create new CellularInformation interface. | |
virtual void | close_network () |
Closes the opened CellularNetwork by deleting the CellularNetwork instance. | |
virtual void | close_information () |
Closes the opened CellularInformation by deleting the CellularInformation instance. | |
virtual void | set_timeout (int timeout) |
Set the default response timeout. | |
virtual void | modem_debug_on (bool on) |
Turn modem debug traces on. | |
virtual nsapi_error_t | init () |
Initialize cellular device must be called right after the module is ready. | |
virtual nsapi_error_t | shutdown () |
Shutdown cellular device to minimum functionality. | |
virtual nsapi_error_t | is_ready () |
Check whether the device is ready to accept commands. | |
virtual void | set_ready_cb (Callback< void()> callback) |
Set callback function to listen when device is ready. | |
virtual nsapi_error_t | set_power_save_mode (int periodic_time, int active_time=0) |
Set power save mode. | |
virtual ATHandler * | get_at_handler () |
Get the current ATHandler instance in use for debug purposes etc. | |
virtual nsapi_error_t | release_at_handler (ATHandler *at_handler) |
Releases the given at_handler. | |
virtual AT_CellularContext * | create_context_impl (ATHandler &at, const char *apn, bool cp_req=false, bool nonip_req=false) |
Creates new instance of AT_CellularContext or if overridden, modem specific implementation. | |
virtual AT_CellularNetwork * | open_network_impl (ATHandler &at) |
Create new instance of AT_CellularNetwork or if overridden, modem specific implementation. | |
virtual AT_CellularInformation * | open_information_impl (ATHandler &at) |
Create new instance of AT_CellularInformation or if overridden, modem specific implementation. | |
virtual CellularContext * | get_context_list () const |
Get the linked list of CellularContext instances. | |
virtual nsapi_error_t | set_baud_rate (int baud_rate) |
Sets cellular modem to given baud rate. | |
virtual CellularSMS * | open_sms (FileHandle *fh=NULL) |
Create new CellularSMS interface. | |
virtual void | close_sms () |
Closes the opened CellularSMS by deleting the CellularSMS instance. | |
virtual AT_CellularSMS * | open_sms_impl (ATHandler &at) |
Create new instance of AT_CellularSMS or if overridden, modem specific implementation. | |
intptr_t | get_property (CellularProperty key) |
Get value for the given key. | |
void | set_cellular_properties (const intptr_t *property_array) |
Cellular module need to define an array of cellular properties which defines module supported property values. | |
virtual events::EventQueue * | get_queue () |
Get event queue that can be chained to main event queue. | |
MBED_DEPRECATED_SINCE ("mbed-os-5.15","Use CellularDevice::shutdown() instead.") void stop() | |
Stop the current operation. | |
FileHandle & | get_file_handle () const |
Get the current FileHandle item used when communicating with the modem. | |
void | set_sim_pin (const char *sim_pin) |
Set the pin code for SIM card. | |
void | set_plmn (const char *plmn) |
Plmn to use when registering to cellular network. | |
nsapi_error_t | set_device_ready () |
Start the interface. | |
nsapi_error_t | set_sim_ready () |
Start the interface. | |
nsapi_error_t | register_to_network () |
Start the interface. | |
nsapi_error_t | attach_to_network () |
Start the interface. | |
void | attach (Callback< void(nsapi_event_t, intptr_t)> status_cb) |
Register callback for status reporting. | |
void | set_retry_timeout_array (const uint16_t timeout[], int array_len) |
Set an array of timeouts to wait before CellularStateMachine retries after failure. | |
Static Public Member Functions | |
static CellularDevice * | get_default_instance () |
Returns singleton instance of CellularDevice, if Mbed target board has a supported onboard modem, or provide-default is defined for a cellular driver in JSON configuration files. | |
static CellularDevice * | get_target_default_instance () |
Return target onboard instance of CellularDevice. | |
Protected Member Functions | |
virtual void | cellular_callback (nsapi_event_t ev, intptr_t ptr, CellularContext *ctx=NULL) |
Cellular callback to be attached to Network and CellularStateMachine classes. | |
void | get_retry_timeout_array (uint16_t *timeout, int &array_len) const |
Get the retry array from the CellularStateMachine. |
Detailed Description
Class AT_CellularDevice.
A class defines opening and closing of cellular interfaces. Deleting/Closing of opened interfaces can be done only through this class.
Definition at line 37 of file AT_CellularDevice.h.
Member Function Documentation
void attach | ( | Callback< void(nsapi_event_t, intptr_t)> | status_cb ) | [inherited] |
Register callback for status reporting.
The specified status callback function will be called on the network and cellular device status changes. The parameters on the callback are the event type and event-type dependent reason parameter.
- Remarks:
- deleting CellularDevice/CellularContext in callback not allowed.
- Allocating/adding lots of traces not recommended as callback is called mostly from State machines thread which is now 2048. You can change to main thread for example via EventQueue.
- Parameters:
-
status_cb The callback for status changes.
Definition at line 175 of file CellularDevice.cpp.
nsapi_error_t attach_to_network | ( | ) | [inherited] |
Start the interface.
Attempts to attach the device to cellular network. API is asynchronous. Application can get results from CellularContext callback, which is set with attach(...), or callback, which is set by attach(...), in this class.
- Returns:
- NSAPI_ERROR_OK on success NSAPI_ERROR_NO_MEMORY on case of memory failure
Definition at line 117 of file CellularDevice.cpp.
void cellular_callback | ( | nsapi_event_t | ev, |
intptr_t | ptr, | ||
CellularContext * | ctx = NULL |
||
) | [protected, virtual] |
Cellular callback to be attached to Network and CellularStateMachine classes.
CellularContext calls this when in PPP mode to provide network changes. This method will broadcast to every interested classes: CellularContext (might be many) and CellularStateMachine if available.
Reimplemented from CellularDevice.
Definition at line 628 of file AT_CellularDevice.cpp.
nsapi_error_t clear | ( | ) | [virtual] |
Clear modem to a default initial state.
Clear persistent user data from the modem, such as PDP contexts.
- Precondition:
- All open network services on modem, such as contexts and sockets, must be closed.
- Postcondition:
- Modem power off/on may be needed to clear modem's runtime state.
- Remarks:
- CellularStateMachine calls this on connect when `cellular.clear-on-connect: true`.
- Returns:
- NSAPI_ERROR_OK on success, otherwise modem may be need power cycling
Reimplemented from CellularDevice.
Definition at line 644 of file AT_CellularDevice.cpp.
void close_information | ( | ) | [virtual] |
Closes the opened CellularInformation by deleting the CellularInformation instance.
Implements CellularDevice.
Definition at line 424 of file AT_CellularDevice.cpp.
void close_network | ( | ) | [virtual] |
Closes the opened CellularNetwork by deleting the CellularNetwork instance.
Implements CellularDevice.
Definition at line 411 of file AT_CellularDevice.cpp.
void close_sms | ( | ) | [virtual] |
Closes the opened CellularSMS by deleting the CellularSMS instance.
Implements CellularDevice.
Definition at line 387 of file AT_CellularDevice.cpp.
CellularContext * create_context | ( | UARTSerial * | serial, |
const char *const | apn, | ||
PinName | dcd_pin = NC , |
||
bool | active_high = false , |
||
bool | cp_req = false , |
||
bool | nonip_req = false |
||
) | [virtual] |
Creates a new CellularContext interface.
This API should be used if serial is UART and PPP mode used. CellularContext created will use data carrier detect to be able to detect disconnection much faster in PPP mode. UARTSerial usually is the same which was given for the CellularDevice.
- Parameters:
-
serial UARTSerial used in communication to modem. If null then the default file handle is used. apn access point to use with context, can be null. dcd_pin Pin used to set data carrier detect on/off for the given UART active_high a boolean set to true if DCD polarity is active low cp_req Flag indicating if EPS control plane optimization is required nonip_req Flag indicating if this context is required to be Non-IP
- Returns:
- new instance of class CellularContext or NULL in case of failure
Implements CellularDevice.
Definition at line 289 of file AT_CellularDevice.cpp.
CellularContext * create_context | ( | FileHandle * | fh = NULL , |
const char * | apn = NULL , |
||
bool | cp_req = false , |
||
bool | nonip_req = false |
||
) | [virtual] |
Creates a new CellularContext interface.
- Parameters:
-
fh file handle used in communication to modem. This can be, for example, UART handle. If null, then the default file handle is used. apn access point to use with context, can be null. cp_req flag indicating if EPS control plane optimization is required nonip_req flag indicating if this context is required to be Non-IP
- Returns:
- new instance of class CellularContext or NULL in case of failure
Implements CellularDevice.
Definition at line 301 of file AT_CellularDevice.cpp.
AT_CellularContext * create_context_impl | ( | ATHandler & | at, |
const char * | apn, | ||
bool | cp_req = false , |
||
bool | nonip_req = false |
||
) | [virtual] |
Creates new instance of AT_CellularContext or if overridden, modem specific implementation.
- Parameters:
-
at ATHandler reference for communication with the modem. apn access point to use with context cp_req flag indicating if control plane EPS optimization needs to be setup nonip_req flag indicating if PDP context needs to be Non-IP
- Returns:
- new instance of class AT_CellularContext
Definition at line 321 of file AT_CellularDevice.cpp.
void delete_context | ( | CellularContext * | context ) | [virtual] |
Deletes the given CellularContext instance.
- Parameters:
-
context CellularContext to delete
Implements CellularDevice.
Definition at line 329 of file AT_CellularDevice.cpp.
ATHandler * get_at_handler | ( | ) | [virtual] |
Get the current ATHandler instance in use for debug purposes etc.
Once use has been finished call to release_at_handler() has to be made
- Returns:
- Pointer to the ATHandler in use
Implements CellularDevice.
Definition at line 194 of file AT_CellularDevice.cpp.
CellularContext * get_context_list | ( | ) | const [virtual] |
Get the linked list of CellularContext instances.
- Returns:
- Pointer to first item in linked list
Reimplemented from CellularDevice.
Definition at line 283 of file AT_CellularDevice.cpp.
CellularDevice * get_default_instance | ( | ) | [static, inherited] |
Returns singleton instance of CellularDevice, if Mbed target board has a supported onboard modem, or provide-default is defined for a cellular driver in JSON configuration files.
Otherwise returns NULL. See NetworkInterface::get_default_instance for details.
- Remarks:
- Application may override this (non-weak) default implementation.
- Returns:
- default CellularDevice, NULL if not defined
Definition at line 160 of file STModCellular.cpp.
FileHandle & get_file_handle | ( | ) | const [inherited] |
Get the current FileHandle item used when communicating with the modem.
- Returns:
- reference to FileHandle
Definition at line 60 of file CellularDevice.cpp.
intptr_t get_property | ( | CellularProperty | key ) |
Get value for the given key.
- Parameters:
-
key key for value to be fetched
- Returns:
- property value for the given key. Value type is defined in enum CellularProperty
Definition at line 685 of file AT_CellularDevice.cpp.
events::EventQueue * get_queue | ( | ) | [virtual, inherited] |
Get event queue that can be chained to main event queue.
- Returns:
- event queue
Definition at line 65 of file CellularDevice.cpp.
void get_retry_timeout_array | ( | uint16_t * | timeout, |
int & | array_len | ||
) | const [protected, inherited] |
Get the retry array from the CellularStateMachine.
Array is used in retry logic. Array contains seconds and retry logic uses those second to wait before trying again.
- Parameters:
-
timeout timeout array containing seconds for retry logic. Must have space for CELLULAR_RETRY_ARRAY_SIZE (defined in CellularCommon.h) array_len length of the timeout array on return
Definition at line 75 of file CellularDevice.cpp.
nsapi_error_t get_sim_state | ( | SimState & | state ) | [virtual] |
Get SIM card's state.
- Parameters:
-
state current state of SIM
- Returns:
- NSAPI_ERROR_OK on success NSAPI_ERROR_DEVICE_ERROR on failure
Implements CellularDevice.
Definition at line 208 of file AT_CellularDevice.cpp.
MBED_WEAK CellularDevice * get_target_default_instance | ( | ) | [static, inherited] |
Return target onboard instance of CellularDevice.
- Remarks:
- Mbed OS target shall override (non-weak) this function for an onboard modem.
- Returns:
- CellularDevice* instance, NULL if not defined
Definition at line 31 of file CellularDevice.cpp.
nsapi_error_t hard_power_off | ( | ) | [virtual] |
Sets the modem in unplugged state.
This is equivalent to pulling the plug off of the device, i.e., detaching power and serial port.
This puts the modem in the lowest power state.
- Remarks:
- CellularStateMachine disconnect or destruct does not shutdown or power off the modem, but you need to do that yourself.
- Precondition:
- You must call soft_power_off to power off the modem before calling hard_power_off.
- Returns:
- NSAPI_ERROR_OK on success
Implements CellularDevice.
Definition at line 168 of file AT_CellularDevice.cpp.
nsapi_error_t hard_power_on | ( | ) | [virtual] |
Sets the modem up for powering on This is equivalent to plugging in the device, i.e., attaching power and serial port.
In general, hard_power_on and soft_power_on provides a simple hardware abstraction layer on top of the modem drivers written for Mbed OS; they can be overridden in a derived class to perform custom power controls in a particular board configuration. In many boards this will be a no-op if there is no separate power supply control circuitry.
- Remarks:
- CellularStateMachine calls hard_power_on at first until successful, then soft_power_on and init until the modem responds. If you are not using CellularStateMachine then you need to call these functions yourself.
- Postcondition:
- You must call soft_power_on to power on the modem after calling hard_power_on.
- Returns:
- NSAPI_ERROR_OK on success
Implements CellularDevice.
Definition at line 163 of file AT_CellularDevice.cpp.
nsapi_error_t init | ( | ) | [virtual] |
Initialize cellular device must be called right after the module is ready.
For example, when multiple cellular modules are supported in a single driver this function detects and adapts to an actual module at runtime.
- Remarks:
- CellularStateMachine calls soft_power_on and init repeatedly when starting to connect until the modem responds.
- Returns:
- NSAPI_ERROR_OK on success NSAPI_ERROR_NO_MEMORY on case of memory failure NSAPI_ERROR_UNSUPPORTED if current cellular module type is not detected NSAPI_ERROR_DEVICE_ERROR if model information could not be read
Implements CellularDevice.
Definition at line 460 of file AT_CellularDevice.cpp.
nsapi_error_t is_ready | ( | ) | [virtual] |
Check whether the device is ready to accept commands.
- Returns:
- NSAPI_ERROR_OK on success NSAPI_ERROR_DEVICE_ERROR on failure
Implements CellularDevice.
Definition at line 490 of file AT_CellularDevice.cpp.
MBED_DEPRECATED_SINCE | ( | "mbed-os-5.15" | , |
"Use CellularDevice::shutdown() instead." | |||
) | [inherited] |
Stop the current operation.
Operations: set_device_ready, set_sim_ready, register_to_network, attach_to_network
void modem_debug_on | ( | bool | on ) | [virtual] |
Turn modem debug traces on.
- Parameters:
-
on set true to enable debug traces
Implements CellularDevice.
Definition at line 453 of file AT_CellularDevice.cpp.
CellularInformation * open_information | ( | FileHandle * | fh = NULL ) |
[virtual] |
Create new CellularInformation interface.
- Parameters:
-
fh file handle used in communication to modem. This can be, for example, UART handle. If null, then the default file handle is used.
- Returns:
- New instance of interface CellularInformation.
Implements CellularDevice.
Definition at line 362 of file AT_CellularDevice.cpp.
AT_CellularInformation * open_information_impl | ( | ATHandler & | at ) | [virtual] |
Create new instance of AT_CellularInformation or if overridden, modem specific implementation.
- Parameters:
-
at ATHandler reference for communication with the modem.
- Returns:
- new instance of class AT_CellularInformation
Definition at line 406 of file AT_CellularDevice.cpp.
CellularNetwork * open_network | ( | FileHandle * | fh = NULL ) |
[virtual] |
Create new CellularNetwork interface.
- Parameters:
-
fh file handle used in communication to modem. This can be, for example, UART handle. If null, then the default file handle is used.
- Returns:
- New instance of interface CellularNetwork.
Implements CellularDevice.
Definition at line 353 of file AT_CellularDevice.cpp.
AT_CellularNetwork * open_network_impl | ( | ATHandler & | at ) | [virtual] |
Create new instance of AT_CellularNetwork or if overridden, modem specific implementation.
- Parameters:
-
at ATHandler reference for communication with the modem.
- Returns:
- new instance of class AT_CellularNetwork
Definition at line 371 of file AT_CellularDevice.cpp.
CellularSMS * open_sms | ( | FileHandle * | fh = NULL ) |
[virtual] |
Create new CellularSMS interface.
- Parameters:
-
fh file handle used in communication to modem. This can be, for example, UART handle. If null, then the default file handle is used.
- Returns:
- New instance of interface CellularSMS.
Implements CellularDevice.
Definition at line 378 of file AT_CellularDevice.cpp.
AT_CellularSMS * open_sms_impl | ( | ATHandler & | at ) | [virtual] |
Create new instance of AT_CellularSMS or if overridden, modem specific implementation.
- Parameters:
-
at ATHandler reference for communication with the modem.
- Returns:
- new instance of class AT_CellularSMS
Definition at line 400 of file AT_CellularDevice.cpp.
nsapi_error_t register_to_network | ( | ) | [inherited] |
Start the interface.
Attempts to register the device to cellular network. API is asynchronous. Application can get results from CellularContext callback, which is set with attach(...), or callback, which is set by attach(...), in this class.
- Returns:
- NSAPI_ERROR_OK on success NSAPI_ERROR_NO_MEMORY on case of memory failure
Definition at line 112 of file CellularDevice.cpp.
nsapi_error_t release_at_handler | ( | ATHandler * | at_handler ) | [virtual] |
Releases the given at_handler.
If last reference to at_hander then it's deleted.
- Parameters:
-
at_handler
- Returns:
- NSAPI_ERROR_OK on success, NSAPI_ERROR_PARAMETER on failure
Implements CellularDevice.
Definition at line 199 of file AT_CellularDevice.cpp.
nsapi_error_t set_baud_rate | ( | int | baud_rate ) | [virtual] |
Sets cellular modem to given baud rate.
- Parameters:
-
baud_rate
- Returns:
- NSAPI_ERROR_OK on success, NSAPI_ERROR_DEVICE_ERROR on failure
Implements CellularDevice.
Definition at line 653 of file AT_CellularDevice.cpp.
void set_cellular_properties | ( | const intptr_t * | property_array ) |
Cellular module need to define an array of cellular properties which defines module supported property values.
- Parameters:
-
property_array array of module properties
Definition at line 675 of file AT_CellularDevice.cpp.
nsapi_error_t set_device_ready | ( | ) | [inherited] |
Start the interface.
Initializes the modem for communication. API is asynchronous. Application can get results from CellularContext callback, which is set with attach(...), or callback, which is set by attach(...), in this class.
- Returns:
- NSAPI_ERROR_OK on success NSAPI_ERROR_NO_MEMORY on case of memory failure
Definition at line 102 of file CellularDevice.cpp.
nsapi_error_t set_pin | ( | const char * | sim_pin ) | [virtual] |
Open the SIM card by setting the pin code for SIM.
- Parameters:
-
sim_pin PIN for the SIM card
- Returns:
- NSAPI_ERROR_OK on success NSAPI_ERROR_PARAMETER if sim_pin is null and sim is not ready NSAPI_ERROR_DEVICE_ERROR on failure
Implements CellularDevice.
Definition at line 258 of file AT_CellularDevice.cpp.
void set_plmn | ( | const char * | plmn ) | [inherited] |
Plmn to use when registering to cellular network.
If plmn is set, then registering is forced to this plmn. If plmn is not set, then automatic registering is used when registering to a cellular network. It doesn't start any operations.
- Parameters:
-
plmn plmn used when registering to cellular network
Definition at line 92 of file CellularDevice.cpp.
nsapi_error_t set_power_save_mode | ( | int | periodic_time, |
int | active_time = 0 |
||
) | [virtual] |
Set power save mode.
- Remarks:
- See 3GPP TS 27.007 PSM for details
- Parameters:
-
periodic_time in seconds to enable power save, or zero to disable active_time in seconds to wait before entering power save mode
- Returns:
- NSAPI_ERROR_OK on success NSAPI_ERROR_DEVICE_ERROR on failure
Table 10.5.163a/3GPP TS 24.008: GPRS Timer 3 information element
Bits 5 to 1 represent the binary coded timer value.
Bits 6 to 8 defines the timer value unit for the GPRS timer as follows: 8 7 6 0 0 0 value is incremented in multiples of 10 minutes 0 0 1 value is incremented in multiples of 1 hour 0 1 0 value is incremented in multiples of 10 hours 0 1 1 value is incremented in multiples of 2 seconds 1 0 0 value is incremented in multiples of 30 seconds 1 0 1 value is incremented in multiples of 1 minute 1 1 0 value is incremented in multiples of 320 hours (NOTE 1) 1 1 1 value indicates that the timer is deactivated (NOTE 2).
Table 10.5.172/3GPP TS 24.008: GPRS Timer information element
Bits 5 to 1 represent the binary coded timer value.
Bits 6 to 8 defines the timer value unit for the GPRS timer as follows:
8 7 6 0 0 0 value is incremented in multiples of 2 seconds 0 0 1 value is incremented in multiples of 1 minute 0 1 0 value is incremented in multiples of decihours 1 1 1 value indicates that the timer is deactivated.
Other values shall be interpreted as multiples of 1 minute in this version of the protocol.
Implements CellularDevice.
Definition at line 507 of file AT_CellularDevice.cpp.
void set_ready_cb | ( | Callback< void()> | callback ) | [virtual] |
Set callback function to listen when device is ready.
- Parameters:
-
callback function to call on device ready, or NULL to remove callback.
Implements CellularDevice.
Definition at line 503 of file AT_CellularDevice.cpp.
void set_retry_timeout_array | ( | const uint16_t | timeout[], |
int | array_len | ||
) | [inherited] |
Set an array of timeouts to wait before CellularStateMachine retries after failure.
To disable retry behavior completely use `set_retry_timeout_array(NULL, 0)`. CellularContext callback event `cell_callback_data_t.final_try` indicates true when all retries have failed.
- Remarks:
- Use `set_retry_timeout_array` for CellularStateMachine to wait before it retries again after failure, this is useful to send repetitive requests when don't know exactly when modem is ready to accept requests. Use `set_timeout` for timeout how long to wait for a response from modem for each request, this is useful if modem can accept requests but processing takes long time before sending response.
- Parameters:
-
timeout timeout array using seconds array_len length of the array
Definition at line 250 of file CellularDevice.cpp.
void set_sim_pin | ( | const char * | sim_pin ) | [inherited] |
Set the pin code for SIM card.
- Parameters:
-
sim_pin PIN for the SIM card
Definition at line 82 of file CellularDevice.cpp.
nsapi_error_t set_sim_ready | ( | ) | [inherited] |
Start the interface.
Attempts to open the sim. API is asynchronous. Application can get results from CellularContext callback, which is set with attach(...), or callback, which is set by attach(...), in this class.
- Returns:
- NSAPI_ERROR_OK on success NSAPI_ERROR_NO_MEMORY on case of memory failure
Definition at line 107 of file CellularDevice.cpp.
void set_timeout | ( | int | timeout ) | [virtual] |
Set the default response timeout.
- Remarks:
- CellularStateMachine timeouts for all states are also changed to `timeout`.
- Parameters:
-
timeout milliseconds to wait response from modem
Implements CellularDevice.
Definition at line 437 of file AT_CellularDevice.cpp.
nsapi_error_t shutdown | ( | ) | [virtual] |
Shutdown cellular device to minimum functionality.
Actual functionality is modem specific, for example UART may is not be responsive without explicit wakeup signal (such as RTS) after shutdown.
- Remarks:
- You must call shutdown before power off to prepare the modem and to quit cellular network.
- Returns:
- NSAPI_ERROR_OK on success NSAPI_ERROR_DEVICE_ERROR on failure
Reimplemented from CellularDevice.
Definition at line 483 of file AT_CellularDevice.cpp.
nsapi_error_t soft_power_off | ( | ) | [virtual] |
Powers down the modem.
This is equivalent to turning off the modem by button press.
- Remarks:
- CellularStateMachine disconnect or destruct does not shutdown or power off the modem, but you need to do that yourself.
- Precondition:
- You must call shutdown to prepare the modem for power off.
- Returns:
- NSAPI_ERROR_OK on success
Implements CellularDevice.
Definition at line 178 of file AT_CellularDevice.cpp.
nsapi_error_t soft_power_on | ( | ) | [virtual] |
Powers up the modem.
This is equivalent to pressing the "power button" to activate or reset the modem and usually implemented as a short pulse on a dedicated GPIO signal. It is expected to be present to make it possible to reset the modem. The driver may repeat this if the modem is not responsive to AT commands.
- Remarks:
- CellularStateMachine calls this when requested to connect. If you are not using CellularStateMachine then you need to call this function yourself.
- Postcondition:
- You must call init to setup the modem.
- Returns:
- NSAPI_ERROR_OK on success
Implements CellularDevice.
Definition at line 173 of file AT_CellularDevice.cpp.
Generated on Tue Jul 12 2022 13:55:43 by
