SDC C-Project CF Review 프로그램
LYW
2021-06-09 f143e5ece742a275d1e360c55e829d21e706b26d
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#pragma once
 
#include "CHCommonClasses/MacroFile.h"
 
enum    LightStatus    { LightStatus_NotConnected=0, LightStatus_Connected };
 
interface ILightControl2Parent
{
    virtual void ILC2P_DisplayMessage(int nIndex, const TCHAR* lpstrFormat, ...) = 0;
    virtual void ILC2P_ChangeLightLevel(int nIndex, int nLevel) = 0;
};
 
class CLightControlInfo
{
public:
    CLightControlInfo(int nIndex=0) : m_nIndex(nIndex)        { Reset(); }
    ~CLightControlInfo(void)                                { Reset(); }
    void Reset()
    {
        m_strName            = _T("");
        m_nControllerType    = 0;
        m_strConnectionPort    = _T("");
        m_nBaudRate            = CBR_9600;
        m_nDefaultValue        = 0;
        m_nCurrentValue        = 0;
        m_nMaxValue            = 255;
        m_nMinValue            = 0;
 
        m_bMaster            = FALSE;
        m_nChannel            = 0;
    }
 
    BOOL LoadInfo(CMacroFile* pFile, const CString& strItemName)
    {
        if (pFile==NULL) return FALSE;
 
        CString strValue = _T("");
 
        strValue = strItemName + _T("_INDEX");
        pFile->GetItem(strValue, m_nIndex, 0);
 
        strValue = strItemName + _T("_NAME");
        pFile->GetItem(strValue, m_strName, 0);
 
        strValue = strItemName + _T("_CONTROL_TYPE");
        pFile->GetItem(strValue, m_nControllerType, 0);
 
        strValue = strItemName + _T("_CONNECT_PORT");
        pFile->GetItem(strValue, m_strConnectionPort, _T(""));
 
        strValue = strItemName + _T("_BAUD_RATE");
        pFile->GetItem(strValue, m_nBaudRate, CBR_9600);
 
        strValue = strItemName + _T("_DEFAULT_VALUE");
        pFile->GetItem(strValue, m_nDefaultValue, 0);
 
        strValue = strItemName + _T("_CURRENT_VALUE");
        pFile->GetItem(strValue, m_nCurrentValue, 0);
 
        strValue = strItemName + _T("_MAX_VALUE");
        pFile->GetItem(strValue, m_nMaxValue, 1);
 
        strValue = strItemName + _T("_MIN_VALUE");
        pFile->GetItem(strValue, m_nMinValue, 0);
 
        strValue = strItemName + _T("_MASTER");
        pFile->GetItem(strValue, m_bMaster, 0);
 
        strValue = strItemName + _T("_CHANNEL");
        pFile->GetItem(strValue, m_nChannel, 0);
 
        return TRUE;
    }
 
    BOOL SaveInfo(CMacroFile* pFile, const CString& strItemName)
    {
        if (pFile==NULL) return FALSE;
 
        CString strValue = _T("");
 
        strValue = strItemName + _T("_INDEX");
        pFile->SetItem(strValue, m_nIndex);
 
        strValue = strItemName + _T("_NAME");
        pFile->SetItem(strValue, m_strName);
 
        strValue = strItemName + _T("_CONTROL_TYPE");
        pFile->SetItem(strValue, m_nControllerType);
 
        strValue = strItemName + _T("_CONNECT_PORT");
        pFile->SetItem(strValue, m_strConnectionPort);
 
        strValue = strItemName + _T("_BAUD_RATE");
        pFile->SetItem(strValue, m_nBaudRate);
 
        strValue = strItemName + _T("_DEFAULT_VALUE");
        pFile->SetItem(strValue, m_nDefaultValue);
 
        strValue = strItemName + _T("_CURRENT_VALUE");
        pFile->SetItem(strValue, m_nCurrentValue);
 
        strValue = strItemName + _T("_MAX_VALUE");
        pFile->SetItem(strValue, m_nMaxValue);
 
        strValue = strItemName + _T("_MIN_VALUE");
        pFile->SetItem(strValue, m_nMinValue);
 
        strValue = strItemName + _T("_MASTER");
        pFile->SetItem(strValue, m_bMaster);
 
        strValue = strItemName + _T("_CHANNEL");
        pFile->SetItem(strValue, m_nChannel);
 
        return TRUE;
    }
 
    int            GetIndex() const                            { return m_nIndex; }
    CString        GetName() const                                { return m_strName; }
    int            GetControllerType() const                    { return m_nControllerType; }
    CString        GetConnectionPort() const                    { return m_strConnectionPort; }
    int            GetBaudRate() const                            { return m_nBaudRate; }
    int            GetDefaultValue() const                        { return m_nDefaultValue; }
    int            GetCurrentValue() const                        { return m_nCurrentValue; }
    int            GetMaxValue() const                            { return m_nMaxValue; }
    int            GetMinValue() const                            { return m_nMinValue; }
    int            GetChannel() const                            { return m_nChannel; }
    int            GetMaster() const                            { return m_bMaster; }
 
    void        SetIndex(int nIndex)                        { m_nIndex = nIndex; }
    void        SetName(const CString& strName)                { m_strName = strName; }
    void        SetControllerType(int nType)                { m_nControllerType = nType; }
    void        SetConnectionPort(const CString& strPort)     { m_strConnectionPort = strPort; }
    void        SetBaudRate(int nValue)                        { m_nBaudRate = nValue; }
    void        SetDefaultValue(int nValue)                    { m_nDefaultValue = nValue; }
    void        SetCurrentValue(int nValue)                 { m_nCurrentValue = nValue; }
    void        SetMaxValue(int nValue)                        { m_nMaxValue = nValue; }
    void        SetMinValue(int nValue)                        { m_nMinValue = nValue; }
    void        SetChannel(int nValue)                        { m_nChannel = nValue; }
    void        SetMaster(BOOL bValue)                        { m_bMaster = bValue; }
 
protected:
    int            m_nIndex;                    // À妽º
    CString        m_strName;                    // À̸§
    int            m_nControllerType;            // ÄÁÆ®·Ñ·¯ Å¸ÀÔ
    CString        m_strConnectionPort;        // ¿¬°á Æ÷Æ®
    int            m_nBaudRate;                // ¿¬°á ¼Óµµ
 
    int            m_nDefaultValue;            // ±âº» °ª
    int            m_nCurrentValue;            // ÇöÀç °ª
    int            m_nMaxValue;                // ÃÖ´ë °ª
    int            m_nMinValue;                // ÃÖ¼Ò °ª
 
    BOOL        m_bMaster;                    // ÄÁÆ®·Ñ·¯ Á¦¾î(Open/Close)±Ç : 0
    int            m_nChannel;                    // Ã¤³Î °ª
};