Cellular: Refactor CellularBase from AT_ControlPlane_netif

pull/12065/head
Ari Parkkila 2019-12-30 01:02:07 -08:00
parent 4b3ef73333
commit 7899fead59
8 changed files with 12 additions and 10 deletions

View File

@ -24,8 +24,8 @@ using namespace mbed_cellular_util;
namespace mbed {
AT_ControlPlane_netif::AT_ControlPlane_netif(ATHandler &at, int cid) : AT_CellularBase(at),
_cid(cid), _cb(NULL), _data(NULL)
AT_ControlPlane_netif::AT_ControlPlane_netif(ATHandler &at, int cid, AT_CellularDevice &device) :
_at(at), _cid(cid), _cb(NULL), _data(NULL), _device(device)
{
}

View File

@ -1056,7 +1056,7 @@ void AT_CellularContext::cellular_callback(nsapi_event_t ev, intptr_t ptr)
ControlPlane_netif *AT_CellularContext::get_cp_netif()
{
if (!_cp_netif) {
_cp_netif = new AT_ControlPlane_netif(_at, _cid);
_cp_netif = new AT_ControlPlane_netif(_at, _cid, *get_device());
}
return _cp_netif;
}

View File

@ -111,7 +111,7 @@ protected:
/** Get string name for NIDD context type.
* @return NIDD context text, e.g. Non-IP or NONIP
*/
virtual const char* get_nonip_context_type_str();
virtual const char *get_nonip_context_type_str();
private:
#if NSAPI_PPP_AVAILABLE

View File

@ -24,8 +24,8 @@ using namespace mbed_cellular_util;
namespace mbed {
AT_ControlPlane_netif::AT_ControlPlane_netif(ATHandler &at, int cid) :
_cid(cid), _cb(NULL), _data(NULL), _at(at)
AT_ControlPlane_netif::AT_ControlPlane_netif(ATHandler &at, int cid, AT_CellularDevice &device) :
_cid(cid), _cb(NULL), _data(NULL), _at(at), _device(device)
{
_at.set_urc_handler("+CRTDCP:", mbed::Callback<void()>(this, &AT_ControlPlane_netif::urc_cp_recv));
}

View File

@ -18,12 +18,13 @@
#include "CellularList.h"
#include "ControlPlane_netif.h"
#include "ATHandler.h"
#include "AT_CellularDevice.h"
namespace mbed {
class AT_ControlPlane_netif: public ControlPlane_netif {
public:
AT_ControlPlane_netif(ATHandler &at, int cid);
AT_ControlPlane_netif(ATHandler &at, int cid, AT_CellularDevice &device);
virtual ~AT_ControlPlane_netif();
protected:
@ -59,6 +60,7 @@ private:
protected:
ATHandler &_at;
AT_CellularDevice &_device;
};
} //mbed namespace

View File

@ -62,7 +62,7 @@ NetworkStack *QUECTEL_BG96_CellularContext::get_stack()
ControlPlane_netif *QUECTEL_BG96_CellularContext::get_cp_netif()
{
if (!_cp_netif) {
_cp_netif = new QUECTEL_BG96_ControlPlane_netif(_at, _cid);
_cp_netif = new QUECTEL_BG96_ControlPlane_netif(_at, _cid, *get_device());
}
return _cp_netif;
}

View File

@ -23,7 +23,7 @@ using namespace mbed_cellular_util;
namespace mbed {
QUECTEL_BG96_ControlPlane_netif::QUECTEL_BG96_ControlPlane_netif(ATHandler &at, int cid) : AT_ControlPlane_netif(at, cid)
QUECTEL_BG96_ControlPlane_netif::QUECTEL_BG96_ControlPlane_netif(ATHandler &at, int cid, AT_CellularDevice &device) : AT_ControlPlane_netif(at, cid, device)
{}
nsapi_size_or_error_t QUECTEL_BG96_ControlPlane_netif::send(const void *data, nsapi_size_t size)

View File

@ -23,7 +23,7 @@ namespace mbed {
class QUECTEL_BG96_ControlPlane_netif: public AT_ControlPlane_netif {
public:
QUECTEL_BG96_ControlPlane_netif(ATHandler &at, int cid);
QUECTEL_BG96_ControlPlane_netif(ATHandler &at, int cid, AT_CellularDevice &device);
virtual ~QUECTEL_BG96_ControlPlane_netif() {};
// ControlPlane_netif