#ifndef CPOWERMETERDRIVER_FP_H
#define CPOWERMETERDRIVER_FP_H

#include "cpowermeterdriver.h"
#include "export_power_meter_driver.h"
typedef byte FT_STATUS;
typedef HANDLE FT_HANDLE;
class POWER_METER_DRIVER_EXPORT CPowerMeterDriver_FP : public CPowerMeterDriver
{
public:
    enum msg_id
    {
         POWERMETERDRIVER_FP_MSG_ID=MAX_POWERMETERDRIVER_MSG_ID,
         MAX_POWERMETERDRIVER_FP_MSG_ID,

    };
public:
    virtual int32_t init_driver();
    virtual int32_t exit_driver();
    CPowerMeterDriver_FP(const QString& name,int32_t id);
    virtual int32_t freshresult(int32_t chid);
    virtual int32_t SetZero(int32_t chid);
public:
    typedef FT_STATUS (__stdcall * FP_FT_Open)(int iDevice, FT_HANDLE *ftHandle);
    typedef FT_STATUS (__stdcall * FP_FT_Close)( FT_HANDLE ftHandle);
    typedef FT_STATUS (__stdcall * FP_FT_Read)( FT_HANDLE ftHandle,LPVOID lpBuffer, DWORD dwBytesToRead, LPDWORD lpdwBytesReturned);
    typedef FT_STATUS (__stdcall * FP_FT_Write)( FT_HANDLE ftHandle,LPVOID lpBuffer, DWORD dwBytesToWrite, LPDWORD lpdwBytesWritten);
    typedef FT_STATUS (__stdcall * FP_FT_Purge)( FT_HANDLE ftHandle,DWORD dwFlags);
    typedef FT_STATUS (__stdcall * FP_FT_GetQueueStatus)( FT_HANDLE ftHandle,LPDWORD lpdwAmountInRxQueue);
    typedef FT_STATUS (__stdcall * FP_FT_GetStatus)(FT_HANDLE ftHandle,
        LPDWORD	lpdwAmountInRxQueue ,
        LPDWORD lpdwAmountInTxQueue,
        LPDWORD	lpdwEventstatus);


private:
    FT_HANDLE m_ftHandle;
    HINSTANCE lib;
    FP_FT_Open 	FT_Open ;
    FP_FT_Close FT_Close ;
    FP_FT_Read 	FT_Read ;
    FP_FT_Write 	FT_Write;
    FP_FT_Purge	FT_Purge;
    FP_FT_GetQueueStatus FT_GetQueueStatus;
    FP_FT_GetStatus	FT_GetStatus;
    QString GetLastError(FT_STATUS status);

};

#endif // CPOWERMETERDRIVER_FP_H
