WISP ERT (Client)  1.0.0
The WISP Extended Runtime (WISP side)
transmission.h File Reference
#include <stdbool.h>
#include <wio.h>
#include "defs.h"

Go to the source code of this file.

Data Structures

struct  wtp_tx_read_info_t
 WTP READ OpSpec information type. More...
 
struct  wtp_tx_fragment_t
 WTP transmit data fragment type. More...
 
struct  wtp_tx_ctrl_t
 WTP sliding window-based transmit control type. More...
 
struct  wtp_rx_fragment_t
 WTP received data fragment type. More...
 
struct  wtp_rx_msg_info_t
 WTP received message information type. More...
 
struct  wtp_rx_ctrl_t
 WTP sliding window-based receive control type. More...
 

Functions

wtp_status_t wtp_tx_init (wtp_tx_ctrl_t *self, uint16_t window_size, uint16_t timeout, uint16_t read_size, uint16_t pkt_buf_size, uint16_t msg_buf_size, uint8_t n_fragments, uint8_t n_msgs)
 Initialize WTP transmit control type. More...
 
wtp_status_t wtp_tx_fini (wtp_tx_ctrl_t *self)
 Finalize WTP transmit control type. More...
 
wtp_status_t wtp_tx_begin_packet (wtp_tx_ctrl_t *self, wtp_pkt_t pkt_type)
 Begin construction of WTP packet. More...
 
wtp_status_t wtp_tx_end_packet (wtp_tx_ctrl_t *self)
 End construction of WTP packet. More...
 
wtp_status_t wtp_tx_add_msg (wtp_tx_ctrl_t *self, uint8_t *data, uint16_t size, wtp_tx_read_info_t **_read_info)
 Add a new message to transmit control. More...
 
wtp_status_t wtp_tx_make_fragment (wtp_tx_ctrl_t *self, uint8_t avail_size, wtp_tx_fragment_t **_fragment)
 Make a new sending data fragment. More...
 
wtp_status_t wtp_tx_handle_ack (wtp_tx_ctrl_t *self, uint16_t seq_num, uint8_t *_n_msgs)
 Handle WTP acknowledgement. More...
 
wtp_status_t wtp_rx_init (wtp_rx_ctrl_t *self, uint16_t window_size, uint16_t msg_data_size, uint16_t fragments_size, uint8_t n_msg_info)
 Initialize WTP receive control type. More...
 
wtp_status_t wtp_rx_fini (wtp_rx_ctrl_t *self)
 Finalize WTP receive control type. More...
 
wtp_status_t wtp_rx_handle_packet (wtp_rx_ctrl_t *self, uint16_t seq_num, uint8_t *data, uint16_t size, uint16_t new_msg_size, uint8_t *_n_msgs)
 Handle incoming data packet. More...
 

Function Documentation

◆ wtp_rx_fini()

wtp_status_t wtp_rx_fini ( wtp_rx_ctrl_t self)

Finalize WTP receive control type.

Parameters
selfWTP receive control instance.
Returns
WIO_OK.

◆ wtp_rx_handle_packet()

wtp_status_t wtp_rx_handle_packet ( wtp_rx_ctrl_t self,
uint16_t  seq_num,
uint8_t *  data,
uint16_t  size,
uint16_t  new_msg_size,
uint8_t *  _n_msgs 
)

Handle incoming data packet.

Parameters
selfWTP receive control instance.
seq_numPacket sequence number.
dataPayload data.
sizePayload size.
new_msg_sizeNew message size for WTP_PKT_BEGIN_MSG, 0 for WTP_PKT_CONT_MSG.
_n_msgsUsed for returning number of messages received.
Returns
Error code if failed, otherwise WIO_OK.

◆ wtp_rx_init()

wtp_status_t wtp_rx_init ( wtp_rx_ctrl_t self,
uint16_t  window_size,
uint16_t  msg_data_size,
uint16_t  fragments_size,
uint8_t  n_msg_info 
)

Initialize WTP receive control type.

Parameters
selfWTP receive control instance.
window_sizeSliding window size.
msg_data_sizeMessage data buffer size.
fragments_sizeData fragments buffer size.
n_msg_infoMaximum number of receiving messages information.
Returns
WIO_ERR_NO_MEMORY if memory allocation failed, otherwise WIO_OK.

◆ wtp_tx_add_msg()

wtp_status_t wtp_tx_add_msg ( wtp_tx_ctrl_t self,
uint8_t *  data,
uint16_t  size,
wtp_tx_read_info_t **  _read_info 
)

Add a new message to transmit control.

Parameters
selfWTP transmit control instance.
dataMessage data.
sizeMessage size.
_read_infoUsed for returning Read OpSpec information object.
Returns
Error code if failed, otherwise WIO_OK.

◆ wtp_tx_begin_packet()

wtp_status_t wtp_tx_begin_packet ( wtp_tx_ctrl_t self,
wtp_pkt_t  pkt_type 
)

Begin construction of WTP packet.

Parameters
selfWTP transmit control instance.
pkt_typePacket type.
Returns
WIO_ERR_OUT_OF_RANGE if exceeds packet buffer memory range, otherwise WIO_OK.

◆ wtp_tx_end_packet()

wtp_status_t wtp_tx_end_packet ( wtp_tx_ctrl_t self)

End construction of WTP packet.

Parameters
selfWTP transmit control instance.
Returns
WIO_OK.

◆ wtp_tx_fini()

wtp_status_t wtp_tx_fini ( wtp_tx_ctrl_t self)

Finalize WTP transmit control type.

Parameters
selfWTP transmit control instance.
Returns
WIO_OK.

◆ wtp_tx_handle_ack()

wtp_status_t wtp_tx_handle_ack ( wtp_tx_ctrl_t self,
uint16_t  seq_num,
uint8_t *  _n_msgs 
)

Handle WTP acknowledgement.

Parameters
selfWTP transmit control instance.
seq_numSequence number.
_n_msgsUsed for returning number of messages sent.
Returns
Error code if failed, otherwise WIO_OK.

◆ wtp_tx_init()

wtp_status_t wtp_tx_init ( wtp_tx_ctrl_t self,
uint16_t  window_size,
uint16_t  timeout,
uint16_t  read_size,
uint16_t  pkt_buf_size,
uint16_t  msg_buf_size,
uint8_t  n_fragments,
uint8_t  n_msgs 
)

Initialize WTP transmit control type.

Parameters
selfWTP transmit control instance.
window_sizeSliding window size.
timeoutPacket sending and requesting uplink timeout.
read_sizeInitialize READ OpSpec size.
pkt_buf_sizePacket buffer size.
msg_buf_sizeMessage buffer size.
n_fragmentsSend data fragments capacity.
n_msgsMaximum amount of messages waiting to send.
Returns
WIO_ERR_NO_MEMORY if memory allocation failed, otherwise WIO_OK.

◆ wtp_tx_make_fragment()

wtp_status_t wtp_tx_make_fragment ( wtp_tx_ctrl_t self,
uint8_t  avail_size,
wtp_tx_fragment_t **  _fragment 
)

Make a new sending data fragment.

Parameters
selfWTP transmit control instance.
avail_sizeAvailable size for message data in a READ OpSpec.
_fragmentUsed for returning newly made data fragment.
Returns
Error code if failed, otherwise WIO_OK.