1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-16 10:03:50 +01:00

gnrc/lorawan: uncrustify files

This commit is contained in:
Ollrogge 2022-08-23 15:39:42 +02:00
parent 5053e3ecae
commit 32cef708a7
7 changed files with 217 additions and 201 deletions

View File

@ -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;
}

View File

@ -86,6 +86,7 @@ static const struct {
static void _print_iface_name(netif_t *iface)
{
char name[CONFIG_NETIF_NAMELENMAX];
netif_get_name(iface, name);
printf("%s", name);
}
@ -743,7 +744,8 @@ static void _netif_list(netif_t *iface)
frac_short(&u8, hwaddr);
if (hwaddr[0] == 1) {
printf(" modulation index: %u ", u8);
} else {
}
else {
printf(" modulation index: %u/%u ", u8, hwaddr[0]);
}
}
@ -1088,10 +1090,12 @@ static int _netif_set_fsk_modulation_index(netif_t *iface, char *value)
{
uint8_t a, b;
char *frac = strchr(value, '/');
if (frac) {
*frac = 0;
b = atoi(frac + 1);
} else {
}
else {
b = 1;
}
a = atoi(value);
@ -1099,10 +1103,12 @@ static int _netif_set_fsk_modulation_index(netif_t *iface, char *value)
frac_extend(&a, &b, 64);
int res = netif_set_opt(iface, NETOPT_MR_FSK_MODULATION_INDEX, 0, &a, sizeof(uint8_t));
if (res < 0) {
printf("error: unable to set modulation index to %d/%d\n", a, b);
return 1;
} else {
}
else {
printf("success: set modulation index to %d/%d\n", res, b);
}
@ -1253,6 +1259,7 @@ static int _netif_set_lw_key(netif_t *iface, netopt_t opt, char *key_str)
size_t key_len = fmt_hex_bytes(key, key_str);
size_t expected_len;
switch (opt) {
case NETOPT_LORAWAN_APPKEY:
case NETOPT_LORAWAN_APPSKEY:
@ -1358,7 +1365,8 @@ static int _netif_set_state(netif_t *iface, char *state_str)
return 0;
}
static int _hex_to_int(char c) {
static int _hex_to_int(char c)
{
if ('0' <= c && c <= '9') {
return c - '0';
}
@ -1870,7 +1878,8 @@ int _gnrc_netif_config(int argc, char **argv)
(strcmp(argv[1], "--help") == 0)) {
_usage(argv[0]);
return 0;
} else {
}
else {
puts("error: invalid interface given");
return 1;
}

View File

@ -71,6 +71,7 @@ static void test_gnrc_lorawan__validate_mic(void)
le_uint32_t calc_mic;
gnrc_lorawan_t mac = { 0 };
memcpy(&mac.dev_addr, &dev_addr, sizeof(dev_addr));
mac.ctx.fnwksintkey = nwkskey;
mac.mcps.fcnt = fcnt;
@ -90,6 +91,7 @@ static void test_gnrc_lorawan__wrong_mic(void)
le_uint32_t calc_mic;
gnrc_lorawan_t mac = { 0 };
memcpy(&mac.dev_addr, &dev_addr, sizeof(dev_addr));
mac.ctx.fnwksintkey = nwkskey;
mac.mcps.fcnt = fcnt;

View File

@ -25,9 +25,11 @@ static uint8_t snwksintkey[] =
{ 0xc0, 0x9f, 0x9e, 0x9a, 0x13, 0x91, 0xae, 0xcc, 0x54, 0xdb, 0x49, 0x0e, 0x11, 0x26, 0x1f, 0x21 };
static uint8_t lorawan_packet_no_mic[] =
{ 0x40, 0x30, 0xe2, 0xde, 0x00, 0x00, 0x00, 0x00, 0x01, 0x3b, 0xc5, 0xf0, 0xa0, 0x69, 0x49, 0x66, 0xee, 0x00, 0xc1, 0xaa, 0x0d, 0xee, 0x20 };
{ 0x40, 0x30, 0xe2, 0xde, 0x00, 0x00, 0x00, 0x00, 0x01, 0x3b, 0xc5, 0xf0, 0xa0, 0x69, 0x49, 0x66,
0xee, 0x00, 0xc1, 0xaa, 0x0d, 0xee, 0x20 };
static uint8_t lorawan_packet_wrong[] =
{ 0x40, 0x30, 0xe2, 0xde, 0x00, 0x00, 0x00, 0xaa, 0x01, 0x3b, 0xc5, 0xf0, 0xa0, 0x69, 0x49, 0x66, 0xee, 0x00, 0xc1, 0xaa, 0x0d, 0xee, 0x20 };
{ 0x40, 0x30, 0xe2, 0xde, 0x00, 0x00, 0x00, 0xaa, 0x01, 0x3b, 0xc5, 0xf0, 0xa0, 0x69, 0x49, 0x66,
0xee, 0x00, 0xc1, 0xaa, 0x0d, 0xee, 0x20 };
static uint8_t mic[] = { 0x12, 0xcd, 0x3c, 0x8a };
static le_uint32_t dev_addr = {
@ -77,6 +79,7 @@ static void test_gnrc_lorawan__validate_mic(void)
le_uint32_t calc_mic;
gnrc_lorawan_t mac = { 0 };
memcpy(&mac.dev_addr, &dev_addr, sizeof(dev_addr));
mac.ctx.fnwksintkey = fnwksintkey;
mac.ctx.snwksintkey = snwksintkey;
@ -100,6 +103,7 @@ static void test_gnrc_lorawan__wrong_mic(void)
le_uint32_t calc_mic;
gnrc_lorawan_t mac = { 0 };
memcpy(&mac.dev_addr, &dev_addr, sizeof(dev_addr));
mac.ctx.fnwksintkey = fnwksintkey;
mac.ctx.snwksintkey = snwksintkey;