#ifndef CLASERDRIVER_PI_H
#define CLASERDRIVER_PI_H

#include "claserdriver_base.h"
class CMSerialPort;

class LASER_DRIVER_IMPL_EXPORT CLaserDriver_PI : public CLaserDriver_Base
{
public:
    enum msg_id
    {
        LASERDRIVER_PI_MSG_ID=MAX_LASERDRIVER_MSG_ID,
        MAX_LASERDRIVER_PI_MSG_ID,
		GETSTATE,
    };
    CLaserDriver_PI(const QString& name,int32_t id);
    ~CLaserDriver_PI();
public:
    int32_t init_driver();
    int32_t exit_driver();
	void do_msg(int iID,QVariantList& vlInput,V_MsgOutput* pvlOutput);
    void SendCommand(const char* pCommand, char *pResponse);
    void MakeSendCheckComm(byte byCommand, byte *pSendData, int32_t iDataSSize, int32_t iDataRSize,
                     bool_t bWrite, byte *pResponse, byte byAddress=0);

    void CheckResponse(int32_t iDataRSize, bool_t bWrite, byte *pResponse);
    void HexToAsic(char *pHex, int iSizeHex, char* pAsic);
    void HexToAsic(char Hex ,char&  Asic);

    void AsicToHex(char* pAsic,int iSizeASC,char* pHex);
    void AsicToHex(char  Asic ,byte& Hex);

    int GetBroadFault(int32_t laserid,BYTE& byFault);
public:
    virtual int SetFreq(int32_t laserid,float64_t dFreq);
    virtual int GetFreq(int32_t laserid);
    virtual int OpenLaserGate(int32_t laserid, bool bOpen);
    virtual int SetPowerRate(int32_t laserid, float64_t dPower);
    virtual int GetPowerRate(int32_t laserid);
    virtual int SetGateSource(int32_t laserid, bool_t bInt);
    virtual int SetPRFSource(int32_t laserid, bool_t bExt);
	int SetRECSource(int32_t laserid, bool_t bInt);
public:
    virtual int SetFPKTime(int32_t laserid, dword_t dwTime,bool bEnable);
    virtual int GetFPKTime(int32_t laserid);
    virtual int SetLDD(int32_t laserid, bool_t bOn);
    virtual int SetShutter(int32_t laserid,bool_t bOn);

    virtual int SetCurrent_Ref(int32_t laserid, double dCurrent);
    virtual int SetCurrent_Max(int32_t laserid, double dCurrent);

    virtual int GetCurrent_Cur(int32_t laserid);
    virtual int GetCurrent_Ref(int32_t laserid);
    virtual int GetCurrent_Max(int32_t laserid);

    virtual int GetShutterStatus(int32_t laserid);
    virtual int GetUVPower(int32_t laserid);
    virtual int GetLaserTime(int32_t laserid);

    virtual int GetSerial(int32_t laserid);
public:
	bool m_bShutterOn;
};

#endif // CLASERDRIVER_PI_H
