17 #ifndef _CELLULARCONTEXT_H_ 18 #define _CELLULARCONTEXT_H_ 20 #include "CellularInterface.h" 32 typedef enum pdp_type {
33 DEFAULT_PDP_TYPE = DEFAULT_STACK,
34 IPV4_PDP_TYPE = IPV4_STACK,
35 IPV6_PDP_TYPE = IPV6_STACK,
36 IPV4V6_PDP_TYPE = IPV4V6_STACK,
51 static const int PDP_CONTEXT_COUNT = 4;
54 enum AuthenticationType {
61 enum RateControlExceptionReports {
62 NotAllowedToBeSent = 0,
67 enum RateControlUplinkTimeUnit {
77 char apn[MAX_ACCESSPOINT_NAME_LENGTH + 1];
78 char local_addr[MAX_IPV6_ADDR_IN_IPV4LIKE_DOTTED_FORMAT + 1];
79 char local_subnet_mask[MAX_IPV6_ADDR_IN_IPV4LIKE_DOTTED_FORMAT + 1];
80 char gateway_addr[MAX_IPV6_ADDR_IN_IPV4LIKE_DOTTED_FORMAT + 1];
81 char dns_primary_addr[MAX_IPV6_ADDR_IN_IPV4LIKE_DOTTED_FORMAT + 1];
82 char dns_secondary_addr[MAX_IPV6_ADDR_IN_IPV4LIKE_DOTTED_FORMAT + 1];
83 char p_cscf_prim_addr[MAX_IPV6_ADDR_IN_IPV4LIKE_DOTTED_FORMAT + 1];
84 char p_cscf_sec_addr[MAX_IPV6_ADDR_IN_IPV4LIKE_DOTTED_FORMAT + 1];
87 int im_signalling_flag;
93 int serving_plmn_rate_control_value;
100 local_subnet_mask[0] =
'\0';
101 gateway_addr[0] =
'\0';
102 dns_primary_addr[0] =
'\0';
103 dns_secondary_addr[0] =
'\0';
104 p_cscf_prim_addr[0] =
'\0';
105 p_cscf_sec_addr[0] =
'\0';
108 im_signalling_flag = -1;
109 lipa_indication = -1;
114 serving_plmn_rate_control_value = -1;
148 virtual void set_plmn(
const char *plmn) = 0;
151 const char *pwd = 0) = 0;
152 virtual void set_credentials(
const char *apn,
const char *uname = 0,
const char *pwd = 0) = 0;
244 CellularContext::RateControlUplinkTimeUnit &time_unit,
int &uplink_rate) = 0;
271 #if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY) 280 #endif // #if DEVICE_SERIAL 299 enum ContextOperation {
348 pdp_type_t _pdp_type;
349 CellularContext::AuthenticationType _authentication_type;
350 nsapi_connection_status_t _connect_status;
354 bool _new_context_set;
355 bool _is_context_active;
356 bool _is_context_activated;
364 uint16_t _retry_timeout_array[CELLULAR_RETRY_ARRAY_SIZE];
365 int _retry_array_length;
virtual void enable_hup(bool enable)=0
Enable or disable hang-up detection.
virtual nsapi_error_t set_sim_ready()=0
Start the interface.
Implements support for data transfer using Control Plane CIoT EPS optimization specified in 3GPP 23...
virtual nsapi_error_t get_rate_control(CellularContext::RateControlExceptionReports &reports, CellularContext::RateControlUplinkTimeUnit &time_unit, int &uplink_rate)=0
Get APN rate control.
virtual const char * get_netmask()=0
Get the local network mask.
virtual nsapi_error_t register_to_network()=0
Start the interface.
virtual nsapi_error_t set_blocking(bool blocking)=0
Set asynchronous operation of connect() and disconnect() calls.
virtual void cellular_callback(nsapi_event_t ev, intptr_t ptr)=0
The CellularDevice calls the status callback function on status changes on the network or CellularDev...
virtual const char * get_ip_address()=0
Get the local IP address.
CellularContext is CellularInterface/NetworkInterface with extensions for cellular connectivity...
Implements support for data transfer using Control Plane CIoT EPS optimization.
virtual void set_sim_pin(const char *sim_pin)=0
Set the PIN code for SIM card.
signed int nsapi_error_t
Type used to represent error codes.
virtual void set_file_handle(FileHandle *fh)=0
Set the file handle used to communicate with the modem.
virtual nsapi_error_t connect()=0
Attempt to connect to a cellular network.
Class providing buffered UART communication functionality using separate circular buffer for send and...
int get_cid() const
Get the pdp context id associated with this context.
virtual void set_plmn(const char *plmn)=0
Set the plmn.
static CellularContext * get_default_instance()
Same as NetworkInterface::get_default_instance()
An abstract interface for connecting to a network and getting information from it.
void cp_data_received()
Triggers control plane's operations needed when control plane data is received, like socket event...
virtual void attach(mbed::Callback< void(nsapi_event_t, intptr_t)> status_cb)=0
Register callback for status reporting.
void call_network_cb(nsapi_connection_status_t status)
Helper method to call callback function if it is provided.
static CellularContext * get_default_nonip_instance()
Instantiates a default Non-IP cellular interface.
virtual bool is_connected()=0
Check if the connection is currently established.
virtual const char * get_gateway()=0
Get the local gateways.
virtual nsapi_error_t get_apn_backoff_timer(int &backoff_timer)=0
Get backoff timer value.
virtual ControlPlane_netif * get_cp_netif()=0
Returns the control plane AT command interface.
virtual void set_credentials(const char *apn, const char *uname=0, const char *pwd=0)=0
Set the cellular network credentials.
virtual void do_connect()
Find and activate pdp context or in case of PPP find correct pdp context and open data channel...
Common interface that is shared between cellular interfaces.
virtual nsapi_error_t get_pdpcontext_params(pdpContextList_t ¶ms_list)=0
Get the relevant information for an active nonsecondary PDP context.
virtual nsapi_error_t set_device_ready()=0
Start the interface.
void set_authentication_type(AuthenticationType type)
Set the authentication type to be used in user authentication if user name and password are defined...
virtual nsapi_error_t disconnect()=0
Stop the interface.
Callback class based on template specialization.
CellularDevice * get_device() const
Get pointer to CellularDevice instance.
virtual nsapi_error_t attach_to_network()=0
Start the interface.
virtual void do_connect_with_retry()
Retry logic after device attached to network.