18 #ifndef CELLULAR_DEVICE_H_ 19 #define CELLULAR_DEVICE_H_ 21 #include "CellularStateMachine.h" 23 #include "ATHandler.h" 24 #if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY) 25 #include "UARTSerial.h" 26 #endif // #if DEVICE_SERIAL 35 class CellularInformation;
36 class CellularNetwork;
37 class CellularContext;
40 const int MAX_PIN_SIZE = 8;
41 const int MAX_PLMN_SIZE = 16;
42 const int MAX_SIM_READY_WAITING_TIME = 30;
185 #if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY) 201 bool active_high =
false,
bool cp_req =
false,
bool nonip_req =
false) = 0;
202 #endif // #if DEVICE_SERIAL 454 void stm_callback(nsapi_event_t ev, intptr_t ptr);
455 int _network_ref_count;
462 nsapi_error_t start_state_machine(CellularStateMachine::CellularState target_state);
466 char _sim_pin[MAX_PIN_SIZE + 1];
467 char _plmn[MAX_PLMN_SIZE + 1];
478 #endif // CELLULAR_DEVICE_H_ virtual nsapi_error_t soft_power_off()=0
Powers down the modem.
void stop()
Stop the current operation.
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.
FileHandle & get_file_handle() const
Get the current FileHandle item used when communicating with the modem.
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 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.
void set_plmn(const char *plmn)
Plmn to use when registering to cellular network.
virtual CellularInformation * open_information(FileHandle *fh=NULL)=0
Create new CellularInformation interface.
signed int nsapi_error_t
Type used to represent error codes.
Class providing buffered UART communication functionality using separate circular buffer for send and...
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 ~CellularDevice()
virtual Destructor
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 nsapi_error_t release_at_handler(ATHandler *at_handler)=0
Release the ATHandler taken into use with get_at_handler()
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(FileHandle *fh=NULL, 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 CellularNetwork * open_network(FileHandle *fh=NULL)=0
Create new CellularNetwork 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.
CellularDevice(FileHandle *fh)
Default constructor.
virtual CellularContext * get_context_list() const
Get the linked list of CellularContext instances.
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.
Callback class based on template specialization.
virtual void close_network()=0
Closes the opened CellularNetwork by deleting the CellularNetwork instance.
virtual CellularSMS * open_sms(FileHandle *fh=NULL)=0
Create new CellularSMS interface.
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.