diff --git a/include/wireless/ieee802154.h b/include/wireless/ieee802154.h index daf66f3f1..028db3166 100644 --- a/include/wireless/ieee802154.h +++ b/include/wireless/ieee802154.h @@ -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 *****************************************************************/ diff --git a/wireless/ieee802154/libmac/Makefile b/wireless/ieee802154/libmac/Makefile index bc8fc6b54..3f449716c 100644 --- a/wireless/ieee802154/libmac/Makefile +++ b/wireless/ieee802154/libmac/Makefile @@ -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 diff --git a/wireless/ieee802154/libmac/ieee802154_getpromisc.c b/wireless/ieee802154/libmac/ieee802154_getpromisc.c index bf97d6ea2..3e144fa63 100644 --- a/wireless/ieee802154/libmac/ieee802154_getpromisc.c +++ b/wireless/ieee802154/libmac/ieee802154_getpromisc.c @@ -63,5 +63,4 @@ int ieee802154_getpromisc(int fd, FAR bool *promisc) *promisc = req.attr_value.mac.promisc_mode; return ret; - } diff --git a/wireless/ieee802154/libmac/ieee802154_getrxonidle.c b/wireless/ieee802154/libmac/ieee802154_getrxonidle.c new file mode 100644 index 000000000..f80c1f460 --- /dev/null +++ b/wireless/ieee802154/libmac/ieee802154_getrxonidle.c @@ -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 + * + * 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 + +#include +#include +#include +#include + +#include + +#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; +} diff --git a/wireless/ieee802154/libmac/ieee802154_setrxonidle.c b/wireless/ieee802154/libmac/ieee802154_setrxonidle.c new file mode 100644 index 000000000..de4d32d21 --- /dev/null +++ b/wireless/ieee802154/libmac/ieee802154_setrxonidle.c @@ -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 + * + * 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 + +#include +#include +#include +#include +#include + +#include + +#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); +} diff --git a/wireless/ieee802154/libmac/sixlowpan_getrxonidle.c b/wireless/ieee802154/libmac/sixlowpan_getrxonidle.c new file mode 100644 index 000000000..0c5a5ec21 --- /dev/null +++ b/wireless/ieee802154/libmac/sixlowpan_getrxonidle.c @@ -0,0 +1,67 @@ +/**************************************************************************** + * apps/wireless/ieee802154/libmac/sixlowpan_getrxonidle.c + * + * Copyright (C) 2017 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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 + +#include +#include +#include +#include +#include + +#include + +#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; +} diff --git a/wireless/ieee802154/libmac/sixlowpan_setrxonidle.c b/wireless/ieee802154/libmac/sixlowpan_setrxonidle.c new file mode 100644 index 000000000..cc0c0d889 --- /dev/null +++ b/wireless/ieee802154/libmac/sixlowpan_setrxonidle.c @@ -0,0 +1,65 @@ +/**************************************************************************** + * apps/wireless/ieee802154/libmac/sixlowpan_setrxonidle.c + * + * Copyright (C) 2017 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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 + +#include +#include +#include +#include +#include +#include + +#include + +#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); +}