WISP ERT (Client)  1.0.0
The WISP Extended Runtime (WISP side)
endpoint.c File Reference
#include <stdlib.h>
#include "endpoint.h"

Functions

static wtp_status_t wtp_handle_open (wtp_t *self, wio_buf_t *buf)
 Handle WTP open packet. More...
 
static wtp_status_t wtp_handle_ack (wtp_t *self, wio_buf_t *buf)
 Handle WTP acknowledgement packet. More...
 
static wtp_status_t wtp_handle_msg_packet (wtp_t *self, wio_buf_t *buf, bool begin_msg)
 Handle WTP message packet. More...
 
static wtp_status_t wtp_handle_begin_msg (wtp_t *self, wio_buf_t *buf)
 Handle WTP begin message packet. More...
 
static wtp_status_t wtp_handle_cont_msg (wtp_t *self, wio_buf_t *buf)
 Handle WTP continue message packet. More...
 
static wtp_status_t wtp_handle_set_param (wtp_t *self, wio_buf_t *buf)
 Handle WTP set parameter message packet. More...
 
wtp_status_t wtp_init (wtp_t *self, uint8_t *epc_mem, uint16_t epc_buf_size, uint8_t *read_mem, uint8_t *write_mem, uint16_t window_size, uint16_t timeout, uint16_t tx_buf_size, uint16_t rx_buf_size, uint8_t n_send, uint8_t n_recv)
 Initialize WTP endpoint. More...
 
wtp_status_t wtp_fini (wtp_t *self)
 Finalize WTP endpoint. More...
 
wtp_status_t wtp_connect (wtp_t *self)
 Connect to WTP server. More...
 
wtp_status_t wtp_close (wtp_t *self)
 Disconnect from WTP server. More...
 
wtp_status_t wtp_send (wtp_t *self, uint8_t *data, uint16_t size, void *cb_data, wio_callback_t cb)
 Send message to WTP server. More...
 
wtp_status_t wtp_recv (wtp_t *self, void *cb_data, wio_callback_t cb)
 Receive message from WTP server. More...
 
wtp_status_t wtp_on_event (wtp_t *self, wtp_event_t event, void *cb_data, wio_callback_t cb)
 Set WTP event handler. More...
 
wtp_status_t wtp_trigger_event (wtp_t *self, wtp_event_t event, wtp_status_t status, void *result)
 Trigger WTP event. More...
 
wtp_status_t wtp_load_read_mem (wtp_t *self)
 Load RFID READ memory for WTP communication. More...
 
wtp_status_t wtp_handle_blockwrite (wtp_t *self)
 Handle RFID BLOCKWRITE operation. More...
 
wtp_status_t wtp_verify_checksum (wtp_t *self, wio_buf_t *write_buf)
 Verify the checksum of received WTP packet. More...
 
uint8_t wtp_xor_checksum (uint8_t *mem, uint16_t begin, uint16_t end)
 WTP Xor checksum function. More...
 

Variables

wtp_pkt_handler_t wtp_pkt_handlers []
 WTP packet handlers. More...
 

Function Documentation

◆ wtp_close()

wtp_status_t wtp_close ( wtp_t self)

Disconnect from WTP server.

◆ wtp_connect()

wtp_status_t wtp_connect ( wtp_t self)

Connect to WTP server.

◆ wtp_fini()

wtp_status_t wtp_fini ( wtp_t self)

Finalize WTP endpoint.

◆ wtp_handle_ack()

static wtp_status_t wtp_handle_ack ( wtp_t self,
wio_buf_t buf 
)
static

Handle WTP acknowledgement packet.

Parameters
selfWTP endpoint instance.
bufReceived packets buffer.
Returns
Error code if failed, otherwise WIO_OK.

◆ wtp_handle_begin_msg()

static wtp_status_t wtp_handle_begin_msg ( wtp_t self,
wio_buf_t buf 
)
static

Handle WTP begin message packet.

Parameters
selfWTP endpoint instance.
bufReceived packets buffer.
Returns
Error code if failed, otherwise WIO_OK.

◆ wtp_handle_blockwrite()

wtp_status_t wtp_handle_blockwrite ( wtp_t self)

