wireless/ieee802154: Adds rxonidle attribute helpers
This commit is contained in:
parent
6ec8e56f89
commit
a6ef54cf0c
@ -100,6 +100,9 @@ int ieee802154_geteaddr(int fd, FAR uint8_t *eaddr);
|
||||
int ieee802154_setpromisc(int fd, bool promisc);
|
||||
int ieee802154_getpromisc(int fd, FAR bool *promisc);
|
||||
|
||||
int ieee802154_setrxonidle(int fd, bool rxonidle);
|
||||
int ieee802154_getrxonidle(int fd, FAR bool *rxonidle);
|
||||
|
||||
int ieee802154_settxpwr(int fd, int32_t txpwr);
|
||||
int ieee802154_gettxpwr(int fd, FAR int32_t *txpwr);
|
||||
|
||||
@ -168,22 +171,14 @@ int sixlowpan_setpromisc(int sock, FAR const char *ifname, bool promisc);
|
||||
int sixlowpan_getpromisc(int sock, FAR const char *ifname,
|
||||
FAR bool *promisc);
|
||||
|
||||
int sixlowpan_setdevmode(int sock, FAR const char *ifname, uint8_t devmode);
|
||||
int sixlowpan_getdevmode(int sock, FAR const char *ifname,
|
||||
FAR uint8_t *devmode);
|
||||
int sixlowpan_setrxonidle(int sock, FAR const char *ifname, bool rxonidle);
|
||||
int sixlowpan_getrxonidle(int sock, FAR const char *ifname,
|
||||
FAR bool *rxonidle);
|
||||
|
||||
int sixlowpan_settxpwr(int sock, FAR const char *ifname, int32_t txpwr);
|
||||
int sixlowpan_gettxpwr(int sock, FAR const char *ifname,
|
||||
FAR int32_t *txpwr);
|
||||
|
||||
int sixlowpan_setcca(int sock, FAR const char *ifname,
|
||||
FAR struct ieee802154_cca_s *cca);
|
||||
int sixlowpan_getcca(int sock, FAR const char *ifname,
|
||||
FAR struct ieee802154_cca_s *cca);
|
||||
|
||||
int sixlowpan_energydetect(int sock, FAR const char *ifname,
|
||||
FAR bool *energy);
|
||||
|
||||
#endif /* CONFIG_NET_6LOWPAN*/
|
||||
|
||||
/* libutils *****************************************************************/
|
||||
|
@ -47,11 +47,12 @@ CSRCS += ieee802154_resetreq.c ieee802154_rxenabreq.c ieee802154_scanreq.c
|
||||
CSRCS += ieee802154_setreq.c ieee802154_startreq.c ieee802154_syncreq.c
|
||||
CSRCS += ieee802154_pollreq.c
|
||||
# Add Get/Set Attribute helpers
|
||||
CSRCS = ieee802154_setchan.c ieee802154_getchan.c
|
||||
CSRCS += ieee802154_setchan.c ieee802154_getchan.c
|
||||
CSRCS += ieee802154_setpanid.c ieee802154_getpanid.c
|
||||
CSRCS += ieee802154_setsaddr.c ieee802154_getsaddr.c
|
||||
CSRCS += ieee802154_seteaddr.c ieee802154_geteaddr.c
|
||||
CSRCS += ieee802154_setpromisc.c ieee802154_getpromisc.c
|
||||
CSRCS += ieee802154_setrxonidle.c ieee802154_getrxonidle.c
|
||||
CSRCS += ieee802154_settxpwr.c ieee802154_gettxpwr.c
|
||||
|
||||
ifeq ($(CONFIG_NET_6LOWPAN),y)
|
||||
@ -67,6 +68,7 @@ CSRCS += sixlowpan_setpanid.c sixlowpan_getpanid.c
|
||||
CSRCS += sixlowpan_setsaddr.c sixlowpan_getsaddr.c
|
||||
CSRCS += sixlowpan_seteaddr.c sixlowpan_geteaddr.c
|
||||
CSRCS += sixlowpan_setpromisc.c sixlowpan_getpromisc.c
|
||||
CSRCS += sixlowpan_setrxonidle.c sixlowpan_getrxonidle.c
|
||||
CSRCS += sixlowpan_settxpwr.c sixlowpan_gettxpwr.c
|
||||
endif
|
||||
|
||||
|
@ -63,5 +63,4 @@ int ieee802154_getpromisc(int fd, FAR bool *promisc)
|
||||
*promisc = req.attr_value.mac.promisc_mode;
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
67
wireless/ieee802154/libmac/ieee802154_getrxonidle.c
Normal file
67
wireless/ieee802154/libmac/ieee802154_getrxonidle.c
Normal file
@ -0,0 +1,67 @@
|
||||
/****************************************************************************
|
||||
* apps/wireless/ieee802154/libmac/ieee802154_getrxonidle.c
|
||||
*
|
||||
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2017 Verge Inc. All rights reserved.
|
||||
* Author: Anthony Merlino <anthony@vergeaero.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/wireless/ieee802154/ieee802154_mac.h>
|
||||
|
||||
#include "wireless/ieee802154.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int ieee802154_getrxonidle(int fd, FAR bool *rxonidle)
|
||||
{
|
||||
struct ieee802154_get_req_s req;
|
||||
int ret;
|
||||
|
||||
req.pib_attr = IEEE802154_PIB_MAC_RX_ON_WHEN_IDLE;
|
||||
ret = ieee802154_get_req(fd, &req);
|
||||
|
||||
*rxonidle = req.attr_value.mac.rxonidle;
|
||||
|
||||
return ret;
|
||||
}
|
65
wireless/ieee802154/libmac/ieee802154_setrxonidle.c
Normal file
65
wireless/ieee802154/libmac/ieee802154_setrxonidle.c
Normal file
@ -0,0 +1,65 @@
|
||||
/****************************************************************************
|
||||
* apps/wireless/ieee802154/libmac/ieee802154_setrxonidle.c
|
||||
*
|
||||
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2017 Verge Inc. All rights reserved.
|
||||
* Author: Anthony Merlino <anthony@vergeaero.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/wireless/ieee802154/ieee802154_mac.h>
|
||||
|
||||
#include "wireless/ieee802154.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int ieee802154_setrxonidle(int fd, bool rxonidle)
|
||||
{
|
||||
struct ieee802154_set_req_s req;
|
||||
|
||||
req.pib_attr = IEEE802154_PIB_MAC_RX_ON_WHEN_IDLE;
|
||||
req.attr_value.mac.rxonidle = rxonidle;
|
||||
|
||||
return ieee802154_set_req(fd, &req);
|
||||
}
|
67
wireless/ieee802154/libmac/sixlowpan_getrxonidle.c
Normal file
67
wireless/ieee802154/libmac/sixlowpan_getrxonidle.c
Normal file
@ -0,0 +1,67 @@
|
||||
/****************************************************************************
|
||||
* apps/wireless/ieee802154/libmac/sixlowpan_getrxonidle.c
|
||||
*
|
||||
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/wireless/ieee802154/ieee802154_mac.h>
|
||||
|
||||
#include "wireless/ieee802154.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int sixlowpan_getrxonidle(int sock, FAR const char *ifname, FAR bool *rxonidle)
|
||||
{
|
||||
struct ieee802154_get_req_s req;
|
||||
int ret;
|
||||
|
||||
req.pib_attr = IEEE802154_PIB_MAC_RX_ON_WHEN_IDLE;
|
||||
ret = sixlowpan_get_req(sock, ifname, &req);
|
||||
|
||||
*rxonidle = req.attr_value.mac.rxonidle;
|
||||
|
||||
return ret;
|
||||
}
|
65
wireless/ieee802154/libmac/sixlowpan_setrxonidle.c
Normal file
65
wireless/ieee802154/libmac/sixlowpan_setrxonidle.c
Normal file
@ -0,0 +1,65 @@
|
||||
/****************************************************************************
|
||||
* apps/wireless/ieee802154/libmac/sixlowpan_setrxonidle.c
|
||||
*
|
||||
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/wireless/ieee802154/ieee802154_mac.h>
|
||||
|
||||
#include "wireless/ieee802154.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int sixlowpan_setrxonidle(int sock, FAR const char *ifname, bool rxonidle)
|
||||
{
|
||||
struct ieee802154_set_req_s req;
|
||||
|
||||
req.pib_attr = IEEE802154_PIB_MAC_RX_ON_WHEN_IDLE;
|
||||
req.attr_value.mac.rxonidle = rxonidle;
|
||||
|
||||
return sixlowpan_set_req(sock, ifname, &req);
|
||||
}
|
Loading…
Reference in New Issue
Block a user