#if !defined(__C232COMM_H__)
#define __C232COMM_H__

class C232Comm
{
private:     
    HANDLE m_hCom;
    int m_nPort;
    DCB m_dcb;
    COMMTIMEOUTS m_commTimeOuts;
    COMMCONFIG m_cc;
    COMMPROP m_cp;
public:
    C232Comm();
    virtual ~C232Comm();
    BOOL IsValid() const { return m_hCom != INVALID_HANDLE_VALUE; }
    BOOL Open(int nPort, DWORD dwBaudRate = CBR_9600, BYTE dwParity = NOPARITY, BYTE bByteSize = 8, BYTE dwStopBits = ONESTOPBIT);
    void Close();
    int rxCom(void* pData, int nLen);
    BOOL rxComLoop(void* pData, int nLen);
    int txCom(const void* pData, int nLen);
    BOOL txComLoop(const void* pData, int nLen);
    void locProcessCommError();
    int CommunicationConfig(HWND hWndParent);
};       

#endif // !defined(__C232COMM_H__)
