Skip to content

Commit af04a7a

Browse files
author
Antti Kauppila
committed
astyle fixes
1 parent 0dacc22 commit af04a7a

File tree

15 files changed

+100
-95
lines changed

15 files changed

+100
-95
lines changed

UNITTESTS/features/lorawan/loramac/Test_LoRaMac.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ TEST_F(Test_LoRaMac, on_radio_tx_done)
354354
object->on_radio_tx_done(100);
355355
}
356356

357-
static void my_cb(loramac_mlme_confirm_t& mlme)
357+
static void my_cb(loramac_mlme_confirm_t &mlme)
358358
{
359359

360360
}

UNITTESTS/stubs/LoRaMacCommand_stub.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ lorawan_status_t LoRaMacCommand::process_mac_commands(const uint8_t *payload, ui
7575
uint8_t commands_size, uint8_t snr,
7676
lora_mac_system_params_t &mac_sys_params,
7777
LoRaPHY &lora_phy,
78-
mbed::Callback<void(loramac_mlme_confirm_t&)> confirm_handler)
78+
mbed::Callback<void(loramac_mlme_confirm_t &)> confirm_handler)
7979
{
8080
return LoRaMacCommand_stub::status_value;
8181
}

UNITTESTS/stubs/LoRaMacCrypto_stub.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,31 +38,31 @@ LoRaMacCrypto::~LoRaMacCrypto()
3838

3939
lorawan_status_t LoRaMacCrypto::set_keys(uint8_t *, uint8_t *, uint8_t *, uint8_t *, uint8_t *, uint8_t *)
4040
{
41-
return LoRaMacCrypto_stub::status;
41+
return LoRaMacCrypto_stub::status;
4242
}
4343

