cellular: fix coding style

pull/8711/head
Martin Kojtal 2018-11-15 07:23:37 +00:00
parent cbdd6324ed
commit a2ae34b0e6
11 changed files with 44 additions and 44 deletions

View File

@ -41,8 +41,8 @@ using namespace mbed_cellular_util;
using namespace mbed;
AT_CellularContext::AT_CellularContext(ATHandler &at, CellularDevice *device, const char *apn) :
AT_CellularBase(at), _ip_stack_type_requested(DEFAULT_STACK), _is_connected(false), _is_blocking(true),
_current_op(OP_INVALID), _device(device), _nw(0), _fh(0)
AT_CellularBase(at), _ip_stack_type_requested(DEFAULT_STACK), _is_connected(false), _is_blocking(true),
_current_op(OP_INVALID), _device(device), _nw(0), _fh(0)
{
tr_debug("AT_CellularContext::AT_CellularContext(): apn: %s", apn);
_stack = NULL;
@ -218,7 +218,7 @@ void AT_CellularContext::set_sim_pin(const char *sim_pin)
}
nsapi_error_t AT_CellularContext::connect(const char *sim_pin, const char *apn, const char *uname,
const char *pwd)
const char *pwd)
{
set_sim_pin(sim_pin);
set_credentials(apn, uname, pwd);
@ -458,7 +458,7 @@ bool AT_CellularContext::set_new_context(int cid)
nsapi_error_t AT_CellularContext::do_activate_context()
{
_at.lock();
_at.lock();
nsapi_error_t err = NSAPI_ERROR_OK;
@ -536,7 +536,7 @@ void AT_CellularContext::do_connect()
#if !NSAPI_PPP_AVAILABLE
// in PPP mode we did not activate any context, just searched the correct _cid
if (_status_cb) {
_status_cb((nsapi_event_t)CellularActivatePDPContext, (intptr_t )&_cb_data);
_status_cb((nsapi_event_t)CellularActivatePDPContext, (intptr_t)&_cb_data);
}
#endif // !NSAPI_PPP_AVAILABLE
}
@ -810,7 +810,7 @@ nsapi_error_t AT_CellularContext::get_pdpcontext_params(pdpContextList_t &params
void AT_CellularContext::cellular_callback(nsapi_event_t ev, intptr_t ptr)
{
if (ev >= NSAPI_EVENT_CELLULAR_STATUS_BASE && ev <= NSAPI_EVENT_CELLULAR_STATUS_END) {
cell_callback_data_t* data = (cell_callback_data_t*)ptr;
cell_callback_data_t *data = (cell_callback_data_t *)ptr;
cellular_connection_status_t st = (cellular_connection_status_t)ev;
_cb_data.error = data->error;
tr_debug("AT_CellularContext::cellular_callback, network_callback called with event: %d, err: %d, data: %d", ev, data->error, data->status_data);
@ -853,16 +853,16 @@ void AT_CellularContext::cellular_callback(nsapi_event_t ev, intptr_t ptr)
_semaphore.release();
} else {
if ((st == CellularDeviceReady && _current_op == OP_DEVICE_READY) ||
(st == CellularSIMStatusChanged && _current_op == OP_SIM_READY &&
data->status_data == CellularSIM::SimStateReady)) {
(st == CellularSIMStatusChanged && _current_op == OP_SIM_READY &&
data->status_data == CellularSIM::SimStateReady)) {
// target reached, release semaphore
_semaphore.release();
} else if (st == CellularRegistrationStatusChanged && (data->status_data == CellularNetwork::RegisteredHomeNetwork ||
data->status_data == CellularNetwork::RegisteredRoaming || data->status_data == CellularNetwork::AlreadyRegistered) && _current_op == OP_REGISTER) {
data->status_data == CellularNetwork::RegisteredRoaming || data->status_data == CellularNetwork::AlreadyRegistered) && _current_op == OP_REGISTER) {
// target reached, release semaphore
_semaphore.release();
} else if (st == CellularAttachNetwork && (_current_op == OP_ATTACH || _current_op == OP_CONNECT) &&
data->status_data == CellularNetwork::Attached) {
data->status_data == CellularNetwork::Attached) {
// target reached, release semaphore
_semaphore.release();
}

View File

@ -34,14 +34,14 @@ using namespace mbed;
#define DEFAULT_AT_TIMEOUT 1000 // at default timeout in milliseconds
AT_CellularDevice::AT_CellularDevice(FileHandle *fh) : CellularDevice(fh), _atHandlers(0), _network(0), _sms(0),
_sim(0), _power(0), _information(0), _context_list(0), _default_timeout(DEFAULT_AT_TIMEOUT),
_modem_debug_on(false)
_sim(0), _power(0), _information(0), _context_list(0), _default_timeout(DEFAULT_AT_TIMEOUT),
_modem_debug_on(false)
{
}
AT_CellularDevice::~AT_CellularDevice()
{
delete _state_machine;
delete _state_machine;
// make sure that all is deleted even if somewhere close was not called and reference counting is messed up.
_network_ref_count = 1;
@ -56,10 +56,10 @@ AT_CellularDevice::~AT_CellularDevice()
close_sim();
close_information();
AT_CellularContext* curr = _context_list;
AT_CellularContext* next;
AT_CellularContext *curr = _context_list;
AT_CellularContext *next;
while (curr) {
next = (AT_CellularContext*)curr->_next;
next = (AT_CellularContext *)curr->_next;
delete curr;
curr = next;
}
@ -134,17 +134,17 @@ CellularContext *AT_CellularDevice::create_context(FileHandle *fh, const char *a
ATHandler *atHandler = get_at_handler(fh);
if (atHandler) {
AT_CellularContext *ctx = create_context_impl(*atHandler, apn);
AT_CellularContext* curr = _context_list;
AT_CellularContext *curr = _context_list;
if (_context_list == NULL) {
_context_list = ctx;
return ctx;
}
AT_CellularContext* prev;
AT_CellularContext *prev;
while (curr) {
prev = curr;
curr = (AT_CellularContext*)curr->_next;
curr = (AT_CellularContext *)curr->_next;
}
prev->_next = ctx;
@ -160,20 +160,20 @@ AT_CellularContext *AT_CellularDevice::create_context_impl(ATHandler &at, const
void AT_CellularDevice::delete_context(CellularContext *context)
{
AT_CellularContext* curr = _context_list;
AT_CellularContext* prev = NULL;
AT_CellularContext *curr = _context_list;
AT_CellularContext *prev = NULL;
while (curr) {
if (curr == context) {
if (prev == NULL) {
_context_list = (AT_CellularContext*)curr->_next;
_context_list = (AT_CellularContext *)curr->_next;
} else {
prev->_next = curr->_next;
}
}
prev = curr;
curr = (AT_CellularContext*)curr->_next;
curr = (AT_CellularContext *)curr->_next;
}
delete (AT_CellularContext*)context;
delete (AT_CellularContext *)context;
}
CellularNetwork *AT_CellularDevice::open_network(FileHandle *fh)

View File

@ -21,7 +21,7 @@
namespace mbed {
GEMALTO_CINTERION_CellularContext::GEMALTO_CINTERION_CellularContext(ATHandler &at, CellularDevice *device,
const char *apn) : AT_CellularContext(at, device, apn)
const char *apn) : AT_CellularContext(at, device, apn)
{
}

View File

@ -19,7 +19,7 @@
namespace mbed {
SARA4_PPP_CellularContext::SARA4_PPP_CellularContext(ATHandler &at, CellularDevice *device, const char *apn) :
AT_CellularContext(at, device, apn)
AT_CellularContext(at, device, apn)
{
}

View File

@ -20,7 +20,7 @@
namespace mbed {
QUECTEL_BC95_CellularContext::QUECTEL_BC95_CellularContext(ATHandler &at, CellularDevice *device, const char *apn) :
AT_CellularContext(at, device, apn)
AT_CellularContext(at, device, apn)
{
}

View File

@ -20,7 +20,7 @@
namespace mbed {
QUECTEL_BG96_CellularContext::QUECTEL_BG96_CellularContext(ATHandler &at, CellularDevice *device, const char *apn) :
AT_CellularContext(at, device, apn)
AT_CellularContext(at, device, apn)
{
}

View File

@ -19,7 +19,7 @@
namespace mbed {
QUECTEL_UG96_CellularContext::QUECTEL_UG96_CellularContext(ATHandler &at, CellularDevice *device, const char *apn) :
AT_CellularContext(at, device, apn)
AT_CellularContext(at, device, apn)
{
}

View File

@ -19,7 +19,7 @@
namespace mbed {
TELIT_HE910_CellularContext::TELIT_HE910_CellularContext(ATHandler &at, CellularDevice *device, const char *apn) :
AT_CellularContext(at, device, apn)
AT_CellularContext(at, device, apn)
{
}

View File

@ -21,7 +21,7 @@
namespace mbed {
UBLOX_AT_CellularContext::UBLOX_AT_CellularContext(ATHandler &at, CellularDevice *device, const char *apn) :
AT_CellularContext(at, device, apn)
AT_CellularContext(at, device, apn)
{
// The authentication to use
_auth = NSAPI_SECURITY_UNKNOWN;
@ -75,9 +75,9 @@ nsapi_error_t UBLOX_AT_CellularContext::open_data_channel()
{
bool success = false;
int active = 0;
char * config = NULL;
char *config = NULL;
nsapi_error_t err = NSAPI_ERROR_NO_CONNECTION;
char imsi[MAX_IMSI_LENGTH+1];
char imsi[MAX_IMSI_LENGTH + 1];
// do check for stack to validate that we have support for stack
_stack = get_stack();
@ -98,14 +98,14 @@ nsapi_error_t UBLOX_AT_CellularContext::open_data_channel()
if (_apn == NULL) {
err = get_imsi(imsi);
if (err == NSAPI_ERROR_OK) {
config = (char*)apnconfig(imsi);
config = (char *)apnconfig(imsi);
}
}
// Attempt to connect
do {
get_next_credentials(&config);
if(_uname && _pwd) {
if (_uname && _pwd) {
_auth = (*_uname && *_pwd) ? _auth : NSAPI_SECURITY_NONE;
} else {
_auth = NSAPI_SECURITY_NONE;
@ -122,9 +122,9 @@ nsapi_error_t UBLOX_AT_CellularContext::open_data_channel()
return err;
}
bool UBLOX_AT_CellularContext::activate_profile(const char* apn,
const char* username,
const char* password)
bool UBLOX_AT_CellularContext::activate_profile(const char *apn,
const char *username,
const char *password)
{
bool activated = false;
bool success = false;
@ -253,7 +253,7 @@ bool UBLOX_AT_CellularContext::disconnect_modem_stack()
return success;
}
nsapi_error_t UBLOX_AT_CellularContext::get_imsi(char* imsi)
nsapi_error_t UBLOX_AT_CellularContext::get_imsi(char *imsi)
{
_at.lock();
_at.cmd_start("AT+CIMI");
@ -269,7 +269,7 @@ nsapi_error_t UBLOX_AT_CellularContext::get_imsi(char* imsi)
}
// Get the next set of credentials, based on IMSI.
void UBLOX_AT_CellularContext::get_next_credentials(char ** config)
void UBLOX_AT_CellularContext::get_next_credentials(char **config)
{
if (*config) {
_apn = _APN_GET(*config);

View File

@ -59,7 +59,7 @@ private:
* NSAPI_SECURITY_CHAP or NSAPI_SECURITY_UNKNOWN).
* @return True if successful, otherwise false.
*/
bool activate_profile(const char* apn, const char* username, const char* password);
bool activate_profile(const char *apn, const char *username, const char *password);
/** Convert nsapi_security_t to the modem security numbers.
*
@ -76,11 +76,11 @@ private:
/** Read IMSI of modem.
*/
nsapi_error_t get_imsi(char* imsi);
nsapi_error_t get_imsi(char *imsi);
/** Get the next set of credentials from the database.
*/
void get_next_credentials(char ** config);
void get_next_credentials(char **config);
};
} /* namespace mbed */

View File

@ -19,7 +19,7 @@
namespace mbed {
UBLOX_PPP_CellularContext::UBLOX_PPP_CellularContext(ATHandler &at, CellularDevice *device, const char *apn) :
AT_CellularContext(at, device, apn)
AT_CellularContext(at, device, apn)
{
}