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
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
156
157
158
159
160
161
162
163
164
165
166
#include "StdAfx.h"
#include "CHLightControls/LightControl_MVSol_TCP.h"
#include "MVXLC/nic.h"
#include "MVXLC/tcp.h"
 
CLightControl_MVSol_TCP::CLightControl_MVSol_TCP(int nIndex) : CLightControl(nIndex)
{
    m_bConnected    = FALSE;
 
    m_pConnectorTcp    = NULL;
    m_pConnectorUdp    = NULL;
}
 
 
CLightControl_MVSol_TCP::~CLightControl_MVSol_TCP(void)
{
    if (m_pConnectorTcp)
    {
        delete m_pConnectorTcp;
        m_pConnectorTcp = NULL;
    }
 
    if (m_pConnectorUdp)
    {
        delete m_pConnectorUdp;
        m_pConnectorUdp = NULL;
    }
}
 
//BOOL CLightControl_MVSol_TCP::Connect( const CLightControlInfo& controlInfo )
//{
//    m_ControlInfo = controlInfo;
//
//    m_pConnectorTcp = new MvxlcTcp(AfxGetMainWnd()->GetSafeHwnd());
//    if (m_pConnectorTcp==NULL)
//    {
//        delete m_pConnectorTcp;
//        m_pConnectorTcp = NULL;
//        return FALSE;
//    }
//    
//    if ((m_bConnected = m_pConnectorTcp->Connect(m_ControlInfo.GetConnectionPort(), 34700))==FALSE)
//        return FALSE;
//
//    return TRUE;
//}
 
void CLightControl_MVSol_TCP::Disconnect()
{
}
 
BOOL CLightControl_MVSol_TCP::GetLightLevel( int &nValue, int nChannel /*= 0*/ ) const
{
    if (m_pConnectorTcp==NULL) return FALSE;
 
    INT nRetValue = 0;
    if (m_pConnectorTcp->GetBrightness(nChannel, &nRetValue) != kAck) return FALSE;
 
    nValue = nRetValue;
 
    return TRUE;
}
 
LONG CLightControl_MVSol_TCP::ConnectEx( const CLightControlInfo& controlInfo )
{
    return TRUE;
}
 
void CLightControl_MVSol_TCP::DisconnectEx()
{
 
}
 
BOOL CLightControl_MVSol_TCP::GetLightLevel( double &dValue, int nChannel /*= 0*/ ) const
{
    if (m_pConnectorTcp==NULL) return FALSE;
 
    INT nRetValue = 0;
    if (m_pConnectorTcp->GetBrightness(nChannel, &nRetValue) != kAck) return FALSE;
 
    dValue = double(nRetValue);
 
    return TRUE;
}
 
BOOL CLightControl_MVSol_TCP::GetLightStatus( int &nValue, int nChannel /*= 0*/ ) const
{
    return TRUE;
}
 
BOOL CLightControl_MVSol_TCP::SetLightLevel( int nValue, int nChannel /*= 0*/ )
{
    if (m_pConnectorTcp==NULL) return FALSE;
 
    if (m_pConnectorTcp->SetBrightness(nChannel, nValue) != kAck) return FALSE;
 
    return TRUE;
}
 
BOOL CLightControl_MVSol_TCP::SetLightLevel( double dValue, int nChannel /*= 0*/ )
{
    if (m_pConnectorTcp==NULL) return FALSE;
 
    if (m_pConnectorTcp->SetBrightness(nChannel, int(dValue)) != kAck) return FALSE;
 
    return TRUE;
}
 
BOOL CLightControl_MVSol_TCP::SetLightStatus( int nValue, int nChannel /*= 0*/ )
{
    return TRUE;
}
 
BOOL CLightControl_MVSol_TCP::SetLightOn()
{
    return TRUE;
}
 
BOOL CLightControl_MVSol_TCP::SetLightOff()
{
    return TRUE;
}
 
 
BOOL CLightControl_MVSol_TCP::SetLightOn(int Channel)
{
    if (!m_bConnected) return FALSE;
 
    return TRUE;
}
 
BOOL CLightControl_MVSol_TCP::SetLightOff(int Channel)
{
    if (!m_bConnected) return FALSE;
 
    return TRUE;
}
 
BOOL CLightControl_MVSol_TCP::SetLightAllOn()
{
    if (!m_bConnected) return FALSE;
 
    return TRUE;
}
 
BOOL CLightControl_MVSol_TCP::SetLightAllOff()
{
    if (!m_bConnected) return FALSE;
 
    return TRUE;
}
 
int CLightControl_MVSol_TCP::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;
}