/*
 * xlru_comm.h
 *
 */

#ifndef XLRU_COMM_H_
#define XLRU_COMM_H_

#ifdef __cplusplus
extern "C" {
#endif

enum xlru_comm_sts_t
{
	xlru_comm_ok,
	xlru_comm_err,	/*Generic error*/
	xlru_coom_err_device,
	xlru_comm_err_parity,
	xlru_comm_err_overrun,		  /*overrun on the communication media*/
	xlru_comm_err_buffer_overrun /*overrun on the internal buffer*/
};

typedef unsigned int xlru_comm_device_id_t;

extern enum xlru_comm_sts_t xlru_comm_initialize(void);

extern void xlru_comm_udp_monitor_enable(bool ena);


extern enum xlru_comm_sts_t xlru_comm_extract_pending_data(xlru_comm_device_id_t id, char* destination_buffer, unsigned int* len, unsigned int max_len);

extern enum xlru_comm_sts_t  xlru_comm_raw_transmit(xlru_comm_device_id_t id, const char* data, unsigned int len);

extern const char* xlru_comm_error_string(xlru_comm_sts_t error_code);

//Debug support
extern enum xlru_comm_sts_t xlru_comm_dbg_get_data(char* destination_buffer, unsigned int* len, unsigned int max_len);

extern void xlru_comm_dbg_add_data(unsigned int source, const char* data, unsigned int len);

extern void xlru_comm_dbg_flush();

#ifdef __cplusplus
}
#endif



#endif /* XLRU_COMM_H_ */
