18#ifndef CELLULAR_DEVICE_H_
19#define CELLULAR_DEVICE_H_
21#include "CellularStateMachine.h"
26#ifdef MBED_CONF_RTOS_PRESENT
27#include "rtos/Thread.h"
37class CellularInformation;
41const int MAX_PIN_SIZE = 8;
42const int MAX_PLMN_SIZE = 16;
43const int MAX_SIM_READY_WAITING_TIME = 30;
303#if MBED_CONF_CELLULAR_USE_SMS || defined(DOXYGEN_ONLY)
444 void stm_callback(nsapi_event_t ev, intptr_t ptr);
447 int _network_ref_count;
448#if MBED_CONF_CELLULAR_USE_SMS
454 Callback<void(nsapi_event_t, intptr_t)> _status_cb;
458 char _sim_pin[MAX_PIN_SIZE + 1];
459 char _plmn[MAX_PLMN_SIZE + 1];
462#ifdef MBED_CONF_RTOS_PRESENT
Class AT_CellularNetwork.
Class for sending AT commands and parsing AT responses.
Callback class based on template specialization.
CellularContext is CellularInterface/NetworkInterface with extensions for cellular connectivity.
virtual void close_information()=0
Closes the opened CellularInformation by deleting the CellularInformation instance.
virtual nsapi_error_t shutdown()
Shutdown cellular device to minimum functionality.
nsapi_error_t set_device_ready()
Start the interface.
virtual void close_sms()=0
Closes the opened CellularSMS by deleting the CellularSMS instance.
void attach(Callback< void(nsapi_event_t, intptr_t)> status_cb)
Register callback for status reporting.
virtual ~CellularDevice()
virtual Destructor
virtual CellularSMS * open_sms()=0
Create new CellularSMS interface.
virtual void set_ready_cb(Callback< void()> callback)=0
Set callback function to listen when device is ready.
virtual nsapi_error_t hard_power_off()=0
Sets the modem in unplugged state.
void set_sim_pin(const char *sim_pin)
Set the pin code for SIM card.
static CellularDevice * get_target_default_instance()
Return target onboard instance of CellularDevice.
CellularDevice()
Default constructor.
virtual void modem_debug_on(bool on)=0
Turn modem debug traces on.
virtual CellularNetwork * open_network()=0
Create new CellularNetwork interface.
virtual nsapi_error_t init()=0
Initialize cellular device must be called right after the module is ready.
virtual void cellular_callback(nsapi_event_t ev, intptr_t ptr, CellularContext *ctx=NULL)
Cellular callback to be attached to Network and CellularStateMachine classes.
virtual nsapi_error_t clear()=0
Clear modem to a default initial state.
void set_plmn(const char *plmn)
Plmn to use when registering to cellular network.
virtual nsapi_error_t hard_power_on()=0
Sets the modem up for powering on This is equivalent to plugging in the device, i....
virtual void delete_context(CellularContext *context)=0
Deletes the given CellularContext instance.
virtual nsapi_error_t set_power_save_mode(int periodic_time, int active_time=0)=0
Set power save mode.
void get_retry_timeout_array(uint16_t *timeout, int &array_len) const
Get the retry array from the CellularStateMachine.
virtual void close_network()=0
Closes the opened CellularNetwork by deleting the CellularNetwork instance.
nsapi_error_t set_sim_ready()
Start the interface.
virtual nsapi_error_t set_pin(const char *sim_pin)=0
Open the SIM card by setting the pin code for SIM.
virtual CellularContext * get_context_list() const =0
Get the linked list of CellularContext instances.
static CellularDevice * get_default_instance()
Returns singleton instance of CellularDevice, if Mbed target board has a supported onboard modem,...
virtual events::EventQueue * get_queue()
Get event queue that can be chained to main event queue.
virtual CellularContext * create_context(const char *apn=NULL, bool cp_req=false, bool nonip_req=false)=0
Creates a new CellularContext interface.
virtual nsapi_error_t soft_power_on()=0
Powers up the modem.
virtual nsapi_error_t is_ready()=0
Check whether the device is ready to accept commands.
nsapi_error_t register_to_network()
Start the interface.
virtual nsapi_error_t get_sim_state(SimState &state)=0
Get SIM card's state.
nsapi_error_t attach_to_network()
Start the interface.
virtual void set_timeout(int timeout)=0
Set the default response timeout.
virtual CellularInformation * open_information()=0
Create new CellularInformation interface.
virtual nsapi_error_t set_baud_rate(int baud_rate)=0
Sets cellular modem to given baud rate.
void set_retry_timeout_array(const uint16_t timeout[], int array_len)
Set an array of timeouts to wait before CellularStateMachine retries after failure.
virtual ATHandler * get_at_handler()=0
Get the current ATHandler instance in use for debug purposes etc.
virtual nsapi_error_t soft_power_off()=0
Powers down the modem.
An abstract interface for connecting to a network and getting information from it.
CellularStateMachine class.
CellularState
Cellular connection states.
The Mutex class is used to synchronize the execution of threads.
The Thread class allow defining, creating, and controlling thread functions in the system.
signed int nsapi_error_t
Type used to represent error codes.