Cellular: astyle fixes after introducing CellularContext class and major refactor.

pull/8579/head
Teppo Järvelin 2018-11-13 18:50:35 +02:00
parent 14f3740c13
commit 88213d3e03
6 changed files with 43 additions and 42 deletions

View File

@ -96,7 +96,7 @@ public:
typedef CellularList<pdpcontext_params_t> pdpContextList_t;
// pointer for next item when used as a linked list
CellularContext* _next;
CellularContext *_next;
protected:
// friend of CellularDevice so that it's the only way to close/delete this class.
friend class CellularDevice;
@ -217,7 +217,7 @@ protected: // Device specific implementations might need these so protected
OP_DEVICE_READY = 0,
OP_SIM_READY = 1,
OP_REGISTER = 2,
OP_ATTACH = 3 ,
OP_ATTACH = 3,
OP_CONNECT = 4,
OP_MAX = 5
};

View File

@ -99,7 +99,7 @@ public:
*
* @param plmn plmn used when registering to cellular network
*/
void set_plmn(const char* plmn);
void set_plmn(const char *plmn);
/** Start the interface
*
@ -260,7 +260,7 @@ private:
CellularNetwork *_nw;
char _sim_pin[MAX_PIN_SIZE + 1];
char _plmn[MAX_PLMN_SIZE +1];
char _plmn[MAX_PLMN_SIZE + 1];
PlatformMutex _mutex;
};

View File

@ -26,12 +26,13 @@ struct cell_callback_data_t {
int status_data; /* cellular_event_status related enum or other info in int format. Check cellular_event_status comments.*/
bool final_try; /* This flag is true if state machine is used and this was the last try. State machine does goes to idle. */
cell_callback_data_t() {
cell_callback_data_t()
{
error = NSAPI_ERROR_OK;
status_data = -1;
final_try = false;
}
};
};
/**
* Cellular specific event changes.

View File

@ -36,7 +36,7 @@ MBED_WEAK CellularDevice *CellularDevice::get_default_instance()
static UARTSerial serial(MDMTXD, MDMRXD, MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE);
#if DEVICE_SERIAL_FC
if (MDMRTS != NC && MDMCTS != NC) {
tr_info("_USING flow control, MDMRTS: %d MDMCTS: %d",MDMRTS, MDMCTS);
tr_info("_USING flow control, MDMRTS: %d MDMCTS: %d", MDMRTS, MDMCTS);
serial.set_flow_control(SerialBase::RTSCTS, MDMRTS, MDMCTS);
}
#endif
@ -50,7 +50,7 @@ MBED_WEAK CellularDevice *CellularDevice::get_default_instance()
}
#endif // CELLULAR_DEVICE
CellularDevice::CellularDevice(FileHandle *fh) : _network_ref_count(0), _sms_ref_count(0),_power_ref_count(0), _sim_ref_count(0),
CellularDevice::CellularDevice(FileHandle *fh) : _network_ref_count(0), _sms_ref_count(0), _power_ref_count(0), _sim_ref_count(0),
_info_ref_count(0), _fh(fh), _queue(5 * EVENTS_EVENT_SIZE), _state_machine(0), _nw(0)
{
set_sim_pin(NULL);
@ -87,7 +87,7 @@ void CellularDevice::set_sim_pin(const char *sim_pin)
}
}
void CellularDevice::set_plmn(const char* plmn)
void CellularDevice::set_plmn(const char *plmn)
{
if (plmn) {
strncpy(_plmn, plmn, sizeof(_plmn));
@ -156,7 +156,7 @@ nsapi_error_t CellularDevice::start_state_machine(CellularStateMachine::Cellular
void CellularDevice::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* ptr_data = (cell_callback_data_t*)ptr;
cell_callback_data_t *ptr_data = (cell_callback_data_t *)ptr;
tr_debug("Device: network_callback called with event: %d, err: %d, data: %d", ev, ptr_data->error, ptr_data->status_data);
cellular_connection_status_t cell_ev = (cellular_connection_status_t)ev;
if (cell_ev == CellularRegistrationStatusChanged && _state_machine) {

View File

@ -157,7 +157,7 @@ bool CellularStateMachine::open_sim()
// report current state so callback can set sim pin if needed
if (_event_status_cb) {
_cb_data.status_data = state;
_event_status_cb((nsapi_event_t)CellularSIMStatusChanged, (intptr_t )&_cb_data);
_event_status_cb((nsapi_event_t)CellularSIMStatusChanged, (intptr_t)&_cb_data);
}
if (state == CellularSIM::SimStatePinNeeded) {
@ -255,7 +255,7 @@ void CellularStateMachine::report_failure(const char *msg)
_event_id = -1;
if (_event_status_cb) {
_cb_data.final_try = true;
_event_status_cb(_current_event, (intptr_t )&_cb_data);
_event_status_cb(_current_event, (intptr_t)&_cb_data);
}
tr_error("Target state %s was not reached. Returning from state: %s", get_state_string(_target_state), get_state_string(_state));
@ -379,7 +379,7 @@ bool CellularStateMachine::device_ready()
return false;
}
if (_event_status_cb) {
_event_status_cb((nsapi_event_t)CellularDeviceReady, (intptr_t )&_cb_data);
_event_status_cb((nsapi_event_t)CellularDeviceReady, (intptr_t)&_cb_data);
}
_power->remove_device_ready_urc_cb(mbed::callback(this, &CellularStateMachine::ready_urc_cb));
_cellularDevice.close_power();
@ -493,7 +493,7 @@ void CellularStateMachine::state_attaching()
_sim = NULL;
if (_event_status_cb) {
_cb_data.status_data = CellularNetwork::Attached;
_event_status_cb(_current_event, (intptr_t )&_cb_data);
_event_status_cb(_current_event, (intptr_t)&_cb_data);
}
} else {
retry_state_or_fail();
@ -655,7 +655,7 @@ void CellularStateMachine::set_cellular_callback(mbed::Callback<void(nsapi_event
void CellularStateMachine::cellular_event_changed(nsapi_event_t ev, intptr_t ptr)
{
cell_callback_data_t *data = (cell_callback_data_t*)ptr;
cell_callback_data_t *data = (cell_callback_data_t *)ptr;
if (ev >= NSAPI_EVENT_CELLULAR_STATUS_BASE && ev <= NSAPI_EVENT_CELLULAR_STATUS_END) {
tr_debug("FSM: cellular_event_changed called with event: %d, err: %d, data: %d _state: %s", ev, data->error, data->status_data, get_state_string(_state));
} else {

View File

@ -23,7 +23,7 @@
#include "PlatformMutex.h"
namespace rtos {
class Thread;
class Thread;
}
namespace mbed {