Skip to content

Commit f76b21c

Browse files
Teppo Järvelin0xc0170
authored andcommitted
Cellular: Change AT_CellularNetwork to use CellularProperties.
This change enables removing function has_registration from class AT_CellularNetwork and all targets inheriting AT_CellularNetwork.
1 parent 104700c commit f76b21c

31 files changed

+149
-175
lines changed

UNITTESTS/features/cellular/framework/AT/at_cellularbase/at_cellularbasetest.cpp

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include "gtest/gtest.h"
1919
#include "AT_CellularBase.h"
2020
#include "EventQueue.h"
21-
#include "AT_CellularBase.h"
21+
#include "AT_CellularNetwork.h"
2222
#include "ATHandler_stub.h"
2323
#include "FileHandle_stub.h"
2424
#include <string.h>
@@ -33,19 +33,22 @@ class my_base : public AT_CellularBase {
3333
}
3434
bool check_not_supported()
3535
{
36-
static const intptr_t cellular_properties[AT_CellularBase::CELLULAR_PROPERTY_MAX] = {
36+
static const intptr_t cellular_properties[AT_CellularBase::PROPERTY_MAX] = {
37+
AT_CellularNetwork::RegistrationModeDisable,// C_EREG
38+
AT_CellularNetwork::RegistrationModeLAC, // C_GREG
39+
AT_CellularNetwork::RegistrationModeLAC, // C_REG
3740
0, // AT_CGSN_WITH_TYPE
3841
1, // AT_CGDATA
39-
1 // AT_CGAUTH
42+
1, // AT_CGAUTH
4043
};
4144

4245
set_cellular_properties(cellular_properties);
43-
return get_property(AT_CGSN_WITH_TYPE);
46+
return get_property(PROPERTY_AT_CGSN_WITH_TYPE);
4447
}
4548

4649
bool check_supported()
4750
{
48-
return get_property(AT_CGDATA);
51+
return get_property(PROPERTY_AT_CGDATA);
4952
}
5053
};
5154

@@ -107,7 +110,10 @@ TEST_F(TestAT_CellularBase, test_AT_CellularBase_set_cellular_properties)
107110
ATHandler ah(&fh, eq, 0, ",");
108111
AT_CellularBase at(ah);
109112

