netlib: Get and/or set PAN ID of IEEE 802.15.4 radio.
This commit is contained in:
parent
874553ee59
commit
450f962602
@ -7,6 +7,8 @@ config NETUTILS_NETLIB
|
|||||||
bool "Network support library"
|
bool "Network support library"
|
||||||
default n
|
default n
|
||||||
depends on NET
|
depends on NET
|
||||||
|
select IEEE802154_LIBRADIO if DRIVERS_IEEE802154
|
||||||
|
select IEEE802154_LIBMAC if WIRELESS_IEEE802154
|
||||||
---help---
|
---help---
|
||||||
Enable support for the network support library.
|
Enable support for the network support library.
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include "wireless/ieee802154.h"
|
||||||
#include "netutils/netlib.h"
|
#include "netutils/netlib.h"
|
||||||
|
|
||||||
#if defined(CONFIG_NET_6LOWPAN) && CONFIG_NSOCKET_DESCRIPTORS > 0
|
#if defined(CONFIG_NET_6LOWPAN) && CONFIG_NSOCKET_DESCRIPTORS > 0
|
||||||
@ -80,13 +81,10 @@ int netlib_getpanid(FAR const char *ifname, FAR uint16_t *panid)
|
|||||||
int sockfd = socket(PF_INET6, NETLIB_SOCK_IOCTL, 0);
|
int sockfd = socket(PF_INET6, NETLIB_SOCK_IOCTL, 0);
|
||||||
if (sockfd >= 0)
|
if (sockfd >= 0)
|
||||||
{
|
{
|
||||||
/* Put the driver name into the request */
|
/* Use the helper provided in libradio */
|
||||||
#warning Missing logic
|
|
||||||
/* Perform the ioctl to get the current PAN ID */
|
|
||||||
|
|
||||||
|
ret = ieee802154_getpanid(sockfd, ifname, panid);
|
||||||
close(sockfd);
|
close(sockfd);
|
||||||
|
|
||||||
/* Reuturn the current PAN ID */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,12 +80,9 @@ int netlib_setpanid(FAR const char *ifname, uint16_t panid)
|
|||||||
int sockfd = socket(PF_INET6, NETLIB_SOCK_IOCTL, 0);
|
int sockfd = socket(PF_INET6, NETLIB_SOCK_IOCTL, 0);
|
||||||
if (sockfd >= 0)
|
if (sockfd >= 0)
|
||||||
{
|
{
|
||||||
/* Put the driver name into the request */
|
/* Use the helper provided in libradio */
|
||||||
# warning Missing Logic
|
|
||||||
/* Put the new PAN ID into the request */
|
|
||||||
|
|
||||||
/* Perform the ioctl to set the new PAN ID */
|
|
||||||
|
|
||||||
|
ret = ieee802154_setpanid(sockfd, ifname, panid);
|
||||||
close(sockfd);
|
close(sockfd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user