Review from last PR; more dangling whitespace at end of lines.
This commit is contained in:
parent
a8ab2f7505
commit
64a9e69e66
@ -74,7 +74,8 @@ void i8sak_acceptassoc_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[]
|
||||
{
|
||||
struct wpanlistener_eventfilter_s filter;
|
||||
bool acceptall = true; /* start off assuming we are going to allow all connections */
|
||||
int option, optcnt;
|
||||
int option;
|
||||
int optcnt;
|
||||
|
||||
optcnt = 0;
|
||||
while ((option = getopt(argc, argv, ":he:")) != ERROR)
|
||||
|
@ -79,7 +79,10 @@ void i8sak_assoc_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
|
||||
{
|
||||
struct ieee802154_assoc_req_s assocreq;
|
||||
struct wpanlistener_eventfilter_s filter;
|
||||
int fd, option, optcnt, ret;
|
||||
int fd;
|
||||
int option;
|
||||
int optcnt;
|
||||
int ret;
|
||||
|
||||
/* If the addresses has never been automatically or manually set before, set
|
||||
* it assuming that we are the default device address and the endpoint is the
|
||||
@ -103,28 +106,33 @@ void i8sak_assoc_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
|
||||
"Usage: %s [-h]\n"
|
||||
" -h = this help menu\n"
|
||||
, argv[0]);
|
||||
|
||||
/* Must manually reset optind if we are going to exit early */
|
||||
|
||||
optind = -1;
|
||||
return;
|
||||
|
||||
case 's':
|
||||
/* Parse extended address and put it into the i8sak instance */
|
||||
|
||||
i8sak->ep.saddr = i8sak_str2luint16(optarg);
|
||||
i8sak->ep.mode= IEEE802154_ADDRMODE_SHORT;
|
||||
break;
|
||||
|
||||
case 'e':
|
||||
/* Parse extended address and put it into the i8sak instance */
|
||||
|
||||
i8sak_str2eaddr(optarg, &i8sak->ep.eaddr[0]);
|
||||
i8sak->ep.mode = IEEE802154_ADDRMODE_EXTENDED;
|
||||
break;
|
||||
|
||||
case ':':
|
||||
fprintf(stderr, "ERROR: missing argument\n");
|
||||
/* Must manually reset optind if we are going to exit early */
|
||||
|
||||
optind = -1;
|
||||
i8sak_cmd_error(i8sak); /* This exits for us */
|
||||
|
||||
case '?':
|
||||
fprintf(stderr, "ERROR: unknown argument\n");
|
||||
/* Must manually reset optind if we are going to exit early */
|
||||
|
@ -97,6 +97,7 @@ void i8sak_blaster_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
|
||||
" -p = set period (and start blaster)\n"
|
||||
"Note: No option starts blaster with defaults\n"
|
||||
, argv[0]);
|
||||
|
||||
/* Must manually reset optind if we are going to exit early */
|
||||
|
||||
optind = -1;
|
||||
@ -104,23 +105,29 @@ void i8sak_blaster_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
|
||||
case 'q': /* Quit blaster */
|
||||
i8sak->blasterenabled = false;
|
||||
break;
|
||||
|
||||
case 'p': /* Inline change blaster period */
|
||||
i8sak->blasterperiod = atoi(optarg);
|
||||
i8sak_blaster_start(i8sak);
|
||||
break;
|
||||
|
||||
case 'f': /* Inline change blaster frame */
|
||||
i8sak->payload_len = i8sak_str2payload(optarg, &i8sak->payload[0]);
|
||||
i8sak_blaster_start(i8sak);
|
||||
break;
|
||||
|
||||
case ':':
|
||||
fprintf(stderr, "ERROR: missing argument\n");
|
||||
|
||||
/* Must manually reset optind if we are going to exit early */
|
||||
|
||||
optind = -1;
|
||||
i8sak_cmd_error(i8sak); /* This exits for us */
|
||||
break;
|
||||
|
||||
case '?':
|
||||
fprintf(stderr, "ERROR: unknown argument\n");
|
||||
|
||||
/* Must manually reset optind if we are going to exit early */
|
||||
|
||||
optind = -1;
|
||||
|
@ -112,12 +112,12 @@ static const struct i8sak_command_s g_i8sak_commands[] =
|
||||
|
||||
#define NCOMMANDS (sizeof(g_i8sak_commands) / sizeof(struct i8sak_command_s))
|
||||
|
||||
sq_queue_t g_i8sak_free;
|
||||
sq_queue_t g_i8sak_instances;
|
||||
struct i8sak_s g_i8sak_pool[CONFIG_IEEE802154_I8SAK_NINSTANCES];
|
||||
bool g_i8sak_initialized = false;
|
||||
bool g_activei8sak_set = false;
|
||||
FAR struct i8sak_s *g_activei8sak;
|
||||
static sq_queue_t g_i8sak_free;
|
||||
static sq_queue_t g_i8sak_instances;
|
||||
static struct i8sak_s g_i8sak_pool[CONFIG_IEEE802154_I8SAK_NINSTANCES];
|
||||
static bool g_i8sak_initialized = false;
|
||||
static bool g_activei8sak_set = false;
|
||||
static FAR struct i8sak_s *g_activei8sak;
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
@ -204,7 +204,9 @@ int i8sak_tx(FAR struct i8sak_s *i8sak, int fd)
|
||||
|
||||
int i8sak_str2payload(FAR const char *str, FAR uint8_t *buf)
|
||||
{
|
||||
int str_len, ret, i = 0;
|
||||
int str_len;
|
||||
int ret;
|
||||
int i = 0;
|
||||
|
||||
str_len = strlen(str);
|
||||
|
||||
@ -213,7 +215,8 @@ int i8sak_str2payload(FAR const char *str, FAR uint8_t *buf)
|
||||
ret = str_len >> 1;
|
||||
|
||||
/* 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))
|
||||
{
|
||||
@ -418,7 +421,9 @@ static void i8sak_switch_instance(FAR char *devname)
|
||||
{
|
||||
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);
|
||||
|
||||
@ -447,7 +452,8 @@ static void i8sak_switch_instance(FAR char *devname)
|
||||
}
|
||||
|
||||
/* Update our "sticky" i8sak instance. Must come before call to setup so that
|
||||
* the shared active global i8sak is correct */
|
||||
* the shared active global i8sak is correct.
|
||||
*/
|
||||
|
||||
g_activei8sak = i8sak;
|
||||
|
||||
@ -465,7 +471,9 @@ static void i8sak_switch_instance(FAR char *devname)
|
||||
static int i8sak_setup(FAR struct i8sak_s *i8sak, FAR const char *devname)
|
||||
{
|
||||
char daemonname[I8SAK_DAEMONNAME_FMTLEN];
|
||||
int i, ret, fd;
|
||||
int i;
|
||||
int ret;
|
||||
int fd;
|
||||
|
||||
if (i8sak->initialized)
|
||||
{
|
||||
@ -651,7 +659,9 @@ int i8_main(int argc, char *argv[])
|
||||
#endif
|
||||
{
|
||||
FAR const struct i8sak_command_s *i8sakcmd;
|
||||
int i, ret, argind;
|
||||
int argind;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
if (!g_i8sak_initialized)
|
||||
{
|
||||
@ -681,11 +691,14 @@ int i8_main(int argc, char *argv[])
|
||||
|
||||
if (argc == 2)
|
||||
{
|
||||
/* Close silently to allow user to set devname without any other operation */
|
||||
/* Close silently to allow user to set devname without any
|
||||
* other operation.
|
||||
*/
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
/* Argument must be command */
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,9 @@ void i8sak_poll_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
|
||||
{
|
||||
struct ieee802154_poll_req_s pollreq;
|
||||
struct wpanlistener_eventfilter_s eventfilter;
|
||||
int ret, fd, option;
|
||||
int option;
|
||||
int fd;
|
||||
int ret;
|
||||
|
||||
ret = OK;
|
||||
while ((option = getopt(argc, argv, ":h")) != ERROR)
|
||||
|
@ -75,7 +75,9 @@
|
||||
|
||||
void i8sak_sniffer_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
|
||||
{
|
||||
int ret, fd, option;
|
||||
int option;
|
||||
int fd;
|
||||
int ret;
|
||||
|
||||
ret = OK;
|
||||
while ((option = getopt(argc, argv, "h")) != ERROR)
|
||||
|
@ -73,7 +73,9 @@ void i8sak_startpan_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
|
||||
{
|
||||
struct ieee802154_reset_req_s resetreq;
|
||||
struct ieee802154_start_req_s startreq;
|
||||
int fd, i, option;
|
||||
int option;
|
||||
int fd;
|
||||
int i;
|
||||
|
||||
while ((option = getopt(argc, argv, ":h")) != ERROR)
|
||||
{
|
||||
|
@ -80,7 +80,10 @@ void i8sak_tx_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
|
||||
enum ieee802154_devmode_e devmode;
|
||||
struct wpanlistener_eventfilter_s eventfilter;
|
||||
bool sendasdev = false;
|
||||
int fd, ret, option, argind;
|
||||
int argind;
|
||||
int option;
|
||||
int fd;
|
||||
int ret;
|
||||
|
||||
ret = OK;
|
||||
argind = 1;
|
||||
@ -94,20 +97,25 @@ void i8sak_tx_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
|
||||
" -h = this help menu\n"
|
||||
" -d = send as device instead of coord\n"
|
||||
, argv[0]);
|
||||
|
||||
/* Must manually reset optind if we are going to exit early */
|
||||
|
||||
optind = -1;
|
||||
return;
|
||||
|
||||
case 'd':
|
||||
sendasdev = true;
|
||||
argind++;
|
||||
break;
|
||||
|
||||
case ':':
|
||||
fprintf(stderr, "ERROR: missing argument\n");
|
||||
|
||||
/* Must manually reset optind if we are going to exit early */
|
||||
|
||||
optind = -1;
|
||||
i8sak_cmd_error(i8sak); /* This exits for us */
|
||||
|
||||
case '?':
|
||||
fprintf(stderr, "ERROR: unknown argument\n");
|
||||
ret = ERROR;
|
||||
@ -139,7 +147,8 @@ void i8sak_tx_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
|
||||
if (!sendasdev)
|
||||
{
|
||||
/* If we are acting as an endpoint, send as normal CSMA (non-indirect)
|
||||
* If we are a coordinator or PAN coordinator, send as indirect */
|
||||
* If we are a coordinator or PAN coordinator, send as indirect.
|
||||
*/
|
||||
|
||||
if (devmode == IEEE802154_DEVMODE_ENDPOINT)
|
||||
{
|
||||
@ -154,7 +163,8 @@ void i8sak_tx_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
|
||||
{
|
||||
/* We cannot send a frame as direct if we are the PAN coordinator. Maybe
|
||||
* this should be the hook for sending payload in beacon? But for now,
|
||||
* let's just thow an error. */
|
||||
* let's just thow an error.
|
||||
*/
|
||||
|
||||
if (devmode == IEEE802154_DEVMODE_PANCOORD)
|
||||
{
|
||||
|
@ -448,7 +448,8 @@ static pthread_addr_t wpanlistener_framethread(pthread_addr_t arg)
|
||||
FAR struct wpanlistener_s *handle = (FAR struct wpanlistener_s *)arg;
|
||||
FAR struct wpanlistener_framereceiver_s *receiver;
|
||||
struct mac802154dev_rxframe_s frame;
|
||||
int i, ret;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
while (handle->threadrun)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user