Skip to content

Commit 71d3574

Browse files
committed
cellular: fix coding style
1 parent 96191e2 commit 71d3574

File tree

16 files changed

+116
-123
lines changed

16 files changed

+116
-123
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ static void test_information_interface()
8484
TEST_ASSERT(info->get_model(buf, kbuf_size) == NSAPI_ERROR_OK);
8585
TEST_ASSERT(info->get_revision(buf, kbuf_size) == NSAPI_ERROR_OK);
8686
TEST_ASSERT((info->get_serial_number(buf, kbuf_size, CellularInformation::SN) == NSAPI_ERROR_OK) ||
87-
((((AT_CellularInformation *)info)->get_device_error().errType == 3) && // 3 == CME error from the modem
88-
(((AT_CellularInformation *)info)->get_device_error().errCode == 4))); // 4 == "operation not supported"
87+
((((AT_CellularInformation *)info)->get_device_error().errType == 3) && // 3 == CME error from the modem
88+
(((AT_CellularInformation *)info)->get_device_error().errCode == 4))); // 4 == "operation not supported"
8989

9090
nsapi_error_t err = info->get_serial_number(buf, kbuf_size, CellularInformation::IMEI);
9191
TEST_ASSERT(err == NSAPI_ERROR_UNSUPPORTED || err == NSAPI_ERROR_OK);

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ static void test_credentials()
223223

