mirror of https://github.com/ARMmbed/mbed-os.git
cellular: fix coding style
parent
cbdd6324ed
commit
a2ae34b0e6
|
@ -536,7 +536,7 @@ void AT_CellularContext::do_connect()
|
||||||
#if !NSAPI_PPP_AVAILABLE
|
#if !NSAPI_PPP_AVAILABLE
|
||||||
// in PPP mode we did not activate any context, just searched the correct _cid
|
// in PPP mode we did not activate any context, just searched the correct _cid
|
||||||
if (_status_cb) {
|
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
|
#endif // !NSAPI_PPP_AVAILABLE
|
||||||
}
|
}
|
||||||
|
@ -810,7 +810,7 @@ nsapi_error_t AT_CellularContext::get_pdpcontext_params(pdpContextList_t ¶ms
|
||||||
void AT_CellularContext::cellular_callback(nsapi_event_t ev, intptr_t ptr)
|
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) {
|
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;
|
cellular_connection_status_t st = (cellular_connection_status_t)ev;
|
||||||
_cb_data.error = data->error;
|
_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);
|
tr_debug("AT_CellularContext::cellular_callback, network_callback called with event: %d, err: %d, data: %d", ev, data->error, data->status_data);
|
||||||
|
|
|
@ -56,10 +56,10 @@ AT_CellularDevice::~AT_CellularDevice()
|
||||||
close_sim();
|
close_sim();
|
||||||
close_information();
|
close_information();
|
||||||
|
|
||||||
AT_CellularContext* curr = _context_list;
|
AT_CellularContext *curr = _context_list;
|
||||||
AT_CellularContext* next;
|
AT_CellularContext *next;
|
||||||
while (curr) {
|
while (curr) {
|
||||||
next = (AT_CellularContext*)curr->_next;
|
next = (AT_CellularContext *)curr->_next;
|
||||||
delete curr;
|
delete curr;
|
||||||
curr = next;
|
curr = next;
|
||||||
}
|
}
|
||||||
|
@ -134,17 +134,17 @@ CellularContext *AT_CellularDevice::create_context(FileHandle *fh, const char *a
|
||||||
ATHandler *atHandler = get_at_handler(fh);
|
ATHandler *atHandler = get_at_handler(fh);
|
||||||
if (atHandler) {
|
if (atHandler) {
|
||||||
AT_CellularContext *ctx = create_context_impl(*atHandler, apn);
|
AT_CellularContext *ctx = create_context_impl(*atHandler, apn);
|
||||||
AT_CellularContext* curr = _context_list;
|
AT_CellularContext *curr = _context_list;
|
||||||
|
|
||||||
if (_context_list == NULL) {
|
if (_context_list == NULL) {
|
||||||
_context_list = ctx;
|
_context_list = ctx;
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
AT_CellularContext* prev;
|
AT_CellularContext *prev;
|
||||||
while (curr) {
|
while (curr) {
|
||||||
prev = curr;
|
prev = curr;
|
||||||
curr = (AT_CellularContext*)curr->_next;
|
curr = (AT_CellularContext *)curr->_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
prev->_next = ctx;
|
prev->_next = ctx;
|
||||||
|
@ -160,20 +160,20 @@ AT_CellularContext *AT_CellularDevice::create_context_impl(ATHandler &at, const
|
||||||
|
|
||||||
void AT_CellularDevice::delete_context(CellularContext *context)
|
void AT_CellularDevice::delete_context(CellularContext *context)
|
||||||
{
|
{
|
||||||
AT_CellularContext* curr = _context_list;
|
AT_CellularContext *curr = _context_list;
|
||||||
AT_CellularContext* prev = NULL;
|
AT_CellularContext *prev = NULL;
|
||||||
while (curr) {
|
while (curr) {
|
||||||
if (curr == context) {
|
if (curr == context) {
|
||||||
if (prev == NULL) {
|
if (prev == NULL) {
|
||||||
_context_list = (AT_CellularContext*)curr->_next;
|
_context_list = (AT_CellularContext *)curr->_next;
|
||||||
} else {
|
} else {
|
||||||
prev->_next = curr->_next;
|
prev->_next = curr->_next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
prev = curr;
|
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)
|
CellularNetwork *AT_CellularDevice::open_network(FileHandle *fh)
|
||||||
|
|
|
@ -75,9 +75,9 @@ nsapi_error_t UBLOX_AT_CellularContext::open_data_channel()
|
||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
int active = 0;
|
int active = 0;
|
||||||
char * config = NULL;
|
char *config = NULL;
|
||||||
nsapi_error_t err = NSAPI_ERROR_NO_CONNECTION;
|
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
|
// do check for stack to validate that we have support for stack
|
||||||
_stack = get_stack();
|
_stack = get_stack();
|
||||||
|
@ -98,14 +98,14 @@ nsapi_error_t UBLOX_AT_CellularContext::open_data_channel()
|
||||||
if (_apn == NULL) {
|
if (_apn == NULL) {
|
||||||
err = get_imsi(imsi);
|
err = get_imsi(imsi);
|
||||||
if (err == NSAPI_ERROR_OK) {
|
if (err == NSAPI_ERROR_OK) {
|
||||||
config = (char*)apnconfig(imsi);
|
config = (char *)apnconfig(imsi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attempt to connect
|
// Attempt to connect
|
||||||
do {
|
do {
|
||||||
get_next_credentials(&config);
|
get_next_credentials(&config);
|
||||||
if(_uname && _pwd) {
|
if (_uname && _pwd) {
|
||||||
_auth = (*_uname && *_pwd) ? _auth : NSAPI_SECURITY_NONE;
|
_auth = (*_uname && *_pwd) ? _auth : NSAPI_SECURITY_NONE;
|
||||||
} else {
|
} else {
|
||||||
_auth = NSAPI_SECURITY_NONE;
|
_auth = NSAPI_SECURITY_NONE;
|
||||||
|
@ -122,9 +122,9 @@ nsapi_error_t UBLOX_AT_CellularContext::open_data_channel()
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UBLOX_AT_CellularContext::activate_profile(const char* apn,
|
bool UBLOX_AT_CellularContext::activate_profile(const char *apn,
|
||||||
const char* username,
|
const char *username,
|
||||||
const char* password)
|
const char *password)
|
||||||
{
|
{
|
||||||
bool activated = false;
|
bool activated = false;
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
@ -253,7 +253,7 @@ bool UBLOX_AT_CellularContext::disconnect_modem_stack()
|
||||||
return success;
|
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.lock();
|
||||||
_at.cmd_start("AT+CIMI");
|
_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.
|
// 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) {
|
if (*config) {
|
||||||
_apn = _APN_GET(*config);
|
_apn = _APN_GET(*config);
|
||||||
|
|
|
@ -59,7 +59,7 @@ private:
|
||||||
* NSAPI_SECURITY_CHAP or NSAPI_SECURITY_UNKNOWN).
|
* NSAPI_SECURITY_CHAP or NSAPI_SECURITY_UNKNOWN).
|
||||||
* @return True if successful, otherwise false.
|
* @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.
|
/** Convert nsapi_security_t to the modem security numbers.
|
||||||
*
|
*
|
||||||
|
@ -76,11 +76,11 @@ private:
|
||||||
|
|
||||||
/** Read IMSI of modem.
|
/** 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.
|
/** Get the next set of credentials from the database.
|
||||||
*/
|
*/
|
||||||
void get_next_credentials(char ** config);
|
void get_next_credentials(char **config);
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace mbed */
|
} /* namespace mbed */
|
||||||
|
|
Loading…
Reference in New Issue