SDC C-Project CF Review 프로그램
LYW
2021-07-27 281a73558e8d437fc778b390281560fa2e7a0e5e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#pragma once
 
#include "LightControlInfo.h"
 
class AFX_EXT_CLASS CLightControl
{
public:
    CLightControl(int nIndex)
    {
        m_nIndex        = nIndex;
        m_pLC2P            = NULL;
        m_nPortIndex    = 1;
        m_nBaudRate        = CBR_9600;
        m_bMultiCH        = FALSE;
        m_bConnected    = FALSE;
    }
 
    virtual ~CLightControl(void)
    {
 
    }
 
    // setter
    void    SetLC2P(ILightControl2Parent* pLC2P)            { m_pLC2P = pLC2P; }
    void    SetDefaultValue(int nValue)    { m_nDefaultValue = nValue; }
 
    // getter
    int        GetControlType() const        { return m_ControlInfo.GetControllerType(); }
    int        GetPortIndex() const        { return m_nPortIndex; }
    int        GetBaudRate() const            { return m_nBaudRate; }
    BOOL    GetConnected() const        { return m_bConnected; }
    int        GetDefaultValue() const        { return m_nDefaultValue; }
 
    virtual BOOL Connect(const CLightControlInfo& controlInfo) = 0;
    virtual LONG ConnectEx(const CLightControlInfo& controlInfo) = 0;        // Multi Channel
    virtual void Disconnect() = 0;
    virtual void DisconnectEx() = 0;                                        // Multi Channel
 
    virtual BOOL GetLightLevel(int &nValue, int nChannel = 0) const = 0;
    virtual BOOL GetLightLevel(double &dValue, int nChannel = 0) const = 0;
    virtual BOOL GetLightStatus(int &nValue, int nChannel = 0) const = 0;
 
    virtual BOOL SetLightLevel(int nValue, int nChannel = 0) = 0;
    virtual BOOL SetLightLevel(double dValue, int nChannel = 0) = 0;
    virtual BOOL SetLightStatus(int nValue, int nChannel = 0) = 0;
    virtual BOOL SetAllLightLevel(int nValue) = 0;
 
    ///virtual BOOL SetLightOn() = 0;
    ///virtual BOOL SetLightOff() = 0;
    virtual BOOL SetLightOn(int nChannel = 0) = 0;
    virtual BOOL SetLightOff(int nChannel = 0) = 0;
 
    virtual BOOL SetLightAllOn() = 0;
    virtual BOOL SetLightAllOff() = 0;
 
 
    virtual int GetStatus( int& nStatusCode, CString& strStatusMessage )
    {
        if (GetConnected()==FALSE) 
        {
            nStatusCode = LightStatus_NotConnected;
            strStatusMessage = _T("Not_Connected");
            return 0;
        }
 
        nStatusCode = LightStatus_Connected;
        strStatusMessage = _T("Connected");
 
        return 1;
    }
    
protected:
    ILightControl2Parent*    m_pLC2P;
    CLightControlInfo        m_ControlInfo;
 
    int                        m_nIndex;
    int                        m_nPortIndex;
    int                        m_nBaudRate;
    BOOL                    m_bConnected;
    BOOL                    m_bMultiCH;                // Multi Channel (True : 1, False : 0)
    int                        m_nDefaultValue;
};