224224
static void test_other()
225225
{
226-
const char* devi = CELLULAR_STRINGIFY(CELLULAR_DEVICE);
226+
const char *devi = CELLULAR_STRINGIFY(CELLULAR_DEVICE);
227227
TEST_ASSERT(nw->get_3gpp_error() == 0);
228228

229229
CellularNetwork::RateControlExceptionReports reports;
@@ -244,8 +244,8 @@ static void test_other()
244244
TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_DEVICE_ERROR || err == NSAPI_ERROR_PARAMETER);
245245
if (err == NSAPI_ERROR_DEVICE_ERROR) {
246246
if (strcmp(devi, "QUECTEL_BG96") != 0 && strcmp(devi, "TELIT_HE910") != 0 && strcmp(devi, "SARA4_PPP") != 0) { // QUECTEL_BG96 does not give any specific reason for device error
247-
TEST_ASSERT(((AT_CellularNetwork *)nw)->get_device_error().errCode == 100 && // 100 == unknown command for modem
248-
((AT_CellularNetwork *)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
247+
TEST_ASSERT(((AT_CellularNetwork *)nw)->get_device_error().errCode == 100 && // 100 == unknown command for modem
248+
((AT_CellularNetwork *)nw)->get_device_error().errType == 3); // 3 == CME error from the modem
249249
}
250250
} else if (err == NSAPI_ERROR_PARAMETER) {
251251
TEST_ASSERT(uplinkRate == -1);
@@ -277,8 +277,8 @@ static void test_other()
277277
if (err == NSAPI_ERROR_DEVICE_ERROR) {
278278
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
279279
TEST_ASSERT((((AT_CellularNetwork *)nw)->get_device_error().errType == 3) && // 3 == CME error from the modem
280-
((((AT_CellularNetwork *)nw)->get_device_error().errCode == 100) || // 100 == unknown command for modem
281-
(((AT_CellularNetwork *)nw)->get_device_error().errCode == 50))); // 50 == incorrect parameters // seen in wise_1570 for not supported commands
280+
((((AT_CellularNetwork *)nw)->get_device_error().errCode == 100) || // 100 == unknown command for modem
281+
(((AT_CellularNetwork *)nw)->get_device_error().errCode == 50))); // 50 == incorrect parameters // seen in wise_1570 for not supported commands
282282
}
283283
} else {
284284
// should have some values, only not optional are apn and bearer id
@@ -292,8 +292,8 @@ static void test_other()
292292
if (err == NSAPI_ERROR_DEVICE_ERROR) {
293293
if (strcmp(devi, "QUECTEL_BG96") != 0 && strcmp(devi, "TELIT_HE910") != 0) {// QUECTEL_BG96 does not give any specific reason for device error
294294
TEST_ASSERT((((AT_CellularNetwork *)nw)->get_device_error().errType == 3) && // 3 == CME error from the modem
295-
((((AT_CellularNetwork *)nw)->get_device_error().errCode == 100) || // 100 == unknown command for modem
296-
(((AT_CellularNetwork *)nw)->get_device_error().errCode == 50))); // 50 == incorrect parameters // seen in wise_1570 for not supported commands
295+
((((AT_CellularNetwork *)nw)->get_device_error().errCode == 100) || // 100 == unknown command for modem
296+
(((AT_CellularNetwork *)nw)->get_device_error().errCode == 50))); // 50 == incorrect parameters // seen in wise_1570 for not supported commands
297297
}
298298
} else {
299299
// we should have some values which are not optional
@@ -306,9 +306,9 @@ static void test_other()
306306
TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_DEVICE_ERROR);
307307
if (err == NSAPI_ERROR_DEVICE_ERROR) {
308308
TEST_ASSERT((((AT_CellularNetwork *)nw)->get_device_error().errType == 3) && // 3 == CME error from the modem
309-
((((AT_CellularNetwork *)nw)->get_device_error().errCode == 100) || // 100 == unknown command for modem
310-
(((AT_CellularNetwork *)nw)->get_device_error().errCode == 50))); // 50 == incorrect parameters // seen in wise_1570 for not supported commands
311-
} else {
309+
((((AT_CellularNetwork *)nw)->get_device_error().errCode == 100) || // 100 == unknown command for modem
310+
(((AT_CellularNetwork *)nw)->get_device_error().errCode == 50))); // 50 == incorrect parameters // seen in wise_1570 for not supported commands
311+
} else {
312312
// test for values
313313
TEST_ASSERT(rssi >= 0);
314314
TEST_ASSERT(ber >= 0);
@@ -339,8 +339,8 @@ static void test_other()
339339
if (err == NSAPI_ERROR_DEVICE_ERROR) {
340340
// if device error then we must check was that really device error or that modem/network does not support the commands
341341
TEST_ASSERT((((AT_CellularNetwork *)nw)->get_device_error().errType == 3) && // 3 == CME error from the modem
342-
((((AT_CellularNetwork *)nw)->get_device_error().errCode == 4) || // 4 == NOT SUPPORTED BY THE MODEM
343-
(((AT_CellularNetwork *)nw)->get_device_error().errCode == 50))); // 50 == incorrect parameters // seen in wise_1570 for not supported commands
342+
((((AT_CellularNetwork *)nw)->get_device_error().errCode == 4) || // 4 == NOT SUPPORTED BY THE MODEM
343+
(((AT_CellularNetwork *)nw)->get_device_error().errCode == 50))); // 50 == incorrect parameters // seen in wise_1570 for not supported commands
344344
} else {
345345
CellularNetwork::operator_names_t *opn = op_names.get_head();
346346
TEST_ASSERT(strlen(opn->numeric) > 0);
@@ -358,8 +358,8 @@ static void test_other()
358358
// if device error then we must check was that really device error or that modem/network does not support the commands
359359
if (!(strcmp(devi, "TELIT_HE910") == 0 || strcmp(devi, "QUECTEL_BG96") == 0 || strcmp(devi, "SARA4_PPP") == 0)) {
360360
TEST_ASSERT((((AT_CellularNetwork *)nw)->get_device_error().errType == 3) && // 3 == CME error from the modem
361-
((((AT_CellularNetwork *)nw)->get_device_error().errCode == 100) || // 100 == unknown command for modem
362-
(((AT_CellularNetwork *)nw)->get_device_error().errCode == 50))); // 50 == incorrect parameters // seen in wise_1570 for not supported commands
361+
((((AT_CellularNetwork *)nw)->get_device_error().errCode == 100) || // 100 == unknown command for modem
362+
(((AT_CellularNetwork *)nw)->get_device_error().errCode == 50))); // 50 == incorrect parameters // seen in wise_1570 for not supported commands
363363
}
364364
} else {
365365
TEST_ASSERT(supported_opt != CellularNetwork::SUPPORTED_UE_OPT_MAX);
@@ -372,8 +372,8 @@ static void test_other()
372372
// if device error then we must check was that really device error or that modem/network does not support the commands
373373
if (!(strcmp(devi, "TELIT_HE910") == 0 || strcmp(devi, "QUECTEL_BG96") == 0 || strcmp(devi, "SARA4_PPP") == 0)) {
374374
TEST_ASSERT((((AT_CellularNetwork *)nw)->get_device_error().errType == 3) && // 3 == CME error from the modem
375-
((((AT_CellularNetwork *)nw)->get_device_error().errCode == 100) || // 100 == unknown command for modem
376-
(((AT_CellularNetwork *)nw)->get_device_error().errCode == 50))); // 50 == incorrect parameters // seen in wise_1570 for not supported commands
375+
((((AT_CellularNetwork *)nw)->get_device_error().errCode == 100) || // 100 == unknown command for modem
376+
(((AT_CellularNetwork *)nw)->get_device_error().errCode == 50))); // 50 == incorrect parameters // seen in wise_1570 for not supported commands
377377
}
378378
}
379379
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static void wait_for_power(CellularPower *pwr)
7373

