Skip to content

Commit 1f9dae7

Browse files
Astyle fixed
1 parent 33678a2 commit 1f9dae7

File tree

6 files changed

+95
-92
lines changed

6 files changed

+95
-92
lines changed

features/cellular/framework/targets/UBLOX/AT/UBLOX_AT.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ nsapi_error_t UBLOX_AT::init()
9292
{
9393
_at->lock();
9494
_at->flush();
95-
_at->cmd_start("AT"); // echo off
95+
_at->cmd_start("AT");
9696
_at->cmd_stop_read_resp();
9797

9898
#ifdef TARGET_UBLOX_C027
@@ -128,7 +128,7 @@ nsapi_error_t UBLOX_AT::config_authentication_parameters()
128128
{
129129
char *config = NULL;
130130
nsapi_error_t err;
131-
char imsi[MAX_IMSI_LENGTH+1];
131+
char imsi[MAX_IMSI_LENGTH + 1];
132132

133133
if (apn == NULL) {
134134
err = get_imsi(imsi);
@@ -149,10 +149,10 @@ nsapi_error_t UBLOX_AT::config_authentication_parameters()
149149
return err;
150150
}
151151

152-
nsapi_error_t UBLOX_AT::set_authentication_parameters(const char* apn,
153-
const char* username,
154-
const char* password,
155-
CellularContext::AuthenticationType auth)
152+
nsapi_error_t UBLOX_AT::set_authentication_parameters(const char *apn,
153+
const char *username,
154+
const char *password,
155+
CellularContext::AuthenticationType auth)
156156
{
157157
int modem_security = ubx_context->nsapi_security_to_modem_security(auth);
158158

@@ -207,7 +207,7 @@ nsapi_error_t UBLOX_AT::get_imsi(char *imsi)
207207
_at->cmd_start("AT+CIMI");
208208
_at->cmd_stop();
209209
_at->resp_start();
210-
_at->read_string(imsi, MAX_IMSI_LENGTH+1);
210+
_at->read_string(imsi, MAX_IMSI_LENGTH + 1);
211211
_at->resp_stop();
212212

213213
return _at->unlock_return_error();

features/cellular/framework/targets/UBLOX/AT/UBLOX_AT.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,23 @@ class UBLOX_AT : public AT_CellularDevice {
4949

5050
private:
5151

52-
UBLOX_AT_CellularContext* ubx_context;
52+
UBLOX_AT_CellularContext *ubx_context;
5353

5454
/** Length of IMSI buffer.
5555
*/
5656
static const int MAX_IMSI_LENGTH = 15;
5757

58-
const char* apn;
59-
const char* uname;
60-
const char* pwd;
58+
const char *apn;
59+
const char *uname;
60+
const char *pwd;
6161

6262
/** The type of authentication to use.
6363
*/
6464
CellularContext::AuthenticationType auth;
6565

6666
nsapi_error_t config_authentication_parameters();
6767

68-
nsapi_error_t set_authentication_parameters(const char* apn, const char* username, const char* password, CellularContext::AuthenticationType auth);
68+
nsapi_error_t set_authentication_parameters(const char *apn, const char *username, const char *password, CellularContext::AuthenticationType auth);
6969

7070
/** Read IMSI of modem.
7171
*/

features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularContext.cpp

Lines changed: 49 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void UBLOX_AT_CellularContext::do_connect()
5959
#elif defined (TARGET_UBLOX_C030_R412M)
6060
if (rat == CellularNetwork::RadioAccessTechnology::RAT_EGPRS) {
6161
if (!_is_context_active) {
62-
_at.set_at_timeout(150*1000);
62+
_at.set_at_timeout(150 * 1000);
6363
_at.cmd_start("AT+CGACT=1,1");
6464
_at.cmd_stop();
6565
_at.resp_start();
@@ -253,26 +253,26 @@ int UBLOX_AT_CellularContext::nsapi_security_to_modem_security(AuthenticationTyp
253253
int modem_security = 3;
254254

255255
switch (nsapi_security) {
256-
case NOAUTH:
257-
modem_security = 0;
258-
break;
259-
case PAP:
260-
modem_security = 1;
261-
break;
262-
case CHAP:
263-
modem_security = 2;
264-
break;
256+
case NOAUTH:
257+
modem_security = 0;
258+
break;
259+
case PAP:
260+
modem_security = 1;
261+
break;
262+
case CHAP:
263+
modem_security = 2;
264+
break;
265265
#ifndef TARGET_UBLOX_C030_R41XM
266-
case AUTOMATIC:
267-
modem_security = 3;
268-
break;
269-
default:
270-
modem_security = 3;
271-
break;
266+
case AUTOMATIC:
267+
modem_security = 3;
268+
break;
269+
default:
270+
modem_security = 3;
271+
break;
272272
#else
273-
default:
274-
modem_security = 0;
275-
break;
273+
default:
274+
modem_security = 0;
275+
break;
276276
#endif
277277
}
278278

@@ -304,7 +304,7 @@ nsapi_error_t UBLOX_AT_CellularContext::get_imsi(char *imsi)
304304
_at.cmd_start("AT+CIMI");
305305
_at.cmd_stop();
306306
_at.resp_start();
307-
_at.read_string(imsi, MAX_IMSI_LENGTH+1);
307+
_at.read_string(imsi, MAX_IMSI_LENGTH + 1);
308308
_at.resp_stop();
309309

310310
return _at.unlock_return_error();
@@ -325,19 +325,23 @@ const char *UBLOX_AT_CellularContext::get_gateway()
325325
return get_ip_address();
326326
}
327327

328-
const char* UBLOX_AT_CellularContext::get_apn() {
328+
const char* UBLOX_AT_CellularContext::get_apn()
329+
{
329330
return _apn;
330331
}
331332

332-
const char* UBLOX_AT_CellularContext::get_uname() {
333+
const char* UBLOX_AT_CellularContext::get_uname()
334+
{
333335
return _uname;
334336
}
335337

336-
const char* UBLOX_AT_CellularContext::get_pwd() {
338+
const char* UBLOX_AT_CellularContext::get_pwd()
339+
{
337340
return _pwd;
338341
}
339342

340-
CellularContext::AuthenticationType UBLOX_AT_CellularContext::get_auth() {
343+
CellularContext::AuthenticationType UBLOX_AT_CellularContext::get_auth()
344+
{
341345
return _authentication_type;
342346
}
343347

@@ -353,27 +357,27 @@ CellularNetwork::RadioAccessTechnology UBLOX_AT_CellularContext::read_radio_tech
353357
_at.resp_stop();
354358

355359
switch (act) {
356-
case 0:
357-
rat = CellularNetwork::RadioAccessTechnology::RAT_GSM;
358-
break;
359-
case 1:
360-
rat = CellularNetwork::RadioAccessTechnology::RAT_GSM;
361-
break;
362-
case 2:
363-
rat = CellularNetwork::RadioAccessTechnology::RAT_UTRAN;
364-
break;
365-
case 7:
366-
rat = CellularNetwork::RadioAccessTechnology::RAT_CATM1;
367-
break;
368-
case 8:
369-
rat = CellularNetwork::RadioAccessTechnology::RAT_NB1;
370-
break;
371-
case 9:
372-
rat = CellularNetwork::RadioAccessTechnology::RAT_EGPRS;
373-
break;
374-
default:
375-
rat = CellularNetwork::RadioAccessTechnology::RAT_UNKNOWN;
376-
break;
360+
case 0:
361+
rat = CellularNetwork::RadioAccessTechnology::RAT_GSM;
362+
break;
363+
case 1:
364+
rat = CellularNetwork::RadioAccessTechnology::RAT_GSM;
365+
break;
366+
case 2:
367+
rat = CellularNetwork::RadioAccessTechnology::RAT_UTRAN;
368+
break;
369+
case 7:
370+
rat = CellularNetwork::RadioAccessTechnology::RAT_CATM1;
371+
break;
372+
case 8:
373+
rat = CellularNetwork::RadioAccessTechnology::RAT_NB1;
374+
break;
375+
case 9:
376+
rat = CellularNetwork::RadioAccessTechnology::RAT_EGPRS;
377+
break;
378+
default:
379+
rat = CellularNetwork::RadioAccessTechnology::RAT_UNKNOWN;
380+
break;
377381
}
378382

379383
return rat;

features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularContext.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ class UBLOX_AT_CellularContext: public AT_CellularContext {
3030
virtual void do_connect();
3131
virtual const char *get_gateway();
3232

33-
const char* get_apn(void);
34-
const char* get_uname(void);
35-
const char* get_pwd(void);
33+
const char *get_apn(void);
34+
const char *get_uname(void);
35+
const char *get_pwd(void);
3636
CellularContext::AuthenticationType get_auth(void);
3737

3838
/** Convert nsapi_security_t to the modem security numbers.

features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularNetwork.cpp

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ using namespace mbed;
2222
UBLOX_AT_CellularNetwork::UBLOX_AT_CellularNetwork(ATHandler &atHandler) : AT_CellularNetwork(atHandler)
2323
{
2424
_op_act = RAT_UNKNOWN;
25-
device = CellularDevice::get_target_default_instance();
2625
}
2726

2827
UBLOX_AT_CellularNetwork::~UBLOX_AT_CellularNetwork()
@@ -35,45 +34,48 @@ UBLOX_AT_CellularNetwork::~UBLOX_AT_CellularNetwork()
3534
nsapi_error_t UBLOX_AT_CellularNetwork::set_access_technology_impl(RadioAccessTechnology opRat)
3635
{
3736
nsapi_error_t ret = NSAPI_ERROR_OK;
37+
CellularNetwork::AttachStatus status;
3838

39-
if (device->get_context_list()->get_connection_status() != NSAPI_STATUS_DISCONNECTED) {
39+
get_attach(status);
40+
if (status == Attached) {
4041
tr_debug("RAT should only be set in detached state");
4142
return NSAPI_ERROR_UNSUPPORTED;
4243
}
44+
4345
_at.lock();
4446
switch (opRat) {
45-
case RAT_EGPRS:
47+
case RAT_EGPRS:
4648
#if defined (TARGET_UBLOX_C030_R412M)
47-
_at.cmd_start("AT+URAT=9,8");
48-
_at.cmd_stop_read_resp();
49-
break;
49+
_at.cmd_start("AT+URAT=9,8");
50+
_at.cmd_stop_read_resp();
51+
break;
5052
#endif
5153
#if defined(TARGET_UBLOX_C030_U201)
52-
case RAT_GSM:
53-
_at.cmd_start("AT+URAT=0,0");
54-
_at.cmd_stop_read_resp();
55-
break;
56-
case RAT_UTRAN:
57-
case RAT_HSDPA:
58-
case RAT_HSUPA:
59-
case RAT_HSDPA_HSUPA:
60-
_at.cmd_start("AT+URAT=2,2");
61-
_at.cmd_stop_read_resp();
62-
break;
54+
case RAT_GSM:
55+
_at.cmd_start("AT+URAT=0,0");
56+
_at.cmd_stop_read_resp();
57+
break;
58+
case RAT_UTRAN:
59+
case RAT_HSDPA:
60+
case RAT_HSUPA:
61+
case RAT_HSDPA_HSUPA:
62+
_at.cmd_start("AT+URAT=2,2");
63+
_at.cmd_stop_read_resp();
64+
break;
6365
#elif defined(TARGET_UBLOX_C030_R41XM)
64-
case RAT_CATM1:
65-
_at.cmd_start("AT+URAT=7,8");
66-
_at.cmd_stop_read_resp();
67-
break;
68-
case RAT_NB1:
69-
_at.cmd_start("AT+URAT=8,7");
70-
_at.cmd_stop_read_resp();
71-
break;
66+
case RAT_CATM1:
67+
_at.cmd_start("AT+URAT=7,8");
68+
_at.cmd_stop_read_resp();
69+
break;
70+
case RAT_NB1:
71+
_at.cmd_start("AT+URAT=8,7");
72+
_at.cmd_stop_read_resp();
73+
break;
7274
#endif
73-
default:
74-
_op_act = RAT_UNKNOWN;
75-
ret = NSAPI_ERROR_UNSUPPORTED;
76-
break;
75+
default:
76+
_op_act = RAT_UNKNOWN;
77+
ret = NSAPI_ERROR_UNSUPPORTED;
78+
break;
7779
}
7880
_at.unlock();
7981
ubx_reboot();

features/cellular/framework/targets/UBLOX/AT/UBLOX_AT_CellularNetwork.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ class UBLOX_AT_CellularNetwork : public AT_CellularNetwork {
3535

3636
protected:
3737
virtual nsapi_error_t set_access_technology_impl(RadioAccessTechnology opRat);
38-
39-
private:
40-
CellularDevice* device;
4138
};
4239

4340
} // namespace mbed

0 commit comments

Comments
 (0)