//---------------------------------------------------------------------------
#pragma hdrstop

#include "VmsCommInfoF.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

TVmsCtlr *FindVms(String ACtrlId)
{
    TVmsCtlr *pObj = NULL;

    VmsIterator it;
    for(it=VmsCtlrManager->FLists.FObjects.begin(); it != VmsCtlrManager->FLists.FObjects.end(); ++it)
    {
        TVmsCtlr *pTmpObj = (TVmsCtlr*)it->second;
        if (pTmpObj->VMS_CTLR_ID == ACtrlId)
        {
            pObj = pTmpObj;
            break;
        }
    }
    return pObj;
}
//---------------------------------------------------------------------------

String VmsOperMode(TVmsCtlr *AObj)
{
    if (AObj->OPER_MODE == "A") return "자동";
    if (AObj->OPER_MODE == "B") return "기본";
    return                             "고정";
}
//---------------------------------------------------------------------------

String VmsComm(TVmsCtlr *AObj)
{
    if (AObj->STATE.Comm == vms_comm_normal) return "통신정상";
    return                                          "통신장애";
}
//---------------------------------------------------------------------------

String VmsModuleState(TVmsCtlr *AObj)
{
    if (AObj->STATE.Comm != vms_comm_normal) return "-";

    if (AObj->STATE.ModuleState == vms_comm_normal) return "모듈정상";
    if (AObj->STATE.ModuleState == vms_comm_normal) return "모듈장애";
    return "?";//"알수없음";
}
//---------------------------------------------------------------------------

String VmsModulePower(TVmsCtlr *AObj)
{
    if (AObj->STATE.Comm != vms_comm_normal) return "-";

    if (AObj->STATE.ModulePowerStatus == vms_module_power_on ) return "전원켜짐";
    if (AObj->STATE.ModulePowerStatus == vms_module_power_off) return "전원꺼짐";
    return "?";//"알수없음";
}
//---------------------------------------------------------------------------

String VmsModuleLuminance(TVmsCtlr *AObj)
{
    if (AObj->STATE.Comm != vms_comm_normal) return "-";
    int nLuminance = AObj->STATE.LuminanceStatus;
    return String(nLuminance);
}
//---------------------------------------------------------------------------

String VmsModuleDoor(TVmsCtlr *AObj)
{
    if (AObj->STATE.Comm != vms_comm_normal) return "-";

    if (AObj->STATE.DoorStatus == vms_door_open ) return "문열림";
    if (AObj->STATE.DoorStatus == vms_door_close) return "문닫힘";
    return "?";//"알수없음";
}
//---------------------------------------------------------------------------

String VmsModuleFan(TVmsCtlr *AObj)
{
    if (AObj->STATE.Comm != vms_comm_normal) return "-";

    if (AObj->STATE.FanStatus == vms_fan_on ) return "팬동작";
    if (AObj->STATE.FanStatus == vms_fan_off) return "팬정지";
    return "?";//"알수없음";
}
//---------------------------------------------------------------------------

String VmsModuleHeater(TVmsCtlr *AObj)
{
    if (AObj->STATE.Comm != vms_comm_normal) return "-";

    if (AObj->STATE.HeaterStatus == vms_heater_on ) return "히터가동";
    if (AObj->STATE.HeaterStatus == vms_heater_off) return "히터중지";
    return "?";//"알수없음";
}
//---------------------------------------------------------------------------

String VmsModuleTemp(TVmsCtlr *AObj)
{
    if (AObj->STATE.Comm != vms_comm_normal) return "-";
    int nTemp = AObj->STATE.BodyTemp;
    //return String(nTemp)+"℃";
    return String(nTemp);
}
//---------------------------------------------------------------------------



