
#ifndef ETHERCAT_SLAVE_VOE_H
#define ETHERCAT_SLAVE_VOE_H

#include "../ethercat_types.h"
#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifndef DYNAMIC_LOAD

BOOL     dx_voe_send(uint16_t master_index, uint16_t slave, uint32_t vendor_id,
                  uint16_t vendor_type, const uint8_t* data, int data_size, int timeout);

BOOL     dx_voe_receive(uint16_t master_index, uint16_t slave, uint32_t* vendor_id,
                     uint16_t* vendor_type, uint8_t** data, int* data_size, int timeout);
BOOL     dx_voe_send_raw(uint16_t master_index, uint16_t slave,
                     const uint8_t* frame_data, int frame_size, int timeout);

BOOL     dx_voe_receive_raw(uint16_t master_index, uint16_t slave,
                        uint8_t** frame_data, int* frame_size, int timeout);
BOOL     dx_voe_is_supported(uint16_t master_index, uint16_t slave);

#endif

typedef void (*voe_notification_cb_t)(uint16_t slave,
                                             uint32_t vendor_id,
                                             uint16_t vendor_type,
                                             const uint8_t* data,
                                             uint32_t data_size,
                                             void* user_data);

int  voe_start_notification_listener(uint16_t master_index);

int  voe_register_notification(uint16_t master_index, uint16_t slave,
                                      uint32_t vendor_id, uint16_t vendor_type,
                                      voe_notification_cb_t cb, void* user_data);

int  voe_unregister_notification(int subscription_index);

int  voe_stop_notification_listener(void);

int  voe_is_notification_listening(void);

#ifdef __cplusplus
}
#endif

#endif