7474
static void test_power_interface()
7575
{
76-
const char* devi = CELLULAR_STRINGIFY(CELLULAR_DEVICE);
76+
const char *devi = CELLULAR_STRINGIFY(CELLULAR_DEVICE);
7777
cellular_device = new CELLULAR_DEVICE(queue);
7878
cellular_device->set_timeout(5000);
7979
CellularPower *pwr = cellular_device->open_power(&cellular_serial);
@@ -89,21 +89,21 @@ static void test_power_interface()
8989
TEST_ASSERT(err == NSAPI_ERROR_OK);
9090
wait_for_power(pwr);
9191

92-
err = pwr->opt_power_save_mode(0,0);
92+
err = pwr->opt_power_save_mode(0, 0);
9393
TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_DEVICE_ERROR);
9494
if (err == NSAPI_ERROR_DEVICE_ERROR) {
9595
if (!(strcmp(devi, "TELIT_HE910") == 0 || strcmp(devi, "QUECTEL_BG96") == 0)) { // TELIT_HE910 and QUECTEL_BG96 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
96-
TEST_ASSERT(((AT_CellularPower*)pwr)->get_device_error().errCode == 100 && // 100 == unknown command for modem
97-
((AT_CellularPower*)pwr)->get_device_error().errType == 3); // 3 == CME error from the modem
96+
TEST_ASSERT(((AT_CellularPower *)pwr)->get_device_error().errCode == 100 && // 100 == unknown command for modem
97+
((AT_CellularPower *)pwr)->get_device_error().errType == 3); // 3 == CME error from the modem
9898
}
9999
}
100100

101101
err = pwr->opt_receive_period(0, CellularPower::EDRXEUTRAN_NB_S1_mode, 3);
102102
TEST_ASSERT(err == NSAPI_ERROR_OK || err == NSAPI_ERROR_DEVICE_ERROR);
103103
if (err == NSAPI_ERROR_DEVICE_ERROR) {
104104
if (!(strcmp(devi, "TELIT_HE910") == 0 || strcmp(devi, "QUECTEL_BG96") == 0)) { // TELIT_HE910 and QUECTEL_BG96 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
105-
TEST_ASSERT(((AT_CellularPower*)pwr)->get_device_error().errCode == 100 && // 100 == unknown command for modem
106-
((AT_CellularPower*)pwr)->get_device_error().errType == 3); // 3 == CME error from the modem
105+
TEST_ASSERT(((AT_CellularPower *)pwr)->get_device_error().errCode == 100 && // 100 == unknown command for modem
106+
((AT_CellularPower *)pwr)->get_device_error().errType == 3); // 3 == CME error from the modem
107107
}
108108
}
109109

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static EventQueue queue(8 * EVENTS_EVENT_SIZE);
5252
static rtos::Semaphore network_semaphore(0);
5353
static CellularConnectionFSM *cellularConnectionFSM;
5454
static CellularConnectionFSM::CellularState cellular_target_state;
55-
static CellularSMS* sms;
55+
static CellularSMS *sms;
5656
static char service_center_address[SMS_MAX_PHONE_NUMBER_SIZE];
5757
static int service_address_type;
5858

@@ -199,7 +199,7 @@ static void test_get_sms()
199199

200200
wait(7);
201201

202-
TEST_ASSERT(sms->get_sms(buf, buf_len, phone_num, SMS_MAX_PHONE_NUMBER_SIZE, time_stamp, SMS_MAX_TIME_STAMP_SIZE, &buf_size) == buf_len-1);
202+
TEST_ASSERT(sms->get_sms(buf, buf_len, phone_num, SMS_MAX_PHONE_NUMBER_SIZE, time_stamp, SMS_MAX_TIME_STAMP_SIZE, &buf_size) == buf_len - 1);
203203
TEST_ASSERT(strcmp(phone_num, MBED_CONF_APP_CELLULAR_PHONE_NUMBER) == 0);
204204
TEST_ASSERT(strcmp(buf, TEST_MESSAGE) == 0);
205205
TEST_ASSERT(buf_size == 0);