44-
int LoRaMacCrypto::compute_mic(const uint8_t *, uint16_t , uint32_t, uint32_t,
44+
int LoRaMacCrypto::compute_mic(const uint8_t *, uint16_t, uint32_t, uint32_t,
4545
uint8_t, uint32_t, uint32_t *)
4646
{
4747
return LoRaMacCrypto_stub::int_table[LoRaMacCrypto_stub::int_table_idx_value++];
4848
}
4949

50-
int LoRaMacCrypto::encrypt_payload(const uint8_t *, uint16_t ,
51-
uint32_t , uint8_t , uint32_t ,
52-
seq_counter_type_t ,
53-
payload_type_t ,
50+
int LoRaMacCrypto::encrypt_payload(const uint8_t *, uint16_t,
51+
uint32_t, uint8_t, uint32_t,
52+
seq_counter_type_t,
53+
payload_type_t,
5454
uint8_t *,
55-
server_type_t , bool)
55+
server_type_t, bool)
5656
{
5757
return LoRaMacCrypto_stub::int_table[LoRaMacCrypto_stub::int_table_idx_value++];
5858
}
5959

60-
int LoRaMacCrypto::decrypt_payload(const uint8_t *, uint16_t ,
61-
uint32_t , uint8_t , uint32_t ,
62-
seq_counter_type_t ,
63-
payload_type_t ,
60+
int LoRaMacCrypto::decrypt_payload(const uint8_t *, uint16_t,
61+
uint32_t, uint8_t, uint32_t,
62+
seq_counter_type_t,
63+
payload_type_t,
6464
uint8_t *,
65-
server_type_t , bool)
65+
server_type_t, bool)
6666
{
6767
return LoRaMacCrypto_stub::int_table[LoRaMacCrypto_stub::int_table_idx_value++];
6868
}

UNITTESTS/stubs/LoRaMac_stub.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ void LoRaMac::extract_data_and_mac_commands(const uint8_t *payload,
128128
seq_counter_type_t cnt_type,
129129
int16_t rssi,
130130
int8_t snr,
131-
Callback<void(loramac_mlme_confirm_t&)> confirm_handler)
131+
Callback<void(loramac_mlme_confirm_t &)> confirm_handler)
132132
{
133133
if (LoRaMac_stub::mlme_conf_ptr) {
134134
confirm_handler(*LoRaMac_stub::mlme_conf_ptr);
@@ -139,7 +139,7 @@ bool LoRaMac::extract_mac_commands_only(const uint8_t *payload,
139139
uint16_t size,
140140
int8_t snr,
141141
uint8_t fopts_len,
142-
Callback<void(loramac_mlme_confirm_t&)> confirm_handler)
142+
Callback<void(loramac_mlme_confirm_t &)> confirm_handler)
143143
{
144144
if (LoRaMac_stub::mlme_conf_ptr) {
145145
confirm_handler(*LoRaMac_stub::mlme_conf_ptr);
@@ -153,7 +153,7 @@ void LoRaMac::handle_data_frame(const uint8_t *const payload,
153153
uint8_t msg_type,
154154
int16_t rssi,
155155
int8_t snr,
156-
Callback<void(loramac_mlme_confirm_t&)> confirm_handler)
156+
Callback<void(loramac_mlme_confirm_t &)> confirm_handler)
157157
{
158158
if (LoRaMac_stub::mlme_conf_ptr) {
159159
confirm_handler(*LoRaMac_stub::mlme_conf_ptr);
@@ -170,7 +170,7 @@ void LoRaMac::on_radio_tx_done(lorawan_time_t timestamp)
170170

171171
void LoRaMac::on_radio_rx_done(const uint8_t *const payload, uint16_t size,
172172
int16_t rssi, int8_t snr,
173-
Callback<void(loramac_mlme_confirm_t&)> confirm_handler)
173+
Callback<void(loramac_mlme_confirm_t &)> confirm_handler)
174174
{
175175
if (LoRaMac_stub::mlme_conf_ptr) {
176176
confirm_handler(*LoRaMac_stub::mlme_conf_ptr);
@@ -492,7 +492,7 @@ uint8_t LoRaMac::get_current_adr_ack_limit()
492492
return LoRaMac_stub::uint8_value;
493493
}
494494

495-
void LoRaMac::get_rejoin_parameters(uint32_t& max_time, uint32_t& max_count)
495+
void LoRaMac::get_rejoin_parameters(uint32_t &max_time, uint32_t &max_count)
496496
{
497497

498498
}

UNITTESTS/stubs/LoRaPHY_stub.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ uint16_t LoRaPHY::get_adr_ack_limit() const
427427
return LoRaPHY_stub::uint16_value;
428428
}
429429

430-
void LoRaPHY::set_adr_ack_limit(const uint16_t& value)
430+
void LoRaPHY::set_adr_ack_limit(const uint16_t &value)
431431
{
432432
}
433433

@@ -436,7 +436,7 @@ uint16_t LoRaPHY::get_adr_ack_delay() const
436436
return LoRaPHY_stub::uint16_value;
437437
}
438438

439-
void LoRaPHY::set_adr_ack_delay(const uint16_t& value)
439+
void LoRaPHY::set_adr_ack_delay(const uint16_t &value)
440440
{
441441
}
442442

UNITTESTS/stubs/LoRaWANStack_stub.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ void LoRaWANStack::mlme_indication_handler()
252252
{
253253
}
254254

255-
void LoRaWANStack::mlme_confirm_handler(loramac_mlme_confirm_t& mlme_confirm)
255+
void LoRaWANStack::mlme_confirm_handler(loramac_mlme_confirm_t &mlme_confirm)
256256
{
257257
}
258258

features/lorawan/LoRaWANStack.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -846,10 +846,10 @@ void LoRaWANStack::poll_rejoin(void)
846846

847847
// check if REJOIN_TYPE_1 is due, if it is, do not proceed with
848848
// REJOIN_TYPE_0
849-
if (((_loramac.get_lora_time()->get_current_time()/1000) -
850-
_rejoin_type1_stamp) > _rejoin_type1_send_period) {
849+
if (((_loramac.get_lora_time()->get_current_time() / 1000) -
850+
_rejoin_type1_stamp) > _rejoin_type1_send_period) {
851851
_ctrl_flags |= REJOIN_IN_PROGRESS;
852-
_rejoin_type1_stamp = _loramac.get_lora_time()->get_current_time()/1000;
852+
_rejoin_type1_stamp = _loramac.get_lora_time()->get_current_time() / 1000;
853853
const int ret = _queue->call(this, &LoRaWANStack::process_rejoin,
854854
REJOIN_REQUEST_TYPE1, false);
855855
MBED_ASSERT(ret != 0);
@@ -1083,7 +1083,7 @@ void LoRaWANStack::mlme_indication_handler()
10831083
tr_error("Unknown MLME Indication type.");
10841084
}
10851085

1086-
void LoRaWANStack::mlme_confirm_handler(loramac_mlme_confirm_t& mlme_confirm)
1086+
void LoRaWANStack::mlme_confirm_handler(loramac_mlme_confirm_t &mlme_confirm)
10871087
{
10881088
if (mlme_confirm.type == MLME_LINK_CHECK) {
10891089
if (mlme_confirm.status == LORAMAC_EVENT_INFO_STATUS_OK) {
@@ -1142,9 +1142,9 @@ void LoRaWANStack::mlme_confirm_handler(loramac_mlme_confirm_t& mlme_confirm)
11421142
}
11431143
} else if (mlme_confirm.type == MLME_FORCE_REJOIN) {
11441144
if (join_req_type_t(mlme_confirm.rejoin_type) <= REJOIN_REQUEST_TYPE2 &&
1145-
_loramac.get_server_type() == LW1_1 ) {
1145+
_loramac.get_server_type() == LW1_1) {
11461146
_forced_datarate = mlme_confirm.datarate;
1147-
_forced_period = ((1 << mlme_confirm.period)*32 + (rand()%33))*1000;
1147+
_forced_period = ((1 << mlme_confirm.period) * 32 + (rand() % 33)) * 1000;
11481148
_forced_retry_count = mlme_confirm.max_retries;
11491149
if (_forced_retry_count) {
11501150
_forced_retry_count += 1;
@@ -1444,18 +1444,18 @@ void LoRaWANStack::process_uninitialized_state(lorawan_status_t &op_status)
14441444

14451445
if (MBED_CONF_LORA_VERSION == LORAWAN_VERSION_1_1) {
14461446
_loramac.get_lora_time()->init(_forced_timer,
1447-
mbed::callback(this, &LoRaWANStack::forced_timer_expiry));
1447+
mbed::callback(this, &LoRaWANStack::forced_timer_expiry));
14481448

14491449
_loramac.get_lora_time()->init(_rejoin_type0_timer,
1450-
mbed::callback(this, &LoRaWANStack::process_rejoin_type0));
1450+
mbed::callback(this, &LoRaWANStack::process_rejoin_type0));
14511451

14521452
_rejoin_type1_stamp = _loramac.get_lora_time()->get_current_time() / 1000;
14531453
}
14541454
}
14551455

14561456
void LoRaWANStack::process_rejoin(join_req_type_t rejoin_type, bool is_forced)
14571457
{
1458-
if (_loramac.get_server_type() == LW1_1 ) {
1458+
if (_loramac.get_server_type() == LW1_1) {
14591459
_loramac.rejoin(rejoin_type, is_forced, _forced_datarate);
14601460
if (rejoin_type == REJOIN_REQUEST_TYPE0) {
14611461
_loramac.get_lora_time()->stop(_rejoin_type0_timer);
@@ -1477,7 +1477,7 @@ void LoRaWANStack::reset_forced_rejoin()
14771477

14781478
void LoRaWANStack::forced_timer_expiry()
14791479
{
1480-
if (_loramac.get_server_type() == LW1_1 ) {
1480+
if (_loramac.get_server_type() == LW1_1) {
14811481
if (_forced_counter < _forced_retry_count) {
14821482
process_rejoin(_forced_rejoin_type, true);
14831483
_loramac.get_lora_time()->start(_forced_timer, _forced_period);
@@ -1489,7 +1489,7 @@ void LoRaWANStack::forced_timer_expiry()
14891489

14901490
void LoRaWANStack::process_rejoin_type0()
14911491
{
1492-
if (_loramac.get_server_type() == LW1_1 ) {
1492+
if (_loramac.get_server_type() == LW1_1) {
14931493
//stop in case counter was exceeded
14941494
process_rejoin(REJOIN_REQUEST_TYPE0, false);
14951495
}

features/lorawan/LoRaWANStack.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ class LoRaWANStack: private mbed::NonCopyable<LoRaWANStack> {
447447
/**
448448
* Handles an MLME confirmation
449449
*/
450-
void mlme_confirm_handler(loramac_mlme_confirm_t& mlme_confirm);
450+
void mlme_confirm_handler(loramac_mlme_confirm_t &mlme_confirm);
451451

452452
/**
453453
* Handles an MCPS confirmation

features/lorawan/lorastack/mac/LoRaMac.cpp

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ loramac_event_info_status_t LoRaMac::handle_join_accept_frame(const uint8_t *pay
220220
_params.rx_buffer[0] = payload[0];
221221

222222
//Store server type to local so that invalid join accept of rejoin request won't affect the orig. type.
223-
if ( (((_params.rx_buffer[11] >> 7) & 0x01) == 1) && MBED_CONF_LORA_VERSION == LORAWAN_VERSION_1_1) {
223+
if ((((_params.rx_buffer[11] >> 7) & 0x01) == 1) && MBED_CONF_LORA_VERSION == LORAWAN_VERSION_1_1) {
224224
stype = LW1_1;
225225
tr_debug("LoRaWAN 1.1.x server");
226226
} else {
@@ -273,8 +273,8 @@ loramac_event_info_status_t LoRaMac::handle_join_accept_frame(const uint8_t *pay
273273

274274
memcpy(args, _params.rx_buffer + payload_start, 3);
275275
memcpy_convert_endianess(args + 3, _params.app_eui, 8);
276-
args[3+8] = nonce_or_rj_cnt & 0xFF;
277-
args[3+9] = (nonce_or_rj_cnt >> 8) & 0xFF;
276+
args[3 + 8] = nonce_or_rj_cnt & 0xFF;
277+
args[3 + 9] = (nonce_or_rj_cnt >> 8) & 0xFF;
278278
args_size = 13;
279279
}
280280

@@ -313,7 +313,7 @@ loramac_event_info_status_t LoRaMac::handle_join_accept_frame(const uint8_t *pay
313313
reset_frame_counters();
314314
reset_phy_params();
315315
} else if (_params.server_type == LW1_1 &&
316-
_params.join_request_type == REJOIN_REQUEST_TYPE2){
316+
_params.join_request_type == REJOIN_REQUEST_TYPE2) {
317317
reset_frame_counters();
318318
}
319319

@@ -416,7 +416,7 @@ void LoRaMac::extract_data_and_mac_commands(const uint8_t *payload,
416416
seq_counter_type_t cnt_type,
417417
int16_t rssi,
418418
int8_t snr,
419-
Callback<void(loramac_mlme_confirm_t&)> confirm_handler)
419+
Callback<void(loramac_mlme_confirm_t &)> confirm_handler)
420420
{
421421
uint8_t frame_len = 0;
422422
uint8_t payload_start_index = FHDR_LEN_WITHOUT_FOPTS + PORT_FIELD_LEN + fopts_len;
@@ -458,7 +458,7 @@ void LoRaMac::extract_data_and_mac_commands(const uint8_t *payload,
458458
return;
459459
}
460460

461-
if(!extract_mac_commands_only(payload, size, snr, fopts_len, confirm_handler)) {
461+
if (!extract_mac_commands_only(payload, size, snr, fopts_len, confirm_handler)) {
462462
return;
463463
}
464464

@@ -483,7 +483,7 @@ bool LoRaMac::extract_mac_commands_only(const uint8_t *payload,
483483
uint16_t size,
484484
int8_t snr,
485485
uint8_t fopts_len,
486-
Callback<void(loramac_mlme_confirm_t&)> confirm_handler)
486+
Callback<void(loramac_mlme_confirm_t &)> confirm_handler)
487487
{
488488
if (fopts_len > 0) {
489489
uint8_t buffer[15] = {0};
@@ -523,7 +523,8 @@ bool LoRaMac::extract_mac_commands_only(const uint8_t *payload,
523523
return true;
524524
}
525525

526-
multicast_params_t *LoRaMac::get_multicast_params(uint32_t address) {
526+
multicast_params_t *LoRaMac::get_multicast_params(uint32_t address)
527+
{
527528
multicast_params_t *obj = _params.multicast_channels;
528529
while (obj != NULL) {
529530
if (address == obj->address) {
@@ -534,7 +535,8 @@ multicast_params_t *LoRaMac::get_multicast_params(uint32_t address) {
534535
return NULL;
535536
}
536537

537-
void LoRaMac::reset_multicast_counters() {
538+
void LoRaMac::reset_multicast_counters()
539+
{
538540
multicast_params_t *obj = _params.multicast_channels;
539541
while (obj != NULL) {
540542
obj->dl_frame_counter = 0;
@@ -548,7 +550,7 @@ void LoRaMac::handle_data_frame(const uint8_t *const payload,
548550
uint8_t msg_type,
549551
int16_t rssi,
550552
int8_t snr,
551-
Callback<void(loramac_mlme_confirm_t&)> confirm_handler)
553+
Callback<void(loramac_mlme_confirm_t &)> confirm_handler)
552554
{
553555
check_frame_size(size);
554556
bool is_multicast = false;
@@ -805,7 +807,7 @@ void LoRaMac::on_radio_tx_done(lorawan_time_t timestamp)
805807

806808
void LoRaMac::on_radio_rx_done(const uint8_t *const payload, uint16_t size,
807809
int16_t rssi, int8_t snr,
808-
Callback<void(loramac_mlme_confirm_t&)> confirm_handler)
810+
Callback<void(loramac_mlme_confirm_t &)> confirm_handler)
809811
{
810812
_demod_ongoing = false;
811813
if (_device_class == CLASS_C && !_continuous_rx2_window_open) {
@@ -1090,7 +1092,7 @@ void LoRaMac::on_ack_timeout_timer_event(void)
10901092
lorawan_status_t status = handle_retransmission();
10911093

10921094
if (status == LORAWAN_STATUS_NO_CHANNEL_FOUND ||
1093-
status == LORAWAN_STATUS_NO_FREE_CHANNEL_FOUND) {
1095+
status == LORAWAN_STATUS_NO_FREE_CHANNEL_FOUND) {
10941096
// In a case when enabled channels are not found, PHY layer
10951097
// resorts to default channels. Next attempt should go forward as the
10961098
// default channels are always available if there is a base station in the
@@ -1299,7 +1301,7 @@ lorawan_status_t LoRaMac::schedule_tx()
12991301
MBED_CONF_LORA_MAX_SYS_RX_ERROR,
13001302
&_params.rx_window2_config);
13011303

1302-
if (mac_hdr.bits.mtype == FRAME_TYPE_JOIN_REQ || mac_hdr.bits.mtype == FRAME_TYPE_REJOIN_REQUEST){
1304+
if (mac_hdr.bits.mtype == FRAME_TYPE_JOIN_REQ || mac_hdr.bits.mtype == FRAME_TYPE_REJOIN_REQUEST) {
13031305
_params.rx_window1_delay = _params.sys_params.join_accept_delay1
13041306
+ _params.rx_window1_config.window_offset;
13051307
_params.rx_window2_delay = _params.sys_params.join_accept_delay2
@@ -1633,7 +1635,7 @@ lorawan_status_t LoRaMac::prepare_join(const lorawan_connect_t *params, bool is_
16331635
if ((params->connection_u.otaa.dev_eui == NULL)
16341636
|| (params->connection_u.otaa.app_eui == NULL)
16351637
|| (params->connection_u.otaa.app_key == NULL)
1636-
|| (params->connection_u.otaa.nwk_key == NULL )
1638+
|| (params->connection_u.otaa.nwk_key == NULL)
16371639
|| (params->connection_u.otaa.nb_trials == 0)) {
16381640
return LORAWAN_STATUS_PARAMETER_INVALID;
16391641
}
@@ -1684,8 +1686,8 @@ lorawan_status_t LoRaMac::prepare_join(const lorawan_connect_t *params, bool is_
16841686
}
16851687

16861688
if (MBED_CONF_LORA_VERSION == LORAWAN_VERSION_1_1
1687-
&& ((params->connection_u.abp.snwk_sintkey == NULL)
1688-
|| (params->connection_u.abp.nwk_senckey == NULL))) {
1689+
&& ((params->connection_u.abp.snwk_sintkey == NULL)
1690+
|| (params->connection_u.abp.nwk_senckey == NULL))) {
16891691
return LORAWAN_STATUS_PARAMETER_INVALID;
16901692
}
16911693

@@ -1804,7 +1806,7 @@ lorawan_status_t LoRaMac::rejoin(join_req_type_t rejoin_type, bool is_forced, ui
18041806
if (_params.RJcount0 == RJCOUNT_ROLLOVER) {
18051807
return LORAWAN_STATUS_SERVICE_UNKNOWN;
18061808
}
1807-
} else if (rejoin_type == REJOIN_REQUEST_TYPE1){
1809+
} else if (rejoin_type == REJOIN_REQUEST_TYPE1) {
18081810
if (_params.RJcount1 == RJCOUNT_ROLLOVER) {
18091811
return LORAWAN_STATUS_SERVICE_UNKNOWN;
18101812
}
@@ -1911,7 +1913,7 @@ lorawan_status_t LoRaMac::prepare_frame(loramac_mhdr_t *machdr,
19111913
_params.tx_buffer[_params.tx_buffer_len++] = (mic >> 24) & 0xFF;
19121914
}
19131915

1914-
break;
1916+
break;
19151917
case FRAME_TYPE_DATA_CONFIRMED_UP:
19161918
_params.is_node_ack_requested = true;
19171919
//Intentional fallthrough
@@ -2299,7 +2301,7 @@ uint8_t LoRaMac::get_current_adr_ack_limit()
22992301
return _lora_phy->get_adr_ack_limit();
23002302
}
23012303

2302-
void LoRaMac::get_rejoin_parameters(uint32_t& max_time, uint32_t& max_count)
2304+
void LoRaMac::get_rejoin_parameters(uint32_t &max_time, uint32_t &max_count)
23032305
{
23042306
max_time = _lora_phy->get_rejoin_max_time();
23052307
max_count = _lora_phy->get_rejoin_max_count();

0 commit comments

Comments
 (0)