#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; // ä³Î °ª
|
};
|