Skip to content

Commit 7899fea

Browse files
author
Ari Parkkila
committed
Cellular: Refactor CellularBase from AT_ControlPlane_netif
1 parent 4b3ef73 commit 7899fea

File tree

8 files changed

+12
-10
lines changed

8 files changed

+12
-10
lines changed

UNITTESTS/stubs/AT_ControlPlane_netif_stub.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ using namespace mbed_cellular_util;
2424

2525
namespace mbed {
2626

27-
AT_ControlPlane_netif::AT_ControlPlane_netif(ATHandler &at, int cid) : AT_CellularBase(at),
28-
_cid(cid), _cb(NULL), _data(NULL)
27+
AT_ControlPlane_netif::AT_ControlPlane_netif(ATHandler &at, int cid, AT_CellularDevice &device) :
28+
_at(at), _cid(cid), _cb(NULL), _data(NULL), _device(device)
2929
{
3030
}
3131

features/cellular/framework/AT/AT_CellularContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@ void AT_CellularContext::cellular_callback(nsapi_event_t ev, intptr_t ptr)
10561056
ControlPlane_netif *AT_CellularContext::get_cp_netif()
10571057
{
10581058
if (!_cp_netif) {
1059-
_cp_netif = new AT_ControlPlane_netif(_at, _cid);
1059+
_cp_netif = new AT_ControlPlane_netif(_at, _cid, *get_device());
10601060
}
10611061
return _cp_netif;
10621062
}

features/cellular/framework/AT/AT_CellularContext.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class AT_CellularContext : public CellularContext {
111111
/** Get string name for NIDD context type.
112112
* @return NIDD context text, e.g. Non-IP or NONIP
113113
*/
114-
virtual const char* get_nonip_context_type_str();
114+
virtual const char *get_nonip_context_type_str();
115115

116116
private:
117117
#if NSAPI_PPP_AVAILABLE

features/cellular/framework/AT/AT_ControlPlane_netif.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ using namespace mbed_cellular_util;
2424

2525
namespace mbed {
2626

27-
AT_ControlPlane_netif::AT_ControlPlane_netif(ATHandler &at, int cid) :
28-
_cid(cid), _cb(NULL), _data(NULL), _at(at)
27+
AT_ControlPlane_netif::AT_ControlPlane_netif(ATHandler &at, int cid, AT_CellularDevice &device) :
28+
_cid(cid), _cb(NULL), _data(NULL), _at(at), _device(device)
2929
{
3030
_at.set_urc_handler("+CRTDCP:", mbed::Callback<void()>(this, &AT_ControlPlane_netif::urc_cp_recv));
3131
}

features/cellular/framework/AT/AT_ControlPlane_netif.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
#include "CellularList.h"
1919
#include "ControlPlane_netif.h"
2020
#include "ATHandler.h"
21+
#include "AT_CellularDevice.h"
2122

2223
namespace mbed {
2324

2425
class AT_ControlPlane_netif: public ControlPlane_netif {
2526
public:
26-
AT_ControlPlane_netif(ATHandler &at, int cid);
27+
AT_ControlPlane_netif(ATHandler &at, int cid, AT_CellularDevice &device);
2728
virtual ~AT_ControlPlane_netif();
2829

2930
protected:
@@ -59,6 +60,7 @@ class AT_ControlPlane_netif: public ControlPlane_netif {
5960

6061
protected:
6162
ATHandler &_at;
63+
AT_CellularDevice &_device;
6264
};
6365

6466
} //mbed namespace

features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96_CellularContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ NetworkStack *QUECTEL_BG96_CellularContext::get_stack()
6262
ControlPlane_netif *QUECTEL_BG96_CellularContext::get_cp_netif()
6363
{
6464
if (!_cp_netif) {
65-
_cp_netif = new QUECTEL_BG96_ControlPlane_netif(_at, _cid);
65+
_cp_netif = new QUECTEL_BG96_ControlPlane_netif(_at, _cid, *get_device());
6666
}
6767
return _cp_netif;
6868
}

features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96_ControlPlane_netif.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ using namespace mbed_cellular_util;
2323

2424
namespace mbed {
2525

26-
QUECTEL_BG96_ControlPlane_netif::QUECTEL_BG96_ControlPlane_netif(ATHandler &at, int cid) : AT_ControlPlane_netif(at, cid)
26+
QUECTEL_BG96_ControlPlane_netif::QUECTEL_BG96_ControlPlane_netif(ATHandler &at, int cid, AT_CellularDevice &device) : AT_ControlPlane_netif(at, cid, device)
2727
{}
2828

2929
nsapi_size_or_error_t QUECTEL_BG96_ControlPlane_netif::send(const void *data, nsapi_size_t size)

features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96_ControlPlane_netif.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace mbed {
2323

2424
class QUECTEL_BG96_ControlPlane_netif: public AT_ControlPlane_netif {
2525
public:
26-
QUECTEL_BG96_ControlPlane_netif(ATHandler &at, int cid);
26+
QUECTEL_BG96_ControlPlane_netif(ATHandler &at, int cid, AT_CellularDevice &device);
2727
virtual ~QUECTEL_BG96_ControlPlane_netif() {};
2828

2929
// ControlPlane_netif

0 commit comments

Comments
 (0)