Merged in antmerlino/apps/i8sak-txpwr (pull request #159)

wireless/ieee802154/i8sak: Adds support for getting/setting transmit power.

Approved-by: GregoryN <gnutt@nuttx.org>
This commit is contained in:
Anthony Merlino 2018-11-01 19:04:28 +00:00 committed by GregoryN
parent a26a7f9767
commit 1617e0dcf0
2 changed files with 20 additions and 0 deletions

View File

@ -103,6 +103,7 @@ void i8sak_get_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
" ep_eaddr = i8sak endpoint extended address\n"
" ep_addrmode = destination address mode"
" rxonidle = Receiver on when idle\n"
" txpwr = Transmit power\n"
, argv[0]);
/* Must manually reset optind if we are going to exit early */
@ -245,6 +246,11 @@ void i8sak_get_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
printf("i8sak: Receive on Idle: false\n");
}
}
else if (strcmp(argv[argind], "txpwr") == 0)
{
ieee802154_gettxpwr(fd, &u.attr.phy.txpwr);
printf("i8sak: Transmit Power: %d\n", (int)u.attr.phy.txpwr);
}
else
{
fprintf(stderr, "ERROR: unsupported parameter: %s\n", argv[argind]);
@ -308,6 +314,11 @@ void i8sak_get_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
printf("i8sak: Receive on Idle: false\n");
}
}
else if (strcmp(argv[argind], "txpwr") == 0)
{
sixlowpan_gettxpwr(fd, i8sak->ifname, &u.attr.phy.txpwr);
printf("i8sak: Transmit Power: %d\n", (int)u.attr.phy.txpwr);
}
else
{
fprintf(stderr, "ERROR: unsupported parameter: %s\n", argv[argind]);

View File

@ -102,6 +102,7 @@ void i8sak_set_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
" ep_addrmode s|e = destination addressing mode\n"
" ep_port 1-65535 = port to send to\n"
" rxonidle = Receiver on when idle\n"
" txpwr = Transmit Power\n"
, argv[0]);
/* Must manually reset optind if we are going to exit early */
@ -235,6 +236,10 @@ void i8sak_set_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
{
ieee802154_setrxonidle(fd, i8sak_str2bool(argv[argind + 1]));
}
else if (strcmp(argv[argind], "txpwr") == 0)
{
ieee802154_settxpwr(fd, i8sak_str2long(argv[argind + 1]));
}
else
{
fprintf(stderr, "ERROR: unsupported parameter: %s\n", argv[argind]);
@ -275,6 +280,10 @@ void i8sak_set_cmd(FAR struct i8sak_s *i8sak, int argc, FAR char *argv[])
{
sixlowpan_setrxonidle(fd, i8sak->ifname, i8sak_str2bool(argv[argind + 1]));
}
else if (strcmp(argv[argind], "txpwr") == 0)
{
sixlowpan_settxpwr(fd, i8sak->ifname, i8sak_str2long(argv[argind + 1]));
}
else
{
fprintf(stderr, "ERROR: unsupported parameter: %s\n", argv[argind]);