5858
5959#include "net/netdev.h"
6060#include "net/netdev/ieee802154.h"
61+ #include "net/ieee802154/radio.h"
6162#include "net/zep.h"
6263
6364#ifdef __cplusplus
6465extern "C" {
6566#endif
6667
68+ /**
69+ * @brief ZEP device initialization parameters
70+ */
71+ typedef struct {
72+ char * local_addr ; /**< local address string */
73+ char * local_port ; /**< local address string */
74+ char * remote_addr ; /**< remote address string */
75+ char * remote_port ; /**< local address string */
76+ } socket_zep_params_t ;
77+
6778/**
6879 * @brief ZEP device state
6980 */
7081typedef struct {
71- netdev_ieee802154_t netdev ; /**< netdev internal member */
82+ /**
83+ * @brief command line parameters
84+ */
85+ const socket_zep_params_t * params ;
7286 int sock_fd ; /**< socket fd */
73- netdev_event_t last_event ; /**< event triggered */
7487 uint32_t seq ; /**< ZEP sequence number */
7588 /**
7689 * @brief Receive buffer
7790 */
7891 uint8_t rcv_buf [sizeof (zep_v2_data_hdr_t ) + IEEE802154_FRAME_LEN_MAX ];
7992 /**
80- * @brief Buffer for send header
93+ * @brief Send buffer
94+ */
95+ uint8_t snd_buf [sizeof (zep_v2_data_hdr_t ) + IEEE802154_FRAME_LEN_MAX ];
96+ uint8_t snd_len ; /**< bytes to send */
97+ uint16_t pan_id ; /**< PAN ID of the ZEP network */
98+ uint16_t chan ; /**< virtual radio channel */
99+ /**
100+ * @brief Short address of the virtual radio
101+ */
102+ uint8_t addr_short [IEEE802154_SHORT_ADDRESS_LEN ];
103+ /**
104+ * @brief Long address of the virtual radio
81105 */
82- uint8_t snd_hdr_buf [sizeof (zep_v2_data_hdr_t )];
83- uint16_t chksum_buf ; /**< buffer for send checksum calculation */
106+ uint8_t addr_long [IEEE802154_LONG_ADDRESS_LEN ];
107+ ieee802154_filter_mode_t filter_mode ; /**< frame filter mode */
108+ ieee802154_trx_state_t state ; /**< radio state */
109+ bool send_hello ; /**< send HELLO packet on connect */
84110} socket_zep_t ;
85111
86- /**
87- * @brief ZEP device initialization parameters
88- */
89- typedef struct {
90- char * local_addr ; /**< local address string */
91- char * local_port ; /**< local address string */
92- char * remote_addr ; /**< remote address string */
93- char * remote_port ; /**< local address string */
94- } socket_zep_params_t ;
95-
96112/**
97113 * @brief Setup socket_zep_t structure
98114 *
99115 * @param[in] dev the preallocated socket_zep_t device handle to setup
100116 * @param[in] params initialization parameters
101- * @param[in] index index of @p params in a global parameter struct array.
102- * If initialized manually, pass a unique identifier instead.
103117 */
104- void socket_zep_setup (socket_zep_t * dev , const socket_zep_params_t * params , uint8_t index );
118+ void socket_zep_setup (socket_zep_t * dev , const socket_zep_params_t * params );
105119
106120/**
107121 * @brief Cleanup socket resources
@@ -110,6 +124,14 @@ void socket_zep_setup(socket_zep_t *dev, const socket_zep_params_t *params, uint
110124 */
111125void socket_zep_cleanup (socket_zep_t * dev );
112126
127+ /**
128+ * @brief Setup socket ZEP in order to be used with the IEEE 802.15.4 Radio HAL
129+ *
130+ * @param[in] dev pointer to the socket ZEP instance
131+ * @param[in] hal pointer to the HAL descriptor associated to the device
132+ */
133+ void socket_zep_hal_setup (socket_zep_t * dev , ieee802154_dev_t * hal );
134+
113135#ifdef __cplusplus
114136}
115137#endif
0 commit comments