mirror of https://github.com/ARMmbed/mbed-os.git
Cellular: Initialize CellularContext member variables in correct class
CellularContext member variables were initialized in inheriting class. Now in base class where they should be initialized so that every inheriting class don't have to init them.pull/10557/head
parent
2f1338b89f
commit
e4ee870b2e
|
@ -19,6 +19,15 @@
|
||||||
|
|
||||||
namespace mbed {
|
namespace mbed {
|
||||||
|
|
||||||
|
CellularContext::CellularContext() : _next(0), _stack(0), _pdp_type(DEFAULT_PDP_TYPE),
|
||||||
|
_authentication_type(CellularContext::CHAP), _connect_status(NSAPI_STATUS_DISCONNECTED), _status_cb(0),
|
||||||
|
_cid(-1), _new_context_set(false), _is_context_active(false), _is_context_activated(false),
|
||||||
|
_apn(0), _uname(0), _pwd(0), _dcd_pin(NC), _active_high(false), _cp_netif(0), _retry_array_length(0),
|
||||||
|
_retry_count(0), _device(0), _nw(0), _is_blocking(true)
|
||||||
|
{
|
||||||
|
memset(_retry_timeout_array, 0, CELLULAR_RETRY_ARRAY_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
void CellularContext::cp_data_received()
|
void CellularContext::cp_data_received()
|
||||||
{
|
{
|
||||||
_cp_netif->data_received();
|
_cp_netif->data_received();
|
||||||
|
|
|
@ -122,6 +122,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
// friend of CellularDevice, so it's the only way to close or delete this class.
|
// friend of CellularDevice, so it's the only way to close or delete this class.
|
||||||
friend class CellularDevice;
|
friend class CellularDevice;
|
||||||
|
CellularContext();
|
||||||
virtual ~CellularContext() {}
|
virtual ~CellularContext() {}
|
||||||
public: // from NetworkInterface
|
public: // from NetworkInterface
|
||||||
virtual nsapi_error_t set_blocking(bool blocking) = 0;
|
virtual nsapi_error_t set_blocking(bool blocking) = 0;
|
||||||
|
|
|
@ -51,28 +51,8 @@ AT_CellularContext::AT_CellularContext(ATHandler &at, CellularDevice *device, co
|
||||||
_nonip_req(nonip_req), _cp_in_use(false)
|
_nonip_req(nonip_req), _cp_in_use(false)
|
||||||
{
|
{
|
||||||
tr_info("New CellularContext %s (%p)", apn ? apn : "", this);
|
tr_info("New CellularContext %s (%p)", apn ? apn : "", this);
|
||||||
_stack = NULL;
|
|
||||||
_pdp_type = DEFAULT_PDP_TYPE;
|
|
||||||
_authentication_type = CellularContext::CHAP;
|
|
||||||
_connect_status = NSAPI_STATUS_DISCONNECTED;
|
|
||||||
_is_context_active = false;
|
|
||||||
_is_context_activated = false;
|
|
||||||
_apn = apn;
|
_apn = apn;
|
||||||
_uname = NULL;
|
|
||||||
_pwd = NULL;
|
|
||||||
_status_cb = NULL;
|
|
||||||
_cid = -1;
|
|
||||||
_new_context_set = false;
|
|
||||||
_next = NULL;
|
|
||||||
_dcd_pin = NC;
|
|
||||||
_active_high = false;
|
|
||||||
_cp_netif = NULL;
|
|
||||||
memset(_retry_timeout_array, 0, CELLULAR_RETRY_ARRAY_SIZE);
|
|
||||||
_retry_array_length = 0;
|
|
||||||
_retry_count = 0;
|
|
||||||
_is_blocking = true;
|
|
||||||
_device = device;
|
_device = device;
|
||||||
_nw = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AT_CellularContext::~AT_CellularContext()
|
AT_CellularContext::~AT_CellularContext()
|
||||||
|
|
|
@ -58,6 +58,15 @@ MBED_WEAK CellularContext *CellularContext::get_default_nonip_instance()
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CellularContext::CellularContext() : _next(0), _stack(0), _pdp_type(DEFAULT_PDP_TYPE),
|
||||||
|
_authentication_type(CellularContext::CHAP), _connect_status(NSAPI_STATUS_DISCONNECTED), _status_cb(0),
|
||||||
|
_cid(-1), _new_context_set(false), _is_context_active(false), _is_context_activated(false),
|
||||||
|
_apn(0), _uname(0), _pwd(0), _dcd_pin(NC), _active_high(false), _cp_netif(0), _retry_array_length(0),
|
||||||
|
_retry_count(0), _device(0), _nw(0), _is_blocking(true)
|
||||||
|
{
|
||||||
|
memset(_retry_timeout_array, 0, CELLULAR_RETRY_ARRAY_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
void CellularContext::cp_data_received()
|
void CellularContext::cp_data_received()
|
||||||
{
|
{
|
||||||
_cp_netif->data_received();
|
_cp_netif->data_received();
|
||||||
|
|
Loading…
Reference in New Issue