17 #ifndef _CELLULARCONTEXT_H_    18 #define _CELLULARCONTEXT_H_    21 #include "netsocket/CellularInterface.h"    23 #include "CellularUtil.h"    45     static const int PDP_CONTEXT_COUNT = 4;
    48     enum AuthenticationType {
    56     enum RateControlExceptionReports {
    57         NotAllowedToBeSent = 0,
    62     enum RateControlUplinkTimeUnit {
    72         char apn[MAX_ACCESSPOINT_NAME_LENGTH + 1];
    73         char local_addr[MAX_IPV6_ADDR_IN_IPV4LIKE_DOTTED_FORMAT + 1];
    74         char local_subnet_mask[MAX_IPV6_ADDR_IN_IPV4LIKE_DOTTED_FORMAT + 1];
    75         char gateway_addr[MAX_IPV6_ADDR_IN_IPV4LIKE_DOTTED_FORMAT + 1];
    76         char dns_primary_addr[MAX_IPV6_ADDR_IN_IPV4LIKE_DOTTED_FORMAT + 1];
    77         char dns_secondary_addr[MAX_IPV6_ADDR_IN_IPV4LIKE_DOTTED_FORMAT + 1];
    78         char p_cscf_prim_addr[MAX_IPV6_ADDR_IN_IPV4LIKE_DOTTED_FORMAT + 1];
    79         char p_cscf_sec_addr[MAX_IPV6_ADDR_IN_IPV4LIKE_DOTTED_FORMAT + 1];
    82         int im_signalling_flag;
    88         int serving_plmn_rate_control_value;
    95             local_subnet_mask[0] = 
'\0';
    96             gateway_addr[0] = 
'\0';
    97             dns_primary_addr[0] = 
'\0';
    98             dns_secondary_addr[0] = 
'\0';
    99             p_cscf_prim_addr[0] = 
'\0';
   100             p_cscf_sec_addr[0] = 
'\0';
   103             im_signalling_flag = -1;
   104             lipa_indication = -1;
   109             serving_plmn_rate_control_value = -1;
   123 #if !NSAPI_PPP_AVAILABLE   151     virtual void set_plmn(
const char *plmn) = 0;
   154                                   const char *pwd = 0) = 0;
   155     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;
   265 #if (DEVICE_SERIAL && DEVICE_INTERRUPTIN) || defined(DOXYGEN_ONLY)   282 #endif // #if DEVICE_SERIAL   301     enum ContextOperation {
   312         DEFAULT_PDP_TYPE = DEFAULT_STACK,
   313         IPV4_PDP_TYPE = IPV4_STACK,
   314         IPV6_PDP_TYPE = IPV6_STACK,
   315         IPV4V6_PDP_TYPE = IPV4V6_STACK,
   372     pdp_type_t _pdp_type;
   373     CellularContext::AuthenticationType _authentication_type;
   374     nsapi_connection_status_t _connect_status;
   378     bool _new_context_set;
   379     bool _is_context_active;
   380     bool _is_context_activated; 
   386     uint16_t _retry_timeout_array[CELLULAR_RETRY_ARRAY_SIZE];
   387     int _retry_array_length;
 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 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...
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 nsapi_error_t connect()=0
Attempt to connect to a cellular network. 
int get_cid() const 
Get the pdp context id associated with this context. 
virtual void set_plmn(const char *plmn)=0
Set the plmn. 
virtual nsapi_error_t configure_hup(PinName dcd_pin=NC, bool active_high=false)=0
Enable or disable hang-up detection. 
virtual const char * get_nonip_context_type_str()=0
Return PDP type string for Non-IP if modem uses other than standard "Non-IP". 
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 nsapi_error_t get_ip_address(SocketAddress *address)=0
Get the local IP address. 
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 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. 
CellularContext::pdp_type_t string_to_pdp_type(const char *pdp_type)
Converts the given pdp type in char format to enum pdp_type_t. 
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.