Skip to content

Commit f059fb3

Browse files
author
Ari Parkkila
committed
Cellular: Updated coding guidelines
1 parent 63f6216 commit f059fb3

File tree

4 files changed

+18
-24
lines changed

4 files changed

+18
-24
lines changed

features/cellular/easy_cellular/CellularConnectionFSM.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,12 @@
3737

3838
#define RETRY_COUNT_DEFAULT 3
3939

40-
namespace mbed
41-
{
40+
namespace mbed {
4241

4342
CellularConnectionFSM::CellularConnectionFSM() :
44-
_serial(0), _state(STATE_INIT), _next_state(_state), _status_callback(0), _event_status_cb(0), _network(0), _power(0), _sim(0),
45-
_queue(8 * EVENTS_EVENT_SIZE), _queue_thread(0), _cellularDevice(0), _retry_count(0), _event_timeout(-1),
46-
_at_queue(8 * EVENTS_EVENT_SIZE), _event_id(0), _plmn(0), _command_success(false), _plmn_network_found(false)
43+
_serial(0), _state(STATE_INIT), _next_state(_state), _status_callback(0), _event_status_cb(0), _network(0), _power(0), _sim(0),
44+
_queue(8 * EVENTS_EVENT_SIZE), _queue_thread(0), _cellularDevice(0), _retry_count(0), _event_timeout(-1),
45+
_at_queue(8 * EVENTS_EVENT_SIZE), _event_id(0), _plmn(0), _command_success(false), _plmn_network_found(false)
4746
{
4847
memset(_sim_pin, 0, sizeof(_sim_pin));
4948
#if MBED_CONF_CELLULAR_RANDOM_MAX_START_DELAY == 0
@@ -147,7 +146,7 @@ bool CellularConnectionFSM::power_on()
147146
void CellularConnectionFSM::set_sim_pin(const char *sim_pin)
148147
{
149148
strncpy(_sim_pin, sim_pin, sizeof(_sim_pin));
150-
_sim_pin[sizeof(_sim_pin)-1] = '\0';
149+
_sim_pin[sizeof(_sim_pin) - 1] = '\0';
151150
}
152151

153152
void CellularConnectionFSM::set_plmn(const char *plmn)
@@ -202,7 +201,7 @@ bool CellularConnectionFSM::is_registered()
202201
}
203202

204203
bool CellularConnectionFSM::get_network_registration(CellularNetwork::RegistrationType type,
205-
CellularNetwork::RegistrationStatus &status, bool &is_registered)
204+
CellularNetwork::RegistrationStatus &status, bool &is_registered)
206205
{
207206
is_registered = false;
208207
bool is_roaming = false;
@@ -581,7 +580,7 @@ void CellularConnectionFSM::event()
581580
if (_event_timeout == -1) {
582581
_event_timeout = 0;
583582
}
584-
_event_id = _queue.call_in(_event_timeout*1000, callback(this, &CellularConnectionFSM::event));
583+
_event_id = _queue.call_in(_event_timeout * 1000, callback(this, &CellularConnectionFSM::event));
585584
if (!_event_id) {
586585
report_failure("Cellular event failure!");
587586
return;

features/cellular/easy_cellular/CellularConnectionFSM.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ const int MAX_RETRY_ARRAY_SIZE = 10;
4343
*
4444
* Finite State Machine for connecting to cellular network
4545
*/
46-
class CellularConnectionFSM
47-
{
46+
class CellularConnectionFSM {
4847
public:
4948
CellularConnectionFSM();
5049
virtual ~CellularConnectionFSM();
@@ -148,7 +147,7 @@ class CellularConnectionFSM
148147
*
149148
* @param plmn operator in numeric format. See more from 3GPP TS 27.007 chapter 7.3.
150149
*/
151-
void set_plmn(const char* plmn);
150+
void set_plmn(const char *plmn);
152151

153152
/** returns readable format of the given state. Used for printing states while debugging.
154153
*
@@ -186,7 +185,7 @@ class CellularConnectionFSM
186185
NetworkStack *get_stack();
187186

188187
private:
189-
void report_failure(const char* msg);
188+
void report_failure(const char *msg);
190189
void event();
191190
void ready_urc_cb();
192191

@@ -203,7 +202,7 @@ class CellularConnectionFSM
203202
events::EventQueue _queue;
204203
rtos::Thread *_queue_thread;
205204
CellularDevice *_cellularDevice;
206-
char _sim_pin[PIN_SIZE+1];
205+
char _sim_pin[PIN_SIZE + 1];
207206
int _retry_count;
208207
int _start_time;
209208
int _event_timeout;

features/cellular/framework/API/CellularDevice.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,15 @@
2727
#include "CellularInformation.h"
2828
#include "NetworkStack.h"
2929

30-
namespace mbed
31-
{
30+
namespace mbed {
3231

3332
/**
3433
* Class CellularDevice
3534
*
3635
* An abstract interface that defines opening and closing of cellular interfaces.
3736
* Deleting/Closing of opened interfaces can be done only via this class.
3837
*/
39-
class CellularDevice
40-
{
38+
class CellularDevice {
4139
public:
4240
/** virtual Destructor
4341
*/

features/cellular/framework/AT/AT_CellularDevice.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,15 @@
2828

2929
#include "ATHandler.h"
3030

31-
namespace mbed
32-
{
31+
namespace mbed {
3332

3433
/**
3534
* Class AT_CellularDevice
3635
*
3736
* A class defines opening and closing of cellular interfaces.
3837
* Deleting/Closing of opened interfaces can be done only through this class.
3938
*/
40-
class AT_CellularDevice : public CellularDevice
41-
{
39+
class AT_CellularDevice : public CellularDevice {
4240
public:
4341
AT_CellularDevice(events::EventQueue &queue);
4442
virtual ~AT_CellularDevice();
@@ -52,7 +50,7 @@ class AT_CellularDevice : public CellularDevice
5250
*
5351
* @param at_handler
5452
*/
55-
void release_at_handler(ATHandler* at_handler);
53+
void release_at_handler(ATHandler *at_handler);
5654

5755
public: // CellularDevice
5856
virtual CellularNetwork *open_network(FileHandle *fh);
@@ -87,8 +85,8 @@ class AT_CellularDevice : public CellularDevice
8785
AT_CellularNetwork *_network;
8886
AT_CellularSMS *_sms;
8987
AT_CellularSIM *_sim;
90-
AT_CellularPower* _power;
91-
AT_CellularInformation* _information;
88+
AT_CellularPower *_power;
89+
AT_CellularInformation *_information;
9290

9391
protected:
9492
events::EventQueue &_queue;

0 commit comments

Comments
 (0)