Skip to content

Commit

Permalink
gnrc/lorawan: uncrustify files
Browse files Browse the repository at this point in the history
  • Loading branch information
Ollrogge committed Aug 23, 2022
1 parent c3f3aad commit cd400ec
Show file tree
Hide file tree
Showing 7 changed files with 217 additions and 201 deletions.
4 changes: 2 additions & 2 deletions examples/lorawan/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static uint8_t appskey[LORAMAC_APPSKEY_LEN];

static void _alarm_cb(void *arg)
{
(void) arg;
(void)arg;
msg_t msg;
msg_send(&msg, sender_pid);
}
Expand All @@ -98,7 +98,7 @@ static void _send_message(void)
/* Try to send the message */
uint8_t ret = semtech_loramac_send(&loramac,
(uint8_t *)message, strlen(message));
if (ret != SEMTECH_LORAMAC_TX_DONE) {
if (ret != SEMTECH_LORAMAC_TX_DONE) {
printf("Cannot send message '%s', ret code: %d\n", message, ret);
return;
}
Expand Down
22 changes: 11 additions & 11 deletions sys/net/gnrc/link_layer/lorawan/gnrc_lorawan_mcps.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ void gnrc_lorawan_mcps_process_downlink(gnrc_lorawan_t *mac, uint8_t *psdu,

/* NOTE: MIC is in pkt */
if (!gnrc_lorawan_mic_is_valid(psdu, size, mac->ctx.snwksintkey,
mac->mcps.fcnt, gnrc_lorawan_optneg_is_set(mac))) {
mac->mcps.fcnt, gnrc_lorawan_optneg_is_set(mac))) {
DEBUG("gnrc_lorawan: invalid MIC\n");
gnrc_lorawan_event_no_rx(mac);
return;
Expand Down Expand Up @@ -226,17 +226,17 @@ void gnrc_lorawan_mcps_process_downlink(gnrc_lorawan_t *mac, uint8_t *psdu,
if (IS_USED(MODULE_GNRC_LORAWAN_1_1) && gnrc_lorawan_optneg_is_set(mac)) {
if (_pkt.port) {
gnrc_lorawan_encrypt_fopts(fopts->iol_base, fopts->iol_len,
&mac->dev_addr,
gnrc_lorawan_get_afcnt_down(mac), true,
GNRC_LORAWAN_DIR_DOWNLINK,
mac->ctx.nwksenckey);
&mac->dev_addr,
gnrc_lorawan_get_afcnt_down(mac), true,
GNRC_LORAWAN_DIR_DOWNLINK,
mac->ctx.nwksenckey);
}
else {
gnrc_lorawan_encrypt_fopts(fopts->iol_base, fopts->iol_len,
&mac->dev_addr,
mac->mcps.fcnt_down, false,
GNRC_LORAWAN_DIR_DOWNLINK,
mac->ctx.nwksenckey);
&mac->dev_addr,
mac->mcps.fcnt_down, false,
GNRC_LORAWAN_DIR_DOWNLINK,
mac->ctx.nwksenckey);
}
}
DEBUG("gnrc_lorawan: processing fopts\n");
Expand Down Expand Up @@ -331,8 +331,8 @@ size_t gnrc_lorawan_build_uplink(gnrc_lorawan_t *mac, iolist_t *payload,
key = mac->ctx.nwksenckey;

gnrc_lorawan_encrypt_fopts(&buf.data[sizeof(lorawan_hdr_t)], fopts_length,
&mac->dev_addr, mac->mcps.fcnt, false,
GNRC_LORAWAN_DIR_UPLINK, key);
&mac->dev_addr, mac->mcps.fcnt, false,
GNRC_LORAWAN_DIR_UPLINK, key);
}

return buf.index;
Expand Down
3 changes: 2 additions & 1 deletion sys/net/gnrc/link_layer/lorawan/gnrc_lorawan_mlme.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ static int _fopts_mlme_link_rekey_ind(lorawan_buffer_t *buf)
{
if (buf) {
assert(buf->index + GNRC_LORAWAN_CID_SIZE +
GNCR_LORAWAN_REKEY_IND_SIZE <= buf->size);
GNCR_LORAWAN_REKEY_IND_SIZE <= buf->size);

buf->data[buf->index++] = GNCR_LORAWAN_CID_REKEY_CONF;
buf->data[buf->index++] = MINOR_LRWAN;
Expand All @@ -353,6 +353,7 @@ static void _mlme_rekey_check_conf(gnrc_lorawan_t *mac, uint8_t *p)
{
/* server version must by smaller or equal to device's LoRaWAN version */
uint8_t server_minor = p[1];

if (server_minor <= MINOR_LRWAN) {
mac->mlme.pending_mlme_opts &= ~GNRC_LORAWAN_MLME_OPTS_REKEY_IND_REQ;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ extern "C" {
#define MAJOR_MASK 0x3 /**< Major mtype mask */
#define MAJOR_LRWAN_R1 0x0 /**< LoRaWAN R1 version type */

#define MINOR_LRWAN 0x1 /**< Minor LoRaWAN version of device */
#define MINOR_LRWAN 0x1 /**< Minor LoRaWAN version of device */

#define JOIN_REQUEST_SIZE (23U) /**< Join Request size in bytes */
#define MIC_SIZE (4U) /**< MIC size in bytes */
Expand Down
Loading

0 comments on commit cd400ec

Please sign in to comment.