#ifndef __QT_INTERFACE_H__
#define __QT_INTERFACE_H__
#include "msystem.h"
#include "ccu_config.h"
#include "modbusTCP_contex.h"

typedef struct modbusTCP_QT
{
    void *ccu;
    qttcu_config_t *config;
    char connect_ip_string[64];

    uint16_t transID;
    int quit;

    int fd;
    int fp[2];

    modbusTCP_frame_t frame;
    mthread_t threadRx;
    mthread_t threadTx;
    pthread_mutex_t mutex0;
    pthread_mutex_t mutex1;

    uint8_t rxbuff[2048];
    int rxbyte;
    uint8_t txbuff[2048];
    int txbyte;

    int debug;

}modbusTCP_QT_t;

extern modbusTCP_QT_t qttcu;

int modbusTCP_QT_init(modbusTCP_QT_t* dev);
void* modbusTCP_QT_loop(void* args);
void modbusTCP_QT_exit(modbusTCP_QT_t* dev);

int modbusTCP_QT_cmd_0x90(modbusTCP_QT_t* dev, uint32_t connectorId, uint32_t GUN_Error, uint32_t GUN_State);
int modbusTCP_QT_cmd_0x91(modbusTCP_QT_t* dev, uint32_t connectorId);
#endif //__QT_INTERFACE_H__
