Mbed OS Reference
|
Class AT_CellularDevice. More...
#include <AT_CellularDevice.h>
Public Member Functions | |
AT_CellularDevice (FileHandle *fh, char const *delim="\r") | |
Create an AT_CellularDevice. More... | |
virtual nsapi_error_t | clear () |
Clear modem to a default initial state. More... | |
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. More... | |
virtual nsapi_error_t | hard_power_off () |
Sets the modem in unplugged state. More... | |
virtual nsapi_error_t | soft_power_on () |
Powers up the modem. More... | |
virtual nsapi_error_t | soft_power_off () |
Powers down the modem. More... | |
virtual nsapi_error_t | set_pin (const char *sim_pin) |
Open the SIM card by setting the pin code for SIM. More... | |
virtual nsapi_error_t | get_sim_state (SimState &state) |
Get SIM card's state. More... | |
virtual CellularContext * | create_context (const char *apn=NULL, bool cp_req=false, bool nonip_req=false) |
Creates a new CellularContext interface. More... | |
virtual void | delete_context (CellularContext *context) |
Deletes the given CellularContext instance. More... | |
virtual CellularNetwork * | open_network () |
Create new CellularNetwork interface. More... | |
virtual CellularInformation * | open_information () |
Create new CellularInformation interface. More... | |
virtual void | close_network () |
Closes the opened CellularNetwork by deleting the CellularNetwork instance. More... | |
virtual void | close_information () |
Closes the opened CellularInformation by deleting the CellularInformation instance. More... | |
virtual void | set_timeout (int timeout) |
Set the default response timeout. More... | |
virtual void | modem_debug_on (bool on) |
Turn modem debug traces on. More... | |
virtual nsapi_error_t | init () |
Initialize cellular device must be called right after the module is ready. More... | |
virtual nsapi_error_t | shutdown () |
Shutdown cellular device to minimum functionality. More... | |
virtual nsapi_error_t | is_ready () |
Check whether the device is ready to accept commands. More... | |
virtual void | set_ready_cb (Callback< void()> callback) |
Set callback function to listen when device is ready. More... | |
virtual nsapi_error_t | set_power_save_mode (int periodic_time, int active_time=0) |
Set power save mode. More... | |
virtual ATHandler * | get_at_handler () |
Get the current ATHandler instance in use for debug purposes etc. More... | |
virtual CellularContext * | get_context_list () const |
Get the linked list of CellularContext instances. More... | |
virtual nsapi_error_t | set_baud_rate (int baud_rate) |
Sets cellular modem to given baud rate. More... | |
intptr_t | get_property (CellularProperty key) |
Get value for the given key. More... | |
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. More... | |
virtual events::EventQueue * | get_queue () |
Get event queue that can be chained to main event queue. More... | |
virtual CellularSMS * | open_sms ()=0 |
Create new CellularSMS interface. More... | |
virtual void | close_sms ()=0 |
Closes the opened CellularSMS by deleting the CellularSMS instance. More... | |
void | set_sim_pin (const char *sim_pin) |
Set the pin code for SIM card. More... | |
void | set_plmn (const char *plmn) |
Plmn to use when registering to cellular network. More... | |
nsapi_error_t | set_device_ready () |
Start the interface. More... | |
nsapi_error_t | set_sim_ready () |
Start the interface. More... | |
nsapi_error_t | register_to_network () |
Start the interface. More... | |
nsapi_error_t | attach_to_network () |
Start the interface. More... | |
void | attach (Callback< void(nsapi_event_t, intptr_t)> status_cb) |
Register callback for status reporting. More... | |
void | set_retry_timeout_array (const uint16_t timeout[], int array_len) |
Set an array of timeouts to wait before CellularStateMachine retries after failure. More... | |
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. More... | |
static CellularDevice * | get_target_default_instance () |
Return target onboard instance of CellularDevice. More... | |
Protected Member Functions | |
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. More... | |
virtual AT_CellularNetwork * | open_network_impl (ATHandler &at) |
Create new instance of AT_CellularNetwork or if overridden, modem specific implementation. More... | |
virtual AT_CellularInformation * | open_information_impl (ATHandler &at) |
Create new instance of AT_CellularInformation or if overridden, modem specific implementation. More... | |
virtual void | cellular_callback (nsapi_event_t ev, intptr_t ptr, CellularContext *ctx=NULL) |
Cellular callback to be attached to Network and CellularStateMachine classes. More... | |
void | get_retry_timeout_array (uint16_t *timeout, int &array_len) const |
Get the retry array from the CellularStateMachine. More... | |
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 44 of file AT_CellularDevice.h.
AT_CellularDevice | ( | FileHandle * | fh, |
char const * | delim = "\r" |
||
) |
Create an AT_CellularDevice.
fh | file handle used for reading AT responses and writing AT commands |
delim | delimiter used when parsing at responses, "\r" should be used as output_delimiter |
|
virtual |
Clear modem to a default initial state.
Clear persistent user data from the modem, such as PDP contexts.
cellular.clear-on-connect: true
.Implements CellularDevice.
|
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.
Implements CellularDevice.
Reimplemented in ONBOARD_SARA4_PPP, ONBOARD_TELIT_HE910, ONBOARD_TELIT_HE910, ONBOARD_TELIT_ME310, TELIT_ME310, ONBOARD_TELIT_ME910, and TELIT_ME910.
|
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.
Implements CellularDevice.
Reimplemented in ONBOARD_SARA4_PPP, ONBOARD_TELIT_HE910, ONBOARD_TELIT_HE910, ONBOARD_TELIT_ME310, TELIT_ME310, ONBOARD_TELIT_ME910, and TELIT_ME910.
|
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.
Implements CellularDevice.
Reimplemented in ALT1250_PPP, ONBOARD_SARA4_PPP, ONBOARD_TELIT_HE910, ONBOARD_TELIT_HE910, ONBOARD_TELIT_ME310, TELIT_ME310, ONBOARD_TELIT_ME910, and TELIT_ME910.
|
virtual |
Powers down the modem.
This is equivalent to turning off the modem by button press.
Implements CellularDevice.
Reimplemented in ONBOARD_SARA4_PPP, ONBOARD_TELIT_HE910, ONBOARD_TELIT_HE910, ONBOARD_TELIT_ME310, TELIT_ME310, ONBOARD_TELIT_ME910, and TELIT_ME910.
|
virtual |
Open the SIM card by setting the pin code for SIM.
sim_pin | PIN for the SIM card |
Implements CellularDevice.
|
virtual |
Get SIM card's state.
state | current state of SIM |
Implements CellularDevice.
|
virtual |
Creates a new CellularContext interface.
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 |
Implements CellularDevice.
|
virtual |
Deletes the given CellularContext instance.
context | CellularContext to delete |
Implements CellularDevice.
|
virtual |
Create new CellularNetwork interface.
Implements CellularDevice.
|
virtual |
Create new CellularInformation interface.
Implements CellularDevice.
|
virtual |
Closes the opened CellularNetwork by deleting the CellularNetwork instance.
Implements CellularDevice.
|
virtual |
Closes the opened CellularInformation by deleting the CellularInformation instance.
Implements CellularDevice.
|
virtual |
Set the default response timeout.
timeout
.timeout | milliseconds to wait response from modem |
Implements CellularDevice.
|
virtual |
|
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.
Implements CellularDevice.
Reimplemented in GEMALTO_CINTERION, RM1000_AT, TELIT_HE910, ONBOARD_TELIT_ME310, TELIT_ME310, ONBOARD_TELIT_ME910, and TELIT_ME910.
|
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.
Reimplemented from CellularDevice.
|
virtual |
Check whether the device is ready to accept commands.
Implements CellularDevice.
|
virtual |
Set callback function to listen when device is ready.
callback | function to call on device ready, or NULL to remove callback. |
Implements CellularDevice.
|
virtual |
Set power save mode.
periodic_time | in seconds to enable power save, or zero to disable |
active_time | in seconds to wait before entering power save mode |
Implements CellularDevice.
Reimplemented in SARA4_PPP.
|
virtual |
Get the current ATHandler instance in use for debug purposes etc.
Implements CellularDevice.
|
virtual |
Get the linked list of CellularContext instances.
Implements CellularDevice.
|
virtual |
Sets cellular modem to given baud rate.
baud_rate |
Implements CellularDevice.
intptr_t get_property | ( | CellularProperty | key | ) |
Get value for the given key.
key | key for value to be fetched |
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.
property_array | array of module properties |
|
protectedvirtual |
Creates new instance of AT_CellularContext or if overridden, modem specific implementation.
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 |
Reimplemented in ALT1250_PPP, GEMALTO_CINTERION, RM1000_AT, TELIT_ME310, and TELIT_ME910.
|
protectedvirtual |
Create new instance of AT_CellularNetwork or if overridden, modem specific implementation.
at | ATHandler reference for communication with the modem. |
Reimplemented in ALT1250_PPP, SARA4_PPP, RM1000_AT, TELIT_ME310, and TELIT_ME910.
|
protectedvirtual |
Create new instance of AT_CellularInformation or if overridden, modem specific implementation.
at | ATHandler reference for communication with the modem. |
Reimplemented in GEMALTO_CINTERION.
|
protectedvirtual |
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.
|
staticinherited |
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.
|
staticinherited |
Return target onboard instance of CellularDevice.
|
virtualinherited |
Get event queue that can be chained to main event queue.
|
pure virtualinherited |
Create new CellularSMS interface.
|
pure virtualinherited |
Closes the opened CellularSMS by deleting the CellularSMS instance.
|
inherited |
Set the pin code for SIM card.
sim_pin | PIN for the SIM card |
|
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.
plmn | plmn used when registering to cellular network |
|
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.
|
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.
|
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.
|
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.
|
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.
status_cb | The callback for status changes. |
|
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.
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.timeout | timeout array using seconds |
array_len | length of the array |
|
protectedinherited |
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.
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 |