Merged in antmerlino/apps/i8sak-getset-rxonidle (pull request #124)

i8sak: Adds ability to get/set rxonidle setting for MAC layer

Approved-by: Gregory Nutt <gnutt@nuttx.org>
This commit is contained in:
Anthony Merlino 2017-11-22 21:37:36 +00:00 committed by Gregory Nutt
parent 96acb66d6a
commit 4091367401
2 changed files with 34 additions and 0 deletions

View File

@ -102,6 +102,7 @@ void i8sak_get_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
" ep_saddr = i8sak endpoint short address\n"
" ep_eaddr = i8sak endpoint extended address\n"
" ep_addrmode = destination address mode"
" rxonidle = Receiver on when idle\n"
, argv[0]);
/* Must manually reset optind if we are going to exit early */
@ -232,6 +233,18 @@ void i8sak_get_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
printf("i8sak: Coordinator Extended Address: "
PRINTF_FORMAT_EADDR(u.attr.mac.coordeaddr));
}
else if (strcmp(argv[argind], "rxonidle") == 0)
{
ieee802154_getrxonidle(fd, &u.attr.mac.rxonidle);
if (u.attr.mac.rxonidle)
{
printf("i8sak: Receive on Idle: true\n");
}
else
{
printf("i8sak: Receive on Idle: false\n");
}
}
else
{
fprintf(stderr, "ERROR: unsupported parameter: %s\n", argv[argind]);
@ -283,6 +296,18 @@ void i8sak_get_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
printf("i8sak: Coordinator Extended Address: "
PRINTF_FORMAT_EADDR(u.attr.mac.coordeaddr));
}
else if (strcmp(argv[argind], "rxonidle") == 0)
{
sixlowpan_getrxonidle(fd, i8sak->ifname, &u.attr.mac.rxonidle);
if (u.attr.mac.rxonidle)
{
printf("i8sak: Receive on Idle: true\n");
}
else
{
printf("i8sak: Receive on Idle: false\n");
}
}
else
{
fprintf(stderr, "ERROR: unsupported parameter: %s\n", argv[argind]);

View File

@ -101,6 +101,7 @@ void i8sak_set_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
" ep_eaddr xx:xx:xx:xx:xx:xx:xx:xx = i8sak endpoint extended address\n"
" ep_addrmode s|e = destination addressing mode\n"
" ep_port 1-65535 = port to send to\n"
" rxonidle = Receiver on when idle\n"
, argv[0]);
/* Must manually reset optind if we are going to exit early */
@ -230,6 +231,10 @@ void i8sak_set_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
i8sak_str2eaddr(argv[argind + 1], u.attr.mac.eaddr);
ieee802154_seteaddr(fd, u.attr.mac.eaddr);
}
else if (strcmp(argv[argind], "rxonidle") == 0)
{
ieee802154_setrxonidle(fd, i8sak_str2bool(argv[argind + 1]));
}
else
{
fprintf(stderr, "ERROR: unsupported parameter: %s\n", argv[argind]);
@ -266,6 +271,10 @@ void i8sak_set_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
i8sak_str2eaddr(argv[argind + 1], u.attr.mac.eaddr);
sixlowpan_seteaddr(fd, i8sak->ifname, u.attr.mac.eaddr);
}
else if (strcmp(argv[argind], "rxonidle") == 0)
{
sixlowpan_setrxonidle(fd, i8sak->ifname, i8sak_str2bool(argv[argind + 1]));
}
else
{
fprintf(stderr, "ERROR: unsupported parameter: %s\n", argv[argind]);