|
@@ -1,7138 +1,7337 @@
|
|
|
-package com.artncore.commons;
|
|
|
-
|
|
|
-import android.util.Log;
|
|
|
-
|
|
|
-import com.util.LogUtil;
|
|
|
-
|
|
|
-import java.util.Calendar;
|
|
|
-
|
|
|
-public class DataClasses {
|
|
|
-
|
|
|
- static String TAG = "DataClasses";
|
|
|
-
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /** [에너지모듈] 데이터 클래스 */
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- public static class EnergyModule
|
|
|
- {
|
|
|
- public Info info;
|
|
|
- public Circuit circuit;
|
|
|
-
|
|
|
- /**
|
|
|
- * 생성자<br>
|
|
|
- * device 는 null 로 시작함을 주의하자
|
|
|
- */
|
|
|
- public EnergyModule()
|
|
|
- {
|
|
|
- info = new Info();
|
|
|
- circuit = null;
|
|
|
- }
|
|
|
- /**
|
|
|
- * 회로개수를 설정한다.
|
|
|
- *
|
|
|
- * @param nCircuitCount - (byte) 회로개수
|
|
|
- */
|
|
|
- public void setCircuitCount(byte nCircuitCount)
|
|
|
- {
|
|
|
- if(nCircuitCount <= 0) return;
|
|
|
-
|
|
|
- info.CircuitCount = nCircuitCount;
|
|
|
-
|
|
|
- circuit = new Circuit(nCircuitCount);
|
|
|
- }
|
|
|
-
|
|
|
- /** 에너지모듈 보드정보 */
|
|
|
- public static class Info
|
|
|
- {
|
|
|
- /** 설치상태 (true:설치 , false:미설치) */
|
|
|
- public boolean Install;
|
|
|
-
|
|
|
- /** 누적 전력 사용량 단위 (false:0.1kWh, true:1Wh) */
|
|
|
- public boolean AccPw_Unit;
|
|
|
-
|
|
|
- /** 회로개수( 범위 : 1~4) */
|
|
|
- public byte CircuitCount;
|
|
|
-
|
|
|
- /** 제조사 코드 ( 0x01 : 제일전기 ) */
|
|
|
- public byte Vender;
|
|
|
-
|
|
|
- /** 펌웨어 Build Date (년) */
|
|
|
- public byte FwVer_Year;
|
|
|
- /** 펌웨어 Build Date (월) */
|
|
|
- public byte FwVer_Month;
|
|
|
- /** 펌웨어 Build Date (일) */
|
|
|
- public byte FwVer_Day;
|
|
|
- /** 펌웨어 Build Date (일련번호) */
|
|
|
- public byte FwVer_Number;
|
|
|
-
|
|
|
- /** 지원 프로토콜 버전 Main */
|
|
|
- public byte ProtocolVer_Main;
|
|
|
- /** 지원 프로토콜 버전 Sub */
|
|
|
- public byte ProtocolVer_Sub;
|
|
|
-
|
|
|
- public Info()
|
|
|
- {
|
|
|
- Install = false;
|
|
|
- CircuitCount = 0;
|
|
|
- }
|
|
|
-
|
|
|
- public String ToDebugString(byte DeviceIdx)
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "(" + (byte)(DeviceIdx + 1) + ") Device - Info\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "Install : " + Install + "\r\n" +
|
|
|
- "CircuitCount : " + CircuitCount + "\r\n" +
|
|
|
- "Vender : " + String.format("0x%02X", Vender) + "\r\n" +
|
|
|
- "FwVer : " + (int)(FwVer_Year+2000) + "." + FwVer_Month + "." + FwVer_Day + "." + FwVer_Number + "\r\n" +
|
|
|
- "ProtocolVer : " + "V" + ProtocolVer_Main + "." + ProtocolVer_Sub + "\r\n" +
|
|
|
- "AccPw_Unit : " + AccPw_Unit + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 에너지모듈 회로 데이터 클래스 */
|
|
|
- public static class Circuit
|
|
|
- {
|
|
|
- /** 에러상태 (true:에러 , false:정상) */
|
|
|
- public boolean UnitError;
|
|
|
- /** 회로개수( 범위 : 1~4) */
|
|
|
- public int CircuitCount;
|
|
|
-
|
|
|
- /** 현재 전력사용량 */
|
|
|
- public double [] NowPw;
|
|
|
- /** 누적 전력사용량 */
|
|
|
- public double [] AccPw;
|
|
|
- /** 누적 전력사용량 오버플로우 */
|
|
|
- public boolean [] AccOverFlow;
|
|
|
-
|
|
|
- public Circuit(byte nCircuitCount)
|
|
|
- {
|
|
|
- if(nCircuitCount <= 0) return;
|
|
|
-
|
|
|
- UnitError = false;
|
|
|
- CircuitCount = nCircuitCount;
|
|
|
-
|
|
|
- NowPw = new double[nCircuitCount];
|
|
|
- for(int i=0 ; i<nCircuitCount ; i++) NowPw[i] = 0.0;
|
|
|
- AccPw = new double[nCircuitCount];
|
|
|
- for(int i=0 ; i<nCircuitCount ; i++) AccPw[i] = 0.0;
|
|
|
- AccOverFlow = new boolean[nCircuitCount];
|
|
|
- for(int i=0 ; i<nCircuitCount ; i++) AccOverFlow[i] = false;
|
|
|
- }
|
|
|
-
|
|
|
- public String ToDebugString(byte DeviceIdx)
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "(" + (byte)(DeviceIdx + 1) + ") Device - Circuit\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "UnitError : " + UnitError + "\r\n" +
|
|
|
- "CircuitCount : " + CircuitCount + "\r\n";
|
|
|
- for(int CircuitIndex=0 ; CircuitIndex<CircuitCount ; CircuitIndex++)
|
|
|
- {
|
|
|
- retStr += " Concent [" + (int)(CircuitIndex + 1) + "]" + "\r\n" +
|
|
|
- " NowPw : " + NowPw[CircuitIndex] + "\r\n" +
|
|
|
- " AccPw : " + AccPw[CircuitIndex] + "\r\n" +
|
|
|
- " AccOverFlow : " + AccOverFlow[CircuitIndex] + "\r\n";
|
|
|
- }
|
|
|
- retStr += "==========================";
|
|
|
-
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /** [대기차단콘센트] 데이터 클래스 */
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- public static class CutOffConcent
|
|
|
- {
|
|
|
- public Info info;
|
|
|
- public Circuit circuit;
|
|
|
-
|
|
|
- /**
|
|
|
- * 생성자<br>
|
|
|
- * device 는 null 로 시작함을 주의하자
|
|
|
- */
|
|
|
- public CutOffConcent()
|
|
|
- {
|
|
|
- info = new Info();
|
|
|
- circuit = null;
|
|
|
- }
|
|
|
- /**
|
|
|
- * 회로개수를 설정한다.
|
|
|
- *
|
|
|
- * @param nCircuitCount - (byte) 회로개수
|
|
|
- */
|
|
|
- public void setCircuitCount(byte nCircuitCount)
|
|
|
- {
|
|
|
- if(nCircuitCount <= 0) return;
|
|
|
-
|
|
|
- info.CircuitCount = nCircuitCount;
|
|
|
-
|
|
|
- circuit = new Circuit(nCircuitCount);
|
|
|
- }
|
|
|
-
|
|
|
- /** 보드정보 */
|
|
|
- public static class Info
|
|
|
- {
|
|
|
- /** 설치상태 (true:설치 , false:미설치) */
|
|
|
- public boolean Install;
|
|
|
-
|
|
|
- /** 회로개수( 콘센트 - 범위 : 1~8) */
|
|
|
- public byte CircuitCount;
|
|
|
-
|
|
|
- /** 제조사 코드 ( 0x01 : 신동아전기 ) */
|
|
|
- public byte Vender;
|
|
|
-
|
|
|
- /** 펌웨어 Build Date (년) */
|
|
|
- public byte FwVer_Year;
|
|
|
- /** 펌웨어 Build Date (월) */
|
|
|
- public byte FwVer_Month;
|
|
|
- /** 펌웨어 Build Date (일) */
|
|
|
- public byte FwVer_Day;
|
|
|
- /** 펌웨어 Build Date (일련번호) */
|
|
|
- public byte FwVer_Number;
|
|
|
-
|
|
|
- /** 지원 프로토콜 버전 Main */
|
|
|
- public byte ProtocolVer_Main;
|
|
|
- /** 지원 프로토콜 버전 Sub */
|
|
|
- public byte ProtocolVer_Sub;
|
|
|
-
|
|
|
- public Info()
|
|
|
- {
|
|
|
- Install = false;
|
|
|
- CircuitCount = 0;
|
|
|
- }
|
|
|
-
|
|
|
- public String ToDebugString(byte DeviceIdx)
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "(" + (byte)(DeviceIdx + 1) + ") Device - Info\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "Install : " + Install + "\r\n" +
|
|
|
- "CircuitCount : " + CircuitCount + "\r\n" +
|
|
|
- "Vender : " + String.format("0x%02X", Vender) + "\r\n" +
|
|
|
- "FwVer : " + (int)(FwVer_Year+2000) + "." + FwVer_Month + "." + FwVer_Day + "." + FwVer_Number + "\r\n" +
|
|
|
- "ProtocolVer : " + "V" + ProtocolVer_Main + "." + ProtocolVer_Sub + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 대기차단콘센트 회로 데이터 클래스 */
|
|
|
- public static class Circuit
|
|
|
- {
|
|
|
- /** 회로개수( 콘센트 - 범위 : 1~8) */
|
|
|
- public int CircuitCount;
|
|
|
-
|
|
|
- /** 모드상태 (true : 자동 , false : 상시) */
|
|
|
- public boolean [] Mode;
|
|
|
- /** 차단상태 (true : 차단상태, false : 노말상태) */
|
|
|
- public boolean [] CutoffStatus;
|
|
|
- /** 설정상태 (true : 대기전력 기준값있음, false : 대기전력 기준값미설정) */
|
|
|
- public boolean [] CutoffValStatus;
|
|
|
- /** 기기상태 (true : 과부하 차단, false : 노말상태) */
|
|
|
- public boolean [] OverloadError;
|
|
|
-
|
|
|
- public Circuit(byte nCircuitCount)
|
|
|
- {
|
|
|
- if(nCircuitCount <= 0) return;
|
|
|
-
|
|
|
- CircuitCount = nCircuitCount;
|
|
|
-
|
|
|
- Mode = new boolean[nCircuitCount];
|
|
|
- for(int i=0 ; i<nCircuitCount ; i++) Mode[i] = false;
|
|
|
- CutoffStatus = new boolean[nCircuitCount];
|
|
|
- for(int i=0 ; i<nCircuitCount ; i++) CutoffStatus[i] = false;
|
|
|
- CutoffValStatus = new boolean[nCircuitCount];
|
|
|
- for(int i=0 ; i<nCircuitCount ; i++) CutoffValStatus[i] = false;
|
|
|
- OverloadError = new boolean[nCircuitCount];
|
|
|
- for(int i=0 ; i<nCircuitCount ; i++) OverloadError[i] = false;
|
|
|
- }
|
|
|
-
|
|
|
- public String ToDebugString(byte DeviceIdx)
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "(" + (byte)(DeviceIdx + 1) + ") Device - Circuit\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "CircuitCount : " + CircuitCount + "\r\n";
|
|
|
- for(int CircuitIndex=0 ; CircuitIndex<CircuitCount ; CircuitIndex++)
|
|
|
- {
|
|
|
- retStr += " Concent [" + (int)(CircuitIndex + 1) + "]" + "\r\n" +
|
|
|
- " Mode : " + Mode[CircuitIndex] + "\r\n" +
|
|
|
- " CutoffStatus : " + CutoffStatus[CircuitIndex] + "\r\n" +
|
|
|
- " CutoffValStatus : " + CutoffValStatus[CircuitIndex] + "\r\n" +
|
|
|
- " OverloadError : " + OverloadError[CircuitIndex] + "\r\n";
|
|
|
- }
|
|
|
- retStr += "==========================";
|
|
|
-
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /** [에너지미터] 데이터 클래스 */
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- public static class EnergyMeter
|
|
|
- {
|
|
|
- public Info info;
|
|
|
- public EachRoom [] eachRoom;
|
|
|
-
|
|
|
- /** 생성자 */
|
|
|
- public EnergyMeter()
|
|
|
- {
|
|
|
- info = new Info();
|
|
|
- eachRoom = null;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 방 개수를 설정한다. <br>
|
|
|
- * {@link EnergyMeter} 생성후 방개수를 설정하여야 eachRoom 가 생성된다.
|
|
|
- *
|
|
|
- * @param nRoomCnt - (byte) 설정할 방개수
|
|
|
- *
|
|
|
- * @return (boolean) true : 성공 , false : 실패
|
|
|
- */
|
|
|
- public boolean setRoomCnt(byte nRoomCnt)
|
|
|
- {
|
|
|
- if(nRoomCnt <= 0) return false;
|
|
|
- if(nRoomCnt > 6) return false;
|
|
|
- if(info == null) return false;
|
|
|
-
|
|
|
- info.RoomCnt = nRoomCnt;
|
|
|
- eachRoom = new EachRoom[nRoomCnt];
|
|
|
- for(byte i=0 ; i<nRoomCnt ; i++)
|
|
|
- {
|
|
|
- eachRoom[i] = new EachRoom();
|
|
|
- }
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 전체 방의 조명 상태를 리턴한다.<br>
|
|
|
- * 방의 조명이 하나라도 켜져있으면 ON , 모두 꺼져있으면 OFF
|
|
|
- *
|
|
|
- * @return (boolean) true : 켜짐 , false : 꺼짐
|
|
|
- */
|
|
|
- public boolean getAllLightOnOff()
|
|
|
- {
|
|
|
- if(eachRoom == null) return false;
|
|
|
-
|
|
|
- for(int i=0 ; i<eachRoom.length ; i++)
|
|
|
- {
|
|
|
- if(eachRoom[i] != null)
|
|
|
- if(eachRoom[i].getAllLightOnOff()) return true;
|
|
|
- }
|
|
|
-
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 전체 방의 콘센트 상태를 리턴한다.<br>
|
|
|
- * 방의 콘센트이 하나라도 켜져있으면 ON , 모두 꺼져있으면 OFF
|
|
|
- *
|
|
|
- * @return (boolean) true : 켜짐 , false : 꺼짐
|
|
|
- */
|
|
|
- public boolean getAllConcentOnOff()
|
|
|
- {
|
|
|
- if(eachRoom == null) return false;
|
|
|
-
|
|
|
- for(int i=0 ; i<eachRoom.length ; i++)
|
|
|
- {
|
|
|
- if(eachRoom[i] != null)
|
|
|
- if(eachRoom[i].getAllConcentOnOff()) return true;
|
|
|
- }
|
|
|
-
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- /** 개별기기정보 */
|
|
|
- public static class EachRoom
|
|
|
- {
|
|
|
- /** 설치상태 (true : 설치 ,false : 미설치) */
|
|
|
- public boolean Install;
|
|
|
- /** 통신상태 (true : 정상 ,false : 비정상) */
|
|
|
- public boolean CommStatus;
|
|
|
- /** 기기이상 (true : 에러 ,false : 비정상) */
|
|
|
- public boolean UnitError;
|
|
|
-
|
|
|
- /** 조명개수 (범위 : 1~4)<br>
|
|
|
- * ※주의 : 0일시 조명 관련 배열데이터 생성되지않음 */
|
|
|
- public byte LightCnt;
|
|
|
- /** 조명 On/OFF 상태 (true:ON , false:OFF) */
|
|
|
- public boolean [] LightOnOff;
|
|
|
- /** 조명 현재 소비전력 (단위: 0.1W) */
|
|
|
- public double LightNowPw;
|
|
|
- /** 조명 누적 전력사용량 (단위: 0.1kWh) */
|
|
|
- public double LightAccPw;
|
|
|
- /** 조명 누적 전럭사용량 오버플로우 */
|
|
|
- public boolean LightAccOverflow;
|
|
|
- /** 조명 과부하로 차단됨 (true:차단 , false:정상) */
|
|
|
- public boolean LightOverLoad;
|
|
|
-
|
|
|
- /** 콘센트개수 (범위 2~3 , 2개일시 C1,C2, 3개일시 C3 추가 * C3은 상시콘센트임 제어않됨!) <br>
|
|
|
- * ※주의 : 0일시 콘센트 관련 배열데이터 생성되지않음 */
|
|
|
- public byte ConCnt;
|
|
|
- /** 콘센트 모드상태 (true : 자동 ,false : 상시) C1, C2에 일괄적용 */
|
|
|
- public boolean ConMode;
|
|
|
- /** 콘센트 On/OFF 상태 (true:ON , false:OFF) */
|
|
|
- public boolean [] ConOnOff;
|
|
|
- /** 콘센트 대기전력 기준값 (단위: 0.1W) */
|
|
|
- public double [] ConCutOffVal;
|
|
|
- /** 콘센트 대기전력 차단상태 (true : 대기전력 자동차단됨, false : 노말상태) */
|
|
|
- public boolean [] ConCutOffStatus;
|
|
|
- /** 콘센트 과부하로 차단됨 (true:차단 , false:정상) */
|
|
|
- public boolean [] ConOverLoad;
|
|
|
-
|
|
|
- /** 콘센트 현재 소비전력 (단위: 0.1W) */
|
|
|
- public double [] ConNowPw;
|
|
|
- /** 콘센트 누적 전력사용량 (단위: 0.1kWh) */
|
|
|
- public double [] ConAccPw;
|
|
|
- /** 콘센트 누적 전럭사용량 오버플로우 */
|
|
|
- public boolean [] ConAccOverflow;
|
|
|
-
|
|
|
- /** 일괄소등용 릴레이 사용여부 (true:지원, false:미지원) */
|
|
|
- public boolean AllLightRelay_Use;
|
|
|
- /** 일괄소등용 릴레이 ON/OFF 상태 (true:ON, false:OFF) */
|
|
|
- public boolean AllLightRelay_OnOff;
|
|
|
-
|
|
|
- public EachRoom()
|
|
|
- {
|
|
|
- Install = false;
|
|
|
- LightCnt = 0;
|
|
|
- ConCnt = 0;
|
|
|
- ConMode = false;
|
|
|
-
|
|
|
- AllLightRelay_Use = false;
|
|
|
- AllLightRelay_OnOff = false;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 조명개수를 설정한다.
|
|
|
- *
|
|
|
- * @param nLightCnt - (byte) 설정할 조명개수
|
|
|
- *
|
|
|
- * @return (boolean) true : 성공 , false : 실패
|
|
|
- */
|
|
|
- public boolean setLightCnt(byte nLightCnt)
|
|
|
- {
|
|
|
- if(nLightCnt <= 0) return false;
|
|
|
-
|
|
|
- LightCnt = nLightCnt;
|
|
|
- LightOnOff = new boolean [nLightCnt];
|
|
|
- for(int i=0 ; i<nLightCnt ; i++) LightOnOff[i] = false;
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 콘센트개수를 설정한다.
|
|
|
- *
|
|
|
- * @param nConCnt - (byte) 설정할 콘센트개수 (2 or 3 설정가능)
|
|
|
- *
|
|
|
- * @return (boolean) true : 성공 , false : 실패
|
|
|
- */
|
|
|
- public boolean setConCnt(byte nConCnt)
|
|
|
- {
|
|
|
- if( !((nConCnt == 2) || (nConCnt == 3)) ) return false;
|
|
|
-
|
|
|
- ConCnt = nConCnt;
|
|
|
-
|
|
|
- byte ControlConcent = 2;
|
|
|
- ConOnOff = new boolean [ControlConcent];
|
|
|
- for(int i=0 ; i<ConOnOff.length ; i++) ConOnOff[i] = false;
|
|
|
- ConCutOffVal = new double [ControlConcent];
|
|
|
- for(int i=0 ; i<ConCutOffVal.length ; i++) ConCutOffVal[i] = 0.0;
|
|
|
- ConCutOffStatus = new boolean [ControlConcent];
|
|
|
- for(int i=0 ; i<ConCutOffStatus.length ; i++) ConCutOffStatus[i] = false;
|
|
|
- ConOverLoad = new boolean [ControlConcent];
|
|
|
- for(int i=0 ; i<ConOverLoad.length ; i++) ConOverLoad[i] = false;
|
|
|
-
|
|
|
- ConNowPw = new double [nConCnt];
|
|
|
- for(int i=0 ; i<nConCnt ; i++) ConNowPw[i] = 0.0;
|
|
|
- ConAccPw = new double [nConCnt];
|
|
|
- for(int i=0 ; i<nConCnt ; i++) ConAccPw[i] = 0.0;
|
|
|
- ConAccOverflow = new boolean [nConCnt];
|
|
|
- for(int i=0 ; i<nConCnt ; i++) ConAccOverflow[i] = false;
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 방 조명의 상태를 리턴한다.<br>
|
|
|
- * 방의 조명이 하나라도 켜져있으면 ON , 모두 꺼져있으면 OFF
|
|
|
- *
|
|
|
- * @return (boolean) true : ON , false : OFF
|
|
|
- */
|
|
|
- public boolean getAllLightOnOff()
|
|
|
- {
|
|
|
- if(LightOnOff == null) return false;
|
|
|
-
|
|
|
- boolean OnOff = false;
|
|
|
- for(int i=0 ; i<LightOnOff.length ; i++)
|
|
|
- {
|
|
|
- if(LightOnOff[i]) { OnOff = true; break; }
|
|
|
- }
|
|
|
- return OnOff;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 방 콘센트의 상태를 리턴한다.<br>
|
|
|
- * 방의 콘센트이 하나라도 켜져있으면 ON , 모두 꺼져있으면 OFF
|
|
|
- *
|
|
|
- * @return (boolean) true : ON , false : OFF
|
|
|
- */
|
|
|
- public boolean getAllConcentOnOff()
|
|
|
- {
|
|
|
- if(ConOnOff == null) return false;
|
|
|
-
|
|
|
- boolean OnOff = false;
|
|
|
- for(int i=0 ; i<ConOnOff.length ; i++)
|
|
|
- {
|
|
|
- if(ConOnOff[i]) { OnOff = true; break; }
|
|
|
- }
|
|
|
- return OnOff;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 모든 콘센트의 소비전력 합을 리턴한다.
|
|
|
- *
|
|
|
- * @return (double) 모든 콘센트 소비전력
|
|
|
- */
|
|
|
- public double getAllConcentNowPw()
|
|
|
- {
|
|
|
- if(ConNowPw == null) return 0.0;
|
|
|
-
|
|
|
- double NowPw = 0;
|
|
|
- for(int i=0 ; i<ConNowPw.length ; i++)
|
|
|
- {
|
|
|
- NowPw += ConNowPw[i];
|
|
|
- }
|
|
|
- return Double.parseDouble(String.format("%.0f", NowPw));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 모든 조명 + 콘센트의 소비전력 합을 리턴한다.
|
|
|
- *
|
|
|
- * @return (double) 모든 조명+콘센트 소비전력
|
|
|
- */
|
|
|
- public double getAllNowPw()
|
|
|
- {
|
|
|
- if(ConNowPw == null) return 0.0;
|
|
|
-
|
|
|
- double NowPw = 0;
|
|
|
- for(int i=0 ; i<ConNowPw.length ; i++)
|
|
|
- {
|
|
|
- NowPw += ConNowPw[i];
|
|
|
- }
|
|
|
- NowPw += LightNowPw;
|
|
|
- return Double.parseDouble(String.format("%.0f", NowPw));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 방 콘센트의 대기전력차단 상태를 리턴한다.<br>
|
|
|
- * 방의 콘센트이 하나라도 대기차단 상태라면 ON , 모두 아니라면 OFF
|
|
|
- *
|
|
|
- * @return (boolean) true : ON , false : OFF
|
|
|
- */
|
|
|
- public boolean getAllConcentCutOffStatus()
|
|
|
- {
|
|
|
- if(ConCutOffStatus == null) return false;
|
|
|
-
|
|
|
- boolean OnOff = false;
|
|
|
- for(int i=0 ; i<ConCutOffStatus.length ; i++)
|
|
|
- {
|
|
|
- if(ConCutOffStatus[i]) { OnOff = true; break; }
|
|
|
- }
|
|
|
- return OnOff;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 방 콘센트의 과부하상태를 리턴한다.<br>
|
|
|
- * 방의 콘센트가 하나라도 과부하차단중이면 true , 모두 정상이면 false
|
|
|
- *
|
|
|
- * @return (boolean) true : 과부하차단 , false : 정상
|
|
|
- */
|
|
|
- public boolean getAllConcentOverLoad()
|
|
|
- {
|
|
|
- if(ConOverLoad == null) return false;
|
|
|
-
|
|
|
- boolean OverLoad = false;
|
|
|
- for(int i=0 ; i<ConOverLoad.length ; i++)
|
|
|
- {
|
|
|
- if(ConOverLoad[i]) { OverLoad = true; break; }
|
|
|
- }
|
|
|
- return OverLoad;
|
|
|
- }
|
|
|
-
|
|
|
- /** 본 클래스 디버깅 메시지 */
|
|
|
- public String ToDebugString(byte RoomIndex)
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "RoomNumber (" + (byte)(RoomIndex+1) + ")\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
-
|
|
|
- "Install : " + Install + "\r\n" +
|
|
|
- "CommError : " + CommStatus + "\r\n" +
|
|
|
- "UnitError : " + UnitError + "\r\n" +
|
|
|
-
|
|
|
- "[Light]\r\n" +
|
|
|
- "LightCnt : " + LightCnt + "\r\n";
|
|
|
- retStr += BooleanArrayString("LightOnOff : ", LightOnOff);
|
|
|
-
|
|
|
- retStr +=
|
|
|
- "LightNowPw : " + LightNowPw + "\r\n" +
|
|
|
- "LightAccPw : " + LightAccPw + "\r\n" +
|
|
|
- "LightAccOverflow : " + LightAccOverflow + "\r\n" +
|
|
|
- "LightOverLoad : " + LightOverLoad + "\r\n" +
|
|
|
-
|
|
|
-
|
|
|
- "[Concent]\r\n" +
|
|
|
- "ConCnt : " + ConCnt + "\r\n" +
|
|
|
- "ConMode : " + ConMode + "\r\n";
|
|
|
- retStr += BooleanArrayString("ConOnOff : ", ConOnOff);
|
|
|
- retStr += DoubleArrayString ("ConCutOffVal : ", ConCutOffVal);
|
|
|
- retStr += BooleanArrayString("ConCutOffStatus : ", ConCutOffStatus);
|
|
|
- retStr += BooleanArrayString("ConOverLoad : ", ConOverLoad);
|
|
|
-
|
|
|
- retStr += DoubleArrayString ("ConNowPw : ", ConNowPw);
|
|
|
- retStr += DoubleArrayString ("ConAccPw : ", ConAccPw);
|
|
|
- retStr += BooleanArrayString("ConAccOverflow : ", ConAccOverflow);
|
|
|
-
|
|
|
- retStr +=
|
|
|
- "[AllLightRelay]\r\n" +
|
|
|
- "AllLightRelay_Use : " + AllLightRelay_Use + "\r\n" +
|
|
|
- "AllLightRelay_OnOff : " + AllLightRelay_OnOff + "\r\n";
|
|
|
-
|
|
|
- retStr += "==========================";
|
|
|
-
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
- private String BooleanArrayString(String Name, boolean [] DataArray)
|
|
|
- {
|
|
|
- String retStr = Name;
|
|
|
- if(DataArray == null) retStr += "null";
|
|
|
- else
|
|
|
- {
|
|
|
- for(int i=0 ; i<DataArray.length ; i++)
|
|
|
- {
|
|
|
- retStr += DataArray[i];
|
|
|
- if(i+1 != DataArray.length) retStr += ", ";
|
|
|
- }
|
|
|
- }
|
|
|
- return retStr + "\r\n";
|
|
|
- }
|
|
|
-
|
|
|
- private String DoubleArrayString(String Name, double [] DataArray)
|
|
|
- {
|
|
|
- String retStr = Name;
|
|
|
- if(DataArray == null) retStr += "null";
|
|
|
- else
|
|
|
- {
|
|
|
- for(int i=0 ; i<DataArray.length ; i++)
|
|
|
- {
|
|
|
- retStr += DataArray[i];
|
|
|
- if(i+1 != DataArray.length) retStr += ", ";
|
|
|
- }
|
|
|
- }
|
|
|
- return retStr + "\r\n";
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 기기정보 */
|
|
|
- public static class Info
|
|
|
- {
|
|
|
- /** 방개수( 범위 : 0~6) */
|
|
|
- public byte RoomCnt;
|
|
|
-
|
|
|
- /** 제조사 코드 ( 0x01 : 제일전기) */
|
|
|
- public byte Vender;
|
|
|
-
|
|
|
- /** 펌웨어 Build Date (년) */
|
|
|
- public byte FwVer_Year;
|
|
|
- /** 펌웨어 Build Date (월) */
|
|
|
- public byte FwVer_Month;
|
|
|
- /** 펌웨어 Build Date (일) */
|
|
|
- public byte FwVer_Day;
|
|
|
- /** 펌웨어 Build Date (일련번호) */
|
|
|
- public byte FwVer_Number;
|
|
|
-
|
|
|
- /** 지원 프로토콜 버전 Main */
|
|
|
- public byte ProtocolVer_Main;
|
|
|
- /** 지원 프로토콜 버전 Sub */
|
|
|
- public byte ProtocolVer_Sub;
|
|
|
-
|
|
|
- /** 일괄소등용 릴레이 사용여부 (true:지원, false:미지원) ※ 에너지미터중 1개라도 본 기능을 지원할시 true , 아닐시 false */
|
|
|
- public boolean AllLightRelay_Use;
|
|
|
-
|
|
|
- /** 누적 전력 사용량 단위 (false:0.1kWh, true:1Wh) */
|
|
|
- public boolean AccPw_Unit;
|
|
|
-
|
|
|
- /** 생성자 */
|
|
|
- public Info()
|
|
|
- {
|
|
|
- RoomCnt = 0;
|
|
|
- AllLightRelay_Use = false;
|
|
|
- }
|
|
|
-
|
|
|
- /** 본 클래스 디버깅 메시지 */
|
|
|
- public String ToDebugString()
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "Device - Info\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "RoomCnt : " + RoomCnt + "\r\n" +
|
|
|
- "Vender : " + String.format("0x%02X", Vender) + "\r\n" +
|
|
|
- "FwVer : " + (int)(FwVer_Year+2000) + "." + FwVer_Month + "." + FwVer_Day + "." + FwVer_Number + "\r\n" +
|
|
|
- "ProtocolVer : " + "V" + ProtocolVer_Main + "." + ProtocolVer_Sub + "\r\n" +
|
|
|
- "AllLightRelay_Use : " + AllLightRelay_Use + "\r\n" +
|
|
|
- "AccPw_Unit : " + AccPw_Unit + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /** [난방V1] 데이터 클래스 */
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- public static class HeatingV1
|
|
|
- {
|
|
|
- /** 방의 개수 */
|
|
|
- public byte RoomCount;
|
|
|
-
|
|
|
- /** 난방 일시정지 상태 (true:설정, false:해제)*/
|
|
|
- public boolean Pause;
|
|
|
-
|
|
|
- /** 설정온도 단위 (ture : 0.5도단위, false : 1도단위) */
|
|
|
- public boolean SetTempPoint05;
|
|
|
-
|
|
|
- /** 에러상태 */
|
|
|
- public byte Error;
|
|
|
-
|
|
|
- /** 각방 데이터 */
|
|
|
- public RoomData [] Room;
|
|
|
-
|
|
|
- /** 기기 정보 */
|
|
|
- public Info info;
|
|
|
-
|
|
|
- public HeatingV1()
|
|
|
- {
|
|
|
- RoomCount = 0;
|
|
|
- Pause = false;
|
|
|
- SetTempPoint05 = true;
|
|
|
- Error = ERROR.Normal;
|
|
|
- Room = null;
|
|
|
- info = new Info();
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 방 개수를 설정한다.<br>
|
|
|
- *
|
|
|
- * @param cnt - (byte) 설정할 방개수 (범위: 1 ~ 8)
|
|
|
- *
|
|
|
- * @return (boolean) true : 성공 , false : 실패
|
|
|
- */
|
|
|
- public boolean SetRoomCount(byte cnt)
|
|
|
- {
|
|
|
- if((cnt <= 0) || (cnt > 8)) return false;
|
|
|
-
|
|
|
- RoomCount = cnt;
|
|
|
- Room = new RoomData [cnt];
|
|
|
- for(byte i=0 ; i<cnt ; i++) Room[i] = new RoomData();
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- /** 기기정보 */
|
|
|
- public static class Info
|
|
|
- {
|
|
|
- /** 디바이스명 + 버전정보 (각 회사별로 정의) */
|
|
|
- public byte [] Data;
|
|
|
-
|
|
|
- private boolean bSet;
|
|
|
- public Info()
|
|
|
- {
|
|
|
- Data = new byte[8];
|
|
|
- for(int i=0 ; i<Data.length ; i++) Data[i] = 0x00;
|
|
|
- bSet = false;
|
|
|
- }
|
|
|
-
|
|
|
- public boolean GetSet()
|
|
|
- {
|
|
|
- return bSet;
|
|
|
- }
|
|
|
-
|
|
|
- public boolean SetData(byte [] setdata)
|
|
|
- {
|
|
|
- if(setdata == null) return false;
|
|
|
- if(setdata.length > 8) return false;
|
|
|
-
|
|
|
- if(Data == null) return false;
|
|
|
-
|
|
|
- if(setdata.length != Data.length) Data = new byte [setdata.length];
|
|
|
- for(int i=0 ; i<setdata.length ; i++) Data[i] = setdata[i];
|
|
|
-
|
|
|
- bSet = true;
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString()
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "Info\r\n" +
|
|
|
- "==========================\r\n";
|
|
|
-
|
|
|
- if(Data == null) retStr += "null\r\n";
|
|
|
- else retStr += Data.toString() + "\r\n";
|
|
|
-
|
|
|
- retStr +=
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 각 방 데이터 */
|
|
|
- public static class RoomData
|
|
|
- {
|
|
|
- ////////////////////////////////////////////
|
|
|
- // 기본기능
|
|
|
- ////////////////////////////////////////////
|
|
|
- /** 난방 ON/OFF (true : ON , false : OFF)*/
|
|
|
- public boolean bOnOff;
|
|
|
- /** 밸브상태 ( ture : 열림, false : 닫힘 ) */
|
|
|
- public boolean bValveStatus;
|
|
|
- /** 설정온도 ( 0.5도 혹은 1도 단위) */
|
|
|
- public double SetTemp;
|
|
|
- /** 현재온도 */
|
|
|
- public double NowTemp;
|
|
|
- /** 에러상태 */
|
|
|
- public byte Error;
|
|
|
-
|
|
|
- public RoomData()
|
|
|
- {
|
|
|
- bOnOff = false;
|
|
|
- bValveStatus = false;
|
|
|
- SetTemp = 10.0;
|
|
|
- NowTemp = 15.0;
|
|
|
- Error = ERROR.Normal;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString(byte RoomIndex)
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "RoomData (" + (int) (RoomIndex+1) + ") \r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "bOnOff : " + bOnOff + "\r\n" +
|
|
|
- "bValveStatus : " + bValveStatus + "\r\n" +
|
|
|
- "SetTemp : " + SetTemp + "\r\n" +
|
|
|
- "NowTemp : " + NowTemp + "\r\n" +
|
|
|
- "Error : " + ERROR.ToDebugString(Error) + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 에러코드 */
|
|
|
- public static class ERROR
|
|
|
- {
|
|
|
- /** 정상 */
|
|
|
- public static byte Normal = 0x00;
|
|
|
- /** 조절기 에러 */
|
|
|
- public static byte RoomSystem = 0x50;
|
|
|
- /** 제어기 에러 */
|
|
|
- public static byte Controller = 0x60;
|
|
|
- /** EEPROM 에러 */
|
|
|
- public static byte Eeprom = 0x70;
|
|
|
- /** 가스보일러 에러 */
|
|
|
- public static byte Boiler = 0x23;
|
|
|
-
|
|
|
- public static String ToDebugString(byte Error)
|
|
|
- {
|
|
|
- String retStr;
|
|
|
-
|
|
|
- if (Error == ERROR.Normal) retStr = "Normal";
|
|
|
- else if(Error == ERROR.RoomSystem) retStr = "RoomSystem";
|
|
|
- else if(Error == ERROR.Controller) retStr = "Controller";
|
|
|
- else if(Error == ERROR.Eeprom) retStr = "Eeprom";
|
|
|
- else if(Error == ERROR.Boiler) retStr = "Boiler";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
- public static boolean Check(byte Error)
|
|
|
- {
|
|
|
- if (Error == ERROR.Normal) return true;
|
|
|
- else if(Error == ERROR.RoomSystem) return true;
|
|
|
- else if(Error == ERROR.Controller) return true;
|
|
|
- else if(Error == ERROR.Eeprom) return true;
|
|
|
- else if(Error == ERROR.Boiler) return true;
|
|
|
-
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 전체방 데이터 정의 (통신용) */
|
|
|
- public static class AllRoomData
|
|
|
- {
|
|
|
- /** 방의 개수 */
|
|
|
- public byte RoomCount;
|
|
|
- /** 설정온도 단위 (ture : 0.5도단위, false : 1도단위) */
|
|
|
- public boolean SetTempPoint05;
|
|
|
- /** 난방 일시정지 상태 (true:설정, false:해제)*/
|
|
|
- public boolean Pause;
|
|
|
- /** 각방 상태 */
|
|
|
- public EachRoomData [] Room;
|
|
|
- /** 에러상태 */
|
|
|
- public byte Error;
|
|
|
-
|
|
|
- public AllRoomData(byte nRoomCount)
|
|
|
- {
|
|
|
- RoomCount = nRoomCount;
|
|
|
- SetTempPoint05 = true;
|
|
|
- Room = new EachRoomData[RoomCount];
|
|
|
- for(byte i=0 ; i<RoomCount ; i++) Room[i] = new EachRoomData();
|
|
|
- Error = ERROR.Normal;
|
|
|
- }
|
|
|
-
|
|
|
- public class EachRoomData
|
|
|
- {
|
|
|
- ////////////////////////////////////////////
|
|
|
- // 기본기능
|
|
|
- ////////////////////////////////////////////
|
|
|
- /** 난방 ON/OFF (true : ON , false : OFF)*/
|
|
|
- public boolean bOnOff;
|
|
|
- /** 밸브상태 ( ture : 열림, false : 닫힘 ) */
|
|
|
- public boolean bValveStatus;
|
|
|
-
|
|
|
- public EachRoomData()
|
|
|
- {
|
|
|
- bOnOff = false;
|
|
|
- bValveStatus = false;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString(byte RoomIndex)
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "RoomData (" + (int) (RoomIndex+1) + ") \r\n" +
|
|
|
- "bOnOff : " + bOnOff + " / " + "bValveStatus : " + bValveStatus + "\r\n";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString()
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "AllRoomData\r\n" +
|
|
|
- "==========================\r\n";
|
|
|
-
|
|
|
- for(byte i=0 ; i<RoomCount ; i++)
|
|
|
- {
|
|
|
- retStr += Room[i].ToDebugString(i);
|
|
|
- }
|
|
|
-
|
|
|
- retStr += "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugStringInfoNPause()
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "InfoNPause\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "RoomCount : " + RoomCount + "\r\n" +
|
|
|
- "SetTempPoint05 : " + SetTempPoint05 + "\r\n" +
|
|
|
- "Error : " + String.format("0x%02X", Error) + "\r\n" +
|
|
|
- "Pause : " + Pause + "\r\n" +
|
|
|
- "==========================";
|
|
|
-
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugStringRoom(byte index)
|
|
|
- {
|
|
|
- if(Room == null) return "Error(Room is null)";
|
|
|
- if(Room.length < index) return "Error(index:" + index + ", Out Of Range !!!)";
|
|
|
-
|
|
|
- return Room[index].ToDebugString(index);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /** [난방V2] 데이터 클래스 */
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- public static class HeatingV2
|
|
|
- {
|
|
|
- /** 기기정보 */
|
|
|
- public Info info;
|
|
|
- /** 각 방 데이터 */
|
|
|
- public RoomData [] Room;
|
|
|
-
|
|
|
- public HeatingV2()
|
|
|
- {
|
|
|
- info = new Info();
|
|
|
- Room = null;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 방 개수를 설정한다.<br>
|
|
|
- *
|
|
|
- * @param cnt - (byte) 설정할 방개수 (범위: 1 ~ 8)
|
|
|
- * @return (boolean) true : 성공 , false : 실패
|
|
|
- */
|
|
|
- public boolean SetRoomCount(byte cnt)
|
|
|
- {
|
|
|
- if(info == null) return false;
|
|
|
-
|
|
|
- if((cnt <= 0) || (cnt > 8)) return false;
|
|
|
-
|
|
|
- info.RoomCount = cnt;
|
|
|
- Room = new RoomData [cnt];
|
|
|
- for(byte i=0 ; i<cnt ; i++) Room[i] = new RoomData();
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- /** 기기정보 */
|
|
|
- public static class Info
|
|
|
- {
|
|
|
- /** 방개수(범위 : 1~6) */
|
|
|
- public byte RoomCount;
|
|
|
-
|
|
|
- /** 제조사 코드 ( 프로토콜 문서에 따름 ) */
|
|
|
- public byte Vender;
|
|
|
-
|
|
|
- /** 펌웨어 Build Date (년) */
|
|
|
- public byte FwVer_Year;
|
|
|
- /** 펌웨어 Build Date (월) */
|
|
|
- public byte FwVer_Month;
|
|
|
- /** 펌웨어 Build Date (일) */
|
|
|
- public byte FwVer_Day;
|
|
|
- /** 펌웨어 Build Date (일련번호) */
|
|
|
- public byte FwVer_Number;
|
|
|
-
|
|
|
- /** 지원 프로토콜 버전 Main */
|
|
|
- public byte ProtocolVer_Main;
|
|
|
- /** 지원 프로토콜 버전 Sub */
|
|
|
- public byte ProtocolVer_Sub;
|
|
|
-
|
|
|
- public SupportInfo Support;
|
|
|
-
|
|
|
- /** 기능 지원 여부 */
|
|
|
- public class SupportInfo
|
|
|
- {
|
|
|
- /** 지원하는 최저설정온도 (범위 : 5도 ~ 20도) */
|
|
|
- public byte MinSetTemp;
|
|
|
- /** 지원하는 최대설정온도 (범위 : 21도 ~ 40도) */
|
|
|
- public byte MaxSetTemp;
|
|
|
-
|
|
|
- // 공통사용부분
|
|
|
- /** 설정온도 단위 (ture : 0.5도단위, false : 1도단위) */
|
|
|
- public boolean SetTempPoint05;
|
|
|
- /** 외출기능 지원여부 (ture : 지원, false : 미지원) */
|
|
|
- public boolean Outing;
|
|
|
- /** 취침기능 지원여부 (ture : 지원, false : 미지원) */
|
|
|
- public boolean Sleep;
|
|
|
- /** 예약기능 지원여부 (ture : 지원, false : 미지원) */
|
|
|
- public boolean Reservation;
|
|
|
- /** 일시정지 지원여부 (ture : 지원, false : 미지원) */
|
|
|
- public boolean Pause;
|
|
|
-
|
|
|
- // I'PARK 디지털 특기시방용
|
|
|
- /** 인공지능 지원여부 (ture : 지원, false : 미지원) */
|
|
|
- public boolean AI;
|
|
|
- /** 외기온도 사용여부 (ture : 사용, false : 미사용) */
|
|
|
- public boolean OutsideTempUse;
|
|
|
- /** 보일러 지원여부 (ture : 지원, false : 미지원) */
|
|
|
- public boolean Boiler;
|
|
|
- /** 누수감지 지원여부 (ture : 지원, false : 미지원) */
|
|
|
- public boolean Leak;
|
|
|
-
|
|
|
- public SupportInfo()
|
|
|
- {
|
|
|
- MinSetTemp = 5;
|
|
|
- MaxSetTemp = 40;
|
|
|
- SetTempPoint05 = false;
|
|
|
- Outing = false;
|
|
|
- Sleep = false;
|
|
|
- Reservation = false;
|
|
|
- Pause = false;
|
|
|
-
|
|
|
- AI = false;
|
|
|
- OutsideTempUse = false;
|
|
|
- Boiler = false;
|
|
|
- Leak = false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public Info()
|
|
|
- {
|
|
|
- Support = new SupportInfo();
|
|
|
- RoomCount = 0;
|
|
|
- }
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString()
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "Info\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "RoomCount : " + RoomCount + "\r\n" +
|
|
|
- "Vender : " + String.format("0x%02X", Vender) + "\r\n" +
|
|
|
- "FwVer : " + (int)(FwVer_Year+2000) + "." + FwVer_Month + "." + FwVer_Day + "." + FwVer_Number + "\r\n" +
|
|
|
- "ProtocolVer : " + "V" + ProtocolVer_Main + "." + ProtocolVer_Sub + "\r\n" +
|
|
|
-
|
|
|
- "[Support]" + "\r\n" +
|
|
|
- "MinSetTemp : " + Support.MinSetTemp +"\r\n" +
|
|
|
- "MaxSetTemp : " + Support.MaxSetTemp +"\r\n" +
|
|
|
- "SetTempPoint05 : " + Support.SetTempPoint05 +"\r\n" +
|
|
|
- "Outing : " + Support.Outing +"\r\n" +
|
|
|
- "Sleep : " + Support.Sleep +"\r\n" +
|
|
|
- "Reservation : " + Support.Reservation +"\r\n" +
|
|
|
- "Pause : " + Support.Pause +"\r\n" +
|
|
|
- "AI : " + Support.AI +"\r\n" +
|
|
|
- "OutsideTempUse : " + Support.OutsideTempUse +"\r\n" +
|
|
|
- "Boiler : " + Support.Boiler +"\r\n" +
|
|
|
- "Leak : " + Support.Leak +"\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 각 방 데이터 */
|
|
|
- public static class RoomData
|
|
|
- {
|
|
|
- ////////////////////////////////////////////
|
|
|
- // 기본기능
|
|
|
- ////////////////////////////////////////////
|
|
|
- /** 운전모드 {@link MODE} 값에 따름 */
|
|
|
- public byte Mode;
|
|
|
- /** 밸브상태 ( ture : 열림, false : 닫힘 ) */
|
|
|
- public boolean bValveStatus;
|
|
|
- /** 설정온도 ( 0.5도 혹은 1도 단위) */
|
|
|
- public double SetTemp;
|
|
|
- /** 현재온도 */
|
|
|
- public double NowTemp;
|
|
|
- /** 에러 코드 */
|
|
|
- public ERROR Error;
|
|
|
-
|
|
|
- ////////////////////////////////////////////
|
|
|
- // 추가기능
|
|
|
- ////////////////////////////////////////////
|
|
|
- /** 취침운전 설정값 */
|
|
|
- public SLEEP Sleep;
|
|
|
- /** 예약운전 설정값 */
|
|
|
- public RESERVATION Reservation;
|
|
|
-
|
|
|
- public RoomData()
|
|
|
- {
|
|
|
- Mode = MODE.HeatingOFF;
|
|
|
- bValveStatus = false;
|
|
|
- SetTemp = 10.0;
|
|
|
- NowTemp = 15.0;
|
|
|
- Error = new ERROR();
|
|
|
- Sleep = new SLEEP();
|
|
|
- Reservation = new RESERVATION();
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString(byte RoomIndex)
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "RoomData (" + (int) (RoomIndex+1) + ") \r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "Mode : " + MODE.ToDebugString(Mode) + "\r\n" +
|
|
|
- "bValveStatus : " + bValveStatus + "\r\n" +
|
|
|
- "SetTemp : " + SetTemp + "\r\n" +
|
|
|
- "NowTemp : " + NowTemp + "\r\n" +
|
|
|
- "Error : " + Error.ToDebugString() + "\r\n" +
|
|
|
- "Sleep : " + Sleep.ToDebugString() + "\r\n" +
|
|
|
- "Reservation : " + Reservation.ToDebugString() + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 각 방 제어용 데이터 */
|
|
|
- public static class CtrlRoomData
|
|
|
- {
|
|
|
- /** 운전모드 {@link MODE} 값에 따름 */
|
|
|
- public byte Mode;
|
|
|
- /** 설정온도 ( 0.5도 혹은 1도 단위) */
|
|
|
- public double SetTemp;
|
|
|
- /** 취침운전 설정값 */
|
|
|
- public SLEEP Sleep;
|
|
|
- /** 예약운전 설정값 */
|
|
|
- public RESERVATION Reservation;
|
|
|
-
|
|
|
- public CtrlRoomData()
|
|
|
- {
|
|
|
- Mode = MODE.Idle;
|
|
|
- SetTemp = 0;
|
|
|
- Sleep = new SLEEP();
|
|
|
- Reservation = new RESERVATION();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 설정시간 */
|
|
|
- public static class SET_TIME
|
|
|
- {
|
|
|
- /** 30분 (ture : 30분, false : 정각) */
|
|
|
- public boolean bMinute30;
|
|
|
- /** 시간 (범위 : 0x03 - 3시 ~ 0x0C - 12시 ) */
|
|
|
- public byte Hour;
|
|
|
-
|
|
|
- public SET_TIME()
|
|
|
- {
|
|
|
- bMinute30 = false;
|
|
|
- Hour = 0;
|
|
|
- }
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString()
|
|
|
- {
|
|
|
- if(bMinute30) return String.format("%d:30", Hour);
|
|
|
- else return String.format("%d:00", Hour);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 에러코드 */
|
|
|
- public static class ERROR
|
|
|
- {
|
|
|
- /** 온도조절기 통신이상 ( true : 이상, false : 정상) */
|
|
|
- public boolean bRoomComm;
|
|
|
- /** 온도조절기 온도센서 이상 ( true : 이상, false : 정상) */
|
|
|
- public boolean bRoomTempSensor;
|
|
|
- /** 온도조절기 시스템 이상 ( true : 이상, false : 정상) */
|
|
|
- public boolean bRoomSystem;
|
|
|
- /** 밸브제어기 온도센서 이상 ( true : 이상, false : 정상) */
|
|
|
- public boolean bMainTempSensor;
|
|
|
- /** 밸브제어기 시스템 이상 ( true : 이상, false : 정상) */
|
|
|
- public boolean bMainSystem;
|
|
|
- /** 보일러 이상 ( true : 이상, false : 정상) */
|
|
|
- public boolean bBoiler;
|
|
|
- /** 누수 이상 ( true : 이상, false : 정상) */
|
|
|
- public boolean bLeak;
|
|
|
- /** 기타이상 ( true : 이상, false : 정상) */
|
|
|
- public boolean bEtc;
|
|
|
-
|
|
|
- public ERROR()
|
|
|
- {
|
|
|
- bRoomComm = false;
|
|
|
- bRoomTempSensor = false;
|
|
|
- bRoomSystem = false;
|
|
|
- bMainTempSensor = false;
|
|
|
- bMainSystem = false;
|
|
|
- bBoiler = false;
|
|
|
- bLeak = false;
|
|
|
- bEtc = false;
|
|
|
- }
|
|
|
-
|
|
|
- public byte getByte()
|
|
|
- {
|
|
|
- byte ret = 0x00;
|
|
|
-
|
|
|
- if(bRoomComm) ret |= define.BIT0;
|
|
|
- if(bRoomTempSensor) ret |= define.BIT1;
|
|
|
- if(bRoomSystem) ret |= define.BIT2;
|
|
|
- if(bMainTempSensor) ret |= define.BIT3;
|
|
|
- if(bMainSystem) ret |= define.BIT4;
|
|
|
- if(bBoiler) ret |= define.BIT5;
|
|
|
- if(bLeak) ret |= define.BIT6;
|
|
|
- if(bEtc) ret |= define.BIT7;
|
|
|
-
|
|
|
- return ret;
|
|
|
- }
|
|
|
-
|
|
|
- public void setByte(byte in)
|
|
|
- {
|
|
|
- if((in&0x01) != 0x00) bRoomComm = true;
|
|
|
- else bRoomComm = false;
|
|
|
- if((in&0x02) != 0x00) bRoomTempSensor = true;
|
|
|
- else bRoomTempSensor = false;
|
|
|
- if((in&0x04) != 0x00) bRoomSystem = true;
|
|
|
- else bRoomSystem = false;
|
|
|
- if((in&0x08) != 0x00) bMainTempSensor = true;
|
|
|
- else bMainTempSensor = false;
|
|
|
- if((in&0x10) != 0x00) bMainSystem = true;
|
|
|
- else bMainSystem = false;
|
|
|
- if((in&0x20) != 0x00) bBoiler = true;
|
|
|
- else bBoiler = false;
|
|
|
- if((in&0x40) != 0x00) bLeak = true;
|
|
|
- else bLeak = false;
|
|
|
- if((in&0x80) != 0x00) bEtc = true;
|
|
|
- else bEtc = false;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString()
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "bRoomComm:" + ToStrBoolean(bRoomComm) + " , " +
|
|
|
- "bRoomTempSensor:" + ToStrBoolean(bRoomTempSensor) + " , " +
|
|
|
- "bRoomSystem:" + ToStrBoolean(bRoomSystem) + " , " +
|
|
|
- "bMainTempSensor:" + ToStrBoolean(bMainTempSensor) + " , " +
|
|
|
- "bMainSystem:" + ToStrBoolean(bMainSystem) + " , " +
|
|
|
- "bBoiler:" + ToStrBoolean(bBoiler) + " , " +
|
|
|
- "bLeak:" + ToStrBoolean(bLeak) + " , " +
|
|
|
- "bEtc:" + ToStrBoolean(bEtc);
|
|
|
-
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
- private String ToStrBoolean(boolean in) { if(in) return "O"; else return "X"; }
|
|
|
- }
|
|
|
-
|
|
|
- /** 취침운전 */
|
|
|
- public static class SLEEP
|
|
|
- {
|
|
|
- /** 기능 지원여부 or 사용여부 */
|
|
|
- private boolean SupportNUse;
|
|
|
- /** 기능 지원여부 or 사용여부 */
|
|
|
- public boolean getSupportNUse() { return SupportNUse; }
|
|
|
-
|
|
|
- //////////////////////////////////////////////
|
|
|
- // 취침 운전시간
|
|
|
- //////////////////////////////////////////////
|
|
|
- private byte Time;
|
|
|
-
|
|
|
- /** 시간데이터를 가져온다. 프로토콜상 byte 데이터*/
|
|
|
- public byte getTime() { return Time; }
|
|
|
- /** 시간데이터를 가져온다. String 데이터로*/
|
|
|
- public String getTimeStr()
|
|
|
- {
|
|
|
- String [] str = new String []
|
|
|
- {"미설정", "3시간", "3시간30분", "4시간", "4시간30분", "5시간", "5시간30분", "6시간", "6시간30분",
|
|
|
- "7시간", "7시간30분", "8시간", "8시간30분", "9시간", "9시간30분", "10시간", "10시간30분",
|
|
|
- "11시간", "11시간30분", "12시간" };
|
|
|
-
|
|
|
- try { return str[Time]; }
|
|
|
- catch (RuntimeException re) {
|
|
|
- LogUtil.errorLogInfo("", "", re);
|
|
|
- }
|
|
|
- catch (Exception e)
|
|
|
- {
|
|
|
- Log.e("DataClasses", "[getTimeStr]");
|
|
|
- //e.printStackTrace();
|
|
|
- LogUtil.errorLogInfo("", "", e);
|
|
|
- }
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
- public boolean setTime(byte setTime)
|
|
|
- {
|
|
|
- if( (setTime < 0) || (setTime > 19) ) return false;
|
|
|
- Time = setTime;
|
|
|
- CheckSupportNUse();
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- public void setTimeIncrease() { if(++Time > 19) Time = 1; CheckSupportNUse(); }
|
|
|
- public void setTimeDecrease() { if(--Time <= 0) Time = 19; CheckSupportNUse(); }
|
|
|
-
|
|
|
- //////////////////////////////////////////////
|
|
|
- // 취침 설정온도
|
|
|
- //////////////////////////////////////////////
|
|
|
- private byte Temp;
|
|
|
-
|
|
|
- public byte getTemp() { return Temp; }
|
|
|
-
|
|
|
- public double getTempDouble()
|
|
|
- {
|
|
|
- double [] tempArray = new double [] { 0.0, 0.5, 1.0, 1.5 };
|
|
|
-
|
|
|
- try { return tempArray[Temp]; }
|
|
|
- catch (RuntimeException re) {
|
|
|
- LogUtil.errorLogInfo("", "", re);
|
|
|
- }
|
|
|
- catch (Exception e)
|
|
|
- {
|
|
|
- Log.e("DataClasses", "[getTempDouble]");
|
|
|
- //e.printStackTrace();
|
|
|
- LogUtil.errorLogInfo("", "", e);
|
|
|
- }
|
|
|
- return 0.0;
|
|
|
- }
|
|
|
-
|
|
|
- public boolean setTemp(byte setTemp)
|
|
|
- {
|
|
|
- if( (setTemp < 0) || (setTemp > 3) ) return false;
|
|
|
- Temp = setTemp;
|
|
|
- CheckSupportNUse();
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- public void setTempIncrease() { if(++Temp > 3) Temp = 1; CheckSupportNUse(); }
|
|
|
- public void setTempDecrease() { if(--Temp <= 0) Temp = 3; CheckSupportNUse(); }
|
|
|
-
|
|
|
- public SLEEP()
|
|
|
- {
|
|
|
- SupportNUse = false;
|
|
|
- Time = 0;
|
|
|
- Temp = 0;
|
|
|
- }
|
|
|
-
|
|
|
- public byte getByte() { return (byte)(Time | (byte)(Temp<<5)); }
|
|
|
-
|
|
|
- public void setByte(byte in)
|
|
|
- {
|
|
|
- setTime((byte)(in & (byte)(define.BIT0 | define.BIT1 | define.BIT2 | define.BIT3 | define.BIT4)));
|
|
|
- setTemp((byte)((in >> 5) & (byte)(define.BIT0 | define.BIT1 | define.BIT2)));
|
|
|
- }
|
|
|
-
|
|
|
- private void CheckSupportNUse()
|
|
|
- {
|
|
|
- if((Time == 0) && (Temp == 0)) SupportNUse = false;
|
|
|
- else SupportNUse = true;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString()
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "Time : " + getTimeStr() + " , " +
|
|
|
- "Temp : " + getTempDouble() + "℃";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 예약운전 */
|
|
|
- public static class RESERVATION
|
|
|
- {
|
|
|
- /** 기능 지원여부 or 사용여부 */
|
|
|
- private boolean SupportNUse;
|
|
|
- /** 기능 지원여부 or 사용여부 */
|
|
|
- public boolean getSupportNUse() { return SupportNUse; }
|
|
|
-
|
|
|
- private boolean [] SettingInfo;
|
|
|
-
|
|
|
- public RESERVATION()
|
|
|
- {
|
|
|
- SupportNUse = false;
|
|
|
- SettingInfo = new boolean [24];
|
|
|
- for(int i=0 ; i<SettingInfo.length ; i++) SettingInfo[i] = false;
|
|
|
- }
|
|
|
-
|
|
|
- public boolean setSchedule(int index, boolean OnOff)
|
|
|
- {
|
|
|
- if( (index < 0) || (index >= 24) ) return false;
|
|
|
- if(SettingInfo == null) return false;
|
|
|
-
|
|
|
- SettingInfo[index] = OnOff;
|
|
|
- SupportNUse = true;
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- public boolean getSchedule(int index)
|
|
|
- {
|
|
|
- if( (index < 0) || (index >= 24) ) return false;
|
|
|
- if(SettingInfo == null) return false;
|
|
|
- return SettingInfo[index];
|
|
|
- }
|
|
|
-
|
|
|
- public byte [] getByte()
|
|
|
- {
|
|
|
- byte [] retArrayByte = new byte[] { 0x00, 0x00, 0x00 };
|
|
|
-
|
|
|
- if(!SupportNUse) return retArrayByte;
|
|
|
-
|
|
|
- int index = 0;
|
|
|
- for(int i=0 ; i<3 ; i++)
|
|
|
- {
|
|
|
- for(int y=0 ; y<8 ; y++)
|
|
|
- {
|
|
|
- if(SettingInfo[index++])
|
|
|
- {
|
|
|
- retArrayByte[i] |= define.BIT_ARRAY[y];
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return retArrayByte;
|
|
|
- }
|
|
|
-
|
|
|
- public void setByte(byte [] in)
|
|
|
- {
|
|
|
- if(in == null) return;
|
|
|
- if(in.length != 3) return;
|
|
|
-
|
|
|
- int SettingInfoIndex = 0;
|
|
|
- boolean OnOff = false;
|
|
|
- byte data;
|
|
|
- for(int cnt=0 ; cnt<3 ; cnt++)
|
|
|
- {
|
|
|
- data = in[cnt];
|
|
|
- for(int i=0 ; i<8 ; i++)
|
|
|
- {
|
|
|
- if( (data & define.BIT_ARRAY[i]) != 0x00) OnOff = true;
|
|
|
- else OnOff = false;
|
|
|
- setSchedule(SettingInfoIndex++, OnOff);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public int getInt()
|
|
|
- {
|
|
|
- int retInt = 0;
|
|
|
-
|
|
|
- if(!SupportNUse) return retInt;
|
|
|
-
|
|
|
- int shift = 1;
|
|
|
- for(int i=0 ; i<24 ; i++)
|
|
|
- {
|
|
|
- if(getSchedule(i)) retInt |= shift;
|
|
|
- shift <<= 1;
|
|
|
- }
|
|
|
-
|
|
|
- return retInt;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public void setInt(int in)
|
|
|
- {
|
|
|
- int shift = 1;
|
|
|
- for(int i=0 ; i<24 ; i++)
|
|
|
- {
|
|
|
- if((in & shift) != 0) setSchedule(i, true);
|
|
|
- else setSchedule(i, false);
|
|
|
-
|
|
|
- shift <<= 1;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString()
|
|
|
- {
|
|
|
- if(SettingInfo == null) return "null";
|
|
|
- if(!SupportNUse) return "NotSupport";
|
|
|
- String retStr = "|";
|
|
|
- for(int i=0 ; i<SettingInfo.length ; i++)
|
|
|
- {
|
|
|
- if(SettingInfo[i]) retStr += "O";
|
|
|
- else retStr += "X";
|
|
|
-
|
|
|
- if(i==5 || i==11 || i==17) retStr += "|";
|
|
|
- }
|
|
|
- retStr += "|";
|
|
|
-
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 운전상태 정의 */
|
|
|
- public static class MODE
|
|
|
- {
|
|
|
- /** 미설정 ( * 설정전용 : 읽기시 해당없음) */
|
|
|
- public static byte Idle = 0x00;
|
|
|
- /** 난방 ON */
|
|
|
- public static byte HeatingON = 0x01;
|
|
|
- /** 난방 OFF */
|
|
|
- public static byte HeatingOFF = 0x02;
|
|
|
- /** 외출 */
|
|
|
- public static byte Outing = 0x03;
|
|
|
- /** 외출해제 ( * 설정전용 : 읽기시 해당없음) */
|
|
|
- public static byte OutingRelease = 0x04;
|
|
|
- /** 취침 */
|
|
|
- public static byte Sleep = 0x05;
|
|
|
- /** 예약 */
|
|
|
- public static byte Reservation = 0x06;
|
|
|
- /** 일시정지 */
|
|
|
- public static byte Pause = 0x07;
|
|
|
- /** 일시정지 해제 ( * 설정전용 : 읽기시 해당없음) */
|
|
|
- public static byte PauseRelease = 0x08;
|
|
|
-
|
|
|
- public static String ToDebugString(byte Mode)
|
|
|
- {
|
|
|
- String retStr;
|
|
|
- if(Mode == MODE.Idle) retStr = "Idle";
|
|
|
- else if(Mode == MODE.HeatingON) retStr = "HeatingON";
|
|
|
- else if(Mode == MODE.HeatingOFF) retStr = "HeatingOFF";
|
|
|
- else if(Mode == MODE.Outing) retStr = "Outing";
|
|
|
- else if(Mode == MODE.OutingRelease) retStr = "OutingRelease";
|
|
|
- else if(Mode == MODE.Sleep) retStr = "Sleep";
|
|
|
- else if(Mode == MODE.Reservation) retStr = "Reservation";
|
|
|
- else if(Mode == MODE.Pause) retStr = "Pause";
|
|
|
- else if(Mode == MODE.PauseRelease) retStr = "PauseRelease";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 읽기운전모드 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param Mode - (byte) 체크할 운전모드
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckGetMode(byte Mode)
|
|
|
- {
|
|
|
- if(Mode == MODE.Idle) return false;
|
|
|
- else if(Mode == MODE.HeatingON) return true;
|
|
|
- else if(Mode == MODE.HeatingOFF) return true;
|
|
|
- else if(Mode == MODE.Outing) return true;
|
|
|
- else if(Mode == MODE.OutingRelease) return false;
|
|
|
- else if(Mode == MODE.Sleep) return true;
|
|
|
- else if(Mode == MODE.Reservation) return true;
|
|
|
- else if(Mode == MODE.Pause) return true;
|
|
|
- else if(Mode == MODE.PauseRelease) return false;
|
|
|
-
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 설정운전모드 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param Mode - (byte) 체크할 운전모드
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckSetMode(byte Mode)
|
|
|
- {
|
|
|
- if(Mode == MODE.Idle) return true;
|
|
|
- else if(Mode == MODE.HeatingON) return true;
|
|
|
- else if(Mode == MODE.HeatingOFF) return true;
|
|
|
- else if(Mode == MODE.Outing) return true;
|
|
|
- else if(Mode == MODE.OutingRelease) return true;
|
|
|
- else if(Mode == MODE.Sleep) return true;
|
|
|
- else if(Mode == MODE.Reservation) return true;
|
|
|
- else if(Mode == MODE.Pause) return true;
|
|
|
- else if(Mode == MODE.PauseRelease) return true;
|
|
|
-
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 운전모드에 따른 ON/OFF 상태를 반환한다.
|
|
|
- *
|
|
|
- * @param Mode - (byte) 입력 운전모드
|
|
|
- *
|
|
|
- * @return (boolean) ture:ON , false:OFF
|
|
|
- */
|
|
|
- public static boolean GetOnOff(byte Mode)
|
|
|
- {
|
|
|
- if(Mode == HeatingV2.MODE.HeatingON) return true;
|
|
|
- else if(Mode == HeatingV2.MODE.HeatingOFF) return false;
|
|
|
- else if(Mode == HeatingV2.MODE.Outing) return false;
|
|
|
- else if(Mode == HeatingV2.MODE.Sleep) return true;
|
|
|
- else if(Mode == HeatingV2.MODE.Reservation) return true;
|
|
|
- else if(Mode == HeatingV2.MODE.Pause) return false;
|
|
|
-
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 전체방 데이터 정의 (통신용) */
|
|
|
- public static class AllRoomData
|
|
|
- {
|
|
|
- public byte RoomCount;
|
|
|
- public EachRoomData [] Room;
|
|
|
-
|
|
|
- public AllRoomData(byte nRoomCount)
|
|
|
- {
|
|
|
- RoomCount = nRoomCount;
|
|
|
- Room = new EachRoomData[RoomCount];
|
|
|
- for(byte i=0 ; i<RoomCount ; i++) Room[i] = new EachRoomData();
|
|
|
- }
|
|
|
-
|
|
|
- public class EachRoomData
|
|
|
- {
|
|
|
- ////////////////////////////////////////////
|
|
|
- // 기본기능
|
|
|
- ////////////////////////////////////////////
|
|
|
- /** 운전모드 {@link MODE} 값에 따름 */
|
|
|
- public byte Mode;
|
|
|
- /** 밸브상태 ( ture : 열림, false : 닫힘 ) */
|
|
|
- public boolean bValveStatus;
|
|
|
- /** 설정온도 ( 0.5도 혹은 1도 단위) */
|
|
|
- public double SetTemp;
|
|
|
- /** 현재온도 */
|
|
|
- public double NowTemp;
|
|
|
-
|
|
|
- public EachRoomData()
|
|
|
- {
|
|
|
- Mode = MODE.HeatingOFF;
|
|
|
- bValveStatus = false;
|
|
|
- SetTemp = 10.0;
|
|
|
- NowTemp = 15.0;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString(byte RoomIndex)
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "RoomData (" + (int) (RoomIndex+1) + ") \r\n" +
|
|
|
- "Mode : " + MODE.ToDebugString(Mode) + " / " + "bValveStatus : " + bValveStatus + "\r\n" +
|
|
|
- "SetTemp : " + SetTemp + " / " + "NowTemp : " + NowTemp + "\r\n";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString()
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "AllRoomData\r\n" +
|
|
|
- "==========================\r\n";
|
|
|
-
|
|
|
- for(byte i=0 ; i<RoomCount ; i++)
|
|
|
- {
|
|
|
- retStr += Room[i].ToDebugString(i);
|
|
|
- }
|
|
|
-
|
|
|
- retStr += "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 보일러 관련 데이터 클래스 */
|
|
|
- public static class BoilerData
|
|
|
- {
|
|
|
- /** 동파방지모드 (true : 가동, false : 정지) */
|
|
|
- public boolean bFrostProtectMode;
|
|
|
- /** 에러코드 (0x00 정상 , 0x00 아닐경우 에러코드 */
|
|
|
- public byte ErrorCode;
|
|
|
- /** 난방수 설정온도 관련 */
|
|
|
- public SetTempData HeatingWater;
|
|
|
- /** 온수 설정온도 관련 */
|
|
|
- public SetTempData HotWater;
|
|
|
-
|
|
|
- public BoilerData()
|
|
|
- {
|
|
|
- bFrostProtectMode = false;
|
|
|
- ErrorCode = 0x00;
|
|
|
- HeatingWater = new SetTempData();
|
|
|
- HotWater = new SetTempData();
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString()
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "BoilerData\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "bFrostProtectMode : " + bFrostProtectMode + "\r\n" +
|
|
|
- "ErrorCode : " + String.format("0x%02X", ErrorCode) + "\r\n" +
|
|
|
- "HeatingWater : " + HeatingWater.ToDebugString() + "\r\n" +
|
|
|
- "HotWater : " + HotWater.ToDebugString() + "\r\n" +
|
|
|
- "==========================\r\n";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
- public class SetTempData
|
|
|
- {
|
|
|
- /** 설정온도 단위 (false : 1도단위 , true : 5도 단위) */
|
|
|
- public boolean bSetTempUnit5;
|
|
|
- /** 설정온도 */
|
|
|
- public byte SetTemp;
|
|
|
- /** 최저 설정온도 */
|
|
|
- public byte MinSetTemp;
|
|
|
- /** 최대 설정온도 */
|
|
|
- public byte MaxSetTemp;
|
|
|
-
|
|
|
- public SetTempData()
|
|
|
- {
|
|
|
- bSetTempUnit5 = false;
|
|
|
- SetTemp = 0;
|
|
|
- MinSetTemp = 0;
|
|
|
- MaxSetTemp = 0;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString()
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "bSetTempUnit5 : " + bSetTempUnit5 + " / SetTemp : " + SetTemp + " / MinSetTemp : " + MinSetTemp + " / MaxSetTemp : " + MaxSetTemp + "\r\n";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 특화기능 관련 데이터 클래스 */
|
|
|
- public static class SpecialFuncData
|
|
|
- {
|
|
|
- /** 인공지능 동작모드 - {@link AIMODE} */
|
|
|
- public byte Mode;
|
|
|
- /** 설정된 외기온도 */
|
|
|
- public double OutsideTemp;
|
|
|
-
|
|
|
- public SpecialFuncData()
|
|
|
- {
|
|
|
- Mode = AIMODE.OFF;
|
|
|
- OutsideTemp = 0;
|
|
|
- }
|
|
|
-
|
|
|
- /** 인공 지능 동작모드 */
|
|
|
- public static class AIMODE
|
|
|
- {
|
|
|
- /** 미설정 ( * 설정전용 : 읽기시 해당없음) */
|
|
|
- public static byte Idle = (byte)0x00;
|
|
|
- /** ON */
|
|
|
- public static byte ON = (byte)0x01;
|
|
|
- /** OFF */
|
|
|
- public static byte OFF = (byte)0x02;
|
|
|
-
|
|
|
- public static String ToDebugString(byte Mode)
|
|
|
- {
|
|
|
- String retStr;
|
|
|
- if(Mode == AIMODE.Idle) retStr = "Idle";
|
|
|
- else if(Mode == AIMODE.ON) retStr = "ON";
|
|
|
- else if(Mode == AIMODE.OFF) retStr = "OFF";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
- public static boolean CheckGetMode(byte Mode)
|
|
|
- {
|
|
|
- if(Mode == AIMODE.Idle) return false;
|
|
|
- else if(Mode == AIMODE.ON) return true;
|
|
|
- else if(Mode == AIMODE.OFF) return true;
|
|
|
-
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- public static boolean CheckSetMode(byte Mode)
|
|
|
- {
|
|
|
- if(Mode == AIMODE.Idle) return true;
|
|
|
- else if(Mode == AIMODE.ON) return true;
|
|
|
- else if(Mode == AIMODE.OFF) return true;
|
|
|
-
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString()
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "SpecialFuncData\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "AIMode : " + AIMODE.ToDebugString(Mode) + "\r\n" +
|
|
|
- "OutsideTemp : " + OutsideTemp + "\r\n" +
|
|
|
- "==========================\r\n";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /** [실시간검침기] 데이터 클래스 */
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- public static class RealTimeMeter {
|
|
|
- public class EachDataList {
|
|
|
- /** 지원여부 */
|
|
|
- public boolean Support;
|
|
|
- /** 누적사용량 */
|
|
|
- public double Acc;
|
|
|
- /** 현재사용량 */
|
|
|
- public double Now;
|
|
|
-
|
|
|
- public EachDataList() {
|
|
|
- Support = false;
|
|
|
- Acc = 0.0;
|
|
|
- Now = 0.0;
|
|
|
- }
|
|
|
-
|
|
|
- public void Input(boolean nSupport, double nAcc, double nNow) {
|
|
|
- Support = nSupport;
|
|
|
- Acc = nAcc;
|
|
|
- Now = nNow;
|
|
|
- }
|
|
|
-
|
|
|
- public String ToDebugString() {
|
|
|
- return "Support : " + Support + " / Acc : " + Acc + " / Now : " + Now;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 전력 */
|
|
|
- public EachDataList Elec;
|
|
|
- /** 수도 */
|
|
|
- public EachDataList Water;
|
|
|
- /** 온수 */
|
|
|
- public EachDataList HotWater;
|
|
|
- /** 가스 */
|
|
|
- public EachDataList Gas;
|
|
|
- /** 열량 */
|
|
|
- public EachDataList Calorie;
|
|
|
-
|
|
|
- // 연속으로 에러가 수신되는 경우 +1을 하여, 3회 이상이면 알람을 발생시킴
|
|
|
- /** 전력 측정 이상 */
|
|
|
- public int nElecErrorCnt;
|
|
|
- /** 수도 측정 이상 */
|
|
|
- public int nWaterErrorCnt;
|
|
|
- /** 온수 측정 이상 */
|
|
|
- public int nHotWaterErrorCnt;
|
|
|
- /** 가스 측정 이상 */
|
|
|
- public int nGasErrorCnt;
|
|
|
- /** 열량 측정 이상 */
|
|
|
- public int nHeatingErrorCnt;
|
|
|
-
|
|
|
- /** 생성자 */
|
|
|
- public RealTimeMeter() {
|
|
|
- Elec = new EachDataList();
|
|
|
- Water = new EachDataList();
|
|
|
- HotWater = new EachDataList();
|
|
|
- Gas = new EachDataList();
|
|
|
- Calorie = new EachDataList();
|
|
|
- nElecErrorCnt = 0;
|
|
|
- nWaterErrorCnt = 0;
|
|
|
- nHotWaterErrorCnt = 0;
|
|
|
- nGasErrorCnt = 0;
|
|
|
- nHeatingErrorCnt = 0;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 전기,수도,온수,가스,열량 5종 모두의 지원여부를 체크한다.
|
|
|
- *
|
|
|
- * @return (boolean) true : 5종, false : 5종아님
|
|
|
- */
|
|
|
- public boolean GetAllSupport() {
|
|
|
- if (Elec.Support && Water.Support && HotWater.Support && Gas.Support && Calorie.Support) return true;
|
|
|
- else return false;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString() {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "RealTimeMeter\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "Elec - " + Elec.ToDebugString() + "\r\n" +
|
|
|
- "Water - " + Water.ToDebugString() + "\r\n" +
|
|
|
- "HotWater - " + HotWater.ToDebugString() + "\r\n" +
|
|
|
- "Gas - " + Gas.ToDebugString() + "\r\n" +
|
|
|
- "Calorie - " + Calorie.ToDebugString() + "\r\n" +
|
|
|
- "nElecErrorCnt: " + nElecErrorCnt + "\r\n" +
|
|
|
- "nWaterErrorCnt: " + nWaterErrorCnt + "\r\n" +
|
|
|
- "nHotWaterErrorCnt: " + nHotWaterErrorCnt + "\r\n" +
|
|
|
- "nGasErrorCnt: " + nGasErrorCnt + "\r\n" +
|
|
|
- "nHeatingErrorCnt: " + nHeatingErrorCnt + "\r\n" +
|
|
|
- "==========================";
|
|
|
-
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /** [환기] 데이터 클래스 */
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- public static class Venti {
|
|
|
- /** ON/OFF 상태 */
|
|
|
- public boolean OnOff;
|
|
|
-
|
|
|
- /** 예약운전 상태 */
|
|
|
- public boolean Reservation;
|
|
|
-
|
|
|
- /** 바람세기 상태 */
|
|
|
- public byte Wind;
|
|
|
-
|
|
|
- /** 취침모드 상태 */
|
|
|
- public byte Sleep;
|
|
|
-
|
|
|
- /** 외부제어 상태 */
|
|
|
- public byte EtcCtr;
|
|
|
-
|
|
|
- /** 타이머 설정값 남은시간 */
|
|
|
- public int Timer;
|
|
|
-
|
|
|
- /** 기기 이상 상태 */
|
|
|
- public FAULT Fault;
|
|
|
-
|
|
|
- /** 기기정보 */
|
|
|
- public SUPPORT Support;
|
|
|
-
|
|
|
- /** 기기정보2 */
|
|
|
- public SUPPORT2 Support2;
|
|
|
-
|
|
|
- /** 자연환기 (바이패스)상태 */
|
|
|
- public boolean ByPass;
|
|
|
-
|
|
|
- /** 히터 가동 남은시간 */
|
|
|
- public byte HeaterTimeRemaining;
|
|
|
-
|
|
|
- /** 히터 상태 */
|
|
|
- public byte HeaterStatus;
|
|
|
-
|
|
|
- /** 자동환기 상태 */
|
|
|
- public boolean AutoDriving;
|
|
|
-
|
|
|
- /** 욕실배기 상태 */
|
|
|
- public boolean BathRoom;
|
|
|
-
|
|
|
- /** 내부순환 상태 */
|
|
|
- public boolean InnerCycle;
|
|
|
-
|
|
|
- /** 외기청정 상태 */
|
|
|
- public boolean OutAirClean;
|
|
|
-
|
|
|
- /** 공기청정 자동상태 */
|
|
|
- public boolean AirCleanAuto;
|
|
|
-
|
|
|
- /** 현산 미세먼지센서 연동 공기청정 자동상태 */
|
|
|
- public boolean HDCAutoAirClean;
|
|
|
-
|
|
|
- public Venti() {
|
|
|
- OnOff = false;
|
|
|
- Reservation = false;
|
|
|
- Wind = 0x01;
|
|
|
- ByPass = false;
|
|
|
- AutoDriving = false;
|
|
|
- BathRoom = false;
|
|
|
- InnerCycle = false;
|
|
|
- OutAirClean = false;
|
|
|
- AirCleanAuto = false;
|
|
|
- HDCAutoAirClean = false;
|
|
|
- Sleep = 0x00;
|
|
|
- HeaterStatus = HEATER.NOT_SUPPORT;
|
|
|
- HeaterTimeRemaining = 0;
|
|
|
- EtcCtr = 0x00;
|
|
|
- Timer = 0;
|
|
|
- Fault = new FAULT((byte)0x00);
|
|
|
- Support = new SUPPORT((byte)0x00);
|
|
|
- Support2 = new SUPPORT2((byte)0x00);
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString() {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "STATUS\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "OnOff : " + OnOff + "\r\n" +
|
|
|
- "Reservation : " + Reservation + "\r\n" +
|
|
|
- "Wind : " + WIND.ToDebugString(Wind) + "\r\n" +
|
|
|
- "ByPass : " + ByPass + "\r\n" +
|
|
|
- "AutoDriving : " + AutoDriving + "\r\n" +
|
|
|
- "BathRoom : " + BathRoom + "\r\n" +
|
|
|
- "InnerCycle : " + InnerCycle + "\r\n" +
|
|
|
- "OutAirClean : " + OutAirClean + "\r\n" +
|
|
|
- "AirCleanAuto : " + AirCleanAuto + "\r\n" +
|
|
|
- "HDCAutoAirClean : " + HDCAutoAirClean + "\r\n" +
|
|
|
- "Sleep : " + SLEEP.ToDebugString(Sleep) + "\r\n" +
|
|
|
- "HeaterStatus : " + HEATER.ToDebugString(HeaterStatus) + "\r\n" +
|
|
|
- "HeaterTimeRemaining : " + HeaterTimeRemaining + "\r\n" +
|
|
|
- "EtcCtr : " + ETC_CTR.ToDebugString(EtcCtr) + "\r\n" +
|
|
|
- "Timer : " + Timer + "\r\n" +
|
|
|
- "Fault : " + String.format("0x%02X", Fault.FaultByte) + "\r\n" +
|
|
|
- "Support : " + String.format("0x%02X", Support.SupportByte) + "\r\n" +
|
|
|
- "Support2 : " + String.format("0x%02X", Support2.SupportByte2) + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
- /** 에러 메시지 출력 */
|
|
|
- public String ToFaultString() {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "FAULT\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "Fault : " + String.format("0x%02X", Fault.FaultByte) + "\r\n" +
|
|
|
- "FilterChangeFree : " + Fault.FilterChangeFree + "\r\n" +
|
|
|
- "FilterChangeMedium : " + Fault.FilterChangeMedium + "\r\n" +
|
|
|
- "MotorError : " + Fault.MotorError + "\r\n" +
|
|
|
- "TempSensorError : " + Fault.TempSensorError + "\r\n" +
|
|
|
- "TempSensorError : " + Fault.TempSensorError + "\r\n" +
|
|
|
- "SafeMode : " + Fault.SafeMode + "\r\n" +
|
|
|
- "SupplyFanError : " + Fault.SupplyFanError + "\r\n" +
|
|
|
- "ExhaustFanError : " + Fault.ExhaustFanError + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
- /** 바람세기 상태 */
|
|
|
- public static class WIND {
|
|
|
- /** 미 */
|
|
|
- public static byte LOW = 0x01;
|
|
|
- /** 약 */
|
|
|
- public static byte MID = 0x02;
|
|
|
- /** 강 */
|
|
|
- public static byte HI = 0x03;
|
|
|
- /** 자동 */
|
|
|
- public static byte AUTO = 0x04;
|
|
|
- /** 자연 */
|
|
|
- public static byte BYPASS = 0x05;
|
|
|
-
|
|
|
- /**
|
|
|
- * 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param nStatus - (byte) 체크할 상태
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckRange(byte nStatus) {
|
|
|
- if (nStatus == WIND.LOW) return true;
|
|
|
- else if(nStatus == WIND.MID) return true;
|
|
|
- else if(nStatus == WIND.HI) return true;
|
|
|
- else if(nStatus == WIND.AUTO) return true;
|
|
|
- else if(nStatus == WIND.BYPASS) return true;
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- public static String ToDebugString(byte nStatus) {
|
|
|
- String retStr;
|
|
|
- if (nStatus == WIND.LOW) retStr = "LOW";
|
|
|
- else if (nStatus == WIND.MID) retStr = "MID";
|
|
|
- else if (nStatus == WIND.HI) retStr = "HI";
|
|
|
- else if (nStatus == WIND.AUTO) retStr = "AUTO";
|
|
|
- else if (nStatus == WIND.BYPASS) retStr = "BYPASS";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 취침모드 상태 */
|
|
|
- public static class SLEEP {
|
|
|
- /** 취침모드 꺼짐 */
|
|
|
- public static byte SLEEP_OFF = 0x00;
|
|
|
- /** 취침모드 켜짐 */
|
|
|
- public static byte SLEEP_ON = 0x01;
|
|
|
-
|
|
|
- /**
|
|
|
- * 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param nStatus - (byte) 체크할 상태
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckRange(byte nStatus) {
|
|
|
- if (nStatus == SLEEP.SLEEP_OFF) return true;
|
|
|
- else if (nStatus == SLEEP.SLEEP_ON) return true;
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- public static String ToDebugString(byte nStatus) {
|
|
|
- String retStr;
|
|
|
- if (nStatus == SLEEP.SLEEP_OFF) retStr = "SLEEP_OFF";
|
|
|
- else if (nStatus == SLEEP.SLEEP_ON) retStr = "SLEEP_ON";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 외부제어 상태 */
|
|
|
- public static class ETC_CTR {
|
|
|
- /** 외부제어 없음 */
|
|
|
- public static byte CTR_NON = 0x00;
|
|
|
- /** 외부제어 있음 */
|
|
|
- public static byte CTR_EXIST = 0x01;
|
|
|
-
|
|
|
- /**
|
|
|
- * 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param nStatus - (byte) 체크할 상태
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckRange(byte nStatus) {
|
|
|
- if (nStatus == ETC_CTR.CTR_NON) return true;
|
|
|
- else if (nStatus == ETC_CTR.CTR_EXIST) return true;
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- public static String ToDebugString(byte nStatus) {
|
|
|
- String retStr;
|
|
|
- if (nStatus == ETC_CTR.CTR_NON) retStr = "CTR_NON";
|
|
|
- else if (nStatus == ETC_CTR.CTR_EXIST) retStr = "CTR_EXIST";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 히터 상태 */
|
|
|
- public static class HEATER {
|
|
|
- /** 꺼짐 */
|
|
|
- public static byte OFF = (byte) 0x00;
|
|
|
- /** 대기상태 */
|
|
|
- public static byte STAND_BY = (byte) 0x01;
|
|
|
- /** 지원하지않음 */
|
|
|
- public static byte NOT_SUPPORT = (byte) 0x02;
|
|
|
- /** 켜짐 */
|
|
|
- public static byte ON = (byte) 0x03;
|
|
|
-
|
|
|
- /**
|
|
|
- * 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param nStatus - (byte) 체크할 상태
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckRange(byte nStatus) {
|
|
|
- if (nStatus == OFF) return true;
|
|
|
- else if (nStatus == STAND_BY) return true;
|
|
|
- else if (nStatus == NOT_SUPPORT) return true;
|
|
|
- else if (nStatus == ON) return true;
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- public static String ToDebugString(byte nStatus) {
|
|
|
- String retStr;
|
|
|
- if (nStatus == OFF) retStr = "OFF";
|
|
|
- else if(nStatus == STAND_BY) retStr = "STAND_BY";
|
|
|
- else if(nStatus == NOT_SUPPORT) retStr = "NOT_SUPPORT";
|
|
|
- else if(nStatus == ON) retStr = "ON";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 기기이상 상태 */
|
|
|
- public static class FAULT {
|
|
|
- /** 필터교환 프리 */
|
|
|
- public boolean FilterChangeFree;
|
|
|
- /** 온도센서 이상 */
|
|
|
- public boolean FilterChangeMedium;
|
|
|
- /** 모터이상 */
|
|
|
- public boolean MotorError;
|
|
|
- /** 온도센서이상 */
|
|
|
- public boolean TempSensorError;
|
|
|
- /** 안전모드 */
|
|
|
- public boolean SafeMode;
|
|
|
- /** 급기팬 이상 */
|
|
|
- public boolean SupplyFanError;
|
|
|
- /** 배기팬 이상 */
|
|
|
- public boolean ExhaustFanError;
|
|
|
-
|
|
|
- public byte FaultByte;
|
|
|
-
|
|
|
- public FAULT(byte inFault) {
|
|
|
- FaultByte = inFault;
|
|
|
- if ((inFault& define.BIT0) != 0x00) FilterChangeFree = true;
|
|
|
- else FilterChangeFree = false;
|
|
|
- if ((inFault& define.BIT1) != 0x00) FilterChangeMedium = true;
|
|
|
- else FilterChangeMedium = false;
|
|
|
- if ((inFault&define.BIT2) != 0x00) MotorError = true;
|
|
|
- else MotorError = false;
|
|
|
- if ((inFault&define.BIT3) != 0x00) TempSensorError = true;
|
|
|
- else TempSensorError = false;
|
|
|
- if ((inFault&define.BIT4) != 0x00) SafeMode = true;
|
|
|
- else SafeMode = false;
|
|
|
- if ((inFault&define.BIT5) != 0x00) SupplyFanError = true;
|
|
|
- else SupplyFanError = false;
|
|
|
- if ((inFault&define.BIT6) != 0x00) ExhaustFanError = true;
|
|
|
- else ExhaustFanError = false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 기기정보 */
|
|
|
- public static class SUPPORT {
|
|
|
- /** 필터교환 프리 */
|
|
|
- public boolean RoomController;
|
|
|
- /** 자연환기(바이패스) */
|
|
|
- public boolean ByPass;
|
|
|
- /** 히터 */
|
|
|
- public boolean Heater;
|
|
|
- /** 필터교환 리셋 */
|
|
|
- public boolean FilterReset;
|
|
|
- /** 자동환기 연동 */
|
|
|
- public boolean AutoDriving;
|
|
|
- /** 욕실 배기 연동 */
|
|
|
- public boolean BathRoom;
|
|
|
- /** 내부순환 상태 */
|
|
|
- public boolean InnerCycle;
|
|
|
- /** 외기청정 상태 */
|
|
|
- public boolean OutAirClean;
|
|
|
-
|
|
|
- public byte SupportByte;
|
|
|
-
|
|
|
- public SUPPORT(byte inSupport) {
|
|
|
- SupportByte = inSupport;
|
|
|
- if ((inSupport& define.BIT0) != 0x00) RoomController = true;
|
|
|
- else RoomController = false;
|
|
|
- if ((inSupport& define.BIT1) != 0x00) ByPass = true;
|
|
|
- else ByPass = false;
|
|
|
- if ((inSupport&define.BIT2) != 0x00) Heater = true;
|
|
|
- else Heater = false;
|
|
|
- if ((inSupport&define.BIT3) != 0x00) FilterReset = true;
|
|
|
- else FilterReset = false;
|
|
|
- if ((inSupport&define.BIT4) != 0x00) AutoDriving = true;
|
|
|
- else AutoDriving = false;
|
|
|
- if ((inSupport&define.BIT5) != 0x00) BathRoom = true;
|
|
|
- else BathRoom = false;
|
|
|
- if ((inSupport&define.BIT6) != 0x00) InnerCycle = true;
|
|
|
- else InnerCycle = false;
|
|
|
- if ((inSupport&define.BIT7) != 0x00) OutAirClean = true;
|
|
|
- else OutAirClean = false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 기기정보 */
|
|
|
- public static class SUPPORT2 {
|
|
|
- /** 창호환기 연동 */
|
|
|
- public boolean WindowVenti;
|
|
|
- /** 취침모드 연동 */
|
|
|
- public boolean SleepMode;
|
|
|
- /** 풍량0단계 사용 */
|
|
|
- public boolean Wind0Use;
|
|
|
-
|
|
|
- public byte SupportByte2;
|
|
|
-
|
|
|
- public SUPPORT2(byte Support2) {
|
|
|
- SupportByte2 = Support2;
|
|
|
- if ((Support2& define.BIT0) != 0x00) WindowVenti = true;
|
|
|
- else WindowVenti = false;
|
|
|
- if ((Support2& define.BIT1) != 0x00) SleepMode = true;
|
|
|
- else SleepMode = false;
|
|
|
- if ((Support2& define.BIT2) != 0x00) Wind0Use = true;
|
|
|
- else Wind0Use = false;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /** [대외향 - 거실조명제어기] 데이터 클래스 */
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- public static class Light {
|
|
|
- /** 조명 개수 */
|
|
|
- public int LightCount;
|
|
|
-
|
|
|
- /** 조명 ONOFF 상태 */
|
|
|
- public boolean [] OnOff;
|
|
|
-
|
|
|
- /** 이상상태 */
|
|
|
- public boolean Fault;
|
|
|
-
|
|
|
- /** 생성자 */
|
|
|
- public Light() {
|
|
|
- LightCount = 0;
|
|
|
- OnOff = new boolean [8];
|
|
|
- for (int i = 0; i < OnOff.length; i++) OnOff[i] = false;
|
|
|
- Fault = false;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString() {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "STATUS\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "Count : " + LightCount + "\r\n" +
|
|
|
- "Fault : " + Fault + "\r\n";
|
|
|
-
|
|
|
- for (int i = 0; i < LightCount; i++) {
|
|
|
- retStr += "[" + (int)(i+1) + "]";
|
|
|
- if (OnOff[i]) retStr += "O ";
|
|
|
- else retStr += "X ";
|
|
|
- retStr += " ";
|
|
|
- }
|
|
|
- retStr += "\r\n";
|
|
|
- retStr += "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /** [전기레인지] 데이터 클래스 */
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- public static class ElectricRange
|
|
|
- {
|
|
|
- public Info info;
|
|
|
- public Device device;
|
|
|
-
|
|
|
- /**
|
|
|
- * 생성자<br>
|
|
|
- */
|
|
|
- public ElectricRange()
|
|
|
- {
|
|
|
- info = new Info();
|
|
|
- setCount((byte)0);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 화구 개수를 설정한다.
|
|
|
- *
|
|
|
- * @param nFireCount - (byte) 설정할 화구 개수 (범위 : 1 ~ 8)
|
|
|
- */
|
|
|
- public void setCount(byte nFireCount )
|
|
|
- {
|
|
|
- if(info == null) return;
|
|
|
-
|
|
|
- // 1. 화구 개수
|
|
|
- if(nFireCount >= 1) info.FireHoleCount = nFireCount;
|
|
|
- else info.FireHoleCount = 0;
|
|
|
-
|
|
|
- // 2. new device
|
|
|
- device = new Device(info.FireHoleCount);
|
|
|
- }
|
|
|
-
|
|
|
- /** 전기레인지 보드정보 */
|
|
|
- public static class Info
|
|
|
- {
|
|
|
- /** 설치상태 (true:설치 , false:미설치) */
|
|
|
- public boolean Install;
|
|
|
- /** 기기정보 */
|
|
|
- public SUPPORT Support;
|
|
|
- /** 설치된 화구 개수 (범위 : 1 ~ 8)*/
|
|
|
- public byte FireHoleCount;
|
|
|
- /** 제조사 코드 ( 0x01 : 쿠첸 ) */
|
|
|
- public byte Vender;
|
|
|
- /** 펌웨어 Build Date (년) */
|
|
|
- public byte FwVer_Year;
|
|
|
- /** 펌웨어 Build Date (월) */
|
|
|
- public byte FwVer_Month;
|
|
|
- /** 펌웨어 Build Date (일) */
|
|
|
- public byte FwVer_Day;
|
|
|
- /** 펌웨어 Build Date (일련번호) */
|
|
|
- public byte FwVer_Number;
|
|
|
-
|
|
|
- /** 지원 프로토콜 버전 Main */
|
|
|
- public byte ProtocolVer_Main;
|
|
|
- /** 지원 프로토콜 버전 Sub */
|
|
|
- public byte ProtocolVer_Sub;
|
|
|
-
|
|
|
- /** 모델명 */
|
|
|
- public byte Model_Number;
|
|
|
-
|
|
|
- public Info()
|
|
|
- {
|
|
|
- Install = false;
|
|
|
- Support = new SUPPORT((byte)0x00);
|
|
|
-
|
|
|
- FireHoleCount = 0;
|
|
|
-
|
|
|
- Vender = 0x00;
|
|
|
-
|
|
|
- FwVer_Year = 0x00;
|
|
|
- FwVer_Month = 0x00;
|
|
|
- FwVer_Day = 0x00;
|
|
|
- FwVer_Number = 0x00;
|
|
|
-
|
|
|
- ProtocolVer_Main = 0x00;
|
|
|
- ProtocolVer_Sub = 0x00;
|
|
|
-
|
|
|
- Model_Number = 0x00;
|
|
|
- }
|
|
|
-
|
|
|
- public String ToDebugString(byte DeviceIdx)
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "(" + (byte)(DeviceIdx + 1) + ") Device - Info\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "FireHoleCount : " + FireHoleCount + "\r\n" +
|
|
|
- "Vender : " + String.format("0x%02X", Vender) + "\r\n" +
|
|
|
- "Model_Number : " + Model_Number + "\r\n" +
|
|
|
- "FwVer : " + (int)(FwVer_Year+2000) + "." + FwVer_Month + "." + FwVer_Day + "." + FwVer_Number + "\r\n" +
|
|
|
- "ProtocolVer : " + "V" + ProtocolVer_Main + "." + ProtocolVer_Sub + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 기기정보 */
|
|
|
- public static class SUPPORT
|
|
|
- {
|
|
|
- /** 화구 OFF 제어 */
|
|
|
- public boolean OnOffCtr;
|
|
|
- /** 인덕션 있음 */
|
|
|
- public boolean InductionExist;
|
|
|
- /** 화구 세기 조절(ON 포함) */
|
|
|
- public boolean FireLevelCtr;
|
|
|
- /** 소비전력 측정 */
|
|
|
- public boolean ConsumeElecMeasure;
|
|
|
-
|
|
|
- public byte SupportByte;
|
|
|
-
|
|
|
- public SUPPORT(byte inSupport)
|
|
|
- {
|
|
|
- SupportByte = inSupport;
|
|
|
- if((inSupport& define.BIT0) != 0x00) OnOffCtr = true;
|
|
|
- else OnOffCtr = false;
|
|
|
- if((inSupport& define.BIT1) != 0x00) InductionExist = true;
|
|
|
- else InductionExist = false;
|
|
|
- if((inSupport&define.BIT2) != 0x00) FireLevelCtr = true;
|
|
|
- else FireLevelCtr = false;
|
|
|
- if((inSupport&define.BIT3) != 0x00) ConsumeElecMeasure = true;
|
|
|
- else ConsumeElecMeasure = false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 기기이상 상태 */
|
|
|
- public static class FAULT
|
|
|
- {
|
|
|
- /** 휴즈 고장 */
|
|
|
- public boolean FuseError;
|
|
|
- /** 센서 고장 */
|
|
|
- public boolean SensorError;
|
|
|
-
|
|
|
- public byte FaultByte;
|
|
|
-
|
|
|
- public FAULT(byte inFault)
|
|
|
- {
|
|
|
- FaultByte = inFault;
|
|
|
- if((inFault& define.BIT0) != 0x00) FuseError = true;
|
|
|
- else FuseError = false;
|
|
|
- if((inFault& define.BIT1) != 0x00) SensorError = true;
|
|
|
- else SensorError = false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 전기레인지 기기 상태 */
|
|
|
- public static class Device
|
|
|
- {
|
|
|
- ////////////////////////////////////////////////////////////
|
|
|
- // FireHole (화구)
|
|
|
- ////////////////////////////////////////////////////////////
|
|
|
- /** 화구 개별 데이터 정의 */
|
|
|
- public static class FireHole
|
|
|
- {
|
|
|
- /** 화구 종류 {@link FIREHOLE_KIND}*/
|
|
|
- public byte Kind;
|
|
|
- /** On/Off 상태 {@link FIREHOLE_STATUS}*/
|
|
|
- public byte Status;
|
|
|
- /** 잔열 상태 {@link FIREHOLE_STATUS}*/
|
|
|
- public byte RemainHeat;
|
|
|
- /** 동작 모드 {@link FIREHOLE_MODE}*/
|
|
|
- public byte Mode;
|
|
|
- /** 동작 세기 (0~10)*/
|
|
|
- public byte Level;
|
|
|
- /** 타이머 상위 */
|
|
|
- public byte Timer_Upper;
|
|
|
- /** 타이머 하위 */
|
|
|
- public byte Timer_Lower;
|
|
|
- /** 고장 정보 {@link FAULT}*/
|
|
|
- public FAULT Fault;
|
|
|
-
|
|
|
-
|
|
|
- public FireHole()
|
|
|
- {
|
|
|
- Kind = FIREHOLE_KIND.NONE;
|
|
|
- Status = FIREHOLE_STATUS.OFF;
|
|
|
- RemainHeat = FIREHOLE_STATUS.REMAIN_HEAT_OFF;
|
|
|
- Mode = FIREHOLE_MODE.OFF;
|
|
|
- Level = 0;
|
|
|
- Timer_Upper = 0;
|
|
|
- Timer_Lower = 0;
|
|
|
-
|
|
|
- Fault = new FAULT((byte)0x00);
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString(int index)
|
|
|
- {
|
|
|
- String retStr = "[" + (int) (index+1) + "] ";
|
|
|
-
|
|
|
- retStr += "Kind:" + FIREHOLE_KIND.ToDebugString(Kind) + " / ";
|
|
|
- retStr += "Status:" + FIREHOLE_STATUS.ToDebugString(Status) + " / ";
|
|
|
- retStr += "RemainHeat:" + FIREHOLE_STATUS.ToDebugString(RemainHeat) + " / ";
|
|
|
- retStr += "Mode:" + FIREHOLE_MODE.ToDebugString(Mode) + " / ";
|
|
|
- retStr += "Level:" + Level + " / ";
|
|
|
- retStr += "Timer_Upper:" + Timer_Upper + " / ";
|
|
|
- retStr += "Timer_Lower:" + Timer_Lower + " / ";
|
|
|
-
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 설치된 화구 개수 (범위 : 1 ~ 8)*/
|
|
|
- public byte FireHoleCount;
|
|
|
- /** 개별 화구 */
|
|
|
- public FireHole[] FireHoles;
|
|
|
-
|
|
|
- /**
|
|
|
- * 화구 가져오기
|
|
|
- *
|
|
|
- * @param index - (byte) 가져올 화구 인덱스
|
|
|
- *
|
|
|
- * @return (FireHole) 화구 클래스 (null : fail)
|
|
|
- */
|
|
|
- public FireHole GetFireHole(int index)
|
|
|
- {
|
|
|
- if(FireHoles == null) return null;
|
|
|
- if(index > FireHoles.length) return null;
|
|
|
- return FireHoles[index];
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 화구 설정하기
|
|
|
- *
|
|
|
- * @param index - (byte) 설정할 화구 인덱스
|
|
|
- * @param Status - (byte) 설정할 화구 상태
|
|
|
- * @param Mode - (byte) 설정할 화구 모드
|
|
|
- *
|
|
|
- * @return (boolean) 설정됨 여부 (true:정상, false:에러)
|
|
|
- */
|
|
|
- public boolean SetFireHole(int index, byte kind, byte Status, byte Mode, byte Level)
|
|
|
- {
|
|
|
- if(FireHoles == null) return false;
|
|
|
- if(index > FireHoles.length) return false;
|
|
|
- FireHole setFireHole = FireHoles[index];
|
|
|
-
|
|
|
- setFireHole.Kind = kind;
|
|
|
- setFireHole.Status = Status;
|
|
|
- setFireHole.Mode = Mode;
|
|
|
- setFireHole.Level = Level;
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 기기를 생성한다.
|
|
|
- *
|
|
|
- * @param nFireHoleCount - (byte) 설정할 화구 개수 (범위 : 1 ~ 8)
|
|
|
- */
|
|
|
- public Device(byte nFireHoleCount)
|
|
|
- {
|
|
|
- // 2. Concent
|
|
|
- if(nFireHoleCount > 0)
|
|
|
- {
|
|
|
- FireHoleCount = nFireHoleCount;
|
|
|
- FireHoles = new FireHole[nFireHoleCount];
|
|
|
- for(byte i=0 ; i<FireHoleCount ; i++) FireHoles[i] = new FireHole();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- FireHoleCount = 0;
|
|
|
- FireHoles = null;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString(byte DeviceIdx)
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "(" + (byte)(DeviceIdx + 1) + ") Device - FireHoles\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "FireHoleCount : " + FireHoleCount + "\r\n";
|
|
|
- if(FireHoles != null)
|
|
|
- {
|
|
|
- for(byte i=0 ; i<FireHoleCount ; i++)
|
|
|
- {
|
|
|
- retStr += FireHoles[i].ToDebugString(i) + "\r\n";
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- retStr += "==========================";
|
|
|
-
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- public static class FIREHOLE_KIND
|
|
|
- {
|
|
|
- /** ON */
|
|
|
- public static byte HIGHLIGHT = 0x00;
|
|
|
- /** OFF */
|
|
|
- public static byte INDUCTION = 0x01;
|
|
|
- /** NONE (미정) */
|
|
|
- public static byte NONE = 0x09;
|
|
|
- /**
|
|
|
- * 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param nStatus - (byte) 체크할 상태
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckRange(byte nStatus)
|
|
|
- {
|
|
|
- if (nStatus == HIGHLIGHT) return true;
|
|
|
- else if(nStatus == INDUCTION) return true;
|
|
|
-
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public static String ToDebugString(byte nStatus)
|
|
|
- {
|
|
|
- String retStr;
|
|
|
- if (nStatus == HIGHLIGHT) retStr = "HIGHLIGHT";
|
|
|
- else if(nStatus == INDUCTION) retStr = "INDUCTION";
|
|
|
- else retStr = "UnDefined";
|
|
|
-
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public static class FIREHOLE_STATUS
|
|
|
- {
|
|
|
- /** ON */
|
|
|
- public static byte ON = 0x01;
|
|
|
- /** OFF */
|
|
|
- public static byte OFF = 0x02;
|
|
|
- /** 잔열 없음 */
|
|
|
- public static byte REMAIN_HEAT_OFF = 0x03;
|
|
|
- /** 잔열 있음 */
|
|
|
- public static byte REMAIN_HEAT_ON = 0x04;
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param nStatus - (byte) 체크할 상태
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckRange(byte nStatus)
|
|
|
- {
|
|
|
- if (nStatus == ON) return true;
|
|
|
- else if(nStatus == OFF) return true;
|
|
|
- else if(nStatus == REMAIN_HEAT_OFF) return true;
|
|
|
- else if(nStatus == REMAIN_HEAT_ON) return true;
|
|
|
-
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public static String ToDebugString(byte nStatus)
|
|
|
- {
|
|
|
- String retStr;
|
|
|
- if (nStatus == ON) retStr = "ON";
|
|
|
- else if(nStatus == OFF) retStr = "OFF";
|
|
|
- else if(nStatus == REMAIN_HEAT_OFF) retStr = "REMAIN_HEAT_OFF";
|
|
|
- else if(nStatus == REMAIN_HEAT_ON) retStr = "REMAIN_HEAT_ON";
|
|
|
- else retStr = "UnDefined";
|
|
|
-
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /** 화구 모드 */
|
|
|
- public static class FIREHOLE_MODE
|
|
|
- {
|
|
|
- /** OFF */
|
|
|
- public static byte OFF = 0x00;
|
|
|
- /** 가열 */
|
|
|
- public static byte HEATING = 0x01;
|
|
|
- /** 보온 */
|
|
|
- public static byte HEAT_SAVE = 0x02;
|
|
|
- /** 물 끓임 */
|
|
|
- public static byte WATER_BOIL = 0x03;
|
|
|
- /** 우림 */
|
|
|
- public static byte SOAKING = 0x04;
|
|
|
- /** 프라이팬 */
|
|
|
- public static byte FRYPAN = 0x05;
|
|
|
-
|
|
|
- /**
|
|
|
- * 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param nStatus - (byte) 체크할 상태
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckRange(byte nStatus)
|
|
|
- {
|
|
|
- if (nStatus == OFF) return true;
|
|
|
- else if(nStatus == HEATING) return true;
|
|
|
- else if(nStatus == HEAT_SAVE) return true;
|
|
|
- else if(nStatus == WATER_BOIL) return true;
|
|
|
- else if(nStatus == SOAKING) return true;
|
|
|
- else if(nStatus == FRYPAN) return true;
|
|
|
-
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public static String ToDebugString(byte nStatus)
|
|
|
- {
|
|
|
- String retStr;
|
|
|
- if (nStatus == OFF) retStr = "OFF";
|
|
|
- else if(nStatus == HEATING) retStr = "HEATING";
|
|
|
- else if(nStatus == HEAT_SAVE) retStr = "HEAT_SAVE";
|
|
|
- else if(nStatus == WATER_BOIL) retStr = "WATER_BOIL";
|
|
|
- else if(nStatus == SOAKING) retStr = "SOAKING";
|
|
|
- else if(nStatus == FRYPAN) retStr = "FRYPAN";
|
|
|
- else retStr = "UnDefined";
|
|
|
-
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /** [재실센서] 데이터 클래스 */
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- public static class InRoomDetectSesnor
|
|
|
- {
|
|
|
- public INFO info;
|
|
|
- public STATUS status;
|
|
|
-
|
|
|
- public InRoomDetectSesnor()
|
|
|
- {
|
|
|
- info = new INFO();
|
|
|
- status = new STATUS();
|
|
|
- }
|
|
|
-
|
|
|
- public static class INFO
|
|
|
- {
|
|
|
- /** 설치 여부 */
|
|
|
- public boolean Install;
|
|
|
-
|
|
|
- /** 프로토콜 Build Data (Year) */
|
|
|
- public byte FwVer_Year;
|
|
|
-
|
|
|
- /** 프로토콜 Build Data (Month) */
|
|
|
- public byte FwVer_Month;
|
|
|
-
|
|
|
- /** 프로토콜 Build Data (Day) */
|
|
|
- public byte FwVer_Day;
|
|
|
-
|
|
|
- /** 프로토콜 Build Data (Number) */
|
|
|
- public byte FwVer_Number;
|
|
|
-
|
|
|
- /** 프로토콜 버전정보 (상위) */
|
|
|
- public byte ProtocolVer_Main;
|
|
|
-
|
|
|
- /** 프로토콜 버전정보 (하위) */
|
|
|
- public byte ProtocolVer_Sub;
|
|
|
-
|
|
|
- /** 제조사 정보 */
|
|
|
- public byte Vendor;
|
|
|
-
|
|
|
- public INFO()
|
|
|
- {
|
|
|
- Install = false;
|
|
|
-
|
|
|
- FwVer_Year = 0;
|
|
|
- FwVer_Month = 0;
|
|
|
- FwVer_Day = 0;
|
|
|
- FwVer_Number = 0;
|
|
|
-
|
|
|
- ProtocolVer_Main = 0;
|
|
|
- ProtocolVer_Sub = 0;
|
|
|
-
|
|
|
- Vendor = 0;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString()
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "INFO\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "Install : " + Install + "\r\n" +
|
|
|
- "\r\n" +
|
|
|
- "FwVer_Year : " + FwVer_Year + "\r\n" +
|
|
|
- "FwVer_Month : " + FwVer_Month + "\r\n" +
|
|
|
- "FwVer_Day : " + FwVer_Day + "\r\n" +
|
|
|
- "FwVer_Number : " + FwVer_Number + "\r\n" +
|
|
|
- "ProtocolVer_Main : " + ProtocolVer_Main + "\r\n" +
|
|
|
- "ProtocolVer_Sub : " + ProtocolVer_Sub + "\r\n" +
|
|
|
- "Vendor : " + Vendor + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /** 재실센서 상태 */
|
|
|
- public static class STATUS
|
|
|
- {
|
|
|
- /** 동작 모드(0:감지동작 꺼짐 / 1:감지동작 켜짐) */
|
|
|
- public byte ActMode;
|
|
|
-
|
|
|
- /** 제실센서 상태(0:미감지 / 1:감지) */
|
|
|
- public byte DetectStatus;
|
|
|
-
|
|
|
- /** 제실센서 미감지인 경우, 10초 카운트 시작 flag*/
|
|
|
- public boolean NonDetectOffStart;
|
|
|
-
|
|
|
- /** 센서 감도(1~15단계) */
|
|
|
- public byte SensingValue;
|
|
|
-
|
|
|
- /** 유지시간(1~7단계) */
|
|
|
- public byte KeepingTime;
|
|
|
-
|
|
|
- /** 누적 감지 카운트(상위) */
|
|
|
- public byte DetectCount_Upper;
|
|
|
-
|
|
|
- /** 누적 감지 카운트(하위) */
|
|
|
- public byte DetectCount_Down;
|
|
|
-
|
|
|
- /** 누적 감지 카운트 합계 변수 */
|
|
|
- public int DetectCountSum;
|
|
|
-
|
|
|
- /** 적용 시나리오 모드(기본/야간주방/사용자설정/주방안전) */
|
|
|
- public byte Scenario_Mode;
|
|
|
-
|
|
|
- public STATUS()
|
|
|
- {
|
|
|
- ActMode = ACTIONMODE.OFF;
|
|
|
- DetectStatus = DETECTSTATUS.DETECT_OFF;
|
|
|
- NonDetectOffStart = false;
|
|
|
-
|
|
|
- SensingValue = 0;
|
|
|
- KeepingTime = 0;
|
|
|
-
|
|
|
- DetectCount_Upper = 0;
|
|
|
- DetectCount_Down = 0;
|
|
|
- DetectCountSum = 0;
|
|
|
-
|
|
|
- Scenario_Mode = SCENARIO_MODE.UNKOWN;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString()
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "STATUS\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "ActMode : " + ACTIONMODE.ToDebugString(ActMode) + "\r\n" +
|
|
|
- "DetectStatus : " + DETECTSTATUS.ToDebugString(DetectStatus) + "\r\n" +
|
|
|
- "NonDetectOffStart : " + NonDetectOffStart + "\r\n" +
|
|
|
- "\r\n" +
|
|
|
- "SensingValue : " + SensingValue + "\r\n" +
|
|
|
- "KeepingTime : " + KeepingTime + " Sec" + "\r\n" +
|
|
|
- "DetectCount_Upper : " + DetectCount_Upper + "(" + String.format("%02X ", DetectCount_Upper) + ")" + "\r\n" +
|
|
|
- "DetectCount_Down : " + DetectCount_Down + "(" + String.format("%02X ", DetectCount_Down) + ")" + "\r\n" +
|
|
|
- "DetectCountSum : " + DetectCountSum + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 동작모드 정의 */
|
|
|
- public static class ACTIONMODE
|
|
|
- {
|
|
|
- /** 센서 동작 꺼짐 */
|
|
|
- public static byte OFF = 0x00;
|
|
|
-
|
|
|
- /** 센서 동작 켜짐 */
|
|
|
- public static byte ON = 0x01;
|
|
|
-
|
|
|
- /** 주소 확인 모드 */
|
|
|
- public static byte ADDRESS_CHECK = 0x02;
|
|
|
-
|
|
|
- /** 테스트 모드 */
|
|
|
- public static byte TEST_MODE = 0x03;
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param nStatus - (byte) 체크할 상태
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckRange(byte nStatus)
|
|
|
- {
|
|
|
- if(nStatus == ACTIONMODE.OFF) return true;
|
|
|
- else if(nStatus == ACTIONMODE.ON) return true;
|
|
|
- else if(nStatus == ACTIONMODE.ADDRESS_CHECK) return true;
|
|
|
- else if(nStatus == ACTIONMODE.TEST_MODE) return true;
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- public static String ToDebugString(byte nStatus)
|
|
|
- {
|
|
|
- String retStr;
|
|
|
- if(nStatus == ACTIONMODE.OFF) retStr = "OFF";
|
|
|
- else if(nStatus == ACTIONMODE.ON) retStr = "ON";
|
|
|
- else if(nStatus == ACTIONMODE.ADDRESS_CHECK) retStr = "ADDRESS_CHECK";
|
|
|
- else if(nStatus == ACTIONMODE.TEST_MODE) retStr = "TEST_MODE";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 감지상태 정의 */
|
|
|
- public static class DETECTSTATUS
|
|
|
- {
|
|
|
- /** 감지 안됨 */
|
|
|
- public static byte DETECT_OFF = 0x00;
|
|
|
-
|
|
|
- /** 감지 됨 */
|
|
|
- public static byte DETECT_ON = 0x01;
|
|
|
-
|
|
|
- /**
|
|
|
- * 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param nStatus - (byte) 체크할 상태
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckRange(byte nStatus)
|
|
|
- {
|
|
|
- if(nStatus == DETECTSTATUS.DETECT_OFF) return true;
|
|
|
- else if(nStatus == DETECTSTATUS.DETECT_ON) return true;
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- public static String ToDebugString(byte nStatus)
|
|
|
- {
|
|
|
- String retStr;
|
|
|
- if(nStatus == DETECTSTATUS.DETECT_OFF) retStr = "OFF";
|
|
|
- else if(nStatus == DETECTSTATUS.DETECT_ON) retStr = "ON";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 동작모드 정의 */
|
|
|
- public static class SCENARIO_MODE
|
|
|
- {
|
|
|
- /** 미정의 모드 */
|
|
|
- public static byte UNKOWN = (byte)0x00;
|
|
|
-
|
|
|
- /** 기본 모드 */
|
|
|
- public static byte BASIC = define.BIT0;
|
|
|
-
|
|
|
- /** 야간 주방 */
|
|
|
- public static byte NIGHT_KITCHEN = define.BIT1;
|
|
|
-
|
|
|
- /** 사용자 설정 */
|
|
|
- public static byte USER_CUSTOM = define.BIT2;
|
|
|
-
|
|
|
- /** 주방 안전 */
|
|
|
- public static byte KITCHEN_SAFE = define.BIT3;
|
|
|
-
|
|
|
- /**
|
|
|
- * 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param nStatus - (byte) 체크할 상태
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckRange(byte nStatus)
|
|
|
- {
|
|
|
- if(nStatus == SCENARIO_MODE.BASIC) return true;
|
|
|
- else if(nStatus == SCENARIO_MODE.NIGHT_KITCHEN) return true;
|
|
|
- else if(nStatus == SCENARIO_MODE.USER_CUSTOM) return true;
|
|
|
- else if(nStatus == SCENARIO_MODE.KITCHEN_SAFE) return true;
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- public static String ToDebugString(byte nStatus)
|
|
|
- {
|
|
|
- String retStr;
|
|
|
-
|
|
|
- if(nStatus == SCENARIO_MODE.BASIC) retStr = "BASIC";
|
|
|
- else if(nStatus == SCENARIO_MODE.NIGHT_KITCHEN) retStr = "NIGHT_KITCHEN";
|
|
|
- else if(nStatus == SCENARIO_MODE.USER_CUSTOM) retStr = "USER_CUSTOM";
|
|
|
- else if(nStatus == SCENARIO_MODE.KITCHEN_SAFE) retStr = "KITCHEN_SAFE";
|
|
|
- else retStr = "UnDefined";
|
|
|
-
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /** [지문인식 도어락] 데이터 클래스 */
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- public static class FP_DoorLock
|
|
|
- {
|
|
|
- public Info info;
|
|
|
- public Device device;
|
|
|
-
|
|
|
- /**
|
|
|
- * 생성자<br>
|
|
|
- */
|
|
|
- public FP_DoorLock()
|
|
|
- {
|
|
|
- info = new Info();
|
|
|
- device = new Device();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /** 지문인식 도어락 기본정보 */
|
|
|
- public static class Info
|
|
|
- {
|
|
|
- /** 설치상태 (true:설치 , false:미설치) */
|
|
|
- public boolean Install;
|
|
|
-
|
|
|
- /** 터치상태 (true: 지원함 , false: 지원안함) */
|
|
|
- public boolean Touch_Recog;
|
|
|
-
|
|
|
- /** 문열림 대기모드 (true: 지원함 , false: 지원안함) */
|
|
|
- public boolean OpenStandByMode;
|
|
|
-
|
|
|
- /** 지문인식 (true: 지원함 , false: 지원안함) */
|
|
|
- public boolean Fingerprint_Recog;
|
|
|
-
|
|
|
- /** 출입ID 구분 (true: 지원함 , false: 지원안함) */
|
|
|
- public boolean EnterId_Classify;
|
|
|
-
|
|
|
- /** 방범기능 (true: 지원함 , false: 지원안함) */
|
|
|
- public boolean Security_Run;
|
|
|
-
|
|
|
- /** 지원 프로토콜 버전 Main */
|
|
|
- public byte ProtocolVer_Main;
|
|
|
-
|
|
|
- /** 지원 프로토콜 버전 Sub */
|
|
|
- public byte ProtocolVer_Sub;
|
|
|
-
|
|
|
- /**
|
|
|
- * 생성자<br>
|
|
|
- */
|
|
|
- public Info()
|
|
|
- {
|
|
|
- Install = false;
|
|
|
- Touch_Recog = false;
|
|
|
- OpenStandByMode = false;
|
|
|
- Fingerprint_Recog = false;
|
|
|
- EnterId_Classify = false;
|
|
|
- Security_Run = false;
|
|
|
-
|
|
|
- ProtocolVer_Main = 0x00;
|
|
|
- ProtocolVer_Sub = 0x00;
|
|
|
- }
|
|
|
-
|
|
|
- public String ToDebugString()
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "Device - Info\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "Touch_Recog : " + Touch_Recog + "\r\n" +
|
|
|
- "OpenStandByMode : " + OpenStandByMode + "\r\n" +
|
|
|
- "Fingerprint_Recog : " + Fingerprint_Recog + "\r\n" +
|
|
|
- "EnterId_Classify : " + EnterId_Classify + "\r\n" +
|
|
|
- "Security_Run : " + Security_Run + "\r\n" +
|
|
|
- "ProtocolVer : " + "V" + ProtocolVer_Main + "." + ProtocolVer_Sub + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 지문인식 도어락 상태 */
|
|
|
- public static class Device
|
|
|
- {
|
|
|
- public STATUS status;
|
|
|
-
|
|
|
- /**
|
|
|
- * 생성자<br>
|
|
|
- */
|
|
|
- public Device()
|
|
|
- {
|
|
|
- status = new STATUS();
|
|
|
- }
|
|
|
-
|
|
|
- public static class STATUS
|
|
|
- {
|
|
|
- /** 문열림 상태 {@link DOORSTATUS} */
|
|
|
- public byte doorstatus;
|
|
|
-
|
|
|
- /** 터치상태 - 0x00:미지원, 0x01:미감지, 0x02:감지 */
|
|
|
- public byte TouchStatus;
|
|
|
-
|
|
|
- /** 문열림 대기모드 - 0x00:미지원, 0x01:해제, 0x02:설정 */
|
|
|
- public byte OpenStandByMode;
|
|
|
-
|
|
|
- /** 출입정보 - 0xEE:평상시, 0x10:ㅂㅣ ㅁㅣㄹ ㅂㅓㄴ ㅎㅗ 출입, 0x20:카드 출입, 0x30:지문 출입, 0x40:리모컨 출입,
|
|
|
- * 0xF0:비밀번호/카드 5회 초과 입력오류, 0xF1:지문 10회 초과 입력오류 */
|
|
|
- public byte EnterInfo;
|
|
|
-
|
|
|
- /** 출입 ID - 1 ~ 255 */
|
|
|
- public byte EnterID;
|
|
|
-
|
|
|
- /** 외출상태 - 0x00:평상시, 0x41:외출설정, 0x42:외출해제 */
|
|
|
- public byte Outing;
|
|
|
-
|
|
|
- /** 경고/이상 - 0x00:정상, 0x41:침입감지, 0x42:센서이상, 0x43:배터리저전압, 0x44:장시간문열림, 0x45:강제잠금 */
|
|
|
- public byte NotiNFault;
|
|
|
-
|
|
|
- public STATUS()
|
|
|
- {
|
|
|
- doorstatus = DOORSTATUS.Close;
|
|
|
- TouchStatus = TOUCHSTATUS.NotSupport;
|
|
|
- OpenStandByMode = OPEN_STANDBY_MODE.NotSupport;
|
|
|
- EnterInfo = ENTER_INFO.Normal;
|
|
|
- EnterID = (byte)0x00;
|
|
|
- Outing = (byte)0x00;
|
|
|
- NotiNFault = (byte)0x00;
|
|
|
- }
|
|
|
-
|
|
|
- public String ToDebugString()
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "Device - Status\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "doorstatus : " + DOORSTATUS.ToDebugString(doorstatus) + "\r\n" +
|
|
|
- "TouchStatus : " + TOUCHSTATUS.ToDebugString(TouchStatus) + "\r\n" +
|
|
|
- "OpenStandByMode : " + OPEN_STANDBY_MODE.ToDebugString(OpenStandByMode) + "\r\n" +
|
|
|
- "EnterInfo : " + ENTER_INFO.ToDebugString(EnterInfo) + "\r\n" +
|
|
|
- "EnterID : " + EnterID + "\r\n" +
|
|
|
- "Outing : " + OUTING_STATUS.ToDebugString(Outing) + "\r\n" +
|
|
|
- "NotiNFault : " + NOTI_FAULT.ToDebugString(NotiNFault) + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 도어락 문열림 상태 정의 */
|
|
|
- public static class DOORSTATUS
|
|
|
- {
|
|
|
- /** 닫힘 */
|
|
|
- public static byte Close = (byte)0x00;
|
|
|
- /** 열림 */
|
|
|
- public static byte Open = (byte)0x01;
|
|
|
- /** 동작중 */
|
|
|
- public static byte Operation = (byte)0x02;
|
|
|
- /** 열림 - 강제잠금되어있음 */
|
|
|
- public static byte Open_LockingForce = (byte)0x03;
|
|
|
- /** 닫힘 - 강제잠금되어있음 */
|
|
|
- public static byte Close_LockingForce = (byte)0x04;
|
|
|
- /** 닫힘 이상 - 데드볼트 끝까지 안나옴(덜닫힘) */
|
|
|
- public static byte Close_Fault = (byte)0x05;
|
|
|
-
|
|
|
- /**
|
|
|
- * 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param nStatus - (byte) 체크할 상태
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckRange(byte nStatus)
|
|
|
- {
|
|
|
- if(nStatus == DOORSTATUS.Close) return true;
|
|
|
- else if(nStatus == DOORSTATUS.Open) return true;
|
|
|
- else if(nStatus == DOORSTATUS.Operation) return true;
|
|
|
- else if(nStatus == DOORSTATUS.Open_LockingForce) return true;
|
|
|
- else if(nStatus == DOORSTATUS.Close_LockingForce) return true;
|
|
|
- else if(nStatus == DOORSTATUS.Close_Fault) return true;
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- public static String ToDebugString(byte nStatus)
|
|
|
- {
|
|
|
- String retStr;
|
|
|
- if(nStatus == DOORSTATUS.Close) retStr = "Close";
|
|
|
- else if(nStatus == DOORSTATUS.Open) retStr = "Open";
|
|
|
- else if(nStatus == DOORSTATUS.Operation) retStr = "Operation";
|
|
|
- else if(nStatus == DOORSTATUS.Open_LockingForce) retStr = "Open_LockingForce";
|
|
|
- else if(nStatus == DOORSTATUS.Close_LockingForce) retStr = "Close_LockingForce";
|
|
|
- else if(nStatus == DOORSTATUS.Close_Fault) retStr = "Close_Fault";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /** 도어락 터치 상태 정의 */
|
|
|
- public static class TOUCHSTATUS
|
|
|
- {
|
|
|
- /** 미지원 */
|
|
|
- public static byte NotSupport = (byte)0x00;
|
|
|
- /** */
|
|
|
- public static byte Touch_Off = (byte)0x01;
|
|
|
- /** 동작중 */
|
|
|
- public static byte Touch_On = (byte)0x02;
|
|
|
-
|
|
|
- /**
|
|
|
- * 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param nStatus - (byte) 체크할 상태
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckRange(byte nStatus)
|
|
|
- {
|
|
|
- if(nStatus == TOUCHSTATUS.NotSupport) return true;
|
|
|
- else if(nStatus == TOUCHSTATUS.Touch_Off) return true;
|
|
|
- else if(nStatus == TOUCHSTATUS.Touch_On) return true;
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- public static String ToDebugString(byte nStatus)
|
|
|
- {
|
|
|
- String retStr;
|
|
|
- if(nStatus == TOUCHSTATUS.NotSupport) retStr = "NotSupport";
|
|
|
- else if(nStatus == TOUCHSTATUS.Touch_Off) retStr = "Touch_Off";
|
|
|
- else if(nStatus == TOUCHSTATUS.Touch_On) retStr = "Touch_On";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /** 문열림대기모드 상태 정의 */
|
|
|
- public static class OPEN_STANDBY_MODE
|
|
|
- {
|
|
|
- /** 미지원 */
|
|
|
- public static byte NotSupport = (byte)0x00;
|
|
|
- /** 해제 상태 */
|
|
|
- public static byte Standby_Off = (byte)0x01;
|
|
|
- /** 설정 상태 */
|
|
|
- public static byte Standby_On = (byte)0x02;
|
|
|
-
|
|
|
- /**
|
|
|
- * 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param nStatus - (byte) 체크할 상태
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckRange(byte nStatus)
|
|
|
- {
|
|
|
- if(nStatus == OPEN_STANDBY_MODE.NotSupport) return true;
|
|
|
- else if(nStatus == OPEN_STANDBY_MODE.Standby_Off) return true;
|
|
|
- else if(nStatus == OPEN_STANDBY_MODE.Standby_On) return true;
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- public static String ToDebugString(byte nStatus)
|
|
|
- {
|
|
|
- String retStr;
|
|
|
- if(nStatus == OPEN_STANDBY_MODE.NotSupport) retStr = "NotSupport";
|
|
|
- else if(nStatus == OPEN_STANDBY_MODE.Standby_Off) retStr = "Standby_Off";
|
|
|
- else if(nStatus == OPEN_STANDBY_MODE.Standby_On) retStr = "Standby_On";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 출입정보 상태 정의 */
|
|
|
- public static class ENTER_INFO
|
|
|
- {
|
|
|
- /** 평상시 */
|
|
|
- public static byte Normal = (byte)0xEE;
|
|
|
- /** 비밀번호 출입 */
|
|
|
- public static byte Enter_Password = (byte)0x10;
|
|
|
- /** 카드 출입 */
|
|
|
- public static byte Enter_Card = (byte)0x20;
|
|
|
- /** 지문 출입 */
|
|
|
- public static byte Enter_FingerPrint = (byte)0x30;
|
|
|
- /** 리모컨 출입 */
|
|
|
- public static byte Enter_Remocon = (byte)0x40;
|
|
|
- /** 비밀번호/카드 5회 초과 입력오류 */
|
|
|
- public static byte Error_PwdCard_Over5 = (byte)0xF0;
|
|
|
- /** 지문 10회 초과 입력오류 */
|
|
|
- public static byte Error_Fp_Over10 = (byte)0xF1;
|
|
|
-
|
|
|
- /**
|
|
|
- * 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param nStatus - (byte) 체크할 상태
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckRange(byte nStatus)
|
|
|
- {
|
|
|
- if(nStatus == ENTER_INFO.Normal) return true;
|
|
|
- else if(nStatus == ENTER_INFO.Enter_Password) return true;
|
|
|
- else if(nStatus == ENTER_INFO.Enter_Card) return true;
|
|
|
- else if(nStatus == ENTER_INFO.Enter_FingerPrint) return true;
|
|
|
- else if(nStatus == ENTER_INFO.Enter_Remocon) return true;
|
|
|
- else if(nStatus == ENTER_INFO.Error_PwdCard_Over5) return true;
|
|
|
- else if(nStatus == ENTER_INFO.Error_Fp_Over10) return true;
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- public static String ToDebugString(byte nStatus)
|
|
|
- {
|
|
|
- String retStr;
|
|
|
- if(nStatus == ENTER_INFO.Normal) retStr = "Normal";
|
|
|
- else if(nStatus == ENTER_INFO.Enter_Password) retStr = "Enter_Password";
|
|
|
- else if(nStatus == ENTER_INFO.Enter_Card) retStr = "Enter_Card";
|
|
|
- else if(nStatus == ENTER_INFO.Enter_FingerPrint) retStr = "Enter_FingerPrint";
|
|
|
- else if(nStatus == ENTER_INFO.Enter_Remocon) retStr = "Enter_Remocon";
|
|
|
- else if(nStatus == ENTER_INFO.Error_PwdCard_Over5) retStr = "Error_PwdCard_Over5";
|
|
|
- else if(nStatus == ENTER_INFO.Error_Fp_Over10) retStr = "Error_Fp_Over10";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /** 방범기능 상태 정의 */
|
|
|
- public static class OUTING_STATUS
|
|
|
- {
|
|
|
- /** 외출설정 상태 */
|
|
|
- public static byte Outing_On = (byte)0x41;
|
|
|
- /** 외출해제 상태 */
|
|
|
- public static byte Outing_Off = (byte)0x42;
|
|
|
-
|
|
|
- /**
|
|
|
- * 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param nStatus - (byte) 체크할 상태
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckRange(byte nStatus)
|
|
|
- {
|
|
|
- if(nStatus == OUTING_STATUS.Outing_On) return true;
|
|
|
- else if(nStatus == OUTING_STATUS.Outing_Off) return true;
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- public static String ToDebugString(byte nStatus)
|
|
|
- {
|
|
|
- String retStr;
|
|
|
- if(nStatus == OUTING_STATUS.Outing_On) retStr = "Outing_On";
|
|
|
- else if(nStatus == OUTING_STATUS.Outing_Off) retStr = "Outing_Off";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 알림/경고/이상 상태 정의 */
|
|
|
- public static class NOTI_FAULT
|
|
|
- {
|
|
|
- /** 침입감지 상태 */
|
|
|
- public static byte Invasion_Detect = (byte)0x41;
|
|
|
- /** 센서이상 상태 */
|
|
|
- public static byte Sensor_Fault = (byte)0x42;
|
|
|
- /** 배터리 저전압 상태 */
|
|
|
- public static byte Battery_Low = (byte)0x43;
|
|
|
- /** 장시간 문열림 상태 */
|
|
|
- public static byte LongTime_Open = (byte)0x44;
|
|
|
- /** 강제잠금 상태 */
|
|
|
- public static byte ForceLock = (byte)0x45;
|
|
|
- /** 화재경고 상태 */
|
|
|
- public static byte FireWarning = (byte)0x46;
|
|
|
-
|
|
|
- /** 비밀번호 삭제 */
|
|
|
- public static byte PWD_Delete = (byte)0xA0;
|
|
|
- /** 비밀번호 등록 */
|
|
|
- public static byte PWD_Reg = (byte)0xA1;
|
|
|
-
|
|
|
- /** 카드 삭제 */
|
|
|
- public static byte CARD_Delete = (byte)0xB0;
|
|
|
- /** 카드 등록 */
|
|
|
- public static byte CARD_Reg = (byte)0xB1;
|
|
|
-
|
|
|
- /** 지문 삭제 */
|
|
|
- public static byte FingerPrint_Delete = (byte)0xC0;
|
|
|
- /** 지문 등록 */
|
|
|
- public static byte FingerPrint_Reg = (byte)0xC1;
|
|
|
-
|
|
|
- /** 리모컨 삭제 */
|
|
|
- public static byte REMOCON_Delete = (byte)0xD0;
|
|
|
- /** 리모컨 등록 */
|
|
|
- public static byte REMOCON_Reg = (byte)0xD1;
|
|
|
-
|
|
|
- /**
|
|
|
- * 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param nStatus - (byte) 체크할 상태
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckRange(byte nStatus)
|
|
|
- {
|
|
|
- if(nStatus == NOTI_FAULT.Invasion_Detect) return true;
|
|
|
- else if(nStatus == NOTI_FAULT.Sensor_Fault) return true;
|
|
|
- else if(nStatus == NOTI_FAULT.Battery_Low) return true;
|
|
|
- else if(nStatus == NOTI_FAULT.LongTime_Open) return true;
|
|
|
- else if(nStatus == NOTI_FAULT.ForceLock) return true;
|
|
|
- else if(nStatus == NOTI_FAULT.FireWarning) return true;
|
|
|
- else if(nStatus == NOTI_FAULT.PWD_Delete) return true;
|
|
|
- else if(nStatus == NOTI_FAULT.PWD_Reg) return true;
|
|
|
- else if(nStatus == NOTI_FAULT.CARD_Delete) return true;
|
|
|
- else if(nStatus == NOTI_FAULT.CARD_Reg) return true;
|
|
|
- else if(nStatus == NOTI_FAULT.FingerPrint_Delete) return true;
|
|
|
- else if(nStatus == NOTI_FAULT.FingerPrint_Reg) return true;
|
|
|
- else if(nStatus == NOTI_FAULT.REMOCON_Delete) return true;
|
|
|
- else if(nStatus == NOTI_FAULT.REMOCON_Reg) return true;
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- public static String ToDebugString(byte nStatus)
|
|
|
- {
|
|
|
- String retStr;
|
|
|
- if(nStatus == NOTI_FAULT.Invasion_Detect) retStr = "Invasion_Detect";
|
|
|
- else if(nStatus == NOTI_FAULT.Sensor_Fault) retStr = "Sensor_Fault";
|
|
|
- else if(nStatus == NOTI_FAULT.Battery_Low) retStr = "Battery_Low";
|
|
|
- else if(nStatus == NOTI_FAULT.LongTime_Open) retStr = "LongTime_Open";
|
|
|
- else if(nStatus == NOTI_FAULT.ForceLock) retStr = "ForceLock";
|
|
|
- else if(nStatus == NOTI_FAULT.FireWarning) retStr = "FireWarning";
|
|
|
- else if(nStatus == NOTI_FAULT.PWD_Delete) retStr = "PWD_Delete";
|
|
|
- else if(nStatus == NOTI_FAULT.PWD_Reg) retStr = "PWD_Reg";
|
|
|
- else if(nStatus == NOTI_FAULT.CARD_Delete) retStr = "CARD_Delete";
|
|
|
- else if(nStatus == NOTI_FAULT.CARD_Reg) retStr = "CARD_Reg";
|
|
|
- else if(nStatus == NOTI_FAULT.FingerPrint_Delete) retStr = "FingerPrint_Delete";
|
|
|
- else if(nStatus == NOTI_FAULT.FingerPrint_Reg) retStr = "FingerPrint_Reg";
|
|
|
- else if(nStatus == NOTI_FAULT.REMOCON_Delete) retStr = "REMOCON_Delete";
|
|
|
- else if(nStatus == NOTI_FAULT.REMOCON_Reg) retStr = "REMOCON_Reg";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /** [멀티스위치] 데이터 클래스 */
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- public static class MultiSwitch {
|
|
|
- public Info info;
|
|
|
- public Device device;
|
|
|
-
|
|
|
- /**
|
|
|
- * 생성자<br>
|
|
|
- */
|
|
|
- public MultiSwitch() {
|
|
|
- info = new Info();
|
|
|
- setBasicInfo((byte) 0x00, (byte) 0x00);
|
|
|
- setAirconInfo((byte) 0x00, null);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 조명 콘센트 개수를 설정한다.
|
|
|
- *
|
|
|
- * @param hLightCnt - (byte) 설정할 조명 개수 (범위 : 0 ~ 8)
|
|
|
- * @param hOutletCnt - (byte) 설정할 콘센트 개수 (범위 : 0 ~ 8)
|
|
|
- */
|
|
|
- public void setBasicInfo(byte hLightCnt, byte hOutletCnt) {
|
|
|
- Log.i(TAG, "[setBasicInfo] hLightCnt [" + String.format("0x%02X", hLightCnt) + "], hOutletCnt [" + String.format("0x%02X", hOutletCnt) + "]");
|
|
|
- if (info == null) {
|
|
|
- Log.w(TAG, "[setBasicInfo] info is null!!");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- // 1. Light
|
|
|
- if (hLightCnt > 0) info.Support.hLightCnt = hLightCnt;
|
|
|
- else info.Support.hLightCnt = 0;
|
|
|
-
|
|
|
- // 2. Concent
|
|
|
- if (hOutletCnt > 0) info.Support.hOutletCnt = hOutletCnt;
|
|
|
- else info.Support.hOutletCnt = 0;
|
|
|
-
|
|
|
- // 3. new device
|
|
|
- device = new Device(info.Support.hLightCnt, info.Support.hOutletCnt);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 제어할 에어컨 정보를 설정한다.
|
|
|
- *
|
|
|
- * @param hCnt - (byte) 제어할 에어컨 개수
|
|
|
- */
|
|
|
- public void setAirconInfo(byte hCnt, byte[] ahAirconIDs) {
|
|
|
- if (ahAirconIDs == null) {
|
|
|
- Log.w(TAG, "[setAirconInfo] ahAirconIDs is null!!");
|
|
|
- Log.i(TAG, "[setAirconInfo] hCnt [" + String.format("0x%02X", hCnt) + "]");
|
|
|
- }
|
|
|
- else {
|
|
|
- Log.w(TAG, "[setAirconInfo] ahAirconIDs is not null!!");
|
|
|
- Log.i(TAG, "[setAirconInfo] hCnt [" + String.format("0x%02X", hCnt) + "], ahAirconIDs.length [" + ahAirconIDs.length + "]");
|
|
|
-
|
|
|
- for (int i = 0; i < ahAirconIDs.length; i++) Log.i(TAG, "[ahAirconIDs] ahAirconIDs[" + i + "] = " + String.format("0x%02X", ahAirconIDs[i]));
|
|
|
- }
|
|
|
-
|
|
|
- if (info == null) {
|
|
|
- Log.w(TAG, "[setAirconInfo] info is null!!");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- if (device == null) {
|
|
|
- Log.w(TAG, "[setAirconInfo] device is null!!");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- // 1. Aircon
|
|
|
- if (hCnt > 0) {
|
|
|
- info.Support.hAirconCtrlCnt = hCnt;
|
|
|
- info.Support.hAirconCtrlID = new byte[hCnt];
|
|
|
- for (int i = 0; i < info.Support.hAirconCtrlCnt; i++) {
|
|
|
- info.Support.hAirconCtrlID[i] = ahAirconIDs[i];
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- info.Support.hAirconCtrlCnt = 0;
|
|
|
- info.Support.hAirconCtrlID = null;
|
|
|
- }
|
|
|
- device.airconData = new Device.AirconData(info.Support.hAirconCtrlCnt);
|
|
|
- }
|
|
|
-
|
|
|
- /** 멀티스위치 보드정보 */
|
|
|
- public static class Info {
|
|
|
- /** 설치상태 (true:설치 , false:미설치) */
|
|
|
- public boolean Install;
|
|
|
-
|
|
|
- /** 제조사 코드 ( 0x01 : 제일전기, 0x02 = 다산지앤지, 0x03 = 클레오) */
|
|
|
- public byte Vender;
|
|
|
-
|
|
|
- /** 펌웨어 Build Date (년) */
|
|
|
- public byte FwVer_Year;
|
|
|
- /** 펌웨어 Build Date (월) */
|
|
|
- public byte FwVer_Month;
|
|
|
- /** 펌웨어 Build Date (일) */
|
|
|
- public byte FwVer_Day;
|
|
|
- /** 펌웨어 Build Date (일련번호) */
|
|
|
- public byte FwVer_Number;
|
|
|
-
|
|
|
- /** 지원 프로토콜 버전 Main */
|
|
|
- public byte ProtocolVer_Main;
|
|
|
- /** 지원 프로토콜 버전 Sub */
|
|
|
- public byte ProtocolVer_Sub;
|
|
|
-
|
|
|
- public Info() {
|
|
|
- Support = new SupportInfo();
|
|
|
-
|
|
|
- Install = false;
|
|
|
-
|
|
|
- Vender = 0x00;
|
|
|
-
|
|
|
- FwVer_Year = 0x00;
|
|
|
- FwVer_Month = 0x00;
|
|
|
- FwVer_Day = 0x00;
|
|
|
- FwVer_Number = 0x00;
|
|
|
-
|
|
|
- ProtocolVer_Main = 0x00;
|
|
|
- ProtocolVer_Sub = 0x00;
|
|
|
- }
|
|
|
-
|
|
|
- public String ToDebugString(byte DeviceIdx) {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "(" + (byte)(DeviceIdx + 1) + ") Device - Info\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "Vender : " + String.format("0x%02X", Vender) + "\r\n" +
|
|
|
- "FwVer : " + (int)(FwVer_Year+2000) + "." + FwVer_Month + "." + FwVer_Day + "." + FwVer_Number + "\r\n" +
|
|
|
- "ProtocolVer : " + "V" + ProtocolVer_Main + "." + ProtocolVer_Sub + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
- public SupportInfo Support;
|
|
|
-
|
|
|
- /** 기능 지원 여부 */
|
|
|
- public class SupportInfo {
|
|
|
- /** 설치된 조명 개수 (범위 : 0 ~ 8)*/
|
|
|
- public byte hLightCnt;
|
|
|
- /** 설치된 콘센트 개수 (범위 : 0 ~ 8)*/
|
|
|
- public byte hOutletCnt;
|
|
|
- /** V2 CMD 사용 여부 */
|
|
|
- public boolean bV2CMDUsage;
|
|
|
- /** 시간정보 연동 (월패드가 기기에 시간정보 제공) */
|
|
|
- public boolean bTimeSync;
|
|
|
- /** V2 CMD - 조명 디밍 지원 여부 (true:지원, false:미지원) */
|
|
|
- public boolean bDim;
|
|
|
- /** V2 CMD - 조명 디밍 지원 단계 (1(X'1') ~ 100(X'64')) */
|
|
|
- public byte hDimLevel;
|
|
|
- /** V2 CMD - 조명 디밍 지원 회로 (BIT0~BIT7, 0: 미지원, 1: 지원) */
|
|
|
- public byte hDimEnabledCircuit;
|
|
|
- /** V2 CMD - 에어컨 제어 지원 여부 (true:지원, false:미지원) */
|
|
|
- public boolean bAirconCtrl;
|
|
|
- /** V2 CMD - 에어컨 연동 대수 (범위 0~15, 0은 에어컨 연동 안함) */
|
|
|
- public byte hAirconCtrlCnt;
|
|
|
- /** V2 CMD - 에어컨 연동 ID (범위 1~15, 멀티스위치가 제어할 에어컨 실내기 ID 배열) */
|
|
|
- public byte[] hAirconCtrlID;
|
|
|
-
|
|
|
- public SupportInfo() {
|
|
|
- hLightCnt = (byte) 0x00;
|
|
|
- hOutletCnt = (byte) 0x00;
|
|
|
- bV2CMDUsage = false;
|
|
|
- bTimeSync = false;
|
|
|
- bDim = false;
|
|
|
- hDimLevel = (byte) 0x00;
|
|
|
- hDimEnabledCircuit = (byte) 0x00;
|
|
|
- bAirconCtrl = false;
|
|
|
- hAirconCtrlCnt =(byte) 0x00;
|
|
|
- hAirconCtrlID = null;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString(byte DeviceIdx) {
|
|
|
- String strAirconIDs = "NONE";
|
|
|
- if (hAirconCtrlCnt > 0 && hAirconCtrlID != null) {
|
|
|
- strAirconIDs = "";
|
|
|
- for (int i = 0; i < hAirconCtrlCnt; i++) {
|
|
|
- if (i == 0) strAirconIDs += hAirconCtrlID[i];
|
|
|
- else strAirconIDs += "/" + hAirconCtrlID[i];
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "(" + (byte)(DeviceIdx + 1) + ") Device - SupportInfo\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "hLightCnt : " + Support.hLightCnt +"\r\n" +
|
|
|
- "hOutletCnt : " + Support.hOutletCnt +"\r\n" +
|
|
|
- "bV2CMDUsage : " + Support.bV2CMDUsage +"\r\n" +
|
|
|
- "bTimeSync : " + Support.bTimeSync +"\r\n" +
|
|
|
- "bDim : " + Support.bDim +"\r\n" +
|
|
|
- "hDimLevel : " + Support.hDimLevel +"\r\n" +
|
|
|
- "hDimEnabledCircuit : " + Support.hDimEnabledCircuit +"\r\n" +
|
|
|
- "bAirconCtrl : " + Support.bAirconCtrl +"\r\n" +
|
|
|
- "hAirconCtrlCnt : " + Support.hAirconCtrlCnt +"\r\n" +
|
|
|
- "strAirconIDs : " + strAirconIDs +"\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 멀티스위치 기기 상태 */
|
|
|
- public static class Device {
|
|
|
- /** 멀티스위치 제어 요청 상태 */
|
|
|
- public static class CtrlReq {
|
|
|
- /** 에어컨 제어 */
|
|
|
- public boolean bAircon; // true: 요청, false: 요청 없음
|
|
|
- public byte[] hAirconCtrlID; // 에어컨 제어 ID
|
|
|
- public byte hAirconCtrlOption; // 에어컨 제어 옵션
|
|
|
- public byte hAirconStatus; // 에어컨 상태 정보
|
|
|
- public byte hSetTemper; // 에어컨 설정온도 정보
|
|
|
-
|
|
|
- public CtrlReq(byte hAirconCnt) {
|
|
|
- bAircon = false; // true: 요청, false: 요청 없음
|
|
|
- hAirconCtrlID = new byte[hAirconCnt]; // 에어컨 제어 ID
|
|
|
- hAirconCtrlOption = (byte) 0x00; // 에어컨 제어 옵션
|
|
|
- hAirconStatus = (byte) 0x00; // 에어컨 상태 정보
|
|
|
- hSetTemper = (byte) 0x00; // 에어컨 설정온도 정보
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString(int index) {
|
|
|
-
|
|
|
- String astrAirconID = "";
|
|
|
- for (int i = 0; i < hAirconCtrlID.length; i++) {
|
|
|
- if (i == 0) astrAirconID = String.format("0x%02X", hAirconCtrlOption);
|
|
|
- else astrAirconID = "/" + String.format("0x%02X", hAirconCtrlOption);
|
|
|
- }
|
|
|
-
|
|
|
- String retStr = "[" + (int) (index+1) + "] ";
|
|
|
- retStr += "bAircon:" + bAircon;
|
|
|
- retStr += "hAirconCtrlID:" + astrAirconID;
|
|
|
- retStr += "hAirconCtrlOption:" + String.format("0x%02X", hAirconCtrlOption) + " / ";
|
|
|
- retStr += "hAirconStatus:" + String.format("0x%02X", hAirconStatus);
|
|
|
- retStr += "hSetTemper:" + String.format("0x%02X", hSetTemper);
|
|
|
-
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public CtrlReq ctrlReq;
|
|
|
-
|
|
|
- ////////////////////////////////////////////////////////////
|
|
|
- // 조명
|
|
|
- ////////////////////////////////////////////////////////////
|
|
|
- /** 조명 개별 데이터 정의 */
|
|
|
- public static class Light {
|
|
|
- /** 조명 ON/OFF 상태 (Off: false, On: true) */
|
|
|
- public boolean bPower;
|
|
|
- /** 디밍 지원 여부 (미지원: false, 지원: true) */
|
|
|
- public boolean bDimUsage;
|
|
|
- /** 디밍 설정 단계 (1(X'1') ~ 100(X'64')), 디밍 지원 단계에 따라 범위가 결정된다. */
|
|
|
- public byte hDimLevel;
|
|
|
-
|
|
|
- public Light() {
|
|
|
- bPower = false;
|
|
|
- bDimUsage = false;
|
|
|
- hDimLevel = (byte) 0x00; // 미사용시 0
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString(int index) {
|
|
|
- String retStr = "[" + (int) (index+1) + "] ";
|
|
|
-
|
|
|
- retStr += "bPower:" + bPower + " / ";
|
|
|
- retStr += "bDimUsage:" + bDimUsage + " / ";
|
|
|
- retStr += "hDimLevel:" + hDimLevel;
|
|
|
-
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 설치된 조명 개수 (범위 : 0 ~ 8)*/
|
|
|
- public byte hLightCnt;
|
|
|
-
|
|
|
- /** 조명 ON/OFF 상태 */
|
|
|
- public Light[] light;
|
|
|
-
|
|
|
- /**
|
|
|
- * 조명 설정하기
|
|
|
- *
|
|
|
- * @param index - (byte) 설정할 조명 인덱스
|
|
|
- * @param power - (byte) 설정할 조명 전원 상태
|
|
|
- * @param dimusage - (byte) 설정할 디밍 사용 여부
|
|
|
- * @param dimlevel - (double) 설정할 디밍 단계
|
|
|
- *
|
|
|
- * @return (boolean) 설정됨 여부 (true:정상, false:에러)
|
|
|
- */
|
|
|
- public boolean setLight(int index, boolean power, boolean dimusage, byte dimlevel) {
|
|
|
- if (light == null) return false;
|
|
|
- if (index > light.length) return false;
|
|
|
- Light setLight = light[index];
|
|
|
-
|
|
|
- setLight.bPower = power; // 조명 전원
|
|
|
- setLight.bDimUsage = dimusage; // 디밍 사용 여부
|
|
|
- setLight.hDimLevel = dimlevel; // 디밍 단계
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 조명 ON/OFF 가져오기
|
|
|
- *
|
|
|
- * @param index - (byte) 가져올 조명 인덱스
|
|
|
- *
|
|
|
- * @return (boolean) 조명 상태 (true:ON, false:OFF)
|
|
|
- */
|
|
|
- public boolean getLightPower(int index) {
|
|
|
- if (light == null) return false;
|
|
|
- if (index > light.length) return false;
|
|
|
- return light[index].bPower;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 조명 디밍 단계 가져오기
|
|
|
- *
|
|
|
- * @param index - (byte) 가져올 조명 인덱스
|
|
|
- *
|
|
|
- * @return (boolean) 조명 상태 (true:ON, false:OFF)
|
|
|
- */
|
|
|
- public byte getLightDimLevel(int index) {
|
|
|
- if (light == null) return (byte) 0x00;
|
|
|
- if (index > light.length) return (byte) 0x00;
|
|
|
- return light[index].hDimLevel;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 조명 디밍 지원 여부 가져오기
|
|
|
- *
|
|
|
- * @param index - (byte) 가져올 조명 인덱스
|
|
|
- *
|
|
|
- * @return (boolean) 조명 디밍 지원 여부 (true:지원, false:미지원)
|
|
|
- */
|
|
|
- public boolean getLightDimUsage(int index) {
|
|
|
- if (light == null) return false;
|
|
|
- if (index > light.length) return false;
|
|
|
- return light[index].bDimUsage;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 조명 상태 정보 가져오기
|
|
|
- *
|
|
|
- * @param index - (byte) 가져올 조명 인덱스
|
|
|
- *
|
|
|
- * @return (Light) 조명 상태 정보
|
|
|
- */
|
|
|
- public Light getLightStatus(int index) {
|
|
|
- if (light == null) return null;
|
|
|
- if (index > light.length) return null;
|
|
|
- return light[index];
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 조명 ON/OFF 설정하기
|
|
|
- *
|
|
|
- * @param index - (byte) 설정할 조명 인덱스
|
|
|
- * @param onoff - (boolean) 설정할 ON/OFF 상태
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- public boolean setLightPower(int index, boolean onoff) {
|
|
|
- if (light == null) return false;
|
|
|
- if (index > light.length) return false;
|
|
|
- light[index].bPower = onoff;
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 조명 디밍 설정하기
|
|
|
- *
|
|
|
- * @param index - (byte) 설정할 조명 인덱스
|
|
|
- * @param dimlevel - (boolean) 설정할 디밍 단계ㅒ
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- public boolean setLightDimLevel(int index, byte dimlevel) {
|
|
|
- if (light == null) return false;
|
|
|
- if (index > light.length) return false;
|
|
|
- light[index].hDimLevel = dimlevel;
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 조명 디밍 지원여부 설정하기
|
|
|
- *
|
|
|
- * @param index - (byte) 설정할 조명 인덱스
|
|
|
- * @param usage - (boolean) 설정할 디밍 지원 여부
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- public boolean setLightDimUsage(int index, boolean usage) {
|
|
|
- if (light == null) return false;
|
|
|
- if (index > light.length) return false;
|
|
|
- light[index].bDimUsage = usage;
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- /** 일괄소등 상태 {@link BATCHOFF_STATUS}*/
|
|
|
- public byte hBatchOffStatus;
|
|
|
-
|
|
|
- ////////////////////////////////////////////////////////////
|
|
|
- // 콘센트
|
|
|
- ////////////////////////////////////////////////////////////
|
|
|
- /** 콘센트 개별 데이터 정의 */
|
|
|
- public static class Outlet {
|
|
|
- /** 상태 {@link OUTLET_STATUS}*/
|
|
|
- public byte Status;
|
|
|
- /** 모드 {@link OUTLET_MODE}*/
|
|
|
- public byte Mode;
|
|
|
- /** 현재 소비전력 */
|
|
|
- public double NowPw;
|
|
|
- /** 대기전력 차단 기준값 */
|
|
|
- public double CutOffVal;
|
|
|
-
|
|
|
- public Outlet() {
|
|
|
- Status = OUTLET_STATUS.Off;
|
|
|
- Mode = OUTLET_MODE.Always;
|
|
|
- NowPw = 0.0;
|
|
|
- CutOffVal = 0.0;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString(int index) {
|
|
|
- String retStr = "[" + (int) (index+1) + "] ";
|
|
|
-
|
|
|
- retStr += "Status:" + OUTLET_STATUS.ToDebugString(Status) + " / ";
|
|
|
- retStr += "Mode:" + OUTLET_MODE.ToDebugString(Mode) + " / ";
|
|
|
- retStr += "NowPw:" + NowPw + " / ";
|
|
|
- retStr += "CutOffVal:" + CutOffVal;
|
|
|
-
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 설치된 콘센트 개수 (범위 : 0 ~ 8)*/
|
|
|
- public byte hOutletCnt;
|
|
|
- /** 콘센트 */
|
|
|
- private Outlet[] outlet;
|
|
|
-
|
|
|
- /**
|
|
|
- * 콘센트 가져오기
|
|
|
- *
|
|
|
- * @param index - (byte) 가져올 콘센트 인덱스
|
|
|
- *
|
|
|
- * @return (Concent) 콘센트 클래스 (null : fail)
|
|
|
- */
|
|
|
- public Outlet getOutletStatus(int index) {
|
|
|
- if (outlet == null) return null;
|
|
|
- if (index > outlet.length) return null;
|
|
|
- return outlet[index];
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 콘센트 설정하기
|
|
|
- *
|
|
|
- * @param index - (byte) 설정할 콘센트 인덱스
|
|
|
- * @param Status - (byte) 설정할 콘센트 상태
|
|
|
- * @param Mode - (byte) 설정할 콘센트 모드
|
|
|
- * @param NowPw - (double) 설정할 콘센트 소비전력
|
|
|
- * @param CutOffVal - (double) 설정할 콘센트 차단기준값
|
|
|
- *
|
|
|
- * @return (boolean) 설정됨 여부 (true:정상, false:에러)
|
|
|
- */
|
|
|
- public boolean setOutlet(int index, byte Status, byte Mode, double NowPw, double CutOffVal) {
|
|
|
- if (outlet == null) return false;
|
|
|
- if (index > outlet.length) return false;
|
|
|
- Outlet setOutlet = outlet[index];
|
|
|
-
|
|
|
- setOutlet.Status = Status;
|
|
|
- setOutlet.Mode = Mode;
|
|
|
- setOutlet.NowPw = NowPw;
|
|
|
- setOutlet.CutOffVal = CutOffVal;
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- ////////////////////////////////////////////////////////////
|
|
|
- // 제어 - 시스템 에어컨
|
|
|
- ////////////////////////////////////////////////////////////
|
|
|
- public static class AirconData {
|
|
|
- ////////////////////////////////////////////
|
|
|
- // 기본기능
|
|
|
- ////////////////////////////////////////////
|
|
|
- /** 실내기 번호*/
|
|
|
- public byte[] hInsideID;
|
|
|
- /** onoff {@link SystemAircon.POWER} 값에 따름 */
|
|
|
- public byte hPower;
|
|
|
- /** 운전모드 {@link SystemAircon.MODE} 값에 따름 */
|
|
|
- public byte hMode;
|
|
|
- /** 풍량 {@link SystemAircon.AIRVOLUME} 값에 따름 */
|
|
|
- public byte hAirVol;
|
|
|
- /** 설정온도 (1도 단위) */
|
|
|
- public byte hSetTemper;
|
|
|
- /** 현재온도 */
|
|
|
- public byte hCurrentTemper;
|
|
|
- /** 풍향제어 상태 */
|
|
|
- public boolean bAirSwing;
|
|
|
- /** 지원하는 최저설정온도 (범위 : (냉방) 5도 ~ 20도) */
|
|
|
- public byte hMinCoolSetTemper;
|
|
|
- /** 지원하는 최대설정온도 (범위 : (냉방) 21도 ~ 40도) */
|
|
|
- public byte hMaxCoolSetTemper;
|
|
|
- /** 지원하는 최저설정온도 (범위 : (난방) 6도 ~ 30도) */
|
|
|
- public byte hMinHeatSetTemper;
|
|
|
- /** 지원하는 최고설정온도 (범위 : (난방) 6도 ~ 30도) */
|
|
|
- public byte hMaxHeatSetTemper;
|
|
|
- /** 모드지원 여부 (냉방) */
|
|
|
- public boolean bSupportModeCooling;
|
|
|
- /** 모드지원 여부 (송풍) */
|
|
|
- public boolean bSupportModeFan;
|
|
|
- /** 모드지원 여부 (난방) */
|
|
|
- public boolean bSupportModeHeating;
|
|
|
- /** 모드지원 여부 (제습) */
|
|
|
- public boolean bSupportModeDehumidify;
|
|
|
- /** 모드지원 여부 (자동) */
|
|
|
- public boolean bSupportModeAuto;
|
|
|
- /** 풍향제어 지원 여부 */
|
|
|
- public boolean bSupportAirSwing;
|
|
|
-
|
|
|
- public AirconData(int nCnt) {
|
|
|
- hInsideID = new byte[nCnt];
|
|
|
- for (int i = 0; i < nCnt; i++) hInsideID[i] = (byte) 0x00;
|
|
|
- hPower = SystemAircon.POWER.NoInfo;
|
|
|
- hMode = SystemAircon.MODE.NoInfo;
|
|
|
- hAirVol = SystemAircon.AIRVOLUME.NoInfo;
|
|
|
- hSetTemper = (byte) 0x00;
|
|
|
- hCurrentTemper = (byte) 0x00;
|
|
|
- bAirSwing = false;
|
|
|
- hMinCoolSetTemper = (byte) 0x12; // 18도
|
|
|
- hMaxCoolSetTemper = (byte) 0x1E; // 30도
|
|
|
- hMinHeatSetTemper = (byte) 0x10; // 16도
|
|
|
- hMaxHeatSetTemper = (byte) 0x2D; // 45도
|
|
|
- bSupportModeCooling = false;
|
|
|
- bSupportModeFan = false;
|
|
|
- bSupportModeHeating = false;
|
|
|
- bSupportModeDehumidify = false;
|
|
|
- bSupportModeAuto = false;
|
|
|
- bSupportAirSwing = false;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString(byte hDeviceIndex) {
|
|
|
- byte hDeviceID = (byte) ((byte) 0x51 + (byte) hDeviceIndex);
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "hDeviceID : " + String.format("0x%02X", hDeviceID) + "\r\n" +
|
|
|
- "hInsideID : " + makeAirconIDs() + "\r\n" +
|
|
|
- "hPower : " + SystemAircon.POWER.ToDebugString(hPower) + "\r\n" +
|
|
|
- "hMode : " + SystemAircon.MODE.ToDebugString(hMode) + "\r\n" +
|
|
|
- "hAirVol : " + SystemAircon.AIRVOLUME.ToDebugString(hAirVol) + "\r\n" +
|
|
|
- "hSetTemper : " + hSetTemper + "\r\n" +
|
|
|
- "hCurrentTemper : " + hCurrentTemper + "\r\n" +
|
|
|
- "bAirSwing : " + bAirSwing + "\r\n" +
|
|
|
- "hMinCoolSetTemper : " + hMinCoolSetTemper +"\r\n" +
|
|
|
- "hMaxCoolSetTemper : " + hMaxCoolSetTemper +"\r\n" +
|
|
|
- "hMinHeatSetTemper : " + hMinHeatSetTemper +"\r\n" +
|
|
|
- "hMaxHeatSetTemper : " + hMaxHeatSetTemper +"\r\n" +
|
|
|
- "bSupportModeCooling : " + bSupportModeCooling +"\r\n" +
|
|
|
- "bSupportModeFan : " + bSupportModeFan +"\r\n" +
|
|
|
- "bSupportModeHeating : " + bSupportModeHeating +"\r\n" +
|
|
|
- "bSupportModeDehumidify : " + bSupportModeDehumidify +"\r\n" +
|
|
|
- "bSupportModeAuto : " + bSupportModeAuto +"\r\n" +
|
|
|
- "bSupportAirSwing : " + bSupportAirSwing +"\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
- public void setAirconStatus(AirconData airconData) {
|
|
|
- if (airconData == null) return;
|
|
|
- hPower = airconData.hPower;
|
|
|
- hMode = airconData.hMode;
|
|
|
- hAirVol = airconData.hAirVol;
|
|
|
- hSetTemper = airconData.hSetTemper;
|
|
|
- hCurrentTemper = airconData.hCurrentTemper;
|
|
|
- bAirSwing = airconData.bAirSwing;
|
|
|
- }
|
|
|
-
|
|
|
- // 시스템 에어컨 데이터 클래스 -> 멀티스위치의 에어컨 데이터 클래스
|
|
|
- public void conversionAirconStatus(SystemAircon.AirconUnitData airconUnitData) {
|
|
|
- if (airconUnitData == null) return;
|
|
|
- hPower = airconUnitData.hPower;
|
|
|
- hMode = airconUnitData.hMode;
|
|
|
- hAirVol = airconUnitData.hAirVol;
|
|
|
- hSetTemper = airconUnitData.hSetTemper;
|
|
|
- hCurrentTemper = airconUnitData.hCurrentTemper;
|
|
|
- bAirSwing = airconUnitData.bAirSwing;
|
|
|
- }
|
|
|
-
|
|
|
- private String makeAirconIDs() {
|
|
|
- String strResult = null;
|
|
|
- if (hInsideID == null) return strResult;
|
|
|
-
|
|
|
- strResult = "Cnt [" + Integer.toString(hInsideID.length) + "]/ID: ";
|
|
|
- for (int i = 0; i < hInsideID.length; i++) {
|
|
|
- strResult += "[" + hInsideID[i] + "]";
|
|
|
- }
|
|
|
-
|
|
|
- return strResult;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public AirconData airconData;
|
|
|
-
|
|
|
- public boolean setAirconStatus(byte power, byte mode, byte airvol, byte settemper, byte currenttemper, boolean airswing) {
|
|
|
- airconData.hPower = power;
|
|
|
- airconData.hMode = mode;
|
|
|
- airconData.hAirVol = airvol;
|
|
|
- airconData.hSetTemper = settemper;
|
|
|
- airconData.hCurrentTemper = currenttemper;
|
|
|
- airconData.bAirSwing = airswing;
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 기기를 생성한다.
|
|
|
- *
|
|
|
- * @param lightCnt - (byte) 설정할 조명 개수 (범위 : 0 ~ 8)
|
|
|
- * @param outletCnt - (byte) 설정할 콘센트 개수 (범위 : 0 ~ 8)
|
|
|
- */
|
|
|
- public Device(byte lightCnt, byte outletCnt) {
|
|
|
- // 1. Light
|
|
|
- if (lightCnt > 0) {
|
|
|
- hLightCnt = lightCnt;
|
|
|
- light = new Light [hLightCnt];
|
|
|
- for (byte i = 0; i < hLightCnt; i++) light[i] = new Light();
|
|
|
- }
|
|
|
- else {
|
|
|
- hLightCnt = 0;
|
|
|
- light = null;
|
|
|
- }
|
|
|
- hBatchOffStatus = BATCHOFF_STATUS.Clr;
|
|
|
-
|
|
|
- // 2. Concent
|
|
|
- if (outletCnt > 0) {
|
|
|
- hOutletCnt = outletCnt;
|
|
|
- outlet = new Outlet[outletCnt];
|
|
|
- for (byte i = 0; i < outletCnt; i++) outlet[i] = new Outlet();
|
|
|
- }
|
|
|
- else {
|
|
|
- hOutletCnt = 0;
|
|
|
- outlet = null;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString(byte DeviceIdx) {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "(" + (byte)(DeviceIdx + 1) + ") Device - Circuit\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
-
|
|
|
- "hLightCnt : " + hLightCnt + "\r\n";
|
|
|
- if (light != null) {
|
|
|
- retStr += "LightPower : ";
|
|
|
- for (byte i = 0; i < hLightCnt; i++) {
|
|
|
- retStr += "[" + (int)(i+1) + "]";
|
|
|
- if (light[i].bPower) retStr += "O ";
|
|
|
- else retStr += "X ";
|
|
|
- retStr += " ";
|
|
|
- }
|
|
|
- retStr += "\r\n";
|
|
|
-
|
|
|
- retStr += "LightDimLevel : ";
|
|
|
- for (byte i = 0; i < hLightCnt; i++) {
|
|
|
- retStr += "[" + (int)(i+1) + "]";
|
|
|
- retStr += light[i].hDimLevel;
|
|
|
- retStr += " ";
|
|
|
- }
|
|
|
- retStr += "\r\n";
|
|
|
-
|
|
|
- retStr += "LightDimUsage : ";
|
|
|
- for (byte i = 0; i < hLightCnt; i++) {
|
|
|
- retStr += "[" + (int)(i+1) + "]";
|
|
|
- if (light[i].bDimUsage) retStr += "O ";
|
|
|
- else retStr += "X ";
|
|
|
- retStr += " ";
|
|
|
- }
|
|
|
- retStr += "\r\n";
|
|
|
- }
|
|
|
- retStr += "\r\n";
|
|
|
-
|
|
|
- retStr += "hOutletCnt : " + hOutletCnt + "\r\n";
|
|
|
- if (outlet != null) {
|
|
|
- for (byte i = 0; i < hOutletCnt; i++) {
|
|
|
- retStr += outlet[i].ToDebugString(i) + "\r\n";
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- retStr += "==========================";
|
|
|
-
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 일괄소등 상태 */
|
|
|
- public static class BATCHOFF_STATUS {
|
|
|
- /** 일괄소등 설정 상태 */
|
|
|
- public static byte Set = 0x01;
|
|
|
- /** 일괄소등 해제 상태 */
|
|
|
- public static byte Clr = 0x02;
|
|
|
-
|
|
|
- /**
|
|
|
- * 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param nStatus - (byte) 체크할 상태
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean checkRange(byte nStatus) {
|
|
|
- if (nStatus == BATCHOFF_STATUS.Set) return true;
|
|
|
- else if (nStatus == BATCHOFF_STATUS.Clr) return true;
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public static String ToDebugString(byte nStatus) {
|
|
|
- String retStr;
|
|
|
- if (nStatus == BATCHOFF_STATUS.Set) retStr = "Set";
|
|
|
- else if (nStatus == BATCHOFF_STATUS.Clr) retStr = "Clr";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 콘센트 상태 */
|
|
|
- public static class OUTLET_STATUS {
|
|
|
- /** ON 상태 */
|
|
|
- public static byte On = 0x01;
|
|
|
- /** OFF 상태(노말) */
|
|
|
- public static byte Off = 0x02;
|
|
|
- /** OFF 상태(대기전력 자동으로 차단됨) */
|
|
|
- public static byte CutOff = 0x03;
|
|
|
- /** OFF 상태(과부하로 차단됨) */
|
|
|
- public static byte OverLoadOff = 0x04;
|
|
|
-
|
|
|
- /**
|
|
|
- * 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param nStatus - (byte) 체크할 상태
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean checkRange(byte nStatus) {
|
|
|
- if (nStatus == On) return true;
|
|
|
- else if (nStatus == Off) return true;
|
|
|
- else if (nStatus == CutOff) return true;
|
|
|
- else if (nStatus == OverLoadOff) return true;
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public static String ToDebugString(byte nStatus) {
|
|
|
- String retStr;
|
|
|
- if (nStatus == On) retStr = "On";
|
|
|
- else if (nStatus == Off) retStr = "Off";
|
|
|
- else if (nStatus == CutOff) retStr = "CutOff";
|
|
|
- else if (nStatus == OverLoadOff) retStr = "OverLoadOff";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 콘센트 모드 */
|
|
|
- public static class OUTLET_MODE {
|
|
|
- /** 자동모드 (대기전력 감시를 사용함) */
|
|
|
- public static byte Auto = 0x01;
|
|
|
- /** 상시모드 (대기전력 감시를 사용하지않음) */
|
|
|
- public static byte Always = 0x02;
|
|
|
-
|
|
|
- /**
|
|
|
- * 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param nStatus - (byte) 체크할 상태
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean checkRange(byte nStatus) {
|
|
|
- if (nStatus == Auto) return true;
|
|
|
- else if (nStatus == Always) return true;
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public static String ToDebugString(byte nStatus) {
|
|
|
- String retStr;
|
|
|
- if (nStatus == Auto) retStr = "Auto";
|
|
|
- else if (nStatus == Always) retStr = "Always";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /** [LED Dimming] 데이터 클래스 */
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- public static class LedController
|
|
|
- {
|
|
|
- public Info info;
|
|
|
- public Device device;
|
|
|
-
|
|
|
- /**
|
|
|
- * 생성자<br>
|
|
|
- */
|
|
|
- public LedController()
|
|
|
- {
|
|
|
- info = new Info();
|
|
|
- device = new Device();
|
|
|
- }
|
|
|
-
|
|
|
- /** 보드정보 */
|
|
|
- public static class Info
|
|
|
- {
|
|
|
- /** 설치상태 (true:설치 , false:미설치) */
|
|
|
- public boolean Install;
|
|
|
-
|
|
|
- /** 기기 지원정보 */
|
|
|
- public SUPPORT Support;
|
|
|
-
|
|
|
- /** 제조사 코드 ( 0x01 : 아이콘트롤스, 0x02 : 제일전기, 0x03 : 네스트필드 ) */
|
|
|
- public byte Vender;
|
|
|
-
|
|
|
- /** 펌웨어 Build Date (년) */
|
|
|
- public byte FwVer_Year;
|
|
|
- /** 펌웨어 Build Date (월) */
|
|
|
- public byte FwVer_Month;
|
|
|
- /** 펌웨어 Build Date (일) */
|
|
|
- public byte FwVer_Day;
|
|
|
- /** 펌웨어 Build Date (일련번호) */
|
|
|
- public byte FwVer_Number;
|
|
|
-
|
|
|
- /** 지원 프로토콜 버전 Main */
|
|
|
- public byte ProtocolVer_Main;
|
|
|
- /** 지원 프로토콜 버전 Sub */
|
|
|
- public byte ProtocolVer_Sub;
|
|
|
-
|
|
|
- public Info()
|
|
|
- {
|
|
|
- Install = false;
|
|
|
-
|
|
|
- Support = new SUPPORT();
|
|
|
-
|
|
|
- Vender = 0x00;
|
|
|
-
|
|
|
- FwVer_Year = 0x00;
|
|
|
- FwVer_Month = 0x00;
|
|
|
- FwVer_Day = 0x00;
|
|
|
- FwVer_Number = 0x00;
|
|
|
-
|
|
|
- ProtocolVer_Main = 0x00;
|
|
|
- ProtocolVer_Sub = 0x00;
|
|
|
- }
|
|
|
-
|
|
|
- public String ToDebugString(byte DeviceIdx)
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "(" + (byte)(DeviceIdx + 1) + ") Device - Info\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "Install : " + Install + "\r\n" +
|
|
|
- Support.ToDebugString() +
|
|
|
- "Vender : " + String.format("0x%02X", Vender) + "\r\n" +
|
|
|
- "FwVer : " + (int)(FwVer_Year+2000) + "." + FwVer_Month + "." + FwVer_Day + "." + FwVer_Number + "\r\n" +
|
|
|
- "ProtocolVer : " + "V" + ProtocolVer_Main + "." + ProtocolVer_Sub + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
- /** 기기 지원 정보 */
|
|
|
- public static class SUPPORT
|
|
|
- {
|
|
|
- /** ON/OFF **/
|
|
|
- public boolean OnOff;
|
|
|
-
|
|
|
- /** 디밍 제어 */
|
|
|
- public boolean Level;
|
|
|
-
|
|
|
- /** 색온도 제어 지원 */
|
|
|
- public boolean Color;
|
|
|
-
|
|
|
- /** 전압 측정 */
|
|
|
- public boolean DC_Voltage;
|
|
|
-
|
|
|
- /** 센서 사용여부 */
|
|
|
- public boolean Sensor;
|
|
|
-
|
|
|
- /** 센서 감도 설정 여부 */
|
|
|
- public boolean Sensitivity;
|
|
|
-
|
|
|
- /** 보드 온도 */
|
|
|
- public boolean BoardDegree;
|
|
|
-
|
|
|
- /** 전체 제어 명령어 사용 여부 (false: 0x21명령어 사용, true: 0x22명령어 사용)**/
|
|
|
- public boolean AllControlType;
|
|
|
-
|
|
|
- /** 센서 감지 횟수 **/
|
|
|
- public boolean SensorDetectCount;
|
|
|
-
|
|
|
- public SUPPORT()
|
|
|
- {
|
|
|
- OnOff = false;
|
|
|
- Level = false;
|
|
|
- Color = false;
|
|
|
- DC_Voltage = false;
|
|
|
- Sensor = false;
|
|
|
- Sensitivity = false;
|
|
|
- BoardDegree = false;
|
|
|
- AllControlType = false;
|
|
|
- SensorDetectCount = false;
|
|
|
- }
|
|
|
-
|
|
|
- public String ToDebugString()
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "[SUPPORT]" + "\r\n" +
|
|
|
- "OnOff : " + OnOff + "\r\n" +
|
|
|
- "Level : " + Level + "\r\n" +
|
|
|
- "Color : " + Color + "\r\n" +
|
|
|
- "DC_Voltage : " + DC_Voltage + "\r\n" +
|
|
|
- "Sensor : " + Sensor + "\r\n" +
|
|
|
- "Sensitivity : " + Sensitivity + "\r\n" +
|
|
|
- "BoardDegree : " + BoardDegree + "\r\n" +
|
|
|
- "AllControlType : " + AllControlType + "\r\n" +
|
|
|
- "SensorDetectCount : " + SensorDetectCount + "\r\n";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 기기 상태 */
|
|
|
- public static class Device
|
|
|
- {
|
|
|
- /** ON/OFF 상태 */
|
|
|
- public byte OnOff;
|
|
|
-
|
|
|
- /** 디밍 레벨 상태 */
|
|
|
- public byte Level;
|
|
|
-
|
|
|
- /** 색온도 상태 */
|
|
|
- public byte Color;
|
|
|
-
|
|
|
- /** 전압 **/
|
|
|
- public double DC_Voltage;
|
|
|
-
|
|
|
- /** 센서 설정 여부 **/
|
|
|
- public boolean Sensor;
|
|
|
-
|
|
|
- /** 센서 감도 */
|
|
|
- public byte Sensitivity;
|
|
|
-
|
|
|
- /** 보드온도 **/
|
|
|
- public double BoardDegree;
|
|
|
-
|
|
|
- /** 센서 감지 횟수 **/
|
|
|
- public int SensorDetectCount;
|
|
|
-
|
|
|
- /** 기기를 생성한다. */
|
|
|
- public Device()
|
|
|
- {
|
|
|
- OnOff = POWER.UnSet;
|
|
|
- Level = LEVEL.UnSet;
|
|
|
- Color = COLOR.UnSet;
|
|
|
- DC_Voltage = 0.0;
|
|
|
- Sensor = false;
|
|
|
- Sensitivity = 0x00;
|
|
|
- BoardDegree = 0.0;
|
|
|
- SensorDetectCount = 0;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString(byte DeviceIdx)
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "(" + (byte)(DeviceIdx + 1) + ") Device - Circuit\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
-
|
|
|
- "OnOff : " + OnOff + "\r\n" +
|
|
|
- "Level : " + Level + "\r\n" +
|
|
|
- "Color : " + Color + "\r\n" +
|
|
|
- "DC_Voltage : " + DC_Voltage + "\r\n" +
|
|
|
- "Sensor : " + Sensor + "\r\n" +
|
|
|
- "Sensitivity : " + Sensitivity + "\r\n" +
|
|
|
- "BoardDegree : " + BoardDegree + "\r\n" +
|
|
|
- "SensorDetectCount : " + SensorDetectCount + "\r\n";
|
|
|
- retStr += "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 전원 정의 */
|
|
|
- public static class POWER
|
|
|
- {
|
|
|
- public static byte UnSet = (byte)0xFF;
|
|
|
- public static byte On = (byte)0x01;
|
|
|
- public static byte Off = (byte)0x02;
|
|
|
-
|
|
|
- /**
|
|
|
- * 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param nStatus - (byte) 체크할 상태
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckRange(byte nStatus)
|
|
|
- {
|
|
|
- if((nStatus >= UnSet) && (nStatus <= Off))
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public static String ToDebugString(byte Color)
|
|
|
- {
|
|
|
- String retStr;
|
|
|
- if(Color == UnSet) retStr = "UnSet";
|
|
|
- else if(Color == On) retStr = "On";
|
|
|
- else if(Color == Off) retStr = "Off";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 디밍 정의 */
|
|
|
- public static class LEVEL
|
|
|
- {
|
|
|
- public static byte UnSet = (byte)0xFF;
|
|
|
- public static byte Min = (byte)0x00;
|
|
|
- public static byte Max = (byte)0x64;
|
|
|
-
|
|
|
- /**
|
|
|
- * 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param nStatus - (byte) 체크할 상태
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckRange(byte nStatus)
|
|
|
- {
|
|
|
- if((nStatus >= Min) && (nStatus <= Max))
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- else if(nStatus == UnSet)
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 색상 정의 */
|
|
|
- public static class COLOR
|
|
|
- {
|
|
|
- public static byte UnSet = (byte)0xFF;
|
|
|
- public static byte Min = (byte)0x00;
|
|
|
- public static byte Max = (byte)0x64;
|
|
|
-
|
|
|
- /**
|
|
|
- * 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param nStatus - (byte) 체크할 상태
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckRange(byte nStatus)
|
|
|
- {
|
|
|
- if((nStatus >= Min) && (nStatus <= Max))
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- else if(nStatus == UnSet)
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /** [에너지미터V2] 데이터 클래스 */
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- public static class EnergyMeterV2
|
|
|
- {
|
|
|
- public Info info;
|
|
|
- public Device device;
|
|
|
-
|
|
|
- /**
|
|
|
- * 생성자
|
|
|
- * **/
|
|
|
- public EnergyMeterV2()
|
|
|
- {
|
|
|
- info = new Info();
|
|
|
- device = new Device();
|
|
|
- }
|
|
|
-
|
|
|
- /** 조명 & 콘센트 정보 **/
|
|
|
- public static class Device
|
|
|
- {
|
|
|
- public LedController ledController[];
|
|
|
-
|
|
|
- public Device()
|
|
|
- {
|
|
|
- ledController = null;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 조명 콘센트 개수를 설정한다.
|
|
|
- *
|
|
|
- * @param nLightCount - (byte) 설정할 조명 개수 (범위 : 0 ~ 12)
|
|
|
- * @return (boolean) 설정 성공 여부 - true:성공, false:범위이탈
|
|
|
- */
|
|
|
- public boolean SetLedCount(byte nLightCount)
|
|
|
- {
|
|
|
- if(nLightCount >= 0 && nLightCount <= 12)
|
|
|
- {
|
|
|
- ledController = new LedController[nLightCount];
|
|
|
- for(int i = 0; i<nLightCount; i++)
|
|
|
- {
|
|
|
- ledController[i] = new LedController();
|
|
|
- }
|
|
|
- return true;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 보드정보 */
|
|
|
- public static class Info
|
|
|
- {
|
|
|
- /** 설치상태 (true:설치 , false:미설치) */
|
|
|
- public boolean Install;
|
|
|
-
|
|
|
- /** 기기 지원정보 */
|
|
|
- public SUPPORT Support;
|
|
|
-
|
|
|
- /** 펌웨어 Build Date (년) */
|
|
|
- public byte FwVer_Year;
|
|
|
- /** 펌웨어 Build Date (월) */
|
|
|
- public byte FwVer_Month;
|
|
|
- /** 펌웨어 Build Date (일) */
|
|
|
- public byte FwVer_Day;
|
|
|
- /** 펌웨어 Build Date (일련번호) */
|
|
|
- public byte FwVer_Number;
|
|
|
-
|
|
|
- /** 지원 프로토콜 버전 Main */
|
|
|
- public byte ProtocolVer_Main;
|
|
|
- /** 지원 프로토콜 버전 Sub */
|
|
|
- public byte ProtocolVer_Sub;
|
|
|
-
|
|
|
- /** 제조사 코드 ( 0x01 : 아이콘트롤스, 0x02 : 제일전기, 0x03 : 네스트필드 ) */
|
|
|
- public byte Vender;
|
|
|
-
|
|
|
- /** 조명 개수 **/
|
|
|
- public byte LedCount;
|
|
|
-
|
|
|
- /** 콘센트 개수 **/
|
|
|
- public byte ConcentCount;
|
|
|
-
|
|
|
- public Info()
|
|
|
- {
|
|
|
- Install = false;
|
|
|
-
|
|
|
- Support = new SUPPORT();
|
|
|
-
|
|
|
- FwVer_Year = 0x00;
|
|
|
- FwVer_Month = 0x00;
|
|
|
- FwVer_Day = 0x00;
|
|
|
- FwVer_Number = 0x00;
|
|
|
-
|
|
|
- ProtocolVer_Main = 0x00;
|
|
|
- ProtocolVer_Sub = 0x00;
|
|
|
-
|
|
|
- Vender = 0x00;
|
|
|
-
|
|
|
- LedCount = 0x00;
|
|
|
- ConcentCount = 0x00;
|
|
|
- }
|
|
|
-
|
|
|
- public String ToDebugString(byte DeviceIdx)
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "(" + (byte)(DeviceIdx + 1) + ") Device - Info\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "Install : " + Install + "\r\n" +
|
|
|
- Support.ToDebugString() +
|
|
|
- "Vender : " + String.format("0x%02X", Vender) + "\r\n" +
|
|
|
- "FwVer : " + (int)(FwVer_Year+2000) + "." + FwVer_Month + "." + FwVer_Day + "." + FwVer_Number + "\r\n" +
|
|
|
- "ProtocolVer : " + "V" + ProtocolVer_Main + "." + ProtocolVer_Sub + "\r\n" +
|
|
|
- "LedCount : " + LedCount + "\r\n" +
|
|
|
- "ConcentCount : " + ConcentCount + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
- /** 기기 지원 정보 */
|
|
|
- public static class SUPPORT
|
|
|
- {
|
|
|
- /** 시간 표시**/
|
|
|
- public boolean TimeShow;
|
|
|
-
|
|
|
- /** 조명 프로그램 스위치**/
|
|
|
- public boolean ProgramSwitch;
|
|
|
-
|
|
|
- /** 객실용 냉난방 제어**/
|
|
|
- public boolean FCU_Control;
|
|
|
-
|
|
|
- /** 에너지미터 구분( 0:거실, 1:주방, 2:안방, 3:침실 )**/
|
|
|
- public int EM_Type;
|
|
|
-
|
|
|
- public SUPPORT()
|
|
|
- {
|
|
|
- TimeShow = false;
|
|
|
- ProgramSwitch = false;
|
|
|
- FCU_Control = false;
|
|
|
- EM_Type = 0;
|
|
|
- }
|
|
|
-
|
|
|
- public String ToDebugString()
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "[SUPPORT]" + "\r\n" +
|
|
|
- "TimeShow : " + TimeShow + "\r\n" +
|
|
|
- "ProgramSwitch : " + ProgramSwitch + "\r\n" +
|
|
|
- "FCU_Control : " + FCU_Control + "\r\n" +
|
|
|
- "EM_Type : " + EM_Type + "\r\n";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /** [LED Dimming] 데이터 클래스 */
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- public static class LedDimming
|
|
|
- {
|
|
|
- public Info info;
|
|
|
- public Device device;
|
|
|
-
|
|
|
- /**
|
|
|
- * 생성자<br>
|
|
|
- */
|
|
|
- public LedDimming()
|
|
|
- {
|
|
|
- info = new Info();
|
|
|
- device = new Device();
|
|
|
- }
|
|
|
-
|
|
|
- /** 보드정보 */
|
|
|
- public static class Info
|
|
|
- {
|
|
|
- /** 설치상태 (true:설치 , false:미설치) */
|
|
|
- public boolean Install;
|
|
|
-
|
|
|
- /** 기기 지원정보 */
|
|
|
- public SUPPORT Support;
|
|
|
-
|
|
|
- /** 제조사 코드 ( 0x01 : 아이콘트롤스, 0x02 : 제일전기, 0x03 : 네스트필드 ) */
|
|
|
- public byte Vender;
|
|
|
-
|
|
|
- /** 펌웨어 Build Date (년) */
|
|
|
- public byte FwVer_Year;
|
|
|
- /** 펌웨어 Build Date (월) */
|
|
|
- public byte FwVer_Month;
|
|
|
- /** 펌웨어 Build Date (일) */
|
|
|
- public byte FwVer_Day;
|
|
|
- /** 펌웨어 Build Date (일련번호) */
|
|
|
- public byte FwVer_Number;
|
|
|
-
|
|
|
- /** 지원 프로토콜 버전 Main */
|
|
|
- public byte ProtocolVer_Main;
|
|
|
- /** 지원 프로토콜 버전 Sub */
|
|
|
- public byte ProtocolVer_Sub;
|
|
|
-
|
|
|
- public Info()
|
|
|
- {
|
|
|
- Install = false;
|
|
|
-
|
|
|
- Support = new SUPPORT();
|
|
|
-
|
|
|
- Vender = 0x00;
|
|
|
-
|
|
|
- FwVer_Year = 0x00;
|
|
|
- FwVer_Month = 0x00;
|
|
|
- FwVer_Day = 0x00;
|
|
|
- FwVer_Number = 0x00;
|
|
|
-
|
|
|
- ProtocolVer_Main = 0x00;
|
|
|
- ProtocolVer_Sub = 0x00;
|
|
|
- }
|
|
|
-
|
|
|
- public String ToDebugString(byte DeviceIdx)
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "(" + (byte)(DeviceIdx + 1) + ") Device - Info\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "Install : " + Install + "\r\n" +
|
|
|
- Support.ToDebugString() +
|
|
|
- "Vender : " + String.format("0x%02X", Vender) + "\r\n" +
|
|
|
- "FwVer : " + (int)(FwVer_Year+2000) + "." + FwVer_Month + "." + FwVer_Day + "." + FwVer_Number + "\r\n" +
|
|
|
- "ProtocolVer : " + "V" + ProtocolVer_Main + "." + ProtocolVer_Sub + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
- /** 기기 지원 정보 */
|
|
|
- public static class SUPPORT
|
|
|
- {
|
|
|
- /** ON/OFF **/
|
|
|
- public boolean OnOff;
|
|
|
-
|
|
|
- /** 디밍 제어 */
|
|
|
- public boolean Level;
|
|
|
-
|
|
|
- /** 색온도 제어 지원 */
|
|
|
- public boolean Color;
|
|
|
-
|
|
|
- /** 전압 측정 */
|
|
|
- public boolean DC_Voltage;
|
|
|
-
|
|
|
- /** 센서 사용여부 */
|
|
|
- public boolean Sensor;
|
|
|
-
|
|
|
- /** 센서 감도 설정 여부 */
|
|
|
- public boolean Sensitivity;
|
|
|
-
|
|
|
- /** 보드 온도 */
|
|
|
- public boolean BoardDegree;
|
|
|
-
|
|
|
- /** 전체 제어 명령어 사용 여부 (false: 0x21명령어 사용, true: 0x22명령어 사용)**/
|
|
|
- public boolean AllControlType;
|
|
|
-
|
|
|
- public SUPPORT()
|
|
|
- {
|
|
|
- OnOff = false;
|
|
|
- Level = false;
|
|
|
- Color = false;
|
|
|
- DC_Voltage = false;
|
|
|
- Sensor = false;
|
|
|
- Sensitivity = false;
|
|
|
- BoardDegree = false;
|
|
|
- AllControlType = false;
|
|
|
- }
|
|
|
-
|
|
|
- public String ToDebugString()
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "[SUPPORT]" + "\r\n" +
|
|
|
- "OnOff : " + OnOff + "\r\n" +
|
|
|
- "Level : " + Level + "\r\n" +
|
|
|
- "Color : " + Color + "\r\n" +
|
|
|
- "DC_Voltage : " + DC_Voltage + "\r\n" +
|
|
|
- "Sensor : " + Sensor + "\r\n" +
|
|
|
- "Sensitivity : " + Sensitivity + "\r\n" +
|
|
|
- "BoardDegree : " + BoardDegree + "\r\n" +
|
|
|
- "AllControlType : " + AllControlType + "\r\n";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 기기 상태 */
|
|
|
- public static class Device
|
|
|
- {
|
|
|
- /** ON/OFF 상태 */
|
|
|
- public boolean OnOff;
|
|
|
-
|
|
|
- /** 디밍 레벨 상태 */
|
|
|
- public byte Level;
|
|
|
-
|
|
|
- /** 색온도 상태 */
|
|
|
- public byte Color;
|
|
|
-
|
|
|
- /** 전압 **/
|
|
|
- public double DC_Voltage;
|
|
|
-
|
|
|
- /** 센서 설정 여부 **/
|
|
|
- public boolean Sensor;
|
|
|
-
|
|
|
- /** 센서 감도 */
|
|
|
- public byte Sensitivity;
|
|
|
-
|
|
|
- /** 보드온도 **/
|
|
|
- public double BoardDegree;
|
|
|
-
|
|
|
- /** 기기를 생성한다. */
|
|
|
- public Device()
|
|
|
- {
|
|
|
- OnOff = false;
|
|
|
- Level = 0x00;
|
|
|
- Color = 0x00;
|
|
|
- DC_Voltage = 0.0;
|
|
|
- Sensor = false;
|
|
|
- Sensitivity = 0x00;
|
|
|
- BoardDegree = 0.0;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString(byte DeviceIdx)
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "(" + (byte)(DeviceIdx + 1) + ") Device - Circuit\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
-
|
|
|
- "OnOff : " + OnOff + "\r\n" +
|
|
|
- "Level : " + Level + "\r\n" +
|
|
|
- "Color : " + Color + "\r\n" +
|
|
|
- "DC_Voltage : " + DC_Voltage + "\r\n" +
|
|
|
- "Sensor : " + Sensor + "\r\n" +
|
|
|
- "Sensitivity : " + Sensitivity + "\r\n" +
|
|
|
- "BoardDegree : " + BoardDegree + "\r\n";
|
|
|
- retStr += "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 전원 정의 */
|
|
|
- public static class POWER
|
|
|
- {
|
|
|
- public static byte UnSet = (byte)0xFF;
|
|
|
- public static byte On = (byte)0x01;
|
|
|
- public static byte Off = (byte)0x02;
|
|
|
-
|
|
|
- /**
|
|
|
- * 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param nStatus - (byte) 체크할 상태
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckRange(byte nStatus)
|
|
|
- {
|
|
|
- if((nStatus >= UnSet) && (nStatus <= Off))
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public static String ToDebugString(byte Color)
|
|
|
- {
|
|
|
- String retStr;
|
|
|
- if(Color == UnSet) retStr = "UnSet";
|
|
|
- else if(Color == On) retStr = "On";
|
|
|
- else if(Color == Off) retStr = "Off";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 디밍 정의 */
|
|
|
- public static class Level
|
|
|
- {
|
|
|
- public static byte UnSet = (byte)0xFF;
|
|
|
- public static byte Min = (byte)0x00;
|
|
|
- public static byte Max = (byte)0x64;
|
|
|
-
|
|
|
- /**
|
|
|
- * 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param nStatus - (byte) 체크할 상태
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckRange(byte nStatus)
|
|
|
- {
|
|
|
- if((nStatus >= Min) && (nStatus <= Max))
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- else if(nStatus == UnSet)
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 색상 정의 */
|
|
|
- public static class COLOR
|
|
|
- {
|
|
|
- public static byte UnSet = (byte)0xFF;
|
|
|
- public static byte Min = (byte)0x00;
|
|
|
- public static byte Max = (byte)0x64;
|
|
|
-
|
|
|
- /**
|
|
|
- * 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param nStatus - (byte) 체크할 상태
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckRange(byte nStatus)
|
|
|
- {
|
|
|
- if((nStatus >= Min) && (nStatus <= Max))
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- else if(nStatus == UnSet)
|
|
|
- {
|
|
|
- return true;
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /** [System Aircon] 데이터 클래스 */
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- public static class SystemAircon {
|
|
|
- /** 기기정보 */
|
|
|
- public Info info;
|
|
|
- public Setting setting;
|
|
|
- /** 각 에어컨 데이터 */
|
|
|
- public AirconUnitData[] Aircon;
|
|
|
-
|
|
|
- public SystemAircon() {
|
|
|
- info = new Info();
|
|
|
- setting = new Setting();
|
|
|
- Aircon = null;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 실내기 개수를 설정한다.<br>
|
|
|
- *
|
|
|
- * @param hCnt - (byte) 설정할 실내기개수 (범위: 1 ~ 9)
|
|
|
- * @return (boolean) true : 성공 , false : 실패
|
|
|
- */
|
|
|
- public boolean setInsideAirConditionerCnt(byte hCnt) {
|
|
|
- try {
|
|
|
- Log.w("SystemAircon", "[setInsideAirConditionerCnt] hCnt [" + hCnt + "]");
|
|
|
- if (info == null) {
|
|
|
- Log.w("SystemAircon", "[setInsideAirConditionerCnt] info is null!!!");
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- if ((hCnt <= 0) || (hCnt > 15)) {
|
|
|
- Log.w("SystemAircon", "[setInsideAirConditionerCnt] Out of range!! hCnt [" + hCnt + "]");
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- info.hInsideAirconCnt = hCnt;
|
|
|
- Aircon = new AirconUnitData[hCnt];
|
|
|
- for (byte i = 0; i < hCnt; i++) {
|
|
|
- Aircon[i] = new AirconUnitData();
|
|
|
- }
|
|
|
- return true;
|
|
|
- } catch (RuntimeException re) {
|
|
|
- LogUtil.errorLogInfo("", "", re);
|
|
|
- return false;
|
|
|
- }
|
|
|
- catch (Exception e) {
|
|
|
- Log.e("SystemAircon", "[Exception] setInsideAirConditionerCnt(byte hCnt)");
|
|
|
- LogUtil.errorLogInfo("", "", e);
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 기기정보 */
|
|
|
- public static class Info {
|
|
|
- /** 실내기개수(범위 : 1~9) */
|
|
|
- public byte hInsideAirconCnt;
|
|
|
- /** 실외기개수(범위 : 1~4) */
|
|
|
- public byte hOutsideAirconCnt;
|
|
|
- /** 첫 실외기에 포함된 실내기개수(범위 : 1~15) */
|
|
|
- public byte hFirtstOutAirconCnt;
|
|
|
- /** 에어컨 연동 상태 */
|
|
|
- public byte hAirconStatus;
|
|
|
- /** 제조사 코드 ( 프로토콜 문서에 따름 ) */
|
|
|
- public byte hVendor;
|
|
|
- /** 펌웨어 Build Date (년) */
|
|
|
- public byte hFwVer_Year;
|
|
|
- /** 펌웨어 Build Date (월) */
|
|
|
- public byte hFwVer_Month;
|
|
|
- /** 펌웨어 Build Date (일) */
|
|
|
- public byte hFwVer_Day;
|
|
|
- /** 펌웨어 Build Date (일련번호) */
|
|
|
- public byte hFwVer_No;
|
|
|
-
|
|
|
- /** 지원 프로토콜 버전 Main */
|
|
|
- public byte hProtocolVer_Main;
|
|
|
- /** 지원 프로토콜 버전 Sub */
|
|
|
- public byte hProtocolVer_Sub;
|
|
|
-
|
|
|
- public Info() {
|
|
|
- Support = new SupportInfo();
|
|
|
- hInsideAirconCnt = (byte) 0x00;
|
|
|
- hOutsideAirconCnt = (byte) 0x00;
|
|
|
- hFirtstOutAirconCnt = (byte) 0x00;
|
|
|
- hAirconStatus = Status.WAIT_OUTDOOR;
|
|
|
- hVendor = (byte) 0x00;
|
|
|
- hFwVer_Year = (byte) 0x00;
|
|
|
- hFwVer_Month = (byte) 0x00;
|
|
|
- hFwVer_Day = (byte) 0x00;
|
|
|
- hFwVer_No = (byte) 0x00;
|
|
|
- hProtocolVer_Main = (byte) 0x00;
|
|
|
- hProtocolVer_Sub = (byte) 0x00;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString() {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "Info\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "hInsideAirconCnt : " + hInsideAirconCnt + "\r\n" +
|
|
|
- "hOutsideAirconCnt : " + hOutsideAirconCnt + "\r\n" +
|
|
|
- "hFirtstOutAirconCnt : " + hFirtstOutAirconCnt + "\r\n" +
|
|
|
- "hAirconStatus : " + hAirconStatus + "\r\n" +
|
|
|
- "hVendor : " + String.format("0x%02X", hVendor) + "\r\n" +
|
|
|
- "hFwVer : " + (int)(hFwVer_Year+2000) + "." + hFwVer_Month + "." + hFwVer_Day + "." + hFwVer_No + "\r\n" +
|
|
|
- "hProtocolVer : " + "V" + hProtocolVer_Main + "." + hProtocolVer_Sub + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
- public SupportInfo Support;
|
|
|
-
|
|
|
- /** 기능 지원 여부 */
|
|
|
- public class SupportInfo {
|
|
|
- /** 지원하는 최저설정온도 (범위 : (냉방) 5도 ~ 20도) */
|
|
|
- public byte hMinCoolSetTemper;
|
|
|
- /** 지원하는 최대설정온도 (범위 : (냉방) 21도 ~ 40도) */
|
|
|
- public byte hMaxCoolSetTemper;
|
|
|
- /** 지원하는 최저설정온도 (범위 : (난방) 6도 ~ 30도) */
|
|
|
- public byte hMinHeatSetTemper;
|
|
|
- /** 지원하는 최고설정온도 (범위 : (난방) 6도 ~ 30도) */
|
|
|
- public byte hMaxHeatSetTemper;
|
|
|
- /** V2 CMD 사용 여부 */
|
|
|
- public boolean bV2CMDUsage;
|
|
|
- /** 모드제어 */
|
|
|
- public boolean bModeCtrl;
|
|
|
- /** 풍량제어 */
|
|
|
- public boolean bAirVolCtrl;
|
|
|
- /** 잔열제거중 제어 가능 */
|
|
|
- public boolean bCtrlOnResidualHeatRemoval;
|
|
|
- /** 온도설정 범위 변경 */
|
|
|
- public boolean bChangeTemperRange;
|
|
|
- /** FCU 연동 여부 */
|
|
|
- public boolean bFCUInterlock;
|
|
|
- /** 모드지원 여부 (냉방) */
|
|
|
- public boolean bModeCooling;
|
|
|
- /** 모드지원 여부 (송풍) */
|
|
|
- public boolean bModeFan;
|
|
|
- /** 모드지원 여부 (난방) */
|
|
|
- public boolean bModeHeating;
|
|
|
- /** 모드지원 여부 (제습) */
|
|
|
- public boolean bModeDehumidify;
|
|
|
- /** 모드지원 여부 (자동) */
|
|
|
- public boolean bModeAuto;
|
|
|
- /** 풍향제어 지원 여부 */
|
|
|
- public boolean bAirSwing;
|
|
|
-
|
|
|
- public SupportInfo() {
|
|
|
- hMinCoolSetTemper = (byte) 0x12; // 18도
|
|
|
- hMaxCoolSetTemper = (byte) 0x1E; // 30도
|
|
|
- hMinHeatSetTemper = (byte) 0x10; // 16도
|
|
|
- hMaxHeatSetTemper = (byte) 0x2D; // 45도
|
|
|
- bV2CMDUsage = false;
|
|
|
- bModeCtrl = false;
|
|
|
- bAirVolCtrl = false;
|
|
|
- bCtrlOnResidualHeatRemoval = false;
|
|
|
- bChangeTemperRange = false;
|
|
|
- bFCUInterlock = false;
|
|
|
- bModeCooling = false;
|
|
|
- bModeFan = false;
|
|
|
- bModeHeating = false;
|
|
|
- bModeDehumidify = false;
|
|
|
- bModeAuto = false;
|
|
|
- bAirSwing = false;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString() {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "SupportInfo\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "hMinCoolSetTemper : " + Support.hMinCoolSetTemper +"\r\n" +
|
|
|
- "hMaxCoolSetTemper : " + Support.hMaxCoolSetTemper +"\r\n" +
|
|
|
- "hMinHeatSetTemper : " + Support.hMinHeatSetTemper +"\r\n" +
|
|
|
- "hMaxHeatSetTemper : " + Support.hMaxHeatSetTemper +"\r\n" +
|
|
|
- "bV2CMDUsage : " + Support.bV2CMDUsage +"\r\n" +
|
|
|
- "bModeCtrl : " + Support.bModeCtrl +"\r\n" +
|
|
|
- "bAirVolCtrl : " + Support.bAirVolCtrl +"\r\n" +
|
|
|
- "bCtrlOnResidualHeatRemoval : " + Support.bCtrlOnResidualHeatRemoval +"\r\n" +
|
|
|
- "bChangeTemperRange : " + Support.bChangeTemperRange +"\r\n" +
|
|
|
- "bFCUInterlock : " + Support.bFCUInterlock +"\r\n" +
|
|
|
- "bModeCooling : " + Support.bModeCooling +"\r\n" +
|
|
|
- "bModeFan : " + Support.bModeFan +"\r\n" +
|
|
|
- "bModeHeating : " + Support.bModeHeating +"\r\n" +
|
|
|
- "bModeDehumidify : " + Support.bModeDehumidify +"\r\n" +
|
|
|
- "nModeAuto : " + Support.bModeAuto +"\r\n" +
|
|
|
- "bAirSwing : " + Support.bAirSwing +"\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 기기정보 설정*/
|
|
|
- public static class Setting {
|
|
|
- /** 설정 여부 ( 프로토콜 문서에 따름 ) */
|
|
|
- public byte hSettingStatus;
|
|
|
-
|
|
|
- /** 에어컨 연동 설정 */
|
|
|
- public byte hAirconSetting;
|
|
|
-
|
|
|
- /** 에어컨 제조사 설정 */
|
|
|
- public byte hManufactureSetting;
|
|
|
-
|
|
|
- /** 그룹 정보 */
|
|
|
- public GroupInfo groupinfo;
|
|
|
-
|
|
|
- public Setting() {
|
|
|
- hSettingStatus = 0;
|
|
|
- // 기본은 냉방전용 에어컨, 원래 값과 다른 경우 재설정을 해줘야 한다.
|
|
|
- hAirconSetting = (byte) 0x01;
|
|
|
- // 기본은 삼성, 원래 값과 다른 경우 재설정을 해줘야 한다.
|
|
|
- hManufactureSetting = (byte) 0x01;
|
|
|
- // 에어컨 그룹설정 정보 초기화
|
|
|
- groupinfo = new GroupInfo();
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString() {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "Setting\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "hSettingStatus : " + String.format("0x%02X", hSettingStatus) + "\r\n" +
|
|
|
- "hAirconSetting : " + String.format("0x%02X", hAirconSetting) + "\r\n" +
|
|
|
- "hManufactureSetting : " + String.format("0x%02X", hManufactureSetting) + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
- /** 그룹정보 설정*/
|
|
|
- public static class GroupInfo {
|
|
|
- /** 각 에어컨 데이터 */
|
|
|
-
|
|
|
- /** 그룹정보 설정 상태*/
|
|
|
- public byte hSettingStatus;
|
|
|
- /** 총 그룹 개수 */
|
|
|
- public byte hGroupCnt;
|
|
|
-
|
|
|
- /** 개별 그룹 정보 */
|
|
|
- public Group[] group;
|
|
|
-
|
|
|
- public GroupInfo() {
|
|
|
- hSettingStatus = (byte) 0x00;
|
|
|
- hGroupCnt = (byte) 0x00;
|
|
|
- setGroupCnt(hGroupCnt);
|
|
|
- }
|
|
|
-
|
|
|
- public boolean setGroupCnt(byte hCnt) {
|
|
|
- if ((hCnt <= 0) || (hCnt > 15)) return false;
|
|
|
-
|
|
|
- hGroupCnt = hCnt;
|
|
|
-
|
|
|
- group = new Group[hCnt];
|
|
|
- for (byte i = 0; i < hCnt; i++) {
|
|
|
- group[i] = new Group();
|
|
|
- }
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString() {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "Setting\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "hSettingStatus : " + String.format("0x%02X", hSettingStatus) + "\r\n" +
|
|
|
- "hGroupCnt : " + String.format("0x%02X", hGroupCnt) + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 개별 그룹 정보*/
|
|
|
- public static class Group {
|
|
|
- /** 그룹번호 */
|
|
|
- public byte hNo;
|
|
|
- /** 그룹 설정값 1 */
|
|
|
- public byte hGroupValue01;
|
|
|
- /** 그룹 설정값 2 */
|
|
|
- public byte hGroupValue02;
|
|
|
-
|
|
|
- public Group() {
|
|
|
- hNo = (byte) 0x00;
|
|
|
- hGroupValue01 = (byte) 0x00;
|
|
|
- hGroupValue02 = (byte) 0x00;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString() {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "Group\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "hNo : " + String.format("0x%02X", hNo) + "\r\n" +
|
|
|
- "hGroupValue01 : " + String.format("0x%02X", hGroupValue01) + "\r\n" +
|
|
|
- "hGroupValue02 : " + String.format("0x%02X", hGroupValue02) + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /** 에어컨 연동 상태 */
|
|
|
- public static class Status {
|
|
|
- /** 실외기 수 정보 수신 대기 */
|
|
|
- public static byte WAIT_OUTDOOR = (byte) 0x00;
|
|
|
- /** 실내기 수 정보 수신 대기 */
|
|
|
- public static byte WAIT_INSIDE = (byte) 0x01;
|
|
|
- /** 실내기 상태 정보 수신 대기 */
|
|
|
- public static byte WAIT_ALL = (byte) 0x02;
|
|
|
- /** 에어컨 연동 완료 */
|
|
|
- public static byte COMPLETE = (byte) 0x03;
|
|
|
-
|
|
|
- /**
|
|
|
- * 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param nStatus - (byte) 체크할 상태
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean checkRange(byte nStatus) {
|
|
|
- if (nStatus == WAIT_OUTDOOR) return true;
|
|
|
- else if (nStatus == WAIT_INSIDE) return true;
|
|
|
- else if (nStatus == WAIT_ALL) return true;
|
|
|
- else if (nStatus == COMPLETE) return true;
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- public static String ToDebugString(byte nStatus) {
|
|
|
- String retStr;
|
|
|
- if (nStatus == WAIT_OUTDOOR) retStr = "OFF";
|
|
|
- else if (nStatus == WAIT_INSIDE) retStr = "STAND_BY";
|
|
|
- else if (nStatus == WAIT_ALL) retStr = "NOT_SUPPORT";
|
|
|
- else if (nStatus == COMPLETE) retStr = "ON";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** ON/OFF상태 정의 */
|
|
|
- public static class POWER {
|
|
|
- /** 정보없음 */
|
|
|
- public static byte NoInfo = (byte) 0x00;
|
|
|
- /** 에어컨 ON */
|
|
|
- public static byte On = (byte) 0x01;
|
|
|
- /** 에어컨 OFF */
|
|
|
- public static byte Off = (byte) 0x02;
|
|
|
- /** 에어컨 잔열제거 */
|
|
|
- public static byte RemoveHeat = (byte) 0x03;
|
|
|
-
|
|
|
- public static String ToDebugString(byte hPower) {
|
|
|
- String retStr;
|
|
|
- if (hPower == POWER.NoInfo) retStr = "NoInfo";
|
|
|
- else if (hPower == POWER.On) retStr = "On";
|
|
|
- else if (hPower == POWER.Off) retStr = "Off";
|
|
|
- else if (hPower == POWER.RemoveHeat) retStr = "RemoveHeat";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 읽기 on/off 상태 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param hPower - (byte) 체크할 on/off모드
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean checkPowerRange(byte hPower) {
|
|
|
- if (hPower == POWER.NoInfo) return true;
|
|
|
- else if (hPower == POWER.On) return true;
|
|
|
- else if (hPower == POWER.Off) return true;
|
|
|
- else if (hPower == POWER.RemoveHeat) return true;
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 운전모드에 따른 ON/OFF 상태를 반환한다.
|
|
|
- *
|
|
|
- * @param hPower - (byte) 입력 운전모드
|
|
|
- *
|
|
|
- * @return (boolean) ture: ON , false: OFF, RemoveHeat
|
|
|
- */
|
|
|
- public static boolean getPower(byte hPower) {
|
|
|
- if (hPower == POWER.On) return true;
|
|
|
- else return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 운전상태 정의 */
|
|
|
- public static class MODE {
|
|
|
- /** 자동 */
|
|
|
- public static byte Auto = (byte) 0x00;
|
|
|
- /** 냉방 */
|
|
|
- public static byte Cooling = (byte) 0x01;
|
|
|
- /** 제습 */
|
|
|
- public static byte Dehumidify = (byte) 0x02;
|
|
|
- /** 송풍 */
|
|
|
- public static byte Fan = (byte) 0x03;
|
|
|
- /** 난방 */
|
|
|
- public static byte Heating = (byte) 0x04;
|
|
|
- /** 정보없음 */
|
|
|
- public static byte NoInfo = (byte) 0xFF;
|
|
|
-
|
|
|
- public static String ToDebugString(byte Mode) {
|
|
|
- String retStr;
|
|
|
- if (Mode == MODE.Auto) retStr = "Auto";
|
|
|
- else if (Mode == MODE.Cooling) retStr = "Cooling";
|
|
|
- else if (Mode == MODE.Dehumidify) retStr = "Dehumidify";
|
|
|
- else if (Mode == MODE.Fan) retStr = "Fan";
|
|
|
- else if (Mode == MODE.Heating) retStr = "Heating";
|
|
|
- else if (Mode == MODE.NoInfo) retStr = "NoInfo";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 설정운전모드 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param Mode - (byte) 체크할 운전모드
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean checkModeRange(byte Mode) {
|
|
|
- if (Mode == MODE.Auto) return true;
|
|
|
- else if (Mode == MODE.Cooling) return true;
|
|
|
- else if (Mode == MODE.Dehumidify) return true;
|
|
|
- else if (Mode == MODE.Fan) return true;
|
|
|
- else if (Mode == MODE.Heating) return true;
|
|
|
- else if (Mode == MODE.NoInfo) return true;
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 풍량 정의
|
|
|
- */
|
|
|
- public static class AIRVOLUME {
|
|
|
- /** 미설정 ( * 설정전용 : 읽기시 해당없음) */
|
|
|
- public static byte Auto = (byte) 0x00;
|
|
|
- /** 약 */
|
|
|
- public static byte Low = (byte) 0x01;
|
|
|
- /** 중 */
|
|
|
- public static byte Mid = (byte) 0x02;
|
|
|
- /** 강 */
|
|
|
- public static byte High = (byte) 0x03;
|
|
|
- /** 정보없음 */
|
|
|
- public static byte NoInfo = (byte) 0xFF;
|
|
|
-
|
|
|
- /**
|
|
|
- * 설정운전모드 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param hAirVol - (byte) 체크할 운전모드
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean checkAirVolRange(byte hAirVol) {
|
|
|
- if (hAirVol == AIRVOLUME.Auto) return true;
|
|
|
- else if (hAirVol == AIRVOLUME.Low) return true;
|
|
|
- else if (hAirVol == AIRVOLUME.Mid) return true;
|
|
|
- else if (hAirVol == AIRVOLUME.High) return true;
|
|
|
- else if (hAirVol == AIRVOLUME.NoInfo) return true;
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- public static String ToDebugString(byte hAirVol) {
|
|
|
- String retStr;
|
|
|
- if (hAirVol == AIRVOLUME.Auto) retStr = "Auto";
|
|
|
- else if (hAirVol == AIRVOLUME.Low) retStr = "Low";
|
|
|
- else if (hAirVol == AIRVOLUME.Mid) retStr = "Mid";
|
|
|
- else if (hAirVol == AIRVOLUME.High) retStr = "High";
|
|
|
- else if (hAirVol == AIRVOLUME.NoInfo) retStr = "NoInfo";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 각 에어컨 데이터 */
|
|
|
- public static class AirconUnitData {
|
|
|
- ////////////////////////////////////////////
|
|
|
- // 기본기능
|
|
|
- ////////////////////////////////////////////
|
|
|
- /** 실내기 번호*/
|
|
|
- public byte hInsideID;
|
|
|
- /** onoff {@link POWER} 값에 따름 */
|
|
|
- public byte hPower;
|
|
|
- /** 운전모드 {@link MODE} 값에 따름 */
|
|
|
- public byte hMode;
|
|
|
- /** 풍량 {@link AIRVOLUME} 값에 따름 */
|
|
|
- public byte hAirVol;
|
|
|
- /** 설정온도 (1도 단위) */
|
|
|
- public byte hSetTemper;
|
|
|
- /** 현재온도 */
|
|
|
- public byte hCurrentTemper;
|
|
|
- /** 풍향제어 상태 */
|
|
|
- public boolean bAirSwing;
|
|
|
- /** 실외기 에러상태 */
|
|
|
- public boolean bOutAirconError;
|
|
|
- /** 실내기 에러상태 */
|
|
|
- public boolean bInsideAirconError;
|
|
|
- /** 에러코드 1 */
|
|
|
- public byte hErrorCode1;
|
|
|
- /** 에러코드 2 */
|
|
|
- public byte hErrorCode2;
|
|
|
-
|
|
|
- public AirconUnitData() {
|
|
|
- hInsideID = (byte) 0x00;
|
|
|
- hPower = POWER.NoInfo;
|
|
|
- hMode = MODE.NoInfo;
|
|
|
- hAirVol = AIRVOLUME.NoInfo;
|
|
|
- hSetTemper = (byte) 0x00;
|
|
|
- hCurrentTemper = (byte) 0x00;
|
|
|
- bOutAirconError = false;
|
|
|
- bInsideAirconError = false;
|
|
|
- hErrorCode1 = (byte) 0x00;
|
|
|
- hErrorCode2 = (byte) 0x00;
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString() {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "hInsideID : " + hInsideID + "\r\n" +
|
|
|
- "hPower : " + POWER.ToDebugString(hPower) + "\r\n" +
|
|
|
- "hMode : " + MODE.ToDebugString(hMode) + "\r\n" +
|
|
|
- "hAirVol : " + AIRVOLUME.ToDebugString(hAirVol) + "\r\n" +
|
|
|
- "hSetTemper : " + hSetTemper + "\r\n" +
|
|
|
- "hCurrentTemper : " + hCurrentTemper + "\r\n" +
|
|
|
- "bAirSwing : " + bAirSwing + "\r\n" +
|
|
|
- "bOutAirconError : " + bOutAirconError + "\r\n" +
|
|
|
- "bInsideAirconError : " + bInsideAirconError + "\r\n" +
|
|
|
- "hErrorCode1 : " + String.format("0x%02X", hErrorCode1) + "\r\n" +
|
|
|
- "hErrorCode2 : " + String.format("0x%02X", hErrorCode2) + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /** [Purity] 데이터 클래스 */
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- public static class Purity {
|
|
|
- /** 기기정보 */
|
|
|
- public Info info;
|
|
|
-
|
|
|
- /** 각 청정환기 데이터 */
|
|
|
- public PurityData [] purityData;
|
|
|
-
|
|
|
- public Purity() {
|
|
|
- info = new Info();
|
|
|
- purityData = null;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 청정환기 개수를 설정한다.<br>
|
|
|
- *
|
|
|
- * @param cnt - (byte) 설정할 청정환기개수 (범위: 1 ~ 9)
|
|
|
- * @return (boolean) true : 성공 , false : 실패
|
|
|
- */
|
|
|
- public boolean SetPurityCount(byte cnt) {
|
|
|
- if (info == null) return false;
|
|
|
-
|
|
|
- if ((cnt <= 0) || (cnt > 15)) return false;
|
|
|
-
|
|
|
- info.InsidePurityCount = cnt;
|
|
|
- purityData = new PurityData [cnt];
|
|
|
- for (byte i = 0; i < cnt; i++) purityData[i] = new PurityData();
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- /** 기기정보 */
|
|
|
- public static class Info {
|
|
|
- /** 실내기개수(범위 : 1~9) */
|
|
|
- public byte InsidePurityCount;
|
|
|
- /** 청정환기 연동 상태 */
|
|
|
- public byte PurityStatus;
|
|
|
- /** 제조사 코드 ( 프로토콜 문서에 따름 ) */
|
|
|
- public byte Vendor;
|
|
|
- /** 펌웨어 Build Date (년) */
|
|
|
- public byte FwVer_Year;
|
|
|
- /** 펌웨어 Build Date (월) */
|
|
|
- public byte FwVer_Month;
|
|
|
- /** 펌웨어 Build Date (일) */
|
|
|
- public byte FwVer_Day;
|
|
|
- /** 펌웨어 Build Date (일련번호) */
|
|
|
- public byte FwVer_Number;
|
|
|
-
|
|
|
- /** 지원 프로토콜 버전 Main */
|
|
|
- public byte ProtocolVer_Main;
|
|
|
- /** 지원 프로토콜 버전 Sub */
|
|
|
- public byte ProtocolVer_Sub;
|
|
|
-
|
|
|
- public SupportInfo Support;
|
|
|
-
|
|
|
- /** 기능 지원 여부 */
|
|
|
- public class SupportInfo {
|
|
|
- /** 풍량 제어 */
|
|
|
- public boolean VolumeControl;
|
|
|
- /** 모드 제어 */
|
|
|
- public boolean ModeControl;
|
|
|
- /** 공기질 센싱 */
|
|
|
- public boolean AirSensing;
|
|
|
- /** 무풍 기능 */
|
|
|
- public boolean NoWindFunc;
|
|
|
- /** 취침 기능 */
|
|
|
- public boolean SleepFunc;
|
|
|
-
|
|
|
- public SupportInfo() {
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public Info() {
|
|
|
- Support = new SupportInfo();
|
|
|
- InsidePurityCount = 0;
|
|
|
- PurityStatus = Status.WAIT_OUTDOOR;
|
|
|
- }
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString() {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "Info\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "InsidePurityCount : " + InsidePurityCount + "\r\n" +
|
|
|
- "Vendor : " + String.format("0x%02X", Vendor) + "\r\n" +
|
|
|
- "FwVer : " + (int)(FwVer_Year+2000) + "." + FwVer_Month + "." + FwVer_Day + "." + FwVer_Number + "\r\n" +
|
|
|
- "ProtocolVer : " + "V" + ProtocolVer_Main + "." + ProtocolVer_Sub + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 청정환기 연동 상태 */
|
|
|
- public static class Status {
|
|
|
- /** 실외기 수 정보 수신 대기 */
|
|
|
- public static byte WAIT_OUTDOOR = (byte) 0x00;
|
|
|
- /** 실내기 수 정보 수신 대기 */
|
|
|
- public static byte WAIT_INSIDE = (byte) 0x01;
|
|
|
- /** 실내기 상태 정보 수신 대기 */
|
|
|
- public static byte WAIT_ALL = (byte) 0x02;
|
|
|
- /** 청정환기 연동 완료 */
|
|
|
- public static byte COMPLETE = (byte) 0x03;
|
|
|
-
|
|
|
- /**
|
|
|
- * 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param nStatus - (byte) 체크할 상태
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckRange(byte nStatus) {
|
|
|
- if (nStatus == WAIT_OUTDOOR) return true;
|
|
|
- else if (nStatus == WAIT_INSIDE) return true;
|
|
|
- else if (nStatus == WAIT_ALL) return true;
|
|
|
- else if (nStatus == COMPLETE) return true;
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- public static String ToDebugString(byte nStatus) {
|
|
|
- String retStr;
|
|
|
- if (nStatus == WAIT_OUTDOOR) retStr = "OFF";
|
|
|
- else if (nStatus == WAIT_INSIDE) retStr = "STAND_BY";
|
|
|
- else if (nStatus == WAIT_ALL) retStr = "NOT_SUPPORT";
|
|
|
- else if (nStatus == COMPLETE) retStr = "ON";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** ON/OFF상태 정의 */
|
|
|
- public static class ONOFF {
|
|
|
- /** 청정환기 ON */
|
|
|
- public static byte PurityON = 0x01;
|
|
|
- /** 청정환기 OFF */
|
|
|
- public static byte PurityOFF = 0x00;
|
|
|
-
|
|
|
- public static String ToDebugString(byte Mode) {
|
|
|
- String retStr;
|
|
|
- if (Mode == ONOFF.PurityON) retStr = "PurityON";
|
|
|
- else if (Mode == ONOFF.PurityOFF) retStr = "PurityOFF";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * onoff운전모드 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param OnOff - (byte) 체크할 onoff
|
|
|
-
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckGetOnOff(byte OnOff) {
|
|
|
- if (OnOff == ONOFF.PurityON) return true;
|
|
|
- else if (OnOff == ONOFF.PurityOFF) return true;
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 운전모드에 따른 ON/OFF 상태를 반환한다.
|
|
|
- *
|
|
|
- * @param Mode - (byte) 입력 운전모드
|
|
|
- *
|
|
|
- * @return (boolean) ture:ON , false:OFF
|
|
|
- */
|
|
|
- public static boolean GetOnOff(byte Mode) {
|
|
|
- if (Mode == ONOFF.PurityON) return true;
|
|
|
- else if (Mode == ONOFF.PurityOFF) return false;
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 청정환기 실내기 운전상태 정의 */
|
|
|
- public static class MODE {
|
|
|
- /** 자동 */
|
|
|
- public static byte AI = 0x00;
|
|
|
- /** 청정 */
|
|
|
- public static byte Purity = 0x01;
|
|
|
- /** 환기 */
|
|
|
- public static byte Venti = 0x02;
|
|
|
-
|
|
|
- public static String ToDebugString(byte Mode) {
|
|
|
- String retStr;
|
|
|
- if (Mode == MODE.AI) retStr = "AI";
|
|
|
- else if (Mode == MODE.Purity) retStr = "Purity";
|
|
|
- else if (Mode == MODE.Venti) retStr = "Venti";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 설정운전모드 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param Mode - (byte) 체크할 운전모드
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckGetMode(byte Mode) {
|
|
|
- if (Mode == MODE.AI) return true;
|
|
|
- else if (Mode == MODE.Purity) return true;
|
|
|
- else if (Mode == MODE.Venti) return true;
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 청정환기 부가기능(사용안함, 무풍, 취침) 정의 */
|
|
|
- public static class ADDSERVICE {
|
|
|
- /** 사용안함 */
|
|
|
- public static byte NotUse = 0x00;
|
|
|
- /** 무풍 */
|
|
|
- public static byte NoWind = 0x01;
|
|
|
- /** 취침 */
|
|
|
- public static byte Sleep = 0x02;
|
|
|
-
|
|
|
- public static String ToDebugString(byte add) {
|
|
|
- String retStr;
|
|
|
- if (add == ADDSERVICE.NotUse) retStr = "NotUse";
|
|
|
- else if (add == ADDSERVICE.NoWind) retStr = "NoWind";
|
|
|
- else if (add == ADDSERVICE.Sleep) retStr = "Sleep";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 부가기능 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param add - (byte) 체크할 운전모드
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckGetAddService(byte add) {
|
|
|
- if (add == ADDSERVICE.NotUse) return true;
|
|
|
- else if (add == ADDSERVICE.NoWind) return true;
|
|
|
- else if (add == ADDSERVICE.Sleep) return true;
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** ERV 운전모드 정의 */
|
|
|
- public static class ERV_MODE {
|
|
|
- /** 자동 */
|
|
|
- public static byte AI = 0x00;
|
|
|
- /** 전열교환 */
|
|
|
- public static byte HeatChange = 0x01;
|
|
|
- /** Bypass */
|
|
|
- public static byte Bypass = 0x02;
|
|
|
-
|
|
|
- public static String ToDebugString(byte Mode) {
|
|
|
- String retStr;
|
|
|
- if (Mode == ERV_MODE.AI) retStr = "AI";
|
|
|
- else if (Mode == ERV_MODE.HeatChange) retStr = "HeatChange";
|
|
|
- else if (Mode == ERV_MODE.Bypass) retStr = "Bypass";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * ERV 운전모드 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param Mode - (byte) 체크할 운전모드
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckGetMode(byte Mode) {
|
|
|
- if (Mode == ERV_MODE.AI) return true;
|
|
|
- else if (Mode == ERV_MODE.HeatChange) return true;
|
|
|
- else if (Mode == ERV_MODE.Bypass) return true;
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 필터알람상태 정의 */
|
|
|
- public static class FILTERALARM
|
|
|
- {
|
|
|
- /** False */
|
|
|
- public static byte False = 0x00;
|
|
|
- /** True */
|
|
|
- public static byte True = 0x01;
|
|
|
- /** 필터알람정보 없음 */
|
|
|
- public static byte NoInfo = 0x02;
|
|
|
-
|
|
|
- public static String ToDebugString(byte FilterAlarm)
|
|
|
- {
|
|
|
- String retStr;
|
|
|
- if(FilterAlarm == FILTERALARM.False) retStr = "False";
|
|
|
- else if(FilterAlarm == FILTERALARM.True) retStr = "True";
|
|
|
- else if(FilterAlarm == FILTERALARM.NoInfo) retStr = "NoInfo";
|
|
|
- else retStr = "UnDefined";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- /**
|
|
|
- * 설정운전모드 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param FilterAlarm - (byte) 체크할 운전모드
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckGetFilterAlarm(byte FilterAlarm)
|
|
|
- {
|
|
|
- if(FilterAlarm == FILTERALARM.False) return true;
|
|
|
- else if(FilterAlarm == FILTERALARM.True) return true;
|
|
|
- else if(FilterAlarm == FILTERALARM.NoInfo) return true;
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 풍량 정의
|
|
|
- */
|
|
|
- public static class VOLUME {
|
|
|
- /** 미설정 ( * 설정전용 : 읽기시 해당없음) */
|
|
|
- public static byte Auto = 0x00;
|
|
|
- /** 약 */
|
|
|
- public static byte Weak = 0x01;
|
|
|
- /** 중 */
|
|
|
- public static byte Medium = 0x02;
|
|
|
- /** 강 */
|
|
|
- public static byte Strong = 0x03;
|
|
|
-
|
|
|
- /**
|
|
|
- * 설정운전모드 범위를 체크한다.
|
|
|
- *
|
|
|
- * @param Mode - (byte) 체크할 운전모드
|
|
|
- *
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean CheckGetVolume(byte Mode)
|
|
|
- {
|
|
|
- if(Mode == VOLUME.Auto) return true;
|
|
|
- else if(Mode == VOLUME.Weak) return true;
|
|
|
- else if(Mode == VOLUME.Medium) return true;
|
|
|
- else if(Mode == VOLUME.Strong) return true;
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 각 청정환기 실내기 데이터 */
|
|
|
- public static class PurityData
|
|
|
- {
|
|
|
- ////////////////////////////////////////////
|
|
|
- // 기본기능
|
|
|
- ////////////////////////////////////////////
|
|
|
- /** onoff {@link MODE} 값에 따름 */
|
|
|
- public byte OnOff;
|
|
|
- /** 운전모드 {@link MODE} 값에 따름 */
|
|
|
- public byte Mode;
|
|
|
- /** 풍량 {@link VOLUME} 값에 따름 */
|
|
|
- public byte Volume;
|
|
|
- /** 무풍,취침 상태 여부 ( 0 : OFF, 1 : 무풍 ON, 2 : 취침 ON [무풍과 취침이 동시에 될 수 없다]) */
|
|
|
- public byte AddService;
|
|
|
- /** 취침 상태 여부 ( 0 : OFF, 1 : ON) */
|
|
|
- //public byte bSleep;
|
|
|
- /** 무풍 상태 여부 ( 0 : OFF, 1 : ON) */
|
|
|
- //public byte bNoWind;
|
|
|
-
|
|
|
- /** 각 열교환기 상태 데이터 */
|
|
|
- public ErvData ervData;
|
|
|
-
|
|
|
- /** 공기질 센싱 항목 데이터 */
|
|
|
- public AirSensingData airSensingData;
|
|
|
-
|
|
|
- public PurityData()
|
|
|
- {
|
|
|
- ervData = new ErvData();
|
|
|
- airSensingData = new AirSensingData();
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString(byte RoomIndex)
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "PurityData (" + (int) (RoomIndex+1) + ") \r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "OnOff : " + MODE.ToDebugString(OnOff) + "\r\n" +
|
|
|
- "Mode : " + MODE.ToDebugString(Mode) + "\r\n" +
|
|
|
- "Volume : " + MODE.ToDebugString(Volume) + "\r\n" +
|
|
|
- //"bSleep : " + MODE.ToDebugString(bSleep) + "\r\n" +
|
|
|
- //"bNoWind : " + MODE.ToDebugString(bNoWind) + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 각 열교환기 상태 데이터 */
|
|
|
- public static class ErvData
|
|
|
- {
|
|
|
- ////////////////////////////////////////////
|
|
|
- // 기본기능
|
|
|
- ////////////////////////////////////////////
|
|
|
- /** onoff {@link MODE} 값에 따름 */
|
|
|
- public byte OnOff;
|
|
|
- /** 운전모드 {@link MODE} 값에 따름 */
|
|
|
- public byte Mode;
|
|
|
- /** 필터알람상태 {@link MODE} 값에 따름 */
|
|
|
- public byte Filter;
|
|
|
- /** 풍량 {@link VOLUME} 값에 따름 */
|
|
|
- public byte Volume;
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString(byte RoomIndex)
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "ErvData (" + (int) (RoomIndex+1) + ") \r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "OnOff : " + MODE.ToDebugString(OnOff) + "\r\n" +
|
|
|
- "Mode : " + MODE.ToDebugString(Mode) + "\r\n" +
|
|
|
- "Filter : " + MODE.ToDebugString(Filter) + "\r\n" +
|
|
|
- "Volume : " + MODE.ToDebugString(Volume) + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 공기질 센싱 항목 데이터 */
|
|
|
- public static class AirSensingData
|
|
|
- {
|
|
|
- ////////////////////////////////////////////
|
|
|
- // 기본기능
|
|
|
- ////////////////////////////////////////////
|
|
|
- /** 운전모드*/
|
|
|
- public byte AirSense;
|
|
|
- /** 미세먼지 */
|
|
|
- public byte Dust;
|
|
|
- /** 초미세먼지 */
|
|
|
- public byte FindDust;
|
|
|
- /** 극초미세먼지 */
|
|
|
- public byte UltraFindDust;
|
|
|
- /** Co2 */
|
|
|
- public byte Co2;
|
|
|
- /** VOC */
|
|
|
- public byte Voc;
|
|
|
- /** 온도 */
|
|
|
- public byte Temp;
|
|
|
- /** 습도 */
|
|
|
- public byte Humidity;
|
|
|
-
|
|
|
- /** 미세먼지 값*/
|
|
|
- public byte dustValue[];
|
|
|
-
|
|
|
- /** 초미세먼지 값*/
|
|
|
- public byte fineDustValue[];
|
|
|
-
|
|
|
- /** Co2 값*/
|
|
|
- public byte co2Value[];
|
|
|
-
|
|
|
- byte[] ModeArray = new byte[]{0, 0, 0, 0, 0, 0};
|
|
|
-
|
|
|
- public AirSensingData()
|
|
|
- {
|
|
|
- dustValue = new byte[]{0, 0};
|
|
|
- fineDustValue = new byte[]{0, 0};
|
|
|
- co2Value = new byte[]{0, 0};
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString(byte RoomIndex)
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "AirData (" + (int) (RoomIndex+1) + ") \r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "AirSense : " + MODE.ToDebugString(AirSense) + "\r\n" +
|
|
|
- "Dust : " + MODE.ToDebugString(Dust) + "\r\n" +
|
|
|
- "FindDust : " + MODE.ToDebugString(FindDust) + "\r\n" +
|
|
|
- "Co2 : " + MODE.ToDebugString(Co2) + "\r\n" +
|
|
|
- "Voc : " + MODE.ToDebugString(Voc) + "\r\n" +
|
|
|
- "Temp : " + MODE.ToDebugString(Temp) + "\r\n" +
|
|
|
- "Humidity : " + MODE.ToDebugString(Humidity) + "\r\n" +
|
|
|
- "UltraFindDust : " + MODE.ToDebugString(UltraFindDust) + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 각 방 제어용 데이터 */
|
|
|
- public static class CtrlRoomData
|
|
|
- {
|
|
|
- /** 청정환기 제어 */
|
|
|
- public byte Control;
|
|
|
-
|
|
|
- public CtrlRoomData()
|
|
|
- {
|
|
|
- Control = 0;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 전체방 데이터 정의 (통신용) */
|
|
|
- public static class AllRoomData
|
|
|
- {
|
|
|
- public byte RoomCount;
|
|
|
- public EachRoomData [] Room;
|
|
|
-
|
|
|
- public AllRoomData(byte nRoomCount)
|
|
|
- {
|
|
|
- RoomCount = nRoomCount;
|
|
|
- Room = new EachRoomData[RoomCount];
|
|
|
- for(byte i=0 ; i<RoomCount ; i++) Room[i] = new EachRoomData();
|
|
|
- }
|
|
|
-
|
|
|
- public class EachRoomData
|
|
|
- {
|
|
|
- /** 운전모드 {@link MODE} 값에 따름 */
|
|
|
- public byte Mode;
|
|
|
- /** 풍량 {@link VOLUME} 값에 따름 */
|
|
|
- public byte Volume;
|
|
|
-
|
|
|
- public EachRoomData()
|
|
|
- {
|
|
|
- Mode = MODE.AI;
|
|
|
- Volume = VOLUME.Auto;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString()
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "AllRoomData\r\n" +
|
|
|
- "==========================\r\n";
|
|
|
-
|
|
|
- for(byte i=0 ; i<RoomCount ; i++)
|
|
|
- {
|
|
|
- //retStr += Room[i].ToDebugString(i);
|
|
|
- }
|
|
|
-
|
|
|
- retStr += "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 에러코드 */
|
|
|
- public static class ERROR
|
|
|
- {
|
|
|
- /** 실내기 에러여부 ( true : 이상, false : 정상) */
|
|
|
- public boolean bError;
|
|
|
- /** 기타이상 ( true : 이상, false : 정상) */
|
|
|
- public boolean bEtc;
|
|
|
-
|
|
|
- public ERROR()
|
|
|
- {
|
|
|
- bError = false;
|
|
|
- bEtc = false;
|
|
|
- }
|
|
|
-
|
|
|
- private String ToStrBoolean(boolean in) { if(in) return "O"; else return "X"; }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /** ------------------ 부가 서비스 관련 -------------- **/
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
-
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /** [주차정보] 데이터 클래스 */
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- public static class CarParkingData
|
|
|
- {
|
|
|
- public int index;
|
|
|
- public String card_num;
|
|
|
- public String card_uid;
|
|
|
- public String card_sn;
|
|
|
- public String card_type;
|
|
|
- public Calendar time;
|
|
|
- public String location_text;
|
|
|
- public String location_map;
|
|
|
- public String vehicle_info;
|
|
|
- public String ftp_path;
|
|
|
- public String ftp_idpass_info;
|
|
|
- public String message;
|
|
|
-
|
|
|
- /**
|
|
|
- * 생성자
|
|
|
- **/
|
|
|
- public CarParkingData()
|
|
|
- {
|
|
|
- index = 0;
|
|
|
- card_num = "null";
|
|
|
- card_uid = "null";
|
|
|
- card_sn = "null";
|
|
|
- card_type = "null";
|
|
|
- time = Calendar.getInstance();
|
|
|
- location_text = "null";
|
|
|
- location_map = "null";
|
|
|
- vehicle_info = "null";
|
|
|
- ftp_path = "null";
|
|
|
- ftp_idpass_info = "null";
|
|
|
- message = "null";
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString()
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "CarParkingData\r\n" +
|
|
|
- "==========================\r\n";
|
|
|
-
|
|
|
-
|
|
|
- String temp_time;
|
|
|
- if(time != null)
|
|
|
- {
|
|
|
- temp_time = String.format("%04d-%02d-%02d %02d:%02d:%02d",time.get(Calendar.YEAR),time.get(Calendar.MONTH)+1, time.get(Calendar.DAY_OF_MONTH),time.get(Calendar.HOUR_OF_DAY), time.get(Calendar.MINUTE), time.get(Calendar.SECOND));
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- temp_time = "null";
|
|
|
- }
|
|
|
- retStr +=
|
|
|
- "index :" + index + " \r\n" +
|
|
|
- "card_num :"+ card_num + " \r\n" +
|
|
|
- "card_uid :"+ card_uid + " \r\n" +
|
|
|
- "card_sn :"+ card_sn + " \r\n" +
|
|
|
- "card_type :"+ card_type + " \r\n" +
|
|
|
- "time :"+ temp_time + " \r\n" +
|
|
|
- "location_text :"+ location_text + " \r\n" +
|
|
|
- "location_map :"+ location_map + " \r\n" +
|
|
|
- "vehicle_info :"+ vehicle_info + " \r\n" +
|
|
|
- "ftp_path :"+ ftp_path + " \r\n" +
|
|
|
- "ftp_idpass_info :"+ ftp_idpass_info + " \r\n" +
|
|
|
- "message :"+ message + " \r\n";
|
|
|
-
|
|
|
- retStr += "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /** [주차 이벤트 정보] 데이터 클래스 */
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- public static class CarEventData
|
|
|
- {
|
|
|
- public Calendar time;
|
|
|
- public int EventType;
|
|
|
- public String CarNum;
|
|
|
- public String location;
|
|
|
- public String message;
|
|
|
-
|
|
|
- /**
|
|
|
- * 생성자
|
|
|
- **/
|
|
|
- public CarEventData()
|
|
|
- {
|
|
|
- time = Calendar.getInstance();
|
|
|
- EventType = 0;
|
|
|
- CarNum = "null";
|
|
|
- location = "null";
|
|
|
- message = "null";
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString()
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "CarEventData\r\n" +
|
|
|
- "==========================\r\n";
|
|
|
-
|
|
|
- String temp_time;
|
|
|
- if(time != null)
|
|
|
- {
|
|
|
- temp_time = String.format("%04d-%02d-%02d %02d:%02d:%02d",time.get(Calendar.YEAR),time.get(Calendar.MONTH)+1, time.get(Calendar.DAY_OF_MONTH),time.get(Calendar.HOUR_OF_DAY), time.get(Calendar.MINUTE), time.get(Calendar.SECOND));
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- temp_time = "null";
|
|
|
- }
|
|
|
-
|
|
|
- retStr +=
|
|
|
- "time :"+ temp_time + " \r\n" +
|
|
|
- "EventType :"+ EventType + " \r\n" +
|
|
|
- "Location :"+ location + " \r\n" +
|
|
|
- "CarNum :"+ CarNum + " \r\n" +
|
|
|
- "message :"+ message + " \r\n";
|
|
|
- retStr += "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // ///////////////////////////////////////////////////////////////////////////////////////
|
|
|
- // ///////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /** [가스 디버깅 데이터] 데이터 클래스 */
|
|
|
- // ///////////////////////////////////////////////////////////////////////////////////////
|
|
|
- // ///////////////////////////////////////////////////////////////////////////////////////
|
|
|
- public static class GasDebugData
|
|
|
- {
|
|
|
- public String time;
|
|
|
- public String packet;
|
|
|
-
|
|
|
- /**
|
|
|
- * 생성자
|
|
|
- **/
|
|
|
- public GasDebugData()
|
|
|
- {
|
|
|
- time = "null";
|
|
|
- packet = "null";
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString()
|
|
|
- {
|
|
|
- String retStr = "==========================\r\n" + "GasDebugData\r\n" + "==========================\r\n";
|
|
|
- retStr += "time :" + time + " \r\n" + "packet :" + packet + "\r\n";
|
|
|
- retStr += "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // ///////////////////////////////////////////////////////////////////////////////////////
|
|
|
- // ///////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /** [층간소음 센서] 데이터 클래스 */
|
|
|
- // ///////////////////////////////////////////////////////////////////////////////////////
|
|
|
- // ///////////////////////////////////////////////////////////////////////////////////////
|
|
|
- public static class InterlayerNoiseSensor
|
|
|
- {
|
|
|
- public Info info;
|
|
|
- public Device device;
|
|
|
-
|
|
|
- /**
|
|
|
- * 생성자
|
|
|
- **/
|
|
|
- public InterlayerNoiseSensor()
|
|
|
- {
|
|
|
- info = new Info();
|
|
|
- device = new Device();
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString()
|
|
|
- {
|
|
|
- String retStr = "==========================\r\n" + "InterlayerNoiseSensor\r\n" + "==========================\r\n";
|
|
|
- retStr += "info = " + info.ToDebugString();
|
|
|
- retStr += "device = " + device.ToDebugString();
|
|
|
- retStr += "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
- /** 층간소음 기기 상태 */
|
|
|
- public static class Device
|
|
|
- {
|
|
|
- /** * 층간소음 발생 상태*/
|
|
|
- private boolean NoiseOccur;
|
|
|
-
|
|
|
- /** * 통신 상태*/
|
|
|
- private boolean CommError;
|
|
|
-
|
|
|
-
|
|
|
- public boolean SetNoiseOccur(boolean input)
|
|
|
- {
|
|
|
- NoiseOccur = input;
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- public boolean GetNoiseOccur()
|
|
|
- {
|
|
|
- return NoiseOccur;
|
|
|
- }
|
|
|
-
|
|
|
- public boolean SetCommStatus(boolean input)
|
|
|
- {
|
|
|
- CommError = input;
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- public boolean GetCommStatus()
|
|
|
- {
|
|
|
- return CommError;
|
|
|
- }
|
|
|
-
|
|
|
- public Device()
|
|
|
- {
|
|
|
- CommError = false;
|
|
|
- NoiseOccur = false;
|
|
|
- }
|
|
|
-
|
|
|
- public String ToDebugString()
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "(InterLayer Noise Sensor - Device) \r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "CommError : " + CommError + "\r\n" +
|
|
|
- "NoiseOccur : " + NoiseOccur + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- /** 층간소음센서 정보 */
|
|
|
- public static class Info
|
|
|
- {
|
|
|
- /** 설치상태 (true:설치 , false:미설치) */
|
|
|
- public boolean Install;
|
|
|
-
|
|
|
- /** 제조사 코드 ( 0x01 : 제일전기, 0x02 = 다산지앤지, 0x03 = 클레오) */
|
|
|
- public byte Vender;
|
|
|
-
|
|
|
- /** 펌웨어 Build Date (년) */
|
|
|
- public byte FwVer_Year;
|
|
|
- /** 펌웨어 Build Date (월) */
|
|
|
- public byte FwVer_Month;
|
|
|
- /** 펌웨어 Build Date (일) */
|
|
|
- public byte FwVer_Day;
|
|
|
- /** 펌웨어 Build Date (일련번호) */
|
|
|
- public byte FwVer_Number;
|
|
|
-
|
|
|
- /** 지원 프로토콜 버전 Main */
|
|
|
- public byte ProtocolVer_Main;
|
|
|
- /** 지원 프로토콜 버전 Sub */
|
|
|
- public byte ProtocolVer_Sub;
|
|
|
-
|
|
|
- public Info()
|
|
|
- {
|
|
|
- Install = false;
|
|
|
- Vender = 0x00;
|
|
|
-
|
|
|
- FwVer_Year = 0x00;
|
|
|
- FwVer_Month = 0x00;
|
|
|
- FwVer_Day = 0x00;
|
|
|
- FwVer_Number = 0x00;
|
|
|
-
|
|
|
- ProtocolVer_Main = 0x00;
|
|
|
- ProtocolVer_Sub = 0x00;
|
|
|
- }
|
|
|
-
|
|
|
- public String ToDebugString()
|
|
|
- {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "( InterLayer Noise Sensor - Info)" + "\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "Vender : " + String.format("0x%02X", Vender) + "\r\n" +
|
|
|
- "FwVer : " + (int)(FwVer_Year+2000) + "." + FwVer_Month + "." + FwVer_Day + "." + FwVer_Number + "\r\n" +
|
|
|
- "ProtocolVer : " + "V" + ProtocolVer_Main + "." + ProtocolVer_Sub + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- // ///////////////////////////////////////////////////////////////////////////////////////
|
|
|
- // ///////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /** [공기질센서] 데이터 클래스 */
|
|
|
- // ///////////////////////////////////////////////////////////////////////////////////////
|
|
|
- // ///////////////////////////////////////////////////////////////////////////////////////
|
|
|
-
|
|
|
- public static class AirQualityData {
|
|
|
-
|
|
|
- public Info info;
|
|
|
- public Device device;
|
|
|
-
|
|
|
- public AirQualityData() {
|
|
|
- info = new Info();
|
|
|
- device = new Device();
|
|
|
- }
|
|
|
-
|
|
|
- /** 기기정보 */
|
|
|
- public static class Info {
|
|
|
- /** 기능 지원 여부 */
|
|
|
- public class SupportClass {
|
|
|
- /** 미세먼지 (PM10) 측정 여부 */
|
|
|
- public boolean bSensePM10 = false;
|
|
|
- /** 초세먼지 (PM2.5) 측정 여부 */
|
|
|
- public boolean bSensePM2p5 = false;
|
|
|
- /** 극초미세먼지(PM1.0) 측정 여부 */
|
|
|
- public boolean bSensePM1p0 = false;
|
|
|
- /** 실내 CO2 측정 여부 */
|
|
|
- public boolean bSenseCO2 = false;
|
|
|
- /** LED 밝기 제어 가능 여부 */
|
|
|
- public boolean bCtrlableLEDBrightness = false;
|
|
|
- /** 공기질 센서 팬 제어 가능 여부 */
|
|
|
- public boolean bCtrlableFanMode = false;
|
|
|
- }
|
|
|
-
|
|
|
- /** 기능 지원 여부 */
|
|
|
- public SupportClass Support;
|
|
|
- /** 펌웨어 Build Date (년) */
|
|
|
- public byte FWVer_Year;
|
|
|
- /** 펌웨어 Build Date (월) */
|
|
|
- public byte FWVer_Month;
|
|
|
- /** 펌웨어 Build Date (일) */
|
|
|
- public byte FWVer_Day;
|
|
|
- /** 펌웨어 Build Date (일련번호) */
|
|
|
- public byte FWVer_No;
|
|
|
-
|
|
|
- /** 지원 프로토콜 버전 Main */
|
|
|
- public byte ProtocolVer_Main;
|
|
|
- /** 지원 프로토콜 버전 Sub */
|
|
|
- public byte ProtocolVer_Sub;
|
|
|
-
|
|
|
- /** 제조사 정보 */
|
|
|
- public byte Vendor;
|
|
|
-
|
|
|
- /** 설치상태 (true:설치 , false:미설치) */
|
|
|
- public boolean Install;
|
|
|
-
|
|
|
- /** 생성자 */
|
|
|
- public Info() {
|
|
|
- Support = new SupportClass();
|
|
|
- Install = false;
|
|
|
- }
|
|
|
-
|
|
|
- /** 본 클래스 디버깅 메시지 */
|
|
|
- public String ToDebugString() {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- " Info\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "Install : " + Install + "\r\n" +
|
|
|
- "FwVer : " + (int)(FWVer_Year +2000) + "." + FWVer_Month + "." + FWVer_Day + "." + FWVer_No + "\r\n" +
|
|
|
- "ProtocolVer : " + "V" + ProtocolVer_Main + "." + ProtocolVer_Sub + "\r\n" +
|
|
|
- "Vendor : " + Vendor + "\r\n" +
|
|
|
-
|
|
|
- "[Support]" + "\r\n" +
|
|
|
- "bSensePM2p5 : " + Support.bSensePM2p5 + "\r\n" +
|
|
|
- "bSensePM10 : " + Support.bSensePM10 + "\r\n" +
|
|
|
- "bSensePM1p0 : " + Support.bSensePM1p0 + "\r\n" +
|
|
|
- "bSenseCO2 : " + Support.bSenseCO2 + "\r\n" +
|
|
|
- "bCtrlableLEDBrightness : " + Support.bCtrlableLEDBrightness + "\r\n" +
|
|
|
- "bCtrlableFanMode : " + Support.bCtrlableFanMode + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public static class Device {
|
|
|
- /** 센서 상태 (false : 정상/ true : 비정상) */
|
|
|
- public boolean bPMSensorStatus; // 먼지센서 상태 (미세먼지, 초미세먼지)
|
|
|
- public boolean bCo2SensorStatus; // Co2
|
|
|
- public boolean bAutoLEDCtrl; // 공기질 센서 상태 LED 밝기 자동 모드 동작 여부
|
|
|
- public boolean bAutoFanCtrl; // 공기질 센서의 팬 자동 모드 동작 여부
|
|
|
- public byte hLEDBrightness; // 공기질 센서 상태 LED 밝기 단계 (0x00: 꺼짐, 0x01: 어둡게, 0x02: 밝게)
|
|
|
- public byte hFanMode; // 공기질 센서의 팬 동작 모드 (0x00: 상시, 0x01: 꺼짐, 0x02: 반복)
|
|
|
- public double dFigure_PM10; // 미세먼지 수치값
|
|
|
- public double dFigure_PM2p5; // 초미세먼지 수치값
|
|
|
- public double dFigure_PM1p0; // 극초미세먼지 수치값
|
|
|
- public double dFigure_CO2; // 이산화탄소 농도
|
|
|
- public byte hLevel_PM10; // 미세먼지 레벨
|
|
|
- public byte hLevel_PM2p5; // 초미세먼지 레벨
|
|
|
- public byte hLevel_PM1p0; // 극초미세먼지 레벨
|
|
|
- public byte hLevel_CO2; // 이산화탄소 레벨
|
|
|
-
|
|
|
- public Device() {
|
|
|
- bPMSensorStatus = false;
|
|
|
- bCo2SensorStatus = false;
|
|
|
- bAutoLEDCtrl = true;
|
|
|
- bAutoFanCtrl = true;
|
|
|
- hLEDBrightness = LEDBrightness.Level_02; // 어둡게
|
|
|
- hFanMode = FanMode.Always; // 자동
|
|
|
- dFigure_PM10 = 0;
|
|
|
- dFigure_PM2p5 = 0;
|
|
|
- dFigure_PM1p0 = 0;
|
|
|
- dFigure_CO2 = 0;
|
|
|
- hLevel_PM10 = 0;
|
|
|
- hLevel_PM2p5 = 0;
|
|
|
- hLevel_PM1p0 = 0;
|
|
|
- hLevel_CO2 = 0;
|
|
|
- }
|
|
|
-
|
|
|
- public String ToDebugString() {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "DeviceData \r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "bPMSensorStatus : " + bPMSensorStatus + "\r\n" +
|
|
|
- "bPMSensorStatus : " + bPMSensorStatus + "\r\n" +
|
|
|
- "bAutoLEDCtrl : " + bAutoLEDCtrl + "\r\n" +
|
|
|
- "bAutoFanCtrl : " + bAutoFanCtrl + "\r\n" +
|
|
|
- "hLEDBrightness : " + hLEDBrightness + "\r\n" +
|
|
|
- "hFanMode : " + hFanMode + "\r\n" +
|
|
|
- "\r\n" +
|
|
|
- "hLevel_PM10 : " + hLevel_PM10 + "\r\n" +
|
|
|
- "dFigure_PM10 : " + dFigure_PM10 + "\r\n" +
|
|
|
- "\r\n" +
|
|
|
- "hLevel_PM2p5 : " + hLevel_PM2p5 + "\r\n" +
|
|
|
- "dFigure_PM2p5 : " + dFigure_PM2p5 + "\r\n" +
|
|
|
- "\r\n" +
|
|
|
- "hLevel_PM1p0 : " + hLevel_PM1p0 + "\r\n" +
|
|
|
- "dFigure_PM1p0 : " + dFigure_PM1p0 + "\r\n" +
|
|
|
- "\r\n" +
|
|
|
- "hLevel_CO2 : " + hLevel_CO2 + "\r\n" +
|
|
|
- "dFigure_CO2 : " + dFigure_CO2 + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
- /**공기질 상태 LED 밝기*/
|
|
|
- public static class LEDBrightness {
|
|
|
- public final static byte Level_00 = (byte) 0x00; // off
|
|
|
- public final static byte Level_01 = (byte) 0x01; // 1단계 (어둡게)
|
|
|
- public final static byte Level_02 = (byte) 0x02; // 2단계 (밝게)
|
|
|
- public final static byte Level_Auto = (byte) 0xFF; // 시간대별로 자동으로 LED밝기를 제어한다. (공기질 센서 프로토콜에는 없으며, 월패드에만 존재)
|
|
|
-
|
|
|
- /**
|
|
|
- * LED 밝기 레벨값 범위 확인
|
|
|
- * @param hLevel - (byte) 체크할 상태
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean checkRange(byte hLevel) {
|
|
|
- if ((hLevel < Level_00 || Level_02 < hLevel) && hLevel != Level_Auto) return false;
|
|
|
- else return true;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /**공기질 상태 LED 밝기*/
|
|
|
- public static class FanMode {
|
|
|
- public final static byte Always = (byte) 0x00; // 상시
|
|
|
- public final static byte Off = (byte) 0x01; // 꺼짐
|
|
|
- public final static byte Repeat = (byte) 0x02; // 반복 (On, Off를 반복함)
|
|
|
- public final static byte Auto = (byte) 0xFF; // 시간대별로 자동으로 센서팬 동작모드를 제어한다. (공기질 센서 프로토콜에는 없으며, 월패드에만 존재)
|
|
|
-
|
|
|
- /**
|
|
|
- * 센서팬 동작모드 상태값 범위 확인
|
|
|
- * @param hMode - (byte) 체크할 상태
|
|
|
- * @return (boolean) ture:정상 , false:범위이탈
|
|
|
- */
|
|
|
- public static boolean checkRange(byte hMode) {
|
|
|
- if ((hMode < Always || Repeat < hMode) && hMode != Auto) return false;
|
|
|
- else return true;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- ///////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- // AIRLevel
|
|
|
- ///////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- public static class AIRLevel {
|
|
|
- public static final class LEVEL6 {
|
|
|
- public static final class PM10 {
|
|
|
- public final static byte BEST = (byte)0x01;
|
|
|
- public final static byte GOOD = (byte)0x02;
|
|
|
- public final static byte NORMAL = (byte)0x03;
|
|
|
- public final static byte BAD = (byte)0x04;
|
|
|
- public final static byte WORSE = (byte)0x05;
|
|
|
- public final static byte WORST = (byte)0x06;
|
|
|
- }
|
|
|
-
|
|
|
- public static final class PM2_5 {
|
|
|
- public final static byte BEST = (byte)0x11;
|
|
|
- public final static byte GOOD = (byte)0x12;
|
|
|
- public final static byte NORMAL = (byte)0x13;
|
|
|
- public final static byte BAD = (byte)0x14;
|
|
|
- public final static byte WORSE = (byte)0x15;
|
|
|
- public final static byte WORST = (byte)0x16;
|
|
|
- }
|
|
|
-
|
|
|
- public static final class CO2 {
|
|
|
- public final static byte BEST = (byte)0x21;
|
|
|
- public final static byte GOOD = (byte)0x22;
|
|
|
- public final static byte NORMAL = (byte)0x23;
|
|
|
- public final static byte BAD = (byte)0x24;
|
|
|
- public final static byte WORSE = (byte)0x25;
|
|
|
- public final static byte WORST = (byte)0x26;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public static final class LEVEL4 {
|
|
|
- public static final class PM10 {
|
|
|
- public final static byte GOOD = (byte)0x02;
|
|
|
- public final static byte NORMAL = (byte)0x03;
|
|
|
- public final static byte BAD = (byte)0x04;
|
|
|
- public final static byte WORSE = (byte)0x05;
|
|
|
- }
|
|
|
-
|
|
|
- public static final class PM2_5 {
|
|
|
- public final static byte GOOD = (byte)0x12;
|
|
|
- public final static byte NORMAL = (byte)0x13;
|
|
|
- public final static byte BAD = (byte)0x14;
|
|
|
- public final static byte WORSE = (byte)0x15;
|
|
|
- }
|
|
|
-
|
|
|
- public static final class CO2 {
|
|
|
- public final static byte GOOD = (byte)0x22;
|
|
|
- public final static byte NORMAL = (byte)0x23;
|
|
|
- public final static byte BAD = (byte)0x24;
|
|
|
- public final static byte WORSE = (byte)0x25;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public static final class LEVEL8 {
|
|
|
- public static final class PM10 {
|
|
|
- public final static byte BEST = (byte)0x01;
|
|
|
- public final static byte GOOD = (byte)0x02;
|
|
|
- public final static byte FINE = (byte)0x03;
|
|
|
- public final static byte NORMAL = (byte)0x04;
|
|
|
- public final static byte BAD = (byte)0x05;
|
|
|
- public final static byte QUITEBAD = (byte)0x06;
|
|
|
- public final static byte WORSE = (byte)0x07;
|
|
|
- public final static byte WORST = (byte)0x08;
|
|
|
- }
|
|
|
-
|
|
|
- public static final class PM2_5 {
|
|
|
- public final static byte BEST = (byte)0x11;
|
|
|
- public final static byte GOOD = (byte)0x12;
|
|
|
- public final static byte FINE = (byte)0x13;
|
|
|
- public final static byte NORMAL = (byte)0x14;
|
|
|
- public final static byte BAD = (byte)0x15;
|
|
|
- public final static byte QUITEBAD = (byte)0x16;
|
|
|
- public final static byte WORSE = (byte)0x17;
|
|
|
- public final static byte WORST = (byte)0x18;
|
|
|
- }
|
|
|
-
|
|
|
- public static final class CO2 {
|
|
|
- public final static byte BEST = (byte)0x21;
|
|
|
- public final static byte GOOD = (byte)0x22;
|
|
|
- public final static byte FINE = (byte)0x23;
|
|
|
- public final static byte NORMAL = (byte)0x24;
|
|
|
- public final static byte BAD = (byte)0x25;
|
|
|
- public final static byte QUITEBAD = (byte)0x26;
|
|
|
- public final static byte WORSE = (byte)0x27;
|
|
|
- public final static byte WORST = (byte)0x28;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /** [쿡탑제어기/Cooktop Controller] 데이터 클래스*/
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- public static class CooktopCtrl {
|
|
|
-
|
|
|
- public Info info;
|
|
|
- public Circuit[] circuit;
|
|
|
-
|
|
|
- // 회로정보 없이 초기화
|
|
|
- public CooktopCtrl() {
|
|
|
- info = new Info();
|
|
|
- circuit = new Circuit[0];
|
|
|
- }
|
|
|
-
|
|
|
- // 회로정보와 함께 초기화
|
|
|
- public CooktopCtrl(byte circuitCnt) {
|
|
|
- if (circuitCnt < 0 || 15 < circuitCnt) {
|
|
|
- Log.w(TAG, "[CooktopCtrl] circuitCnt is out of range!!! circuitCnt -> " + circuitCnt);
|
|
|
- return;
|
|
|
- }
|
|
|
- info = new Info(circuitCnt);
|
|
|
- circuit = new Circuit[(int) circuitCnt];
|
|
|
- for(int i = 0 ; i< circuitCnt; i++)
|
|
|
- {
|
|
|
- circuit[i] = new Circuit();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 회로개수 설정
|
|
|
- public void setCircuitCnt(byte circuitCnt) {
|
|
|
- if (circuitCnt < 0 || 15 < circuitCnt) {
|
|
|
- Log.w(TAG, "[setCircuitCnt] circuitCnt is out of range!!! circuitCnt -> " + circuitCnt);
|
|
|
- return;
|
|
|
- }
|
|
|
- int circuit_len = (int) circuitCnt;
|
|
|
- circuit = new Circuit[circuit_len];
|
|
|
- for(int i = 0 ; i< circuit_len; i++)
|
|
|
- {
|
|
|
- circuit[i] = new Circuit();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 제어기 전체상태를 반환한다. */
|
|
|
- public Circuit getCircuit(byte index) {
|
|
|
- if (index < circuit.length || circuit.length < index) {
|
|
|
- Log.w(TAG, "[getCircuit] index is out of range!!! index -> " + index);
|
|
|
- return null;
|
|
|
- }
|
|
|
- Circuit Result = circuit[index];
|
|
|
- return Result;
|
|
|
- }
|
|
|
-
|
|
|
- /** 제어기 전체상태를 설정한다. */
|
|
|
- public boolean setCircuit(byte index, Circuit cir) {
|
|
|
- if (index < circuit.length || circuit.length < index) {
|
|
|
- Log.w(TAG, "[setCircuit] index is out of range!!! index -> " + index);
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- if (cir == null) {
|
|
|
- Log.w(TAG, "[setCircuit] cir is null!!");
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- circuit[index] = cir;
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- /** 보드정보 */
|
|
|
- public static class Info {
|
|
|
- /** 설치상태 (true:설치 , false:미설치) */
|
|
|
- public boolean bInstall;
|
|
|
-
|
|
|
- /** 제조사 코드 ( 0x01 : 한국소방, 0x02 : 신우전자 ) */
|
|
|
- public byte hVendor;
|
|
|
-
|
|
|
- /** 회로개수( 콘센트 - 범위 : 1~56) */
|
|
|
- public byte hCircuitCnt;
|
|
|
-
|
|
|
- /** 기능 제공 옵션 1/2 */
|
|
|
- public byte hSupport01;
|
|
|
- public byte hSupport02;
|
|
|
-
|
|
|
- /** 펌웨어 Build Date (년) */
|
|
|
- public byte hFWVer_Year;
|
|
|
- /** 펌웨어 Build Date (월) */
|
|
|
- public byte hFWVer_Month;
|
|
|
- /** 펌웨어 Build Date (일) */
|
|
|
- public byte hFWVer_Day;
|
|
|
- /** 펌웨어 Build Date (일련번호) */
|
|
|
- public byte hFWVer_No;
|
|
|
-
|
|
|
- /** 지원 프로토콜 버전 Main */
|
|
|
- public byte hProtocolVer_Main;
|
|
|
- /** 지원 프로토콜 버전 Sub */
|
|
|
- public byte hProtocolVer_Sub;
|
|
|
-
|
|
|
- /** 회로 타입 */
|
|
|
- public byte[] hCircuitType;
|
|
|
-
|
|
|
- public Info() {
|
|
|
- bInstall = false;
|
|
|
- hVendor = (byte) 0x00;
|
|
|
- hCircuitCnt = (byte) 0x00;
|
|
|
- hSupport01 = (byte) 0x00;
|
|
|
- hSupport02 = (byte) 0x00;
|
|
|
- hFWVer_Year = (byte) 0x00;
|
|
|
- hFWVer_Month = (byte) 0x00;
|
|
|
- hFWVer_Day = (byte) 0x00;
|
|
|
- hFWVer_No = (byte) 0x00;
|
|
|
- hProtocolVer_Main = (byte) 0x00;
|
|
|
- hProtocolVer_Sub = (byte) 0x00;
|
|
|
- if (0 < hCircuitCnt) {
|
|
|
- hCircuitType = new byte[(int) hCircuitCnt];
|
|
|
- for (int i = 0; i < 0; i++) hCircuitType[i] = DEVICE_TYPE.NOINFO;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public Info(byte hCircuitCnt) {
|
|
|
- bInstall = false;
|
|
|
- hVendor = (byte) 0x00;
|
|
|
- this.hCircuitCnt = hCircuitCnt;
|
|
|
- hSupport01 = (byte) 0x00;
|
|
|
- hSupport02 = (byte) 0x00;
|
|
|
- hFWVer_Year = (byte) 0x00;
|
|
|
- hFWVer_Month = (byte) 0x00;
|
|
|
- hFWVer_Day = (byte) 0x00;
|
|
|
- hFWVer_No = (byte) 0x00;
|
|
|
- hProtocolVer_Main = (byte) 0x00;
|
|
|
- hProtocolVer_Sub = (byte) 0x00;
|
|
|
- if (0 < this.hCircuitCnt) {
|
|
|
- hCircuitType = new byte[(int) this.hCircuitCnt];
|
|
|
- for (int i = 0; i < 0; i++) hCircuitType[i] = DEVICE_TYPE.NOINFO;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 디바이스 Info에 회로정보만 초기화
|
|
|
- public void setInfoCircuitCnt(byte hCnt) {
|
|
|
- hCircuitCnt = hCnt;
|
|
|
- if (0 < hCircuitCnt) {
|
|
|
- hCircuitType = new byte[(int) hCircuitCnt];
|
|
|
- for (int i = 0; i < 0; i++) hCircuitType[i] = DEVICE_TYPE.NOINFO;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public String ToDebugString(byte hDeviceID) {
|
|
|
- String strSubType = "0";
|
|
|
- for (int i = 0; i < hCircuitCnt; i++) {
|
|
|
- if (i == 0) strSubType = String.valueOf((int) hCircuitCnt) + "-";
|
|
|
- else strSubType += "/" + String.format("0x%02X", hCircuitType[i]);
|
|
|
- }
|
|
|
-
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "(" + (byte)(hDeviceID + 1) + ") Device - Info\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "Install : " + bInstall + "\r\n" +
|
|
|
- "Vendor : " + String.format("0x%02X", hVendor) + "\r\n" +
|
|
|
- "SubdeviceCnt : " + hCircuitCnt + "\r\n" +
|
|
|
- "Support01 : " + hSupport01 + "\r\n" +
|
|
|
- "Support02 : " + hSupport02 + "\r\n" +
|
|
|
- "FWVer : " + (int)(hFWVer_Year +2000) + "." + hFWVer_Month + "." + hFWVer_Day + "." + hFWVer_No + "\r\n" +
|
|
|
- "ProtocolVer : " + "V" + hProtocolVer_Main + "." + hProtocolVer_Sub + "\r\n" +
|
|
|
- "SubDeviceType : " + strSubType + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** CookTop 데이터 클래스 */
|
|
|
- /**
|
|
|
- * 회로개수( 콘센트 - 범위 : 1~15)
|
|
|
- */
|
|
|
- public static class Circuit {
|
|
|
-
|
|
|
- public Circuit() {
|
|
|
- hID = (byte) 0x00;
|
|
|
- hType = DEVICE_TYPE.NOINFO;
|
|
|
- hStatus = DEVICE_STATUS.NOINFO;
|
|
|
- hErrorStatus = (byte) 0x00;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 서브 기기 ID (Index)
|
|
|
- * 1부터 시작하며, 연번이어야 함 (1~56)
|
|
|
- */
|
|
|
- public byte hID;
|
|
|
-
|
|
|
- /**
|
|
|
- * 디바이스 타입
|
|
|
- * 0x00: 정보없음, 0x01: 가스밸브, 0x02: 쿡탑콘센트
|
|
|
- */
|
|
|
- public byte hType;
|
|
|
-
|
|
|
- /**
|
|
|
- * 제어기 상태
|
|
|
- * 0x00: 정보없음, 0x01: 닫힘, 0x02: 동작중, 0x03: 열림
|
|
|
- */
|
|
|
- public byte hStatus;
|
|
|
-
|
|
|
- /**
|
|
|
- * 제어기 이상 상태
|
|
|
- * BIT0: 제어기 이상, BIT1: 가스누출/전기누전, BIT2: 화재발생, BIT3: 가스/전기 센서 이상, BIT4: 화재센서 이상
|
|
|
- */
|
|
|
- public byte hErrorStatus;
|
|
|
-
|
|
|
- /** 제어기 ID를 반환한다. */
|
|
|
- public byte getCircuitID() {
|
|
|
- byte hResult = hID;
|
|
|
- return hResult;
|
|
|
- }
|
|
|
-
|
|
|
- /** 제어기 ID를 설정한다. */
|
|
|
- public boolean setCircuitID(byte id) {
|
|
|
- if (!DEVICE_ID.checkRange(id)) {
|
|
|
- Log.w(TAG, "[setCircuitID] id is out of range!! -> id: " + id);
|
|
|
- return false;
|
|
|
- }
|
|
|
- hID = id;
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- /** 제어기 종류를 반환한다. */
|
|
|
- public byte getCircuitType() {
|
|
|
- byte hResult = hType;
|
|
|
- return hResult;
|
|
|
- }
|
|
|
-
|
|
|
- /** 제어기 종류를 설정한다. */
|
|
|
- public boolean setCircuitType(byte type) {
|
|
|
- if (!DEVICE_TYPE.checkRange(type)) {
|
|
|
- Log.w(TAG, "[setCircuitType] type is out of range!! -> type: " + type);
|
|
|
- return false;
|
|
|
- }
|
|
|
- hType = type;
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- /** 제어기 상태를 반환한다. */
|
|
|
- public byte getCircuitStatus() {
|
|
|
- byte hResult = hStatus;
|
|
|
- return hResult;
|
|
|
- }
|
|
|
-
|
|
|
- /** 제어기 상태를 설정한다. */
|
|
|
- public boolean setCircuitStatus(byte status) {
|
|
|
- if (!DEVICE_STATUS.checkRange(status)) {
|
|
|
- Log.w(TAG, "[setCircuitStatus] type is out of range!! -> status: " + status);
|
|
|
- return false;
|
|
|
- }
|
|
|
- hStatus = status;
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- /** 제어기 에러 전체 상태 정보를 저장한다. */
|
|
|
- public void setErrorStatus(byte error) {
|
|
|
- hErrorStatus = error;
|
|
|
- }
|
|
|
-
|
|
|
- /** 제어기 에러 전체 상태 정보를 반환한다. */
|
|
|
- public byte getErrorStatus() {
|
|
|
- byte hResult = hErrorStatus;
|
|
|
- return hResult;
|
|
|
- }
|
|
|
-
|
|
|
- /** 개별 에러 상태 정보를 저장한다. - 제어기 이상 */
|
|
|
- public void setErrorStatus_CtrlError(boolean bValue) {
|
|
|
- if (bValue) hErrorStatus |= define.BIT0;
|
|
|
- }
|
|
|
-
|
|
|
- /** 개별 에러 상태 정보를 저장한다. - 가스누출/전기누전 */
|
|
|
- public void setErrorStatus_Leakage(boolean bValue) {
|
|
|
- if (bValue) hErrorStatus |= define.BIT1;
|
|
|
- }
|
|
|
-
|
|
|
- /** 개별 에러 상태 정보를 저장한다. - 화재발생 */
|
|
|
- public void setErrorStatus_Fire(boolean bValue) {
|
|
|
- if (bValue) hErrorStatus |= define.BIT2;
|
|
|
- }
|
|
|
-
|
|
|
- /** 개별 에러 상태 정보를 저장한다. - 가스/전기 센서 이상 */
|
|
|
- public void setErrorStatus_DetectionSensorError(boolean bValue) {
|
|
|
- if (bValue) hErrorStatus |= define.BIT3;
|
|
|
- }
|
|
|
-
|
|
|
- /** 개별 에러 상태 정보를 저장한다. - 화재 센서 이상*/
|
|
|
- public void setErrorStatus_FireSensorError(boolean bValue) {
|
|
|
- if (bValue) hErrorStatus |= define.BIT4;
|
|
|
- }
|
|
|
-
|
|
|
- /** 개별 에러 상태 정보를 반환한다. - 제어기 이상 */
|
|
|
- public boolean getErrorStatus_CtrlError() {
|
|
|
- if ((hErrorStatus & define.BIT0) != 0x00) return true;
|
|
|
- else return false;
|
|
|
- }
|
|
|
-
|
|
|
- /** 개별 에러 상태 정보를 반환한다. - 가스누출/전기누전 */
|
|
|
- public boolean getErrorStatus_Leakage() {
|
|
|
- if ((hErrorStatus & define.BIT1) != 0x00) return true;
|
|
|
- else return false;
|
|
|
- }
|
|
|
-
|
|
|
- /** 개별 에러 상태 정보를 반환한다. - 화재발생 */
|
|
|
- public boolean getErrorStatus_Fire() {
|
|
|
- if ((hErrorStatus & define.BIT2) != 0x00) return true;
|
|
|
- else return false;
|
|
|
- }
|
|
|
-
|
|
|
- /** 개별 에러 상태 정보를 반환한다. - 가스/전기 센서 이상 */
|
|
|
- public boolean getErrorStatus_DetectionSensorError() {
|
|
|
- if ((hErrorStatus & define.BIT3) != 0x00) return true;
|
|
|
- else return false;
|
|
|
- }
|
|
|
-
|
|
|
- /** 개별 에러 상태 정보를 반환한다. - 화재 센서 이상*/
|
|
|
- public boolean getErrorStatus_FireSensorError() {
|
|
|
- if ((hErrorStatus & define.BIT4) != 0x00) return true;
|
|
|
- else return false;
|
|
|
- }
|
|
|
-
|
|
|
- public String ToDebugString(byte hDeviceID) {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "(" + (byte)(hDeviceID + 1) + ") Device - Status\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
- "hID : " + String.format("0x%02X", hID) + "\r\n" +
|
|
|
- "hType : " + String.format("0x%02X", hType) + "\r\n" +
|
|
|
- "hStatus : " + String.format("0x%02X", hStatus) + "\r\n" +
|
|
|
- "hErrorStatus : " + String.format("0x%02X", hErrorStatus) + "\r\n" +
|
|
|
- "==========================";
|
|
|
- return retStr;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /** 디버깅 메시지 출력 */
|
|
|
- public String ToDebugString(byte DeviceIdx) {
|
|
|
- String retStr =
|
|
|
- "==========================\r\n" +
|
|
|
- "(" + (byte)(DeviceIdx + 1) + ") Device - Circuit\r\n" +
|
|
|
- "==========================\r\n" +
|
|
|
-
|
|
|
- "hCircuitCnt : " + info.hCircuitCnt + "\r\n";
|
|
|
- if (circuit != null) {
|
|
|
- retStr += "CircuitInfo : ";
|
|
|
- for (byte i = 0; i < info.hCircuitCnt; i++) {
|
|
|
- retStr += "[" + (int) circuit[i].getCircuitID() + "] ";
|
|
|
- retStr += DEVICE_TYPE.getString(circuit[i].getCircuitType()) + " / ";
|
|
|
- retStr += DEVICE_TYPE.getString(circuit[i].getCircuitStatus()) + " / ";
|
|
|
- retStr += DEVICE_TYPE.getString(circuit[i].getErrorStatus());
|
|
|
- }
|
|
|
- retStr += "\r\n";
|
|
|
- }
|
|
|
- retStr += "\r\n";
|
|
|
-
|
|
|
- retStr += "==========================";
|
|
|
-
|
|
|
- return retStr;
|
|
|
- }
|
|
|
-
|
|
|
- ///////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- // 디바이스 ID
|
|
|
- ///////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- public static final class DEVICE_ID {
|
|
|
- public final static byte ID_MIN = (byte)0x01; // 최소 ID
|
|
|
- public final static byte ID_MAX = (byte)0x0F; // 최대 ID
|
|
|
-
|
|
|
- public static boolean checkRange(byte value) {
|
|
|
- if (value < ID_MIN || ID_MAX < value) return false;
|
|
|
- else return true;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- ///////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- // 디바이스 종류
|
|
|
- ///////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- public static final class DEVICE_TYPE {
|
|
|
- public final static byte NOINFO = (byte)0x00; // 정보없음
|
|
|
- public final static byte GASVALVE = (byte)0x01; // 가스밸브
|
|
|
- public final static byte OUTLET = (byte)0x02; // 쿡탑콘센트
|
|
|
-
|
|
|
- public static boolean checkRange(byte value) {
|
|
|
- if (value < NOINFO || OUTLET < value) return false;
|
|
|
- else return true;
|
|
|
- }
|
|
|
-
|
|
|
- public static String getString(byte value) {
|
|
|
- if (value == NOINFO) return "NOINFO";
|
|
|
- else if (value == GASVALVE) return "GASVALVE";
|
|
|
- else if (value == OUTLET) return "OUTLET";
|
|
|
- else return "NONE";
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- ///////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- // 디바이스 동작 상태
|
|
|
- ///////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
- public static final class DEVICE_STATUS {
|
|
|
- public final static byte NOINFO = (byte)0x00; // 정보없음
|
|
|
- public final static byte CLOSE = (byte)0x01; // 닫힘
|
|
|
- public final static byte WORKING = (byte)0x02; // 동작중
|
|
|
- public final static byte OPEN = (byte)0x03; // 열림
|
|
|
-
|
|
|
- public static boolean checkRange(byte value) {
|
|
|
- if (value < NOINFO || OPEN < value) return false;
|
|
|
- else return true;
|
|
|
- }
|
|
|
-
|
|
|
- public static String getString(byte value) {
|
|
|
- if (value == NOINFO) return "NOINFO";
|
|
|
- else if (value == CLOSE) return "CLOSE";
|
|
|
- else if (value == WORKING) return "WORKING";
|
|
|
- else if (value == OPEN) return "OPEN";
|
|
|
- else return "NONE";
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-}
|
|
|
+package com.artncore.commons;
|
|
|
+
|
|
|
+import android.util.Log;
|
|
|
+
|
|
|
+import com.util.LogUtil;
|
|
|
+
|
|
|
+import java.util.Calendar;
|
|
|
+
|
|
|
+public class DataClasses {
|
|
|
+
|
|
|
+ static String TAG = "DataClasses";
|
|
|
+
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /** [에너지모듈] 데이터 클래스 */
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static class EnergyModule
|
|
|
+ {
|
|
|
+ public Info info;
|
|
|
+ public Circuit circuit;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 생성자<br>
|
|
|
+ * device 는 null 로 시작함을 주의하자
|
|
|
+ */
|
|
|
+ public EnergyModule()
|
|
|
+ {
|
|
|
+ info = new Info();
|
|
|
+ circuit = null;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 회로개수를 설정한다.
|
|
|
+ *
|
|
|
+ * @param nCircuitCount - (byte) 회로개수
|
|
|
+ */
|
|
|
+ public void setCircuitCount(byte nCircuitCount)
|
|
|
+ {
|
|
|
+ if(nCircuitCount <= 0) return;
|
|
|
+
|
|
|
+ info.CircuitCount = nCircuitCount;
|
|
|
+
|
|
|
+ circuit = new Circuit(nCircuitCount);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 에너지모듈 보드정보 */
|
|
|
+ public static class Info
|
|
|
+ {
|
|
|
+ /** 설치상태 (true:설치 , false:미설치) */
|
|
|
+ public boolean Install;
|
|
|
+
|
|
|
+ /** 누적 전력 사용량 단위 (false:0.1kWh, true:1Wh) */
|
|
|
+ public boolean AccPw_Unit;
|
|
|
+
|
|
|
+ /** 회로개수( 범위 : 1~4) */
|
|
|
+ public byte CircuitCount;
|
|
|
+
|
|
|
+ /** 제조사 코드 ( 0x01 : 제일전기 ) */
|
|
|
+ public byte Vender;
|
|
|
+
|
|
|
+ /** 펌웨어 Build Date (년) */
|
|
|
+ public byte FwVer_Year;
|
|
|
+ /** 펌웨어 Build Date (월) */
|
|
|
+ public byte FwVer_Month;
|
|
|
+ /** 펌웨어 Build Date (일) */
|
|
|
+ public byte FwVer_Day;
|
|
|
+ /** 펌웨어 Build Date (일련번호) */
|
|
|
+ public byte FwVer_Number;
|
|
|
+
|
|
|
+ /** 지원 프로토콜 버전 Main */
|
|
|
+ public byte ProtocolVer_Main;
|
|
|
+ /** 지원 프로토콜 버전 Sub */
|
|
|
+ public byte ProtocolVer_Sub;
|
|
|
+
|
|
|
+ public Info()
|
|
|
+ {
|
|
|
+ Install = false;
|
|
|
+ CircuitCount = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String ToDebugString(byte DeviceIdx)
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "(" + (byte)(DeviceIdx + 1) + ") Device - Info\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "Install : " + Install + "\r\n" +
|
|
|
+ "CircuitCount : " + CircuitCount + "\r\n" +
|
|
|
+ "Vender : " + String.format("0x%02X", Vender) + "\r\n" +
|
|
|
+ "FwVer : " + (int)(FwVer_Year+2000) + "." + FwVer_Month + "." + FwVer_Day + "." + FwVer_Number + "\r\n" +
|
|
|
+ "ProtocolVer : " + "V" + ProtocolVer_Main + "." + ProtocolVer_Sub + "\r\n" +
|
|
|
+ "AccPw_Unit : " + AccPw_Unit + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 에너지모듈 회로 데이터 클래스 */
|
|
|
+ public static class Circuit
|
|
|
+ {
|
|
|
+ /** 에러상태 (true:에러 , false:정상) */
|
|
|
+ public boolean UnitError;
|
|
|
+ /** 회로개수( 범위 : 1~4) */
|
|
|
+ public int CircuitCount;
|
|
|
+
|
|
|
+ /** 현재 전력사용량 */
|
|
|
+ public double [] NowPw;
|
|
|
+ /** 누적 전력사용량 */
|
|
|
+ public double [] AccPw;
|
|
|
+ /** 누적 전력사용량 오버플로우 */
|
|
|
+ public boolean [] AccOverFlow;
|
|
|
+
|
|
|
+ public Circuit(byte nCircuitCount)
|
|
|
+ {
|
|
|
+ if(nCircuitCount <= 0) return;
|
|
|
+
|
|
|
+ UnitError = false;
|
|
|
+ CircuitCount = nCircuitCount;
|
|
|
+
|
|
|
+ NowPw = new double[nCircuitCount];
|
|
|
+ for(int i=0 ; i<nCircuitCount ; i++) NowPw[i] = 0.0;
|
|
|
+ AccPw = new double[nCircuitCount];
|
|
|
+ for(int i=0 ; i<nCircuitCount ; i++) AccPw[i] = 0.0;
|
|
|
+ AccOverFlow = new boolean[nCircuitCount];
|
|
|
+ for(int i=0 ; i<nCircuitCount ; i++) AccOverFlow[i] = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String ToDebugString(byte DeviceIdx)
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "(" + (byte)(DeviceIdx + 1) + ") Device - Circuit\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "UnitError : " + UnitError + "\r\n" +
|
|
|
+ "CircuitCount : " + CircuitCount + "\r\n";
|
|
|
+ for(int CircuitIndex=0 ; CircuitIndex<CircuitCount ; CircuitIndex++)
|
|
|
+ {
|
|
|
+ retStr += " Concent [" + (int)(CircuitIndex + 1) + "]" + "\r\n" +
|
|
|
+ " NowPw : " + NowPw[CircuitIndex] + "\r\n" +
|
|
|
+ " AccPw : " + AccPw[CircuitIndex] + "\r\n" +
|
|
|
+ " AccOverFlow : " + AccOverFlow[CircuitIndex] + "\r\n";
|
|
|
+ }
|
|
|
+ retStr += "==========================";
|
|
|
+
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /** [대기차단콘센트] 데이터 클래스 */
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static class CutOffConcent
|
|
|
+ {
|
|
|
+ public Info info;
|
|
|
+ public Circuit circuit;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 생성자<br>
|
|
|
+ * device 는 null 로 시작함을 주의하자
|
|
|
+ */
|
|
|
+ public CutOffConcent()
|
|
|
+ {
|
|
|
+ info = new Info();
|
|
|
+ circuit = null;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 회로개수를 설정한다.
|
|
|
+ *
|
|
|
+ * @param nCircuitCount - (byte) 회로개수
|
|
|
+ */
|
|
|
+ public void setCircuitCount(byte nCircuitCount)
|
|
|
+ {
|
|
|
+ if(nCircuitCount <= 0) return;
|
|
|
+
|
|
|
+ info.CircuitCount = nCircuitCount;
|
|
|
+
|
|
|
+ circuit = new Circuit(nCircuitCount);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 보드정보 */
|
|
|
+ public static class Info
|
|
|
+ {
|
|
|
+ /** 설치상태 (true:설치 , false:미설치) */
|
|
|
+ public boolean Install;
|
|
|
+
|
|
|
+ /** 회로개수( 콘센트 - 범위 : 1~8) */
|
|
|
+ public byte CircuitCount;
|
|
|
+
|
|
|
+ /** 제조사 코드 ( 0x01 : 신동아전기 ) */
|
|
|
+ public byte Vender;
|
|
|
+
|
|
|
+ /** 펌웨어 Build Date (년) */
|
|
|
+ public byte FwVer_Year;
|
|
|
+ /** 펌웨어 Build Date (월) */
|
|
|
+ public byte FwVer_Month;
|
|
|
+ /** 펌웨어 Build Date (일) */
|
|
|
+ public byte FwVer_Day;
|
|
|
+ /** 펌웨어 Build Date (일련번호) */
|
|
|
+ public byte FwVer_Number;
|
|
|
+
|
|
|
+ /** 지원 프로토콜 버전 Main */
|
|
|
+ public byte ProtocolVer_Main;
|
|
|
+ /** 지원 프로토콜 버전 Sub */
|
|
|
+ public byte ProtocolVer_Sub;
|
|
|
+
|
|
|
+ public Info()
|
|
|
+ {
|
|
|
+ Install = false;
|
|
|
+ CircuitCount = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String ToDebugString(byte DeviceIdx)
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "(" + (byte)(DeviceIdx + 1) + ") Device - Info\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "Install : " + Install + "\r\n" +
|
|
|
+ "CircuitCount : " + CircuitCount + "\r\n" +
|
|
|
+ "Vender : " + String.format("0x%02X", Vender) + "\r\n" +
|
|
|
+ "FwVer : " + (int)(FwVer_Year+2000) + "." + FwVer_Month + "." + FwVer_Day + "." + FwVer_Number + "\r\n" +
|
|
|
+ "ProtocolVer : " + "V" + ProtocolVer_Main + "." + ProtocolVer_Sub + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 대기차단콘센트 회로 데이터 클래스 */
|
|
|
+ public static class Circuit
|
|
|
+ {
|
|
|
+ /** 회로개수( 콘센트 - 범위 : 1~8) */
|
|
|
+ public int CircuitCount;
|
|
|
+
|
|
|
+ /** 모드상태 (true : 자동 , false : 상시) */
|
|
|
+ public boolean [] Mode;
|
|
|
+ /** 차단상태 (true : 차단상태, false : 노말상태) */
|
|
|
+ public boolean [] CutoffStatus;
|
|
|
+ /** 설정상태 (true : 대기전력 기준값있음, false : 대기전력 기준값미설정) */
|
|
|
+ public boolean [] CutoffValStatus;
|
|
|
+ /** 기기상태 (true : 과부하 차단, false : 노말상태) */
|
|
|
+ public boolean [] OverloadError;
|
|
|
+
|
|
|
+ public Circuit(byte nCircuitCount)
|
|
|
+ {
|
|
|
+ if(nCircuitCount <= 0) return;
|
|
|
+
|
|
|
+ CircuitCount = nCircuitCount;
|
|
|
+
|
|
|
+ Mode = new boolean[nCircuitCount];
|
|
|
+ for(int i=0 ; i<nCircuitCount ; i++) Mode[i] = false;
|
|
|
+ CutoffStatus = new boolean[nCircuitCount];
|
|
|
+ for(int i=0 ; i<nCircuitCount ; i++) CutoffStatus[i] = false;
|
|
|
+ CutoffValStatus = new boolean[nCircuitCount];
|
|
|
+ for(int i=0 ; i<nCircuitCount ; i++) CutoffValStatus[i] = false;
|
|
|
+ OverloadError = new boolean[nCircuitCount];
|
|
|
+ for(int i=0 ; i<nCircuitCount ; i++) OverloadError[i] = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String ToDebugString(byte DeviceIdx)
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "(" + (byte)(DeviceIdx + 1) + ") Device - Circuit\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "CircuitCount : " + CircuitCount + "\r\n";
|
|
|
+ for(int CircuitIndex=0 ; CircuitIndex<CircuitCount ; CircuitIndex++)
|
|
|
+ {
|
|
|
+ retStr += " Concent [" + (int)(CircuitIndex + 1) + "]" + "\r\n" +
|
|
|
+ " Mode : " + Mode[CircuitIndex] + "\r\n" +
|
|
|
+ " CutoffStatus : " + CutoffStatus[CircuitIndex] + "\r\n" +
|
|
|
+ " CutoffValStatus : " + CutoffValStatus[CircuitIndex] + "\r\n" +
|
|
|
+ " OverloadError : " + OverloadError[CircuitIndex] + "\r\n";
|
|
|
+ }
|
|
|
+ retStr += "==========================";
|
|
|
+
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /** [에너지미터] 데이터 클래스 */
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static class EnergyMeter
|
|
|
+ {
|
|
|
+ public Info info;
|
|
|
+ public EachRoom [] eachRoom;
|
|
|
+
|
|
|
+ /** 생성자 */
|
|
|
+ public EnergyMeter()
|
|
|
+ {
|
|
|
+ info = new Info();
|
|
|
+ eachRoom = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 방 개수를 설정한다. <br>
|
|
|
+ * {@link EnergyMeter} 생성후 방개수를 설정하여야 eachRoom 가 생성된다.
|
|
|
+ *
|
|
|
+ * @param nRoomCnt - (byte) 설정할 방개수
|
|
|
+ *
|
|
|
+ * @return (boolean) true : 성공 , false : 실패
|
|
|
+ */
|
|
|
+ public boolean setRoomCnt(byte nRoomCnt)
|
|
|
+ {
|
|
|
+ if(nRoomCnt <= 0) return false;
|
|
|
+ if(nRoomCnt > 6) return false;
|
|
|
+ if(info == null) return false;
|
|
|
+
|
|
|
+ info.RoomCnt = nRoomCnt;
|
|
|
+ eachRoom = new EachRoom[nRoomCnt];
|
|
|
+ for(byte i=0 ; i<nRoomCnt ; i++)
|
|
|
+ {
|
|
|
+ eachRoom[i] = new EachRoom();
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 전체 방의 조명 상태를 리턴한다.<br>
|
|
|
+ * 방의 조명이 하나라도 켜져있으면 ON , 모두 꺼져있으면 OFF
|
|
|
+ *
|
|
|
+ * @return (boolean) true : 켜짐 , false : 꺼짐
|
|
|
+ */
|
|
|
+ public boolean getAllLightOnOff()
|
|
|
+ {
|
|
|
+ if(eachRoom == null) return false;
|
|
|
+
|
|
|
+ for(int i=0 ; i<eachRoom.length ; i++)
|
|
|
+ {
|
|
|
+ if(eachRoom[i] != null)
|
|
|
+ if(eachRoom[i].getAllLightOnOff()) return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 전체 방의 콘센트 상태를 리턴한다.<br>
|
|
|
+ * 방의 콘센트이 하나라도 켜져있으면 ON , 모두 꺼져있으면 OFF
|
|
|
+ *
|
|
|
+ * @return (boolean) true : 켜짐 , false : 꺼짐
|
|
|
+ */
|
|
|
+ public boolean getAllConcentOnOff()
|
|
|
+ {
|
|
|
+ if(eachRoom == null) return false;
|
|
|
+
|
|
|
+ for(int i=0 ; i<eachRoom.length ; i++)
|
|
|
+ {
|
|
|
+ if(eachRoom[i] != null)
|
|
|
+ if(eachRoom[i].getAllConcentOnOff()) return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 개별기기정보 */
|
|
|
+ public static class EachRoom
|
|
|
+ {
|
|
|
+ /** 설치상태 (true : 설치 ,false : 미설치) */
|
|
|
+ public boolean Install;
|
|
|
+ /** 통신상태 (true : 정상 ,false : 비정상) */
|
|
|
+ public boolean CommStatus;
|
|
|
+ /** 기기이상 (true : 에러 ,false : 비정상) */
|
|
|
+ public boolean UnitError;
|
|
|
+
|
|
|
+ /** 조명개수 (범위 : 1~4)<br>
|
|
|
+ * ※주의 : 0일시 조명 관련 배열데이터 생성되지않음 */
|
|
|
+ public byte LightCnt;
|
|
|
+ /** 조명 On/OFF 상태 (true:ON , false:OFF) */
|
|
|
+ public boolean [] LightOnOff;
|
|
|
+ /** 조명 현재 소비전력 (단위: 0.1W) */
|
|
|
+ public double LightNowPw;
|
|
|
+ /** 조명 누적 전력사용량 (단위: 0.1kWh) */
|
|
|
+ public double LightAccPw;
|
|
|
+ /** 조명 누적 전럭사용량 오버플로우 */
|
|
|
+ public boolean LightAccOverflow;
|
|
|
+ /** 조명 과부하로 차단됨 (true:차단 , false:정상) */
|
|
|
+ public boolean LightOverLoad;
|
|
|
+
|
|
|
+ /** 콘센트개수 (범위 2~3 , 2개일시 C1,C2, 3개일시 C3 추가 * C3은 상시콘센트임 제어않됨!) <br>
|
|
|
+ * ※주의 : 0일시 콘센트 관련 배열데이터 생성되지않음 */
|
|
|
+ public byte ConCnt;
|
|
|
+ /** 콘센트 모드상태 (true : 자동 ,false : 상시) C1, C2에 일괄적용 */
|
|
|
+ public boolean ConMode;
|
|
|
+ /** 콘센트 On/OFF 상태 (true:ON , false:OFF) */
|
|
|
+ public boolean [] ConOnOff;
|
|
|
+ /** 콘센트 대기전력 기준값 (단위: 0.1W) */
|
|
|
+ public double [] ConCutOffVal;
|
|
|
+ /** 콘센트 대기전력 차단상태 (true : 대기전력 자동차단됨, false : 노말상태) */
|
|
|
+ public boolean [] ConCutOffStatus;
|
|
|
+ /** 콘센트 과부하로 차단됨 (true:차단 , false:정상) */
|
|
|
+ public boolean [] ConOverLoad;
|
|
|
+
|
|
|
+ /** 콘센트 현재 소비전력 (단위: 0.1W) */
|
|
|
+ public double [] ConNowPw;
|
|
|
+ /** 콘센트 누적 전력사용량 (단위: 0.1kWh) */
|
|
|
+ public double [] ConAccPw;
|
|
|
+ /** 콘센트 누적 전럭사용량 오버플로우 */
|
|
|
+ public boolean [] ConAccOverflow;
|
|
|
+
|
|
|
+ /** 일괄소등용 릴레이 사용여부 (true:지원, false:미지원) */
|
|
|
+ public boolean AllLightRelay_Use;
|
|
|
+ /** 일괄소등용 릴레이 ON/OFF 상태 (true:ON, false:OFF) */
|
|
|
+ public boolean AllLightRelay_OnOff;
|
|
|
+
|
|
|
+ public EachRoom()
|
|
|
+ {
|
|
|
+ Install = false;
|
|
|
+ LightCnt = 0;
|
|
|
+ ConCnt = 0;
|
|
|
+ ConMode = false;
|
|
|
+
|
|
|
+ AllLightRelay_Use = false;
|
|
|
+ AllLightRelay_OnOff = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 조명개수를 설정한다.
|
|
|
+ *
|
|
|
+ * @param nLightCnt - (byte) 설정할 조명개수
|
|
|
+ *
|
|
|
+ * @return (boolean) true : 성공 , false : 실패
|
|
|
+ */
|
|
|
+ public boolean setLightCnt(byte nLightCnt)
|
|
|
+ {
|
|
|
+ if(nLightCnt <= 0) return false;
|
|
|
+
|
|
|
+ LightCnt = nLightCnt;
|
|
|
+ LightOnOff = new boolean [nLightCnt];
|
|
|
+ for(int i=0 ; i<nLightCnt ; i++) LightOnOff[i] = false;
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 콘센트개수를 설정한다.
|
|
|
+ *
|
|
|
+ * @param nConCnt - (byte) 설정할 콘센트개수 (2 or 3 설정가능)
|
|
|
+ *
|
|
|
+ * @return (boolean) true : 성공 , false : 실패
|
|
|
+ */
|
|
|
+ public boolean setConCnt(byte nConCnt)
|
|
|
+ {
|
|
|
+ if( !((nConCnt == 2) || (nConCnt == 3)) ) return false;
|
|
|
+
|
|
|
+ ConCnt = nConCnt;
|
|
|
+
|
|
|
+ byte ControlConcent = 2;
|
|
|
+ ConOnOff = new boolean [ControlConcent];
|
|
|
+ for(int i=0 ; i<ConOnOff.length ; i++) ConOnOff[i] = false;
|
|
|
+ ConCutOffVal = new double [ControlConcent];
|
|
|
+ for(int i=0 ; i<ConCutOffVal.length ; i++) ConCutOffVal[i] = 0.0;
|
|
|
+ ConCutOffStatus = new boolean [ControlConcent];
|
|
|
+ for(int i=0 ; i<ConCutOffStatus.length ; i++) ConCutOffStatus[i] = false;
|
|
|
+ ConOverLoad = new boolean [ControlConcent];
|
|
|
+ for(int i=0 ; i<ConOverLoad.length ; i++) ConOverLoad[i] = false;
|
|
|
+
|
|
|
+ ConNowPw = new double [nConCnt];
|
|
|
+ for(int i=0 ; i<nConCnt ; i++) ConNowPw[i] = 0.0;
|
|
|
+ ConAccPw = new double [nConCnt];
|
|
|
+ for(int i=0 ; i<nConCnt ; i++) ConAccPw[i] = 0.0;
|
|
|
+ ConAccOverflow = new boolean [nConCnt];
|
|
|
+ for(int i=0 ; i<nConCnt ; i++) ConAccOverflow[i] = false;
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 방 조명의 상태를 리턴한다.<br>
|
|
|
+ * 방의 조명이 하나라도 켜져있으면 ON , 모두 꺼져있으면 OFF
|
|
|
+ *
|
|
|
+ * @return (boolean) true : ON , false : OFF
|
|
|
+ */
|
|
|
+ public boolean getAllLightOnOff()
|
|
|
+ {
|
|
|
+ if(LightOnOff == null) return false;
|
|
|
+
|
|
|
+ boolean OnOff = false;
|
|
|
+ for(int i=0 ; i<LightOnOff.length ; i++)
|
|
|
+ {
|
|
|
+ if(LightOnOff[i]) { OnOff = true; break; }
|
|
|
+ }
|
|
|
+ return OnOff;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 방 콘센트의 상태를 리턴한다.<br>
|
|
|
+ * 방의 콘센트이 하나라도 켜져있으면 ON , 모두 꺼져있으면 OFF
|
|
|
+ *
|
|
|
+ * @return (boolean) true : ON , false : OFF
|
|
|
+ */
|
|
|
+ public boolean getAllConcentOnOff()
|
|
|
+ {
|
|
|
+ if(ConOnOff == null) return false;
|
|
|
+
|
|
|
+ boolean OnOff = false;
|
|
|
+ for(int i=0 ; i<ConOnOff.length ; i++)
|
|
|
+ {
|
|
|
+ if(ConOnOff[i]) { OnOff = true; break; }
|
|
|
+ }
|
|
|
+ return OnOff;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 모든 콘센트의 소비전력 합을 리턴한다.
|
|
|
+ *
|
|
|
+ * @return (double) 모든 콘센트 소비전력
|
|
|
+ */
|
|
|
+ public double getAllConcentNowPw()
|
|
|
+ {
|
|
|
+ if(ConNowPw == null) return 0.0;
|
|
|
+
|
|
|
+ double NowPw = 0;
|
|
|
+ for(int i=0 ; i<ConNowPw.length ; i++)
|
|
|
+ {
|
|
|
+ NowPw += ConNowPw[i];
|
|
|
+ }
|
|
|
+ return Double.parseDouble(String.format("%.0f", NowPw));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 모든 조명 + 콘센트의 소비전력 합을 리턴한다.
|
|
|
+ *
|
|
|
+ * @return (double) 모든 조명+콘센트 소비전력
|
|
|
+ */
|
|
|
+ public double getAllNowPw()
|
|
|
+ {
|
|
|
+ if(ConNowPw == null) return 0.0;
|
|
|
+
|
|
|
+ double NowPw = 0;
|
|
|
+ for(int i=0 ; i<ConNowPw.length ; i++)
|
|
|
+ {
|
|
|
+ NowPw += ConNowPw[i];
|
|
|
+ }
|
|
|
+ NowPw += LightNowPw;
|
|
|
+ return Double.parseDouble(String.format("%.0f", NowPw));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 방 콘센트의 대기전력차단 상태를 리턴한다.<br>
|
|
|
+ * 방의 콘센트이 하나라도 대기차단 상태라면 ON , 모두 아니라면 OFF
|
|
|
+ *
|
|
|
+ * @return (boolean) true : ON , false : OFF
|
|
|
+ */
|
|
|
+ public boolean getAllConcentCutOffStatus()
|
|
|
+ {
|
|
|
+ if(ConCutOffStatus == null) return false;
|
|
|
+
|
|
|
+ boolean OnOff = false;
|
|
|
+ for(int i=0 ; i<ConCutOffStatus.length ; i++)
|
|
|
+ {
|
|
|
+ if(ConCutOffStatus[i]) { OnOff = true; break; }
|
|
|
+ }
|
|
|
+ return OnOff;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 방 콘센트의 과부하상태를 리턴한다.<br>
|
|
|
+ * 방의 콘센트가 하나라도 과부하차단중이면 true , 모두 정상이면 false
|
|
|
+ *
|
|
|
+ * @return (boolean) true : 과부하차단 , false : 정상
|
|
|
+ */
|
|
|
+ public boolean getAllConcentOverLoad()
|
|
|
+ {
|
|
|
+ if(ConOverLoad == null) return false;
|
|
|
+
|
|
|
+ boolean OverLoad = false;
|
|
|
+ for(int i=0 ; i<ConOverLoad.length ; i++)
|
|
|
+ {
|
|
|
+ if(ConOverLoad[i]) { OverLoad = true; break; }
|
|
|
+ }
|
|
|
+ return OverLoad;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 본 클래스 디버깅 메시지 */
|
|
|
+ public String ToDebugString(byte RoomIndex)
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "RoomNumber (" + (byte)(RoomIndex+1) + ")\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+
|
|
|
+ "Install : " + Install + "\r\n" +
|
|
|
+ "CommError : " + CommStatus + "\r\n" +
|
|
|
+ "UnitError : " + UnitError + "\r\n" +
|
|
|
+
|
|
|
+ "[Light]\r\n" +
|
|
|
+ "LightCnt : " + LightCnt + "\r\n";
|
|
|
+ retStr += BooleanArrayString("LightOnOff : ", LightOnOff);
|
|
|
+
|
|
|
+ retStr +=
|
|
|
+ "LightNowPw : " + LightNowPw + "\r\n" +
|
|
|
+ "LightAccPw : " + LightAccPw + "\r\n" +
|
|
|
+ "LightAccOverflow : " + LightAccOverflow + "\r\n" +
|
|
|
+ "LightOverLoad : " + LightOverLoad + "\r\n" +
|
|
|
+
|
|
|
+
|
|
|
+ "[Concent]\r\n" +
|
|
|
+ "ConCnt : " + ConCnt + "\r\n" +
|
|
|
+ "ConMode : " + ConMode + "\r\n";
|
|
|
+ retStr += BooleanArrayString("ConOnOff : ", ConOnOff);
|
|
|
+ retStr += DoubleArrayString ("ConCutOffVal : ", ConCutOffVal);
|
|
|
+ retStr += BooleanArrayString("ConCutOffStatus : ", ConCutOffStatus);
|
|
|
+ retStr += BooleanArrayString("ConOverLoad : ", ConOverLoad);
|
|
|
+
|
|
|
+ retStr += DoubleArrayString ("ConNowPw : ", ConNowPw);
|
|
|
+ retStr += DoubleArrayString ("ConAccPw : ", ConAccPw);
|
|
|
+ retStr += BooleanArrayString("ConAccOverflow : ", ConAccOverflow);
|
|
|
+
|
|
|
+ retStr +=
|
|
|
+ "[AllLightRelay]\r\n" +
|
|
|
+ "AllLightRelay_Use : " + AllLightRelay_Use + "\r\n" +
|
|
|
+ "AllLightRelay_OnOff : " + AllLightRelay_OnOff + "\r\n";
|
|
|
+
|
|
|
+ retStr += "==========================";
|
|
|
+
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ private String BooleanArrayString(String Name, boolean [] DataArray)
|
|
|
+ {
|
|
|
+ String retStr = Name;
|
|
|
+ if(DataArray == null) retStr += "null";
|
|
|
+ else
|
|
|
+ {
|
|
|
+ for(int i=0 ; i<DataArray.length ; i++)
|
|
|
+ {
|
|
|
+ retStr += DataArray[i];
|
|
|
+ if(i+1 != DataArray.length) retStr += ", ";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return retStr + "\r\n";
|
|
|
+ }
|
|
|
+
|
|
|
+ private String DoubleArrayString(String Name, double [] DataArray)
|
|
|
+ {
|
|
|
+ String retStr = Name;
|
|
|
+ if(DataArray == null) retStr += "null";
|
|
|
+ else
|
|
|
+ {
|
|
|
+ for(int i=0 ; i<DataArray.length ; i++)
|
|
|
+ {
|
|
|
+ retStr += DataArray[i];
|
|
|
+ if(i+1 != DataArray.length) retStr += ", ";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return retStr + "\r\n";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 기기정보 */
|
|
|
+ public static class Info
|
|
|
+ {
|
|
|
+ /** 방개수( 범위 : 0~6) */
|
|
|
+ public byte RoomCnt;
|
|
|
+
|
|
|
+ /** 제조사 코드 ( 0x01 : 제일전기) */
|
|
|
+ public byte Vender;
|
|
|
+
|
|
|
+ /** 펌웨어 Build Date (년) */
|
|
|
+ public byte FwVer_Year;
|
|
|
+ /** 펌웨어 Build Date (월) */
|
|
|
+ public byte FwVer_Month;
|
|
|
+ /** 펌웨어 Build Date (일) */
|
|
|
+ public byte FwVer_Day;
|
|
|
+ /** 펌웨어 Build Date (일련번호) */
|
|
|
+ public byte FwVer_Number;
|
|
|
+
|
|
|
+ /** 지원 프로토콜 버전 Main */
|
|
|
+ public byte ProtocolVer_Main;
|
|
|
+ /** 지원 프로토콜 버전 Sub */
|
|
|
+ public byte ProtocolVer_Sub;
|
|
|
+
|
|
|
+ /** 일괄소등용 릴레이 사용여부 (true:지원, false:미지원) ※ 에너지미터중 1개라도 본 기능을 지원할시 true , 아닐시 false */
|
|
|
+ public boolean AllLightRelay_Use;
|
|
|
+
|
|
|
+ /** 누적 전력 사용량 단위 (false:0.1kWh, true:1Wh) */
|
|
|
+ public boolean AccPw_Unit;
|
|
|
+
|
|
|
+ /** 생성자 */
|
|
|
+ public Info()
|
|
|
+ {
|
|
|
+ RoomCnt = 0;
|
|
|
+ AllLightRelay_Use = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 본 클래스 디버깅 메시지 */
|
|
|
+ public String ToDebugString()
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "Device - Info\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "RoomCnt : " + RoomCnt + "\r\n" +
|
|
|
+ "Vender : " + String.format("0x%02X", Vender) + "\r\n" +
|
|
|
+ "FwVer : " + (int)(FwVer_Year+2000) + "." + FwVer_Month + "." + FwVer_Day + "." + FwVer_Number + "\r\n" +
|
|
|
+ "ProtocolVer : " + "V" + ProtocolVer_Main + "." + ProtocolVer_Sub + "\r\n" +
|
|
|
+ "AllLightRelay_Use : " + AllLightRelay_Use + "\r\n" +
|
|
|
+ "AccPw_Unit : " + AccPw_Unit + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /** [난방V1] 데이터 클래스 */
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static class HeatingV1
|
|
|
+ {
|
|
|
+ /** 방의 개수 */
|
|
|
+ public byte RoomCount;
|
|
|
+
|
|
|
+ /** 난방 일시정지 상태 (true:설정, false:해제)*/
|
|
|
+ public boolean Pause;
|
|
|
+
|
|
|
+ /** 설정온도 단위 (ture : 0.5도단위, false : 1도단위) */
|
|
|
+ public boolean SetTempPoint05;
|
|
|
+
|
|
|
+ /** 에러상태 */
|
|
|
+ public byte Error;
|
|
|
+
|
|
|
+ /** 각방 데이터 */
|
|
|
+ public RoomData [] Room;
|
|
|
+
|
|
|
+ /** 기기 정보 */
|
|
|
+ public Info info;
|
|
|
+
|
|
|
+ public HeatingV1()
|
|
|
+ {
|
|
|
+ RoomCount = 0;
|
|
|
+ Pause = false;
|
|
|
+ SetTempPoint05 = true;
|
|
|
+ Error = ERROR.Normal;
|
|
|
+ Room = null;
|
|
|
+ info = new Info();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 방 개수를 설정한다.<br>
|
|
|
+ *
|
|
|
+ * @param cnt - (byte) 설정할 방개수 (범위: 1 ~ 8)
|
|
|
+ *
|
|
|
+ * @return (boolean) true : 성공 , false : 실패
|
|
|
+ */
|
|
|
+ public boolean SetRoomCount(byte cnt)
|
|
|
+ {
|
|
|
+ if((cnt <= 0) || (cnt > 8)) return false;
|
|
|
+
|
|
|
+ RoomCount = cnt;
|
|
|
+ Room = new RoomData [cnt];
|
|
|
+ for(byte i=0 ; i<cnt ; i++) Room[i] = new RoomData();
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 기기정보 */
|
|
|
+ public static class Info
|
|
|
+ {
|
|
|
+ /** 디바이스명 + 버전정보 (각 회사별로 정의) */
|
|
|
+ public byte [] Data;
|
|
|
+
|
|
|
+ private boolean bSet;
|
|
|
+ public Info()
|
|
|
+ {
|
|
|
+ Data = new byte[8];
|
|
|
+ for(int i=0 ; i<Data.length ; i++) Data[i] = 0x00;
|
|
|
+ bSet = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean GetSet()
|
|
|
+ {
|
|
|
+ return bSet;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean SetData(byte [] setdata)
|
|
|
+ {
|
|
|
+ if(setdata == null) return false;
|
|
|
+ if(setdata.length > 8) return false;
|
|
|
+
|
|
|
+ if(Data == null) return false;
|
|
|
+
|
|
|
+ if(setdata.length != Data.length) Data = new byte [setdata.length];
|
|
|
+ for(int i=0 ; i<setdata.length ; i++) Data[i] = setdata[i];
|
|
|
+
|
|
|
+ bSet = true;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString()
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "Info\r\n" +
|
|
|
+ "==========================\r\n";
|
|
|
+
|
|
|
+ if(Data == null) retStr += "null\r\n";
|
|
|
+ else retStr += Data.toString() + "\r\n";
|
|
|
+
|
|
|
+ retStr +=
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 각 방 데이터 */
|
|
|
+ public static class RoomData
|
|
|
+ {
|
|
|
+ ////////////////////////////////////////////
|
|
|
+ // 기본기능
|
|
|
+ ////////////////////////////////////////////
|
|
|
+ /** 난방 ON/OFF (true : ON , false : OFF)*/
|
|
|
+ public boolean bOnOff;
|
|
|
+ /** 밸브상태 ( ture : 열림, false : 닫힘 ) */
|
|
|
+ public boolean bValveStatus;
|
|
|
+ /** 설정온도 ( 0.5도 혹은 1도 단위) */
|
|
|
+ public double SetTemp;
|
|
|
+ /** 현재온도 */
|
|
|
+ public double NowTemp;
|
|
|
+ /** 에러상태 */
|
|
|
+ public byte Error;
|
|
|
+
|
|
|
+ public RoomData()
|
|
|
+ {
|
|
|
+ bOnOff = false;
|
|
|
+ bValveStatus = false;
|
|
|
+ SetTemp = 10.0;
|
|
|
+ NowTemp = 15.0;
|
|
|
+ Error = ERROR.Normal;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString(byte RoomIndex)
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "RoomData (" + (int) (RoomIndex+1) + ") \r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "bOnOff : " + bOnOff + "\r\n" +
|
|
|
+ "bValveStatus : " + bValveStatus + "\r\n" +
|
|
|
+ "SetTemp : " + SetTemp + "\r\n" +
|
|
|
+ "NowTemp : " + NowTemp + "\r\n" +
|
|
|
+ "Error : " + ERROR.ToDebugString(Error) + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 에러코드 */
|
|
|
+ public static class ERROR
|
|
|
+ {
|
|
|
+ /** 정상 */
|
|
|
+ public static byte Normal = 0x00;
|
|
|
+ /** 조절기 에러 */
|
|
|
+ public static byte RoomSystem = 0x50;
|
|
|
+ /** 제어기 에러 */
|
|
|
+ public static byte Controller = 0x60;
|
|
|
+ /** EEPROM 에러 */
|
|
|
+ public static byte Eeprom = 0x70;
|
|
|
+ /** 가스보일러 에러 */
|
|
|
+ public static byte Boiler = 0x23;
|
|
|
+
|
|
|
+ public static String ToDebugString(byte Error)
|
|
|
+ {
|
|
|
+ String retStr;
|
|
|
+
|
|
|
+ if (Error == ERROR.Normal) retStr = "Normal";
|
|
|
+ else if(Error == ERROR.RoomSystem) retStr = "RoomSystem";
|
|
|
+ else if(Error == ERROR.Controller) retStr = "Controller";
|
|
|
+ else if(Error == ERROR.Eeprom) retStr = "Eeprom";
|
|
|
+ else if(Error == ERROR.Boiler) retStr = "Boiler";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static boolean Check(byte Error)
|
|
|
+ {
|
|
|
+ if (Error == ERROR.Normal) return true;
|
|
|
+ else if(Error == ERROR.RoomSystem) return true;
|
|
|
+ else if(Error == ERROR.Controller) return true;
|
|
|
+ else if(Error == ERROR.Eeprom) return true;
|
|
|
+ else if(Error == ERROR.Boiler) return true;
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 전체방 데이터 정의 (통신용) */
|
|
|
+ public static class AllRoomData
|
|
|
+ {
|
|
|
+ /** 방의 개수 */
|
|
|
+ public byte RoomCount;
|
|
|
+ /** 설정온도 단위 (ture : 0.5도단위, false : 1도단위) */
|
|
|
+ public boolean SetTempPoint05;
|
|
|
+ /** 난방 일시정지 상태 (true:설정, false:해제)*/
|
|
|
+ public boolean Pause;
|
|
|
+ /** 각방 상태 */
|
|
|
+ public EachRoomData [] Room;
|
|
|
+ /** 에러상태 */
|
|
|
+ public byte Error;
|
|
|
+
|
|
|
+ public AllRoomData(byte nRoomCount)
|
|
|
+ {
|
|
|
+ RoomCount = nRoomCount;
|
|
|
+ SetTempPoint05 = true;
|
|
|
+ Room = new EachRoomData[RoomCount];
|
|
|
+ for(byte i=0 ; i<RoomCount ; i++) Room[i] = new EachRoomData();
|
|
|
+ Error = ERROR.Normal;
|
|
|
+ }
|
|
|
+
|
|
|
+ public class EachRoomData
|
|
|
+ {
|
|
|
+ ////////////////////////////////////////////
|
|
|
+ // 기본기능
|
|
|
+ ////////////////////////////////////////////
|
|
|
+ /** 난방 ON/OFF (true : ON , false : OFF)*/
|
|
|
+ public boolean bOnOff;
|
|
|
+ /** 밸브상태 ( ture : 열림, false : 닫힘 ) */
|
|
|
+ public boolean bValveStatus;
|
|
|
+
|
|
|
+ public EachRoomData()
|
|
|
+ {
|
|
|
+ bOnOff = false;
|
|
|
+ bValveStatus = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString(byte RoomIndex)
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "RoomData (" + (int) (RoomIndex+1) + ") \r\n" +
|
|
|
+ "bOnOff : " + bOnOff + " / " + "bValveStatus : " + bValveStatus + "\r\n";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString()
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "AllRoomData\r\n" +
|
|
|
+ "==========================\r\n";
|
|
|
+
|
|
|
+ for(byte i=0 ; i<RoomCount ; i++)
|
|
|
+ {
|
|
|
+ retStr += Room[i].ToDebugString(i);
|
|
|
+ }
|
|
|
+
|
|
|
+ retStr += "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugStringInfoNPause()
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "InfoNPause\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "RoomCount : " + RoomCount + "\r\n" +
|
|
|
+ "SetTempPoint05 : " + SetTempPoint05 + "\r\n" +
|
|
|
+ "Error : " + String.format("0x%02X", Error) + "\r\n" +
|
|
|
+ "Pause : " + Pause + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugStringRoom(byte index)
|
|
|
+ {
|
|
|
+ if(Room == null) return "Error(Room is null)";
|
|
|
+ if(Room.length < index) return "Error(index:" + index + ", Out Of Range !!!)";
|
|
|
+
|
|
|
+ return Room[index].ToDebugString(index);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /** [난방V2] 데이터 클래스 */
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static class HeatingV2
|
|
|
+ {
|
|
|
+ /** 기기정보 */
|
|
|
+ public Info info;
|
|
|
+ /** 각 방 데이터 */
|
|
|
+ public RoomData [] Room;
|
|
|
+
|
|
|
+ public HeatingV2()
|
|
|
+ {
|
|
|
+ info = new Info();
|
|
|
+ Room = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 방 개수를 설정한다.<br>
|
|
|
+ *
|
|
|
+ * @param cnt - (byte) 설정할 방개수 (범위: 1 ~ 8)
|
|
|
+ * @return (boolean) true : 성공 , false : 실패
|
|
|
+ */
|
|
|
+ public boolean SetRoomCount(byte cnt)
|
|
|
+ {
|
|
|
+ if(info == null) return false;
|
|
|
+
|
|
|
+ if((cnt <= 0) || (cnt > 8)) return false;
|
|
|
+
|
|
|
+ info.RoomCount = cnt;
|
|
|
+ Room = new RoomData [cnt];
|
|
|
+ for(byte i=0 ; i<cnt ; i++) Room[i] = new RoomData();
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 기기정보 */
|
|
|
+ public static class Info
|
|
|
+ {
|
|
|
+ /** 방개수(범위 : 1~6) */
|
|
|
+ public byte RoomCount;
|
|
|
+
|
|
|
+ /** 제조사 코드 ( 프로토콜 문서에 따름 ) */
|
|
|
+ public byte Vender;
|
|
|
+
|
|
|
+ /** 펌웨어 Build Date (년) */
|
|
|
+ public byte FwVer_Year;
|
|
|
+ /** 펌웨어 Build Date (월) */
|
|
|
+ public byte FwVer_Month;
|
|
|
+ /** 펌웨어 Build Date (일) */
|
|
|
+ public byte FwVer_Day;
|
|
|
+ /** 펌웨어 Build Date (일련번호) */
|
|
|
+ public byte FwVer_Number;
|
|
|
+
|
|
|
+ /** 지원 프로토콜 버전 Main */
|
|
|
+ public byte ProtocolVer_Main;
|
|
|
+ /** 지원 프로토콜 버전 Sub */
|
|
|
+ public byte ProtocolVer_Sub;
|
|
|
+
|
|
|
+ public SupportInfo Support;
|
|
|
+
|
|
|
+ /** 기능 지원 여부 */
|
|
|
+ public class SupportInfo
|
|
|
+ {
|
|
|
+ /** 지원하는 최저설정온도 (범위 : 5도 ~ 20도) */
|
|
|
+ public byte MinSetTemp;
|
|
|
+ /** 지원하는 최대설정온도 (범위 : 21도 ~ 40도) */
|
|
|
+ public byte MaxSetTemp;
|
|
|
+
|
|
|
+ // 공통사용부분
|
|
|
+ /** 설정온도 단위 (ture : 0.5도단위, false : 1도단위) */
|
|
|
+ public boolean SetTempPoint05;
|
|
|
+ /** 외출기능 지원여부 (ture : 지원, false : 미지원) */
|
|
|
+ public boolean Outing;
|
|
|
+ /** 취침기능 지원여부 (ture : 지원, false : 미지원) */
|
|
|
+ public boolean Sleep;
|
|
|
+ /** 예약기능 지원여부 (ture : 지원, false : 미지원) */
|
|
|
+ public boolean Reservation;
|
|
|
+ /** 일시정지 지원여부 (ture : 지원, false : 미지원) */
|
|
|
+ public boolean Pause;
|
|
|
+
|
|
|
+ // I'PARK 디지털 특기시방용
|
|
|
+ /** 인공지능 지원여부 (ture : 지원, false : 미지원) */
|
|
|
+ public boolean AI;
|
|
|
+ /** 외기온도 사용여부 (ture : 사용, false : 미사용) */
|
|
|
+ public boolean OutsideTempUse;
|
|
|
+ /** 보일러 지원여부 (ture : 지원, false : 미지원) */
|
|
|
+ public boolean Boiler;
|
|
|
+ /** 누수감지 지원여부 (ture : 지원, false : 미지원) */
|
|
|
+ public boolean Leak;
|
|
|
+
|
|
|
+ public SupportInfo()
|
|
|
+ {
|
|
|
+ MinSetTemp = 5;
|
|
|
+ MaxSetTemp = 40;
|
|
|
+ SetTempPoint05 = false;
|
|
|
+ Outing = false;
|
|
|
+ Sleep = false;
|
|
|
+ Reservation = false;
|
|
|
+ Pause = false;
|
|
|
+
|
|
|
+ AI = false;
|
|
|
+ OutsideTempUse = false;
|
|
|
+ Boiler = false;
|
|
|
+ Leak = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public Info()
|
|
|
+ {
|
|
|
+ Support = new SupportInfo();
|
|
|
+ RoomCount = 0;
|
|
|
+ }
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString()
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "Info\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "RoomCount : " + RoomCount + "\r\n" +
|
|
|
+ "Vender : " + String.format("0x%02X", Vender) + "\r\n" +
|
|
|
+ "FwVer : " + (int)(FwVer_Year+2000) + "." + FwVer_Month + "." + FwVer_Day + "." + FwVer_Number + "\r\n" +
|
|
|
+ "ProtocolVer : " + "V" + ProtocolVer_Main + "." + ProtocolVer_Sub + "\r\n" +
|
|
|
+
|
|
|
+ "[Support]" + "\r\n" +
|
|
|
+ "MinSetTemp : " + Support.MinSetTemp +"\r\n" +
|
|
|
+ "MaxSetTemp : " + Support.MaxSetTemp +"\r\n" +
|
|
|
+ "SetTempPoint05 : " + Support.SetTempPoint05 +"\r\n" +
|
|
|
+ "Outing : " + Support.Outing +"\r\n" +
|
|
|
+ "Sleep : " + Support.Sleep +"\r\n" +
|
|
|
+ "Reservation : " + Support.Reservation +"\r\n" +
|
|
|
+ "Pause : " + Support.Pause +"\r\n" +
|
|
|
+ "AI : " + Support.AI +"\r\n" +
|
|
|
+ "OutsideTempUse : " + Support.OutsideTempUse +"\r\n" +
|
|
|
+ "Boiler : " + Support.Boiler +"\r\n" +
|
|
|
+ "Leak : " + Support.Leak +"\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 각 방 데이터 */
|
|
|
+ public static class RoomData
|
|
|
+ {
|
|
|
+ ////////////////////////////////////////////
|
|
|
+ // 기본기능
|
|
|
+ ////////////////////////////////////////////
|
|
|
+ /** 운전모드 {@link MODE} 값에 따름 */
|
|
|
+ public byte Mode;
|
|
|
+ /** 밸브상태 ( ture : 열림, false : 닫힘 ) */
|
|
|
+ public boolean bValveStatus;
|
|
|
+ /** 설정온도 ( 0.5도 혹은 1도 단위) */
|
|
|
+ public double SetTemp;
|
|
|
+ /** 현재온도 */
|
|
|
+ public double NowTemp;
|
|
|
+ /** 에러 코드 */
|
|
|
+ public ERROR Error;
|
|
|
+
|
|
|
+ ////////////////////////////////////////////
|
|
|
+ // 추가기능
|
|
|
+ ////////////////////////////////////////////
|
|
|
+ /** 취침운전 설정값 */
|
|
|
+ public SLEEP Sleep;
|
|
|
+ /** 예약운전 설정값 */
|
|
|
+ public RESERVATION Reservation;
|
|
|
+
|
|
|
+ public RoomData()
|
|
|
+ {
|
|
|
+ Mode = MODE.HeatingOFF;
|
|
|
+ bValveStatus = false;
|
|
|
+ SetTemp = 10.0;
|
|
|
+ NowTemp = 15.0;
|
|
|
+ Error = new ERROR();
|
|
|
+ Sleep = new SLEEP();
|
|
|
+ Reservation = new RESERVATION();
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString(byte RoomIndex)
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "RoomData (" + (int) (RoomIndex+1) + ") \r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "Mode : " + MODE.ToDebugString(Mode) + "\r\n" +
|
|
|
+ "bValveStatus : " + bValveStatus + "\r\n" +
|
|
|
+ "SetTemp : " + SetTemp + "\r\n" +
|
|
|
+ "NowTemp : " + NowTemp + "\r\n" +
|
|
|
+ "Error : " + Error.ToDebugString() + "\r\n" +
|
|
|
+ "Sleep : " + Sleep.ToDebugString() + "\r\n" +
|
|
|
+ "Reservation : " + Reservation.ToDebugString() + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 각 방 제어용 데이터 */
|
|
|
+ public static class CtrlRoomData
|
|
|
+ {
|
|
|
+ /** 운전모드 {@link MODE} 값에 따름 */
|
|
|
+ public byte Mode;
|
|
|
+ /** 설정온도 ( 0.5도 혹은 1도 단위) */
|
|
|
+ public double SetTemp;
|
|
|
+ /** 취침운전 설정값 */
|
|
|
+ public SLEEP Sleep;
|
|
|
+ /** 예약운전 설정값 */
|
|
|
+ public RESERVATION Reservation;
|
|
|
+
|
|
|
+ public CtrlRoomData()
|
|
|
+ {
|
|
|
+ Mode = MODE.Idle;
|
|
|
+ SetTemp = 0;
|
|
|
+ Sleep = new SLEEP();
|
|
|
+ Reservation = new RESERVATION();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 설정시간 */
|
|
|
+ public static class SET_TIME
|
|
|
+ {
|
|
|
+ /** 30분 (ture : 30분, false : 정각) */
|
|
|
+ public boolean bMinute30;
|
|
|
+ /** 시간 (범위 : 0x03 - 3시 ~ 0x0C - 12시 ) */
|
|
|
+ public byte Hour;
|
|
|
+
|
|
|
+ public SET_TIME()
|
|
|
+ {
|
|
|
+ bMinute30 = false;
|
|
|
+ Hour = 0;
|
|
|
+ }
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString()
|
|
|
+ {
|
|
|
+ if(bMinute30) return String.format("%d:30", Hour);
|
|
|
+ else return String.format("%d:00", Hour);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 에러코드 */
|
|
|
+ public static class ERROR
|
|
|
+ {
|
|
|
+ /** 온도조절기 통신이상 ( true : 이상, false : 정상) */
|
|
|
+ public boolean bRoomComm;
|
|
|
+ /** 온도조절기 온도센서 이상 ( true : 이상, false : 정상) */
|
|
|
+ public boolean bRoomTempSensor;
|
|
|
+ /** 온도조절기 시스템 이상 ( true : 이상, false : 정상) */
|
|
|
+ public boolean bRoomSystem;
|
|
|
+ /** 밸브제어기 온도센서 이상 ( true : 이상, false : 정상) */
|
|
|
+ public boolean bMainTempSensor;
|
|
|
+ /** 밸브제어기 시스템 이상 ( true : 이상, false : 정상) */
|
|
|
+ public boolean bMainSystem;
|
|
|
+ /** 보일러 이상 ( true : 이상, false : 정상) */
|
|
|
+ public boolean bBoiler;
|
|
|
+ /** 누수 이상 ( true : 이상, false : 정상) */
|
|
|
+ public boolean bLeak;
|
|
|
+ /** 기타이상 ( true : 이상, false : 정상) */
|
|
|
+ public boolean bEtc;
|
|
|
+
|
|
|
+ public ERROR()
|
|
|
+ {
|
|
|
+ bRoomComm = false;
|
|
|
+ bRoomTempSensor = false;
|
|
|
+ bRoomSystem = false;
|
|
|
+ bMainTempSensor = false;
|
|
|
+ bMainSystem = false;
|
|
|
+ bBoiler = false;
|
|
|
+ bLeak = false;
|
|
|
+ bEtc = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public byte getByte()
|
|
|
+ {
|
|
|
+ byte ret = 0x00;
|
|
|
+
|
|
|
+ if(bRoomComm) ret |= define.BIT0;
|
|
|
+ if(bRoomTempSensor) ret |= define.BIT1;
|
|
|
+ if(bRoomSystem) ret |= define.BIT2;
|
|
|
+ if(bMainTempSensor) ret |= define.BIT3;
|
|
|
+ if(bMainSystem) ret |= define.BIT4;
|
|
|
+ if(bBoiler) ret |= define.BIT5;
|
|
|
+ if(bLeak) ret |= define.BIT6;
|
|
|
+ if(bEtc) ret |= define.BIT7;
|
|
|
+
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setByte(byte in)
|
|
|
+ {
|
|
|
+ if((in&0x01) != 0x00) bRoomComm = true;
|
|
|
+ else bRoomComm = false;
|
|
|
+ if((in&0x02) != 0x00) bRoomTempSensor = true;
|
|
|
+ else bRoomTempSensor = false;
|
|
|
+ if((in&0x04) != 0x00) bRoomSystem = true;
|
|
|
+ else bRoomSystem = false;
|
|
|
+ if((in&0x08) != 0x00) bMainTempSensor = true;
|
|
|
+ else bMainTempSensor = false;
|
|
|
+ if((in&0x10) != 0x00) bMainSystem = true;
|
|
|
+ else bMainSystem = false;
|
|
|
+ if((in&0x20) != 0x00) bBoiler = true;
|
|
|
+ else bBoiler = false;
|
|
|
+ if((in&0x40) != 0x00) bLeak = true;
|
|
|
+ else bLeak = false;
|
|
|
+ if((in&0x80) != 0x00) bEtc = true;
|
|
|
+ else bEtc = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString()
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "bRoomComm:" + ToStrBoolean(bRoomComm) + " , " +
|
|
|
+ "bRoomTempSensor:" + ToStrBoolean(bRoomTempSensor) + " , " +
|
|
|
+ "bRoomSystem:" + ToStrBoolean(bRoomSystem) + " , " +
|
|
|
+ "bMainTempSensor:" + ToStrBoolean(bMainTempSensor) + " , " +
|
|
|
+ "bMainSystem:" + ToStrBoolean(bMainSystem) + " , " +
|
|
|
+ "bBoiler:" + ToStrBoolean(bBoiler) + " , " +
|
|
|
+ "bLeak:" + ToStrBoolean(bLeak) + " , " +
|
|
|
+ "bEtc:" + ToStrBoolean(bEtc);
|
|
|
+
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ private String ToStrBoolean(boolean in) { if(in) return "O"; else return "X"; }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 취침운전 */
|
|
|
+ public static class SLEEP
|
|
|
+ {
|
|
|
+ /** 기능 지원여부 or 사용여부 */
|
|
|
+ private boolean SupportNUse;
|
|
|
+ /** 기능 지원여부 or 사용여부 */
|
|
|
+ public boolean getSupportNUse() { return SupportNUse; }
|
|
|
+
|
|
|
+ //////////////////////////////////////////////
|
|
|
+ // 취침 운전시간
|
|
|
+ //////////////////////////////////////////////
|
|
|
+ private byte Time;
|
|
|
+
|
|
|
+ /** 시간데이터를 가져온다. 프로토콜상 byte 데이터*/
|
|
|
+ public byte getTime() { return Time; }
|
|
|
+ /** 시간데이터를 가져온다. String 데이터로*/
|
|
|
+ public String getTimeStr()
|
|
|
+ {
|
|
|
+ String [] str = new String []
|
|
|
+ {"미설정", "3시간", "3시간30분", "4시간", "4시간30분", "5시간", "5시간30분", "6시간", "6시간30분",
|
|
|
+ "7시간", "7시간30분", "8시간", "8시간30분", "9시간", "9시간30분", "10시간", "10시간30분",
|
|
|
+ "11시간", "11시간30분", "12시간" };
|
|
|
+
|
|
|
+ try { return str[Time]; }
|
|
|
+ catch (RuntimeException re) {
|
|
|
+ LogUtil.errorLogInfo("", "", re);
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ Log.e("DataClasses", "[getTimeStr]");
|
|
|
+ //e.printStackTrace();
|
|
|
+ LogUtil.errorLogInfo("", "", e);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean setTime(byte setTime)
|
|
|
+ {
|
|
|
+ if( (setTime < 0) || (setTime > 19) ) return false;
|
|
|
+ Time = setTime;
|
|
|
+ CheckSupportNUse();
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setTimeIncrease() { if(++Time > 19) Time = 1; CheckSupportNUse(); }
|
|
|
+ public void setTimeDecrease() { if(--Time <= 0) Time = 19; CheckSupportNUse(); }
|
|
|
+
|
|
|
+ //////////////////////////////////////////////
|
|
|
+ // 취침 설정온도
|
|
|
+ //////////////////////////////////////////////
|
|
|
+ private byte Temp;
|
|
|
+
|
|
|
+ public byte getTemp() { return Temp; }
|
|
|
+
|
|
|
+ public double getTempDouble()
|
|
|
+ {
|
|
|
+ double [] tempArray = new double [] { 0.0, 0.5, 1.0, 1.5 };
|
|
|
+
|
|
|
+ try { return tempArray[Temp]; }
|
|
|
+ catch (RuntimeException re) {
|
|
|
+ LogUtil.errorLogInfo("", "", re);
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ Log.e("DataClasses", "[getTempDouble]");
|
|
|
+ //e.printStackTrace();
|
|
|
+ LogUtil.errorLogInfo("", "", e);
|
|
|
+ }
|
|
|
+ return 0.0;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean setTemp(byte setTemp)
|
|
|
+ {
|
|
|
+ if( (setTemp < 0) || (setTemp > 3) ) return false;
|
|
|
+ Temp = setTemp;
|
|
|
+ CheckSupportNUse();
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setTempIncrease() { if(++Temp > 3) Temp = 1; CheckSupportNUse(); }
|
|
|
+ public void setTempDecrease() { if(--Temp <= 0) Temp = 3; CheckSupportNUse(); }
|
|
|
+
|
|
|
+ public SLEEP()
|
|
|
+ {
|
|
|
+ SupportNUse = false;
|
|
|
+ Time = 0;
|
|
|
+ Temp = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ public byte getByte() { return (byte)(Time | (byte)(Temp<<5)); }
|
|
|
+
|
|
|
+ public void setByte(byte in)
|
|
|
+ {
|
|
|
+ setTime((byte)(in & (byte)(define.BIT0 | define.BIT1 | define.BIT2 | define.BIT3 | define.BIT4)));
|
|
|
+ setTemp((byte)((in >> 5) & (byte)(define.BIT0 | define.BIT1 | define.BIT2)));
|
|
|
+ }
|
|
|
+
|
|
|
+ private void CheckSupportNUse()
|
|
|
+ {
|
|
|
+ if((Time == 0) && (Temp == 0)) SupportNUse = false;
|
|
|
+ else SupportNUse = true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString()
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "Time : " + getTimeStr() + " , " +
|
|
|
+ "Temp : " + getTempDouble() + "℃";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 예약운전 */
|
|
|
+ public static class RESERVATION
|
|
|
+ {
|
|
|
+ /** 기능 지원여부 or 사용여부 */
|
|
|
+ private boolean SupportNUse;
|
|
|
+ /** 기능 지원여부 or 사용여부 */
|
|
|
+ public boolean getSupportNUse() { return SupportNUse; }
|
|
|
+
|
|
|
+ private boolean [] SettingInfo;
|
|
|
+
|
|
|
+ public RESERVATION()
|
|
|
+ {
|
|
|
+ SupportNUse = false;
|
|
|
+ SettingInfo = new boolean [24];
|
|
|
+ for(int i=0 ; i<SettingInfo.length ; i++) SettingInfo[i] = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean setSchedule(int index, boolean OnOff)
|
|
|
+ {
|
|
|
+ if( (index < 0) || (index >= 24) ) return false;
|
|
|
+ if(SettingInfo == null) return false;
|
|
|
+
|
|
|
+ SettingInfo[index] = OnOff;
|
|
|
+ SupportNUse = true;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean getSchedule(int index)
|
|
|
+ {
|
|
|
+ if( (index < 0) || (index >= 24) ) return false;
|
|
|
+ if(SettingInfo == null) return false;
|
|
|
+ return SettingInfo[index];
|
|
|
+ }
|
|
|
+
|
|
|
+ public byte [] getByte()
|
|
|
+ {
|
|
|
+ byte [] retArrayByte = new byte[] { 0x00, 0x00, 0x00 };
|
|
|
+
|
|
|
+ if(!SupportNUse) return retArrayByte;
|
|
|
+
|
|
|
+ int index = 0;
|
|
|
+ for(int i=0 ; i<3 ; i++)
|
|
|
+ {
|
|
|
+ for(int y=0 ; y<8 ; y++)
|
|
|
+ {
|
|
|
+ if(SettingInfo[index++])
|
|
|
+ {
|
|
|
+ retArrayByte[i] |= define.BIT_ARRAY[y];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return retArrayByte;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setByte(byte [] in)
|
|
|
+ {
|
|
|
+ if(in == null) return;
|
|
|
+ if(in.length != 3) return;
|
|
|
+
|
|
|
+ int SettingInfoIndex = 0;
|
|
|
+ boolean OnOff = false;
|
|
|
+ byte data;
|
|
|
+ for(int cnt=0 ; cnt<3 ; cnt++)
|
|
|
+ {
|
|
|
+ data = in[cnt];
|
|
|
+ for(int i=0 ; i<8 ; i++)
|
|
|
+ {
|
|
|
+ if( (data & define.BIT_ARRAY[i]) != 0x00) OnOff = true;
|
|
|
+ else OnOff = false;
|
|
|
+ setSchedule(SettingInfoIndex++, OnOff);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public int getInt()
|
|
|
+ {
|
|
|
+ int retInt = 0;
|
|
|
+
|
|
|
+ if(!SupportNUse) return retInt;
|
|
|
+
|
|
|
+ int shift = 1;
|
|
|
+ for(int i=0 ; i<24 ; i++)
|
|
|
+ {
|
|
|
+ if(getSchedule(i)) retInt |= shift;
|
|
|
+ shift <<= 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ return retInt;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public void setInt(int in)
|
|
|
+ {
|
|
|
+ int shift = 1;
|
|
|
+ for(int i=0 ; i<24 ; i++)
|
|
|
+ {
|
|
|
+ if((in & shift) != 0) setSchedule(i, true);
|
|
|
+ else setSchedule(i, false);
|
|
|
+
|
|
|
+ shift <<= 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString()
|
|
|
+ {
|
|
|
+ if(SettingInfo == null) return "null";
|
|
|
+ if(!SupportNUse) return "NotSupport";
|
|
|
+ String retStr = "|";
|
|
|
+ for(int i=0 ; i<SettingInfo.length ; i++)
|
|
|
+ {
|
|
|
+ if(SettingInfo[i]) retStr += "O";
|
|
|
+ else retStr += "X";
|
|
|
+
|
|
|
+ if(i==5 || i==11 || i==17) retStr += "|";
|
|
|
+ }
|
|
|
+ retStr += "|";
|
|
|
+
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 운전상태 정의 */
|
|
|
+ public static class MODE
|
|
|
+ {
|
|
|
+ /** 미설정 ( * 설정전용 : 읽기시 해당없음) */
|
|
|
+ public static byte Idle = 0x00;
|
|
|
+ /** 난방 ON */
|
|
|
+ public static byte HeatingON = 0x01;
|
|
|
+ /** 난방 OFF */
|
|
|
+ public static byte HeatingOFF = 0x02;
|
|
|
+ /** 외출 */
|
|
|
+ public static byte Outing = 0x03;
|
|
|
+ /** 외출해제 ( * 설정전용 : 읽기시 해당없음) */
|
|
|
+ public static byte OutingRelease = 0x04;
|
|
|
+ /** 취침 */
|
|
|
+ public static byte Sleep = 0x05;
|
|
|
+ /** 예약 */
|
|
|
+ public static byte Reservation = 0x06;
|
|
|
+ /** 일시정지 */
|
|
|
+ public static byte Pause = 0x07;
|
|
|
+ /** 일시정지 해제 ( * 설정전용 : 읽기시 해당없음) */
|
|
|
+ public static byte PauseRelease = 0x08;
|
|
|
+
|
|
|
+ public static String ToDebugString(byte Mode)
|
|
|
+ {
|
|
|
+ String retStr;
|
|
|
+ if(Mode == MODE.Idle) retStr = "Idle";
|
|
|
+ else if(Mode == MODE.HeatingON) retStr = "HeatingON";
|
|
|
+ else if(Mode == MODE.HeatingOFF) retStr = "HeatingOFF";
|
|
|
+ else if(Mode == MODE.Outing) retStr = "Outing";
|
|
|
+ else if(Mode == MODE.OutingRelease) retStr = "OutingRelease";
|
|
|
+ else if(Mode == MODE.Sleep) retStr = "Sleep";
|
|
|
+ else if(Mode == MODE.Reservation) retStr = "Reservation";
|
|
|
+ else if(Mode == MODE.Pause) retStr = "Pause";
|
|
|
+ else if(Mode == MODE.PauseRelease) retStr = "PauseRelease";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 읽기운전모드 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param Mode - (byte) 체크할 운전모드
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckGetMode(byte Mode)
|
|
|
+ {
|
|
|
+ if(Mode == MODE.Idle) return false;
|
|
|
+ else if(Mode == MODE.HeatingON) return true;
|
|
|
+ else if(Mode == MODE.HeatingOFF) return true;
|
|
|
+ else if(Mode == MODE.Outing) return true;
|
|
|
+ else if(Mode == MODE.OutingRelease) return false;
|
|
|
+ else if(Mode == MODE.Sleep) return true;
|
|
|
+ else if(Mode == MODE.Reservation) return true;
|
|
|
+ else if(Mode == MODE.Pause) return true;
|
|
|
+ else if(Mode == MODE.PauseRelease) return false;
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 설정운전모드 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param Mode - (byte) 체크할 운전모드
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckSetMode(byte Mode)
|
|
|
+ {
|
|
|
+ if(Mode == MODE.Idle) return true;
|
|
|
+ else if(Mode == MODE.HeatingON) return true;
|
|
|
+ else if(Mode == MODE.HeatingOFF) return true;
|
|
|
+ else if(Mode == MODE.Outing) return true;
|
|
|
+ else if(Mode == MODE.OutingRelease) return true;
|
|
|
+ else if(Mode == MODE.Sleep) return true;
|
|
|
+ else if(Mode == MODE.Reservation) return true;
|
|
|
+ else if(Mode == MODE.Pause) return true;
|
|
|
+ else if(Mode == MODE.PauseRelease) return true;
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 운전모드에 따른 ON/OFF 상태를 반환한다.
|
|
|
+ *
|
|
|
+ * @param Mode - (byte) 입력 운전모드
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:ON , false:OFF
|
|
|
+ */
|
|
|
+ public static boolean GetOnOff(byte Mode)
|
|
|
+ {
|
|
|
+ if(Mode == HeatingV2.MODE.HeatingON) return true;
|
|
|
+ else if(Mode == HeatingV2.MODE.HeatingOFF) return false;
|
|
|
+ else if(Mode == HeatingV2.MODE.Outing) return false;
|
|
|
+ else if(Mode == HeatingV2.MODE.Sleep) return true;
|
|
|
+ else if(Mode == HeatingV2.MODE.Reservation) return true;
|
|
|
+ else if(Mode == HeatingV2.MODE.Pause) return false;
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 전체방 데이터 정의 (통신용) */
|
|
|
+ public static class AllRoomData
|
|
|
+ {
|
|
|
+ public byte RoomCount;
|
|
|
+ public EachRoomData [] Room;
|
|
|
+
|
|
|
+ public AllRoomData(byte nRoomCount)
|
|
|
+ {
|
|
|
+ RoomCount = nRoomCount;
|
|
|
+ Room = new EachRoomData[RoomCount];
|
|
|
+ for(byte i=0 ; i<RoomCount ; i++) Room[i] = new EachRoomData();
|
|
|
+ }
|
|
|
+
|
|
|
+ public class EachRoomData
|
|
|
+ {
|
|
|
+ ////////////////////////////////////////////
|
|
|
+ // 기본기능
|
|
|
+ ////////////////////////////////////////////
|
|
|
+ /** 운전모드 {@link MODE} 값에 따름 */
|
|
|
+ public byte Mode;
|
|
|
+ /** 밸브상태 ( ture : 열림, false : 닫힘 ) */
|
|
|
+ public boolean bValveStatus;
|
|
|
+ /** 설정온도 ( 0.5도 혹은 1도 단위) */
|
|
|
+ public double SetTemp;
|
|
|
+ /** 현재온도 */
|
|
|
+ public double NowTemp;
|
|
|
+
|
|
|
+ public EachRoomData()
|
|
|
+ {
|
|
|
+ Mode = MODE.HeatingOFF;
|
|
|
+ bValveStatus = false;
|
|
|
+ SetTemp = 10.0;
|
|
|
+ NowTemp = 15.0;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString(byte RoomIndex)
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "RoomData (" + (int) (RoomIndex+1) + ") \r\n" +
|
|
|
+ "Mode : " + MODE.ToDebugString(Mode) + " / " + "bValveStatus : " + bValveStatus + "\r\n" +
|
|
|
+ "SetTemp : " + SetTemp + " / " + "NowTemp : " + NowTemp + "\r\n";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString()
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "AllRoomData\r\n" +
|
|
|
+ "==========================\r\n";
|
|
|
+
|
|
|
+ for(byte i=0 ; i<RoomCount ; i++)
|
|
|
+ {
|
|
|
+ retStr += Room[i].ToDebugString(i);
|
|
|
+ }
|
|
|
+
|
|
|
+ retStr += "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 보일러 관련 데이터 클래스 */
|
|
|
+ public static class BoilerData
|
|
|
+ {
|
|
|
+ /** 동파방지모드 (true : 가동, false : 정지) */
|
|
|
+ public boolean bFrostProtectMode;
|
|
|
+ /** 에러코드 (0x00 정상 , 0x00 아닐경우 에러코드 */
|
|
|
+ public byte ErrorCode;
|
|
|
+ /** 난방수 설정온도 관련 */
|
|
|
+ public SetTempData HeatingWater;
|
|
|
+ /** 온수 설정온도 관련 */
|
|
|
+ public SetTempData HotWater;
|
|
|
+
|
|
|
+ public BoilerData()
|
|
|
+ {
|
|
|
+ bFrostProtectMode = false;
|
|
|
+ ErrorCode = 0x00;
|
|
|
+ HeatingWater = new SetTempData();
|
|
|
+ HotWater = new SetTempData();
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString()
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "BoilerData\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "bFrostProtectMode : " + bFrostProtectMode + "\r\n" +
|
|
|
+ "ErrorCode : " + String.format("0x%02X", ErrorCode) + "\r\n" +
|
|
|
+ "HeatingWater : " + HeatingWater.ToDebugString() + "\r\n" +
|
|
|
+ "HotWater : " + HotWater.ToDebugString() + "\r\n" +
|
|
|
+ "==========================\r\n";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ public class SetTempData
|
|
|
+ {
|
|
|
+ /** 설정온도 단위 (false : 1도단위 , true : 5도 단위) */
|
|
|
+ public boolean bSetTempUnit5;
|
|
|
+ /** 설정온도 */
|
|
|
+ public byte SetTemp;
|
|
|
+ /** 최저 설정온도 */
|
|
|
+ public byte MinSetTemp;
|
|
|
+ /** 최대 설정온도 */
|
|
|
+ public byte MaxSetTemp;
|
|
|
+
|
|
|
+ public SetTempData()
|
|
|
+ {
|
|
|
+ bSetTempUnit5 = false;
|
|
|
+ SetTemp = 0;
|
|
|
+ MinSetTemp = 0;
|
|
|
+ MaxSetTemp = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString()
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "bSetTempUnit5 : " + bSetTempUnit5 + " / SetTemp : " + SetTemp + " / MinSetTemp : " + MinSetTemp + " / MaxSetTemp : " + MaxSetTemp + "\r\n";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 특화기능 관련 데이터 클래스 */
|
|
|
+ public static class SpecialFuncData
|
|
|
+ {
|
|
|
+ /** 인공지능 동작모드 - {@link AIMODE} */
|
|
|
+ public byte Mode;
|
|
|
+ /** 설정된 외기온도 */
|
|
|
+ public double OutsideTemp;
|
|
|
+
|
|
|
+ public SpecialFuncData()
|
|
|
+ {
|
|
|
+ Mode = AIMODE.OFF;
|
|
|
+ OutsideTemp = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 인공 지능 동작모드 */
|
|
|
+ public static class AIMODE
|
|
|
+ {
|
|
|
+ /** 미설정 ( * 설정전용 : 읽기시 해당없음) */
|
|
|
+ public static byte Idle = (byte)0x00;
|
|
|
+ /** ON */
|
|
|
+ public static byte ON = (byte)0x01;
|
|
|
+ /** OFF */
|
|
|
+ public static byte OFF = (byte)0x02;
|
|
|
+
|
|
|
+ public static String ToDebugString(byte Mode)
|
|
|
+ {
|
|
|
+ String retStr;
|
|
|
+ if(Mode == AIMODE.Idle) retStr = "Idle";
|
|
|
+ else if(Mode == AIMODE.ON) retStr = "ON";
|
|
|
+ else if(Mode == AIMODE.OFF) retStr = "OFF";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static boolean CheckGetMode(byte Mode)
|
|
|
+ {
|
|
|
+ if(Mode == AIMODE.Idle) return false;
|
|
|
+ else if(Mode == AIMODE.ON) return true;
|
|
|
+ else if(Mode == AIMODE.OFF) return true;
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static boolean CheckSetMode(byte Mode)
|
|
|
+ {
|
|
|
+ if(Mode == AIMODE.Idle) return true;
|
|
|
+ else if(Mode == AIMODE.ON) return true;
|
|
|
+ else if(Mode == AIMODE.OFF) return true;
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString()
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "SpecialFuncData\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "AIMode : " + AIMODE.ToDebugString(Mode) + "\r\n" +
|
|
|
+ "OutsideTemp : " + OutsideTemp + "\r\n" +
|
|
|
+ "==========================\r\n";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /** [실시간검침기] 데이터 클래스 */
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static class RealTimeMeter {
|
|
|
+ public class EachDataList {
|
|
|
+ /** 지원여부 */
|
|
|
+ public boolean Support;
|
|
|
+ /** 누적사용량 */
|
|
|
+ public double Acc;
|
|
|
+ /** 현재사용량 */
|
|
|
+ public double Now;
|
|
|
+
|
|
|
+ public EachDataList() {
|
|
|
+ Support = false;
|
|
|
+ Acc = 0.0;
|
|
|
+ Now = 0.0;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void Input(boolean nSupport, double nAcc, double nNow) {
|
|
|
+ Support = nSupport;
|
|
|
+ Acc = nAcc;
|
|
|
+ Now = nNow;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String ToDebugString() {
|
|
|
+ return "Support : " + Support + " / Acc : " + Acc + " / Now : " + Now;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 전력 */
|
|
|
+ public EachDataList Elec;
|
|
|
+ /** 수도 */
|
|
|
+ public EachDataList Water;
|
|
|
+ /** 온수 */
|
|
|
+ public EachDataList HotWater;
|
|
|
+ /** 가스 */
|
|
|
+ public EachDataList Gas;
|
|
|
+ /** 열량 */
|
|
|
+ public EachDataList Calorie;
|
|
|
+
|
|
|
+ // 연속으로 에러가 수신되는 경우 +1을 하여, 3회 이상이면 알람을 발생시킴
|
|
|
+ /** 전력 측정 이상 */
|
|
|
+ public int nElecErrorCnt;
|
|
|
+ /** 수도 측정 이상 */
|
|
|
+ public int nWaterErrorCnt;
|
|
|
+ /** 온수 측정 이상 */
|
|
|
+ public int nHotWaterErrorCnt;
|
|
|
+ /** 가스 측정 이상 */
|
|
|
+ public int nGasErrorCnt;
|
|
|
+ /** 열량 측정 이상 */
|
|
|
+ public int nHeatingErrorCnt;
|
|
|
+
|
|
|
+ /** 생성자 */
|
|
|
+ public RealTimeMeter() {
|
|
|
+ Elec = new EachDataList();
|
|
|
+ Water = new EachDataList();
|
|
|
+ HotWater = new EachDataList();
|
|
|
+ Gas = new EachDataList();
|
|
|
+ Calorie = new EachDataList();
|
|
|
+ nElecErrorCnt = 0;
|
|
|
+ nWaterErrorCnt = 0;
|
|
|
+ nHotWaterErrorCnt = 0;
|
|
|
+ nGasErrorCnt = 0;
|
|
|
+ nHeatingErrorCnt = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 전기,수도,온수,가스,열량 5종 모두의 지원여부를 체크한다.
|
|
|
+ *
|
|
|
+ * @return (boolean) true : 5종, false : 5종아님
|
|
|
+ */
|
|
|
+ public boolean GetAllSupport() {
|
|
|
+ if (Elec.Support && Water.Support && HotWater.Support && Gas.Support && Calorie.Support) return true;
|
|
|
+ else return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString() {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "RealTimeMeter\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "Elec - " + Elec.ToDebugString() + "\r\n" +
|
|
|
+ "Water - " + Water.ToDebugString() + "\r\n" +
|
|
|
+ "HotWater - " + HotWater.ToDebugString() + "\r\n" +
|
|
|
+ "Gas - " + Gas.ToDebugString() + "\r\n" +
|
|
|
+ "Calorie - " + Calorie.ToDebugString() + "\r\n" +
|
|
|
+ "nElecErrorCnt: " + nElecErrorCnt + "\r\n" +
|
|
|
+ "nWaterErrorCnt: " + nWaterErrorCnt + "\r\n" +
|
|
|
+ "nHotWaterErrorCnt: " + nHotWaterErrorCnt + "\r\n" +
|
|
|
+ "nGasErrorCnt: " + nGasErrorCnt + "\r\n" +
|
|
|
+ "nHeatingErrorCnt: " + nHeatingErrorCnt + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /** [환기] 데이터 클래스 */
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static class Venti {
|
|
|
+ /** ON/OFF 상태 */
|
|
|
+ public boolean OnOff;
|
|
|
+
|
|
|
+ /** 예약운전 상태 */
|
|
|
+ public boolean Reservation;
|
|
|
+
|
|
|
+ /** 바람세기 상태 */
|
|
|
+ public byte Wind;
|
|
|
+
|
|
|
+ /** 취침모드 상태 */
|
|
|
+ public byte Sleep;
|
|
|
+
|
|
|
+ /** 외부제어 상태 */
|
|
|
+ public byte EtcCtr;
|
|
|
+
|
|
|
+ /** 타이머 설정값 남은시간 */
|
|
|
+ public int Timer;
|
|
|
+
|
|
|
+ /** 기기 이상 상태 */
|
|
|
+ public FAULT Fault;
|
|
|
+
|
|
|
+ /** 기기정보 */
|
|
|
+ public SUPPORT Support;
|
|
|
+
|
|
|
+ /** 기기정보2 */
|
|
|
+ public SUPPORT2 Support2;
|
|
|
+
|
|
|
+ /** 자연환기 (바이패스)상태 */
|
|
|
+ public boolean ByPass;
|
|
|
+
|
|
|
+ /** 히터 가동 남은시간 */
|
|
|
+ public byte HeaterTimeRemaining;
|
|
|
+
|
|
|
+ /** 히터 상태 */
|
|
|
+ public byte HeaterStatus;
|
|
|
+
|
|
|
+ /** 자동환기 상태 */
|
|
|
+ public boolean AutoDriving;
|
|
|
+
|
|
|
+ /** 욕실배기 상태 */
|
|
|
+ public boolean BathRoom;
|
|
|
+
|
|
|
+ /** 내부순환 상태 */
|
|
|
+ public boolean InnerCycle;
|
|
|
+
|
|
|
+ /** 외기청정 상태 */
|
|
|
+ public boolean OutAirClean;
|
|
|
+
|
|
|
+ /** 공기청정 자동상태 */
|
|
|
+ public boolean AirCleanAuto;
|
|
|
+
|
|
|
+ /** 현산 미세먼지센서 연동 공기청정 자동상태 */
|
|
|
+ public boolean HDCAutoAirClean;
|
|
|
+
|
|
|
+ public Venti() {
|
|
|
+ OnOff = false;
|
|
|
+ Reservation = false;
|
|
|
+ Wind = 0x01;
|
|
|
+ ByPass = false;
|
|
|
+ AutoDriving = false;
|
|
|
+ BathRoom = false;
|
|
|
+ InnerCycle = false;
|
|
|
+ OutAirClean = false;
|
|
|
+ AirCleanAuto = false;
|
|
|
+ HDCAutoAirClean = false;
|
|
|
+ Sleep = 0x00;
|
|
|
+ HeaterStatus = HEATER.NOT_SUPPORT;
|
|
|
+ HeaterTimeRemaining = 0;
|
|
|
+ EtcCtr = 0x00;
|
|
|
+ Timer = 0;
|
|
|
+ Fault = new FAULT((byte)0x00);
|
|
|
+ Support = new SUPPORT((byte)0x00);
|
|
|
+ Support2 = new SUPPORT2((byte)0x00);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString() {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "STATUS\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "OnOff : " + OnOff + "\r\n" +
|
|
|
+ "Reservation : " + Reservation + "\r\n" +
|
|
|
+ "Wind : " + WIND.ToDebugString(Wind) + "\r\n" +
|
|
|
+ "ByPass : " + ByPass + "\r\n" +
|
|
|
+ "AutoDriving : " + AutoDriving + "\r\n" +
|
|
|
+ "BathRoom : " + BathRoom + "\r\n" +
|
|
|
+ "InnerCycle : " + InnerCycle + "\r\n" +
|
|
|
+ "OutAirClean : " + OutAirClean + "\r\n" +
|
|
|
+ "AirCleanAuto : " + AirCleanAuto + "\r\n" +
|
|
|
+ "HDCAutoAirClean : " + HDCAutoAirClean + "\r\n" +
|
|
|
+ "Sleep : " + SLEEP.ToDebugString(Sleep) + "\r\n" +
|
|
|
+ "HeaterStatus : " + HEATER.ToDebugString(HeaterStatus) + "\r\n" +
|
|
|
+ "HeaterTimeRemaining : " + HeaterTimeRemaining + "\r\n" +
|
|
|
+ "EtcCtr : " + ETC_CTR.ToDebugString(EtcCtr) + "\r\n" +
|
|
|
+ "Timer : " + Timer + "\r\n" +
|
|
|
+ "Fault : " + String.format("0x%02X", Fault.FaultByte) + "\r\n" +
|
|
|
+ "Support : " + String.format("0x%02X", Support.SupportByte) + "\r\n" +
|
|
|
+ "Support2 : " + String.format("0x%02X", Support2.SupportByte2) + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 에러 메시지 출력 */
|
|
|
+ public String ToFaultString() {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "FAULT\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "Fault : " + String.format("0x%02X", Fault.FaultByte) + "\r\n" +
|
|
|
+ "FilterChangeFree : " + Fault.FilterChangeFree + "\r\n" +
|
|
|
+ "FilterChangeMedium : " + Fault.FilterChangeMedium + "\r\n" +
|
|
|
+ "MotorError : " + Fault.MotorError + "\r\n" +
|
|
|
+ "TempSensorError : " + Fault.TempSensorError + "\r\n" +
|
|
|
+ "TempSensorError : " + Fault.TempSensorError + "\r\n" +
|
|
|
+ "SafeMode : " + Fault.SafeMode + "\r\n" +
|
|
|
+ "SupplyFanError : " + Fault.SupplyFanError + "\r\n" +
|
|
|
+ "ExhaustFanError : " + Fault.ExhaustFanError + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 바람세기 상태 */
|
|
|
+ public static class WIND {
|
|
|
+ /** 미 */
|
|
|
+ public static byte LOW = 0x01;
|
|
|
+ /** 약 */
|
|
|
+ public static byte MID = 0x02;
|
|
|
+ /** 강 */
|
|
|
+ public static byte HI = 0x03;
|
|
|
+ /** 자동 */
|
|
|
+ public static byte AUTO = 0x04;
|
|
|
+ /** 자연 */
|
|
|
+ public static byte BYPASS = 0x05;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param nStatus - (byte) 체크할 상태
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckRange(byte nStatus) {
|
|
|
+ if (nStatus == WIND.LOW) return true;
|
|
|
+ else if(nStatus == WIND.MID) return true;
|
|
|
+ else if(nStatus == WIND.HI) return true;
|
|
|
+ else if(nStatus == WIND.AUTO) return true;
|
|
|
+ else if(nStatus == WIND.BYPASS) return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String ToDebugString(byte nStatus) {
|
|
|
+ String retStr;
|
|
|
+ if (nStatus == WIND.LOW) retStr = "LOW";
|
|
|
+ else if (nStatus == WIND.MID) retStr = "MID";
|
|
|
+ else if (nStatus == WIND.HI) retStr = "HI";
|
|
|
+ else if (nStatus == WIND.AUTO) retStr = "AUTO";
|
|
|
+ else if (nStatus == WIND.BYPASS) retStr = "BYPASS";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 취침모드 상태 */
|
|
|
+ public static class SLEEP {
|
|
|
+ /** 취침모드 꺼짐 */
|
|
|
+ public static byte SLEEP_OFF = 0x00;
|
|
|
+ /** 취침모드 켜짐 */
|
|
|
+ public static byte SLEEP_ON = 0x01;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param nStatus - (byte) 체크할 상태
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckRange(byte nStatus) {
|
|
|
+ if (nStatus == SLEEP.SLEEP_OFF) return true;
|
|
|
+ else if (nStatus == SLEEP.SLEEP_ON) return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String ToDebugString(byte nStatus) {
|
|
|
+ String retStr;
|
|
|
+ if (nStatus == SLEEP.SLEEP_OFF) retStr = "SLEEP_OFF";
|
|
|
+ else if (nStatus == SLEEP.SLEEP_ON) retStr = "SLEEP_ON";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 외부제어 상태 */
|
|
|
+ public static class ETC_CTR {
|
|
|
+ /** 외부제어 없음 */
|
|
|
+ public static byte CTR_NON = 0x00;
|
|
|
+ /** 외부제어 있음 */
|
|
|
+ public static byte CTR_EXIST = 0x01;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param nStatus - (byte) 체크할 상태
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckRange(byte nStatus) {
|
|
|
+ if (nStatus == ETC_CTR.CTR_NON) return true;
|
|
|
+ else if (nStatus == ETC_CTR.CTR_EXIST) return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String ToDebugString(byte nStatus) {
|
|
|
+ String retStr;
|
|
|
+ if (nStatus == ETC_CTR.CTR_NON) retStr = "CTR_NON";
|
|
|
+ else if (nStatus == ETC_CTR.CTR_EXIST) retStr = "CTR_EXIST";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 히터 상태 */
|
|
|
+ public static class HEATER {
|
|
|
+ /** 꺼짐 */
|
|
|
+ public static byte OFF = (byte) 0x00;
|
|
|
+ /** 대기상태 */
|
|
|
+ public static byte STAND_BY = (byte) 0x01;
|
|
|
+ /** 지원하지않음 */
|
|
|
+ public static byte NOT_SUPPORT = (byte) 0x02;
|
|
|
+ /** 켜짐 */
|
|
|
+ public static byte ON = (byte) 0x03;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param nStatus - (byte) 체크할 상태
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckRange(byte nStatus) {
|
|
|
+ if (nStatus == OFF) return true;
|
|
|
+ else if (nStatus == STAND_BY) return true;
|
|
|
+ else if (nStatus == NOT_SUPPORT) return true;
|
|
|
+ else if (nStatus == ON) return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String ToDebugString(byte nStatus) {
|
|
|
+ String retStr;
|
|
|
+ if (nStatus == OFF) retStr = "OFF";
|
|
|
+ else if(nStatus == STAND_BY) retStr = "STAND_BY";
|
|
|
+ else if(nStatus == NOT_SUPPORT) retStr = "NOT_SUPPORT";
|
|
|
+ else if(nStatus == ON) retStr = "ON";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 기기이상 상태 */
|
|
|
+ public static class FAULT {
|
|
|
+ /** 필터교환 프리 */
|
|
|
+ public boolean FilterChangeFree;
|
|
|
+ /** 온도센서 이상 */
|
|
|
+ public boolean FilterChangeMedium;
|
|
|
+ /** 모터이상 */
|
|
|
+ public boolean MotorError;
|
|
|
+ /** 온도센서이상 */
|
|
|
+ public boolean TempSensorError;
|
|
|
+ /** 안전모드 */
|
|
|
+ public boolean SafeMode;
|
|
|
+ /** 급기팬 이상 */
|
|
|
+ public boolean SupplyFanError;
|
|
|
+ /** 배기팬 이상 */
|
|
|
+ public boolean ExhaustFanError;
|
|
|
+
|
|
|
+ public byte FaultByte;
|
|
|
+
|
|
|
+ public FAULT(byte inFault) {
|
|
|
+ FaultByte = inFault;
|
|
|
+ if ((inFault& define.BIT0) != 0x00) FilterChangeFree = true;
|
|
|
+ else FilterChangeFree = false;
|
|
|
+ if ((inFault& define.BIT1) != 0x00) FilterChangeMedium = true;
|
|
|
+ else FilterChangeMedium = false;
|
|
|
+ if ((inFault&define.BIT2) != 0x00) MotorError = true;
|
|
|
+ else MotorError = false;
|
|
|
+ if ((inFault&define.BIT3) != 0x00) TempSensorError = true;
|
|
|
+ else TempSensorError = false;
|
|
|
+ if ((inFault&define.BIT4) != 0x00) SafeMode = true;
|
|
|
+ else SafeMode = false;
|
|
|
+ if ((inFault&define.BIT5) != 0x00) SupplyFanError = true;
|
|
|
+ else SupplyFanError = false;
|
|
|
+ if ((inFault&define.BIT6) != 0x00) ExhaustFanError = true;
|
|
|
+ else ExhaustFanError = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 기기정보 */
|
|
|
+ public static class SUPPORT {
|
|
|
+ /** 필터교환 프리 */
|
|
|
+ public boolean RoomController;
|
|
|
+ /** 자연환기(바이패스) */
|
|
|
+ public boolean ByPass;
|
|
|
+ /** 히터 */
|
|
|
+ public boolean Heater;
|
|
|
+ /** 필터교환 리셋 */
|
|
|
+ public boolean FilterReset;
|
|
|
+ /** 자동환기 연동 */
|
|
|
+ public boolean AutoDriving;
|
|
|
+ /** 욕실 배기 연동 */
|
|
|
+ public boolean BathRoom;
|
|
|
+ /** 내부순환 상태 */
|
|
|
+ public boolean InnerCycle;
|
|
|
+ /** 외기청정 상태 */
|
|
|
+ public boolean OutAirClean;
|
|
|
+
|
|
|
+ public byte SupportByte;
|
|
|
+
|
|
|
+ public SUPPORT(byte inSupport) {
|
|
|
+ SupportByte = inSupport;
|
|
|
+ if ((inSupport& define.BIT0) != 0x00) RoomController = true;
|
|
|
+ else RoomController = false;
|
|
|
+ if ((inSupport& define.BIT1) != 0x00) ByPass = true;
|
|
|
+ else ByPass = false;
|
|
|
+ if ((inSupport&define.BIT2) != 0x00) Heater = true;
|
|
|
+ else Heater = false;
|
|
|
+ if ((inSupport&define.BIT3) != 0x00) FilterReset = true;
|
|
|
+ else FilterReset = false;
|
|
|
+ if ((inSupport&define.BIT4) != 0x00) AutoDriving = true;
|
|
|
+ else AutoDriving = false;
|
|
|
+ if ((inSupport&define.BIT5) != 0x00) BathRoom = true;
|
|
|
+ else BathRoom = false;
|
|
|
+ if ((inSupport&define.BIT6) != 0x00) InnerCycle = true;
|
|
|
+ else InnerCycle = false;
|
|
|
+ if ((inSupport&define.BIT7) != 0x00) OutAirClean = true;
|
|
|
+ else OutAirClean = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 기기정보 */
|
|
|
+ public static class SUPPORT2 {
|
|
|
+ /** 창호환기 연동 */
|
|
|
+ public boolean WindowVenti;
|
|
|
+ /** 취침모드 연동 */
|
|
|
+ public boolean SleepMode;
|
|
|
+ /** 풍량0단계 사용 */
|
|
|
+ public boolean Wind0Use;
|
|
|
+
|
|
|
+ public byte SupportByte2;
|
|
|
+
|
|
|
+ public SUPPORT2(byte Support2) {
|
|
|
+ SupportByte2 = Support2;
|
|
|
+ if ((Support2& define.BIT0) != 0x00) WindowVenti = true;
|
|
|
+ else WindowVenti = false;
|
|
|
+ if ((Support2& define.BIT1) != 0x00) SleepMode = true;
|
|
|
+ else SleepMode = false;
|
|
|
+ if ((Support2& define.BIT2) != 0x00) Wind0Use = true;
|
|
|
+ else Wind0Use = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /** [대외향 - 거실조명제어기] 데이터 클래스 */
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static class Light {
|
|
|
+ /** 조명 개수 */
|
|
|
+ public int LightCount;
|
|
|
+
|
|
|
+ /** 조명 ONOFF 상태 */
|
|
|
+ public boolean [] OnOff;
|
|
|
+
|
|
|
+ /** 이상상태 */
|
|
|
+ public boolean Fault;
|
|
|
+
|
|
|
+ /** 생성자 */
|
|
|
+ public Light() {
|
|
|
+ LightCount = 0;
|
|
|
+ OnOff = new boolean [8];
|
|
|
+ for (int i = 0; i < OnOff.length; i++) OnOff[i] = false;
|
|
|
+ Fault = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString() {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "STATUS\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "Count : " + LightCount + "\r\n" +
|
|
|
+ "Fault : " + Fault + "\r\n";
|
|
|
+
|
|
|
+ for (int i = 0; i < LightCount; i++) {
|
|
|
+ retStr += "[" + (int)(i+1) + "]";
|
|
|
+ if (OnOff[i]) retStr += "O ";
|
|
|
+ else retStr += "X ";
|
|
|
+ retStr += " ";
|
|
|
+ }
|
|
|
+ retStr += "\r\n";
|
|
|
+ retStr += "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /** [전기레인지] 데이터 클래스 */
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static class ElectricRange
|
|
|
+ {
|
|
|
+ public Info info;
|
|
|
+ public Device device;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 생성자<br>
|
|
|
+ */
|
|
|
+ public ElectricRange()
|
|
|
+ {
|
|
|
+ info = new Info();
|
|
|
+ setCount((byte)0);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 화구 개수를 설정한다.
|
|
|
+ *
|
|
|
+ * @param nFireCount - (byte) 설정할 화구 개수 (범위 : 1 ~ 8)
|
|
|
+ */
|
|
|
+ public void setCount(byte nFireCount )
|
|
|
+ {
|
|
|
+ if(info == null) return;
|
|
|
+
|
|
|
+ // 1. 화구 개수
|
|
|
+ if(nFireCount >= 1) info.FireHoleCount = nFireCount;
|
|
|
+ else info.FireHoleCount = 0;
|
|
|
+
|
|
|
+ // 2. new device
|
|
|
+ device = new Device(info.FireHoleCount);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 전기레인지 보드정보 */
|
|
|
+ public static class Info
|
|
|
+ {
|
|
|
+ /** 설치상태 (true:설치 , false:미설치) */
|
|
|
+ public boolean Install;
|
|
|
+ /** 기기정보 */
|
|
|
+ public SUPPORT Support;
|
|
|
+ /** 설치된 화구 개수 (범위 : 1 ~ 8)*/
|
|
|
+ public byte FireHoleCount;
|
|
|
+ /** 제조사 코드 ( 0x01 : 쿠첸 ) */
|
|
|
+ public byte Vender;
|
|
|
+ /** 펌웨어 Build Date (년) */
|
|
|
+ public byte FwVer_Year;
|
|
|
+ /** 펌웨어 Build Date (월) */
|
|
|
+ public byte FwVer_Month;
|
|
|
+ /** 펌웨어 Build Date (일) */
|
|
|
+ public byte FwVer_Day;
|
|
|
+ /** 펌웨어 Build Date (일련번호) */
|
|
|
+ public byte FwVer_Number;
|
|
|
+
|
|
|
+ /** 지원 프로토콜 버전 Main */
|
|
|
+ public byte ProtocolVer_Main;
|
|
|
+ /** 지원 프로토콜 버전 Sub */
|
|
|
+ public byte ProtocolVer_Sub;
|
|
|
+
|
|
|
+ /** 모델명 */
|
|
|
+ public byte Model_Number;
|
|
|
+
|
|
|
+ public Info()
|
|
|
+ {
|
|
|
+ Install = false;
|
|
|
+ Support = new SUPPORT((byte)0x00);
|
|
|
+
|
|
|
+ FireHoleCount = 0;
|
|
|
+
|
|
|
+ Vender = 0x00;
|
|
|
+
|
|
|
+ FwVer_Year = 0x00;
|
|
|
+ FwVer_Month = 0x00;
|
|
|
+ FwVer_Day = 0x00;
|
|
|
+ FwVer_Number = 0x00;
|
|
|
+
|
|
|
+ ProtocolVer_Main = 0x00;
|
|
|
+ ProtocolVer_Sub = 0x00;
|
|
|
+
|
|
|
+ Model_Number = 0x00;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String ToDebugString(byte DeviceIdx)
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "(" + (byte)(DeviceIdx + 1) + ") Device - Info\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "FireHoleCount : " + FireHoleCount + "\r\n" +
|
|
|
+ "Vender : " + String.format("0x%02X", Vender) + "\r\n" +
|
|
|
+ "Model_Number : " + Model_Number + "\r\n" +
|
|
|
+ "FwVer : " + (int)(FwVer_Year+2000) + "." + FwVer_Month + "." + FwVer_Day + "." + FwVer_Number + "\r\n" +
|
|
|
+ "ProtocolVer : " + "V" + ProtocolVer_Main + "." + ProtocolVer_Sub + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 기기정보 */
|
|
|
+ public static class SUPPORT
|
|
|
+ {
|
|
|
+ /** 화구 OFF 제어 */
|
|
|
+ public boolean OnOffCtr;
|
|
|
+ /** 인덕션 있음 */
|
|
|
+ public boolean InductionExist;
|
|
|
+ /** 화구 세기 조절(ON 포함) */
|
|
|
+ public boolean FireLevelCtr;
|
|
|
+ /** 소비전력 측정 */
|
|
|
+ public boolean ConsumeElecMeasure;
|
|
|
+
|
|
|
+ public byte SupportByte;
|
|
|
+
|
|
|
+ public SUPPORT(byte inSupport)
|
|
|
+ {
|
|
|
+ SupportByte = inSupport;
|
|
|
+ if((inSupport& define.BIT0) != 0x00) OnOffCtr = true;
|
|
|
+ else OnOffCtr = false;
|
|
|
+ if((inSupport& define.BIT1) != 0x00) InductionExist = true;
|
|
|
+ else InductionExist = false;
|
|
|
+ if((inSupport&define.BIT2) != 0x00) FireLevelCtr = true;
|
|
|
+ else FireLevelCtr = false;
|
|
|
+ if((inSupport&define.BIT3) != 0x00) ConsumeElecMeasure = true;
|
|
|
+ else ConsumeElecMeasure = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 기기이상 상태 */
|
|
|
+ public static class FAULT
|
|
|
+ {
|
|
|
+ /** 휴즈 고장 */
|
|
|
+ public boolean FuseError;
|
|
|
+ /** 센서 고장 */
|
|
|
+ public boolean SensorError;
|
|
|
+
|
|
|
+ public byte FaultByte;
|
|
|
+
|
|
|
+ public FAULT(byte inFault)
|
|
|
+ {
|
|
|
+ FaultByte = inFault;
|
|
|
+ if((inFault& define.BIT0) != 0x00) FuseError = true;
|
|
|
+ else FuseError = false;
|
|
|
+ if((inFault& define.BIT1) != 0x00) SensorError = true;
|
|
|
+ else SensorError = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 전기레인지 기기 상태 */
|
|
|
+ public static class Device
|
|
|
+ {
|
|
|
+ ////////////////////////////////////////////////////////////
|
|
|
+ // FireHole (화구)
|
|
|
+ ////////////////////////////////////////////////////////////
|
|
|
+ /** 화구 개별 데이터 정의 */
|
|
|
+ public static class FireHole
|
|
|
+ {
|
|
|
+ /** 화구 종류 {@link FIREHOLE_KIND}*/
|
|
|
+ public byte Kind;
|
|
|
+ /** On/Off 상태 {@link FIREHOLE_STATUS}*/
|
|
|
+ public byte Status;
|
|
|
+ /** 잔열 상태 {@link FIREHOLE_STATUS}*/
|
|
|
+ public byte RemainHeat;
|
|
|
+ /** 동작 모드 {@link FIREHOLE_MODE}*/
|
|
|
+ public byte Mode;
|
|
|
+ /** 동작 세기 (0~10)*/
|
|
|
+ public byte Level;
|
|
|
+ /** 타이머 상위 */
|
|
|
+ public byte Timer_Upper;
|
|
|
+ /** 타이머 하위 */
|
|
|
+ public byte Timer_Lower;
|
|
|
+ /** 고장 정보 {@link FAULT}*/
|
|
|
+ public FAULT Fault;
|
|
|
+
|
|
|
+
|
|
|
+ public FireHole()
|
|
|
+ {
|
|
|
+ Kind = FIREHOLE_KIND.NONE;
|
|
|
+ Status = FIREHOLE_STATUS.OFF;
|
|
|
+ RemainHeat = FIREHOLE_STATUS.REMAIN_HEAT_OFF;
|
|
|
+ Mode = FIREHOLE_MODE.OFF;
|
|
|
+ Level = 0;
|
|
|
+ Timer_Upper = 0;
|
|
|
+ Timer_Lower = 0;
|
|
|
+
|
|
|
+ Fault = new FAULT((byte)0x00);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString(int index)
|
|
|
+ {
|
|
|
+ String retStr = "[" + (int) (index+1) + "] ";
|
|
|
+
|
|
|
+ retStr += "Kind:" + FIREHOLE_KIND.ToDebugString(Kind) + " / ";
|
|
|
+ retStr += "Status:" + FIREHOLE_STATUS.ToDebugString(Status) + " / ";
|
|
|
+ retStr += "RemainHeat:" + FIREHOLE_STATUS.ToDebugString(RemainHeat) + " / ";
|
|
|
+ retStr += "Mode:" + FIREHOLE_MODE.ToDebugString(Mode) + " / ";
|
|
|
+ retStr += "Level:" + Level + " / ";
|
|
|
+ retStr += "Timer_Upper:" + Timer_Upper + " / ";
|
|
|
+ retStr += "Timer_Lower:" + Timer_Lower + " / ";
|
|
|
+
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 설치된 화구 개수 (범위 : 1 ~ 8)*/
|
|
|
+ public byte FireHoleCount;
|
|
|
+ /** 개별 화구 */
|
|
|
+ public FireHole[] FireHoles;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 화구 가져오기
|
|
|
+ *
|
|
|
+ * @param index - (byte) 가져올 화구 인덱스
|
|
|
+ *
|
|
|
+ * @return (FireHole) 화구 클래스 (null : fail)
|
|
|
+ */
|
|
|
+ public FireHole GetFireHole(int index)
|
|
|
+ {
|
|
|
+ if(FireHoles == null) return null;
|
|
|
+ if(index > FireHoles.length) return null;
|
|
|
+ return FireHoles[index];
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 화구 설정하기
|
|
|
+ *
|
|
|
+ * @param index - (byte) 설정할 화구 인덱스
|
|
|
+ * @param Status - (byte) 설정할 화구 상태
|
|
|
+ * @param Mode - (byte) 설정할 화구 모드
|
|
|
+ *
|
|
|
+ * @return (boolean) 설정됨 여부 (true:정상, false:에러)
|
|
|
+ */
|
|
|
+ public boolean SetFireHole(int index, byte kind, byte Status, byte Mode, byte Level)
|
|
|
+ {
|
|
|
+ if(FireHoles == null) return false;
|
|
|
+ if(index > FireHoles.length) return false;
|
|
|
+ FireHole setFireHole = FireHoles[index];
|
|
|
+
|
|
|
+ setFireHole.Kind = kind;
|
|
|
+ setFireHole.Status = Status;
|
|
|
+ setFireHole.Mode = Mode;
|
|
|
+ setFireHole.Level = Level;
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 기기를 생성한다.
|
|
|
+ *
|
|
|
+ * @param nFireHoleCount - (byte) 설정할 화구 개수 (범위 : 1 ~ 8)
|
|
|
+ */
|
|
|
+ public Device(byte nFireHoleCount)
|
|
|
+ {
|
|
|
+ // 2. Concent
|
|
|
+ if(nFireHoleCount > 0)
|
|
|
+ {
|
|
|
+ FireHoleCount = nFireHoleCount;
|
|
|
+ FireHoles = new FireHole[nFireHoleCount];
|
|
|
+ for(byte i=0 ; i<FireHoleCount ; i++) FireHoles[i] = new FireHole();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ FireHoleCount = 0;
|
|
|
+ FireHoles = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString(byte DeviceIdx)
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "(" + (byte)(DeviceIdx + 1) + ") Device - FireHoles\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "FireHoleCount : " + FireHoleCount + "\r\n";
|
|
|
+ if(FireHoles != null)
|
|
|
+ {
|
|
|
+ for(byte i=0 ; i<FireHoleCount ; i++)
|
|
|
+ {
|
|
|
+ retStr += FireHoles[i].ToDebugString(i) + "\r\n";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ retStr += "==========================";
|
|
|
+
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public static class FIREHOLE_KIND
|
|
|
+ {
|
|
|
+ /** ON */
|
|
|
+ public static byte HIGHLIGHT = 0x00;
|
|
|
+ /** OFF */
|
|
|
+ public static byte INDUCTION = 0x01;
|
|
|
+ /** NONE (미정) */
|
|
|
+ public static byte NONE = 0x09;
|
|
|
+ /**
|
|
|
+ * 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param nStatus - (byte) 체크할 상태
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckRange(byte nStatus)
|
|
|
+ {
|
|
|
+ if (nStatus == HIGHLIGHT) return true;
|
|
|
+ else if(nStatus == INDUCTION) return true;
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public static String ToDebugString(byte nStatus)
|
|
|
+ {
|
|
|
+ String retStr;
|
|
|
+ if (nStatus == HIGHLIGHT) retStr = "HIGHLIGHT";
|
|
|
+ else if(nStatus == INDUCTION) retStr = "INDUCTION";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static class FIREHOLE_STATUS
|
|
|
+ {
|
|
|
+ /** ON */
|
|
|
+ public static byte ON = 0x01;
|
|
|
+ /** OFF */
|
|
|
+ public static byte OFF = 0x02;
|
|
|
+ /** 잔열 없음 */
|
|
|
+ public static byte REMAIN_HEAT_OFF = 0x03;
|
|
|
+ /** 잔열 있음 */
|
|
|
+ public static byte REMAIN_HEAT_ON = 0x04;
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param nStatus - (byte) 체크할 상태
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckRange(byte nStatus)
|
|
|
+ {
|
|
|
+ if (nStatus == ON) return true;
|
|
|
+ else if(nStatus == OFF) return true;
|
|
|
+ else if(nStatus == REMAIN_HEAT_OFF) return true;
|
|
|
+ else if(nStatus == REMAIN_HEAT_ON) return true;
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public static String ToDebugString(byte nStatus)
|
|
|
+ {
|
|
|
+ String retStr;
|
|
|
+ if (nStatus == ON) retStr = "ON";
|
|
|
+ else if(nStatus == OFF) retStr = "OFF";
|
|
|
+ else if(nStatus == REMAIN_HEAT_OFF) retStr = "REMAIN_HEAT_OFF";
|
|
|
+ else if(nStatus == REMAIN_HEAT_ON) retStr = "REMAIN_HEAT_ON";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /** 화구 모드 */
|
|
|
+ public static class FIREHOLE_MODE
|
|
|
+ {
|
|
|
+ /** OFF */
|
|
|
+ public static byte OFF = 0x00;
|
|
|
+ /** 가열 */
|
|
|
+ public static byte HEATING = 0x01;
|
|
|
+ /** 보온 */
|
|
|
+ public static byte HEAT_SAVE = 0x02;
|
|
|
+ /** 물 끓임 */
|
|
|
+ public static byte WATER_BOIL = 0x03;
|
|
|
+ /** 우림 */
|
|
|
+ public static byte SOAKING = 0x04;
|
|
|
+ /** 프라이팬 */
|
|
|
+ public static byte FRYPAN = 0x05;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param nStatus - (byte) 체크할 상태
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckRange(byte nStatus)
|
|
|
+ {
|
|
|
+ if (nStatus == OFF) return true;
|
|
|
+ else if(nStatus == HEATING) return true;
|
|
|
+ else if(nStatus == HEAT_SAVE) return true;
|
|
|
+ else if(nStatus == WATER_BOIL) return true;
|
|
|
+ else if(nStatus == SOAKING) return true;
|
|
|
+ else if(nStatus == FRYPAN) return true;
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public static String ToDebugString(byte nStatus)
|
|
|
+ {
|
|
|
+ String retStr;
|
|
|
+ if (nStatus == OFF) retStr = "OFF";
|
|
|
+ else if(nStatus == HEATING) retStr = "HEATING";
|
|
|
+ else if(nStatus == HEAT_SAVE) retStr = "HEAT_SAVE";
|
|
|
+ else if(nStatus == WATER_BOIL) retStr = "WATER_BOIL";
|
|
|
+ else if(nStatus == SOAKING) retStr = "SOAKING";
|
|
|
+ else if(nStatus == FRYPAN) retStr = "FRYPAN";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /** [재실센서] 데이터 클래스 */
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static class InRoomDetectSesnor
|
|
|
+ {
|
|
|
+ public INFO info;
|
|
|
+ public STATUS status;
|
|
|
+
|
|
|
+ public InRoomDetectSesnor()
|
|
|
+ {
|
|
|
+ info = new INFO();
|
|
|
+ status = new STATUS();
|
|
|
+ }
|
|
|
+
|
|
|
+ public static class INFO
|
|
|
+ {
|
|
|
+ /** 설치 여부 */
|
|
|
+ public boolean Install;
|
|
|
+
|
|
|
+ /** 프로토콜 Build Data (Year) */
|
|
|
+ public byte FwVer_Year;
|
|
|
+
|
|
|
+ /** 프로토콜 Build Data (Month) */
|
|
|
+ public byte FwVer_Month;
|
|
|
+
|
|
|
+ /** 프로토콜 Build Data (Day) */
|
|
|
+ public byte FwVer_Day;
|
|
|
+
|
|
|
+ /** 프로토콜 Build Data (Number) */
|
|
|
+ public byte FwVer_Number;
|
|
|
+
|
|
|
+ /** 프로토콜 버전정보 (상위) */
|
|
|
+ public byte ProtocolVer_Main;
|
|
|
+
|
|
|
+ /** 프로토콜 버전정보 (하위) */
|
|
|
+ public byte ProtocolVer_Sub;
|
|
|
+
|
|
|
+ /** 제조사 정보 */
|
|
|
+ public byte Vendor;
|
|
|
+
|
|
|
+ public INFO()
|
|
|
+ {
|
|
|
+ Install = false;
|
|
|
+
|
|
|
+ FwVer_Year = 0;
|
|
|
+ FwVer_Month = 0;
|
|
|
+ FwVer_Day = 0;
|
|
|
+ FwVer_Number = 0;
|
|
|
+
|
|
|
+ ProtocolVer_Main = 0;
|
|
|
+ ProtocolVer_Sub = 0;
|
|
|
+
|
|
|
+ Vendor = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString()
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "INFO\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "Install : " + Install + "\r\n" +
|
|
|
+ "\r\n" +
|
|
|
+ "FwVer_Year : " + FwVer_Year + "\r\n" +
|
|
|
+ "FwVer_Month : " + FwVer_Month + "\r\n" +
|
|
|
+ "FwVer_Day : " + FwVer_Day + "\r\n" +
|
|
|
+ "FwVer_Number : " + FwVer_Number + "\r\n" +
|
|
|
+ "ProtocolVer_Main : " + ProtocolVer_Main + "\r\n" +
|
|
|
+ "ProtocolVer_Sub : " + ProtocolVer_Sub + "\r\n" +
|
|
|
+ "Vendor : " + Vendor + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /** 재실센서 상태 */
|
|
|
+ public static class STATUS
|
|
|
+ {
|
|
|
+ /** 동작 모드(0:감지동작 꺼짐 / 1:감지동작 켜짐) */
|
|
|
+ public byte ActMode;
|
|
|
+
|
|
|
+ /** 제실센서 상태(0:미감지 / 1:감지) */
|
|
|
+ public byte DetectStatus;
|
|
|
+
|
|
|
+ /** 제실센서 미감지인 경우, 10초 카운트 시작 flag*/
|
|
|
+ public boolean NonDetectOffStart;
|
|
|
+
|
|
|
+ /** 센서 감도(1~15단계) */
|
|
|
+ public byte SensingValue;
|
|
|
+
|
|
|
+ /** 유지시간(1~7단계) */
|
|
|
+ public byte KeepingTime;
|
|
|
+
|
|
|
+ /** 누적 감지 카운트(상위) */
|
|
|
+ public byte DetectCount_Upper;
|
|
|
+
|
|
|
+ /** 누적 감지 카운트(하위) */
|
|
|
+ public byte DetectCount_Down;
|
|
|
+
|
|
|
+ /** 누적 감지 카운트 합계 변수 */
|
|
|
+ public int DetectCountSum;
|
|
|
+
|
|
|
+ /** 적용 시나리오 모드(기본/야간주방/사용자설정/주방안전) */
|
|
|
+ public byte Scenario_Mode;
|
|
|
+
|
|
|
+ public STATUS()
|
|
|
+ {
|
|
|
+ ActMode = ACTIONMODE.OFF;
|
|
|
+ DetectStatus = DETECTSTATUS.DETECT_OFF;
|
|
|
+ NonDetectOffStart = false;
|
|
|
+
|
|
|
+ SensingValue = 0;
|
|
|
+ KeepingTime = 0;
|
|
|
+
|
|
|
+ DetectCount_Upper = 0;
|
|
|
+ DetectCount_Down = 0;
|
|
|
+ DetectCountSum = 0;
|
|
|
+
|
|
|
+ Scenario_Mode = SCENARIO_MODE.UNKOWN;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString()
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "STATUS\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "ActMode : " + ACTIONMODE.ToDebugString(ActMode) + "\r\n" +
|
|
|
+ "DetectStatus : " + DETECTSTATUS.ToDebugString(DetectStatus) + "\r\n" +
|
|
|
+ "NonDetectOffStart : " + NonDetectOffStart + "\r\n" +
|
|
|
+ "\r\n" +
|
|
|
+ "SensingValue : " + SensingValue + "\r\n" +
|
|
|
+ "KeepingTime : " + KeepingTime + " Sec" + "\r\n" +
|
|
|
+ "DetectCount_Upper : " + DetectCount_Upper + "(" + String.format("%02X ", DetectCount_Upper) + ")" + "\r\n" +
|
|
|
+ "DetectCount_Down : " + DetectCount_Down + "(" + String.format("%02X ", DetectCount_Down) + ")" + "\r\n" +
|
|
|
+ "DetectCountSum : " + DetectCountSum + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 동작모드 정의 */
|
|
|
+ public static class ACTIONMODE
|
|
|
+ {
|
|
|
+ /** 센서 동작 꺼짐 */
|
|
|
+ public static byte OFF = 0x00;
|
|
|
+
|
|
|
+ /** 센서 동작 켜짐 */
|
|
|
+ public static byte ON = 0x01;
|
|
|
+
|
|
|
+ /** 주소 확인 모드 */
|
|
|
+ public static byte ADDRESS_CHECK = 0x02;
|
|
|
+
|
|
|
+ /** 테스트 모드 */
|
|
|
+ public static byte TEST_MODE = 0x03;
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param nStatus - (byte) 체크할 상태
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckRange(byte nStatus)
|
|
|
+ {
|
|
|
+ if(nStatus == ACTIONMODE.OFF) return true;
|
|
|
+ else if(nStatus == ACTIONMODE.ON) return true;
|
|
|
+ else if(nStatus == ACTIONMODE.ADDRESS_CHECK) return true;
|
|
|
+ else if(nStatus == ACTIONMODE.TEST_MODE) return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String ToDebugString(byte nStatus)
|
|
|
+ {
|
|
|
+ String retStr;
|
|
|
+ if(nStatus == ACTIONMODE.OFF) retStr = "OFF";
|
|
|
+ else if(nStatus == ACTIONMODE.ON) retStr = "ON";
|
|
|
+ else if(nStatus == ACTIONMODE.ADDRESS_CHECK) retStr = "ADDRESS_CHECK";
|
|
|
+ else if(nStatus == ACTIONMODE.TEST_MODE) retStr = "TEST_MODE";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 감지상태 정의 */
|
|
|
+ public static class DETECTSTATUS
|
|
|
+ {
|
|
|
+ /** 감지 안됨 */
|
|
|
+ public static byte DETECT_OFF = 0x00;
|
|
|
+
|
|
|
+ /** 감지 됨 */
|
|
|
+ public static byte DETECT_ON = 0x01;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param nStatus - (byte) 체크할 상태
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckRange(byte nStatus)
|
|
|
+ {
|
|
|
+ if(nStatus == DETECTSTATUS.DETECT_OFF) return true;
|
|
|
+ else if(nStatus == DETECTSTATUS.DETECT_ON) return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String ToDebugString(byte nStatus)
|
|
|
+ {
|
|
|
+ String retStr;
|
|
|
+ if(nStatus == DETECTSTATUS.DETECT_OFF) retStr = "OFF";
|
|
|
+ else if(nStatus == DETECTSTATUS.DETECT_ON) retStr = "ON";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 동작모드 정의 */
|
|
|
+ public static class SCENARIO_MODE
|
|
|
+ {
|
|
|
+ /** 미정의 모드 */
|
|
|
+ public static byte UNKOWN = (byte)0x00;
|
|
|
+
|
|
|
+ /** 기본 모드 */
|
|
|
+ public static byte BASIC = define.BIT0;
|
|
|
+
|
|
|
+ /** 야간 주방 */
|
|
|
+ public static byte NIGHT_KITCHEN = define.BIT1;
|
|
|
+
|
|
|
+ /** 사용자 설정 */
|
|
|
+ public static byte USER_CUSTOM = define.BIT2;
|
|
|
+
|
|
|
+ /** 주방 안전 */
|
|
|
+ public static byte KITCHEN_SAFE = define.BIT3;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param nStatus - (byte) 체크할 상태
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckRange(byte nStatus)
|
|
|
+ {
|
|
|
+ if(nStatus == SCENARIO_MODE.BASIC) return true;
|
|
|
+ else if(nStatus == SCENARIO_MODE.NIGHT_KITCHEN) return true;
|
|
|
+ else if(nStatus == SCENARIO_MODE.USER_CUSTOM) return true;
|
|
|
+ else if(nStatus == SCENARIO_MODE.KITCHEN_SAFE) return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String ToDebugString(byte nStatus)
|
|
|
+ {
|
|
|
+ String retStr;
|
|
|
+
|
|
|
+ if(nStatus == SCENARIO_MODE.BASIC) retStr = "BASIC";
|
|
|
+ else if(nStatus == SCENARIO_MODE.NIGHT_KITCHEN) retStr = "NIGHT_KITCHEN";
|
|
|
+ else if(nStatus == SCENARIO_MODE.USER_CUSTOM) retStr = "USER_CUSTOM";
|
|
|
+ else if(nStatus == SCENARIO_MODE.KITCHEN_SAFE) retStr = "KITCHEN_SAFE";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /** [지문인식 도어락] 데이터 클래스 */
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static class FP_DoorLock
|
|
|
+ {
|
|
|
+ public Info info;
|
|
|
+ public Device device;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 생성자<br>
|
|
|
+ */
|
|
|
+ public FP_DoorLock()
|
|
|
+ {
|
|
|
+ info = new Info();
|
|
|
+ device = new Device();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /** 지문인식 도어락 기본정보 */
|
|
|
+ public static class Info
|
|
|
+ {
|
|
|
+ /** 설치상태 (true:설치 , false:미설치) */
|
|
|
+ public boolean Install;
|
|
|
+
|
|
|
+ /** 터치상태 (true: 지원함 , false: 지원안함) */
|
|
|
+ public boolean Touch_Recog;
|
|
|
+
|
|
|
+ /** 문열림 대기모드 (true: 지원함 , false: 지원안함) */
|
|
|
+ public boolean OpenStandByMode;
|
|
|
+
|
|
|
+ /** 지문인식 (true: 지원함 , false: 지원안함) */
|
|
|
+ public boolean Fingerprint_Recog;
|
|
|
+
|
|
|
+ /** 출입ID 구분 (true: 지원함 , false: 지원안함) */
|
|
|
+ public boolean EnterId_Classify;
|
|
|
+
|
|
|
+ /** 방범기능 (true: 지원함 , false: 지원안함) */
|
|
|
+ public boolean Security_Run;
|
|
|
+
|
|
|
+ /** 지원 프로토콜 버전 Main */
|
|
|
+ public byte ProtocolVer_Main;
|
|
|
+
|
|
|
+ /** 지원 프로토콜 버전 Sub */
|
|
|
+ public byte ProtocolVer_Sub;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 생성자<br>
|
|
|
+ */
|
|
|
+ public Info()
|
|
|
+ {
|
|
|
+ Install = false;
|
|
|
+ Touch_Recog = false;
|
|
|
+ OpenStandByMode = false;
|
|
|
+ Fingerprint_Recog = false;
|
|
|
+ EnterId_Classify = false;
|
|
|
+ Security_Run = false;
|
|
|
+
|
|
|
+ ProtocolVer_Main = 0x00;
|
|
|
+ ProtocolVer_Sub = 0x00;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String ToDebugString()
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "Device - Info\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "Touch_Recog : " + Touch_Recog + "\r\n" +
|
|
|
+ "OpenStandByMode : " + OpenStandByMode + "\r\n" +
|
|
|
+ "Fingerprint_Recog : " + Fingerprint_Recog + "\r\n" +
|
|
|
+ "EnterId_Classify : " + EnterId_Classify + "\r\n" +
|
|
|
+ "Security_Run : " + Security_Run + "\r\n" +
|
|
|
+ "ProtocolVer : " + "V" + ProtocolVer_Main + "." + ProtocolVer_Sub + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 지문인식 도어락 상태 */
|
|
|
+ public static class Device
|
|
|
+ {
|
|
|
+ public STATUS status;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 생성자<br>
|
|
|
+ */
|
|
|
+ public Device()
|
|
|
+ {
|
|
|
+ status = new STATUS();
|
|
|
+ }
|
|
|
+
|
|
|
+ public static class STATUS
|
|
|
+ {
|
|
|
+ /** 문열림 상태 {@link DOORSTATUS} */
|
|
|
+ public byte doorstatus;
|
|
|
+
|
|
|
+ /** 터치상태 - 0x00:미지원, 0x01:미감지, 0x02:감지 */
|
|
|
+ public byte TouchStatus;
|
|
|
+
|
|
|
+ /** 문열림 대기모드 - 0x00:미지원, 0x01:해제, 0x02:설정 */
|
|
|
+ public byte OpenStandByMode;
|
|
|
+
|
|
|
+ /** 출입정보 - 0xEE:평상시, 0x10:ㅂㅣ ㅁㅣㄹ ㅂㅓㄴ ㅎㅗ 출입, 0x20:카드 출입, 0x30:지문 출입, 0x40:리모컨 출입,
|
|
|
+ * 0xF0:비밀번호/카드 5회 초과 입력오류, 0xF1:지문 10회 초과 입력오류 */
|
|
|
+ public byte EnterInfo;
|
|
|
+
|
|
|
+ /** 출입 ID - 1 ~ 255 */
|
|
|
+ public byte EnterID;
|
|
|
+
|
|
|
+ /** 외출상태 - 0x00:평상시, 0x41:외출설정, 0x42:외출해제 */
|
|
|
+ public byte Outing;
|
|
|
+
|
|
|
+ /** 경고/이상 - 0x00:정상, 0x41:침입감지, 0x42:센서이상, 0x43:배터리저전압, 0x44:장시간문열림, 0x45:강제잠금 */
|
|
|
+ public byte NotiNFault;
|
|
|
+
|
|
|
+ public STATUS()
|
|
|
+ {
|
|
|
+ doorstatus = DOORSTATUS.Close;
|
|
|
+ TouchStatus = TOUCHSTATUS.NotSupport;
|
|
|
+ OpenStandByMode = OPEN_STANDBY_MODE.NotSupport;
|
|
|
+ EnterInfo = ENTER_INFO.Normal;
|
|
|
+ EnterID = (byte)0x00;
|
|
|
+ Outing = (byte)0x00;
|
|
|
+ NotiNFault = (byte)0x00;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String ToDebugString()
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "Device - Status\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "doorstatus : " + DOORSTATUS.ToDebugString(doorstatus) + "\r\n" +
|
|
|
+ "TouchStatus : " + TOUCHSTATUS.ToDebugString(TouchStatus) + "\r\n" +
|
|
|
+ "OpenStandByMode : " + OPEN_STANDBY_MODE.ToDebugString(OpenStandByMode) + "\r\n" +
|
|
|
+ "EnterInfo : " + ENTER_INFO.ToDebugString(EnterInfo) + "\r\n" +
|
|
|
+ "EnterID : " + EnterID + "\r\n" +
|
|
|
+ "Outing : " + OUTING_STATUS.ToDebugString(Outing) + "\r\n" +
|
|
|
+ "NotiNFault : " + NOTI_FAULT.ToDebugString(NotiNFault) + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 도어락 문열림 상태 정의 */
|
|
|
+ public static class DOORSTATUS
|
|
|
+ {
|
|
|
+ /** 닫힘 */
|
|
|
+ public static byte Close = (byte)0x00;
|
|
|
+ /** 열림 */
|
|
|
+ public static byte Open = (byte)0x01;
|
|
|
+ /** 동작중 */
|
|
|
+ public static byte Operation = (byte)0x02;
|
|
|
+ /** 열림 - 강제잠금되어있음 */
|
|
|
+ public static byte Open_LockingForce = (byte)0x03;
|
|
|
+ /** 닫힘 - 강제잠금되어있음 */
|
|
|
+ public static byte Close_LockingForce = (byte)0x04;
|
|
|
+ /** 닫힘 이상 - 데드볼트 끝까지 안나옴(덜닫힘) */
|
|
|
+ public static byte Close_Fault = (byte)0x05;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param nStatus - (byte) 체크할 상태
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckRange(byte nStatus)
|
|
|
+ {
|
|
|
+ if(nStatus == DOORSTATUS.Close) return true;
|
|
|
+ else if(nStatus == DOORSTATUS.Open) return true;
|
|
|
+ else if(nStatus == DOORSTATUS.Operation) return true;
|
|
|
+ else if(nStatus == DOORSTATUS.Open_LockingForce) return true;
|
|
|
+ else if(nStatus == DOORSTATUS.Close_LockingForce) return true;
|
|
|
+ else if(nStatus == DOORSTATUS.Close_Fault) return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String ToDebugString(byte nStatus)
|
|
|
+ {
|
|
|
+ String retStr;
|
|
|
+ if(nStatus == DOORSTATUS.Close) retStr = "Close";
|
|
|
+ else if(nStatus == DOORSTATUS.Open) retStr = "Open";
|
|
|
+ else if(nStatus == DOORSTATUS.Operation) retStr = "Operation";
|
|
|
+ else if(nStatus == DOORSTATUS.Open_LockingForce) retStr = "Open_LockingForce";
|
|
|
+ else if(nStatus == DOORSTATUS.Close_LockingForce) retStr = "Close_LockingForce";
|
|
|
+ else if(nStatus == DOORSTATUS.Close_Fault) retStr = "Close_Fault";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /** 도어락 터치 상태 정의 */
|
|
|
+ public static class TOUCHSTATUS
|
|
|
+ {
|
|
|
+ /** 미지원 */
|
|
|
+ public static byte NotSupport = (byte)0x00;
|
|
|
+ /** */
|
|
|
+ public static byte Touch_Off = (byte)0x01;
|
|
|
+ /** 동작중 */
|
|
|
+ public static byte Touch_On = (byte)0x02;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param nStatus - (byte) 체크할 상태
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckRange(byte nStatus)
|
|
|
+ {
|
|
|
+ if(nStatus == TOUCHSTATUS.NotSupport) return true;
|
|
|
+ else if(nStatus == TOUCHSTATUS.Touch_Off) return true;
|
|
|
+ else if(nStatus == TOUCHSTATUS.Touch_On) return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String ToDebugString(byte nStatus)
|
|
|
+ {
|
|
|
+ String retStr;
|
|
|
+ if(nStatus == TOUCHSTATUS.NotSupport) retStr = "NotSupport";
|
|
|
+ else if(nStatus == TOUCHSTATUS.Touch_Off) retStr = "Touch_Off";
|
|
|
+ else if(nStatus == TOUCHSTATUS.Touch_On) retStr = "Touch_On";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /** 문열림대기모드 상태 정의 */
|
|
|
+ public static class OPEN_STANDBY_MODE
|
|
|
+ {
|
|
|
+ /** 미지원 */
|
|
|
+ public static byte NotSupport = (byte)0x00;
|
|
|
+ /** 해제 상태 */
|
|
|
+ public static byte Standby_Off = (byte)0x01;
|
|
|
+ /** 설정 상태 */
|
|
|
+ public static byte Standby_On = (byte)0x02;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param nStatus - (byte) 체크할 상태
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckRange(byte nStatus)
|
|
|
+ {
|
|
|
+ if(nStatus == OPEN_STANDBY_MODE.NotSupport) return true;
|
|
|
+ else if(nStatus == OPEN_STANDBY_MODE.Standby_Off) return true;
|
|
|
+ else if(nStatus == OPEN_STANDBY_MODE.Standby_On) return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String ToDebugString(byte nStatus)
|
|
|
+ {
|
|
|
+ String retStr;
|
|
|
+ if(nStatus == OPEN_STANDBY_MODE.NotSupport) retStr = "NotSupport";
|
|
|
+ else if(nStatus == OPEN_STANDBY_MODE.Standby_Off) retStr = "Standby_Off";
|
|
|
+ else if(nStatus == OPEN_STANDBY_MODE.Standby_On) retStr = "Standby_On";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 출입정보 상태 정의 */
|
|
|
+ public static class ENTER_INFO
|
|
|
+ {
|
|
|
+ /** 평상시 */
|
|
|
+ public static byte Normal = (byte)0xEE;
|
|
|
+ /** 비밀번호 출입 */
|
|
|
+ public static byte Enter_Password = (byte)0x10;
|
|
|
+ /** 카드 출입 */
|
|
|
+ public static byte Enter_Card = (byte)0x20;
|
|
|
+ /** 지문 출입 */
|
|
|
+ public static byte Enter_FingerPrint = (byte)0x30;
|
|
|
+ /** 리모컨 출입 */
|
|
|
+ public static byte Enter_Remocon = (byte)0x40;
|
|
|
+ /** 비밀번호/카드 5회 초과 입력오류 */
|
|
|
+ public static byte Error_PwdCard_Over5 = (byte)0xF0;
|
|
|
+ /** 지문 10회 초과 입력오류 */
|
|
|
+ public static byte Error_Fp_Over10 = (byte)0xF1;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param nStatus - (byte) 체크할 상태
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckRange(byte nStatus)
|
|
|
+ {
|
|
|
+ if(nStatus == ENTER_INFO.Normal) return true;
|
|
|
+ else if(nStatus == ENTER_INFO.Enter_Password) return true;
|
|
|
+ else if(nStatus == ENTER_INFO.Enter_Card) return true;
|
|
|
+ else if(nStatus == ENTER_INFO.Enter_FingerPrint) return true;
|
|
|
+ else if(nStatus == ENTER_INFO.Enter_Remocon) return true;
|
|
|
+ else if(nStatus == ENTER_INFO.Error_PwdCard_Over5) return true;
|
|
|
+ else if(nStatus == ENTER_INFO.Error_Fp_Over10) return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String ToDebugString(byte nStatus)
|
|
|
+ {
|
|
|
+ String retStr;
|
|
|
+ if(nStatus == ENTER_INFO.Normal) retStr = "Normal";
|
|
|
+ else if(nStatus == ENTER_INFO.Enter_Password) retStr = "Enter_Password";
|
|
|
+ else if(nStatus == ENTER_INFO.Enter_Card) retStr = "Enter_Card";
|
|
|
+ else if(nStatus == ENTER_INFO.Enter_FingerPrint) retStr = "Enter_FingerPrint";
|
|
|
+ else if(nStatus == ENTER_INFO.Enter_Remocon) retStr = "Enter_Remocon";
|
|
|
+ else if(nStatus == ENTER_INFO.Error_PwdCard_Over5) retStr = "Error_PwdCard_Over5";
|
|
|
+ else if(nStatus == ENTER_INFO.Error_Fp_Over10) retStr = "Error_Fp_Over10";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /** 방범기능 상태 정의 */
|
|
|
+ public static class OUTING_STATUS
|
|
|
+ {
|
|
|
+ /** 외출설정 상태 */
|
|
|
+ public static byte Outing_On = (byte)0x41;
|
|
|
+ /** 외출해제 상태 */
|
|
|
+ public static byte Outing_Off = (byte)0x42;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param nStatus - (byte) 체크할 상태
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckRange(byte nStatus)
|
|
|
+ {
|
|
|
+ if(nStatus == OUTING_STATUS.Outing_On) return true;
|
|
|
+ else if(nStatus == OUTING_STATUS.Outing_Off) return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String ToDebugString(byte nStatus)
|
|
|
+ {
|
|
|
+ String retStr;
|
|
|
+ if(nStatus == OUTING_STATUS.Outing_On) retStr = "Outing_On";
|
|
|
+ else if(nStatus == OUTING_STATUS.Outing_Off) retStr = "Outing_Off";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 알림/경고/이상 상태 정의 */
|
|
|
+ public static class NOTI_FAULT
|
|
|
+ {
|
|
|
+ /** 침입감지 상태 */
|
|
|
+ public static byte Invasion_Detect = (byte)0x41;
|
|
|
+ /** 센서이상 상태 */
|
|
|
+ public static byte Sensor_Fault = (byte)0x42;
|
|
|
+ /** 배터리 저전압 상태 */
|
|
|
+ public static byte Battery_Low = (byte)0x43;
|
|
|
+ /** 장시간 문열림 상태 */
|
|
|
+ public static byte LongTime_Open = (byte)0x44;
|
|
|
+ /** 강제잠금 상태 */
|
|
|
+ public static byte ForceLock = (byte)0x45;
|
|
|
+ /** 화재경고 상태 */
|
|
|
+ public static byte FireWarning = (byte)0x46;
|
|
|
+
|
|
|
+ /** 비밀번호 삭제 */
|
|
|
+ public static byte PWD_Delete = (byte)0xA0;
|
|
|
+ /** 비밀번호 등록 */
|
|
|
+ public static byte PWD_Reg = (byte)0xA1;
|
|
|
+
|
|
|
+ /** 카드 삭제 */
|
|
|
+ public static byte CARD_Delete = (byte)0xB0;
|
|
|
+ /** 카드 등록 */
|
|
|
+ public static byte CARD_Reg = (byte)0xB1;
|
|
|
+
|
|
|
+ /** 지문 삭제 */
|
|
|
+ public static byte FingerPrint_Delete = (byte)0xC0;
|
|
|
+ /** 지문 등록 */
|
|
|
+ public static byte FingerPrint_Reg = (byte)0xC1;
|
|
|
+
|
|
|
+ /** 리모컨 삭제 */
|
|
|
+ public static byte REMOCON_Delete = (byte)0xD0;
|
|
|
+ /** 리모컨 등록 */
|
|
|
+ public static byte REMOCON_Reg = (byte)0xD1;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param nStatus - (byte) 체크할 상태
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckRange(byte nStatus)
|
|
|
+ {
|
|
|
+ if(nStatus == NOTI_FAULT.Invasion_Detect) return true;
|
|
|
+ else if(nStatus == NOTI_FAULT.Sensor_Fault) return true;
|
|
|
+ else if(nStatus == NOTI_FAULT.Battery_Low) return true;
|
|
|
+ else if(nStatus == NOTI_FAULT.LongTime_Open) return true;
|
|
|
+ else if(nStatus == NOTI_FAULT.ForceLock) return true;
|
|
|
+ else if(nStatus == NOTI_FAULT.FireWarning) return true;
|
|
|
+ else if(nStatus == NOTI_FAULT.PWD_Delete) return true;
|
|
|
+ else if(nStatus == NOTI_FAULT.PWD_Reg) return true;
|
|
|
+ else if(nStatus == NOTI_FAULT.CARD_Delete) return true;
|
|
|
+ else if(nStatus == NOTI_FAULT.CARD_Reg) return true;
|
|
|
+ else if(nStatus == NOTI_FAULT.FingerPrint_Delete) return true;
|
|
|
+ else if(nStatus == NOTI_FAULT.FingerPrint_Reg) return true;
|
|
|
+ else if(nStatus == NOTI_FAULT.REMOCON_Delete) return true;
|
|
|
+ else if(nStatus == NOTI_FAULT.REMOCON_Reg) return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String ToDebugString(byte nStatus)
|
|
|
+ {
|
|
|
+ String retStr;
|
|
|
+ if(nStatus == NOTI_FAULT.Invasion_Detect) retStr = "Invasion_Detect";
|
|
|
+ else if(nStatus == NOTI_FAULT.Sensor_Fault) retStr = "Sensor_Fault";
|
|
|
+ else if(nStatus == NOTI_FAULT.Battery_Low) retStr = "Battery_Low";
|
|
|
+ else if(nStatus == NOTI_FAULT.LongTime_Open) retStr = "LongTime_Open";
|
|
|
+ else if(nStatus == NOTI_FAULT.ForceLock) retStr = "ForceLock";
|
|
|
+ else if(nStatus == NOTI_FAULT.FireWarning) retStr = "FireWarning";
|
|
|
+ else if(nStatus == NOTI_FAULT.PWD_Delete) retStr = "PWD_Delete";
|
|
|
+ else if(nStatus == NOTI_FAULT.PWD_Reg) retStr = "PWD_Reg";
|
|
|
+ else if(nStatus == NOTI_FAULT.CARD_Delete) retStr = "CARD_Delete";
|
|
|
+ else if(nStatus == NOTI_FAULT.CARD_Reg) retStr = "CARD_Reg";
|
|
|
+ else if(nStatus == NOTI_FAULT.FingerPrint_Delete) retStr = "FingerPrint_Delete";
|
|
|
+ else if(nStatus == NOTI_FAULT.FingerPrint_Reg) retStr = "FingerPrint_Reg";
|
|
|
+ else if(nStatus == NOTI_FAULT.REMOCON_Delete) retStr = "REMOCON_Delete";
|
|
|
+ else if(nStatus == NOTI_FAULT.REMOCON_Reg) retStr = "REMOCON_Reg";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /** [멀티스위치] 데이터 클래스 */
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static class MultiSwitch {
|
|
|
+ public Info info;
|
|
|
+ public Device device;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 생성자<br>
|
|
|
+ */
|
|
|
+ public MultiSwitch() {
|
|
|
+ info = new Info();
|
|
|
+ setBasicInfo((byte) 0x00, (byte) 0x00);
|
|
|
+ setAirconInfo((byte) 0x00, null);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 조명 콘센트 개수를 설정한다.
|
|
|
+ *
|
|
|
+ * @param hLightCnt - (byte) 설정할 조명 개수 (범위 : 0 ~ 8)
|
|
|
+ * @param hOutletCnt - (byte) 설정할 콘센트 개수 (범위 : 0 ~ 8)
|
|
|
+ */
|
|
|
+ public void setBasicInfo(byte hLightCnt, byte hOutletCnt) {
|
|
|
+ Log.i(TAG, "[setBasicInfo] hLightCnt [" + String.format("0x%02X", hLightCnt) + "], hOutletCnt [" + String.format("0x%02X", hOutletCnt) + "]");
|
|
|
+ if (info == null) {
|
|
|
+ Log.w(TAG, "[setBasicInfo] info is null!!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 1. Light
|
|
|
+ if (hLightCnt > 0) info.Support.hLightCnt = hLightCnt;
|
|
|
+ else info.Support.hLightCnt = 0;
|
|
|
+
|
|
|
+ // 2. Concent
|
|
|
+ if (hOutletCnt > 0) info.Support.hOutletCnt = hOutletCnt;
|
|
|
+ else info.Support.hOutletCnt = 0;
|
|
|
+
|
|
|
+ // 3. new device
|
|
|
+ device = new Device(info.Support.hLightCnt, info.Support.hOutletCnt);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 제어할 에어컨 정보를 설정한다.
|
|
|
+ *
|
|
|
+ * @param hCnt - (byte) 제어할 에어컨 개수
|
|
|
+ */
|
|
|
+ public void setAirconInfo(byte hCnt, byte[] ahAirconIDs) {
|
|
|
+ if (ahAirconIDs == null) {
|
|
|
+ Log.w(TAG, "[setAirconInfo] ahAirconIDs is null!!");
|
|
|
+ Log.i(TAG, "[setAirconInfo] hCnt [" + String.format("0x%02X", hCnt) + "]");
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ Log.w(TAG, "[setAirconInfo] ahAirconIDs is not null!!");
|
|
|
+ Log.i(TAG, "[setAirconInfo] hCnt [" + String.format("0x%02X", hCnt) + "], ahAirconIDs.length [" + ahAirconIDs.length + "]");
|
|
|
+
|
|
|
+ for (int i = 0; i < ahAirconIDs.length; i++) Log.i(TAG, "[ahAirconIDs] ahAirconIDs[" + i + "] = " + String.format("0x%02X", ahAirconIDs[i]));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (info == null) {
|
|
|
+ Log.w(TAG, "[setAirconInfo] info is null!!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (device == null) {
|
|
|
+ Log.w(TAG, "[setAirconInfo] device is null!!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 1. Aircon
|
|
|
+ if (hCnt > 0) {
|
|
|
+ info.Support.hAirconCtrlCnt = hCnt;
|
|
|
+ info.Support.hAirconCtrlID = new byte[hCnt];
|
|
|
+ for (int i = 0; i < info.Support.hAirconCtrlCnt; i++) {
|
|
|
+ info.Support.hAirconCtrlID[i] = ahAirconIDs[i];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ info.Support.hAirconCtrlCnt = 0;
|
|
|
+ info.Support.hAirconCtrlID = null;
|
|
|
+ }
|
|
|
+ device.airconData = new Device.AirconData(info.Support.hAirconCtrlCnt);
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 멀티스위치 보드정보 */
|
|
|
+ public static class Info {
|
|
|
+ /** 설치상태 (true:설치 , false:미설치) */
|
|
|
+ public boolean Install;
|
|
|
+
|
|
|
+ /** 제조사 코드 ( 0x01 : 제일전기, 0x02 = 다산지앤지, 0x03 = 클레오) */
|
|
|
+ public byte Vender;
|
|
|
+
|
|
|
+ /** 펌웨어 Build Date (년) */
|
|
|
+ public byte FwVer_Year;
|
|
|
+ /** 펌웨어 Build Date (월) */
|
|
|
+ public byte FwVer_Month;
|
|
|
+ /** 펌웨어 Build Date (일) */
|
|
|
+ public byte FwVer_Day;
|
|
|
+ /** 펌웨어 Build Date (일련번호) */
|
|
|
+ public byte FwVer_Number;
|
|
|
+
|
|
|
+ /** 지원 프로토콜 버전 Main */
|
|
|
+ public byte ProtocolVer_Main;
|
|
|
+ /** 지원 프로토콜 버전 Sub */
|
|
|
+ public byte ProtocolVer_Sub;
|
|
|
+
|
|
|
+ public Info() {
|
|
|
+ Support = new SupportInfo();
|
|
|
+
|
|
|
+ Install = false;
|
|
|
+
|
|
|
+ Vender = 0x00;
|
|
|
+
|
|
|
+ FwVer_Year = 0x00;
|
|
|
+ FwVer_Month = 0x00;
|
|
|
+ FwVer_Day = 0x00;
|
|
|
+ FwVer_Number = 0x00;
|
|
|
+
|
|
|
+ ProtocolVer_Main = 0x00;
|
|
|
+ ProtocolVer_Sub = 0x00;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String ToDebugString(byte DeviceIdx) {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "(" + (byte)(DeviceIdx + 1) + ") Device - Info\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "Vender : " + String.format("0x%02X", Vender) + "\r\n" +
|
|
|
+ "FwVer : " + (int)(FwVer_Year+2000) + "." + FwVer_Month + "." + FwVer_Day + "." + FwVer_Number + "\r\n" +
|
|
|
+ "ProtocolVer : " + "V" + ProtocolVer_Main + "." + ProtocolVer_Sub + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ public SupportInfo Support;
|
|
|
+
|
|
|
+ /** 기능 지원 여부 */
|
|
|
+ public class SupportInfo {
|
|
|
+ /** 설치된 조명 개수 (범위 : 0 ~ 8)*/
|
|
|
+ public byte hLightCnt;
|
|
|
+ /** 설치된 콘센트 개수 (범위 : 0 ~ 8)*/
|
|
|
+ public byte hOutletCnt;
|
|
|
+ /** V2 CMD 사용 여부 */
|
|
|
+ public boolean bV2CMDUsage;
|
|
|
+ /** 시간정보 연동 (월패드가 기기에 시간정보 제공) */
|
|
|
+ public boolean bTimeSync;
|
|
|
+ /** V2 CMD - 조명 디밍 지원 여부 (true:지원, false:미지원) */
|
|
|
+ public boolean bDim;
|
|
|
+ /** V2 CMD - 조명 디밍 지원 단계 (1(X'1') ~ 100(X'64')) */
|
|
|
+ public byte hDimLevel;
|
|
|
+ /** V2 CMD - 조명 디밍 지원 회로 (BIT0~BIT7, 0: 미지원, 1: 지원) */
|
|
|
+ public byte hDimEnabledCircuit;
|
|
|
+ /** V2 CMD - 에어컨 제어 지원 여부 (true:지원, false:미지원) */
|
|
|
+ public boolean bAirconCtrl;
|
|
|
+ /** V2 CMD - 에어컨 연동 대수 (범위 0~15, 0은 에어컨 연동 안함) */
|
|
|
+ public byte hAirconCtrlCnt;
|
|
|
+ /** V2 CMD - 에어컨 연동 ID (범위 1~15, 멀티스위치가 제어할 에어컨 실내기 ID 배열) */
|
|
|
+ public byte[] hAirconCtrlID;
|
|
|
+
|
|
|
+ public SupportInfo() {
|
|
|
+ hLightCnt = (byte) 0x00;
|
|
|
+ hOutletCnt = (byte) 0x00;
|
|
|
+ bV2CMDUsage = false;
|
|
|
+ bTimeSync = false;
|
|
|
+ bDim = false;
|
|
|
+ hDimLevel = (byte) 0x00;
|
|
|
+ hDimEnabledCircuit = (byte) 0x00;
|
|
|
+ bAirconCtrl = false;
|
|
|
+ hAirconCtrlCnt =(byte) 0x00;
|
|
|
+ hAirconCtrlID = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString(byte DeviceIdx) {
|
|
|
+ String strAirconIDs = "NONE";
|
|
|
+ if (hAirconCtrlCnt > 0 && hAirconCtrlID != null) {
|
|
|
+ strAirconIDs = "";
|
|
|
+ for (int i = 0; i < hAirconCtrlCnt; i++) {
|
|
|
+ if (i == 0) strAirconIDs += hAirconCtrlID[i];
|
|
|
+ else strAirconIDs += "/" + hAirconCtrlID[i];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "(" + (byte)(DeviceIdx + 1) + ") Device - SupportInfo\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "hLightCnt : " + Support.hLightCnt +"\r\n" +
|
|
|
+ "hOutletCnt : " + Support.hOutletCnt +"\r\n" +
|
|
|
+ "bV2CMDUsage : " + Support.bV2CMDUsage +"\r\n" +
|
|
|
+ "bTimeSync : " + Support.bTimeSync +"\r\n" +
|
|
|
+ "bDim : " + Support.bDim +"\r\n" +
|
|
|
+ "hDimLevel : " + Support.hDimLevel +"\r\n" +
|
|
|
+ "hDimEnabledCircuit : " + Support.hDimEnabledCircuit +"\r\n" +
|
|
|
+ "bAirconCtrl : " + Support.bAirconCtrl +"\r\n" +
|
|
|
+ "hAirconCtrlCnt : " + Support.hAirconCtrlCnt +"\r\n" +
|
|
|
+ "strAirconIDs : " + strAirconIDs +"\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 멀티스위치 기기 상태 */
|
|
|
+ public static class Device {
|
|
|
+ /** 멀티스위치 제어 요청 상태 */
|
|
|
+ public static class CtrlReq {
|
|
|
+ /** 에어컨 제어 */
|
|
|
+ public boolean bAircon; // true: 요청, false: 요청 없음
|
|
|
+ public byte[] hAirconCtrlID; // 에어컨 제어 ID
|
|
|
+ public byte hAirconCtrlOption; // 에어컨 제어 옵션
|
|
|
+ public byte hAirconStatus; // 에어컨 상태 정보
|
|
|
+ public byte hSetTemper; // 에어컨 설정온도 정보
|
|
|
+
|
|
|
+ public CtrlReq(byte hAirconCnt) {
|
|
|
+ bAircon = false; // true: 요청, false: 요청 없음
|
|
|
+ hAirconCtrlID = new byte[hAirconCnt]; // 에어컨 제어 ID
|
|
|
+ hAirconCtrlOption = (byte) 0x00; // 에어컨 제어 옵션
|
|
|
+ hAirconStatus = (byte) 0x00; // 에어컨 상태 정보
|
|
|
+ hSetTemper = (byte) 0x00; // 에어컨 설정온도 정보
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString(int index) {
|
|
|
+
|
|
|
+ String astrAirconID = "";
|
|
|
+ for (int i = 0; i < hAirconCtrlID.length; i++) {
|
|
|
+ if (i == 0) astrAirconID = String.format("0x%02X", hAirconCtrlOption);
|
|
|
+ else astrAirconID = "/" + String.format("0x%02X", hAirconCtrlOption);
|
|
|
+ }
|
|
|
+
|
|
|
+ String retStr = "[" + (int) (index+1) + "] ";
|
|
|
+ retStr += "bAircon:" + bAircon;
|
|
|
+ retStr += "hAirconCtrlID:" + astrAirconID;
|
|
|
+ retStr += "hAirconCtrlOption:" + String.format("0x%02X", hAirconCtrlOption) + " / ";
|
|
|
+ retStr += "hAirconStatus:" + String.format("0x%02X", hAirconStatus);
|
|
|
+ retStr += "hSetTemper:" + String.format("0x%02X", hSetTemper);
|
|
|
+
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public CtrlReq ctrlReq;
|
|
|
+
|
|
|
+ ////////////////////////////////////////////////////////////
|
|
|
+ // 조명
|
|
|
+ ////////////////////////////////////////////////////////////
|
|
|
+ /** 조명 개별 데이터 정의 */
|
|
|
+ public static class Light {
|
|
|
+ /** 조명 ON/OFF 상태 (Off: false, On: true) */
|
|
|
+ public boolean bPower;
|
|
|
+ /** 디밍 지원 여부 (미지원: false, 지원: true) */
|
|
|
+ public boolean bDimUsage;
|
|
|
+ /** 디밍 설정 단계 (1(X'1') ~ 100(X'64')), 디밍 지원 단계에 따라 범위가 결정된다. */
|
|
|
+ public byte hDimLevel;
|
|
|
+
|
|
|
+ public Light() {
|
|
|
+ bPower = false;
|
|
|
+ bDimUsage = false;
|
|
|
+ hDimLevel = (byte) 0x00; // 미사용시 0
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString(int index) {
|
|
|
+ String retStr = "[" + (int) (index+1) + "] ";
|
|
|
+
|
|
|
+ retStr += "bPower:" + bPower + " / ";
|
|
|
+ retStr += "bDimUsage:" + bDimUsage + " / ";
|
|
|
+ retStr += "hDimLevel:" + hDimLevel;
|
|
|
+
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 설치된 조명 개수 (범위 : 0 ~ 8)*/
|
|
|
+ public byte hLightCnt;
|
|
|
+
|
|
|
+ /** 조명 ON/OFF 상태 */
|
|
|
+ public Light[] light;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 조명 설정하기
|
|
|
+ *
|
|
|
+ * @param index - (byte) 설정할 조명 인덱스
|
|
|
+ * @param power - (byte) 설정할 조명 전원 상태
|
|
|
+ * @param dimusage - (byte) 설정할 디밍 사용 여부
|
|
|
+ * @param dimlevel - (double) 설정할 디밍 단계
|
|
|
+ *
|
|
|
+ * @return (boolean) 설정됨 여부 (true:정상, false:에러)
|
|
|
+ */
|
|
|
+ public boolean setLight(int index, boolean power, boolean dimusage, byte dimlevel) {
|
|
|
+ if (light == null) return false;
|
|
|
+ if (index > light.length) return false;
|
|
|
+ Light setLight = light[index];
|
|
|
+
|
|
|
+ setLight.bPower = power; // 조명 전원
|
|
|
+ setLight.bDimUsage = dimusage; // 디밍 사용 여부
|
|
|
+ setLight.hDimLevel = dimlevel; // 디밍 단계
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 조명 ON/OFF 가져오기
|
|
|
+ *
|
|
|
+ * @param index - (byte) 가져올 조명 인덱스
|
|
|
+ *
|
|
|
+ * @return (boolean) 조명 상태 (true:ON, false:OFF)
|
|
|
+ */
|
|
|
+ public boolean getLightPower(int index) {
|
|
|
+ if (light == null) return false;
|
|
|
+ if (index > light.length) return false;
|
|
|
+ return light[index].bPower;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 조명 디밍 단계 가져오기
|
|
|
+ *
|
|
|
+ * @param index - (byte) 가져올 조명 인덱스
|
|
|
+ *
|
|
|
+ * @return (boolean) 조명 상태 (true:ON, false:OFF)
|
|
|
+ */
|
|
|
+ public byte getLightDimLevel(int index) {
|
|
|
+ if (light == null) return (byte) 0x00;
|
|
|
+ if (index > light.length) return (byte) 0x00;
|
|
|
+ return light[index].hDimLevel;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 조명 디밍 지원 여부 가져오기
|
|
|
+ *
|
|
|
+ * @param index - (byte) 가져올 조명 인덱스
|
|
|
+ *
|
|
|
+ * @return (boolean) 조명 디밍 지원 여부 (true:지원, false:미지원)
|
|
|
+ */
|
|
|
+ public boolean getLightDimUsage(int index) {
|
|
|
+ if (light == null) return false;
|
|
|
+ if (index > light.length) return false;
|
|
|
+ return light[index].bDimUsage;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 조명 상태 정보 가져오기
|
|
|
+ *
|
|
|
+ * @param index - (byte) 가져올 조명 인덱스
|
|
|
+ *
|
|
|
+ * @return (Light) 조명 상태 정보
|
|
|
+ */
|
|
|
+ public Light getLightStatus(int index) {
|
|
|
+ if (light == null) return null;
|
|
|
+ if (index > light.length) return null;
|
|
|
+ return light[index];
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 조명 ON/OFF 설정하기
|
|
|
+ *
|
|
|
+ * @param index - (byte) 설정할 조명 인덱스
|
|
|
+ * @param onoff - (boolean) 설정할 ON/OFF 상태
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public boolean setLightPower(int index, boolean onoff) {
|
|
|
+ if (light == null) return false;
|
|
|
+ if (index > light.length) return false;
|
|
|
+ light[index].bPower = onoff;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 조명 디밍 설정하기
|
|
|
+ *
|
|
|
+ * @param index - (byte) 설정할 조명 인덱스
|
|
|
+ * @param dimlevel - (boolean) 설정할 디밍 단계ㅒ
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public boolean setLightDimLevel(int index, byte dimlevel) {
|
|
|
+ if (light == null) return false;
|
|
|
+ if (index > light.length) return false;
|
|
|
+ light[index].hDimLevel = dimlevel;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 조명 디밍 지원여부 설정하기
|
|
|
+ *
|
|
|
+ * @param index - (byte) 설정할 조명 인덱스
|
|
|
+ * @param usage - (boolean) 설정할 디밍 지원 여부
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public boolean setLightDimUsage(int index, boolean usage) {
|
|
|
+ if (light == null) return false;
|
|
|
+ if (index > light.length) return false;
|
|
|
+ light[index].bDimUsage = usage;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 일괄소등 상태 {@link BATCHOFF_STATUS}*/
|
|
|
+ public byte hBatchOffStatus;
|
|
|
+
|
|
|
+ ////////////////////////////////////////////////////////////
|
|
|
+ // 콘센트
|
|
|
+ ////////////////////////////////////////////////////////////
|
|
|
+ /** 콘센트 개별 데이터 정의 */
|
|
|
+ public static class Outlet {
|
|
|
+ /** 상태 {@link OUTLET_STATUS}*/
|
|
|
+ public byte Status;
|
|
|
+ /** 모드 {@link OUTLET_MODE}*/
|
|
|
+ public byte Mode;
|
|
|
+ /** 현재 소비전력 */
|
|
|
+ public double NowPw;
|
|
|
+ /** 대기전력 차단 기준값 */
|
|
|
+ public double CutOffVal;
|
|
|
+
|
|
|
+ public Outlet() {
|
|
|
+ Status = OUTLET_STATUS.Off;
|
|
|
+ Mode = OUTLET_MODE.Always;
|
|
|
+ NowPw = 0.0;
|
|
|
+ CutOffVal = 0.0;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString(int index) {
|
|
|
+ String retStr = "[" + (int) (index+1) + "] ";
|
|
|
+
|
|
|
+ retStr += "Status:" + OUTLET_STATUS.ToDebugString(Status) + " / ";
|
|
|
+ retStr += "Mode:" + OUTLET_MODE.ToDebugString(Mode) + " / ";
|
|
|
+ retStr += "NowPw:" + NowPw + " / ";
|
|
|
+ retStr += "CutOffVal:" + CutOffVal;
|
|
|
+
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 설치된 콘센트 개수 (범위 : 0 ~ 8)*/
|
|
|
+ public byte hOutletCnt;
|
|
|
+ /** 콘센트 */
|
|
|
+ private Outlet[] outlet;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 콘센트 가져오기
|
|
|
+ *
|
|
|
+ * @param index - (byte) 가져올 콘센트 인덱스
|
|
|
+ *
|
|
|
+ * @return (Concent) 콘센트 클래스 (null : fail)
|
|
|
+ */
|
|
|
+ public Outlet getOutletStatus(int index) {
|
|
|
+ if (outlet == null) return null;
|
|
|
+ if (index > outlet.length) return null;
|
|
|
+ return outlet[index];
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 콘센트 설정하기
|
|
|
+ *
|
|
|
+ * @param index - (byte) 설정할 콘센트 인덱스
|
|
|
+ * @param Status - (byte) 설정할 콘센트 상태
|
|
|
+ * @param Mode - (byte) 설정할 콘센트 모드
|
|
|
+ * @param NowPw - (double) 설정할 콘센트 소비전력
|
|
|
+ * @param CutOffVal - (double) 설정할 콘센트 차단기준값
|
|
|
+ *
|
|
|
+ * @return (boolean) 설정됨 여부 (true:정상, false:에러)
|
|
|
+ */
|
|
|
+ public boolean setOutlet(int index, byte Status, byte Mode, double NowPw, double CutOffVal) {
|
|
|
+ if (outlet == null) return false;
|
|
|
+ if (index > outlet.length) return false;
|
|
|
+ Outlet setOutlet = outlet[index];
|
|
|
+
|
|
|
+ setOutlet.Status = Status;
|
|
|
+ setOutlet.Mode = Mode;
|
|
|
+ setOutlet.NowPw = NowPw;
|
|
|
+ setOutlet.CutOffVal = CutOffVal;
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ ////////////////////////////////////////////////////////////
|
|
|
+ // 제어 - 시스템 에어컨
|
|
|
+ ////////////////////////////////////////////////////////////
|
|
|
+ public static class AirconData {
|
|
|
+ ////////////////////////////////////////////
|
|
|
+ // 기본기능
|
|
|
+ ////////////////////////////////////////////
|
|
|
+ /** 실내기 번호*/
|
|
|
+ public byte[] hInsideID;
|
|
|
+ /** onoff {@link SystemAircon.POWER} 값에 따름 */
|
|
|
+ public byte hPower;
|
|
|
+ /** 운전모드 {@link SystemAircon.MODE} 값에 따름 */
|
|
|
+ public byte hMode;
|
|
|
+ /** 풍량 {@link SystemAircon.AIRVOLUME} 값에 따름 */
|
|
|
+ public byte hAirVol;
|
|
|
+ /** 설정온도 (1도 단위) */
|
|
|
+ public byte hSetTemper;
|
|
|
+ /** 현재온도 */
|
|
|
+ public byte hCurrentTemper;
|
|
|
+ /** 풍향제어 상태 */
|
|
|
+ public boolean bAirSwing;
|
|
|
+ /** 지원하는 최저설정온도 (범위 : (냉방) 5도 ~ 20도) */
|
|
|
+ public byte hMinCoolSetTemper;
|
|
|
+ /** 지원하는 최대설정온도 (범위 : (냉방) 21도 ~ 40도) */
|
|
|
+ public byte hMaxCoolSetTemper;
|
|
|
+ /** 지원하는 최저설정온도 (범위 : (난방) 6도 ~ 30도) */
|
|
|
+ public byte hMinHeatSetTemper;
|
|
|
+ /** 지원하는 최고설정온도 (범위 : (난방) 6도 ~ 30도) */
|
|
|
+ public byte hMaxHeatSetTemper;
|
|
|
+ /** 모드지원 여부 (냉방) */
|
|
|
+ public boolean bSupportModeCooling;
|
|
|
+ /** 모드지원 여부 (송풍) */
|
|
|
+ public boolean bSupportModeFan;
|
|
|
+ /** 모드지원 여부 (난방) */
|
|
|
+ public boolean bSupportModeHeating;
|
|
|
+ /** 모드지원 여부 (제습) */
|
|
|
+ public boolean bSupportModeDehumidify;
|
|
|
+ /** 모드지원 여부 (자동) */
|
|
|
+ public boolean bSupportModeAuto;
|
|
|
+ /** 풍향제어 지원 여부 */
|
|
|
+ public boolean bSupportAirSwing;
|
|
|
+
|
|
|
+ public AirconData(int nCnt) {
|
|
|
+ hInsideID = new byte[nCnt];
|
|
|
+ for (int i = 0; i < nCnt; i++) hInsideID[i] = (byte) 0x00;
|
|
|
+ hPower = SystemAircon.POWER.NoInfo;
|
|
|
+ hMode = SystemAircon.MODE.NoInfo;
|
|
|
+ hAirVol = SystemAircon.AIRVOLUME.NoInfo;
|
|
|
+ hSetTemper = (byte) 0x00;
|
|
|
+ hCurrentTemper = (byte) 0x00;
|
|
|
+ bAirSwing = false;
|
|
|
+ hMinCoolSetTemper = (byte) 0x12; // 18도
|
|
|
+ hMaxCoolSetTemper = (byte) 0x1E; // 30도
|
|
|
+ hMinHeatSetTemper = (byte) 0x10; // 16도
|
|
|
+ hMaxHeatSetTemper = (byte) 0x2D; // 45도
|
|
|
+ bSupportModeCooling = false;
|
|
|
+ bSupportModeFan = false;
|
|
|
+ bSupportModeHeating = false;
|
|
|
+ bSupportModeDehumidify = false;
|
|
|
+ bSupportModeAuto = false;
|
|
|
+ bSupportAirSwing = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString(byte hDeviceIndex) {
|
|
|
+ byte hDeviceID = (byte) ((byte) 0x51 + (byte) hDeviceIndex);
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "hDeviceID : " + String.format("0x%02X", hDeviceID) + "\r\n" +
|
|
|
+ "hInsideID : " + makeAirconIDs() + "\r\n" +
|
|
|
+ "hPower : " + SystemAircon.POWER.ToDebugString(hPower) + "\r\n" +
|
|
|
+ "hMode : " + SystemAircon.MODE.ToDebugString(hMode) + "\r\n" +
|
|
|
+ "hAirVol : " + SystemAircon.AIRVOLUME.ToDebugString(hAirVol) + "\r\n" +
|
|
|
+ "hSetTemper : " + hSetTemper + "\r\n" +
|
|
|
+ "hCurrentTemper : " + hCurrentTemper + "\r\n" +
|
|
|
+ "bAirSwing : " + bAirSwing + "\r\n" +
|
|
|
+ "hMinCoolSetTemper : " + hMinCoolSetTemper +"\r\n" +
|
|
|
+ "hMaxCoolSetTemper : " + hMaxCoolSetTemper +"\r\n" +
|
|
|
+ "hMinHeatSetTemper : " + hMinHeatSetTemper +"\r\n" +
|
|
|
+ "hMaxHeatSetTemper : " + hMaxHeatSetTemper +"\r\n" +
|
|
|
+ "bSupportModeCooling : " + bSupportModeCooling +"\r\n" +
|
|
|
+ "bSupportModeFan : " + bSupportModeFan +"\r\n" +
|
|
|
+ "bSupportModeHeating : " + bSupportModeHeating +"\r\n" +
|
|
|
+ "bSupportModeDehumidify : " + bSupportModeDehumidify +"\r\n" +
|
|
|
+ "bSupportModeAuto : " + bSupportModeAuto +"\r\n" +
|
|
|
+ "bSupportAirSwing : " + bSupportAirSwing +"\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void setAirconStatus(AirconData airconData) {
|
|
|
+ if (airconData == null) return;
|
|
|
+ hPower = airconData.hPower;
|
|
|
+ hMode = airconData.hMode;
|
|
|
+ hAirVol = airconData.hAirVol;
|
|
|
+ hSetTemper = airconData.hSetTemper;
|
|
|
+ hCurrentTemper = airconData.hCurrentTemper;
|
|
|
+ bAirSwing = airconData.bAirSwing;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 시스템 에어컨 데이터 클래스 -> 멀티스위치의 에어컨 데이터 클래스
|
|
|
+ public void conversionAirconStatus(SystemAircon.AirconUnitData airconUnitData) {
|
|
|
+ if (airconUnitData == null) return;
|
|
|
+ hPower = airconUnitData.hPower;
|
|
|
+ hMode = airconUnitData.hMode;
|
|
|
+ hAirVol = airconUnitData.hAirVol;
|
|
|
+ hSetTemper = airconUnitData.hSetTemper;
|
|
|
+ hCurrentTemper = airconUnitData.hCurrentTemper;
|
|
|
+ bAirSwing = airconUnitData.bAirSwing;
|
|
|
+ }
|
|
|
+
|
|
|
+ private String makeAirconIDs() {
|
|
|
+ String strResult = null;
|
|
|
+ if (hInsideID == null) return strResult;
|
|
|
+
|
|
|
+ strResult = "Cnt [" + Integer.toString(hInsideID.length) + "]/ID: ";
|
|
|
+ for (int i = 0; i < hInsideID.length; i++) {
|
|
|
+ strResult += "[" + hInsideID[i] + "]";
|
|
|
+ }
|
|
|
+
|
|
|
+ return strResult;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public AirconData airconData;
|
|
|
+
|
|
|
+ public boolean setAirconStatus(byte power, byte mode, byte airvol, byte settemper, byte currenttemper, boolean airswing) {
|
|
|
+ airconData.hPower = power;
|
|
|
+ airconData.hMode = mode;
|
|
|
+ airconData.hAirVol = airvol;
|
|
|
+ airconData.hSetTemper = settemper;
|
|
|
+ airconData.hCurrentTemper = currenttemper;
|
|
|
+ airconData.bAirSwing = airswing;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 기기를 생성한다.
|
|
|
+ *
|
|
|
+ * @param lightCnt - (byte) 설정할 조명 개수 (범위 : 0 ~ 8)
|
|
|
+ * @param outletCnt - (byte) 설정할 콘센트 개수 (범위 : 0 ~ 8)
|
|
|
+ */
|
|
|
+ public Device(byte lightCnt, byte outletCnt) {
|
|
|
+ // 1. Light
|
|
|
+ if (lightCnt > 0) {
|
|
|
+ hLightCnt = lightCnt;
|
|
|
+ light = new Light [hLightCnt];
|
|
|
+ for (byte i = 0; i < hLightCnt; i++) light[i] = new Light();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ hLightCnt = 0;
|
|
|
+ light = null;
|
|
|
+ }
|
|
|
+ hBatchOffStatus = BATCHOFF_STATUS.Clr;
|
|
|
+
|
|
|
+ // 2. Concent
|
|
|
+ if (outletCnt > 0) {
|
|
|
+ hOutletCnt = outletCnt;
|
|
|
+ outlet = new Outlet[outletCnt];
|
|
|
+ for (byte i = 0; i < outletCnt; i++) outlet[i] = new Outlet();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ hOutletCnt = 0;
|
|
|
+ outlet = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString(byte DeviceIdx) {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "(" + (byte)(DeviceIdx + 1) + ") Device - Circuit\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+
|
|
|
+ "hLightCnt : " + hLightCnt + "\r\n";
|
|
|
+ if (light != null) {
|
|
|
+ retStr += "LightPower : ";
|
|
|
+ for (byte i = 0; i < hLightCnt; i++) {
|
|
|
+ retStr += "[" + (int)(i+1) + "]";
|
|
|
+ if (light[i].bPower) retStr += "O ";
|
|
|
+ else retStr += "X ";
|
|
|
+ retStr += " ";
|
|
|
+ }
|
|
|
+ retStr += "\r\n";
|
|
|
+
|
|
|
+ retStr += "LightDimLevel : ";
|
|
|
+ for (byte i = 0; i < hLightCnt; i++) {
|
|
|
+ retStr += "[" + (int)(i+1) + "]";
|
|
|
+ retStr += light[i].hDimLevel;
|
|
|
+ retStr += " ";
|
|
|
+ }
|
|
|
+ retStr += "\r\n";
|
|
|
+
|
|
|
+ retStr += "LightDimUsage : ";
|
|
|
+ for (byte i = 0; i < hLightCnt; i++) {
|
|
|
+ retStr += "[" + (int)(i+1) + "]";
|
|
|
+ if (light[i].bDimUsage) retStr += "O ";
|
|
|
+ else retStr += "X ";
|
|
|
+ retStr += " ";
|
|
|
+ }
|
|
|
+ retStr += "\r\n";
|
|
|
+ }
|
|
|
+ retStr += "\r\n";
|
|
|
+
|
|
|
+ retStr += "hOutletCnt : " + hOutletCnt + "\r\n";
|
|
|
+ if (outlet != null) {
|
|
|
+ for (byte i = 0; i < hOutletCnt; i++) {
|
|
|
+ retStr += outlet[i].ToDebugString(i) + "\r\n";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ retStr += "==========================";
|
|
|
+
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 일괄소등 상태 */
|
|
|
+ public static class BATCHOFF_STATUS {
|
|
|
+ /** 일괄소등 설정 상태 */
|
|
|
+ public static byte Set = 0x01;
|
|
|
+ /** 일괄소등 해제 상태 */
|
|
|
+ public static byte Clr = 0x02;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param nStatus - (byte) 체크할 상태
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean checkRange(byte nStatus) {
|
|
|
+ if (nStatus == BATCHOFF_STATUS.Set) return true;
|
|
|
+ else if (nStatus == BATCHOFF_STATUS.Clr) return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public static String ToDebugString(byte nStatus) {
|
|
|
+ String retStr;
|
|
|
+ if (nStatus == BATCHOFF_STATUS.Set) retStr = "Set";
|
|
|
+ else if (nStatus == BATCHOFF_STATUS.Clr) retStr = "Clr";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 콘센트 상태 */
|
|
|
+ public static class OUTLET_STATUS {
|
|
|
+ /** ON 상태 */
|
|
|
+ public static byte On = 0x01;
|
|
|
+ /** OFF 상태(노말) */
|
|
|
+ public static byte Off = 0x02;
|
|
|
+ /** OFF 상태(대기전력 자동으로 차단됨) */
|
|
|
+ public static byte CutOff = 0x03;
|
|
|
+ /** OFF 상태(과부하로 차단됨) */
|
|
|
+ public static byte OverLoadOff = 0x04;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param nStatus - (byte) 체크할 상태
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean checkRange(byte nStatus) {
|
|
|
+ if (nStatus == On) return true;
|
|
|
+ else if (nStatus == Off) return true;
|
|
|
+ else if (nStatus == CutOff) return true;
|
|
|
+ else if (nStatus == OverLoadOff) return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public static String ToDebugString(byte nStatus) {
|
|
|
+ String retStr;
|
|
|
+ if (nStatus == On) retStr = "On";
|
|
|
+ else if (nStatus == Off) retStr = "Off";
|
|
|
+ else if (nStatus == CutOff) retStr = "CutOff";
|
|
|
+ else if (nStatus == OverLoadOff) retStr = "OverLoadOff";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 콘센트 모드 */
|
|
|
+ public static class OUTLET_MODE {
|
|
|
+ /** 자동모드 (대기전력 감시를 사용함) */
|
|
|
+ public static byte Auto = 0x01;
|
|
|
+ /** 상시모드 (대기전력 감시를 사용하지않음) */
|
|
|
+ public static byte Always = 0x02;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param nStatus - (byte) 체크할 상태
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean checkRange(byte nStatus) {
|
|
|
+ if (nStatus == Auto) return true;
|
|
|
+ else if (nStatus == Always) return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public static String ToDebugString(byte nStatus) {
|
|
|
+ String retStr;
|
|
|
+ if (nStatus == Auto) retStr = "Auto";
|
|
|
+ else if (nStatus == Always) retStr = "Always";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /** [LED Dimming] 데이터 클래스 */
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static class LedController
|
|
|
+ {
|
|
|
+ public Info info;
|
|
|
+ public Device device;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 생성자<br>
|
|
|
+ */
|
|
|
+ public LedController()
|
|
|
+ {
|
|
|
+ info = new Info();
|
|
|
+ device = new Device();
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 보드정보 */
|
|
|
+ public static class Info
|
|
|
+ {
|
|
|
+ /** 설치상태 (true:설치 , false:미설치) */
|
|
|
+ public boolean Install;
|
|
|
+
|
|
|
+ /** 기기 지원정보 */
|
|
|
+ public SUPPORT Support;
|
|
|
+
|
|
|
+ /** 제조사 코드 ( 0x01 : 아이콘트롤스, 0x02 : 제일전기, 0x03 : 네스트필드 ) */
|
|
|
+ public byte Vender;
|
|
|
+
|
|
|
+ /** 펌웨어 Build Date (년) */
|
|
|
+ public byte FwVer_Year;
|
|
|
+ /** 펌웨어 Build Date (월) */
|
|
|
+ public byte FwVer_Month;
|
|
|
+ /** 펌웨어 Build Date (일) */
|
|
|
+ public byte FwVer_Day;
|
|
|
+ /** 펌웨어 Build Date (일련번호) */
|
|
|
+ public byte FwVer_Number;
|
|
|
+
|
|
|
+ /** 지원 프로토콜 버전 Main */
|
|
|
+ public byte ProtocolVer_Main;
|
|
|
+ /** 지원 프로토콜 버전 Sub */
|
|
|
+ public byte ProtocolVer_Sub;
|
|
|
+
|
|
|
+ public Info()
|
|
|
+ {
|
|
|
+ Install = false;
|
|
|
+
|
|
|
+ Support = new SUPPORT();
|
|
|
+
|
|
|
+ Vender = 0x00;
|
|
|
+
|
|
|
+ FwVer_Year = 0x00;
|
|
|
+ FwVer_Month = 0x00;
|
|
|
+ FwVer_Day = 0x00;
|
|
|
+ FwVer_Number = 0x00;
|
|
|
+
|
|
|
+ ProtocolVer_Main = 0x00;
|
|
|
+ ProtocolVer_Sub = 0x00;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String ToDebugString(byte DeviceIdx)
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "(" + (byte)(DeviceIdx + 1) + ") Device - Info\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "Install : " + Install + "\r\n" +
|
|
|
+ Support.ToDebugString() +
|
|
|
+ "Vender : " + String.format("0x%02X", Vender) + "\r\n" +
|
|
|
+ "FwVer : " + (int)(FwVer_Year+2000) + "." + FwVer_Month + "." + FwVer_Day + "." + FwVer_Number + "\r\n" +
|
|
|
+ "ProtocolVer : " + "V" + ProtocolVer_Main + "." + ProtocolVer_Sub + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 기기 지원 정보 */
|
|
|
+ public static class SUPPORT
|
|
|
+ {
|
|
|
+ /** ON/OFF **/
|
|
|
+ public boolean OnOff;
|
|
|
+
|
|
|
+ /** 디밍 제어 */
|
|
|
+ public boolean Level;
|
|
|
+
|
|
|
+ /** 색온도 제어 지원 */
|
|
|
+ public boolean Color;
|
|
|
+
|
|
|
+ /** 전압 측정 */
|
|
|
+ public boolean DC_Voltage;
|
|
|
+
|
|
|
+ /** 센서 사용여부 */
|
|
|
+ public boolean Sensor;
|
|
|
+
|
|
|
+ /** 센서 감도 설정 여부 */
|
|
|
+ public boolean Sensitivity;
|
|
|
+
|
|
|
+ /** 보드 온도 */
|
|
|
+ public boolean BoardDegree;
|
|
|
+
|
|
|
+ /** 전체 제어 명령어 사용 여부 (false: 0x21명령어 사용, true: 0x22명령어 사용)**/
|
|
|
+ public boolean AllControlType;
|
|
|
+
|
|
|
+ /** 센서 감지 횟수 **/
|
|
|
+ public boolean SensorDetectCount;
|
|
|
+
|
|
|
+ public SUPPORT()
|
|
|
+ {
|
|
|
+ OnOff = false;
|
|
|
+ Level = false;
|
|
|
+ Color = false;
|
|
|
+ DC_Voltage = false;
|
|
|
+ Sensor = false;
|
|
|
+ Sensitivity = false;
|
|
|
+ BoardDegree = false;
|
|
|
+ AllControlType = false;
|
|
|
+ SensorDetectCount = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String ToDebugString()
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "[SUPPORT]" + "\r\n" +
|
|
|
+ "OnOff : " + OnOff + "\r\n" +
|
|
|
+ "Level : " + Level + "\r\n" +
|
|
|
+ "Color : " + Color + "\r\n" +
|
|
|
+ "DC_Voltage : " + DC_Voltage + "\r\n" +
|
|
|
+ "Sensor : " + Sensor + "\r\n" +
|
|
|
+ "Sensitivity : " + Sensitivity + "\r\n" +
|
|
|
+ "BoardDegree : " + BoardDegree + "\r\n" +
|
|
|
+ "AllControlType : " + AllControlType + "\r\n" +
|
|
|
+ "SensorDetectCount : " + SensorDetectCount + "\r\n";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 기기 상태 */
|
|
|
+ public static class Device
|
|
|
+ {
|
|
|
+ /** ON/OFF 상태 */
|
|
|
+ public byte OnOff;
|
|
|
+
|
|
|
+ /** 디밍 레벨 상태 */
|
|
|
+ public byte Level;
|
|
|
+
|
|
|
+ /** 색온도 상태 */
|
|
|
+ public byte Color;
|
|
|
+
|
|
|
+ /** 전압 **/
|
|
|
+ public double DC_Voltage;
|
|
|
+
|
|
|
+ /** 센서 설정 여부 **/
|
|
|
+ public boolean Sensor;
|
|
|
+
|
|
|
+ /** 센서 감도 */
|
|
|
+ public byte Sensitivity;
|
|
|
+
|
|
|
+ /** 보드온도 **/
|
|
|
+ public double BoardDegree;
|
|
|
+
|
|
|
+ /** 센서 감지 횟수 **/
|
|
|
+ public int SensorDetectCount;
|
|
|
+
|
|
|
+ /** 기기를 생성한다. */
|
|
|
+ public Device()
|
|
|
+ {
|
|
|
+ OnOff = POWER.UnSet;
|
|
|
+ Level = LEVEL.UnSet;
|
|
|
+ Color = COLOR.UnSet;
|
|
|
+ DC_Voltage = 0.0;
|
|
|
+ Sensor = false;
|
|
|
+ Sensitivity = 0x00;
|
|
|
+ BoardDegree = 0.0;
|
|
|
+ SensorDetectCount = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString(byte DeviceIdx)
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "(" + (byte)(DeviceIdx + 1) + ") Device - Circuit\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+
|
|
|
+ "OnOff : " + OnOff + "\r\n" +
|
|
|
+ "Level : " + Level + "\r\n" +
|
|
|
+ "Color : " + Color + "\r\n" +
|
|
|
+ "DC_Voltage : " + DC_Voltage + "\r\n" +
|
|
|
+ "Sensor : " + Sensor + "\r\n" +
|
|
|
+ "Sensitivity : " + Sensitivity + "\r\n" +
|
|
|
+ "BoardDegree : " + BoardDegree + "\r\n" +
|
|
|
+ "SensorDetectCount : " + SensorDetectCount + "\r\n";
|
|
|
+ retStr += "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 전원 정의 */
|
|
|
+ public static class POWER
|
|
|
+ {
|
|
|
+ public static byte UnSet = (byte)0xFF;
|
|
|
+ public static byte On = (byte)0x01;
|
|
|
+ public static byte Off = (byte)0x02;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param nStatus - (byte) 체크할 상태
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckRange(byte nStatus)
|
|
|
+ {
|
|
|
+ if((nStatus >= UnSet) && (nStatus <= Off))
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public static String ToDebugString(byte Color)
|
|
|
+ {
|
|
|
+ String retStr;
|
|
|
+ if(Color == UnSet) retStr = "UnSet";
|
|
|
+ else if(Color == On) retStr = "On";
|
|
|
+ else if(Color == Off) retStr = "Off";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디밍 정의 */
|
|
|
+ public static class LEVEL
|
|
|
+ {
|
|
|
+ public static byte UnSet = (byte)0xFF;
|
|
|
+ public static byte Min = (byte)0x00;
|
|
|
+ public static byte Max = (byte)0x64;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param nStatus - (byte) 체크할 상태
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckRange(byte nStatus)
|
|
|
+ {
|
|
|
+ if((nStatus >= Min) && (nStatus <= Max))
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ else if(nStatus == UnSet)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 색상 정의 */
|
|
|
+ public static class COLOR
|
|
|
+ {
|
|
|
+ public static byte UnSet = (byte)0xFF;
|
|
|
+ public static byte Min = (byte)0x00;
|
|
|
+ public static byte Max = (byte)0x64;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param nStatus - (byte) 체크할 상태
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckRange(byte nStatus)
|
|
|
+ {
|
|
|
+ if((nStatus >= Min) && (nStatus <= Max))
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ else if(nStatus == UnSet)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /** [에너지미터V2] 데이터 클래스 */
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static class EnergyMeterV2
|
|
|
+ {
|
|
|
+ public Info info;
|
|
|
+ public Device device;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 생성자
|
|
|
+ * **/
|
|
|
+ public EnergyMeterV2()
|
|
|
+ {
|
|
|
+ info = new Info();
|
|
|
+ device = new Device();
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 조명 & 콘센트 정보 **/
|
|
|
+ public static class Device
|
|
|
+ {
|
|
|
+ public LedController ledController[];
|
|
|
+
|
|
|
+ public Device()
|
|
|
+ {
|
|
|
+ ledController = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 조명 콘센트 개수를 설정한다.
|
|
|
+ *
|
|
|
+ * @param nLightCount - (byte) 설정할 조명 개수 (범위 : 0 ~ 12)
|
|
|
+ * @return (boolean) 설정 성공 여부 - true:성공, false:범위이탈
|
|
|
+ */
|
|
|
+ public boolean SetLedCount(byte nLightCount)
|
|
|
+ {
|
|
|
+ if(nLightCount >= 0 && nLightCount <= 12)
|
|
|
+ {
|
|
|
+ ledController = new LedController[nLightCount];
|
|
|
+ for(int i = 0; i<nLightCount; i++)
|
|
|
+ {
|
|
|
+ ledController[i] = new LedController();
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 보드정보 */
|
|
|
+ public static class Info
|
|
|
+ {
|
|
|
+ /** 설치상태 (true:설치 , false:미설치) */
|
|
|
+ public boolean Install;
|
|
|
+
|
|
|
+ /** 기기 지원정보 */
|
|
|
+ public SUPPORT Support;
|
|
|
+
|
|
|
+ /** 펌웨어 Build Date (년) */
|
|
|
+ public byte FwVer_Year;
|
|
|
+ /** 펌웨어 Build Date (월) */
|
|
|
+ public byte FwVer_Month;
|
|
|
+ /** 펌웨어 Build Date (일) */
|
|
|
+ public byte FwVer_Day;
|
|
|
+ /** 펌웨어 Build Date (일련번호) */
|
|
|
+ public byte FwVer_Number;
|
|
|
+
|
|
|
+ /** 지원 프로토콜 버전 Main */
|
|
|
+ public byte ProtocolVer_Main;
|
|
|
+ /** 지원 프로토콜 버전 Sub */
|
|
|
+ public byte ProtocolVer_Sub;
|
|
|
+
|
|
|
+ /** 제조사 코드 ( 0x01 : 아이콘트롤스, 0x02 : 제일전기, 0x03 : 네스트필드 ) */
|
|
|
+ public byte Vender;
|
|
|
+
|
|
|
+ /** 조명 개수 **/
|
|
|
+ public byte LedCount;
|
|
|
+
|
|
|
+ /** 콘센트 개수 **/
|
|
|
+ public byte ConcentCount;
|
|
|
+
|
|
|
+ public Info()
|
|
|
+ {
|
|
|
+ Install = false;
|
|
|
+
|
|
|
+ Support = new SUPPORT();
|
|
|
+
|
|
|
+ FwVer_Year = 0x00;
|
|
|
+ FwVer_Month = 0x00;
|
|
|
+ FwVer_Day = 0x00;
|
|
|
+ FwVer_Number = 0x00;
|
|
|
+
|
|
|
+ ProtocolVer_Main = 0x00;
|
|
|
+ ProtocolVer_Sub = 0x00;
|
|
|
+
|
|
|
+ Vender = 0x00;
|
|
|
+
|
|
|
+ LedCount = 0x00;
|
|
|
+ ConcentCount = 0x00;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String ToDebugString(byte DeviceIdx)
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "(" + (byte)(DeviceIdx + 1) + ") Device - Info\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "Install : " + Install + "\r\n" +
|
|
|
+ Support.ToDebugString() +
|
|
|
+ "Vender : " + String.format("0x%02X", Vender) + "\r\n" +
|
|
|
+ "FwVer : " + (int)(FwVer_Year+2000) + "." + FwVer_Month + "." + FwVer_Day + "." + FwVer_Number + "\r\n" +
|
|
|
+ "ProtocolVer : " + "V" + ProtocolVer_Main + "." + ProtocolVer_Sub + "\r\n" +
|
|
|
+ "LedCount : " + LedCount + "\r\n" +
|
|
|
+ "ConcentCount : " + ConcentCount + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 기기 지원 정보 */
|
|
|
+ public static class SUPPORT
|
|
|
+ {
|
|
|
+ /** 시간 표시**/
|
|
|
+ public boolean TimeShow;
|
|
|
+
|
|
|
+ /** 조명 프로그램 스위치**/
|
|
|
+ public boolean ProgramSwitch;
|
|
|
+
|
|
|
+ /** 객실용 냉난방 제어**/
|
|
|
+ public boolean FCU_Control;
|
|
|
+
|
|
|
+ /** 에너지미터 구분( 0:거실, 1:주방, 2:안방, 3:침실 )**/
|
|
|
+ public int EM_Type;
|
|
|
+
|
|
|
+ public SUPPORT()
|
|
|
+ {
|
|
|
+ TimeShow = false;
|
|
|
+ ProgramSwitch = false;
|
|
|
+ FCU_Control = false;
|
|
|
+ EM_Type = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String ToDebugString()
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "[SUPPORT]" + "\r\n" +
|
|
|
+ "TimeShow : " + TimeShow + "\r\n" +
|
|
|
+ "ProgramSwitch : " + ProgramSwitch + "\r\n" +
|
|
|
+ "FCU_Control : " + FCU_Control + "\r\n" +
|
|
|
+ "EM_Type : " + EM_Type + "\r\n";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /** [LED Dimming] 데이터 클래스 */
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static class LedDimming
|
|
|
+ {
|
|
|
+ public Info info;
|
|
|
+ public Device device;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 생성자<br>
|
|
|
+ */
|
|
|
+ public LedDimming()
|
|
|
+ {
|
|
|
+ info = new Info();
|
|
|
+ device = new Device();
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 보드정보 */
|
|
|
+ public static class Info
|
|
|
+ {
|
|
|
+ /** 설치상태 (true:설치 , false:미설치) */
|
|
|
+ public boolean Install;
|
|
|
+
|
|
|
+ /** 기기 지원정보 */
|
|
|
+ public SUPPORT Support;
|
|
|
+
|
|
|
+ /** 제조사 코드 ( 0x01 : 아이콘트롤스, 0x02 : 제일전기, 0x03 : 네스트필드 ) */
|
|
|
+ public byte Vender;
|
|
|
+
|
|
|
+ /** 펌웨어 Build Date (년) */
|
|
|
+ public byte FwVer_Year;
|
|
|
+ /** 펌웨어 Build Date (월) */
|
|
|
+ public byte FwVer_Month;
|
|
|
+ /** 펌웨어 Build Date (일) */
|
|
|
+ public byte FwVer_Day;
|
|
|
+ /** 펌웨어 Build Date (일련번호) */
|
|
|
+ public byte FwVer_Number;
|
|
|
+
|
|
|
+ /** 지원 프로토콜 버전 Main */
|
|
|
+ public byte ProtocolVer_Main;
|
|
|
+ /** 지원 프로토콜 버전 Sub */
|
|
|
+ public byte ProtocolVer_Sub;
|
|
|
+
|
|
|
+ public Info()
|
|
|
+ {
|
|
|
+ Install = false;
|
|
|
+
|
|
|
+ Support = new SUPPORT();
|
|
|
+
|
|
|
+ Vender = 0x00;
|
|
|
+
|
|
|
+ FwVer_Year = 0x00;
|
|
|
+ FwVer_Month = 0x00;
|
|
|
+ FwVer_Day = 0x00;
|
|
|
+ FwVer_Number = 0x00;
|
|
|
+
|
|
|
+ ProtocolVer_Main = 0x00;
|
|
|
+ ProtocolVer_Sub = 0x00;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String ToDebugString(byte DeviceIdx)
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "(" + (byte)(DeviceIdx + 1) + ") Device - Info\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "Install : " + Install + "\r\n" +
|
|
|
+ Support.ToDebugString() +
|
|
|
+ "Vender : " + String.format("0x%02X", Vender) + "\r\n" +
|
|
|
+ "FwVer : " + (int)(FwVer_Year+2000) + "." + FwVer_Month + "." + FwVer_Day + "." + FwVer_Number + "\r\n" +
|
|
|
+ "ProtocolVer : " + "V" + ProtocolVer_Main + "." + ProtocolVer_Sub + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 기기 지원 정보 */
|
|
|
+ public static class SUPPORT
|
|
|
+ {
|
|
|
+ /** ON/OFF **/
|
|
|
+ public boolean OnOff;
|
|
|
+
|
|
|
+ /** 디밍 제어 */
|
|
|
+ public boolean Level;
|
|
|
+
|
|
|
+ /** 색온도 제어 지원 */
|
|
|
+ public boolean Color;
|
|
|
+
|
|
|
+ /** 전압 측정 */
|
|
|
+ public boolean DC_Voltage;
|
|
|
+
|
|
|
+ /** 센서 사용여부 */
|
|
|
+ public boolean Sensor;
|
|
|
+
|
|
|
+ /** 센서 감도 설정 여부 */
|
|
|
+ public boolean Sensitivity;
|
|
|
+
|
|
|
+ /** 보드 온도 */
|
|
|
+ public boolean BoardDegree;
|
|
|
+
|
|
|
+ /** 전체 제어 명령어 사용 여부 (false: 0x21명령어 사용, true: 0x22명령어 사용)**/
|
|
|
+ public boolean AllControlType;
|
|
|
+
|
|
|
+ public SUPPORT()
|
|
|
+ {
|
|
|
+ OnOff = false;
|
|
|
+ Level = false;
|
|
|
+ Color = false;
|
|
|
+ DC_Voltage = false;
|
|
|
+ Sensor = false;
|
|
|
+ Sensitivity = false;
|
|
|
+ BoardDegree = false;
|
|
|
+ AllControlType = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String ToDebugString()
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "[SUPPORT]" + "\r\n" +
|
|
|
+ "OnOff : " + OnOff + "\r\n" +
|
|
|
+ "Level : " + Level + "\r\n" +
|
|
|
+ "Color : " + Color + "\r\n" +
|
|
|
+ "DC_Voltage : " + DC_Voltage + "\r\n" +
|
|
|
+ "Sensor : " + Sensor + "\r\n" +
|
|
|
+ "Sensitivity : " + Sensitivity + "\r\n" +
|
|
|
+ "BoardDegree : " + BoardDegree + "\r\n" +
|
|
|
+ "AllControlType : " + AllControlType + "\r\n";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 기기 상태 */
|
|
|
+ public static class Device
|
|
|
+ {
|
|
|
+ /** ON/OFF 상태 */
|
|
|
+ public boolean OnOff;
|
|
|
+
|
|
|
+ /** 디밍 레벨 상태 */
|
|
|
+ public byte Level;
|
|
|
+
|
|
|
+ /** 색온도 상태 */
|
|
|
+ public byte Color;
|
|
|
+
|
|
|
+ /** 전압 **/
|
|
|
+ public double DC_Voltage;
|
|
|
+
|
|
|
+ /** 센서 설정 여부 **/
|
|
|
+ public boolean Sensor;
|
|
|
+
|
|
|
+ /** 센서 감도 */
|
|
|
+ public byte Sensitivity;
|
|
|
+
|
|
|
+ /** 보드온도 **/
|
|
|
+ public double BoardDegree;
|
|
|
+
|
|
|
+ /** 기기를 생성한다. */
|
|
|
+ public Device()
|
|
|
+ {
|
|
|
+ OnOff = false;
|
|
|
+ Level = 0x00;
|
|
|
+ Color = 0x00;
|
|
|
+ DC_Voltage = 0.0;
|
|
|
+ Sensor = false;
|
|
|
+ Sensitivity = 0x00;
|
|
|
+ BoardDegree = 0.0;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString(byte DeviceIdx)
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "(" + (byte)(DeviceIdx + 1) + ") Device - Circuit\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+
|
|
|
+ "OnOff : " + OnOff + "\r\n" +
|
|
|
+ "Level : " + Level + "\r\n" +
|
|
|
+ "Color : " + Color + "\r\n" +
|
|
|
+ "DC_Voltage : " + DC_Voltage + "\r\n" +
|
|
|
+ "Sensor : " + Sensor + "\r\n" +
|
|
|
+ "Sensitivity : " + Sensitivity + "\r\n" +
|
|
|
+ "BoardDegree : " + BoardDegree + "\r\n";
|
|
|
+ retStr += "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 전원 정의 */
|
|
|
+ public static class POWER
|
|
|
+ {
|
|
|
+ public static byte UnSet = (byte)0xFF;
|
|
|
+ public static byte On = (byte)0x01;
|
|
|
+ public static byte Off = (byte)0x02;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param nStatus - (byte) 체크할 상태
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckRange(byte nStatus)
|
|
|
+ {
|
|
|
+ if((nStatus >= UnSet) && (nStatus <= Off))
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public static String ToDebugString(byte Color)
|
|
|
+ {
|
|
|
+ String retStr;
|
|
|
+ if(Color == UnSet) retStr = "UnSet";
|
|
|
+ else if(Color == On) retStr = "On";
|
|
|
+ else if(Color == Off) retStr = "Off";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디밍 정의 */
|
|
|
+ public static class Level
|
|
|
+ {
|
|
|
+ public static byte UnSet = (byte)0xFF;
|
|
|
+ public static byte Min = (byte)0x00;
|
|
|
+ public static byte Max = (byte)0x64;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param nStatus - (byte) 체크할 상태
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckRange(byte nStatus)
|
|
|
+ {
|
|
|
+ if((nStatus >= Min) && (nStatus <= Max))
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ else if(nStatus == UnSet)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 색상 정의 */
|
|
|
+ public static class COLOR
|
|
|
+ {
|
|
|
+ public static byte UnSet = (byte)0xFF;
|
|
|
+ public static byte Min = (byte)0x00;
|
|
|
+ public static byte Max = (byte)0x64;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param nStatus - (byte) 체크할 상태
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckRange(byte nStatus)
|
|
|
+ {
|
|
|
+ if((nStatus >= Min) && (nStatus <= Max))
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ else if(nStatus == UnSet)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /** [System Aircon] 데이터 클래스 */
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static class SystemAircon {
|
|
|
+ /** 기기정보 */
|
|
|
+ public Info info;
|
|
|
+ public Setting setting;
|
|
|
+ /** 각 에어컨 데이터 */
|
|
|
+ public AirconUnitData[] Aircon;
|
|
|
+
|
|
|
+ public SystemAircon() {
|
|
|
+ info = new Info();
|
|
|
+ setting = new Setting();
|
|
|
+ Aircon = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 실내기 개수를 설정한다.<br>
|
|
|
+ *
|
|
|
+ * @param hCnt - (byte) 설정할 실내기개수 (범위: 1 ~ 9)
|
|
|
+ * @return (boolean) true : 성공 , false : 실패
|
|
|
+ */
|
|
|
+ public boolean setInsideAirConditionerCnt(byte hCnt) {
|
|
|
+ try {
|
|
|
+ Log.w("SystemAircon", "[setInsideAirConditionerCnt] hCnt [" + hCnt + "]");
|
|
|
+ if (info == null) {
|
|
|
+ Log.w("SystemAircon", "[setInsideAirConditionerCnt] info is null!!!");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if ((hCnt <= 0) || (hCnt > 15)) {
|
|
|
+ Log.w("SystemAircon", "[setInsideAirConditionerCnt] Out of range!! hCnt [" + hCnt + "]");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ info.hInsideAirconCnt = hCnt;
|
|
|
+ Aircon = new AirconUnitData[hCnt];
|
|
|
+ for (byte i = 0; i < hCnt; i++) {
|
|
|
+ Aircon[i] = new AirconUnitData();
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ } catch (RuntimeException re) {
|
|
|
+ LogUtil.errorLogInfo("", "", re);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ catch (Exception e) {
|
|
|
+ Log.e("SystemAircon", "[Exception] setInsideAirConditionerCnt(byte hCnt)");
|
|
|
+ LogUtil.errorLogInfo("", "", e);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 기기정보 */
|
|
|
+ public static class Info {
|
|
|
+ /** 실내기개수(범위 : 1~9) */
|
|
|
+ public byte hInsideAirconCnt;
|
|
|
+ /** 실외기개수(범위 : 1~4) */
|
|
|
+ public byte hOutsideAirconCnt;
|
|
|
+ /** 첫 실외기에 포함된 실내기개수(범위 : 1~15) */
|
|
|
+ public byte hFirtstOutAirconCnt;
|
|
|
+ /** 에어컨 연동 상태 */
|
|
|
+ public byte hAirconStatus;
|
|
|
+ /** 제조사 코드 ( 프로토콜 문서에 따름 ) */
|
|
|
+ public byte hVendor;
|
|
|
+ /** 펌웨어 Build Date (년) */
|
|
|
+ public byte hFwVer_Year;
|
|
|
+ /** 펌웨어 Build Date (월) */
|
|
|
+ public byte hFwVer_Month;
|
|
|
+ /** 펌웨어 Build Date (일) */
|
|
|
+ public byte hFwVer_Day;
|
|
|
+ /** 펌웨어 Build Date (일련번호) */
|
|
|
+ public byte hFwVer_No;
|
|
|
+
|
|
|
+ /** 지원 프로토콜 버전 Main */
|
|
|
+ public byte hProtocolVer_Main;
|
|
|
+ /** 지원 프로토콜 버전 Sub */
|
|
|
+ public byte hProtocolVer_Sub;
|
|
|
+
|
|
|
+ public Info() {
|
|
|
+ Support = new SupportInfo();
|
|
|
+ hInsideAirconCnt = (byte) 0x00;
|
|
|
+ hOutsideAirconCnt = (byte) 0x00;
|
|
|
+ hFirtstOutAirconCnt = (byte) 0x00;
|
|
|
+ hAirconStatus = Status.WAIT_OUTDOOR;
|
|
|
+ hVendor = (byte) 0x00;
|
|
|
+ hFwVer_Year = (byte) 0x00;
|
|
|
+ hFwVer_Month = (byte) 0x00;
|
|
|
+ hFwVer_Day = (byte) 0x00;
|
|
|
+ hFwVer_No = (byte) 0x00;
|
|
|
+ hProtocolVer_Main = (byte) 0x00;
|
|
|
+ hProtocolVer_Sub = (byte) 0x00;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString() {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "Info\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "hInsideAirconCnt : " + hInsideAirconCnt + "\r\n" +
|
|
|
+ "hOutsideAirconCnt : " + hOutsideAirconCnt + "\r\n" +
|
|
|
+ "hFirtstOutAirconCnt : " + hFirtstOutAirconCnt + "\r\n" +
|
|
|
+ "hAirconStatus : " + hAirconStatus + "\r\n" +
|
|
|
+ "hVendor : " + String.format("0x%02X", hVendor) + "\r\n" +
|
|
|
+ "hFwVer : " + (int)(hFwVer_Year+2000) + "." + hFwVer_Month + "." + hFwVer_Day + "." + hFwVer_No + "\r\n" +
|
|
|
+ "hProtocolVer : " + "V" + hProtocolVer_Main + "." + hProtocolVer_Sub + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ public SupportInfo Support;
|
|
|
+
|
|
|
+ /** 기능 지원 여부 */
|
|
|
+ public class SupportInfo {
|
|
|
+ /** 지원하는 최저설정온도 (범위 : (냉방) 5도 ~ 20도) */
|
|
|
+ public byte hMinCoolSetTemper;
|
|
|
+ /** 지원하는 최대설정온도 (범위 : (냉방) 21도 ~ 40도) */
|
|
|
+ public byte hMaxCoolSetTemper;
|
|
|
+ /** 지원하는 최저설정온도 (범위 : (난방) 6도 ~ 30도) */
|
|
|
+ public byte hMinHeatSetTemper;
|
|
|
+ /** 지원하는 최고설정온도 (범위 : (난방) 6도 ~ 30도) */
|
|
|
+ public byte hMaxHeatSetTemper;
|
|
|
+ /** V2 CMD 사용 여부 */
|
|
|
+ public boolean bV2CMDUsage;
|
|
|
+ /** 모드제어 */
|
|
|
+ public boolean bModeCtrl;
|
|
|
+ /** 풍량제어 */
|
|
|
+ public boolean bAirVolCtrl;
|
|
|
+ /** 잔열제거중 제어 가능 */
|
|
|
+ public boolean bCtrlOnResidualHeatRemoval;
|
|
|
+ /** 온도설정 범위 변경 */
|
|
|
+ public boolean bChangeTemperRange;
|
|
|
+ /** FCU 연동 여부 */
|
|
|
+ public boolean bFCUInterlock;
|
|
|
+ /** 모드지원 여부 (냉방) */
|
|
|
+ public boolean bModeCooling;
|
|
|
+ /** 모드지원 여부 (송풍) */
|
|
|
+ public boolean bModeFan;
|
|
|
+ /** 모드지원 여부 (난방) */
|
|
|
+ public boolean bModeHeating;
|
|
|
+ /** 모드지원 여부 (제습) */
|
|
|
+ public boolean bModeDehumidify;
|
|
|
+ /** 모드지원 여부 (자동) */
|
|
|
+ public boolean bModeAuto;
|
|
|
+ /** 풍향제어 지원 여부 */
|
|
|
+ public boolean bAirSwing;
|
|
|
+
|
|
|
+ public SupportInfo() {
|
|
|
+ hMinCoolSetTemper = (byte) 0x12; // 18도
|
|
|
+ hMaxCoolSetTemper = (byte) 0x1E; // 30도
|
|
|
+ hMinHeatSetTemper = (byte) 0x10; // 16도
|
|
|
+ hMaxHeatSetTemper = (byte) 0x2D; // 45도
|
|
|
+ bV2CMDUsage = false;
|
|
|
+ bModeCtrl = false;
|
|
|
+ bAirVolCtrl = false;
|
|
|
+ bCtrlOnResidualHeatRemoval = false;
|
|
|
+ bChangeTemperRange = false;
|
|
|
+ bFCUInterlock = false;
|
|
|
+ bModeCooling = false;
|
|
|
+ bModeFan = false;
|
|
|
+ bModeHeating = false;
|
|
|
+ bModeDehumidify = false;
|
|
|
+ bModeAuto = false;
|
|
|
+ bAirSwing = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString() {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "SupportInfo\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "hMinCoolSetTemper : " + Support.hMinCoolSetTemper +"\r\n" +
|
|
|
+ "hMaxCoolSetTemper : " + Support.hMaxCoolSetTemper +"\r\n" +
|
|
|
+ "hMinHeatSetTemper : " + Support.hMinHeatSetTemper +"\r\n" +
|
|
|
+ "hMaxHeatSetTemper : " + Support.hMaxHeatSetTemper +"\r\n" +
|
|
|
+ "bV2CMDUsage : " + Support.bV2CMDUsage +"\r\n" +
|
|
|
+ "bModeCtrl : " + Support.bModeCtrl +"\r\n" +
|
|
|
+ "bAirVolCtrl : " + Support.bAirVolCtrl +"\r\n" +
|
|
|
+ "bCtrlOnResidualHeatRemoval : " + Support.bCtrlOnResidualHeatRemoval +"\r\n" +
|
|
|
+ "bChangeTemperRange : " + Support.bChangeTemperRange +"\r\n" +
|
|
|
+ "bFCUInterlock : " + Support.bFCUInterlock +"\r\n" +
|
|
|
+ "bModeCooling : " + Support.bModeCooling +"\r\n" +
|
|
|
+ "bModeFan : " + Support.bModeFan +"\r\n" +
|
|
|
+ "bModeHeating : " + Support.bModeHeating +"\r\n" +
|
|
|
+ "bModeDehumidify : " + Support.bModeDehumidify +"\r\n" +
|
|
|
+ "nModeAuto : " + Support.bModeAuto +"\r\n" +
|
|
|
+ "bAirSwing : " + Support.bAirSwing +"\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 기기정보 설정*/
|
|
|
+ public static class Setting {
|
|
|
+ /** 설정 여부 ( 프로토콜 문서에 따름 ) */
|
|
|
+ public byte hSettingStatus;
|
|
|
+
|
|
|
+ /** 에어컨 연동 설정 */
|
|
|
+ public byte hAirconSetting;
|
|
|
+
|
|
|
+ /** 에어컨 제조사 설정 */
|
|
|
+ public byte hManufactureSetting;
|
|
|
+
|
|
|
+ /** 그룹 정보 */
|
|
|
+ public GroupInfo groupinfo;
|
|
|
+
|
|
|
+ public Setting() {
|
|
|
+ hSettingStatus = 0;
|
|
|
+ // 기본은 냉방전용 에어컨, 원래 값과 다른 경우 재설정을 해줘야 한다.
|
|
|
+ hAirconSetting = (byte) 0x01;
|
|
|
+ // 기본은 삼성, 원래 값과 다른 경우 재설정을 해줘야 한다.
|
|
|
+ hManufactureSetting = (byte) 0x01;
|
|
|
+ // 에어컨 그룹설정 정보 초기화
|
|
|
+ groupinfo = new GroupInfo();
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString() {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "Setting\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "hSettingStatus : " + String.format("0x%02X", hSettingStatus) + "\r\n" +
|
|
|
+ "hAirconSetting : " + String.format("0x%02X", hAirconSetting) + "\r\n" +
|
|
|
+ "hManufactureSetting : " + String.format("0x%02X", hManufactureSetting) + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 그룹정보 설정*/
|
|
|
+ public static class GroupInfo {
|
|
|
+ /** 각 에어컨 데이터 */
|
|
|
+
|
|
|
+ /** 그룹정보 설정 상태*/
|
|
|
+ public byte hSettingStatus;
|
|
|
+ /** 총 그룹 개수 */
|
|
|
+ public byte hGroupCnt;
|
|
|
+
|
|
|
+ /** 개별 그룹 정보 */
|
|
|
+ public Group[] group;
|
|
|
+
|
|
|
+ public GroupInfo() {
|
|
|
+ hSettingStatus = (byte) 0x00;
|
|
|
+ hGroupCnt = (byte) 0x00;
|
|
|
+ setGroupCnt(hGroupCnt);
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean setGroupCnt(byte hCnt) {
|
|
|
+ if ((hCnt <= 0) || (hCnt > 15)) return false;
|
|
|
+
|
|
|
+ hGroupCnt = hCnt;
|
|
|
+
|
|
|
+ group = new Group[hCnt];
|
|
|
+ for (byte i = 0; i < hCnt; i++) {
|
|
|
+ group[i] = new Group();
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString() {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "Setting\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "hSettingStatus : " + String.format("0x%02X", hSettingStatus) + "\r\n" +
|
|
|
+ "hGroupCnt : " + String.format("0x%02X", hGroupCnt) + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 개별 그룹 정보*/
|
|
|
+ public static class Group {
|
|
|
+ /** 그룹번호 */
|
|
|
+ public byte hNo;
|
|
|
+ /** 그룹 설정값 1 */
|
|
|
+ public byte hGroupValue01;
|
|
|
+ /** 그룹 설정값 2 */
|
|
|
+ public byte hGroupValue02;
|
|
|
+
|
|
|
+ public Group() {
|
|
|
+ hNo = (byte) 0x00;
|
|
|
+ hGroupValue01 = (byte) 0x00;
|
|
|
+ hGroupValue02 = (byte) 0x00;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString() {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "Group\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "hNo : " + String.format("0x%02X", hNo) + "\r\n" +
|
|
|
+ "hGroupValue01 : " + String.format("0x%02X", hGroupValue01) + "\r\n" +
|
|
|
+ "hGroupValue02 : " + String.format("0x%02X", hGroupValue02) + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /** 에어컨 연동 상태 */
|
|
|
+ public static class Status {
|
|
|
+ /** 실외기 수 정보 수신 대기 */
|
|
|
+ public static byte WAIT_OUTDOOR = (byte) 0x00;
|
|
|
+ /** 실내기 수 정보 수신 대기 */
|
|
|
+ public static byte WAIT_INSIDE = (byte) 0x01;
|
|
|
+ /** 실내기 상태 정보 수신 대기 */
|
|
|
+ public static byte WAIT_ALL = (byte) 0x02;
|
|
|
+ /** 에어컨 연동 완료 */
|
|
|
+ public static byte COMPLETE = (byte) 0x03;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param nStatus - (byte) 체크할 상태
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean checkRange(byte nStatus) {
|
|
|
+ if (nStatus == WAIT_OUTDOOR) return true;
|
|
|
+ else if (nStatus == WAIT_INSIDE) return true;
|
|
|
+ else if (nStatus == WAIT_ALL) return true;
|
|
|
+ else if (nStatus == COMPLETE) return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String ToDebugString(byte nStatus) {
|
|
|
+ String retStr;
|
|
|
+ if (nStatus == WAIT_OUTDOOR) retStr = "OFF";
|
|
|
+ else if (nStatus == WAIT_INSIDE) retStr = "STAND_BY";
|
|
|
+ else if (nStatus == WAIT_ALL) retStr = "NOT_SUPPORT";
|
|
|
+ else if (nStatus == COMPLETE) retStr = "ON";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** ON/OFF상태 정의 */
|
|
|
+ public static class POWER {
|
|
|
+ /** 정보없음 */
|
|
|
+ public static byte NoInfo = (byte) 0x00;
|
|
|
+ /** 에어컨 ON */
|
|
|
+ public static byte On = (byte) 0x01;
|
|
|
+ /** 에어컨 OFF */
|
|
|
+ public static byte Off = (byte) 0x02;
|
|
|
+ /** 에어컨 잔열제거 */
|
|
|
+ public static byte RemoveHeat = (byte) 0x03;
|
|
|
+
|
|
|
+ public static String ToDebugString(byte hPower) {
|
|
|
+ String retStr;
|
|
|
+ if (hPower == POWER.NoInfo) retStr = "NoInfo";
|
|
|
+ else if (hPower == POWER.On) retStr = "On";
|
|
|
+ else if (hPower == POWER.Off) retStr = "Off";
|
|
|
+ else if (hPower == POWER.RemoveHeat) retStr = "RemoveHeat";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 읽기 on/off 상태 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param hPower - (byte) 체크할 on/off모드
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean checkPowerRange(byte hPower) {
|
|
|
+ if (hPower == POWER.NoInfo) return true;
|
|
|
+ else if (hPower == POWER.On) return true;
|
|
|
+ else if (hPower == POWER.Off) return true;
|
|
|
+ else if (hPower == POWER.RemoveHeat) return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 운전모드에 따른 ON/OFF 상태를 반환한다.
|
|
|
+ *
|
|
|
+ * @param hPower - (byte) 입력 운전모드
|
|
|
+ *
|
|
|
+ * @return (boolean) ture: ON , false: OFF, RemoveHeat
|
|
|
+ */
|
|
|
+ public static boolean getPower(byte hPower) {
|
|
|
+ if (hPower == POWER.On) return true;
|
|
|
+ else return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 운전상태 정의 */
|
|
|
+ public static class MODE {
|
|
|
+ /** 자동 */
|
|
|
+ public static byte Auto = (byte) 0x00;
|
|
|
+ /** 냉방 */
|
|
|
+ public static byte Cooling = (byte) 0x01;
|
|
|
+ /** 제습 */
|
|
|
+ public static byte Dehumidify = (byte) 0x02;
|
|
|
+ /** 송풍 */
|
|
|
+ public static byte Fan = (byte) 0x03;
|
|
|
+ /** 난방 */
|
|
|
+ public static byte Heating = (byte) 0x04;
|
|
|
+ /** 정보없음 */
|
|
|
+ public static byte NoInfo = (byte) 0xFF;
|
|
|
+
|
|
|
+ public static String ToDebugString(byte Mode) {
|
|
|
+ String retStr;
|
|
|
+ if (Mode == MODE.Auto) retStr = "Auto";
|
|
|
+ else if (Mode == MODE.Cooling) retStr = "Cooling";
|
|
|
+ else if (Mode == MODE.Dehumidify) retStr = "Dehumidify";
|
|
|
+ else if (Mode == MODE.Fan) retStr = "Fan";
|
|
|
+ else if (Mode == MODE.Heating) retStr = "Heating";
|
|
|
+ else if (Mode == MODE.NoInfo) retStr = "NoInfo";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 설정운전모드 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param Mode - (byte) 체크할 운전모드
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean checkModeRange(byte Mode) {
|
|
|
+ if (Mode == MODE.Auto) return true;
|
|
|
+ else if (Mode == MODE.Cooling) return true;
|
|
|
+ else if (Mode == MODE.Dehumidify) return true;
|
|
|
+ else if (Mode == MODE.Fan) return true;
|
|
|
+ else if (Mode == MODE.Heating) return true;
|
|
|
+ else if (Mode == MODE.NoInfo) return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 풍량 정의
|
|
|
+ */
|
|
|
+ public static class AIRVOLUME {
|
|
|
+ /** 미설정 ( * 설정전용 : 읽기시 해당없음) */
|
|
|
+ public static byte Auto = (byte) 0x00;
|
|
|
+ /** 약 */
|
|
|
+ public static byte Low = (byte) 0x01;
|
|
|
+ /** 중 */
|
|
|
+ public static byte Mid = (byte) 0x02;
|
|
|
+ /** 강 */
|
|
|
+ public static byte High = (byte) 0x03;
|
|
|
+ /** 정보없음 */
|
|
|
+ public static byte NoInfo = (byte) 0xFF;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 설정운전모드 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param hAirVol - (byte) 체크할 운전모드
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean checkAirVolRange(byte hAirVol) {
|
|
|
+ if (hAirVol == AIRVOLUME.Auto) return true;
|
|
|
+ else if (hAirVol == AIRVOLUME.Low) return true;
|
|
|
+ else if (hAirVol == AIRVOLUME.Mid) return true;
|
|
|
+ else if (hAirVol == AIRVOLUME.High) return true;
|
|
|
+ else if (hAirVol == AIRVOLUME.NoInfo) return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String ToDebugString(byte hAirVol) {
|
|
|
+ String retStr;
|
|
|
+ if (hAirVol == AIRVOLUME.Auto) retStr = "Auto";
|
|
|
+ else if (hAirVol == AIRVOLUME.Low) retStr = "Low";
|
|
|
+ else if (hAirVol == AIRVOLUME.Mid) retStr = "Mid";
|
|
|
+ else if (hAirVol == AIRVOLUME.High) retStr = "High";
|
|
|
+ else if (hAirVol == AIRVOLUME.NoInfo) retStr = "NoInfo";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 각 에어컨 데이터 */
|
|
|
+ public static class AirconUnitData {
|
|
|
+ ////////////////////////////////////////////
|
|
|
+ // 기본기능
|
|
|
+ ////////////////////////////////////////////
|
|
|
+ /** 실내기 번호*/
|
|
|
+ public byte hInsideID;
|
|
|
+ /** onoff {@link POWER} 값에 따름 */
|
|
|
+ public byte hPower;
|
|
|
+ /** 운전모드 {@link MODE} 값에 따름 */
|
|
|
+ public byte hMode;
|
|
|
+ /** 풍량 {@link AIRVOLUME} 값에 따름 */
|
|
|
+ public byte hAirVol;
|
|
|
+ /** 설정온도 (1도 단위) */
|
|
|
+ public byte hSetTemper;
|
|
|
+ /** 현재온도 */
|
|
|
+ public byte hCurrentTemper;
|
|
|
+ /** 풍향제어 상태 */
|
|
|
+ public boolean bAirSwing;
|
|
|
+ /** 실외기 에러상태 */
|
|
|
+ public boolean bOutAirconError;
|
|
|
+ /** 실내기 에러상태 */
|
|
|
+ public boolean bInsideAirconError;
|
|
|
+ /** 에러코드 1 */
|
|
|
+ public byte hErrorCode1;
|
|
|
+ /** 에러코드 2 */
|
|
|
+ public byte hErrorCode2;
|
|
|
+
|
|
|
+ public AirconUnitData() {
|
|
|
+ hInsideID = (byte) 0x00;
|
|
|
+ hPower = POWER.NoInfo;
|
|
|
+ hMode = MODE.NoInfo;
|
|
|
+ hAirVol = AIRVOLUME.NoInfo;
|
|
|
+ hSetTemper = (byte) 0x00;
|
|
|
+ hCurrentTemper = (byte) 0x00;
|
|
|
+ bOutAirconError = false;
|
|
|
+ bInsideAirconError = false;
|
|
|
+ hErrorCode1 = (byte) 0x00;
|
|
|
+ hErrorCode2 = (byte) 0x00;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString() {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "hInsideID : " + hInsideID + "\r\n" +
|
|
|
+ "hPower : " + POWER.ToDebugString(hPower) + "\r\n" +
|
|
|
+ "hMode : " + MODE.ToDebugString(hMode) + "\r\n" +
|
|
|
+ "hAirVol : " + AIRVOLUME.ToDebugString(hAirVol) + "\r\n" +
|
|
|
+ "hSetTemper : " + hSetTemper + "\r\n" +
|
|
|
+ "hCurrentTemper : " + hCurrentTemper + "\r\n" +
|
|
|
+ "bAirSwing : " + bAirSwing + "\r\n" +
|
|
|
+ "bOutAirconError : " + bOutAirconError + "\r\n" +
|
|
|
+ "bInsideAirconError : " + bInsideAirconError + "\r\n" +
|
|
|
+ "hErrorCode1 : " + String.format("0x%02X", hErrorCode1) + "\r\n" +
|
|
|
+ "hErrorCode2 : " + String.format("0x%02X", hErrorCode2) + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /** [Purity] 데이터 클래스 */
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static class Purity {
|
|
|
+ /** 기기정보 */
|
|
|
+ public Info info;
|
|
|
+
|
|
|
+ /** 각 청정환기 데이터 */
|
|
|
+ public PurityData [] purityData;
|
|
|
+
|
|
|
+ public Purity() {
|
|
|
+ info = new Info();
|
|
|
+ purityData = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 청정환기 개수를 설정한다.<br>
|
|
|
+ *
|
|
|
+ * @param cnt - (byte) 설정할 청정환기개수 (범위: 1 ~ 9)
|
|
|
+ * @return (boolean) true : 성공 , false : 실패
|
|
|
+ */
|
|
|
+ public boolean SetPurityCount(byte cnt) {
|
|
|
+ if (info == null) return false;
|
|
|
+
|
|
|
+ if ((cnt <= 0) || (cnt > 15)) return false;
|
|
|
+
|
|
|
+ info.InsidePurityCount = cnt;
|
|
|
+ purityData = new PurityData [cnt];
|
|
|
+ for (byte i = 0; i < cnt; i++) purityData[i] = new PurityData();
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 기기정보 */
|
|
|
+ public static class Info {
|
|
|
+ /** 실내기개수(범위 : 1~9) */
|
|
|
+ public byte InsidePurityCount;
|
|
|
+ /** 청정환기 연동 상태 */
|
|
|
+ public byte PurityStatus;
|
|
|
+ /** 제조사 코드 ( 프로토콜 문서에 따름 ) */
|
|
|
+ public byte Vendor;
|
|
|
+ /** 펌웨어 Build Date (년) */
|
|
|
+ public byte FwVer_Year;
|
|
|
+ /** 펌웨어 Build Date (월) */
|
|
|
+ public byte FwVer_Month;
|
|
|
+ /** 펌웨어 Build Date (일) */
|
|
|
+ public byte FwVer_Day;
|
|
|
+ /** 펌웨어 Build Date (일련번호) */
|
|
|
+ public byte FwVer_Number;
|
|
|
+
|
|
|
+ /** 지원 프로토콜 버전 Main */
|
|
|
+ public byte ProtocolVer_Main;
|
|
|
+ /** 지원 프로토콜 버전 Sub */
|
|
|
+ public byte ProtocolVer_Sub;
|
|
|
+
|
|
|
+ public SupportInfo Support;
|
|
|
+
|
|
|
+ /** 기능 지원 여부 */
|
|
|
+ public class SupportInfo {
|
|
|
+ /** 풍량 제어 */
|
|
|
+ public boolean VolumeControl;
|
|
|
+ /** 모드 제어 */
|
|
|
+ public boolean ModeControl;
|
|
|
+ /** 공기질 센싱 */
|
|
|
+ public boolean AirSensing;
|
|
|
+ /** 무풍 기능 */
|
|
|
+ public boolean NoWindFunc;
|
|
|
+ /** 취침 기능 */
|
|
|
+ public boolean SleepFunc;
|
|
|
+
|
|
|
+ public SupportInfo() {
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public Info() {
|
|
|
+ Support = new SupportInfo();
|
|
|
+ InsidePurityCount = 0;
|
|
|
+ PurityStatus = Status.WAIT_OUTDOOR;
|
|
|
+ }
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString() {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "Info\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "InsidePurityCount : " + InsidePurityCount + "\r\n" +
|
|
|
+ "Vendor : " + String.format("0x%02X", Vendor) + "\r\n" +
|
|
|
+ "FwVer : " + (int)(FwVer_Year+2000) + "." + FwVer_Month + "." + FwVer_Day + "." + FwVer_Number + "\r\n" +
|
|
|
+ "ProtocolVer : " + "V" + ProtocolVer_Main + "." + ProtocolVer_Sub + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 청정환기 연동 상태 */
|
|
|
+ public static class Status {
|
|
|
+ /** 실외기 수 정보 수신 대기 */
|
|
|
+ public static byte WAIT_OUTDOOR = (byte) 0x00;
|
|
|
+ /** 실내기 수 정보 수신 대기 */
|
|
|
+ public static byte WAIT_INSIDE = (byte) 0x01;
|
|
|
+ /** 실내기 상태 정보 수신 대기 */
|
|
|
+ public static byte WAIT_ALL = (byte) 0x02;
|
|
|
+ /** 청정환기 연동 완료 */
|
|
|
+ public static byte COMPLETE = (byte) 0x03;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param nStatus - (byte) 체크할 상태
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckRange(byte nStatus) {
|
|
|
+ if (nStatus == WAIT_OUTDOOR) return true;
|
|
|
+ else if (nStatus == WAIT_INSIDE) return true;
|
|
|
+ else if (nStatus == WAIT_ALL) return true;
|
|
|
+ else if (nStatus == COMPLETE) return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String ToDebugString(byte nStatus) {
|
|
|
+ String retStr;
|
|
|
+ if (nStatus == WAIT_OUTDOOR) retStr = "OFF";
|
|
|
+ else if (nStatus == WAIT_INSIDE) retStr = "STAND_BY";
|
|
|
+ else if (nStatus == WAIT_ALL) retStr = "NOT_SUPPORT";
|
|
|
+ else if (nStatus == COMPLETE) retStr = "ON";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** ON/OFF상태 정의 */
|
|
|
+ public static class ONOFF {
|
|
|
+ /** 청정환기 ON */
|
|
|
+ public static byte PurityON = 0x01;
|
|
|
+ /** 청정환기 OFF */
|
|
|
+ public static byte PurityOFF = 0x00;
|
|
|
+
|
|
|
+ public static String ToDebugString(byte Mode) {
|
|
|
+ String retStr;
|
|
|
+ if (Mode == ONOFF.PurityON) retStr = "PurityON";
|
|
|
+ else if (Mode == ONOFF.PurityOFF) retStr = "PurityOFF";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * onoff운전모드 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param OnOff - (byte) 체크할 onoff
|
|
|
+
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckGetOnOff(byte OnOff) {
|
|
|
+ if (OnOff == ONOFF.PurityON) return true;
|
|
|
+ else if (OnOff == ONOFF.PurityOFF) return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 운전모드에 따른 ON/OFF 상태를 반환한다.
|
|
|
+ *
|
|
|
+ * @param Mode - (byte) 입력 운전모드
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:ON , false:OFF
|
|
|
+ */
|
|
|
+ public static boolean GetOnOff(byte Mode) {
|
|
|
+ if (Mode == ONOFF.PurityON) return true;
|
|
|
+ else if (Mode == ONOFF.PurityOFF) return false;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 청정환기 실내기 운전상태 정의 */
|
|
|
+ public static class MODE {
|
|
|
+ /** 자동 */
|
|
|
+ public static byte AI = 0x00;
|
|
|
+ /** 청정 */
|
|
|
+ public static byte Purity = 0x01;
|
|
|
+ /** 환기 */
|
|
|
+ public static byte Venti = 0x02;
|
|
|
+
|
|
|
+ public static String ToDebugString(byte Mode) {
|
|
|
+ String retStr;
|
|
|
+ if (Mode == MODE.AI) retStr = "AI";
|
|
|
+ else if (Mode == MODE.Purity) retStr = "Purity";
|
|
|
+ else if (Mode == MODE.Venti) retStr = "Venti";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 설정운전모드 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param Mode - (byte) 체크할 운전모드
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckGetMode(byte Mode) {
|
|
|
+ if (Mode == MODE.AI) return true;
|
|
|
+ else if (Mode == MODE.Purity) return true;
|
|
|
+ else if (Mode == MODE.Venti) return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 청정환기 부가기능(사용안함, 무풍, 취침) 정의 */
|
|
|
+ public static class ADDSERVICE {
|
|
|
+ /** 사용안함 */
|
|
|
+ public static byte NotUse = 0x00;
|
|
|
+ /** 무풍 */
|
|
|
+ public static byte NoWind = 0x01;
|
|
|
+ /** 취침 */
|
|
|
+ public static byte Sleep = 0x02;
|
|
|
+
|
|
|
+ public static String ToDebugString(byte add) {
|
|
|
+ String retStr;
|
|
|
+ if (add == ADDSERVICE.NotUse) retStr = "NotUse";
|
|
|
+ else if (add == ADDSERVICE.NoWind) retStr = "NoWind";
|
|
|
+ else if (add == ADDSERVICE.Sleep) retStr = "Sleep";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 부가기능 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param add - (byte) 체크할 운전모드
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckGetAddService(byte add) {
|
|
|
+ if (add == ADDSERVICE.NotUse) return true;
|
|
|
+ else if (add == ADDSERVICE.NoWind) return true;
|
|
|
+ else if (add == ADDSERVICE.Sleep) return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** ERV 운전모드 정의 */
|
|
|
+ public static class ERV_MODE {
|
|
|
+ /** 자동 */
|
|
|
+ public static byte AI = 0x00;
|
|
|
+ /** 전열교환 */
|
|
|
+ public static byte HeatChange = 0x01;
|
|
|
+ /** Bypass */
|
|
|
+ public static byte Bypass = 0x02;
|
|
|
+
|
|
|
+ public static String ToDebugString(byte Mode) {
|
|
|
+ String retStr;
|
|
|
+ if (Mode == ERV_MODE.AI) retStr = "AI";
|
|
|
+ else if (Mode == ERV_MODE.HeatChange) retStr = "HeatChange";
|
|
|
+ else if (Mode == ERV_MODE.Bypass) retStr = "Bypass";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * ERV 운전모드 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param Mode - (byte) 체크할 운전모드
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckGetMode(byte Mode) {
|
|
|
+ if (Mode == ERV_MODE.AI) return true;
|
|
|
+ else if (Mode == ERV_MODE.HeatChange) return true;
|
|
|
+ else if (Mode == ERV_MODE.Bypass) return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 필터알람상태 정의 */
|
|
|
+ public static class FILTERALARM
|
|
|
+ {
|
|
|
+ /** False */
|
|
|
+ public static byte False = 0x00;
|
|
|
+ /** True */
|
|
|
+ public static byte True = 0x01;
|
|
|
+ /** 필터알람정보 없음 */
|
|
|
+ public static byte NoInfo = 0x02;
|
|
|
+
|
|
|
+ public static String ToDebugString(byte FilterAlarm)
|
|
|
+ {
|
|
|
+ String retStr;
|
|
|
+ if(FilterAlarm == FILTERALARM.False) retStr = "False";
|
|
|
+ else if(FilterAlarm == FILTERALARM.True) retStr = "True";
|
|
|
+ else if(FilterAlarm == FILTERALARM.NoInfo) retStr = "NoInfo";
|
|
|
+ else retStr = "UnDefined";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 설정운전모드 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param FilterAlarm - (byte) 체크할 운전모드
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckGetFilterAlarm(byte FilterAlarm)
|
|
|
+ {
|
|
|
+ if(FilterAlarm == FILTERALARM.False) return true;
|
|
|
+ else if(FilterAlarm == FILTERALARM.True) return true;
|
|
|
+ else if(FilterAlarm == FILTERALARM.NoInfo) return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 풍량 정의
|
|
|
+ */
|
|
|
+ public static class VOLUME {
|
|
|
+ /** 미설정 ( * 설정전용 : 읽기시 해당없음) */
|
|
|
+ public static byte Auto = 0x00;
|
|
|
+ /** 약 */
|
|
|
+ public static byte Weak = 0x01;
|
|
|
+ /** 중 */
|
|
|
+ public static byte Medium = 0x02;
|
|
|
+ /** 강 */
|
|
|
+ public static byte Strong = 0x03;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 설정운전모드 범위를 체크한다.
|
|
|
+ *
|
|
|
+ * @param Mode - (byte) 체크할 운전모드
|
|
|
+ *
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean CheckGetVolume(byte Mode)
|
|
|
+ {
|
|
|
+ if(Mode == VOLUME.Auto) return true;
|
|
|
+ else if(Mode == VOLUME.Weak) return true;
|
|
|
+ else if(Mode == VOLUME.Medium) return true;
|
|
|
+ else if(Mode == VOLUME.Strong) return true;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 각 청정환기 실내기 데이터 */
|
|
|
+ public static class PurityData
|
|
|
+ {
|
|
|
+ ////////////////////////////////////////////
|
|
|
+ // 기본기능
|
|
|
+ ////////////////////////////////////////////
|
|
|
+ /** onoff {@link MODE} 값에 따름 */
|
|
|
+ public byte OnOff;
|
|
|
+ /** 운전모드 {@link MODE} 값에 따름 */
|
|
|
+ public byte Mode;
|
|
|
+ /** 풍량 {@link VOLUME} 값에 따름 */
|
|
|
+ public byte Volume;
|
|
|
+ /** 무풍,취침 상태 여부 ( 0 : OFF, 1 : 무풍 ON, 2 : 취침 ON [무풍과 취침이 동시에 될 수 없다]) */
|
|
|
+ public byte AddService;
|
|
|
+ /** 취침 상태 여부 ( 0 : OFF, 1 : ON) */
|
|
|
+ //public byte bSleep;
|
|
|
+ /** 무풍 상태 여부 ( 0 : OFF, 1 : ON) */
|
|
|
+ //public byte bNoWind;
|
|
|
+
|
|
|
+ /** 각 열교환기 상태 데이터 */
|
|
|
+ public ErvData ervData;
|
|
|
+
|
|
|
+ /** 공기질 센싱 항목 데이터 */
|
|
|
+ public AirSensingData airSensingData;
|
|
|
+
|
|
|
+ public PurityData()
|
|
|
+ {
|
|
|
+ ervData = new ErvData();
|
|
|
+ airSensingData = new AirSensingData();
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString(byte RoomIndex)
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "PurityData (" + (int) (RoomIndex+1) + ") \r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "OnOff : " + MODE.ToDebugString(OnOff) + "\r\n" +
|
|
|
+ "Mode : " + MODE.ToDebugString(Mode) + "\r\n" +
|
|
|
+ "Volume : " + MODE.ToDebugString(Volume) + "\r\n" +
|
|
|
+ //"bSleep : " + MODE.ToDebugString(bSleep) + "\r\n" +
|
|
|
+ //"bNoWind : " + MODE.ToDebugString(bNoWind) + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 각 열교환기 상태 데이터 */
|
|
|
+ public static class ErvData
|
|
|
+ {
|
|
|
+ ////////////////////////////////////////////
|
|
|
+ // 기본기능
|
|
|
+ ////////////////////////////////////////////
|
|
|
+ /** onoff {@link MODE} 값에 따름 */
|
|
|
+ public byte OnOff;
|
|
|
+ /** 운전모드 {@link MODE} 값에 따름 */
|
|
|
+ public byte Mode;
|
|
|
+ /** 필터알람상태 {@link MODE} 값에 따름 */
|
|
|
+ public byte Filter;
|
|
|
+ /** 풍량 {@link VOLUME} 값에 따름 */
|
|
|
+ public byte Volume;
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString(byte RoomIndex)
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "ErvData (" + (int) (RoomIndex+1) + ") \r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "OnOff : " + MODE.ToDebugString(OnOff) + "\r\n" +
|
|
|
+ "Mode : " + MODE.ToDebugString(Mode) + "\r\n" +
|
|
|
+ "Filter : " + MODE.ToDebugString(Filter) + "\r\n" +
|
|
|
+ "Volume : " + MODE.ToDebugString(Volume) + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 공기질 센싱 항목 데이터 */
|
|
|
+ public static class AirSensingData
|
|
|
+ {
|
|
|
+ ////////////////////////////////////////////
|
|
|
+ // 기본기능
|
|
|
+ ////////////////////////////////////////////
|
|
|
+ /** 운전모드*/
|
|
|
+ public byte AirSense;
|
|
|
+ /** 미세먼지 */
|
|
|
+ public byte Dust;
|
|
|
+ /** 초미세먼지 */
|
|
|
+ public byte FindDust;
|
|
|
+ /** 극초미세먼지 */
|
|
|
+ public byte UltraFindDust;
|
|
|
+ /** Co2 */
|
|
|
+ public byte Co2;
|
|
|
+ /** VOC */
|
|
|
+ public byte Voc;
|
|
|
+ /** 온도 */
|
|
|
+ public byte Temp;
|
|
|
+ /** 습도 */
|
|
|
+ public byte Humidity;
|
|
|
+
|
|
|
+ /** 미세먼지 값*/
|
|
|
+ public byte dustValue[];
|
|
|
+
|
|
|
+ /** 초미세먼지 값*/
|
|
|
+ public byte fineDustValue[];
|
|
|
+
|
|
|
+ /** Co2 값*/
|
|
|
+ public byte co2Value[];
|
|
|
+
|
|
|
+ byte[] ModeArray = new byte[]{0, 0, 0, 0, 0, 0};
|
|
|
+
|
|
|
+ public AirSensingData()
|
|
|
+ {
|
|
|
+ dustValue = new byte[]{0, 0};
|
|
|
+ fineDustValue = new byte[]{0, 0};
|
|
|
+ co2Value = new byte[]{0, 0};
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString(byte RoomIndex)
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "AirData (" + (int) (RoomIndex+1) + ") \r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "AirSense : " + MODE.ToDebugString(AirSense) + "\r\n" +
|
|
|
+ "Dust : " + MODE.ToDebugString(Dust) + "\r\n" +
|
|
|
+ "FindDust : " + MODE.ToDebugString(FindDust) + "\r\n" +
|
|
|
+ "Co2 : " + MODE.ToDebugString(Co2) + "\r\n" +
|
|
|
+ "Voc : " + MODE.ToDebugString(Voc) + "\r\n" +
|
|
|
+ "Temp : " + MODE.ToDebugString(Temp) + "\r\n" +
|
|
|
+ "Humidity : " + MODE.ToDebugString(Humidity) + "\r\n" +
|
|
|
+ "UltraFindDust : " + MODE.ToDebugString(UltraFindDust) + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 각 방 제어용 데이터 */
|
|
|
+ public static class CtrlRoomData
|
|
|
+ {
|
|
|
+ /** 청정환기 제어 */
|
|
|
+ public byte Control;
|
|
|
+
|
|
|
+ public CtrlRoomData()
|
|
|
+ {
|
|
|
+ Control = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 전체방 데이터 정의 (통신용) */
|
|
|
+ public static class AllRoomData
|
|
|
+ {
|
|
|
+ public byte RoomCount;
|
|
|
+ public EachRoomData [] Room;
|
|
|
+
|
|
|
+ public AllRoomData(byte nRoomCount)
|
|
|
+ {
|
|
|
+ RoomCount = nRoomCount;
|
|
|
+ Room = new EachRoomData[RoomCount];
|
|
|
+ for(byte i=0 ; i<RoomCount ; i++) Room[i] = new EachRoomData();
|
|
|
+ }
|
|
|
+
|
|
|
+ public class EachRoomData
|
|
|
+ {
|
|
|
+ /** 운전모드 {@link MODE} 값에 따름 */
|
|
|
+ public byte Mode;
|
|
|
+ /** 풍량 {@link VOLUME} 값에 따름 */
|
|
|
+ public byte Volume;
|
|
|
+
|
|
|
+ public EachRoomData()
|
|
|
+ {
|
|
|
+ Mode = MODE.AI;
|
|
|
+ Volume = VOLUME.Auto;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString()
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "AllRoomData\r\n" +
|
|
|
+ "==========================\r\n";
|
|
|
+
|
|
|
+ for(byte i=0 ; i<RoomCount ; i++)
|
|
|
+ {
|
|
|
+ //retStr += Room[i].ToDebugString(i);
|
|
|
+ }
|
|
|
+
|
|
|
+ retStr += "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 에러코드 */
|
|
|
+ public static class ERROR
|
|
|
+ {
|
|
|
+ /** 실내기 에러여부 ( true : 이상, false : 정상) */
|
|
|
+ public boolean bError;
|
|
|
+ /** 기타이상 ( true : 이상, false : 정상) */
|
|
|
+ public boolean bEtc;
|
|
|
+
|
|
|
+ public ERROR()
|
|
|
+ {
|
|
|
+ bError = false;
|
|
|
+ bEtc = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ private String ToStrBoolean(boolean in) { if(in) return "O"; else return "X"; }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /** ------------------ 부가 서비스 관련 -------------- **/
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /** [주차정보] 데이터 클래스 */
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static class CarParkingData
|
|
|
+ {
|
|
|
+ public int index;
|
|
|
+ public String card_num;
|
|
|
+ public String card_uid;
|
|
|
+ public String card_sn;
|
|
|
+ public String card_type;
|
|
|
+ public Calendar time;
|
|
|
+ public String location_text;
|
|
|
+ public String location_map;
|
|
|
+ public String vehicle_info;
|
|
|
+ public String ftp_path;
|
|
|
+ public String ftp_idpass_info;
|
|
|
+ public String message;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 생성자
|
|
|
+ **/
|
|
|
+ public CarParkingData()
|
|
|
+ {
|
|
|
+ index = 0;
|
|
|
+ card_num = "null";
|
|
|
+ card_uid = "null";
|
|
|
+ card_sn = "null";
|
|
|
+ card_type = "null";
|
|
|
+ time = Calendar.getInstance();
|
|
|
+ location_text = "null";
|
|
|
+ location_map = "null";
|
|
|
+ vehicle_info = "null";
|
|
|
+ ftp_path = "null";
|
|
|
+ ftp_idpass_info = "null";
|
|
|
+ message = "null";
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString()
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "CarParkingData\r\n" +
|
|
|
+ "==========================\r\n";
|
|
|
+
|
|
|
+
|
|
|
+ String temp_time;
|
|
|
+ if(time != null)
|
|
|
+ {
|
|
|
+ temp_time = String.format("%04d-%02d-%02d %02d:%02d:%02d",time.get(Calendar.YEAR),time.get(Calendar.MONTH)+1, time.get(Calendar.DAY_OF_MONTH),time.get(Calendar.HOUR_OF_DAY), time.get(Calendar.MINUTE), time.get(Calendar.SECOND));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ temp_time = "null";
|
|
|
+ }
|
|
|
+ retStr +=
|
|
|
+ "index :" + index + " \r\n" +
|
|
|
+ "card_num :"+ card_num + " \r\n" +
|
|
|
+ "card_uid :"+ card_uid + " \r\n" +
|
|
|
+ "card_sn :"+ card_sn + " \r\n" +
|
|
|
+ "card_type :"+ card_type + " \r\n" +
|
|
|
+ "time :"+ temp_time + " \r\n" +
|
|
|
+ "location_text :"+ location_text + " \r\n" +
|
|
|
+ "location_map :"+ location_map + " \r\n" +
|
|
|
+ "vehicle_info :"+ vehicle_info + " \r\n" +
|
|
|
+ "ftp_path :"+ ftp_path + " \r\n" +
|
|
|
+ "ftp_idpass_info :"+ ftp_idpass_info + " \r\n" +
|
|
|
+ "message :"+ message + " \r\n";
|
|
|
+
|
|
|
+ retStr += "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /** [주차 이벤트 정보] 데이터 클래스 */
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static class CarEventData
|
|
|
+ {
|
|
|
+ public Calendar time;
|
|
|
+ public int EventType;
|
|
|
+ public String CarNum;
|
|
|
+ public String location;
|
|
|
+ public String message;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 생성자
|
|
|
+ **/
|
|
|
+ public CarEventData()
|
|
|
+ {
|
|
|
+ time = Calendar.getInstance();
|
|
|
+ EventType = 0;
|
|
|
+ CarNum = "null";
|
|
|
+ location = "null";
|
|
|
+ message = "null";
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString()
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "CarEventData\r\n" +
|
|
|
+ "==========================\r\n";
|
|
|
+
|
|
|
+ String temp_time;
|
|
|
+ if(time != null)
|
|
|
+ {
|
|
|
+ temp_time = String.format("%04d-%02d-%02d %02d:%02d:%02d",time.get(Calendar.YEAR),time.get(Calendar.MONTH)+1, time.get(Calendar.DAY_OF_MONTH),time.get(Calendar.HOUR_OF_DAY), time.get(Calendar.MINUTE), time.get(Calendar.SECOND));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ temp_time = "null";
|
|
|
+ }
|
|
|
+
|
|
|
+ retStr +=
|
|
|
+ "time :"+ temp_time + " \r\n" +
|
|
|
+ "EventType :"+ EventType + " \r\n" +
|
|
|
+ "Location :"+ location + " \r\n" +
|
|
|
+ "CarNum :"+ CarNum + " \r\n" +
|
|
|
+ "message :"+ message + " \r\n";
|
|
|
+ retStr += "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ // ///////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ // ///////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /** [가스 디버깅 데이터] 데이터 클래스 */
|
|
|
+ // ///////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ // ///////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static class GasDebugData
|
|
|
+ {
|
|
|
+ public String time;
|
|
|
+ public String packet;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 생성자
|
|
|
+ **/
|
|
|
+ public GasDebugData()
|
|
|
+ {
|
|
|
+ time = "null";
|
|
|
+ packet = "null";
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString()
|
|
|
+ {
|
|
|
+ String retStr = "==========================\r\n" + "GasDebugData\r\n" + "==========================\r\n";
|
|
|
+ retStr += "time :" + time + " \r\n" + "packet :" + packet + "\r\n";
|
|
|
+ retStr += "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // ///////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ // ///////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /** [층간소음 센서] 데이터 클래스 */
|
|
|
+ // ///////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ // ///////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static class InterlayerNoiseSensor
|
|
|
+ {
|
|
|
+ public Info info;
|
|
|
+ public Device device;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 생성자
|
|
|
+ **/
|
|
|
+ public InterlayerNoiseSensor()
|
|
|
+ {
|
|
|
+ info = new Info();
|
|
|
+ device = new Device();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString()
|
|
|
+ {
|
|
|
+ String retStr = "==========================\r\n" + "InterlayerNoiseSensor\r\n" + "==========================\r\n";
|
|
|
+ retStr += "info = " + info.ToDebugString();
|
|
|
+ retStr += "device = " + device.ToDebugString();
|
|
|
+ retStr += "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 층간소음 기기 상태 */
|
|
|
+ public static class Device
|
|
|
+ {
|
|
|
+ /** * 층간소음 발생 상태*/
|
|
|
+ private boolean NoiseOccur;
|
|
|
+
|
|
|
+ /** * 통신 상태*/
|
|
|
+ private boolean CommError;
|
|
|
+
|
|
|
+
|
|
|
+ public boolean SetNoiseOccur(boolean input)
|
|
|
+ {
|
|
|
+ NoiseOccur = input;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean GetNoiseOccur()
|
|
|
+ {
|
|
|
+ return NoiseOccur;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean SetCommStatus(boolean input)
|
|
|
+ {
|
|
|
+ CommError = input;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean GetCommStatus()
|
|
|
+ {
|
|
|
+ return CommError;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Device()
|
|
|
+ {
|
|
|
+ CommError = false;
|
|
|
+ NoiseOccur = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String ToDebugString()
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "(InterLayer Noise Sensor - Device) \r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "CommError : " + CommError + "\r\n" +
|
|
|
+ "NoiseOccur : " + NoiseOccur + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 층간소음센서 정보 */
|
|
|
+ public static class Info
|
|
|
+ {
|
|
|
+ /** 설치상태 (true:설치 , false:미설치) */
|
|
|
+ public boolean Install;
|
|
|
+
|
|
|
+ /** 제조사 코드 ( 0x01 : 제일전기, 0x02 = 다산지앤지, 0x03 = 클레오) */
|
|
|
+ public byte Vender;
|
|
|
+
|
|
|
+ /** 펌웨어 Build Date (년) */
|
|
|
+ public byte FwVer_Year;
|
|
|
+ /** 펌웨어 Build Date (월) */
|
|
|
+ public byte FwVer_Month;
|
|
|
+ /** 펌웨어 Build Date (일) */
|
|
|
+ public byte FwVer_Day;
|
|
|
+ /** 펌웨어 Build Date (일련번호) */
|
|
|
+ public byte FwVer_Number;
|
|
|
+
|
|
|
+ /** 지원 프로토콜 버전 Main */
|
|
|
+ public byte ProtocolVer_Main;
|
|
|
+ /** 지원 프로토콜 버전 Sub */
|
|
|
+ public byte ProtocolVer_Sub;
|
|
|
+
|
|
|
+ public Info()
|
|
|
+ {
|
|
|
+ Install = false;
|
|
|
+ Vender = 0x00;
|
|
|
+
|
|
|
+ FwVer_Year = 0x00;
|
|
|
+ FwVer_Month = 0x00;
|
|
|
+ FwVer_Day = 0x00;
|
|
|
+ FwVer_Number = 0x00;
|
|
|
+
|
|
|
+ ProtocolVer_Main = 0x00;
|
|
|
+ ProtocolVer_Sub = 0x00;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String ToDebugString()
|
|
|
+ {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "( InterLayer Noise Sensor - Info)" + "\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "Vender : " + String.format("0x%02X", Vender) + "\r\n" +
|
|
|
+ "FwVer : " + (int)(FwVer_Year+2000) + "." + FwVer_Month + "." + FwVer_Day + "." + FwVer_Number + "\r\n" +
|
|
|
+ "ProtocolVer : " + "V" + ProtocolVer_Main + "." + ProtocolVer_Sub + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // ///////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ // ///////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /** [공기질센서] 데이터 클래스 */
|
|
|
+ // ///////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ // ///////////////////////////////////////////////////////////////////////////////////////
|
|
|
+
|
|
|
+ public static class AirQualityData {
|
|
|
+
|
|
|
+ public Info info;
|
|
|
+ public Device device;
|
|
|
+
|
|
|
+ public AirQualityData() {
|
|
|
+ info = new Info();
|
|
|
+ device = new Device();
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 기기정보 */
|
|
|
+ public static class Info {
|
|
|
+ /** 기능 지원 여부 */
|
|
|
+ public class SupportClass {
|
|
|
+ /** 미세먼지 (PM10) 측정 여부 */
|
|
|
+ public boolean bSensePM10 = false;
|
|
|
+ /** 초세먼지 (PM2.5) 측정 여부 */
|
|
|
+ public boolean bSensePM2p5 = false;
|
|
|
+ /** 극초미세먼지(PM1.0) 측정 여부 */
|
|
|
+ public boolean bSensePM1p0 = false;
|
|
|
+ /** 실내 CO2 측정 여부 */
|
|
|
+ public boolean bSenseCO2 = false;
|
|
|
+ /** LED 밝기 제어 가능 여부 */
|
|
|
+ public boolean bCtrlableLEDBrightness = false;
|
|
|
+ /** 공기질 센서 팬 제어 가능 여부 */
|
|
|
+ public boolean bCtrlableFanMode = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 기능 지원 여부 */
|
|
|
+ public SupportClass Support;
|
|
|
+ /** 펌웨어 Build Date (년) */
|
|
|
+ public byte FWVer_Year;
|
|
|
+ /** 펌웨어 Build Date (월) */
|
|
|
+ public byte FWVer_Month;
|
|
|
+ /** 펌웨어 Build Date (일) */
|
|
|
+ public byte FWVer_Day;
|
|
|
+ /** 펌웨어 Build Date (일련번호) */
|
|
|
+ public byte FWVer_No;
|
|
|
+
|
|
|
+ /** 지원 프로토콜 버전 Main */
|
|
|
+ public byte ProtocolVer_Main;
|
|
|
+ /** 지원 프로토콜 버전 Sub */
|
|
|
+ public byte ProtocolVer_Sub;
|
|
|
+
|
|
|
+ /** 제조사 정보 */
|
|
|
+ public byte Vendor;
|
|
|
+
|
|
|
+ /** 설치상태 (true:설치 , false:미설치) */
|
|
|
+ public boolean Install;
|
|
|
+
|
|
|
+ /** 생성자 */
|
|
|
+ public Info() {
|
|
|
+ Support = new SupportClass();
|
|
|
+ Install = false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 본 클래스 디버깅 메시지 */
|
|
|
+ public String ToDebugString() {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ " Info\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "Install : " + Install + "\r\n" +
|
|
|
+ "FwVer : " + (int)(FWVer_Year +2000) + "." + FWVer_Month + "." + FWVer_Day + "." + FWVer_No + "\r\n" +
|
|
|
+ "ProtocolVer : " + "V" + ProtocolVer_Main + "." + ProtocolVer_Sub + "\r\n" +
|
|
|
+ "Vendor : " + Vendor + "\r\n" +
|
|
|
+
|
|
|
+ "[Support]" + "\r\n" +
|
|
|
+ "bSensePM2p5 : " + Support.bSensePM2p5 + "\r\n" +
|
|
|
+ "bSensePM10 : " + Support.bSensePM10 + "\r\n" +
|
|
|
+ "bSensePM1p0 : " + Support.bSensePM1p0 + "\r\n" +
|
|
|
+ "bSenseCO2 : " + Support.bSenseCO2 + "\r\n" +
|
|
|
+ "bCtrlableLEDBrightness : " + Support.bCtrlableLEDBrightness + "\r\n" +
|
|
|
+ "bCtrlableFanMode : " + Support.bCtrlableFanMode + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static class Device {
|
|
|
+ /** 센서 상태 (false : 정상/ true : 비정상) */
|
|
|
+ public boolean bPMSensorStatus; // 먼지센서 상태 (미세먼지, 초미세먼지)
|
|
|
+ public boolean bCo2SensorStatus; // Co2
|
|
|
+ public boolean bAutoLEDCtrl; // 공기질 센서 상태 LED 밝기 자동 모드 동작 여부
|
|
|
+ public boolean bAutoFanCtrl; // 공기질 센서의 팬 자동 모드 동작 여부
|
|
|
+ public byte hLEDBrightness; // 공기질 센서 상태 LED 밝기 단계 (0x00: 꺼짐, 0x01: 어둡게, 0x02: 밝게)
|
|
|
+ public byte hFanMode; // 공기질 센서의 팬 동작 모드 (0x00: 상시, 0x01: 꺼짐, 0x02: 반복)
|
|
|
+ public double dFigure_PM10; // 미세먼지 수치값
|
|
|
+ public double dFigure_PM2p5; // 초미세먼지 수치값
|
|
|
+ public double dFigure_PM1p0; // 극초미세먼지 수치값
|
|
|
+ public double dFigure_CO2; // 이산화탄소 농도
|
|
|
+ public byte hLevel_PM10; // 미세먼지 레벨
|
|
|
+ public byte hLevel_PM2p5; // 초미세먼지 레벨
|
|
|
+ public byte hLevel_PM1p0; // 극초미세먼지 레벨
|
|
|
+ public byte hLevel_CO2; // 이산화탄소 레벨
|
|
|
+
|
|
|
+ public Device() {
|
|
|
+ bPMSensorStatus = false;
|
|
|
+ bCo2SensorStatus = false;
|
|
|
+ bAutoLEDCtrl = true;
|
|
|
+ bAutoFanCtrl = true;
|
|
|
+ hLEDBrightness = LEDBrightness.Level_02; // 어둡게
|
|
|
+ hFanMode = FanMode.Always; // 자동
|
|
|
+ dFigure_PM10 = 0;
|
|
|
+ dFigure_PM2p5 = 0;
|
|
|
+ dFigure_PM1p0 = 0;
|
|
|
+ dFigure_CO2 = 0;
|
|
|
+ hLevel_PM10 = 0;
|
|
|
+ hLevel_PM2p5 = 0;
|
|
|
+ hLevel_PM1p0 = 0;
|
|
|
+ hLevel_CO2 = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String ToDebugString() {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "DeviceData \r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "bPMSensorStatus : " + bPMSensorStatus + "\r\n" +
|
|
|
+ "bPMSensorStatus : " + bPMSensorStatus + "\r\n" +
|
|
|
+ "bAutoLEDCtrl : " + bAutoLEDCtrl + "\r\n" +
|
|
|
+ "bAutoFanCtrl : " + bAutoFanCtrl + "\r\n" +
|
|
|
+ "hLEDBrightness : " + hLEDBrightness + "\r\n" +
|
|
|
+ "hFanMode : " + hFanMode + "\r\n" +
|
|
|
+ "\r\n" +
|
|
|
+ "hLevel_PM10 : " + hLevel_PM10 + "\r\n" +
|
|
|
+ "dFigure_PM10 : " + dFigure_PM10 + "\r\n" +
|
|
|
+ "\r\n" +
|
|
|
+ "hLevel_PM2p5 : " + hLevel_PM2p5 + "\r\n" +
|
|
|
+ "dFigure_PM2p5 : " + dFigure_PM2p5 + "\r\n" +
|
|
|
+ "\r\n" +
|
|
|
+ "hLevel_PM1p0 : " + hLevel_PM1p0 + "\r\n" +
|
|
|
+ "dFigure_PM1p0 : " + dFigure_PM1p0 + "\r\n" +
|
|
|
+ "\r\n" +
|
|
|
+ "hLevel_CO2 : " + hLevel_CO2 + "\r\n" +
|
|
|
+ "dFigure_CO2 : " + dFigure_CO2 + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**공기질 상태 LED 밝기*/
|
|
|
+ public static class LEDBrightness {
|
|
|
+ public final static byte Level_00 = (byte) 0x00; // off
|
|
|
+ public final static byte Level_01 = (byte) 0x01; // 1단계 (어둡게)
|
|
|
+ public final static byte Level_02 = (byte) 0x02; // 2단계 (밝게)
|
|
|
+ public final static byte Level_Auto = (byte) 0xFF; // 시간대별로 자동으로 LED밝기를 제어한다. (공기질 센서 프로토콜에는 없으며, 월패드에만 존재)
|
|
|
+
|
|
|
+ /**
|
|
|
+ * LED 밝기 레벨값 범위 확인
|
|
|
+ * @param hLevel - (byte) 체크할 상태
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean checkRange(byte hLevel) {
|
|
|
+ if ((hLevel < Level_00 || Level_02 < hLevel) && hLevel != Level_Auto) return false;
|
|
|
+ else return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**공기질 상태 LED 밝기*/
|
|
|
+ public static class FanMode {
|
|
|
+ public final static byte Always = (byte) 0x00; // 상시
|
|
|
+ public final static byte Off = (byte) 0x01; // 꺼짐
|
|
|
+ public final static byte Repeat = (byte) 0x02; // 반복 (On, Off를 반복함)
|
|
|
+ public final static byte Auto = (byte) 0xFF; // 시간대별로 자동으로 센서팬 동작모드를 제어한다. (공기질 센서 프로토콜에는 없으며, 월패드에만 존재)
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 센서팬 동작모드 상태값 범위 확인
|
|
|
+ * @param hMode - (byte) 체크할 상태
|
|
|
+ * @return (boolean) ture:정상 , false:범위이탈
|
|
|
+ */
|
|
|
+ public static boolean checkRange(byte hMode) {
|
|
|
+ if ((hMode < Always || Repeat < hMode) && hMode != Auto) return false;
|
|
|
+ else return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ ///////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ // AIRLevel
|
|
|
+ ///////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static class AIRLevel {
|
|
|
+ public static final class LEVEL6 {
|
|
|
+ public static final class PM10 {
|
|
|
+ public final static byte BEST = (byte)0x01;
|
|
|
+ public final static byte GOOD = (byte)0x02;
|
|
|
+ public final static byte NORMAL = (byte)0x03;
|
|
|
+ public final static byte BAD = (byte)0x04;
|
|
|
+ public final static byte WORSE = (byte)0x05;
|
|
|
+ public final static byte WORST = (byte)0x06;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static final class PM2_5 {
|
|
|
+ public final static byte BEST = (byte)0x11;
|
|
|
+ public final static byte GOOD = (byte)0x12;
|
|
|
+ public final static byte NORMAL = (byte)0x13;
|
|
|
+ public final static byte BAD = (byte)0x14;
|
|
|
+ public final static byte WORSE = (byte)0x15;
|
|
|
+ public final static byte WORST = (byte)0x16;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static final class CO2 {
|
|
|
+ public final static byte BEST = (byte)0x21;
|
|
|
+ public final static byte GOOD = (byte)0x22;
|
|
|
+ public final static byte NORMAL = (byte)0x23;
|
|
|
+ public final static byte BAD = (byte)0x24;
|
|
|
+ public final static byte WORSE = (byte)0x25;
|
|
|
+ public final static byte WORST = (byte)0x26;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static final class LEVEL4 {
|
|
|
+ public static final class PM10 {
|
|
|
+ public final static byte GOOD = (byte)0x02;
|
|
|
+ public final static byte NORMAL = (byte)0x03;
|
|
|
+ public final static byte BAD = (byte)0x04;
|
|
|
+ public final static byte WORSE = (byte)0x05;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static final class PM2_5 {
|
|
|
+ public final static byte GOOD = (byte)0x12;
|
|
|
+ public final static byte NORMAL = (byte)0x13;
|
|
|
+ public final static byte BAD = (byte)0x14;
|
|
|
+ public final static byte WORSE = (byte)0x15;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static final class CO2 {
|
|
|
+ public final static byte GOOD = (byte)0x22;
|
|
|
+ public final static byte NORMAL = (byte)0x23;
|
|
|
+ public final static byte BAD = (byte)0x24;
|
|
|
+ public final static byte WORSE = (byte)0x25;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public static final class LEVEL8 {
|
|
|
+ public static final class PM10 {
|
|
|
+ public final static byte BEST = (byte)0x01;
|
|
|
+ public final static byte GOOD = (byte)0x02;
|
|
|
+ public final static byte FINE = (byte)0x03;
|
|
|
+ public final static byte NORMAL = (byte)0x04;
|
|
|
+ public final static byte BAD = (byte)0x05;
|
|
|
+ public final static byte QUITEBAD = (byte)0x06;
|
|
|
+ public final static byte WORSE = (byte)0x07;
|
|
|
+ public final static byte WORST = (byte)0x08;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static final class PM2_5 {
|
|
|
+ public final static byte BEST = (byte)0x11;
|
|
|
+ public final static byte GOOD = (byte)0x12;
|
|
|
+ public final static byte FINE = (byte)0x13;
|
|
|
+ public final static byte NORMAL = (byte)0x14;
|
|
|
+ public final static byte BAD = (byte)0x15;
|
|
|
+ public final static byte QUITEBAD = (byte)0x16;
|
|
|
+ public final static byte WORSE = (byte)0x17;
|
|
|
+ public final static byte WORST = (byte)0x18;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static final class CO2 {
|
|
|
+ public final static byte BEST = (byte)0x21;
|
|
|
+ public final static byte GOOD = (byte)0x22;
|
|
|
+ public final static byte FINE = (byte)0x23;
|
|
|
+ public final static byte NORMAL = (byte)0x24;
|
|
|
+ public final static byte BAD = (byte)0x25;
|
|
|
+ public final static byte QUITEBAD = (byte)0x26;
|
|
|
+ public final static byte WORSE = (byte)0x27;
|
|
|
+ public final static byte WORST = (byte)0x28;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /** [쿡탑제어기/Cooktop Controller] 데이터 클래스*/
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static class CooktopCtrl {
|
|
|
+
|
|
|
+ public Info info;
|
|
|
+ public Circuit[] circuit;
|
|
|
+
|
|
|
+ // 회로정보 없이 초기화
|
|
|
+ public CooktopCtrl() {
|
|
|
+ info = new Info();
|
|
|
+ circuit = new Circuit[0];
|
|
|
+ }
|
|
|
+
|
|
|
+ // 회로정보와 함께 초기화
|
|
|
+ public CooktopCtrl(byte circuitCnt) {
|
|
|
+ if (circuitCnt < 0 || 15 < circuitCnt) {
|
|
|
+ Log.w(TAG, "[CooktopCtrl] circuitCnt is out of range!!! circuitCnt -> " + circuitCnt);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ info = new Info(circuitCnt);
|
|
|
+ circuit = new Circuit[(int) circuitCnt];
|
|
|
+ for(int i = 0 ; i< circuitCnt; i++)
|
|
|
+ {
|
|
|
+ circuit[i] = new Circuit();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 회로개수 설정
|
|
|
+ public void setCircuitCnt(byte circuitCnt) {
|
|
|
+ if (circuitCnt < 0 || 15 < circuitCnt) {
|
|
|
+ Log.w(TAG, "[setCircuitCnt] circuitCnt is out of range!!! circuitCnt -> " + circuitCnt);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ int circuit_len = (int) circuitCnt;
|
|
|
+ circuit = new Circuit[circuit_len];
|
|
|
+ for(int i = 0 ; i< circuit_len; i++)
|
|
|
+ {
|
|
|
+ circuit[i] = new Circuit();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 제어기 전체상태를 반환한다. */
|
|
|
+ public Circuit getCircuit(byte index) {
|
|
|
+ if (index < circuit.length || circuit.length < index) {
|
|
|
+ Log.w(TAG, "[getCircuit] index is out of range!!! index -> " + index);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ Circuit Result = circuit[index];
|
|
|
+ return Result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 제어기 전체상태를 설정한다. */
|
|
|
+ public boolean setCircuit(byte index, Circuit cir) {
|
|
|
+ if (index < circuit.length || circuit.length < index) {
|
|
|
+ Log.w(TAG, "[setCircuit] index is out of range!!! index -> " + index);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (cir == null) {
|
|
|
+ Log.w(TAG, "[setCircuit] cir is null!!");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ circuit[index] = cir;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 보드정보 */
|
|
|
+ public static class Info {
|
|
|
+ /** 설치상태 (true:설치 , false:미설치) */
|
|
|
+ public boolean bInstall;
|
|
|
+
|
|
|
+ /** 제조사 코드 ( 0x01 : 한국소방, 0x02 : 신우전자 ) */
|
|
|
+ public byte hVendor;
|
|
|
+
|
|
|
+ /** 회로개수( 콘센트 - 범위 : 1~56) */
|
|
|
+ public byte hCircuitCnt;
|
|
|
+
|
|
|
+ /** 기능 제공 옵션 1/2 */
|
|
|
+ public byte hSupport01;
|
|
|
+ public byte hSupport02;
|
|
|
+
|
|
|
+ /** 펌웨어 Build Date (년) */
|
|
|
+ public byte hFWVer_Year;
|
|
|
+ /** 펌웨어 Build Date (월) */
|
|
|
+ public byte hFWVer_Month;
|
|
|
+ /** 펌웨어 Build Date (일) */
|
|
|
+ public byte hFWVer_Day;
|
|
|
+ /** 펌웨어 Build Date (일련번호) */
|
|
|
+ public byte hFWVer_No;
|
|
|
+
|
|
|
+ /** 지원 프로토콜 버전 Main */
|
|
|
+ public byte hProtocolVer_Main;
|
|
|
+ /** 지원 프로토콜 버전 Sub */
|
|
|
+ public byte hProtocolVer_Sub;
|
|
|
+
|
|
|
+ /** 회로 타입 */
|
|
|
+ public byte[] hCircuitType;
|
|
|
+
|
|
|
+ public Info() {
|
|
|
+ bInstall = false;
|
|
|
+ hVendor = (byte) 0x00;
|
|
|
+ hCircuitCnt = (byte) 0x00;
|
|
|
+ hSupport01 = (byte) 0x00;
|
|
|
+ hSupport02 = (byte) 0x00;
|
|
|
+ hFWVer_Year = (byte) 0x00;
|
|
|
+ hFWVer_Month = (byte) 0x00;
|
|
|
+ hFWVer_Day = (byte) 0x00;
|
|
|
+ hFWVer_No = (byte) 0x00;
|
|
|
+ hProtocolVer_Main = (byte) 0x00;
|
|
|
+ hProtocolVer_Sub = (byte) 0x00;
|
|
|
+ if (0 < hCircuitCnt) {
|
|
|
+ hCircuitType = new byte[(int) hCircuitCnt];
|
|
|
+ for (int i = 0; i < 0; i++) hCircuitType[i] = DEVICE_TYPE.NOINFO;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public Info(byte hCircuitCnt) {
|
|
|
+ bInstall = false;
|
|
|
+ hVendor = (byte) 0x00;
|
|
|
+ this.hCircuitCnt = hCircuitCnt;
|
|
|
+ hSupport01 = (byte) 0x00;
|
|
|
+ hSupport02 = (byte) 0x00;
|
|
|
+ hFWVer_Year = (byte) 0x00;
|
|
|
+ hFWVer_Month = (byte) 0x00;
|
|
|
+ hFWVer_Day = (byte) 0x00;
|
|
|
+ hFWVer_No = (byte) 0x00;
|
|
|
+ hProtocolVer_Main = (byte) 0x00;
|
|
|
+ hProtocolVer_Sub = (byte) 0x00;
|
|
|
+ if (0 < this.hCircuitCnt) {
|
|
|
+ hCircuitType = new byte[(int) this.hCircuitCnt];
|
|
|
+ for (int i = 0; i < 0; i++) hCircuitType[i] = DEVICE_TYPE.NOINFO;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 디바이스 Info에 회로정보만 초기화
|
|
|
+ public void setInfoCircuitCnt(byte hCnt) {
|
|
|
+ hCircuitCnt = hCnt;
|
|
|
+ if (0 < hCircuitCnt) {
|
|
|
+ hCircuitType = new byte[(int) hCircuitCnt];
|
|
|
+ for (int i = 0; i < 0; i++) hCircuitType[i] = DEVICE_TYPE.NOINFO;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public String ToDebugString(byte hDeviceID) {
|
|
|
+ String strSubType = "0";
|
|
|
+ for (int i = 0; i < hCircuitCnt; i++) {
|
|
|
+ if (i == 0) strSubType = String.valueOf((int) hCircuitCnt) + "-";
|
|
|
+ else strSubType += "/" + String.format("0x%02X", hCircuitType[i]);
|
|
|
+ }
|
|
|
+
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "(" + (byte)(hDeviceID + 1) + ") Device - Info\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "Install : " + bInstall + "\r\n" +
|
|
|
+ "Vendor : " + String.format("0x%02X", hVendor) + "\r\n" +
|
|
|
+ "SubdeviceCnt : " + hCircuitCnt + "\r\n" +
|
|
|
+ "Support01 : " + hSupport01 + "\r\n" +
|
|
|
+ "Support02 : " + hSupport02 + "\r\n" +
|
|
|
+ "FWVer : " + (int)(hFWVer_Year +2000) + "." + hFWVer_Month + "." + hFWVer_Day + "." + hFWVer_No + "\r\n" +
|
|
|
+ "ProtocolVer : " + "V" + hProtocolVer_Main + "." + hProtocolVer_Sub + "\r\n" +
|
|
|
+ "SubDeviceType : " + strSubType + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** CookTop 데이터 클래스 */
|
|
|
+ /**
|
|
|
+ * 회로개수( 콘센트 - 범위 : 1~15)
|
|
|
+ */
|
|
|
+ public static class Circuit {
|
|
|
+
|
|
|
+ public Circuit() {
|
|
|
+ hID = (byte) 0x00;
|
|
|
+ hType = DEVICE_TYPE.NOINFO;
|
|
|
+ hStatus = DEVICE_STATUS.NOINFO;
|
|
|
+ hErrorStatus = (byte) 0x00;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 서브 기기 ID (Index)
|
|
|
+ * 1부터 시작하며, 연번이어야 함 (1~56)
|
|
|
+ */
|
|
|
+ public byte hID;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 디바이스 타입
|
|
|
+ * 0x00: 정보없음, 0x01: 가스밸브, 0x02: 쿡탑콘센트
|
|
|
+ */
|
|
|
+ public byte hType;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 제어기 상태
|
|
|
+ * 0x00: 정보없음, 0x01: 닫힘, 0x02: 동작중, 0x03: 열림
|
|
|
+ */
|
|
|
+ public byte hStatus;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 제어기 이상 상태
|
|
|
+ * BIT0: 제어기 이상, BIT1: 가스누출/전기누전, BIT2: 화재발생, BIT3: 가스/전기 센서 이상, BIT4: 화재센서 이상
|
|
|
+ */
|
|
|
+ public byte hErrorStatus;
|
|
|
+
|
|
|
+ /** 제어기 ID를 반환한다. */
|
|
|
+ public byte getCircuitID() {
|
|
|
+ byte hResult = hID;
|
|
|
+ return hResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 제어기 ID를 설정한다. */
|
|
|
+ public boolean setCircuitID(byte id) {
|
|
|
+ if (!DEVICE_ID.checkRange(id)) {
|
|
|
+ Log.w(TAG, "[setCircuitID] id is out of range!! -> id: " + id);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ hID = id;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 제어기 종류를 반환한다. */
|
|
|
+ public byte getCircuitType() {
|
|
|
+ byte hResult = hType;
|
|
|
+ return hResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 제어기 종류를 설정한다. */
|
|
|
+ public boolean setCircuitType(byte type) {
|
|
|
+ if (!DEVICE_TYPE.checkRange(type)) {
|
|
|
+ Log.w(TAG, "[setCircuitType] type is out of range!! -> type: " + type);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ hType = type;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 제어기 상태를 반환한다. */
|
|
|
+ public byte getCircuitStatus() {
|
|
|
+ byte hResult = hStatus;
|
|
|
+ return hResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 제어기 상태를 설정한다. */
|
|
|
+ public boolean setCircuitStatus(byte status) {
|
|
|
+ if (!DEVICE_STATUS.checkRange(status)) {
|
|
|
+ Log.w(TAG, "[setCircuitStatus] type is out of range!! -> status: " + status);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ hStatus = status;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 제어기 에러 전체 상태 정보를 저장한다. */
|
|
|
+ public void setErrorStatus(byte error) {
|
|
|
+ hErrorStatus = error;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 제어기 에러 전체 상태 정보를 반환한다. */
|
|
|
+ public byte getErrorStatus() {
|
|
|
+ byte hResult = hErrorStatus;
|
|
|
+ return hResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 개별 에러 상태 정보를 저장한다. - 제어기 이상 */
|
|
|
+ public void setErrorStatus_CtrlError(boolean bValue) {
|
|
|
+ if (bValue) hErrorStatus |= define.BIT0;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 개별 에러 상태 정보를 저장한다. - 가스누출/전기누전 */
|
|
|
+ public void setErrorStatus_Leakage(boolean bValue) {
|
|
|
+ if (bValue) hErrorStatus |= define.BIT1;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 개별 에러 상태 정보를 저장한다. - 화재발생 */
|
|
|
+ public void setErrorStatus_Fire(boolean bValue) {
|
|
|
+ if (bValue) hErrorStatus |= define.BIT2;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 개별 에러 상태 정보를 저장한다. - 가스/전기 센서 이상 */
|
|
|
+ public void setErrorStatus_DetectionSensorError(boolean bValue) {
|
|
|
+ if (bValue) hErrorStatus |= define.BIT3;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 개별 에러 상태 정보를 저장한다. - 화재 센서 이상*/
|
|
|
+ public void setErrorStatus_FireSensorError(boolean bValue) {
|
|
|
+ if (bValue) hErrorStatus |= define.BIT4;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 개별 에러 상태 정보를 반환한다. - 제어기 이상 */
|
|
|
+ public boolean getErrorStatus_CtrlError() {
|
|
|
+ if ((hErrorStatus & define.BIT0) != 0x00) return true;
|
|
|
+ else return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 개별 에러 상태 정보를 반환한다. - 가스누출/전기누전 */
|
|
|
+ public boolean getErrorStatus_Leakage() {
|
|
|
+ if ((hErrorStatus & define.BIT1) != 0x00) return true;
|
|
|
+ else return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 개별 에러 상태 정보를 반환한다. - 화재발생 */
|
|
|
+ public boolean getErrorStatus_Fire() {
|
|
|
+ if ((hErrorStatus & define.BIT2) != 0x00) return true;
|
|
|
+ else return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 개별 에러 상태 정보를 반환한다. - 가스/전기 센서 이상 */
|
|
|
+ public boolean getErrorStatus_DetectionSensorError() {
|
|
|
+ if ((hErrorStatus & define.BIT3) != 0x00) return true;
|
|
|
+ else return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 개별 에러 상태 정보를 반환한다. - 화재 센서 이상*/
|
|
|
+ public boolean getErrorStatus_FireSensorError() {
|
|
|
+ if ((hErrorStatus & define.BIT4) != 0x00) return true;
|
|
|
+ else return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String ToDebugString(byte hDeviceID) {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "(" + (byte)(hDeviceID + 1) + ") Device - Status\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "hID : " + String.format("0x%02X", hID) + "\r\n" +
|
|
|
+ "hType : " + String.format("0x%02X", hType) + "\r\n" +
|
|
|
+ "hStatus : " + String.format("0x%02X", hStatus) + "\r\n" +
|
|
|
+ "hErrorStatus : " + String.format("0x%02X", hErrorStatus) + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 디버깅 메시지 출력 */
|
|
|
+ public String ToDebugString(byte DeviceIdx) {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "(" + (byte)(DeviceIdx + 1) + ") Device - Circuit\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+
|
|
|
+ "hCircuitCnt : " + info.hCircuitCnt + "\r\n";
|
|
|
+ if (circuit != null) {
|
|
|
+ retStr += "CircuitInfo : ";
|
|
|
+ for (byte i = 0; i < info.hCircuitCnt; i++) {
|
|
|
+ retStr += "[" + (int) circuit[i].getCircuitID() + "] ";
|
|
|
+ retStr += DEVICE_TYPE.getString(circuit[i].getCircuitType()) + " / ";
|
|
|
+ retStr += DEVICE_TYPE.getString(circuit[i].getCircuitStatus()) + " / ";
|
|
|
+ retStr += DEVICE_TYPE.getString(circuit[i].getErrorStatus());
|
|
|
+ }
|
|
|
+ retStr += "\r\n";
|
|
|
+ }
|
|
|
+ retStr += "\r\n";
|
|
|
+
|
|
|
+ retStr += "==========================";
|
|
|
+
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+
|
|
|
+ ///////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ // 디바이스 ID
|
|
|
+ ///////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static final class DEVICE_ID {
|
|
|
+ public final static byte ID_MIN = (byte)0x01; // 최소 ID
|
|
|
+ public final static byte ID_MAX = (byte)0x0F; // 최대 ID
|
|
|
+
|
|
|
+ public static boolean checkRange(byte value) {
|
|
|
+ if (value < ID_MIN || ID_MAX < value) return false;
|
|
|
+ else return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ///////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ // 디바이스 종류
|
|
|
+ ///////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static final class DEVICE_TYPE {
|
|
|
+ public final static byte NOINFO = (byte)0x00; // 정보없음
|
|
|
+ public final static byte GASVALVE = (byte)0x01; // 가스밸브
|
|
|
+ public final static byte OUTLET = (byte)0x02; // 쿡탑콘센트
|
|
|
+
|
|
|
+ public static boolean checkRange(byte value) {
|
|
|
+ if (value < NOINFO || OUTLET < value) return false;
|
|
|
+ else return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String getString(byte value) {
|
|
|
+ if (value == NOINFO) return "NOINFO";
|
|
|
+ else if (value == GASVALVE) return "GASVALVE";
|
|
|
+ else if (value == OUTLET) return "OUTLET";
|
|
|
+ else return "NONE";
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ///////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ // 디바이스 동작 상태
|
|
|
+ ///////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static final class DEVICE_STATUS {
|
|
|
+ public final static byte NOINFO = (byte)0x00; // 정보없음
|
|
|
+ public final static byte CLOSE = (byte)0x01; // 닫힘
|
|
|
+ public final static byte WORKING = (byte)0x02; // 동작중
|
|
|
+ public final static byte OPEN = (byte)0x03; // 열림
|
|
|
+
|
|
|
+ public static boolean checkRange(byte value) {
|
|
|
+ if (value < NOINFO || OPEN < value) return false;
|
|
|
+ else return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String getString(byte value) {
|
|
|
+ if (value == NOINFO) return "NOINFO";
|
|
|
+ else if (value == CLOSE) return "CLOSE";
|
|
|
+ else if (value == WORKING) return "WORKING";
|
|
|
+ else if (value == OPEN) return "OPEN";
|
|
|
+ else return "NONE";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /** [커튼제어기v1/Curtain Controller] 데이터 클래스*/
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ /////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static class CurtainCtrl {
|
|
|
+
|
|
|
+ public Info info;
|
|
|
+ public Curtain crutain;
|
|
|
+
|
|
|
+ public CurtainCtrl() {
|
|
|
+ info = new Info();
|
|
|
+ crutain = new Curtain();
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 보드정보 */
|
|
|
+ public static class Info {
|
|
|
+ /** 설치상태 (true:설치 , false:미설치) */
|
|
|
+ public boolean bInstall;
|
|
|
+
|
|
|
+ public Info() {
|
|
|
+ bInstall = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /** Curtain 데이터 클래스 */
|
|
|
+ /**
|
|
|
+ * 회로개수( 콘센트 - 범위 : 0x1~0xF)
|
|
|
+ */
|
|
|
+ public static class Curtain {
|
|
|
+
|
|
|
+ public Curtain() {
|
|
|
+ hGroupID = (byte) 0x80;
|
|
|
+ hStatus = DEVICE_STATUS.CLOSE;
|
|
|
+ hErrorStatus = (byte) 0x00;
|
|
|
+ GroupCount = (byte) 0x00;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 그룹 ID (Index)
|
|
|
+ * 0x80(거실) 또는 0x90(안방)
|
|
|
+ */
|
|
|
+ protected byte hGroupID;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 그룹개수
|
|
|
+ */
|
|
|
+ protected byte GroupCount;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 그룹개수 설정
|
|
|
+ * @param Count 그룹개수
|
|
|
+ */
|
|
|
+ public void setGroupCount(byte Count)
|
|
|
+ {
|
|
|
+ GroupCount = Count;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 그룹갯수 가져오기
|
|
|
+ * @return 그룹개수
|
|
|
+ */
|
|
|
+ public byte getGroupCount()
|
|
|
+ {
|
|
|
+ return GroupCount;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * ID (Index)
|
|
|
+ * 거실(0x80) : 81 ~ 8F
|
|
|
+ * 안방(0x90) : 91 ~9F
|
|
|
+ */
|
|
|
+ protected byte hID;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 제어기 상태
|
|
|
+ * 0x00: 닫힘, 0x01: 열림, 0x02: 여는동작중, 0x03: 닫는동작중
|
|
|
+ */
|
|
|
+ protected byte hStatus;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 제어기 이상 상태
|
|
|
+ * BIT0: 제어기 이상, BIT1: 모터이상, BIT2: 커튼이상
|
|
|
+ */
|
|
|
+ protected byte hErrorStatus;
|
|
|
+
|
|
|
+
|
|
|
+ /** 제어기 ID를 반환한다. */
|
|
|
+ public byte getCurtainID() {
|
|
|
+ byte hResult = hID;
|
|
|
+ return hResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * ID 지정
|
|
|
+ * @param ID
|
|
|
+ */
|
|
|
+ public void setCurtainID(byte ID)
|
|
|
+ {
|
|
|
+ hID = ID;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 제어기 그룹 ID를 반환한다. 80: 거실, 90안방*/
|
|
|
+ public byte getCurtainGroupID() {
|
|
|
+ byte hResult = hGroupID;
|
|
|
+ return hResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Group ID 설정
|
|
|
+ * @param ID
|
|
|
+ */
|
|
|
+ public void setCurtainGroupID(byte ID)
|
|
|
+ {
|
|
|
+ hGroupID = ID;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /** 제어기 상태를 반환한다. */
|
|
|
+ public byte getCurtainStatus() {
|
|
|
+ byte hResult = hStatus;
|
|
|
+ return hResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 제어기 상태를 설정한다. */
|
|
|
+ public boolean setCurtainStatus(byte status) {
|
|
|
+ if (!DEVICE_STATUS.checkRange(status)) {
|
|
|
+ Log.w(TAG, "[setCircuitStatus] type is out of range!! -> status: " + status);
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ hStatus = status;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean hDeiveError = false;
|
|
|
+ public boolean hMotorError = false;
|
|
|
+ public boolean hCurtainError = false;
|
|
|
+
|
|
|
+ /** 제어기 에러 전체 상태 정보를 저장한다. */
|
|
|
+ public void setErrorStatus(byte error) {
|
|
|
+ if ((error& define.BIT0) != 0x00) hDeiveError = true;
|
|
|
+ if ((error& define.BIT1) != 0x00) hMotorError = true;
|
|
|
+ if ((error& define.BIT2) != 0x00) hCurtainError = true;
|
|
|
+ hErrorStatus = error;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 제어기 에러 전체 상태 정보를 반환한다. */
|
|
|
+ public byte getErrorStatus() {
|
|
|
+ byte hResult = hErrorStatus;
|
|
|
+ return hResult;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String ToDebugString(byte hDeviceID) {
|
|
|
+ String retStr =
|
|
|
+ "==========================\r\n" +
|
|
|
+ "(" + (byte)(hDeviceID + 1) + ") Device - Status\r\n" +
|
|
|
+ "==========================\r\n" +
|
|
|
+ "hGroupID : " + String.format("0x%02X", hGroupID) + "\r\n" +
|
|
|
+ "hID : " + String.format("0x%02X", hID) + "\r\n" +
|
|
|
+ "hStatus : " + String.format("0x%02X", hStatus) + "\r\n" +
|
|
|
+ "hErrorStatus : " + String.format("0x%02X", hErrorStatus) + "\r\n" +
|
|
|
+ "==========================";
|
|
|
+ return retStr;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ ///////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ // 디바이스 ID
|
|
|
+ ///////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static final class DEVICE_ID {
|
|
|
+ public final static byte ID_MIN = (byte)0x01; // 최소 ID
|
|
|
+ public final static byte ID_MAX = (byte)0x0F; // 최대 ID
|
|
|
+
|
|
|
+ public static boolean checkRange(byte value) {
|
|
|
+ if (value < ID_MIN || ID_MAX < value) return false;
|
|
|
+ else return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ ///////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ // 디바이스 동작 상태
|
|
|
+ ///////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+ public static final class DEVICE_STATUS {
|
|
|
+ public final static byte CLOSE = (byte)0x00; // 닫힘
|
|
|
+ public final static byte OPEN = (byte)0x01; // 열림
|
|
|
+ public final static byte OPENING = (byte)0x02; // 열고 있는중
|
|
|
+ public final static byte CLOSING = (byte)0x03; // 닫는중
|
|
|
+
|
|
|
+ public static boolean checkRange(byte value) {
|
|
|
+ if (value < CLOSE || CLOSING < value) return false;
|
|
|
+ else return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static String getString(byte value) {
|
|
|
+ if (value == CLOSE) return "CLOSE";
|
|
|
+ else if (value == OPEN) return "OPEN";
|
|
|
+ else if (value == OPENING) return "OPENING";
|
|
|
+ else if (value == CLOSING) return "CLOSING";
|
|
|
+ else return "NONE";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|