Skip to content

Commit c0b8a11

Browse files
author
Mirela Chirica
committed
Cellular: Fix network greentea tests for BC95 modem
1 parent b5d68b5 commit c0b8a11

File tree

2 files changed

+28
-15
lines changed

2 files changed

+28
-15
lines changed

features/cellular/TESTS/api/cellular_network/main.cpp

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ static void test_other()
225225
if (strcmp(devi, "QUECTEL_BG96") != 0 && strcmp(devi, "TELIT_HE910") != 0) { // QUECTEL_BG96 does not give any specific reason for device error
226226
if (err == NSAPI_ERROR_DEVICE_ERROR) {
227227
TEST_ASSERT(((AT_CellularNetwork *)nw)->get_device_error().errCode == 100 && // 100 == unknown command for modem
228-
((AT_CellularNetwork *)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
228+
((AT_CellularNetwork *)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
229229
}
230230
}
231231

@@ -235,7 +235,7 @@ static void test_other()
235235
if (err == NSAPI_ERROR_DEVICE_ERROR) {
236236
if (strcmp(devi, "QUECTEL_BG96") != 0 && strcmp(devi, "TELIT_HE910") != 0) { // QUECTEL_BG96 does not give any specific reason for device error
237237
TEST_ASSERT(((AT_CellularNetwork *)nw)->get_device_error().errCode == 100 && // 100 == unknown command for modem
238-
((AT_CellularNetwork *)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
238+
((AT_CellularNetwork *)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
239239
}
240240
} else if (err == NSAPI_ERROR_PARAMETER) {
241241
TEST_ASSERT(uplinkRate == -1);
@@ -246,6 +246,8 @@ static void test_other()
246246
err = nw->set_access_technology(CellularNetwork::RAT_GSM);
247247
TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_UNSUPPORTED);
248248

249+
// scanning of operators requires some delay before operation is allowed(seen with WISE_1570)
250+
wait(5);
249251
// scanning of operators might take a long time
250252
cellular.get_device()->set_timeout(240 * 1000);
251253
CellularNetwork::operList_t operators;
@@ -264,8 +266,9 @@ static void test_other()
264266
TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_DEVICE_ERROR);
265267
if (err == NSAPI_ERROR_DEVICE_ERROR) {
266268
if (strcmp(devi, "TELIT_HE910") != 0) { // TELIT_HE910 just gives an error and no specific error number so we can't know is this real error or that modem/network does not support the command
267-
TEST_ASSERT(((AT_CellularNetwork *)nw)->get_device_error().errCode == 100 && // 100 == unknown command for modem
268-
((AT_CellularNetwork *)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
269+
TEST_ASSERT((((AT_CellularNetwork *)nw)->get_device_error().errType == 3) && // 3 == CME error from the modem
270+
((((AT_CellularNetwork *)nw)->get_device_error().errCode == 100) || // 100 == unknown command for modem
271+
(((AT_CellularNetwork *)nw)->get_device_error().errCode == 50))); // 50 == incorrect parameters // seen in wise_1570 for not supported commands
269272
}
270273
} else {
271274
// should have some values, only not optional are apn and bearer id
@@ -278,8 +281,9 @@ static void test_other()
278281
TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_DEVICE_ERROR);
279282
if (err == NSAPI_ERROR_DEVICE_ERROR) {
280283
if (strcmp(devi, "QUECTEL_BG96") != 0 && strcmp(devi, "TELIT_HE910") != 0) {// QUECTEL_BG96 does not give any specific reason for device error
281-
TEST_ASSERT(((AT_CellularNetwork *)nw)->get_device_error().errCode == 100 && // 100 == unknown command for modem
282-
((AT_CellularNetwork *)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
284+
TEST_ASSERT((((AT_CellularNetwork *)nw)->get_device_error().errType == 3) && // 3 == CME error from the modem
285+
((((AT_CellularNetwork *)nw)->get_device_error().errCode == 100) || // 100 == unknown command for modem
286+
(((AT_CellularNetwork *)nw)->get_device_error().errCode == 50))); // 50 == incorrect parameters // seen in wise_1570 for not supported commands
283287
}
284288
} else {
285289
// we should have some values which are not optional
@@ -291,9 +295,10 @@ static void test_other()
291295
err = nw->get_signal_quality(rssi, ber);
292296
TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_DEVICE_ERROR);
293297
if (err == NSAPI_ERROR_DEVICE_ERROR) {
294-
TEST_ASSERT(((AT_CellularNetwork *)nw)->get_device_error().errCode == 100 && // 100 == unknown command for modem
295-
((AT_CellularNetwork *)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
296-
} else {
298+
TEST_ASSERT((((AT_CellularNetwork *)nw)->get_device_error().errType == 3) && // 3 == CME error from the modem
299+
((((AT_CellularNetwork *)nw)->get_device_error().errCode == 100) || // 100 == unknown command for modem
300+
(((AT_CellularNetwork *)nw)->get_device_error().errCode == 50))); // 50 == incorrect parameters // seen in wise_1570 for not supported commands
301+
} else {
297302
// test for values
298303
TEST_ASSERT(rssi >= 0);
299304
TEST_ASSERT(ber >= 0);
@@ -321,8 +326,9 @@ static void test_other()
321326
TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_DEVICE_ERROR);
322327
if (err == NSAPI_ERROR_DEVICE_ERROR) {
323328
// if device error then we must check was that really device error or that modem/network does not support the commands
324-
TEST_ASSERT(((AT_CellularNetwork *)nw)->get_device_error().errCode == 4 // 4 == NOT SUPPORTED BY THE MODEM
325-
&& ((AT_CellularNetwork *)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
329+
TEST_ASSERT((((AT_CellularNetwork *)nw)->get_device_error().errType == 3) && // 3 == CME error from the modem
330+
((((AT_CellularNetwork *)nw)->get_device_error().errCode == 4) || // 4 == NOT SUPPORTED BY THE MODEM
331+
(((AT_CellularNetwork *)nw)->get_device_error().errCode == 50))); // 50 == incorrect parameters // seen in wise_1570 for not supported commands
326332
} else {
327333
CellularNetwork::operator_names_t *opn = op_names.get_head();
328334
TEST_ASSERT(strlen(opn->numeric) > 0);
@@ -338,8 +344,9 @@ static void test_other()
338344
if (err == NSAPI_ERROR_DEVICE_ERROR) {
339345
// if device error then we must check was that really device error or that modem/network does not support the commands
340346
if (!(strcmp(devi, "TELIT_HE910") == 0 || strcmp(devi, "QUECTEL_BG96") == 0)) {
341-
TEST_ASSERT(((AT_CellularNetwork *)nw)->get_device_error().errCode == 100 && // 100 == unknown command for modem
342-
((AT_CellularNetwork *)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
347+
TEST_ASSERT((((AT_CellularNetwork *)nw)->get_device_error().errType == 3) && // 3 == CME error from the modem
348+
((((AT_CellularNetwork *)nw)->get_device_error().errCode == 100) || // 100 == unknown command for modem
349+
(((AT_CellularNetwork *)nw)->get_device_error().errCode == 50))); // 50 == incorrect parameters // seen in wise_1570 for not supported commands
343350
}
344351
} else {
345352
TEST_ASSERT(supported_opt != CellularNetwork::SUPPORTED_UE_OPT_MAX);
@@ -351,8 +358,9 @@ static void test_other()
351358
if (err == NSAPI_ERROR_DEVICE_ERROR) {
352359
// if device error then we must check was that really device error or that modem/network does not support the commands
353360
if (!(strcmp(devi, "TELIT_HE910") == 0 || strcmp(devi, "QUECTEL_BG96") == 0)) {
354-
TEST_ASSERT(((AT_CellularNetwork *)nw)->get_device_error().errCode == 100 && // 100 == unknown command for modem
355-
((AT_CellularNetwork *)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
361+
TEST_ASSERT((((AT_CellularNetwork *)nw)->get_device_error().errType == 3) && // 3 == CME error from the modem
362+
((((AT_CellularNetwork *)nw)->get_device_error().errCode == 100) || // 100 == unknown command for modem
363+
(((AT_CellularNetwork *)nw)->get_device_error().errCode == 50))); // 50 == incorrect parameters // seen in wise_1570 for not supported commands
356364
}
357365
}
358366
}

features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularPower.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ nsapi_error_t QUECTEL_BC95_CellularPower::set_at_mode()
3333
{
3434
_at.lock();
3535
_at.flush();
36+
_at.cmd_start("AT");
37+
_at.cmd_stop();
38+
_at.resp_start();
39+
_at.resp_stop();
40+
3641
_at.cmd_start("AT+CMEE="); // verbose responses
3742
_at.write_int(1);
3843
_at.cmd_stop();

0 commit comments

Comments
 (0)