package com.hdl.sdk.hdl_core.HDLAppliances.HDLSecurity;
|
|
|
import com.hdl.sdk.hdl_core.HDLAppliances.HDLSecurity.Parser.SecurityParser;
|
import com.hdl.sdk.hdl_core.HDLDeviceManger.Bean.AppliancesInfo;
|
import com.hdl.sdk.hdl_core.HDLDeviceManger.Bean.SecurityStateBean;
|
|
/**
|
* Created by JLChen on 2019/7/29
|
* 安防模块
|
*/
|
public class SecurityBackInfo {
|
|
private AppliancesInfo appliancesInfo;
|
private String remarks;
|
private int channelNum; //回路号
|
private SecurityStateBean mSecurityStateBean;
|
|
private byte[] curState; //返回信息
|
|
public SecurityBackInfo() {
|
|
}
|
|
public SecurityBackInfo(AppliancesInfo mAppliancesInfo) {
|
this.appliancesInfo = mAppliancesInfo;
|
this.remarks = mAppliancesInfo.getRemarks();
|
this.curState = mAppliancesInfo.getArrCurState();
|
this.mSecurityStateBean = new SecurityStateBean();
|
|
if (this.curState == null) return;
|
|
if (this.curState.length >= 3) {
|
this.channelNum = this.curState[0] & 0xFF;
|
this.mSecurityStateBean.alarmCurrent = this.curState[1] & 0x10;
|
this.mSecurityStateBean.alarmEmergency = this.curState[1] & 0x08;
|
this.mSecurityStateBean.alarmSudden = this.curState[1] & 0x04;
|
this.mSecurityStateBean.alarmGas = this.curState[1] & 0x02;
|
this.mSecurityStateBean.alarmFire = this.curState[1] & 0x01;
|
this.mSecurityStateBean.alarmTemperature = this.curState[2] & 0x80;
|
this.mSecurityStateBean.alarmPower = this.curState[2] & 0x40;
|
this.mSecurityStateBean.alarmSilent = this.curState[2] & 0x20;
|
int mCurState = this.curState[2] & 0x1F;
|
|
switch (mCurState) {
|
case 0:
|
this.mSecurityStateBean.armingState = SecurityParser.ARMING_DISARMING;//撤防状态
|
break;
|
case 1:
|
this.mSecurityStateBean.armingState = SecurityParser.ARMING_HOLIDAY;//假期布防
|
break;
|
case 2:
|
this.mSecurityStateBean.armingState = SecurityParser.ARMING_LEAVE;//离开布防
|
break;
|
case 4:
|
this.mSecurityStateBean.armingState = SecurityParser.ARMING_AT_NIGHT;//夜间布防
|
break;
|
case 8:
|
this.mSecurityStateBean.armingState = SecurityParser.ARMING_AT_NIGHT_WITH_GUEST;//晚上有客布防
|
break;
|
case 10:
|
this.mSecurityStateBean.armingState = SecurityParser.ARMING_DURING_THE_DAY;//白天布防
|
break;
|
default:
|
// this.armingState = SecurityParser.ARMING_DISARMING;//撤防状态
|
this.mSecurityStateBean.armingState = -1; //未知状态
|
break;
|
}
|
|
|
}
|
|
}
|
|
|
public AppliancesInfo getAppliancesInfo() {
|
return appliancesInfo;
|
}
|
|
public void setAppliancesInfo(AppliancesInfo appliancesInfo) {
|
this.appliancesInfo = appliancesInfo;
|
}
|
|
public String getRemarks() {
|
return remarks;
|
}
|
|
public void setRemarks(String remarks) {
|
this.remarks = remarks;
|
}
|
|
public int getChannelNum() {
|
return channelNum;
|
}
|
|
public void setChannelNum(int channelNum) {
|
this.channelNum = channelNum;
|
}
|
|
public SecurityStateBean getSecurityStateBean() {
|
return mSecurityStateBean;
|
}
|
|
public void setSecurityStateBean(SecurityStateBean securityStateBean) {
|
mSecurityStateBean = securityStateBean;
|
}
|
|
public byte[] getCurState() {
|
return curState;
|
}
|
|
public void setCurState(byte[] curState) {
|
this.curState = curState;
|
}
|
}
|
|
|
// Bit 4 0 = 正常状态 , 1 = 电流报警
|
// Bit 3 0 =正常状态, 1 = 紧急报警
|
// Bit 2 0 =正常状态, 1 = 突发报警
|
// Bit 1 0 =正常状态, 1 = 煤气报警
|
// Bit 0 0 =正常状态, 1 = 火警 3
|
//
|
// Encode Bit Value
|
// Bit 7 0 =正常状态, 1 = 温度报警
|
// Bit 6 0 =正常状态, 1 = 功率报警
|
// Bit 5 0 =正常状态, 1 = 无声报警
|
// Bit 4 0 =正常状态, 1 = 白天布防状态
|
// Bit 3 0 =正常状态, 1 = 晚上有客布防
|
// Bit 2 0 =正常状态, 1 = 夜间布防
|
// Bit 1 0 =正常状态, 1 = 离开布防
|
// Bit 0 0 =正常状态, 1 = 假期布防
|