wireless/ieee802154: Adds option to make it easy to send large frame for testing purposes

This commit is contained in:
Anthony Merlino 2017-06-21 15:27:04 -04:00
parent 593f224950
commit f96b4b15f4

View File

@ -80,6 +80,7 @@ void i8sak_tx_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
enum ieee802154_devmode_e devmode; enum ieee802154_devmode_e devmode;
struct wpanlistener_eventfilter_s eventfilter; struct wpanlistener_eventfilter_s eventfilter;
bool sendasdev = false; bool sendasdev = false;
bool sendmax = false;
int argind; int argind;
int option; int option;
int fd; int fd;
@ -87,7 +88,7 @@ void i8sak_tx_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
ret = OK; ret = OK;
argind = 1; argind = 1;
while ((option = getopt(argc, argv, ":hd")) != ERROR) while ((option = getopt(argc, argv, ":hdm")) != ERROR)
{ {
switch (option) switch (option)
{ {
@ -96,6 +97,7 @@ void i8sak_tx_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
"Usage: %s [-h|d] [<hex-payload>]\n" "Usage: %s [-h|d] [<hex-payload>]\n"
" -h = this help menu\n" " -h = this help menu\n"
" -d = send as device instead of coord\n" " -d = send as device instead of coord\n"
" -m = send the largest frame possible"
, argv[0]); , argv[0]);
/* Must manually reset optind if we are going to exit early */ /* Must manually reset optind if we are going to exit early */
@ -107,6 +109,11 @@ void i8sak_tx_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
sendasdev = true; sendasdev = true;
argind++; argind++;
break; break;
case 'm':
sendmax = true;
argind++;
break;
case ':': case ':':
fprintf(stderr, "ERROR: missing argument\n"); fprintf(stderr, "ERROR: missing argument\n");
@ -132,6 +139,11 @@ void i8sak_tx_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
{ {
i8sak->payload_len = i8sak_str2payload(argv[1], &i8sak->payload[0]); i8sak->payload_len = i8sak_str2payload(argv[1], &i8sak->payload[0]);
} }
if (sendmax)
{
i8sak->payload_len = IEEE802154_MAX_SAFE_MAC_PAYLOAD_SIZE;
}
fd = open(i8sak->devname, O_RDWR); fd = open(i8sak->devname, O_RDWR);
if (fd < 0) if (fd < 0)