Skip to content

Commit 884a774

Browse files
committed
lorawan: fix astyle coding style
1 parent 7bd2581 commit 884a774

29 files changed

+330
-315
lines changed

features/lorawan/lorastack/mac/LoRaMac.cpp

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ void LoRaMac::handle_join_accept_frame(const uint8_t *payload, uint16_t size)
289289
void LoRaMac::check_frame_size(uint16_t size)
290290
{
291291
uint8_t value = _lora_phy->get_max_payload(_mcps_indication.rx_datarate,
292-
_params.is_repeater_supported);
292+
_params.is_repeater_supported);
293293

294294
if (MAX(0, (int16_t)((int16_t)size - (int16_t)LORA_MAC_FRMPAYLOAD_OVERHEAD))
295295
> (int32_t) value) {
@@ -319,7 +319,7 @@ bool LoRaMac::message_integrity_check(const uint8_t *const payload,
319319
mic_rx |= ((uint32_t) payload[size - LORAMAC_MFR_LEN + 2] << 16);
320320
mic_rx |= ((uint32_t) payload[size - LORAMAC_MFR_LEN + 3] << 24);
321321

322-
sequence_counter_prev = (uint16_t)*downlink_counter;
322+
sequence_counter_prev = (uint16_t) * downlink_counter;
323323
sequence_counter_diff = sequence_counter - sequence_counter_prev;
324324
*downlink_counter += sequence_counter_diff;
325325
if (sequence_counter < sequence_counter_prev) {
@@ -600,8 +600,8 @@ void LoRaMac::handle_data_frame(const uint8_t *const payload,
600600
}
601601

602602
if (_device_class == CLASS_C) {
603-
_lora_time.stop(_rx2_closure_timer_for_class_c);
604-
}
603+
_lora_time.stop(_rx2_closure_timer_for_class_c);
604+
}
605605

606606
if (_params.is_node_ack_requested && fctrl.bits.ack) {
607607
_mcps_confirmation.ack_received = fctrl.bits.ack;
@@ -699,7 +699,7 @@ void LoRaMac::on_radio_rx_done(const uint8_t *const payload, uint16_t size,
699699
if (_device_class == CLASS_C && !_continuous_rx2_window_open) {
700700
_lora_time.stop(_rx2_closure_timer_for_class_c);
701701
open_rx2_window();
702-
} else if (_device_class != CLASS_C){
702+
} else if (_device_class != CLASS_C) {
703703
_lora_time.stop(_params.timers.rx_window1_timer);
704704
_lora_phy->put_radio_to_sleep();
705705
}
@@ -1118,9 +1118,9 @@ lorawan_status_t LoRaMac::schedule_tx()
11181118
next_channel.last_aggregate_tx_time = _params.timers.aggregated_last_tx_time;
11191119

11201120
lorawan_status_t status = _lora_phy->set_next_channel(&next_channel,
1121-
&_params.channel,
1122-
&backoff_time,
1123-
&_params.timers.aggregated_timeoff);
1121+
&_params.channel,
1122+
&backoff_time,
1123+
&_params.timers.aggregated_timeoff);
11241124

11251125
switch (status) {
11261126
case LORAWAN_STATUS_NO_CHANNEL_FOUND:
@@ -1139,20 +1139,20 @@ lorawan_status_t LoRaMac::schedule_tx()
11391139
}
11401140

11411141
uint8_t rx1_dr = _lora_phy->apply_DR_offset(_params.sys_params.channel_data_rate,
1142-
_params.sys_params.rx1_dr_offset);
1142+
_params.sys_params.rx1_dr_offset);
11431143

11441144
tr_debug("TX: Channel=%d, TX DR=%d, RX1 DR=%d",
11451145
_params.channel, _params.sys_params.channel_data_rate, rx1_dr);
11461146

11471147

11481148
_lora_phy->compute_rx_win_params(rx1_dr, MBED_CONF_LORA_DOWNLINK_PREAMBLE_LENGTH,
1149-
MBED_CONF_LORA_MAX_SYS_RX_ERROR,
1150-
&_params.rx_window1_config);
1149+
MBED_CONF_LORA_MAX_SYS_RX_ERROR,
1150+
&_params.rx_window1_config);
11511151

11521152
_lora_phy->compute_rx_win_params(_params.sys_params.rx2_channel.datarate,
1153-
MBED_CONF_LORA_DOWNLINK_PREAMBLE_LENGTH,
1154-
MBED_CONF_LORA_MAX_SYS_RX_ERROR,
1155-
&_params.rx_window2_config);
1153+
MBED_CONF_LORA_DOWNLINK_PREAMBLE_LENGTH,
1154+
MBED_CONF_LORA_MAX_SYS_RX_ERROR,
1155+
&_params.rx_window2_config);
11561156

