| | |
| | | package com.hdl.sdk.ttl.HDLAppliances.HDLCurtain; |
| | | |
| | | |
| | | import android.util.Log; |
| | | |
| | | import com.hdl.sdk.ttl.HDLAppliances.HDLCurtain.Parser.CurtainCtrlParser; |
| | | import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Arrays; |
| | | |
| | | /** |
| | | * Created by djl on 2017/4/1. |
| | |
| | | */ |
| | | |
| | | public class CurtainCtrlBackInfo implements Serializable { |
| | | public AppliancesInfo appliancesInfo; |
| | | //窗帘号 |
| | | int num; |
| | | |
| | | int state; |
| | | int state;//0=停;1=开;2=关 |
| | | int precent;//百分比 |
| | | int type;//功能类型 |
| | | |
| | | String remarks; |
| | | |
| | | String parentRemarks; |
| | | private byte[] curState;//控制回馈信息 |
| | | |
| | | public AppliancesInfo appliancesInfo; |
| | | public CurtainCtrlBackInfo() { |
| | | |
| | | } |
| | | |
| | | public CurtainCtrlBackInfo(AppliancesInfo mAppliancesInfo) { |
| | | this.appliancesInfo = mAppliancesInfo; |
| | | this.curState = mAppliancesInfo.getArrCurState(); |
| | | this.remarks = mAppliancesInfo.getRemarks(); |
| | | |
| | | if (this.curState == null) return; |
| | | |
| | | if (this.curState.length >= 3) { |
| | | this.type = this.curState[2] & 0xFF; |
| | | Log.d("panlili", "CurtainCtrlBackInfo.java:CurtainCtrlBackInfo----->type= " + type); |
| | | if (type == 1) {//=窗帘控制V1.1开关停 |
| | | this.state = this.curState[1] & 0xFF; |
| | | switch (state) {//这里改成0,1,2 |
| | | case 0: |
| | | state = CurtainCtrlParser.curtainPause; |
| | | break; |
| | | case 1: |
| | | state = CurtainCtrlParser.curtainOn; |
| | | break; |
| | | case 2: |
| | | state = CurtainCtrlParser.curtainOff; |
| | | break; |
| | | default: |
| | | state = 0; |
| | | break; |
| | | } |
| | | } else if (type == 2) {//=窗帘控制V1.1百分比 |
| | | this.precent = this.curState[1] & 0xFF; |
| | | } else if (type == 0) { |
| | | this.state = this.curState[1] & 0xFF; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | public String getRemarks() { |
| | |
| | | this.parentRemarks = parentRemarks; |
| | | } |
| | | |
| | | public int getPrecent() { |
| | | return precent; |
| | | } |
| | | |
| | | public void setPrecent(int precent) { |
| | | this.precent = precent; |
| | | } |
| | | |
| | | public int getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(int type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public byte[] getCurState() { |
| | | return curState; |
| | | } |
| | | |
| | | public void setCurState(byte[] curState) { |
| | | this.curState = curState; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "CurtainCtrlBackInfo{" + |
| | | "num=" + num + |
| | | "appliancesInfo=" + appliancesInfo + |
| | | ", num=" + num + |
| | | ", state=" + state + |
| | | ", precent=" + precent + |
| | | ", type=" + type + |
| | | ", remarks='" + remarks + '\'' + |
| | | ", parentRemarks='" + parentRemarks + '\'' + |
| | | ", curState=" + Arrays.toString(curState) + |
| | | '}'; |
| | | } |
| | | } |