Handle RFID BLOCKWRITE operation.

◆ wtp_handle_cont_msg()

static wtp_status_t wtp_handle_cont_msg ( wtp_t self,
wio_buf_t buf 
)
static

Handle WTP continue message packet.

Parameters
selfWTP endpoint instance.
bufReceived packets buffer.
Returns
Error code if failed, otherwise WIO_OK.

◆ wtp_handle_msg_packet()

static wtp_status_t wtp_handle_msg_packet ( wtp_t self,
wio_buf_t buf,
bool  begin_msg 
)
static

Handle WTP message packet.

Parameters
selfWTP endpoint instance.
bufReceived packets buffer.
begin_msgTrue for WTP_PKT_BEGIN_MSG and false for WTP_PKT_CONT_MSG.
Returns
Error code if failed, otherwise WIO_OK.

◆ wtp_handle_open()

static wtp_status_t wtp_handle_open ( wtp_t self,
wio_buf_t buf 
)
static

Handle WTP open packet.

Parameters
selfWTP endpoint instance.
bufReceived packets buffer.
Returns
Error code if failed, otherwise WIO_OK.

◆ wtp_handle_set_param()

static wtp_status_t wtp_handle_set_param ( wtp_t self,
wio_buf_t buf 
)
static

Handle WTP set parameter message packet.

Parameters
selfWTP endpoint instance.
bufReceived packets buffer.

◆ wtp_init()

wtp_status_t wtp_init ( wtp_t self,
uint8_t *  epc_mem,
uint16_t  epc_buf_size,
uint8_t *  read_mem,
uint8_t *  write_mem,
uint16_t  window_size,
uint16_t  timeout,
uint16_t  tx_buf_size,
uint16_t  rx_buf_size,
uint8_t  n_send,
uint8_t  n_recv 
)

Initialize WTP endpoint.

◆ wtp_load_read_mem()

wtp_status_t wtp_load_read_mem ( wtp_t self)

Load RFID READ memory for WTP communication.

◆ wtp_on_event()

wtp_status_t wtp_on_event ( wtp_t self,
wtp_event_t  event,
void *  cb_data,
wio_callback_t  cb 
)

Set WTP event handler.

◆ wtp_recv()

wtp_status_t wtp_recv ( wtp_t self,
void *  cb_data,
wio_callback_t  cb 
)

Receive message from WTP server.

◆ wtp_send()

wtp_status_t wtp_send ( wtp_t self,
uint8_t *  data,
uint16_t  size,
void *  cb_data,
wio_callback_t  cb 
)

Send message to WTP server.

◆ wtp_trigger_event()

wtp_status_t wtp_trigger_event ( wtp_t self,
wtp_event_t  event,
wtp_status_t  status,
void *  result 
)

Trigger WTP event.

◆ wtp_verify_checksum()

wtp_status_t wtp_verify_checksum ( wtp_t self,
wio_buf_t write_buf 
)

Verify the checksum of received WTP packet.

◆ wtp_xor_checksum()

uint8_t wtp_xor_checksum ( uint8_t *  mem,
uint16_t  begin,
uint16_t  end 
)

WTP Xor checksum function.

Variable Documentation

◆ wtp_pkt_handlers

wtp_pkt_handler_t wtp_pkt_handlers
Initial value:
= {
NULL,
NULL,
NULL,
}
static wtp_status_t wtp_handle_set_param(wtp_t *self, wio_buf_t *buf)
Handle WTP set parameter message packet.
Definition: endpoint.c:217
static wtp_status_t wtp_handle_open(wtp_t *self, wio_buf_t *buf)
Handle WTP open packet.
Definition: endpoint.c:14
static wtp_status_t wtp_handle_cont_msg(wtp_t *self, wio_buf_t *buf)
Handle WTP continue message packet.
Definition: endpoint.c:204
static wtp_status_t wtp_handle_ack(wtp_t *self, wio_buf_t *buf)
Handle WTP acknowledgement packet.
Definition: endpoint.c:45
static wtp_status_t wtp_handle_begin_msg(wtp_t *self, wio_buf_t *buf)
Handle WTP begin message packet.
Definition: endpoint.c:190

WTP packet handlers.