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