mirror of https://github.com/ARMmbed/mbed-os.git
Cellular: Updated coding guidelines
parent
63f62165d8
commit
f059fb36bd
|
@ -37,13 +37,12 @@
|
|||
|
||||
#define RETRY_COUNT_DEFAULT 3
|
||||
|
||||
namespace mbed
|
||||
{
|
||||
namespace mbed {
|
||||
|
||||
CellularConnectionFSM::CellularConnectionFSM() :
|
||||
_serial(0), _state(STATE_INIT), _next_state(_state), _status_callback(0), _event_status_cb(0), _network(0), _power(0), _sim(0),
|
||||
_queue(8 * EVENTS_EVENT_SIZE), _queue_thread(0), _cellularDevice(0), _retry_count(0), _event_timeout(-1),
|
||||
_at_queue(8 * EVENTS_EVENT_SIZE), _event_id(0), _plmn(0), _command_success(false), _plmn_network_found(false)
|
||||
_serial(0), _state(STATE_INIT), _next_state(_state), _status_callback(0), _event_status_cb(0), _network(0), _power(0), _sim(0),
|
||||
_queue(8 * EVENTS_EVENT_SIZE), _queue_thread(0), _cellularDevice(0), _retry_count(0), _event_timeout(-1),
|
||||
_at_queue(8 * EVENTS_EVENT_SIZE), _event_id(0), _plmn(0), _command_success(false), _plmn_network_found(false)
|
||||
{
|
||||
memset(_sim_pin, 0, sizeof(_sim_pin));
|
||||
#if MBED_CONF_CELLULAR_RANDOM_MAX_START_DELAY == 0
|
||||
|
@ -147,7 +146,7 @@ bool CellularConnectionFSM::power_on()
|
|||
void CellularConnectionFSM::set_sim_pin(const char *sim_pin)
|
||||
{
|
||||
strncpy(_sim_pin, sim_pin, sizeof(_sim_pin));
|
||||
_sim_pin[sizeof(_sim_pin)-1] = '\0';
|
||||
_sim_pin[sizeof(_sim_pin) - 1] = '\0';
|
||||
}
|
||||
|
||||
void CellularConnectionFSM::set_plmn(const char *plmn)
|
||||
|
@ -202,7 +201,7 @@ bool CellularConnectionFSM::is_registered()
|
|||
}
|
||||
|
||||
bool CellularConnectionFSM::get_network_registration(CellularNetwork::RegistrationType type,
|
||||
CellularNetwork::RegistrationStatus &status, bool &is_registered)
|
||||
CellularNetwork::RegistrationStatus &status, bool &is_registered)
|
||||
{
|
||||
is_registered = false;
|
||||
bool is_roaming = false;
|
||||
|
@ -581,7 +580,7 @@ void CellularConnectionFSM::event()
|
|||
if (_event_timeout == -1) {
|
||||
_event_timeout = 0;
|
||||
}
|
||||
_event_id = _queue.call_in(_event_timeout*1000, callback(this, &CellularConnectionFSM::event));
|
||||
_event_id = _queue.call_in(_event_timeout * 1000, callback(this, &CellularConnectionFSM::event));
|
||||
if (!_event_id) {
|
||||
report_failure("Cellular event failure!");
|
||||
return;
|
||||
|
|
|
@ -43,8 +43,7 @@ const int MAX_RETRY_ARRAY_SIZE = 10;
|
|||
*
|
||||
* Finite State Machine for connecting to cellular network
|
||||
*/
|
||||
class CellularConnectionFSM
|
||||
{
|
||||
class CellularConnectionFSM {
|
||||
public:
|
||||
CellularConnectionFSM();
|
||||
virtual ~CellularConnectionFSM();
|
||||
|
@ -148,7 +147,7 @@ public:
|
|||
*
|
||||
* @param plmn operator in numeric format. See more from 3GPP TS 27.007 chapter 7.3.
|
||||
*/
|
||||
void set_plmn(const char* plmn);
|
||||
void set_plmn(const char *plmn);
|
||||
|
||||
/** returns readable format of the given state. Used for printing states while debugging.
|
||||
*
|
||||
|
@ -186,7 +185,7 @@ private:
|
|||
NetworkStack *get_stack();
|
||||
|
||||
private:
|
||||
void report_failure(const char* msg);
|
||||
void report_failure(const char *msg);
|
||||
void event();
|
||||
void ready_urc_cb();
|
||||
|
||||
|
@ -203,7 +202,7 @@ private:
|
|||
events::EventQueue _queue;
|
||||
rtos::Thread *_queue_thread;
|
||||
CellularDevice *_cellularDevice;
|
||||
char _sim_pin[PIN_SIZE+1];
|
||||
char _sim_pin[PIN_SIZE + 1];
|
||||
int _retry_count;
|
||||
int _start_time;
|
||||
int _event_timeout;
|
||||
|
|
|
@ -27,8 +27,7 @@
|
|||
#include "CellularInformation.h"
|
||||
#include "NetworkStack.h"
|
||||
|
||||
namespace mbed
|
||||
{
|
||||
namespace mbed {
|
||||
|
||||
/**
|
||||
* Class CellularDevice
|
||||
|
@ -36,8 +35,7 @@ namespace mbed
|
|||
* An abstract interface that defines opening and closing of cellular interfaces.
|
||||
* Deleting/Closing of opened interfaces can be done only via this class.
|
||||
*/
|
||||
class CellularDevice
|
||||
{
|
||||
class CellularDevice {
|
||||
public:
|
||||
/** virtual Destructor
|
||||
*/
|
||||
|
|
|
@ -28,8 +28,7 @@
|
|||
|
||||
#include "ATHandler.h"
|
||||
|
||||
namespace mbed
|
||||
{
|
||||
namespace mbed {
|
||||
|
||||
/**
|
||||
* Class AT_CellularDevice
|
||||
|
@ -37,8 +36,7 @@ namespace mbed
|
|||
* A class defines opening and closing of cellular interfaces.
|
||||
* Deleting/Closing of opened interfaces can be done only through this class.
|
||||
*/
|
||||
class AT_CellularDevice : public CellularDevice
|
||||
{
|
||||
class AT_CellularDevice : public CellularDevice {
|
||||
public:
|
||||
AT_CellularDevice(events::EventQueue &queue);
|
||||
virtual ~AT_CellularDevice();
|
||||
|
@ -52,7 +50,7 @@ protected:
|
|||
*
|
||||
* @param at_handler
|
||||
*/
|
||||
void release_at_handler(ATHandler* at_handler);
|
||||
void release_at_handler(ATHandler *at_handler);
|
||||
|
||||
public: // CellularDevice
|
||||
virtual CellularNetwork *open_network(FileHandle *fh);
|
||||
|
@ -87,8 +85,8 @@ protected:
|
|||
AT_CellularNetwork *_network;
|
||||
AT_CellularSMS *_sms;
|
||||
AT_CellularSIM *_sim;
|
||||
AT_CellularPower* _power;
|
||||
AT_CellularInformation* _information;
|
||||
AT_CellularPower *_power;
|
||||
AT_CellularInformation *_information;
|
||||
|
||||
protected:
|
||||
events::EventQueue &_queue;
|
||||
|
|
Loading…
Reference in New Issue