features/cellular/framework/API/CellularNetwork.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -537,15 +537,15 @@ class CellularNetwork : public NetworkInterface {
537537
*/
538538
virtual nsapi_error_t get_registration_params(registration_params_t &reg_params) = 0;
539539

540-
/** Gets the network registration parameters based on required registration type:
541-
* status, access technology, cell_id, lac, active_time, periodic_tau.
542-
*
543-
* @param type see RegistrationType values
544-
* @param reg_params see registration_params_t
545-
* @return NSAPI_ERROR_OK on success
546-
* NSAPI_ERROR_UNSUPPORTED if the modem does not support RegistrationType
547-
* NSAPI_ERROR_DEVICE_ERROR on failure
548-
*/
540+
/** Gets the network registration parameters based on required registration type:
541+
* status, access technology, cell_id, lac, active_time, periodic_tau.
542+
*
543+
* @param type see RegistrationType values
544+
* @param reg_params see registration_params_t
545+
* @return NSAPI_ERROR_OK on success
546+
* NSAPI_ERROR_UNSUPPORTED if the modem does not support RegistrationType
547+
* NSAPI_ERROR_DEVICE_ERROR on failure
548+
*/
549549
virtual nsapi_error_t get_registration_params(RegistrationType type, registration_params_t &reg_params) = 0;
550550
};
551551