110-
static const intptr_t cellular_properties[AT_CellularBase::CELLULAR_PROPERTY_MAX] = {
113+
static const intptr_t cellular_properties[AT_CellularBase::PROPERTY_MAX] = {
114+
AT_CellularNetwork::RegistrationModeDisable,// C_EREG
115+
AT_CellularNetwork::RegistrationModeLAC, // C_GREG
116+
AT_CellularNetwork::RegistrationModeLAC, // C_REG
111117
0, // AT_CGSN_WITH_TYPE
112118
1, // AT_CGDATA
113119
1 // AT_CGAUTH

UNITTESTS/features/cellular/framework/AT/at_cellularnetwork/at_cellularnetworktest.cpp

Lines changed: 47 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,6 @@ class my_AT_CN : public AT_CellularNetwork {
5252
public:
5353
my_AT_CN(ATHandler &atHandler) : AT_CellularNetwork(atHandler) {}
5454
virtual ~my_AT_CN() {}
55-
virtual AT_CellularNetwork::RegistrationMode has_registration(RegistrationType reg_type)
56-
{
57-
if (reg_type == C_GREG) {
58-
return RegistrationModeDisable;
59-
}
60-
return RegistrationModeEnable;
61-
}
6255
virtual nsapi_error_t set_access_technology_impl(RadioAccessTechnology op_rat)
6356
{
6457
return NSAPI_ERROR_OK;
@@ -69,13 +62,6 @@ class my_AT_CNipv6 : public AT_CellularNetwork {
6962
public:
7063
my_AT_CNipv6(ATHandler &atHandler) : AT_CellularNetwork(atHandler) {}
7164
virtual ~my_AT_CNipv6() {}
72-
virtual AT_CellularNetwork::RegistrationMode has_registration(RegistrationType reg_type)
73-
{
74-
if (reg_type == C_GREG) {
75-
return RegistrationModeDisable;
76-
}
77-
return RegistrationModeEnable;
78-
}
7965
virtual nsapi_error_t set_access_technology_impl(RadioAccessTechnology op_rat)
8066
{
8167
return NSAPI_ERROR_OK;
@@ -150,32 +136,32 @@ TEST_F(TestAT_CellularNetwork, test_AT_CellularNetwork_get_registration_params)
150136
ATHandler_stub::read_string_value = NULL;
151137
ATHandler_stub::ssize_value = 0;
152138
// Check get_registration_params without specifying the registration type
153-
EXPECT_TRUE(NSAPI_ERROR_OK == cn.get_registration_params(reg_params_check));
154-
EXPECT_TRUE(reg_params_check._status == CellularNetwork::RegistrationDenied);
155-
EXPECT_TRUE(reg_params_check._act == CellularNetwork::RAT_EGPRS);
156-
EXPECT_TRUE(reg_params_check._cell_id == 305463233);
157-
EXPECT_TRUE(reg_params_check._active_time == 240);
158-
EXPECT_TRUE(reg_params_check._periodic_tau == 70 * 60 * 60);
139+
ASSERT_EQ(NSAPI_ERROR_OK, cn.get_registration_params(reg_params_check));
140+
ASSERT_EQ(reg_params_check._status, CellularNetwork::RegistrationDenied);
141+
ASSERT_EQ(reg_params_check._act, CellularNetwork::RAT_EGPRS);
142+
ASSERT_EQ(reg_params_check._cell_id, 305463233);
143+
ASSERT_EQ(reg_params_check._active_time, 240);
144+
ASSERT_EQ(reg_params_check._periodic_tau, 70 * 60 * 60);
159145

160146
reg_params._status = CellularNetwork::NotRegistered;
161147
reg_params._act = CellularNetwork::RAT_GSM;
162148
reg_params._cell_id = 1;
163-
EXPECT_TRUE(NSAPI_ERROR_OK == cn.get_registration_params(CellularNetwork::C_GREG, reg_params));
164-
EXPECT_TRUE(reg_params._status == CellularNetwork::RegistrationDenied);
165-
EXPECT_TRUE(reg_params._act == CellularNetwork::RAT_EGPRS);
166-
EXPECT_TRUE(reg_params._cell_id == -1);
149+
ASSERT_EQ(NSAPI_ERROR_OK, cn.get_registration_params(CellularNetwork::C_REG, reg_params));
150+
ASSERT_EQ(reg_params._status, CellularNetwork::RegistrationDenied);
151+
ASSERT_EQ(reg_params._act, CellularNetwork::RAT_EGPRS);
152+
ASSERT_EQ(reg_params._cell_id, -1);
167153

168154
my_AT_CN nw(at);
169155
reg_params._status = CellularNetwork::NotRegistered;
170156
reg_params._act = CellularNetwork::RAT_GSM;
171157

172-
EXPECT_TRUE(NSAPI_ERROR_UNSUPPORTED == nw.get_registration_params(CellularNetwork::C_GREG, reg_params));
173-
EXPECT_TRUE(reg_params._status == CellularNetwork::NotRegistered);
174-
EXPECT_TRUE(reg_params._act == CellularNetwork::RAT_GSM);
158+
ASSERT_EQ(NSAPI_ERROR_UNSUPPORTED, nw.get_registration_params(CellularNetwork::C_GREG, reg_params));
159+
ASSERT_EQ(reg_params._status, CellularNetwork::NotRegistered);
160+
ASSERT_EQ(reg_params._act, CellularNetwork::RAT_GSM);
175161

176-
EXPECT_TRUE(NSAPI_ERROR_OK == nw.get_registration_params(CellularNetwork::C_EREG, reg_params));
177-
EXPECT_TRUE(reg_params._status == CellularNetwork::RegistrationDenied);
178-
EXPECT_TRUE(reg_params._act == CellularNetwork::RAT_EGPRS);
162+
ASSERT_EQ(NSAPI_ERROR_OK, nw.get_registration_params(CellularNetwork::C_EREG, reg_params));
163+
ASSERT_EQ(reg_params._status, CellularNetwork::RegistrationDenied);
164+
ASSERT_EQ(reg_params._act, CellularNetwork::RAT_EGPRS);
179165

180166
ATHandler_stub::nsapi_error_value = NSAPI_ERROR_DEVICE_ERROR;
181167
reg_params._status = CellularNetwork::NotRegistered;
@@ -184,15 +170,15 @@ TEST_F(TestAT_CellularNetwork, test_AT_CellularNetwork_get_registration_params)
184170
reg_params._active_time = 2;
185171
reg_params._periodic_tau = 3;
186172

187-
EXPECT_TRUE(NSAPI_ERROR_DEVICE_ERROR == cn.get_registration_params(CellularNetwork::C_EREG, reg_params));
188-
EXPECT_TRUE(reg_params._status == CellularNetwork::NotRegistered);
189-
EXPECT_TRUE(reg_params._act == CellularNetwork::RAT_UNKNOWN);
173+
ASSERT_EQ(NSAPI_ERROR_DEVICE_ERROR, cn.get_registration_params(CellularNetwork::C_EREG, reg_params));
174+
ASSERT_EQ(reg_params._status, CellularNetwork::NotRegistered);
175+
ASSERT_EQ(reg_params._act, CellularNetwork::RAT_UNKNOWN);
190176
EXPECT_TRUE(reg_params._cell_id == -1 && reg_params._active_time == -1 && reg_params._periodic_tau == -1);
191177

192-
EXPECT_TRUE(NSAPI_ERROR_DEVICE_ERROR == cn.get_registration_params(CellularNetwork::C_GREG, reg_params));
193-
EXPECT_TRUE(reg_params._status == CellularNetwork::NotRegistered);
194-
EXPECT_TRUE(reg_params._act == CellularNetwork::RAT_UNKNOWN);
195-
EXPECT_TRUE(reg_params._cell_id == -1);
178+
ASSERT_EQ(NSAPI_ERROR_DEVICE_ERROR, cn.get_registration_params(CellularNetwork::C_REG, reg_params));
179+
ASSERT_EQ(reg_params._status, CellularNetwork::NotRegistered);
180+
ASSERT_EQ(reg_params._act, CellularNetwork::RAT_UNKNOWN);
181+
ASSERT_EQ(reg_params._cell_id, -1);
196182

197183
reg_params._status = CellularNetwork::SearchingNetwork;
198184
reg_params._act = CellularNetwork::RAT_GSM;
@@ -304,63 +290,63 @@ TEST_F(TestAT_CellularNetwork, test_AT_CellularNetwork_set_registration_urc)
304290
AT_CellularNetwork cn(at);
305291

306292
CellularNetwork::RegistrationType type = CellularNetwork::C_EREG;
307-
EXPECT_TRUE(NSAPI_ERROR_OK == cn.set_registration_urc(type, true));
293+
ASSERT_EQ(NSAPI_ERROR_OK, cn.set_registration_urc(type, true));
308294
type = CellularNetwork::C_GREG;
309-
EXPECT_TRUE(NSAPI_ERROR_OK == cn.set_registration_urc(type, true));
295+
ASSERT_EQ(NSAPI_ERROR_UNSUPPORTED, cn.set_registration_urc(type, true));
310296
type = CellularNetwork::C_REG;
311-
EXPECT_TRUE(NSAPI_ERROR_OK == cn.set_registration_urc(type, true));
297+
ASSERT_EQ(NSAPI_ERROR_OK, cn.set_registration_urc(type, true));
312298

313299
my_AT_CN nw(at);
314300
type = CellularNetwork::C_EREG;
315-
EXPECT_TRUE(NSAPI_ERROR_OK == nw.set_registration_urc(type, true));
301+
ASSERT_EQ(NSAPI_ERROR_OK, nw.set_registration_urc(type, true));
316302
type = CellularNetwork::C_GREG;
317-
EXPECT_TRUE(NSAPI_ERROR_UNSUPPORTED == nw.set_registration_urc(type, true));
303+
ASSERT_EQ(NSAPI_ERROR_UNSUPPORTED, nw.set_registration_urc(type, true));
318304
type = CellularNetwork::C_REG;
319-
EXPECT_TRUE(NSAPI_ERROR_OK == nw.set_registration_urc(type, true));
305+
ASSERT_EQ(NSAPI_ERROR_OK, nw.set_registration_urc(type, true));
320306

321307
type = CellularNetwork::C_EREG;
322-
EXPECT_TRUE(NSAPI_ERROR_OK == cn.set_registration_urc(type, false));
308+
ASSERT_EQ(NSAPI_ERROR_OK, cn.set_registration_urc(type, false));
323309
type = CellularNetwork::C_GREG;
324-
EXPECT_TRUE(NSAPI_ERROR_OK == cn.set_registration_urc(type, false));
310+
ASSERT_EQ(NSAPI_ERROR_UNSUPPORTED, cn.set_registration_urc(type, false));
325311
type = CellularNetwork::C_REG;
326-
EXPECT_TRUE(NSAPI_ERROR_OK == cn.set_registration_urc(type, false));
312+
ASSERT_EQ(NSAPI_ERROR_OK, cn.set_registration_urc(type, false));
327313

328314
type = CellularNetwork::C_EREG;
329-
EXPECT_TRUE(NSAPI_ERROR_OK == nw.set_registration_urc(type, false));
315+
ASSERT_EQ(NSAPI_ERROR_OK, nw.set_registration_urc(type, false));
330316
type = CellularNetwork::C_GREG;
331-
EXPECT_TRUE(NSAPI_ERROR_UNSUPPORTED == nw.set_registration_urc(type, false));
317+
ASSERT_EQ(NSAPI_ERROR_UNSUPPORTED, nw.set_registration_urc(type, false));
332318
type = CellularNetwork::C_REG;
333-
EXPECT_TRUE(NSAPI_ERROR_OK == nw.set_registration_urc(type, false));
319+
ASSERT_EQ(NSAPI_ERROR_OK, nw.set_registration_urc(type, false));
334320

335321

336322
ATHandler_stub::nsapi_error_value = NSAPI_ERROR_DEVICE_ERROR;
337323
type = CellularNetwork::C_EREG;
338-
EXPECT_TRUE(NSAPI_ERROR_DEVICE_ERROR == cn.set_registration_urc(type, true));
324+
ASSERT_EQ(NSAPI_ERROR_DEVICE_ERROR, cn.set_registration_urc(type, true));
339325
type = CellularNetwork::C_GREG;
340-
EXPECT_TRUE(NSAPI_ERROR_DEVICE_ERROR == cn.set_registration_urc(type, true));
326+
ASSERT_EQ(NSAPI_ERROR_UNSUPPORTED, cn.set_registration_urc(type, true));
341327
type = CellularNetwork::C_REG;
342-
EXPECT_TRUE(NSAPI_ERROR_DEVICE_ERROR == cn.set_registration_urc(type, true));
328+
ASSERT_EQ(NSAPI_ERROR_DEVICE_ERROR, cn.set_registration_urc(type, true));
343329

344330
type = CellularNetwork::C_EREG;
345-
EXPECT_TRUE(NSAPI_ERROR_DEVICE_ERROR == nw.set_registration_urc(type, true));
331+
ASSERT_EQ(NSAPI_ERROR_DEVICE_ERROR, nw.set_registration_urc(type, true));
346332
type = CellularNetwork::C_GREG;
347-
EXPECT_TRUE(NSAPI_ERROR_UNSUPPORTED == nw.set_registration_urc(type, true));
333+
ASSERT_EQ(NSAPI_ERROR_UNSUPPORTED, nw.set_registration_urc(type, true));
348334
type = CellularNetwork::C_REG;
349-
EXPECT_TRUE(NSAPI_ERROR_DEVICE_ERROR == nw.set_registration_urc(type, true));
335+
ASSERT_EQ(NSAPI_ERROR_DEVICE_ERROR, nw.set_registration_urc(type, true));
350336

351337
type = CellularNetwork::C_EREG;
352-
EXPECT_TRUE(NSAPI_ERROR_DEVICE_ERROR == cn.set_registration_urc(type, false));
338+
ASSERT_EQ(NSAPI_ERROR_DEVICE_ERROR, cn.set_registration_urc(type, false));
353339
type = CellularNetwork::C_GREG;
354-
EXPECT_TRUE(NSAPI_ERROR_DEVICE_ERROR == cn.set_registration_urc(type, false));
340+
ASSERT_EQ(NSAPI_ERROR_UNSUPPORTED, cn.set_registration_urc(type, false));
355341
type = CellularNetwork::C_REG;
356-
EXPECT_TRUE(NSAPI_ERROR_DEVICE_ERROR == cn.set_registration_urc(type, false));
342+
ASSERT_EQ(NSAPI_ERROR_DEVICE_ERROR, cn.set_registration_urc(type, false));
357343

358344
type = CellularNetwork::C_EREG;
359-
EXPECT_TRUE(NSAPI_ERROR_DEVICE_ERROR == nw.set_registration_urc(type, false));
345+
ASSERT_EQ(NSAPI_ERROR_DEVICE_ERROR, nw.set_registration_urc(type, false));
360346
type = CellularNetwork::C_GREG;
361-
EXPECT_TRUE(NSAPI_ERROR_UNSUPPORTED == nw.set_registration_urc(type, false));
347+
ASSERT_EQ(NSAPI_ERROR_UNSUPPORTED, nw.set_registration_urc(type, false));
362348
type = CellularNetwork::C_REG;
363-
EXPECT_TRUE(NSAPI_ERROR_DEVICE_ERROR == nw.set_registration_urc(type, false));
349+
ASSERT_EQ(NSAPI_ERROR_DEVICE_ERROR, nw.set_registration_urc(type, false));
364350
}
365351

366352
TEST_F(TestAT_CellularNetwork, test_AT_CellularNetwork_set_attach)

UNITTESTS/stubs/AT_CellularBase_stub.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
#include "nsapi_types.h"
1919
#include "AT_CellularBase_stub.h"
20-
20+
#include "AT_CellularNetwork.h"
2121
using namespace mbed;
2222

2323
ATHandler *AT_CellularBase_stub::handler_value = NULL;
@@ -42,5 +42,11 @@ device_err_t AT_CellularBase::get_device_error() const
4242

4343
intptr_t AT_CellularBase::get_property(CellularProperty key)
4444
{
45+
if (key == PROPERTY_C_GREG) {
46+
return AT_CellularNetwork::RegistrationModeDisable;
47+
} else if (key == PROPERTY_C_REG || key == PROPERTY_C_EREG) {
48+
return AT_CellularNetwork::RegistrationModeEnable;
49+
}
50+
4551
return AT_CellularBase_stub::supported_bool;
4652
}

UNITTESTS/stubs/AT_CellularNetwork_stub.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,6 @@ nsapi_error_t AT_CellularNetwork::get_registration_params(registration_params_t
6868
return NSAPI_ERROR_OK;
6969
}
7070

71-
AT_CellularNetwork::RegistrationMode AT_CellularNetwork::has_registration(RegistrationType reg_type)
72-
{
73-
return RegistrationModeDisable;
74-
}
75-
7671
nsapi_error_t AT_CellularNetwork::set_attach()
7772
{
7873
return NSAPI_ERROR_OK;

features/cellular/framework/AT/AT_CellularBase.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,13 @@ class AT_CellularBase {
4343
device_err_t get_device_error() const;
4444

4545
enum CellularProperty {
46-
AT_CGSN_WITH_TYPE, // 0 = not supported, 1 = supported. AT+CGSN without type is likely always supported similar to AT+GSN.
47-
AT_CGDATA, // 0 = not supported, 1 = supported. Alternative is to support only ATD*99***<cid>#
48-
AT_CGAUTH, // 0 = not supported, 1 = supported. APN authentication AT commands supported
49-
CELLULAR_PROPERTY_MAX
46+
PROPERTY_C_EREG, // AT_CellularNetwork::RegistrationMode. What support modem has for this registration type.
47+
PROPERTY_C_GREG, // AT_CellularNetwork::RegistrationMode. What support modem has for this registration type.
48+
PROPERTY_C_REG, // AT_CellularNetwork::RegistrationMode. What support modem has for this registration type.
49+
PROPERTY_AT_CGSN_WITH_TYPE, // 0 = not supported, 1 = supported. AT+CGSN without type is likely always supported similar to AT+GSN.
50+
PROPERTY_AT_CGDATA, // 0 = not supported, 1 = supported. Alternative is to support only ATD*99***<cid>#
51+
PROPERTY_AT_CGAUTH, // 0 = not supported, 1 = supported. APN authentication AT commands supported
52+
PROPERTY_MAX
5053
};
5154

5255
/** Cellular module need to define an array of cellular properties which defines module supported property values.

features/cellular/framework/AT/AT_CellularContext.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ nsapi_error_t AT_CellularContext::do_user_authentication()
289289
{
290290
// if user has defined user name and password we need to call CGAUTH before activating or modifying context
291291
if (_pwd && _uname) {
292-
if (!get_property(AT_CGAUTH)) {
292+
if (!get_property(PROPERTY_AT_CGAUTH)) {
293293
return NSAPI_ERROR_UNSUPPORTED;
294294
}
295295
_at.cmd_start("AT+CGAUTH=");
@@ -572,7 +572,7 @@ void AT_CellularContext::do_connect()
572572
nsapi_error_t AT_CellularContext::open_data_channel()
573573
{
574574
tr_info("CellularContext PPP connect");
575-
if (get_property(AT_CGDATA)) {
575+
if (get_property(PROPERTY_AT_CGDATA)) {
576576
_at.cmd_start("AT+CGDATA=\"PPP\",");
577577
_at.write_int(_cid);
578578
} else {

features/cellular/framework/AT/AT_CellularInformation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ nsapi_error_t AT_CellularInformation::get_serial_number(char *buf, size_t buf_si
5454
return get_info("AT+CGSN", buf, buf_size);
5555
}
5656

57-
if (!get_property(AT_CGSN_WITH_TYPE)) {
57+
if (!get_property(PROPERTY_AT_CGSN_WITH_TYPE)) {
5858
return NSAPI_ERROR_UNSUPPORTED;
5959
}
6060

features/cellular/framework/AT/AT_CellularNetwork.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ AT_CellularNetwork::AT_CellularNetwork(ATHandler &atHandler) : AT_CellularBase(a
8080
_urc_funcs[C_REG] = callback(this, &AT_CellularNetwork::urc_creg);
8181

8282
for (int type = 0; type < CellularNetwork::C_MAX; type++) {
83-
if (has_registration((RegistrationType)type) != RegistrationModeDisable) {
83+
if (get_property((AT_CellularBase::CellularProperty)type) != RegistrationModeDisable) {
8484
_at.set_urc_handler(at_reg[type].urc_prefix, _urc_funcs[type]);
8585
}
8686
}
@@ -103,7 +103,7 @@ AT_CellularNetwork::~AT_CellularNetwork()
103103
_at.unlock();
104104

105105
for (int type = 0; type < CellularNetwork::C_MAX; type++) {
106-
if (has_registration((RegistrationType)type) != RegistrationModeDisable) {
106+
if (get_property((AT_CellularBase::CellularProperty)type) != RegistrationModeDisable) {
107107
_at.set_urc_handler(at_reg[type].urc_prefix, 0);
108108
}
109109
}
@@ -223,7 +223,7 @@ nsapi_error_t AT_CellularNetwork::set_registration_urc(RegistrationType type, bo
223223
int index = (int)type;
224224
MBED_ASSERT(index >= 0 && index < C_MAX);
225225

226-
RegistrationMode mode = has_registration(type);
226+
RegistrationMode mode = (RegistrationMode)get_property((AT_CellularBase::CellularProperty)type);
227227
if (mode == RegistrationModeDisable) {
228228
return NSAPI_ERROR_UNSUPPORTED;
229229
} else {
@@ -322,12 +322,6 @@ void AT_CellularNetwork::read_reg_params(RegistrationType type, registration_par
322322
#endif
323323
}
324324

325-
AT_CellularNetwork::RegistrationMode AT_CellularNetwork::has_registration(RegistrationType reg_type)
326-
{
327-
(void)reg_type;
328-
return RegistrationModeLAC;
329-
}
330-
331325
nsapi_error_t AT_CellularNetwork::set_attach()
332326
{
333327
_at.lock();
@@ -612,7 +606,7 @@ nsapi_error_t AT_CellularNetwork::get_registration_params(RegistrationType type,
612606
int i = (int)type;
613607
MBED_ASSERT(i >= 0 && i < C_MAX);
614608

615-
if (!has_registration(at_reg[i].type)) {
609+
if (!get_property((AT_CellularBase::CellularProperty)at_reg[i].type)) {
616610
return NSAPI_ERROR_UNSUPPORTED;
617611
}
618612

features/cellular/framework/AT/AT_CellularNetwork.h

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ class AT_CellularNetwork : public CellularNetwork, public AT_CellularBase {
4343
// declare friend so it can access stack
4444
friend class AT_CellularDevice;
4545

46+
enum RegistrationMode {
47+
RegistrationModeDisable = 0,
48+
RegistrationModeEnable, // <stat>
49+
RegistrationModeLAC, // <stat>[,<[lac>,]<[ci>],[<AcT>],[<rac>]]
50+
};
51+
4652
public: // CellularNetwork
4753

4854
virtual nsapi_error_t set_registration(const char *plmn = 0);
@@ -92,18 +98,6 @@ class AT_CellularNetwork : public CellularNetwork, public AT_CellularBase {
9298

9399
protected:
94100

95-
/** Check if modem supports given registration type.
96-
*
97-
* @param reg_type enum RegistrationType
98-
* @return mode supported on given reg_type as per 3GPP TS 27.007, 0 when unsupported
99-
*/
100-
enum RegistrationMode {
101-
RegistrationModeDisable = 0,
102-
RegistrationModeEnable, // <stat>
103-
RegistrationModeLAC, // <stat>[,<[lac>,]<[ci>],[<AcT>],[<rac>]]
104-
};
105-
virtual RegistrationMode has_registration(RegistrationType reg_type);
106-
107101
/** Sets access technology to be scanned. Modem specific implementation.
108102
*
109103
* @param op_rat Access technology

0 commit comments

Comments
 (0)