From 81d297dd33911dbfdc93dbc3fa9747e511b7ce8e Mon Sep 17 00:00:00 2001
From: panlili2024 <14743743+panlili2024@user.noreply.gitee.com>
Date: 星期五, 08 十一月 2024 14:51:10 +0800
Subject: [PATCH] 优化透传数据解析
---
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLCurtain/CurtainCtrlBackInfo.java | 78 +++++++++++++++++++++++++++++++++++++-
1 files changed, 75 insertions(+), 3 deletions(-)
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLCurtain/CurtainCtrlBackInfo.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLCurtain/CurtainCtrlBackInfo.java
index f1d1c09..70573c4 100644
--- a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLCurtain/CurtainCtrlBackInfo.java
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLCurtain/CurtainCtrlBackInfo.java
@@ -1,9 +1,13 @@
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.
@@ -11,17 +15,57 @@
*/
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() {
@@ -64,13 +108,41 @@
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) +
'}';
}
}
--
Gitblit v1.8.0