11571157
if (!_is_nwk_joined) {
11581158
_params.rx_window1_delay = _params.sys_params.join_accept_delay1
@@ -1177,8 +1177,8 @@ lorawan_status_t LoRaMac::schedule_tx()
11771177
fopts_len) == false) {
11781178
tr_error("Allowed FRMPayload = %d, FRMPayload = %d, MAC commands pending = %d",
11791179
_lora_phy->get_max_payload(_params.sys_params.channel_data_rate,
1180-
_params.is_repeater_supported),
1181-
_ongoing_tx_msg.f_buffer_size, fopts_len);
1180+
_params.is_repeater_supported),
1181+
_ongoing_tx_msg.f_buffer_size, fopts_len);
11821182
return LORAWAN_STATUS_LENGTH_ERROR;
11831183
}
11841184
_params.rx_window1_delay = _params.sys_params.recv_delay1
@@ -1201,7 +1201,7 @@ void LoRaMac::calculate_backOff(uint8_t channel)
12011201
{
12021202
lorawan_time_t elapsed_time = _lora_time.get_elapsed_time(_params.timers.mac_init_time);
12031203
_lora_phy->calculate_backoff(_is_nwk_joined, _params.is_last_tx_join_request, _params.is_dutycycle_on,
1204-
channel, elapsed_time, _params.timers.tx_toa);
1204+
channel, elapsed_time, _params.timers.tx_toa);
12051205

