// NuDAM.h: interface for the CNuDAM class.
//
//////////////////////////////////////////////////////////////////////
#pragma once

#include <string>

#include "Scanner.h"
#include "Utility.h"
#include "SerialPort.h"

#ifdef BUILD_COMMDLL
#define COMMDLL_DLLCLASS __declspec(dllexport)
#else
#define COMMDLL_DLLCLASS __declspec(dllimport)
#endif

class COMMDLL_DLLCLASS CNuDAM : public CScanner, CMyWait
{
public:
    bool AO_6024_Readback(int nModuleID, int nPort, double& dOutput);
    bool AO_6024(int nModuleID, int nPort, double dOutput);
    void ReceiveComm(const char* cpcBuffer, int nSize);
    std::string GetReceiveData();
    CNuDAM();
    virtual ~CNuDAM();

protected:
    CMutex m_mutexNuDAM;
    bool SendMsg(std::string csMsg, DWORD dwTimeout);
    virtual void DecodeReceiveData();

    HANDLE m_hAck;
    std::string m_strModuleID;   // ID for NuDAM module
    std::string m_str6024AOPort; // Analog output port (A, B, C, D) for 6024 module
    std::string m_strCommand;
    std::string m_strReplyAdd;
    std::string m_strReplyData;
};