features/cellular/framework/AT/ATHandler.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ ssize_t ATHandler::read_string(char *buf, size_t size, bool read_even_stop_tag)
501501
// Consume to delimiter or stop_tag
502502
if (!delimiter_found && !_stop_tag->found) {
503503
match_pos = 0;
504-
while(1) {
504+
while (1) {
505505
int c = get_char();
506506
if (c == -1) {
507507
set_error(NSAPI_ERROR_DEVICE_ERROR);
@@ -951,8 +951,8 @@ bool ATHandler::consume_to_tag(const char *tag, bool consume_tag)
951951
int c = get_char();
952952
if (c == -1) {
953953
break;
954-
// compares c against tag at current position and if this match fails
955-
// compares c against tag[0] and also resets match_pos to 0
954+
// compares c against tag at current position and if this match fails
955+
// compares c against tag[0] and also resets match_pos to 0
956956
} else if (c == tag[match_pos] || ((match_pos = 1) && (c == tag[--match_pos]))) {
957957
match_pos++;
958958
if (match_pos == strlen(tag)) {

features/cellular/framework/AT/AT_CellularSMS.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ nsapi_error_t AT_CellularSMS::set_csdh(int show_header)
249249
nsapi_error_t AT_CellularSMS::initialize(CellularSMSMmode mode)
250250
{
251251
if (NSAPI_ERROR_OK != _at.set_urc_handler("+CMTI:", callback(this, &AT_CellularSMS::cmti_urc)) ||
252-
NSAPI_ERROR_OK != _at.set_urc_handler("+CMT:", callback(this, &AT_CellularSMS::cmt_urc))) {
252+
NSAPI_ERROR_OK != _at.set_urc_handler("+CMT:", callback(this, &AT_CellularSMS::cmt_urc))) {
253253
return NSAPI_ERROR_NO_MEMORY;
254254
}
255255

@@ -625,7 +625,7 @@ nsapi_size_or_error_t AT_CellularSMS::read_sms_from_index(int msg_index, char *b
625625
int len = _at.read_string(time_stamp, SMS_MAX_TIME_STAMP_SIZE);
626626
if (len < (SMS_MAX_TIME_STAMP_SIZE - 2)) {
627627
time_stamp[len++] = ',';
628-
_at.read_string(&time_stamp[len], SMS_MAX_TIME_STAMP_SIZE-len);
628+
_at.read_string(&time_stamp[len], SMS_MAX_TIME_STAMP_SIZE - len);
629629
}
630630
}
631631
(void)_at.consume_to_stop_tag(); // consume until <CR><LF>

features/cellular/framework/device/CellularDevice.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ MBED_WEAK CellularDevice *CellularDevice::get_default_instance()
4040
#endif // CELLULAR_DEVICE
4141

4242
CellularDevice::CellularDevice() : _network_ref_count(0), _sms_ref_count(0), _power_ref_count(0), _sim_ref_count(0),
43-
_info_ref_count(0)
43+
_info_ref_count(0)
4444
{
4545
}
4646

features/cellular/framework/targets/GEMALTO/CINTERION/GEMALTO_CINTERION_CellularStack.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ nsapi_size_or_error_t GEMALTO_CINTERION_CellularStack::socket_recvfrom_impl(Cell
520520

521521
tr_debug("Socket %d, recvfrom %s, %d bytes (err %d)", socket->id, socket->remoteAddress.get_ip_address(), len, _at.get_last_error());
522522

523-
return (_at.get_last_error() == NSAPI_ERROR_OK) ? ( recv_len ? recv_len : NSAPI_ERROR_WOULD_BLOCK ) : NSAPI_ERROR_DEVICE_ERROR;
523+
return (_at.get_last_error() == NSAPI_ERROR_OK) ? (recv_len ? recv_len : NSAPI_ERROR_WOULD_BLOCK) : NSAPI_ERROR_DEVICE_ERROR;
524524
}
525525

526526
// setup internet connection profile for sockets

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

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -49,38 +49,38 @@ nsapi_error_t QUECTEL_BG96_CellularStack::socket_connect(nsapi_socket_t handle,
4949

5050
_at.lock();
5151
if (socket->proto == NSAPI_TCP) {
52-
_at.cmd_start("AT+QIOPEN=");
53-
_at.write_int(_cid);
54-
_at.write_int(request_connect_id);
55-
_at.write_string("TCP");
56-
_at.write_string(address.get_ip_address());
57-
_at.write_int(address.get_port());
58-
_at.write_int(socket->localAddress.get_port());
59-
_at.write_int(0);
60-
_at.cmd_stop();
61-
62-
handle_open_socket_response(modem_connect_id, err);
63-
64-
if ((_at.get_last_error() == NSAPI_ERROR_OK) && err) {
65-
_at.cmd_start("AT+QICLOSE=");
66-
_at.write_int(modem_connect_id);
67-
_at.cmd_stop();
68-
_at.resp_start();
69-
_at.resp_stop();
70-
71-
_at.cmd_start("AT+QIOPEN=");
72-
_at.write_int(_cid);
73-
_at.write_int(request_connect_id);
74-
_at.write_string("TCP");
75-
_at.write_string(address.get_ip_address());
76-
_at.write_int(address.get_port());
77-
_at.write_int(socket->localAddress.get_port());
78-
_at.write_int(0);
79-
_at.cmd_stop();
80-
81-
handle_open_socket_response(modem_connect_id, err);
82-
}
83-
}
52+
_at.cmd_start("AT+QIOPEN=");
53+
_at.write_int(_cid);
54+
_at.write_int(request_connect_id);
55+
_at.write_string("TCP");
56+
_at.write_string(address.get_ip_address());
57+
_at.write_int(address.get_port());
58+
_at.write_int(socket->localAddress.get_port());
59+
_at.write_int(0);
60+
_at.cmd_stop();
61+
62+
handle_open_socket_response(modem_connect_id, err);
63+
64+
if ((_at.get_last_error() == NSAPI_ERROR_OK) && err) {
65+
_at.cmd_start("AT+QICLOSE=");
66+
_at.write_int(modem_connect_id);
67+
_at.cmd_stop();
68+
_at.resp_start();
69+
_at.resp_stop();
70+
71+
_at.cmd_start("AT+QIOPEN=");
72+
_at.write_int(_cid);
73+
_at.write_int(request_connect_id);
74+
_at.write_string("TCP");
75+
_at.write_string(address.get_ip_address());
76+
_at.write_int(address.get_port());
77+
_at.write_int(socket->localAddress.get_port());
78+
_at.write_int(0);
79+
_at.cmd_stop();
80+
81+
handle_open_socket_response(modem_connect_id, err);
82+
}
83+
}
8484

8585
// If opened successfully BUT not requested one, close it
8686
if (!err && (modem_connect_id != request_connect_id)) {

features/cellular/framework/targets/UBLOX/AT/UBLOX_AT.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020

2121
#include "AT_CellularDevice.h"
2222

23-
namespace mbed
24-
{
23+
namespace mbed {
2524

2625
class UBLOX_AT : public AT_CellularDevice {
2726
public:

0 commit comments

Comments
 (0)