12061206
// Update aggregated time-off. This must be an assignment and no incremental
12071207
// update as we do only calculate the time-off based on the last transmission
@@ -1301,7 +1301,7 @@ int16_t LoRaMac::prepare_ongoing_tx(const uint8_t port,
13011301
_ongoing_tx_msg.port = port;
13021302
uint8_t max_possible_size = 0;
13031303
uint8_t fopts_len = _mac_commands.get_mac_cmd_length()
1304-
+ _mac_commands.get_repeat_commands_length();
1304+
+ _mac_commands.get_repeat_commands_length();
13051305

13061306
// Handles unconfirmed messages
13071307
if (flags & MSG_UNCONFIRMED_FLAG) {
@@ -1420,9 +1420,9 @@ void LoRaMac::set_device_class(const device_class_t &device_class,
14201420
_params.is_node_ack_requested = false;
14211421
_lora_phy->put_radio_to_sleep();
14221422
_lora_phy->compute_rx_win_params(_params.sys_params.rx2_channel.datarate,
1423-
MBED_CONF_LORA_DOWNLINK_PREAMBLE_LENGTH,
1424-
MBED_CONF_LORA_MAX_SYS_RX_ERROR,
1425-
&_params.rx_window2_config);
1423+
MBED_CONF_LORA_DOWNLINK_PREAMBLE_LENGTH,
1424+
MBED_CONF_LORA_MAX_SYS_RX_ERROR,
1425+
&_params.rx_window2_config);
14261426
}
14271427

14281428
if (CLASS_C == _device_class) {
@@ -1607,9 +1607,9 @@ lorawan_status_t LoRaMac::prepare_frame(loramac_mhdr_t *machdr,
16071607

16081608
if (_params.sys_params.adr_on) {
16091609
if (_lora_phy->get_next_ADR(true,
1610-
_params.sys_params.channel_data_rate,
1611-
_params.sys_params.channel_tx_power,
1612-
_params.adr_ack_counter)) {
1610+
_params.sys_params.channel_data_rate,
1611+
_params.sys_params.channel_tx_power,
1612+
_params.adr_ack_counter)) {
16131613
fctrl->bits.adr_ack_req = 1;
16141614
}
16151615
}
@@ -1696,7 +1696,7 @@ lorawan_status_t LoRaMac::prepare_frame(loramac_mhdr_t *machdr,
16961696

16971697
_params.tx_buffer_len += LORAMAC_MFR_LEN;
16981698
}
1699-
break;
1699+
break;
17001700
case FRAME_TYPE_PROPRIETARY:
17011701
if ((fbuffer != NULL) && (_params.tx_buffer_len > 0)) {
17021702
memcpy(_params.tx_buffer + pkt_header_len, (uint8_t *) fbuffer,

features/lorawan/lorastack/mac/LoRaMacChannelPlan.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void LoRaMacChannelPlan::activate_channelplan_subsystem(LoRaPHY *phy)
3838
_lora_phy = phy;
3939
}
4040

41-
lorawan_status_t LoRaMacChannelPlan::set_plan(const lorawan_channelplan_t& plan)
41+
lorawan_status_t LoRaMacChannelPlan::set_plan(const lorawan_channelplan_t &plan)
4242
{
4343
lorawan_status_t status;
4444

@@ -66,8 +66,8 @@ lorawan_status_t LoRaMacChannelPlan::set_plan(const lorawan_channelplan_t& plan)
6666
return LORAWAN_STATUS_OK;
6767
}
6868

69-
lorawan_status_t LoRaMacChannelPlan::get_plan(lorawan_channelplan_t& plan,
70-
const channel_params_t* channel_list)
69+
lorawan_status_t LoRaMacChannelPlan::get_plan(lorawan_channelplan_t &plan,
70+
const channel_params_t *channel_list)
7171
{
7272
uint8_t max_num_channels;
7373
uint16_t *channel_mask;

features/lorawan/lorastack/mac/LoRaMacChannelPlan.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class LoRaMacChannelPlan {
6767
* @return LORAWAN_STATUS_OK if everything goes well otherwise
6868
* a negative error code is returned.
6969
*/
70-
lorawan_status_t set_plan(const lorawan_channelplan_t& plan);
70+
lorawan_status_t set_plan(const lorawan_channelplan_t &plan);
7171

7272
/** Access the active channel plan
7373
*
@@ -81,7 +81,7 @@ class LoRaMacChannelPlan {
8181
* @return LORAWAN_STATUS_OK if everything goes well otherwise
8282
* a negative error code is returned.
8383
*/
84-
lorawan_status_t get_plan(lorawan_channelplan_t& plan, const channel_params_t* channel_list);
84+
lorawan_status_t get_plan(lorawan_channelplan_t &plan, const channel_params_t *channel_list);
8585

8686
/** Remove the active channel plan
8787
*

features/lorawan/lorastack/mac/LoRaMacCommand.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ bool LoRaMacCommand::has_sticky_mac_cmd() const
129129

130130
lorawan_status_t LoRaMacCommand::process_mac_commands(const uint8_t *payload, uint8_t mac_index,
131131
uint8_t commands_size, uint8_t snr,
132-
loramac_mlme_confirm_t& mlme_conf,
132+
loramac_mlme_confirm_t &mlme_conf,
133133
lora_mac_system_params_t &mac_sys_params,
134134
LoRaPHY &lora_phy)
135135
{
@@ -180,7 +180,7 @@ lorawan_status_t LoRaMacCommand::process_mac_commands(const uint8_t *payload, ui
180180
// Update MAC index
181181
mac_index += link_adr_nb_bytes_pasred - 1;
182182
}
183-
break;
183+
break;
184184
case SRV_MAC_DUTY_CYCLE_REQ:
185185
mac_sys_params.max_duty_cycle = payload[mac_index++];
186186
mac_sys_params.aggregated_duty_cycle = 1 << mac_sys_params.max_duty_cycle;
@@ -207,7 +207,7 @@ lorawan_status_t LoRaMacCommand::process_mac_commands(const uint8_t *payload, ui
207207
}
208208
ret_value = add_rx_param_setup_ans(status);
209209
}
210-
break;
210+
break;
211211
case SRV_MAC_DEV_STATUS_REQ: {
212212
uint8_t battery_level = BAT_LEVEL_NO_MEASURE;
213213
if (_battery_level_cb) {
@@ -231,7 +231,7 @@ lorawan_status_t LoRaMacCommand::process_mac_commands(const uint8_t *payload, ui
231231

232232
ret_value = add_new_channel_ans(status);
233233
}
234-
break;
234+
break;
235235
case SRV_MAC_RX_TIMING_SETUP_REQ: {
236236
uint8_t delay = payload[mac_index++] & 0x0F;
237237

@@ -242,7 +242,7 @@ lorawan_status_t LoRaMacCommand::process_mac_commands(const uint8_t *payload, ui
242242
mac_sys_params.recv_delay2 = mac_sys_params.recv_delay1 + 1000;
243243
ret_value = add_rx_timing_setup_ans();
244244
}
245-
break;
245+
break;
246246
case SRV_MAC_TX_PARAM_SETUP_REQ: {
247247
uint8_t eirpDwellTime = payload[mac_index++];
248248
uint8_t ul_dwell_time;
@@ -270,7 +270,7 @@ lorawan_status_t LoRaMacCommand::process_mac_commands(const uint8_t *payload, ui
270270
ret_value = add_tx_param_setup_ans();
271271
}
272272
}
273-
break;
273+
break;
274274
case SRV_MAC_DL_CHANNEL_REQ: {
275275
uint8_t channel_id = payload[mac_index++];
276276
uint32_t rx1_frequency;
@@ -283,7 +283,7 @@ lorawan_status_t LoRaMacCommand::process_mac_commands(const uint8_t *payload, ui
283283

284284
ret_value = add_dl_channel_ans(status);
285285
}
286-
break;
286+
break;
287287
default:
288288
// Unknown command. ABORT MAC commands processing
289289
tr_error("Invalid MAC command (0x%X)!", payload[mac_index]);

features/lorawan/lorastack/mac/LoRaMacCommand.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ class LoRaMacCommand {
116116
*/
117117
lorawan_status_t process_mac_commands(const uint8_t *payload, uint8_t mac_index,
118118
uint8_t commands_size, uint8_t snr,
119-
loramac_mlme_confirm_t& mlme_conf,
120-
lora_mac_system_params_t& mac_params,
121-
LoRaPHY& lora_phy);
119+
loramac_mlme_confirm_t &mlme_conf,
120+
lora_mac_system_params_t &mac_params,
121+
LoRaPHY &lora_phy);
122122

123123
/**
124124
* @brief Adds a new LinkCheckReq MAC command to be sent.

0 commit comments

Comments
 (0)