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:
parent
5053e3ecae
commit
32cef708a7
@ -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);
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
@ -94,7 +95,7 @@ __attribute__ ((unused))
|
||||
static void str_toupper(char *str)
|
||||
{
|
||||
while (*str) {
|
||||
*str = toupper((unsigned) *str);
|
||||
*str = toupper((unsigned)*str);
|
||||
++str;
|
||||
}
|
||||
}
|
||||
@ -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]);
|
||||
}
|
||||
}
|
||||
@ -809,12 +811,12 @@ static void _netif_list(netif_t *iface)
|
||||
#ifdef MODULE_GNRC_NETIF_CMD_LORA
|
||||
res = netif_get_opt(iface, NETOPT_DEMOD_MARGIN, 0, &u8, sizeof(u8));
|
||||
if (res >= 0) {
|
||||
printf(" Demod margin.: %u ", (unsigned) u8);
|
||||
printf(" Demod margin.: %u ", (unsigned)u8);
|
||||
line_thresh++;
|
||||
}
|
||||
res = netif_get_opt(iface, NETOPT_NUM_GATEWAYS, 0, &u8, sizeof(u8));
|
||||
if (res >= 0) {
|
||||
printf(" Num gateways.: %u ", (unsigned) u8);
|
||||
printf(" Num gateways.: %u ", (unsigned)u8);
|
||||
line_thresh++;
|
||||
}
|
||||
#endif
|
||||
@ -1087,11 +1089,13 @@ static int _netif_set_fsk_fec(netif_t *iface, char *value)
|
||||
static int _netif_set_fsk_modulation_index(netif_t *iface, char *value)
|
||||
{
|
||||
uint8_t a, b;
|
||||
char* frac = strchr(value, '/');
|
||||
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;
|
||||
}
|
||||
|
||||
@ -70,7 +70,8 @@ static void test_gnrc_lorawan__validate_mic(void)
|
||||
/* Uplink packet */
|
||||
le_uint32_t calc_mic;
|
||||
|
||||
gnrc_lorawan_t mac = {0};
|
||||
gnrc_lorawan_t mac = { 0 };
|
||||
|
||||
memcpy(&mac.dev_addr, &dev_addr, sizeof(dev_addr));
|
||||
mac.ctx.fnwksintkey = nwkskey;
|
||||
mac.mcps.fcnt = fcnt;
|
||||
@ -89,7 +90,8 @@ static void test_gnrc_lorawan__wrong_mic(void)
|
||||
/* Uplink packet */
|
||||
le_uint32_t calc_mic;
|
||||
|
||||
gnrc_lorawan_t mac = {0};
|
||||
gnrc_lorawan_t mac = { 0 };
|
||||
|
||||
memcpy(&mac.dev_addr, &dev_addr, sizeof(dev_addr));
|
||||
mac.ctx.fnwksintkey = nwkskey;
|
||||
mac.mcps.fcnt = fcnt;
|
||||
|
||||
@ -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 = {
|
||||
@ -76,7 +78,8 @@ static void test_gnrc_lorawan__validate_mic(void)
|
||||
/* Uplink packet */
|
||||
le_uint32_t calc_mic;
|
||||
|
||||
gnrc_lorawan_t mac = {0};
|
||||
gnrc_lorawan_t mac = { 0 };
|
||||
|
||||
memcpy(&mac.dev_addr, &dev_addr, sizeof(dev_addr));
|
||||
mac.ctx.fnwksintkey = fnwksintkey;
|
||||
mac.ctx.snwksintkey = snwksintkey;
|
||||
@ -99,7 +102,8 @@ static void test_gnrc_lorawan__wrong_mic(void)
|
||||
/* Uplink packet */
|
||||
le_uint32_t calc_mic;
|
||||
|
||||
gnrc_lorawan_t mac = {0};
|
||||
gnrc_lorawan_t mac = { 0 };
|
||||
|
||||
memcpy(&mac.dev_addr, &dev_addr, sizeof(dev_addr));
|
||||
mac.ctx.fnwksintkey = fnwksintkey;
|
||||
mac.ctx.snwksintkey = snwksintkey;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user