17 #ifndef _CELLULARCONTEXT_H_ 18 #define _CELLULARCONTEXT_H_ 20 #include "CellularInterface.h" 22 #include "CellularUtil.h" 44 static const int PDP_CONTEXT_COUNT = 4;
47 enum AuthenticationType {
55 enum RateControlExceptionReports {
56 NotAllowedToBeSent = 0,
61 enum RateControlUplinkTimeUnit {
71 char apn[MAX_ACCESSPOINT_NAME_LENGTH + 1];
72 char local_addr[MAX_IPV6_ADDR_IN_IPV4LIKE_DOTTED_FORMAT + 1];
73 char local_subnet_mask[MAX_IPV6_ADDR_IN_IPV4LIKE_DOTTED_FORMAT + 1];
74 char gateway_addr[MAX_IPV6_ADDR_IN_IPV4LIKE_DOTTED_FORMAT + 1];
75 char dns_primary_addr[MAX_IPV6_ADDR_IN_IPV4LIKE_DOTTED_FORMAT + 1];
76 char dns_secondary_addr[MAX_IPV6_ADDR_IN_IPV4LIKE_DOTTED_FORMAT + 1];
77 char p_cscf_prim_addr[MAX_IPV6_ADDR_IN_IPV4LIKE_DOTTED_FORMAT + 1];
78 char p_cscf_sec_addr[MAX_IPV6_ADDR_IN_IPV4LIKE_DOTTED_FORMAT + 1];
81 int im_signalling_flag;
87 int serving_plmn_rate_control_value;
94 local_subnet_mask[0] =
'\0';
95 gateway_addr[0] =
'\0';
96 dns_primary_addr[0] =
'\0';
97 dns_secondary_addr[0] =
'\0';
98 p_cscf_prim_addr[0] =
'\0';
99 p_cscf_sec_addr[0] =
'\0';
102 im_signalling_flag = -1;
103 lipa_indication = -1;
108 serving_plmn_rate_control_value = -1;
142 virtual void set_plmn(
const char *plmn) = 0;
145 const char *pwd = 0) = 0;
146 virtual void set_credentials(
const char *apn,
const char *uname = 0,
const char *pwd = 0) = 0;
238 CellularContext::RateControlUplinkTimeUnit &time_unit,
int &uplink_rate) = 0;
265 #if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY) 274 #endif // #if DEVICE_SERIAL 293 enum ContextOperation {
347 pdp_type_t _pdp_type;
348 CellularContext::AuthenticationType _authentication_type;
349 nsapi_connection_status_t _connect_status;
353 bool _new_context_set;
354 bool _is_context_active;
355 bool _is_context_activated;
363 uint16_t _retry_timeout_array[CELLULAR_RETRY_ARRAY_SIZE];
364 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...
void validate_ip_address()
After we have connected successfully we must check that we have a valid IP address.
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.