Remove dangling whitespace
This commit is contained in:
parent
e7409b3b16
commit
a8ab2f7505
@ -136,7 +136,7 @@ static void acceptassoc_eventcb(FAR struct ieee802154_notif_s *notif, FAR void *
|
|||||||
|
|
||||||
printf("i8sak: a device is trying to associate\n");
|
printf("i8sak: a device is trying to associate\n");
|
||||||
|
|
||||||
/* If the address matches our device, accept the association.
|
/* If the address matches our device, accept the association.
|
||||||
* Otherwise, reject the assocation.
|
* Otherwise, reject the assocation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -145,11 +145,11 @@ static void acceptassoc_eventcb(FAR struct ieee802154_notif_s *notif, FAR void *
|
|||||||
{
|
{
|
||||||
/* Send a ASSOC.resp primtive to the MAC. Copy the association
|
/* Send a ASSOC.resp primtive to the MAC. Copy the association
|
||||||
* indication address into the association response primitive
|
* indication address into the association response primitive
|
||||||
*/
|
*/
|
||||||
|
|
||||||
memcpy(&assocresp.devaddr[0], ¬if->u.assocind.devaddr[0],
|
memcpy(&assocresp.devaddr[0], ¬if->u.assocind.devaddr[0],
|
||||||
IEEE802154_EADDR_LEN);
|
IEEE802154_EADDR_LEN);
|
||||||
|
|
||||||
assocresp.assocsaddr = i8sak->next_saddr;
|
assocresp.assocsaddr = i8sak->next_saddr;
|
||||||
|
|
||||||
assocresp.status = IEEE802154_STATUS_SUCCESS;
|
assocresp.status = IEEE802154_STATUS_SUCCESS;
|
||||||
@ -160,11 +160,11 @@ static void acceptassoc_eventcb(FAR struct ieee802154_notif_s *notif, FAR void *
|
|||||||
{
|
{
|
||||||
/* Send a ASSOC.resp primtive to the MAC. Copy the association
|
/* Send a ASSOC.resp primtive to the MAC. Copy the association
|
||||||
* indication address into the association response primitive
|
* indication address into the association response primitive
|
||||||
*/
|
*/
|
||||||
|
|
||||||
memcpy(&assocresp.devaddr[0], ¬if->u.assocind.devaddr[0],
|
memcpy(&assocresp.devaddr[0], ¬if->u.assocind.devaddr[0],
|
||||||
IEEE802154_EADDR_LEN);
|
IEEE802154_EADDR_LEN);
|
||||||
|
|
||||||
assocresp.status = IEEE802154_STATUS_DENIED;
|
assocresp.status = IEEE802154_STATUS_DENIED;
|
||||||
|
|
||||||
printf("i8sak: rejecting association request\n");
|
printf("i8sak: rejecting association request\n");
|
||||||
|
@ -86,7 +86,7 @@ void i8sak_assoc_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
|
|||||||
* default PAN Coordinator address. This is actually the way the i8sak settings
|
* default PAN Coordinator address. This is actually the way the i8sak settings
|
||||||
* are configured, so just set the flag if it's not already set.
|
* are configured, so just set the flag if it's not already set.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!i8sak->addrset)
|
if (!i8sak->addrset)
|
||||||
{
|
{
|
||||||
i8sak->addrset = true;
|
i8sak->addrset = true;
|
||||||
@ -133,7 +133,7 @@ void i8sak_assoc_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
|
|||||||
i8sak_cmd_error(i8sak); /* This exits for us */
|
i8sak_cmd_error(i8sak); /* This exits for us */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If none of the option flags were used, and there is an argument included,
|
/* If none of the option flags were used, and there is an argument included,
|
||||||
* assume it is the PAN ID
|
* assume it is the PAN ID
|
||||||
*/
|
*/
|
||||||
@ -142,7 +142,7 @@ void i8sak_assoc_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
|
|||||||
{
|
{
|
||||||
i8sak->ep.panid = i8sak_str2luint16(argv[1]);
|
i8sak->ep.panid = i8sak_str2luint16(argv[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
fd = open(i8sak->devname, O_RDWR);
|
fd = open(i8sak->devname, O_RDWR);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
{
|
{
|
||||||
@ -212,7 +212,7 @@ static void assoc_eventcb(FAR struct ieee802154_notif_s *notif, FAR void *arg)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("i8sak: ASSOC.request failed: %s\n",
|
printf("i8sak: ASSOC.request failed: %s\n",
|
||||||
IEEE802154_STATUS_STRING[notif->u.assocconf.status]);
|
IEEE802154_STATUS_STRING[notif->u.assocconf.status]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ static inline void i8sak_blaster_start (FAR struct i8sak_s *i8sak)
|
|||||||
|
|
||||||
/* Signal the daemon to start running */
|
/* Signal the daemon to start running */
|
||||||
|
|
||||||
printf("starting blaster\n");
|
printf("starting blaster\n");
|
||||||
sem_post(&i8sak->updatesem);
|
sem_post(&i8sak->updatesem);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -131,7 +131,7 @@ static void i8sak_switch_instance(FAR char *devname);
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name : i8sak_tx
|
* Name : i8sak_tx
|
||||||
*
|
*
|
||||||
@ -187,7 +187,7 @@ int i8sak_tx(FAR struct i8sak_s *i8sak, int fd)
|
|||||||
{
|
{
|
||||||
printf(" write: errno=%d\n",errno);
|
printf(" write: errno=%d\n",errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,14 +205,14 @@ int i8sak_tx(FAR struct i8sak_s *i8sak, int fd)
|
|||||||
int i8sak_str2payload(FAR const char *str, FAR uint8_t *buf)
|
int i8sak_str2payload(FAR const char *str, FAR uint8_t *buf)
|
||||||
{
|
{
|
||||||
int str_len, ret, i = 0;
|
int str_len, ret, i = 0;
|
||||||
|
|
||||||
str_len = strlen(str);
|
str_len = strlen(str);
|
||||||
|
|
||||||
/* Each byte is represented by 2 chars */
|
/* Each byte is represented by 2 chars */
|
||||||
|
|
||||||
ret = str_len >> 1;
|
ret = str_len >> 1;
|
||||||
|
|
||||||
/* Check if the number of chars is a multiple of 2 and that the number of
|
/* Check if the number of chars is a multiple of 2 and that the number of
|
||||||
* bytes does not exceed the max MAC frame payload supported */
|
* bytes does not exceed the max MAC frame payload supported */
|
||||||
|
|
||||||
if ((str_len & 1) || (ret > IEEE802154_MAX_MAC_PAYLOAD_SIZE))
|
if ((str_len & 1) || (ret > IEEE802154_MAX_MAC_PAYLOAD_SIZE))
|
||||||
@ -417,21 +417,21 @@ bool i8sak_str2bool(FAR const char *str)
|
|||||||
static void i8sak_switch_instance(FAR char *devname)
|
static void i8sak_switch_instance(FAR char *devname)
|
||||||
{
|
{
|
||||||
FAR struct i8sak_s *i8sak;
|
FAR struct i8sak_s *i8sak;
|
||||||
|
|
||||||
/* Search list of i8sak instances for one associated with the provided device */
|
/* Search list of i8sak instances for one associated with the provided device */
|
||||||
|
|
||||||
i8sak = (FAR struct i8sak_s *)sq_peek(&g_i8sak_instances);
|
i8sak = (FAR struct i8sak_s *)sq_peek(&g_i8sak_instances);
|
||||||
|
|
||||||
while (i8sak != NULL)
|
while (i8sak != NULL)
|
||||||
{
|
{
|
||||||
if (strcmp(devname, i8sak->devname) == 0)
|
if (strcmp(devname, i8sak->devname) == 0)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
i8sak = (FAR struct i8sak_s *)sq_next((FAR sq_entry_t *)i8sak);
|
i8sak = (FAR struct i8sak_s *)sq_next((FAR sq_entry_t *)i8sak);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If there isn't a i8sak instance started for this device, allocate one */
|
/* If there isn't a i8sak instance started for this device, allocate one */
|
||||||
|
|
||||||
if (i8sak == NULL)
|
if (i8sak == NULL)
|
||||||
@ -450,7 +450,7 @@ static void i8sak_switch_instance(FAR char *devname)
|
|||||||
* the shared active global i8sak is correct */
|
* the shared active global i8sak is correct */
|
||||||
|
|
||||||
g_activei8sak = i8sak;
|
g_activei8sak = i8sak;
|
||||||
|
|
||||||
if (!g_activei8sak_set)
|
if (!g_activei8sak_set)
|
||||||
{
|
{
|
||||||
g_activei8sak_set = true;
|
g_activei8sak_set = true;
|
||||||
@ -471,7 +471,7 @@ static int i8sak_setup(FAR struct i8sak_s *i8sak, FAR const char *devname)
|
|||||||
{
|
{
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
i8sak->daemon_started = false;
|
i8sak->daemon_started = false;
|
||||||
i8sak->daemon_shutdown = false;
|
i8sak->daemon_shutdown = false;
|
||||||
|
|
||||||
@ -485,9 +485,9 @@ static int i8sak_setup(FAR struct i8sak_s *i8sak, FAR const char *devname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
strcpy(&i8sak->devname[0], devname);
|
strcpy(&i8sak->devname[0], devname);
|
||||||
|
|
||||||
/* Initialze default extended address */
|
/* Initialze default extended address */
|
||||||
|
|
||||||
for (i = 0; i < IEEE802154_EADDR_LEN; i++)
|
for (i = 0; i < IEEE802154_EADDR_LEN; i++)
|
||||||
{
|
{
|
||||||
i8sak->addr.eaddr[i] = (uint8_t)((CONFIG_IEEE802154_I8SAK_DEV_EADDR >> (i*8)) & 0xFF);
|
i8sak->addr.eaddr[i] = (uint8_t)((CONFIG_IEEE802154_I8SAK_DEV_EADDR >> (i*8)) & 0xFF);
|
||||||
@ -512,9 +512,9 @@ static int i8sak_setup(FAR struct i8sak_s *i8sak, FAR const char *devname)
|
|||||||
printf("cannot open %s, errno=%d\n", i8sak->devname, errno);
|
printf("cannot open %s, errno=%d\n", i8sak->devname, errno);
|
||||||
i8sak_cmd_error(i8sak);
|
i8sak_cmd_error(i8sak);
|
||||||
}
|
}
|
||||||
|
|
||||||
ieee802154_seteaddr(fd, &i8sak->addr.eaddr[0]);
|
ieee802154_seteaddr(fd, &i8sak->addr.eaddr[0]);
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
i8sak->addrset = false;
|
i8sak->addrset = false;
|
||||||
@ -589,7 +589,7 @@ static int i8sak_daemon(int argc, FAR char *argv[])
|
|||||||
/* Signal the calling thread that the daemon is up and running */
|
/* Signal the calling thread that the daemon is up and running */
|
||||||
|
|
||||||
sem_post(&i8sak->sigsem);
|
sem_post(&i8sak->sigsem);
|
||||||
|
|
||||||
while (!i8sak->daemon_shutdown)
|
while (!i8sak->daemon_shutdown)
|
||||||
{
|
{
|
||||||
if (i8sak->blasterenabled)
|
if (i8sak->blasterenabled)
|
||||||
@ -662,7 +662,7 @@ int i8_main(int argc, char *argv[])
|
|||||||
sq_addlast((FAR sq_entry_t *)&g_i8sak_pool[i], &g_i8sak_free);
|
sq_addlast((FAR sq_entry_t *)&g_i8sak_pool[i], &g_i8sak_free);
|
||||||
g_i8sak_pool[i].initialized = false;
|
g_i8sak_pool[i].initialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_i8sak_initialized = true;
|
g_i8sak_initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -688,17 +688,17 @@ int i8_main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
/* Argument must be command */
|
/* Argument must be command */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If devname wasn't included, we need to check if our sticky feature has
|
/* If devname wasn't included, we need to check if our sticky feature has
|
||||||
* ever been set.
|
* ever been set.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
else if (!g_activei8sak_set)
|
else if (!g_activei8sak_set)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "ERROR: Must include devname the first time you run\n");
|
fprintf(stderr, "ERROR: Must include devname the first time you run\n");
|
||||||
i8sak_showusage(argv[0], EXIT_FAILURE);
|
i8sak_showusage(argv[0], EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find the command in the g_i8sak_command[] list */
|
/* Find the command in the g_i8sak_command[] list */
|
||||||
|
|
||||||
i8sakcmd = NULL;
|
i8sakcmd = NULL;
|
||||||
@ -711,7 +711,7 @@ int i8_main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i8sakcmd == NULL)
|
if (i8sakcmd == NULL)
|
||||||
{
|
{
|
||||||
i8sak_showusage(argv[0], EXIT_FAILURE);
|
i8sak_showusage(argv[0], EXIT_FAILURE);
|
||||||
@ -730,7 +730,7 @@ int i8_main(int argc, char *argv[])
|
|||||||
fprintf(stderr, "ERROR: Failed to lock i8sak instance\n");
|
fprintf(stderr, "ERROR: Failed to lock i8sak instance\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
i8sakcmd->handler(g_activei8sak, argc - argind, &argv[argind]);
|
i8sakcmd->handler(g_activei8sak, argc - argind, &argv[argind]);
|
||||||
|
|
||||||
sem_post(&g_activei8sak->exclsem);
|
sem_post(&g_activei8sak->exclsem);
|
||||||
|
@ -110,7 +110,7 @@ void i8sak_poll_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
|
|||||||
i8sak_cmd_error(i8sak); /* This exits for us */
|
i8sak_cmd_error(i8sak); /* This exits for us */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret != OK)
|
if (ret != OK)
|
||||||
{
|
{
|
||||||
i8sak_cmd_error(i8sak);
|
i8sak_cmd_error(i8sak);
|
||||||
@ -167,7 +167,7 @@ static void poll_eventcb(FAR struct ieee802154_notif_s *notif, FAR void *arg)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("i8sak: POLL.request failed: %s\n",
|
printf("i8sak: POLL.request failed: %s\n",
|
||||||
IEEE802154_STATUS_STRING[notif->u.pollconf.status]);
|
IEEE802154_STATUS_STRING[notif->u.pollconf.status]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ void i8sak_sniffer_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
|
|||||||
i8sak_cmd_error(i8sak); /* This exits for us */
|
i8sak_cmd_error(i8sak); /* This exits for us */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret != OK)
|
if (ret != OK)
|
||||||
{
|
{
|
||||||
i8sak_cmd_error(i8sak);
|
i8sak_cmd_error(i8sak);
|
||||||
@ -120,12 +120,12 @@ void i8sak_sniffer_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
|
|||||||
|
|
||||||
/* Enable promiscuous mode */
|
/* Enable promiscuous mode */
|
||||||
|
|
||||||
printf("i8sak: turning on promiscuous mode.\n");
|
printf("i8sak: turning on promiscuous mode.\n");
|
||||||
ieee802154_setpromisc(fd, true);
|
ieee802154_setpromisc(fd, true);
|
||||||
|
|
||||||
/* Make sure receiver is always on while idle */
|
/* Make sure receiver is always on while idle */
|
||||||
|
|
||||||
printf("i8sak: setting receiveonidle.\n");
|
printf("i8sak: setting receiveonidle.\n");
|
||||||
ieee802154_setrxonidle(fd, true);
|
ieee802154_setrxonidle(fd, true);
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
|
@ -124,12 +124,12 @@ void i8sak_startpan_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
|
|||||||
* it assuming that we are the default PAN coordinator address and the
|
* it assuming that we are the default PAN coordinator address and the
|
||||||
* endpoint is the default device address.
|
* endpoint is the default device address.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!i8sak->addrset)
|
if (!i8sak->addrset)
|
||||||
{
|
{
|
||||||
for (i = 0; i < IEEE802154_EADDR_LEN; i++)
|
for (i = 0; i < IEEE802154_EADDR_LEN; i++)
|
||||||
{
|
{
|
||||||
i8sak->addr.eaddr[i] =
|
i8sak->addr.eaddr[i] =
|
||||||
(uint8_t)((CONFIG_IEEE802154_I8SAK_PANCOORD_EADDR >> (i*8)) & 0xFF);
|
(uint8_t)((CONFIG_IEEE802154_I8SAK_PANCOORD_EADDR >> (i*8)) & 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,10 +139,10 @@ void i8sak_startpan_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
|
|||||||
|
|
||||||
for (i = 0; i < IEEE802154_EADDR_LEN; i++)
|
for (i = 0; i < IEEE802154_EADDR_LEN; i++)
|
||||||
{
|
{
|
||||||
i8sak->ep.eaddr[i] =
|
i8sak->ep.eaddr[i] =
|
||||||
(uint8_t)((CONFIG_IEEE802154_I8SAK_DEV_EADDR >> (i*8)) & 0xFF);
|
(uint8_t)((CONFIG_IEEE802154_I8SAK_DEV_EADDR >> (i*8)) & 0xFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
i8sak->ep.mode = IEEE802154_ADDRMODE_SHORT;
|
i8sak->ep.mode = IEEE802154_ADDRMODE_SHORT;
|
||||||
i8sak->ep.saddr = CONFIG_IEEE802154_I8SAK_DEV_SADDR;
|
i8sak->ep.saddr = CONFIG_IEEE802154_I8SAK_DEV_SADDR;
|
||||||
i8sak->ep.panid = CONFIG_IEEE802154_I8SAK_PANID;
|
i8sak->ep.panid = CONFIG_IEEE802154_I8SAK_PANID;
|
||||||
@ -159,7 +159,7 @@ void i8sak_startpan_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
|
|||||||
|
|
||||||
startreq.panid = i8sak->addr.panid;
|
startreq.panid = i8sak->addr.panid;
|
||||||
startreq.chnum = i8sak->chnum;
|
startreq.chnum = i8sak->chnum;
|
||||||
startreq.chpage = i8sak->chpage;
|
startreq.chpage = i8sak->chpage;
|
||||||
startreq.beaconorder = 15;
|
startreq.beaconorder = 15;
|
||||||
startreq.pancoord = true;
|
startreq.pancoord = true;
|
||||||
startreq.coordrealign = false;
|
startreq.coordrealign = false;
|
||||||
|
@ -114,12 +114,12 @@ void i8sak_tx_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret != OK)
|
if (ret != OK)
|
||||||
{
|
{
|
||||||
i8sak_cmd_error(i8sak);
|
i8sak_cmd_error(i8sak);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc == argind + 1)
|
if (argc == argind + 1)
|
||||||
{
|
{
|
||||||
i8sak->payload_len = i8sak_str2payload(argv[1], &i8sak->payload[0]);
|
i8sak->payload_len = i8sak_str2payload(argv[1], &i8sak->payload[0]);
|
||||||
@ -131,7 +131,7 @@ void i8sak_tx_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
|
|||||||
printf("i8sak: cannot open %s, errno=%d\n", i8sak->devname, errno);
|
printf("i8sak: cannot open %s, errno=%d\n", i8sak->devname, errno);
|
||||||
i8sak_cmd_error(i8sak);
|
i8sak_cmd_error(i8sak);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if transaction should be indirect or not */
|
/* Check if transaction should be indirect or not */
|
||||||
|
|
||||||
ieee802154_getdevmode(fd, &devmode);
|
ieee802154_getdevmode(fd, &devmode);
|
||||||
@ -162,7 +162,7 @@ void i8sak_tx_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
|
|||||||
close(fd);
|
close(fd);
|
||||||
i8sak_cmd_error(i8sak);
|
i8sak_cmd_error(i8sak);
|
||||||
}
|
}
|
||||||
|
|
||||||
i8sak->indirect = false;
|
i8sak->indirect = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ void i8sak_tx_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
|
|||||||
close(fd);
|
close(fd);
|
||||||
i8sak_cmd_error(i8sak);
|
i8sak_cmd_error(i8sak);
|
||||||
}
|
}
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,7 +208,7 @@ static void tx_eventcb(FAR struct ieee802154_notif_s *notif, FAR void *arg)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("i8sak: frame failed to send: %s\n",
|
printf("i8sak: frame failed to send: %s\n",
|
||||||
IEEE802154_STATUS_STRING[notif->u.dataconf.status]);
|
IEEE802154_STATUS_STRING[notif->u.dataconf.status]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,13 +71,13 @@ static pthread_addr_t wpanlistener_eventthread(pthread_addr_t arg);
|
|||||||
* OK on success; a negated errno on failure
|
* OK on success; a negated errno on failure
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int wpanlistener_setup(FAR struct wpanlistener_s *handle, int fd)
|
int wpanlistener_setup(FAR struct wpanlistener_s *handle, int fd)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Initialize the frame receiver allocation pool */
|
/* Initialize the frame receiver allocation pool */
|
||||||
|
|
||||||
sq_init(&handle->framereceivers);
|
sq_init(&handle->framereceivers);
|
||||||
@ -95,9 +95,9 @@ int wpanlistener_setup(FAR struct wpanlistener_s *handle, int fd)
|
|||||||
{
|
{
|
||||||
sq_addlast((FAR sq_entry_t *)&handle->eventreceiver_pool[i], &handle->eventreceivers_free);
|
sq_addlast((FAR sq_entry_t *)&handle->eventreceiver_pool[i], &handle->eventreceivers_free);
|
||||||
}
|
}
|
||||||
|
|
||||||
sem_init(&handle->exclsem, 0, 1);
|
sem_init(&handle->exclsem, 0, 1);
|
||||||
|
|
||||||
handle->is_setup = true;
|
handle->is_setup = true;
|
||||||
handle->fd = fd;
|
handle->fd = fd;
|
||||||
return OK;
|
return OK;
|
||||||
@ -116,7 +116,7 @@ int wpanlistener_setup(FAR struct wpanlistener_s *handle, int fd)
|
|||||||
* OK on success; a negated errno on failure
|
* OK on success; a negated errno on failure
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int wpanlistener_start(FAR struct wpanlistener_s *handle)
|
int wpanlistener_start(FAR struct wpanlistener_s *handle)
|
||||||
@ -157,7 +157,7 @@ int wpanlistener_start(FAR struct wpanlistener_s *handle)
|
|||||||
* OK on success; a negated errno on failure
|
* OK on success; a negated errno on failure
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int wpanlistener_stop(FAR struct wpanlistener_s *handle)
|
int wpanlistener_stop(FAR struct wpanlistener_s *handle)
|
||||||
@ -181,12 +181,12 @@ int wpanlistener_stop(FAR struct wpanlistener_s *handle)
|
|||||||
* arg - user specified argument to send to the callback
|
* arg - user specified argument to send to the callback
|
||||||
* oneshot - whether the receiver is automatically unregistered after the
|
* oneshot - whether the receiver is automatically unregistered after the
|
||||||
* first notification
|
* first notification
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* OK if successful; a negated errno on failure
|
* OK if successful; a negated errno on failure
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int wpanlistener_add_framereceiver(FAR struct wpanlistener_s *handle,
|
int wpanlistener_add_framereceiver(FAR struct wpanlistener_s *handle,
|
||||||
@ -216,12 +216,12 @@ int wpanlistener_add_framereceiver(FAR struct wpanlistener_s *handle,
|
|||||||
sem_post(&handle->exclsem);
|
sem_post(&handle->exclsem);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
receiver->cb = cb;
|
receiver->cb = cb;
|
||||||
memcpy(&receiver->filter, filter, sizeof(struct wpanlistener_framefilter_s));
|
memcpy(&receiver->filter, filter, sizeof(struct wpanlistener_framefilter_s));
|
||||||
receiver->arg = arg;
|
receiver->arg = arg;
|
||||||
receiver->oneshot = oneshot;
|
receiver->oneshot = oneshot;
|
||||||
|
|
||||||
/* Link the receiver into the list */
|
/* Link the receiver into the list */
|
||||||
|
|
||||||
sq_addlast((FAR sq_entry_t *)receiver, &handle->framereceivers);
|
sq_addlast((FAR sq_entry_t *)receiver, &handle->framereceivers);
|
||||||
@ -229,7 +229,7 @@ int wpanlistener_add_framereceiver(FAR struct wpanlistener_s *handle,
|
|||||||
sem_post(&handle->exclsem);
|
sem_post(&handle->exclsem);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: wpanlistener_add_eventreceiver
|
* Name: wpanlistener_add_eventreceiver
|
||||||
*
|
*
|
||||||
@ -251,7 +251,7 @@ int wpanlistener_add_framereceiver(FAR struct wpanlistener_s *handle,
|
|||||||
* OK if successful; a negated errno on failure
|
* OK if successful; a negated errno on failure
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int wpanlistener_add_eventreceiver(FAR struct wpanlistener_s *handle,
|
int wpanlistener_add_eventreceiver(FAR struct wpanlistener_s *handle,
|
||||||
@ -281,7 +281,7 @@ int wpanlistener_add_eventreceiver(FAR struct wpanlistener_s *handle,
|
|||||||
sem_post(&handle->exclsem);
|
sem_post(&handle->exclsem);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
receiver->cb = cb;
|
receiver->cb = cb;
|
||||||
memcpy(&receiver->filter, filter, sizeof(struct wpanlistener_eventfilter_s));
|
memcpy(&receiver->filter, filter, sizeof(struct wpanlistener_eventfilter_s));
|
||||||
receiver->arg = arg;
|
receiver->arg = arg;
|
||||||
@ -290,7 +290,7 @@ int wpanlistener_add_eventreceiver(FAR struct wpanlistener_s *handle,
|
|||||||
/* Link the receiver into the list */
|
/* Link the receiver into the list */
|
||||||
|
|
||||||
sq_addlast((FAR sq_entry_t *)receiver, &handle->eventreceivers);
|
sq_addlast((FAR sq_entry_t *)receiver, &handle->eventreceivers);
|
||||||
|
|
||||||
sem_post(&handle->exclsem);
|
sem_post(&handle->exclsem);
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
@ -311,7 +311,7 @@ int wpanlistener_add_eventreceiver(FAR struct wpanlistener_s *handle,
|
|||||||
* OK on success; a negated errno on failure
|
* OK on success; a negated errno on failure
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int wpanlistener_remove_framereceiver(FAR struct wpanlistener_s *handle,
|
int wpanlistener_remove_framereceiver(FAR struct wpanlistener_s *handle,
|
||||||
@ -328,14 +328,14 @@ int wpanlistener_remove_framereceiver(FAR struct wpanlistener_s *handle,
|
|||||||
fprintf(stderr, "wpanlistener: failed to remove receiver: %d\n", ret);
|
fprintf(stderr, "wpanlistener: failed to remove receiver: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search through frame receivers until either we match the callback, or
|
/* Search through frame receivers until either we match the callback, or
|
||||||
* there is no more receivers to check.
|
* there is no more receivers to check.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
receiver = (FAR struct wpanlistener_framereceiver_s *)sq_peek(
|
receiver = (FAR struct wpanlistener_framereceiver_s *)sq_peek(
|
||||||
&handle->framereceivers);
|
&handle->framereceivers);
|
||||||
|
|
||||||
while (receiver != NULL)
|
while (receiver != NULL)
|
||||||
{
|
{
|
||||||
/* Check if callback matches */
|
/* Check if callback matches */
|
||||||
@ -354,11 +354,11 @@ int wpanlistener_remove_framereceiver(FAR struct wpanlistener_s *handle,
|
|||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
receiver = (FAR struct wpanlistener_framereceiver_s *)sq_next(
|
receiver = (FAR struct wpanlistener_framereceiver_s *)sq_next(
|
||||||
(FAR sq_entry_t *)receiver);
|
(FAR sq_entry_t *)receiver);
|
||||||
}
|
}
|
||||||
|
|
||||||
sem_post(&handle->exclsem);
|
sem_post(&handle->exclsem);
|
||||||
fprintf(stderr, "wpanlistener: failed to remove receiver");
|
fprintf(stderr, "wpanlistener: failed to remove receiver");
|
||||||
return ERROR;
|
return ERROR;
|
||||||
@ -379,7 +379,7 @@ int wpanlistener_remove_framereceiver(FAR struct wpanlistener_s *handle,
|
|||||||
* OK on success; a negated errno on failure
|
* OK on success; a negated errno on failure
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int wpanlistener_remove_eventreceiver(FAR struct wpanlistener_s *handle,
|
int wpanlistener_remove_eventreceiver(FAR struct wpanlistener_s *handle,
|
||||||
@ -396,14 +396,14 @@ int wpanlistener_remove_eventreceiver(FAR struct wpanlistener_s *handle,
|
|||||||
fprintf(stderr, "wpanlistener: failed to remove receiver: %d\n", ret);
|
fprintf(stderr, "wpanlistener: failed to remove receiver: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search through frame receivers until either we match the callback, or
|
/* Search through frame receivers until either we match the callback, or
|
||||||
* there is no more receivers to check.
|
* there is no more receivers to check.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
receiver = (FAR struct wpanlistener_eventreceiver_s *)sq_peek(
|
receiver = (FAR struct wpanlistener_eventreceiver_s *)sq_peek(
|
||||||
&handle->eventreceivers);
|
&handle->eventreceivers);
|
||||||
|
|
||||||
while (receiver != NULL)
|
while (receiver != NULL)
|
||||||
{
|
{
|
||||||
/* Check if callback matches */
|
/* Check if callback matches */
|
||||||
@ -422,11 +422,11 @@ int wpanlistener_remove_eventreceiver(FAR struct wpanlistener_s *handle,
|
|||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
receiver = (FAR struct wpanlistener_eventreceiver_s *)sq_next(
|
receiver = (FAR struct wpanlistener_eventreceiver_s *)sq_next(
|
||||||
(FAR sq_entry_t *)receiver);
|
(FAR sq_entry_t *)receiver);
|
||||||
}
|
}
|
||||||
|
|
||||||
sem_post(&handle->exclsem);
|
sem_post(&handle->exclsem);
|
||||||
fprintf(stderr, "wpanlistener: failed to remove receiver");
|
fprintf(stderr, "wpanlistener: failed to remove receiver");
|
||||||
return ERROR;
|
return ERROR;
|
||||||
@ -474,29 +474,29 @@ static pthread_addr_t wpanlistener_framethread(pthread_addr_t arg)
|
|||||||
|
|
||||||
printf(" \n");
|
printf(" \n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
/* Loop through frame receivers and call callbacks for those receivers
|
/* Loop through frame receivers and call callbacks for those receivers
|
||||||
* whose filter matches this frame
|
* whose filter matches this frame
|
||||||
*/
|
*/
|
||||||
|
|
||||||
receiver = (FAR struct wpanlistener_framereceiver_s *)sq_peek(
|
receiver = (FAR struct wpanlistener_framereceiver_s *)sq_peek(
|
||||||
&handle->framereceivers);
|
&handle->framereceivers);
|
||||||
|
|
||||||
while (receiver != NULL)
|
while (receiver != NULL)
|
||||||
{
|
{
|
||||||
/* TODO: When filtering options are figured out. Actually filter packets
|
/* TODO: When filtering options are figured out. Actually filter packets
|
||||||
* here. For now, all frames get passed to all receivers.
|
* here. For now, all frames get passed to all receivers.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
receiver->cb(&frame, receiver->arg);
|
receiver->cb(&frame, receiver->arg);
|
||||||
|
|
||||||
receiver = (FAR struct wpanlistener_framereceiver_s *)sq_next(
|
receiver = (FAR struct wpanlistener_framereceiver_s *)sq_next(
|
||||||
(FAR sq_entry_t *)receiver);
|
(FAR sq_entry_t *)receiver);
|
||||||
|
|
||||||
/* Check if the receiver was a one-shot receiver, then throw it out
|
/* Check if the receiver was a one-shot receiver, then throw it out
|
||||||
* if it is
|
* if it is
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (receiver->oneshot)
|
if (receiver->oneshot)
|
||||||
{
|
{
|
||||||
/* Unlink the receiver from the list */
|
/* Unlink the receiver from the list */
|
||||||
@ -547,10 +547,10 @@ static pthread_addr_t wpanlistener_eventthread(pthread_addr_t arg)
|
|||||||
/* Loop through event receivers and call callbacks for those receivers
|
/* Loop through event receivers and call callbacks for those receivers
|
||||||
* listening for this event type.
|
* listening for this event type.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
receiver = (FAR struct wpanlistener_eventreceiver_s *)sq_peek(
|
receiver = (FAR struct wpanlistener_eventreceiver_s *)sq_peek(
|
||||||
&handle->eventreceivers);
|
&handle->eventreceivers);
|
||||||
|
|
||||||
while (receiver != NULL)
|
while (receiver != NULL)
|
||||||
{
|
{
|
||||||
if (notif.notiftype == IEEE802154_NOTIFY_CONF_DATA &&
|
if (notif.notiftype == IEEE802154_NOTIFY_CONF_DATA &&
|
||||||
@ -727,15 +727,15 @@ static pthread_addr_t wpanlistener_eventthread(pthread_addr_t arg)
|
|||||||
receiver->filter.indevents.disassoc)
|
receiver->filter.indevents.disassoc)
|
||||||
{
|
{
|
||||||
receiver->cb(¬if, receiver->arg);
|
receiver->cb(¬if, receiver->arg);
|
||||||
|
|
||||||
if (receiver->oneshot)
|
if (receiver->oneshot)
|
||||||
{
|
{
|
||||||
/* Unlink the receiver from the list */
|
/* Unlink the receiver from the list */
|
||||||
|
|
||||||
sq_rem((FAR sq_entry_t *)receiver, &handle->eventreceivers);
|
sq_rem((FAR sq_entry_t *)receiver, &handle->eventreceivers);
|
||||||
|
|
||||||
/* Link the receiver back into the free list */
|
/* Link the receiver back into the free list */
|
||||||
|
|
||||||
sq_addlast((FAR sq_entry_t *)receiver, &handle->eventreceivers_free);
|
sq_addlast((FAR sq_entry_t *)receiver, &handle->eventreceivers_free);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -744,15 +744,15 @@ static pthread_addr_t wpanlistener_eventthread(pthread_addr_t arg)
|
|||||||
receiver->filter.indevents.beaconnotify)
|
receiver->filter.indevents.beaconnotify)
|
||||||
{
|
{
|
||||||
receiver->cb(¬if, receiver->arg);
|
receiver->cb(¬if, receiver->arg);
|
||||||
|
|
||||||
if (receiver->oneshot)
|
if (receiver->oneshot)
|
||||||
{
|
{
|
||||||
/* Unlink the receiver from the list */
|
/* Unlink the receiver from the list */
|
||||||
|
|
||||||
sq_rem((FAR sq_entry_t *)receiver, &handle->eventreceivers);
|
sq_rem((FAR sq_entry_t *)receiver, &handle->eventreceivers);
|
||||||
|
|
||||||
/* Link the receiver back into the free list */
|
/* Link the receiver back into the free list */
|
||||||
|
|
||||||
sq_addlast((FAR sq_entry_t *)receiver, &handle->eventreceivers_free);
|
sq_addlast((FAR sq_entry_t *)receiver, &handle->eventreceivers_free);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -761,15 +761,15 @@ static pthread_addr_t wpanlistener_eventthread(pthread_addr_t arg)
|
|||||||
receiver->filter.indevents.gts)
|
receiver->filter.indevents.gts)
|
||||||
{
|
{
|
||||||
receiver->cb(¬if, receiver->arg);
|
receiver->cb(¬if, receiver->arg);
|
||||||
|
|
||||||
if (receiver->oneshot)
|
if (receiver->oneshot)
|
||||||
{
|
{
|
||||||
/* Unlink the receiver from the list */
|
/* Unlink the receiver from the list */
|
||||||
|
|
||||||
sq_rem((FAR sq_entry_t *)receiver, &handle->eventreceivers);
|
sq_rem((FAR sq_entry_t *)receiver, &handle->eventreceivers);
|
||||||
|
|
||||||
/* Link the receiver back into the free list */
|
/* Link the receiver back into the free list */
|
||||||
|
|
||||||
sq_addlast((FAR sq_entry_t *)receiver, &handle->eventreceivers_free);
|
sq_addlast((FAR sq_entry_t *)receiver, &handle->eventreceivers_free);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -778,15 +778,15 @@ static pthread_addr_t wpanlistener_eventthread(pthread_addr_t arg)
|
|||||||
receiver->filter.indevents.orphan)
|
receiver->filter.indevents.orphan)
|
||||||
{
|
{
|
||||||
receiver->cb(¬if, receiver->arg);
|
receiver->cb(¬if, receiver->arg);
|
||||||
|
|
||||||
if (receiver->oneshot)
|
if (receiver->oneshot)
|
||||||
{
|
{
|
||||||
/* Unlink the receiver from the list */
|
/* Unlink the receiver from the list */
|
||||||
|
|
||||||
sq_rem((FAR sq_entry_t *)receiver, &handle->eventreceivers);
|
sq_rem((FAR sq_entry_t *)receiver, &handle->eventreceivers);
|
||||||
|
|
||||||
/* Link the receiver back into the free list */
|
/* Link the receiver back into the free list */
|
||||||
|
|
||||||
sq_addlast((FAR sq_entry_t *)receiver, &handle->eventreceivers_free);
|
sq_addlast((FAR sq_entry_t *)receiver, &handle->eventreceivers_free);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -795,15 +795,15 @@ static pthread_addr_t wpanlistener_eventthread(pthread_addr_t arg)
|
|||||||
receiver->filter.indevents.commstatus)
|
receiver->filter.indevents.commstatus)
|
||||||
{
|
{
|
||||||
receiver->cb(¬if, receiver->arg);
|
receiver->cb(¬if, receiver->arg);
|
||||||
|
|
||||||
if (receiver->oneshot)
|
if (receiver->oneshot)
|
||||||
{
|
{
|
||||||
/* Unlink the receiver from the list */
|
/* Unlink the receiver from the list */
|
||||||
|
|
||||||
sq_rem((FAR sq_entry_t *)receiver, &handle->eventreceivers);
|
sq_rem((FAR sq_entry_t *)receiver, &handle->eventreceivers);
|
||||||
|
|
||||||
/* Link the receiver back into the free list */
|
/* Link the receiver back into the free list */
|
||||||
|
|
||||||
sq_addlast((FAR sq_entry_t *)receiver, &handle->eventreceivers_free);
|
sq_addlast((FAR sq_entry_t *)receiver, &handle->eventreceivers_free);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -812,15 +812,15 @@ static pthread_addr_t wpanlistener_eventthread(pthread_addr_t arg)
|
|||||||
receiver->filter.indevents.syncloss)
|
receiver->filter.indevents.syncloss)
|
||||||
{
|
{
|
||||||
receiver->cb(¬if, receiver->arg);
|
receiver->cb(¬if, receiver->arg);
|
||||||
|
|
||||||
if (receiver->oneshot)
|
if (receiver->oneshot)
|
||||||
{
|
{
|
||||||
/* Unlink the receiver from the list */
|
/* Unlink the receiver from the list */
|
||||||
|
|
||||||
sq_rem((FAR sq_entry_t *)receiver, &handle->eventreceivers);
|
sq_rem((FAR sq_entry_t *)receiver, &handle->eventreceivers);
|
||||||
|
|
||||||
/* Link the receiver back into the free list */
|
/* Link the receiver back into the free list */
|
||||||
|
|
||||||
sq_addlast((FAR sq_entry_t *)receiver, &handle->eventreceivers_free);
|
sq_addlast((FAR sq_entry_t *)receiver, &handle->eventreceivers_free);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@
|
|||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int ieee802154_enableevents(int fd, bool enable)
|
int ieee802154_enableevents(int fd, bool enable)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -488,7 +488,7 @@ static void wapi_essid_cmd(int sock, FAR const char *ifname,
|
|||||||
/* Convert input strings to values */
|
/* Convert input strings to values */
|
||||||
|
|
||||||
essid_flag = (enum wapi_essid_flag_e)wapi_str2ndx(flagstr, g_wapi_essid_flags, 2);
|
essid_flag = (enum wapi_essid_flag_e)wapi_str2ndx(flagstr, g_wapi_essid_flags, 2);
|
||||||
|
|
||||||
/* Set the ESSID */
|
/* Set the ESSID */
|
||||||
|
|
||||||
ret = wapi_set_essid(sock, ifname, essid, essid_flag);
|
ret = wapi_set_essid(sock, ifname, essid, essid_flag);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user