From 566ddb2ea03e2514de50f2ca861a2674f6e840ac Mon Sep 17 00:00:00 2001
From: 562935844@qq.com
Date: 星期一, 27 十一月 2023 13:32:27 +0800
Subject: [PATCH] 新增科技系统、门锁、新风和地暖支持
---
app/src/main/java/com/hdl/sdk/ttl_sdk/activity/FreshAirActivity.java | 413 ++
app/src/main/java/com/hdl/sdk/ttl_sdk/activity/AppliancesListActivity.java | 37
app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlAirActivity.java | 127
app/src/main/java/com/hdl/sdk/ttl_sdk/activity/FreshAirJinMaoActivity.java | 461 +++
app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlCurtainActivity.java | 2
app/src/main/res/layout/activity_ctrl_jinmao_freshair.xml | 166 +
.idea/encodings.xml | 4
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLSecurity/Parser/SecurityParser.java | 1
app/src/main/res/mipmap-mdpi/icon_fresh_air.png | 0
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/DoorMachineFeedFristBackEvent.java | 31
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLDeviceManager.java | 1126 ++++---
.idea/misc.xml | 24
app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlLightActivity.java | 61
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Utils/HDLUtlis/AesUtil.java | 161 +
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAirCondition/AirTechSysBackInfo.java | 120
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLLight/ColourLightCtrlBackInfo.java | 145 +
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAirCondition/AirHVACBackInfo.java | 10
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLLight/Parser/LightCtrlParser.java | 61
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/ColourLightFeedBackEvent.java | 30
app/build.gradle | 3
app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlActivity.java | 25
app/src/main/res/layout/activity_ctrl_technology_system.xml | 69
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Config/Configuration.java | 102
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLDoorMachine/DoorMachineFristBackInfo.java | 71
app/src/main/res/layout/activity_ctrl_light.xml | 35
app/src/main/res/layout/activity_ctrl_air_hvac.xml | 2
app/src/main/res/layout/activity_door_machine.xml | 48
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/FreshAirFeedBackEvent.java | 28
app/src/main/java/com/hdl/sdk/ttl_sdk/activity/DoorMachineActivity.java | 334 ++
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLDoorMachine/Parser/DoorMachineParser.java | 161 +
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLSerialPortCore.java | 61
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/DoorMachineFeedBackEvent.java | 32
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLGeothermal/GeothermalBackInfo.java | 173 +
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/AppliancesInfo.java | 21
app/src/main/java/com/hdl/sdk/ttl_sdk/activity/SensorActivity.java | 83
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/AirTechSysFeedBackEvent.java | 28
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Utils/HDLUtlis/HDLUtlis.java | 49
app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlColourLightActivity.java | 321 ++
app/src/main/res/layout/activity_ctrl.xml | 8
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HandleSearch.java | 14
app/src/main/java/com/hdl/sdk/ttl_sdk/HDLApplication.java | 2
app/src/main/res/layout/activity_geothermal.xml | 65
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Utils/HDLUtlis/CommonHelper.java | 79
app/src/main/java/com/hdl/sdk/ttl_sdk/activity/MainActivity.java | 13
app/src/main/res/layout/activity_sensor.xml | 9
app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlAirTechSysActivity.java | 314 ++
app/src/main/res/mipmap-mdpi/ic_geothermal.png | 0
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLFreshAir/Parser/FreshAirJinMaoParser.java | 139
app/src/main/java/com/hdl/sdk/ttl_sdk/adapter/HDLAppliancesListAdapter.java | 29
app/src/main/res/layout/activity_ctrl_common_switch.xml | 2
app/src/main/res/layout/activity_fresh_air.xml | 54
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLGeothermal/Parser/GeothermalParser.java | 201 +
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/GeothermalFeedBackEvent.java | 42
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLDoorMachine/DoorMachineWaringBackInfo.java | 21
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLDoorMachine/DoorMachineBackInfo.java | 107
app/src/main/res/layout/activity_ctrl_air.xml | 2
HDL_TTLSDK485/build.gradle | 13
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/Config/HDLApConfig.java | 24
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Parser/DeviceParser.java | 241 +
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLFreshAir/Parser/FreshAirParser.java | 100
app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlAirHVACActivity.java | 2
app/src/main/java/com/hdl/sdk/ttl_sdk/activity/GeothermalActivity.java | 383 ++
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLFreshAir/FreshAirBackInfo.java | 182 +
app/src/main/res/values/attrs.xml | 424 ++
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLCommand.java | 474 +++
app/src/main/AndroidManifest.xml | 6
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/FreshAirJinMaoFeedBackEvent.java | 27
/dev/null | 0
app/src/main/java/com/hdl/sdk/ttl_sdk/utlis/RGBColorPicker.java | 463 +++
app/src/main/res/mipmap-mdpi/icon_common_switch.png | 0
app/src/main/res/layout/activity_ctrl_colour_light.xml | 105
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAirCondition/Parser/AirCtrlParser.java | 337 +-
app/src/main/res/layout/activity_ctrl_logic.xml | 2
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLFreshAir/FreshAirJinMaoBackInfo.java | 180 +
74 files changed, 7,579 insertions(+), 1,111 deletions(-)
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
index 15a15b2..97626ba 100644
--- a/.idea/encodings.xml
+++ b/.idea/encodings.xml
@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
- <component name="Encoding" addBOMForNewFiles="with NO BOM" />
+ <component name="Encoding">
+ <file url="PROJECT" charset="UTF-8" />
+ </component>
</project>
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index fdb9c66..4b6796a 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,10 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
+ <component name="DesignSurface">
+ <option name="filePathToZoomLevelMap">
+ <map>
+ <entry key="..\:/HDL/ProjectCode/Android_HDL_SDK_TTL485/app/src/main/res/layout/activity_appliances_new.xml" value="0.3494791666666667" />
+ <entry key="..\:/HDL/ProjectCode/Android_HDL_SDK_TTL485/app/src/main/res/layout/activity_ctrl.xml" value="0.3494791666666667" />
+ <entry key="..\:/HDL/ProjectCode/Android_HDL_SDK_TTL485/app/src/main/res/layout/activity_ctrl_air.xml" value="0.3494791666666667" />
+ <entry key="..\:/HDL/ProjectCode/Android_HDL_SDK_TTL485/app/src/main/res/layout/activity_ctrl_air_hvac.xml" value="0.3494791666666667" />
+ <entry key="..\:/HDL/ProjectCode/Android_HDL_SDK_TTL485/app/src/main/res/layout/activity_ctrl_colour_light.xml" value="0.3494791666666667" />
+ <entry key="..\:/HDL/ProjectCode/Android_HDL_SDK_TTL485/app/src/main/res/layout/activity_ctrl_common_switch.xml" value="0.3494791666666667" />
+ <entry key="..\:/HDL/ProjectCode/Android_HDL_SDK_TTL485/app/src/main/res/layout/activity_ctrl_curtain.xml" value="0.3536458333333333" />
+ <entry key="..\:/HDL/ProjectCode/Android_HDL_SDK_TTL485/app/src/main/res/layout/activity_ctrl_jinmao_freshair.xml" value="0.3494791666666667" />
+ <entry key="..\:/HDL/ProjectCode/Android_HDL_SDK_TTL485/app/src/main/res/layout/activity_ctrl_light.xml" value="0.3536458333333333" />
+ <entry key="..\:/HDL/ProjectCode/Android_HDL_SDK_TTL485/app/src/main/res/layout/activity_ctrl_logic.xml" value="0.3494791666666667" />
+ <entry key="..\:/HDL/ProjectCode/Android_HDL_SDK_TTL485/app/src/main/res/layout/activity_ctrl_technology_system.xml" value="0.3536458333333333" />
+ <entry key="..\:/HDL/ProjectCode/Android_HDL_SDK_TTL485/app/src/main/res/layout/activity_door_machine.xml" value="0.3536458333333333" />
+ <entry key="..\:/HDL/ProjectCode/Android_HDL_SDK_TTL485/app/src/main/res/layout/activity_fresh_air.xml" value="0.3536458333333333" />
+ <entry key="..\:/HDL/ProjectCode/Android_HDL_SDK_TTL485/app/src/main/res/layout/activity_geothermal.xml" value="0.3536458333333333" />
+ <entry key="..\:/HDL/ProjectCode/Android_HDL_SDK_TTL485/app/src/main/res/layout/activity_send_test.xml" value="0.3494791666666667" />
+ <entry key="..\:/HDL/ProjectCode/Android_HDL_SDK_TTL485/app/src/main/res/layout/activity_sensor.xml" value="0.3494791666666667" />
+ <entry key="..\:/HDL/ProjectCode/Android_HDL_SDK_TTL485/app/src/main/res/layout/list_item_appliances.xml" value="0.3494791666666667" />
+ </map>
+ </option>
+ </component>
<component name="EntryPointsManager">
<list size="1">
<item index="0" class="java.lang.String" itemvalue="android.support.annotation.IntDef" />
</list>
</component>
+ <component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="JavadocGenerationManager">
<option name="OUTPUT_DIRECTORY" value="$PROJECT_DIR$/../鍏朵粬/doc" />
<option name="OTHER_OPTIONS" value="-encoding utf-8 -charset utf-8" />
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
deleted file mode 100644
index 7f68460..0000000
--- a/.idea/runConfigurations.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="RunConfigurationProducerService">
- <option name="ignoredProducers">
- <set>
- <option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
- <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
- <option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
- </set>
- </option>
- </component>
-</project>
\ No newline at end of file
diff --git a/HDL_TTLSDK485/build.gradle b/HDL_TTLSDK485/build.gradle
index 06f5296..922a725 100644
--- a/HDL_TTLSDK485/build.gradle
+++ b/HDL_TTLSDK485/build.gradle
@@ -7,13 +7,13 @@
defaultConfig {
minSdkVersion 17
targetSdkVersion 28
- versionCode 1
- versionName "1.0.1"
+ versionCode 2
+ versionName "1.1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk {
moduleName "serial_port"
- abiFilters "armeabi-v7a","x86"
+ abiFilters "armeabi-v7a", "x86", "arm64-v8a"
}
}
buildTypes {
@@ -52,10 +52,11 @@
}
dependencies {
- implementation fileTree(include: ['*.jar','*.aar'], dir: 'libs')
+ implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
api 'org.greenrobot:eventbus:3.0.0'
-// api 'com.google.code.gson:gson:2.8.5'
+ api 'com.google.code.gson:gson:2.8.8'
+ api 'com.licheedev:android-serialport:2.1.3'
// testImplementation 'junit:junit:4.12'
// androidTestImplementation 'com.android.support.test:runner:1.0.2'
// androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
@@ -78,8 +79,6 @@
// rename ('classes.jar','test.jar')
//}
//makeJar.dependsOn(build)
-
-
//publish {
diff --git a/HDL_TTLSDK485/libs/armeabi-v7a/libserial_port.so b/HDL_TTLSDK485/libs/armeabi-v7a/libserial_port.so
deleted file mode 100644
index 6b230b9..0000000
--- a/HDL_TTLSDK485/libs/armeabi-v7a/libserial_port.so
+++ /dev/null
Binary files differ
diff --git a/HDL_TTLSDK485/libs/gson-2.8.5.jar b/HDL_TTLSDK485/libs/gson-2.8.5.jar
deleted file mode 100644
index 0d5baf3..0000000
--- a/HDL_TTLSDK485/libs/gson-2.8.5.jar
+++ /dev/null
Binary files differ
diff --git a/HDL_TTLSDK485/libs/x86/libserial_port.so b/HDL_TTLSDK485/libs/x86/libserial_port.so
deleted file mode 100644
index 1039113..0000000
--- a/HDL_TTLSDK485/libs/x86/libserial_port.so
+++ /dev/null
Binary files differ
diff --git a/HDL_TTLSDK485/src/main/java/android/serialport/api/SerialPort.java b/HDL_TTLSDK485/src/main/java/android/serialport/api/SerialPort.java
deleted file mode 100644
index 445b9ea..0000000
--- a/HDL_TTLSDK485/src/main/java/android/serialport/api/SerialPort.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2009 Cedric Priscal
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.serialport.api;
-
-import java.io.File;
-import java.io.FileDescriptor;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import android.util.Log;
-
-public class SerialPort {
-
- private static final String TAG = "SerialPort";
-
- /*
- * Do not remove or rename the field mFd: it is used by native method
- * close();
- */
- private FileDescriptor mFd;
- private FileInputStream mFileInputStream;
- private FileOutputStream mFileOutputStream;
-
- public SerialPort(File device, int baudrate, int flags) throws SecurityException, IOException {
-
-// /* Check access permission */
-// if (!device.canRead() || !device.canWrite()) {
-// try {
-// /* Missing read/write permission, trying to chmod the file */
-// Process su;
-// su = Runtime.getRuntime().exec("/system/bin/su");
-// String cmd = "chmod 666 " + device.getAbsolutePath() + "\n" + "exit\n";
-// su.getOutputStream().write(cmd.getBytes());
-// if ((su.waitFor() != 0) || !device.canRead() || !device.canWrite()) {
-// throw new SecurityException();
-// }
-// } catch (Exception e) {
-// e.printStackTrace();
-// throw new SecurityException();
-// }
-// }
-
- mFd = open(device.getAbsolutePath(), baudrate, flags);
- if (mFd == null) {
- Log.e(TAG, "native open returns null");
- throw new IOException();
- }
- mFileInputStream = new FileInputStream(mFd);
- mFileOutputStream = new FileOutputStream(mFd);
- }
-
- // Getters and setters
- public InputStream getInputStream() {
- return mFileInputStream;
- }
-
- public OutputStream getOutputStream() {
- return mFileOutputStream;
- }
-
- // JNI
- private native static FileDescriptor open(String path, int baudrate, int flags);
-
- public native void close();
-
- public static native int BackLight_ON();
-
- public static native int BackLight_OFF();
-
-
- static {
- System.loadLibrary("serial_port");
- }
-}
diff --git a/HDL_TTLSDK485/src/main/java/android/serialport/api/SerialPortFinder.java b/HDL_TTLSDK485/src/main/java/android/serialport/api/SerialPortFinder.java
deleted file mode 100644
index 0d80d1a..0000000
--- a/HDL_TTLSDK485/src/main/java/android/serialport/api/SerialPortFinder.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright 2009 Cedric Priscal
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.serialport.api;
-
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.LineNumberReader;
-import java.util.Iterator;
-import java.util.Vector;
-
-import android.util.Log;
-
-public class SerialPortFinder {
-
- public class Driver {
- public Driver(String name, String root) {
- mDriverName = name;
- mDeviceRoot = root;
- }
-
- private String mDriverName;
- private String mDeviceRoot;
- Vector<File> mDevices = null;
-
- public Vector<File> getDevices() {
- if (mDevices == null) {
- mDevices = new Vector<File>();
- File dev = new File("/dev");
- File[] files = dev.listFiles();
- int i;
- for (i = 0; i < files.length; i++) {
- if (files[i].getAbsolutePath().startsWith(mDeviceRoot)) {
- Log.d(TAG, "Found new device: " + files[i]);
- mDevices.add(files[i]);
- }
- }
- }
- return mDevices;
- }
-
- public String getName() {
- return mDriverName;
- }
- }
-
- private static final String TAG = "SerialPort";
-
- private Vector<Driver> mDrivers = null;
-
- Vector<Driver> getDrivers() throws IOException {
- if (mDrivers == null) {
- mDrivers = new Vector<Driver>();
- LineNumberReader r = new LineNumberReader(new FileReader("/proc/tty/drivers"));
- String l;
- while ((l = r.readLine()) != null) {
- // Issue 3:
- // Since driver name may contain spaces, we do not extract
- // driver name with split()
- String drivername = l.substring(0, 0x15).trim();
- String[] w = l.split(" +");
- if ((w.length >= 5) && (w[w.length - 1].equals("serial"))) {
- Log.d(TAG, "Found new driver " + drivername + " on " + w[w.length - 4]);
- // mDrivers.add(new Driver(drivername, w[w.length-4]));
- mDrivers.add(new Driver(drivername, w[w.length - 4]));
- }
- }
- r.close();
- }
- return mDrivers;
- }
-
- public String[] getAllDevices() {
- Vector<String> devices = new Vector<String>();
- // Parse each driver
- Iterator<Driver> itdriv;
- try {
- itdriv = getDrivers().iterator();
- while (itdriv.hasNext()) {
- Driver driver = itdriv.next();
- Iterator<File> itdev = driver.getDevices().iterator();
- while (itdev.hasNext()) {
- String device = itdev.next().getName();
- String value = String.format("%s (%s)", device, driver.getName());
- devices.add(value);
- }
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- return devices.toArray(new String[devices.size()]);
- }
-
- public String[] getAllDevicesPath() {
- Vector<String> devices = new Vector<String>();
- // Parse each driver
- Iterator<Driver> itdriv;
- try {
- itdriv = getDrivers().iterator();
- while (itdriv.hasNext()) {
- Driver driver = itdriv.next();
- Iterator<File> itdev = driver.getDevices().iterator();
- while (itdev.hasNext()) {
- String device = itdev.next().getAbsolutePath();
- devices.add(device);
- }
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- return devices.toArray(new String[devices.size()]);
- }
-}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Config/Configuration.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Config/Configuration.java
index 172ffc9..2766550 100644
--- a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Config/Configuration.java
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Config/Configuration.java
@@ -6,24 +6,53 @@
//瀹剁數绫诲瀷鐮�
//澶х被
- /**鐏厜绫�*/
+ /**
+ * 鐏厜绫�
+ */
public static final int LIGTH_BIG_TYPE = 1; //
- /**绐楀笜绫�*/
+ /**
+ * 绐楀笜绫�
+ */
public static final int CURTAIN_BIG_TYPE = 2;
- /**浼犳劅鍣ㄧ被*/
- public static final int SENSOR_BIG_TYPE = 5;//2019-07-03 灞忚斀 2019-11-1 鍘诲睆钄�
- /**绌鸿皟绫�*/
+ /**
+ * 浼犳劅鍣ㄧ被
+ */
+ public static final int SENSOR_BIG_TYPE = 5;
+ /**
+ * 绌鸿皟绫�
+ */
public static final int AIR_BIG_TYPE = 7;
- /**鑳屾櫙闊充箰绫�*/
+ /**
+ * 鍦扮儹妯″潡
+ */
+ public static final int GEOTHERMAL_BIG_TYPE = 8;
+ /**
+ * 鑳屾櫙闊充箰绫�
+ */
public static final int AUDIO_BIG_TYPE = 9;
- /**瀹夐槻鍔熻兘*/
+ /**
+ * 瀹夐槻鍔熻兘
+ */
public static final int SECURITY_BIG_TYPE = 10;
- /**閫昏緫鍔熻兘绫�*/
+ /**
+ * 閫昏緫鍔熻兘绫�
+ */
public static final int LOGIC_BIG_TYPE = 12;
- /**鍏ㄥ眬鍦烘櫙*/
+ /**
+ * 闂ㄥ彛鏈虹被
+ */
+ public static final int DOOR_MACHINE_BIG_TYPE = 14;
+ /**
+ * 鍏ㄥ眬鍦烘櫙
+ */
public static final int GLOBAL_LOGIC_BIG_TYPE = 17;
-
- /**閫氱敤寮�鍏�*/
+ /**
+ * 鏂伴绯荤粺
+ */
+ public static final int FRESH_AIR_BIG_TYPE = 19;
+ /**
+ * 閫氱敤寮�鍏�
+ */
public static final int COMMON_SWITCH_BIG_TYPE = 100;
//灏忕被 鍏堜笉鍋氬垎绫�
@@ -108,6 +137,11 @@
public static final int LIGHT_CTRL_BACK_COMMAND = 0x0032;
public static final int LIGHT_STATE_COMMAND = 0x0033;
public static final int LIGHT_STATE_BACK_COMMAND = 0x0034;
+ //****************2023-08鏂板****************
+ public static final int LIGHT_RGB_CTRL_COMMAND = 0xE45C;
+ public static final int LIGHT_RGB_CTRL_BACK_COMMAND = 0xE45D;
+ public static final int LIGHT_RGB_STATE_COMMAND = 0xE472;
+ public static final int LIGHT_RGB_STATE_BACK_COMMAND = 0xE473;
//绐楀笜鎿嶄綔鐮併�佺姸鎬佽鍙栫爜
public static final int CURTAIN_CTRL_COMMAND = 0xE3E0;
@@ -133,7 +167,7 @@
//閫昏緫妯″潡鎿嶄綔鐮併�佺姸鎬佽鍙栫爜
public static final int LOGIC_CTRL_COMMAND = 0x0002;
- public static final int LOGIC_CTRL_BACK_COMMAND = 0x0003;
+ public static final int LOGIC_CTRL_BACK_COMMAND = 0x0003;
public static final int LOGIC_STATE_COMMAND = 0x000C;
public static final int LOGIC_STATE_BACK_COMMAND = 0x000D;
@@ -151,7 +185,7 @@
//瑙f瀽锛�0xE4F9 鍛戒护涓鸿鍙栦紶鎰熷櫒鍛戒护锛�0xE4FA 涓鸿鍙栬繑鍥炲�笺�傝嫢瑕佷笉鏂幏鍙栦紶鎰熷櫒 鐨勭姸鎬侊紝
//搴旇寮�鍚紶鎰熷櫒浣胯兘鍔熻兘锛屽紑鍚悗浼犳劅鍣ㄥ氨浼氬彂鍑� 0x353A 鐨勫箍鎾姸鎬侊紝涓嶉渶 瑕佷竴鐩磋鍙栵紝鍙渶鎺ユ敹鍗冲彲銆�0x353A 涓� 0xE4FA 杩斿洖鐨勬槸涓�鏍风殑鏍煎紡鐘舵�併��
-// public static final int SENSOR_BROADCAST_COMMAND = 0x1647;
+ // public static final int SENSOR_BROADCAST_COMMAND = 0x1647;
public static final int WARNING_COMMAND = 0xF606;
//澶勭悊杞彂闊充箰鏁版嵁
public static final int AUDIO_CTRL_READ_COMMAND = 0x192E;
@@ -180,6 +214,46 @@
public static final int COMMON_SWITCH_CTRL_BACK_COMMAND = 0xE01D;//閫氱敤寮�鍏虫帶鍒跺弽棣�
public static final int COMMON_SWITCH_STATE_COMMAND = 0xE018;//璇婚�氱敤寮�鍏崇姸鎬�
public static final int COMMON_SWITCH_STATE_BACK_COMMAND = 0xE019;//璇婚�氱敤寮�鍏崇姸鎬佸弽棣�
+
+
+ /**
+ * 2020-07-20 鏂伴绯荤粺
+ */
+ public static final int FRESH_AIR_CTRL_COMMAND = 0x144A;
+ public static final int FRESH_AIR_CTRL_BACK_COMMAND = 0x144B;
+ public static final int FRESH_AIR_STATE_COMMAND = 0x144C;
+ public static final int FRESH_AIR_STATE_BACK_COMMAND = 0x144D;
+
+ /**
+ * 2020-07-20 閲戣寕鏂伴
+ */
+ public static final int FRESH_AIR_JINMAO_STATE_COMMAND = 0x1446;
+ public static final int FRESH_AIR_JINMAO_STATE_BACK_COMMAND = 0x1447;
+ public static final int FRESH_AIR_JINMAO_CTRL_COMMAND = 0x1448;
+ public static final int FRESH_AIR_JINMAO_CTRL_BACK_COMMAND = 0x1449;
+
+ /**
+ * 2020-07-20 鍦扮儹
+ */
+ //鍦扮儹妯″潡
+ public static final int GEOTHERMAL_MODULE_CTRL_COMMAND = 0x1C5C;
+ public static final int GEOTHERMAL_MODULE_CTRL_BACK_COMMAND = 0x1C5D;
+ public static final int GEOTHERMAL_MODULE_STATE_COMMAND = 0x1C5E;
+ public static final int GEOTHERMAL_MODULE_STATE_BACK_COMMAND = 0x1C5F;
+
+ /**
+ * 2023-08-22 闂ㄩ攣
+ */
+ //闂ㄩ攣妯″潡
+ public static final int DOOR_MACHINE_MODULE_SETTING_PASSWORD_COMMAND = 0x1F5C;//璁剧疆涓存椂瀵嗙爜
+ public static final int DOOR_MACHINE_MODULE_SETTING_PASSWORD_BACK_COMMAND = 0x1F5D;//璁剧疆涓存椂瀵嗙爜杩斿洖
+ public static final int DOOR_MACHINE_MODULE_CTRL_FRIST_COMMAND = 0xE4EE;//杩滅▼寮�閿佽繛鎺�
+ public static final int DOOR_MACHINE_MODULE_CTRL_FRIST_BACK_COMMAND = 0xE4EF;
+ public static final int DOOR_MACHINE_MODULE_CTRL_COMMAND = 0xE4F0;//杩滅▼寮�鍏抽攣
+ public static final int DOOR_MACHINE_MODULE_CTRL_BACK_COMMAND = 0xE4F1;
+ public static final int DOOR_MACHINE_MODULE_STATE_COMMAND = 0x1F60;//璇婚棬閿佺姸鎬�
+ public static final int DOOR_MACHINE_MODULE_STATE_BACK_COMMAND = 0x1F61;
+ public static final int DOOR_MACHINE_BROADCAST_STATE_BACK_COMMAND = 0x1F4D;//骞挎挱闂ㄩ攣鐘舵�佸拰鎶ヨ
// /**
@@ -229,8 +303,6 @@
// public static final int RCU_AIR_CTRL_COMMAND = 0x2065;
// public static final int RCU_AIR_CTRL_BACK_COMMAND = 0x2066;
// public static final int RCU_AIR_CAST_COMMAND = 0x209A;
-
-
}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/Config/HDLApConfig.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/Config/HDLApConfig.java
index aece8d7..69a13f7 100644
--- a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/Config/HDLApConfig.java
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/Config/HDLApConfig.java
@@ -6,10 +6,14 @@
public class HDLApConfig {
- public static final int TYPE_LIGHT_DIMMER = 101;
- public static final int TYPE_LIGHT_RELAY = 102;
- public static final int TYPE_LIGHT_MIX_DIMMER = 103;
- public static final int TYPE_LIGHT_MIX_RELAY = 104;
+ public static final int TYPE_LIGHT_DIMMER = 101;//璋冨厜鍥炶矾
+ public static final int TYPE_LIGHT_RELAY = 102;//寮�鍏冲洖璺�
+ public static final int TYPE_LIGHT_MIX_DIMMER = 103;//娣峰悎璋冨厜绫�
+ public static final int TYPE_LIGHT_MIX_RELAY = 104;//娣峰悎寮�鍏崇被
+ public static final int TYPE_LIGHT_CCT = 105;//閫昏緫鐏帶鍒禖CT
+ public static final int TYPE_LIGHT_RGB = 106;//閫昏緫鐏疪GB
+ public static final int TYPE_LIGHT_DALI = 107;//DALI(鐩墠CCT鐢ㄨ繖涓�)
+ public static final int TYPE_LIGHT_DMX = 108;//DMX(鐩墠dmx澶氱敤杩欎釜)
public static final int TYPE_CURTAIN_GLYSTRO = 201;
public static final int TYPE_CURTAIN_ROLLER = 202;
@@ -19,6 +23,7 @@
public static final int TYPE_AC_COOLMASTER = 302;
public static final int TYPE_AC_INFRARED = 303;
public static final int TYPE_AC_PANEL = 304;
+ public static final int TYPE_AC_TECHSYS = 305;
public static final int TYPE_MUSIC_MODULE = 401;
@@ -62,12 +67,15 @@
public static final int TYPE_SENSOR_DOOR_MAGNET= 627; //闂ㄧ銆佺獥纾�
public static final int TYPE_SENSOR_EMERGENCY_BUTTON = 628; //绱ф�ユ寜閽�
+ //2020-07-20
+ public static final int TYPE_GEOTHERMAL_MODULE = 801; //鍦扮儹妯″潡锛�0锛� 鍥炶矾鍙凤紝澶囨敞锛屽湴鐑姸鎬�
+ public static final int TYPE_GEOTHERMAL_JINMAO = 802; //閲戣寕瀹氬埗鍦扮儹妯″潡锛�1锛� 鍥炶矾鍙凤紝澶囨敞锛屽湴鐑姸鎬�
+ public static final int TYPE_FRESH_AIR = 1901; //鏂伴绯荤粺锛�0锛�
+ public static final int TYPE_FRESH_AIR_JINMAO = 1902; //閲戣寕鏂伴锛�1锛�
+ //2023-08-22
+ public static final int TYPE_DOOR_MACHINE = 1404; //闂ㄩ攣锛�4锛�
public static final int TYPE_COMMON_SWITCH = 10001;//閫氱敤寮�鍏�
-
-
-
-
}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAirCondition/AirHVACBackInfo.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAirCondition/AirHVACBackInfo.java
index bdd681b..14b1a9b 100644
--- a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAirCondition/AirHVACBackInfo.java
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAirCondition/AirHVACBackInfo.java
@@ -12,6 +12,7 @@
private String remarks;
private int channelNum;//鍥炶矾鍙�
private int isOn;//0=鍏筹紝1=寮�
+ private int indoorTemp;//瀹ゅ唴娓╁害
private int refTemp;//鍒跺喎娓╁害鐐� 0-84
private int heatTemp;//鍒剁儹娓╁害鐐� 0-84
private int autoTemp;//鑷姩娓╁害鐐� 0-84
@@ -35,6 +36,7 @@
if (this.curState.length >= 13) {
this.channelNum = this.curState[0] & 0xFF;
+ this.indoorTemp = this.curState[2] & 0xFF;
this.refTemp = this.curState[3] & 0xFF;//鍒跺喎娓╁害鐐� 0-84
this.heatTemp = this.curState[4] & 0xFF;//鍒剁儹娓╁害鐐� 0-84
this.autoTemp = this.curState[5] & 0xFF;//鑷姩娓╁害鐐� 0-84
@@ -77,6 +79,14 @@
this.isOn = isOn;
}
+ public int getIndoorTemp() {
+ return indoorTemp;
+ }
+
+ public void setIndoorTemp(int indoorTemp) {
+ this.indoorTemp = indoorTemp;
+ }
+
public int getRefTemp() {
return refTemp;
}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAirCondition/AirTechSysBackInfo.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAirCondition/AirTechSysBackInfo.java
new file mode 100644
index 0000000..18426c4
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAirCondition/AirTechSysBackInfo.java
@@ -0,0 +1,120 @@
+package com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition;
+
+import android.util.Log;
+
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
+
+import java.io.Serializable;
+
+/**
+ * Created by panlili on 2023/8/21
+ */
+public class AirTechSysBackInfo implements Serializable {
+ private AppliancesInfo appliancesInfo;
+ private String remarks;
+ private int channelNum;//鍥炶矾鍙�
+ private int isOn;//0=鍏筹紝1=寮�
+ private String indoorTemp;//瀹ゅ唴娓╁害鐐� 0-84
+ private int indoorTempInt;//瀹ゅ唴娓╁害鐐规暣鏁伴儴鍒�
+ private int indoorTempFloat;//瀹ゅ唴娓╁害鐐瑰皬鏁伴儴鍒�
+ private int refTemp;//鍒跺喎娓╁害鐐� 0-84
+ private int heatTemp;//鍒剁儹娓╁害鐐� 0-84
+ private int airMode;//绌鸿皟妯″紡0 = 鍒跺喎, 1 = 鍒剁儹
+ private byte[] curState;//鎺у埗鍥為淇℃伅
+
+ public AirTechSysBackInfo() {
+
+ }
+
+ public AirTechSysBackInfo(AppliancesInfo mAppliancesInfo) {
+ this.appliancesInfo = mAppliancesInfo;
+ this.curState = mAppliancesInfo.getArrCurState();
+ this.remarks = mAppliancesInfo.getRemarks();
+
+ if (this.curState == null) return;
+
+ if (this.curState.length >= 14) {
+ this.channelNum = this.curState[0] & 0xFF;
+ this.indoorTempInt = this.curState[2] & 0xFF;
+ this.refTemp = this.curState[3] & 0xFF;//鍒跺喎娓╁害鐐� 0-84
+ this.heatTemp = this.curState[4] & 0xFF;//鍒剁儹娓╁害鐐� 0-84
+ this.isOn = this.curState[8] & 0xFF;//鍙彇浣�4浣�
+ this.airMode = this.curState[9] & 0xFF;
+ this.indoorTempFloat = this.curState[13] & 0xFF;
+ this.indoorTemp = indoorTempInt + "." + indoorTempFloat;
+ }
+ }
+
+ public String getIndoorTemp() {
+ return indoorTemp;
+ }
+
+ public void setIndoorTemp(String indoorTemp) {
+ this.indoorTemp = indoorTemp;
+ }
+
+ 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 int getIsOn() {
+ return isOn;
+ }
+
+ public void setIsOn(int isOn) {
+ this.isOn = isOn;
+ }
+
+ public int getRefTemp() {
+ return refTemp;
+ }
+
+ public void setRefTemp(int refTemp) {
+ this.refTemp = refTemp;
+ }
+
+ public int getHeatTemp() {
+ return heatTemp;
+ }
+
+ public void setHeatTemp(int heatTemp) {
+ this.heatTemp = heatTemp;
+ }
+
+ public int getAirMode() {
+ return airMode;
+ }
+
+ public void setAirMode(int airMode) {
+ this.airMode = airMode;
+ }
+
+ public byte[] getCurState() {
+ return curState;
+ }
+
+ public void setCurState(byte[] curState) {
+ this.curState = curState;
+ }
+
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAirCondition/Parser/AirCtrlParser.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAirCondition/Parser/AirCtrlParser.java
index 3827c58..29eab72 100644
--- a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAirCondition/Parser/AirCtrlParser.java
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAirCondition/Parser/AirCtrlParser.java
@@ -195,19 +195,19 @@
addBytes[10] = (byte) state;
break;
}
- }else {
+ } else {
addBytes[0] = (byte) newInfo.getChannelNum();
addBytes[1] = 0;
- addBytes[2] = (byte)28;
- addBytes[3] = (byte)28;
- addBytes[4] = (byte)28;
- addBytes[5] = (byte)28;
- addBytes[6] = (byte)28;
+ addBytes[2] = (byte) 28;
+ addBytes[3] = (byte) 28;
+ addBytes[4] = (byte) 28;
+ addBytes[5] = (byte) 28;
+ addBytes[6] = (byte) 28;
addBytes[7] = 0;
addBytes[8] = 1;
addBytes[9] = 0;
addBytes[10] = 0;
- addBytes[11] = (byte)28;
+ addBytes[11] = (byte) 28;
addBytes[12] = 0;
switch (type) {
case airSwich://璁剧疆寮�鍏崇姸鎬�
@@ -266,183 +266,148 @@
}
-// public static byte[] getRcuAirAddByte(AppliancesInfo I,int type, int arg2){
-// byte[] addBytes = new byte[9];
-// addBytes[4] = 1;
-// byte[] curAirInfo = I.getArrCurState();
-// switch (I.getChannelNum()){
-// case 1:
-// curAirInfo = HDLDeviceManager.air1Info;
-// break;
-// case 2:
-// curAirInfo = HDLDeviceManager.air2Info;
-// break;
-// case 3:
-// curAirInfo = HDLDeviceManager.air3Info;
-// break;
-// case 4:
-// curAirInfo = HDLDeviceManager.air4Info;
-// break;
-// }
-//
-// byte airSwitch = curAirInfo[0];
-// byte aircurMode = curAirInfo[1];
-// byte airTem = curAirInfo[2];
-// byte aircurSpeed = curAirInfo[3];
-// byte aircurTem = curAirInfo[4];
-// byte airBAIFENG = curAirInfo[5];
-//
-// addBytes[0] = (byte) I.getChannelNum();
-// addBytes[1] = airSwitch;
-// switch (aircurMode){
-// case 0:
-// addBytes[2] = airTem;
-// break;
-// case 1:
-// addBytes[5] = airTem;
-// break;
-// case 2:
-// break;
-// case 3:
-// addBytes[6] = airTem;
-// break;
-// }
-// addBytes[3] = (byte) ((aircurMode << 4) | aircurSpeed);
-// addBytes[4] = 1;
-// addBytes[8] = airBAIFENG;
-// switch (type){
-// case airSwich:
-// if(arg2 == airOff){
-// addBytes[1] = 0;
-// }else if(arg2 == airOn){
-// addBytes[1] = 1;
-// }
-// break;
-// case refTem:
-// addBytes[2] = (byte) arg2;
-// addBytes[5] = (byte) arg2;
-// addBytes[6] = (byte) arg2;
-// addBytes[7] = (byte) arg2;
-// break;
-// case airSpeed :
-// int modifyLow;
-// int height = ((addBytes[3] & 0xf0) >> 4);//鑾峰彇楂�4浣�
-// switch (arg2){
-// case airSpeedAuto:
-// modifyLow = 0;
-// addBytes[3] = (byte)((height<<4)|modifyLow);
-// break;
-// case airSpeedHigh:
-// modifyLow = 1;
-// addBytes[3] = (byte)((height<<4)|modifyLow);
-// break;
-// case airSpeedMid:
-// modifyLow = 2;
-// addBytes[3] = (byte)((height<<4)|modifyLow);
-// break;
-// case airSpeedLow:
-// modifyLow = 3;
-// addBytes[3] = (byte)((height<<4)|modifyLow);
-// break;
-// default:
-// addBytes = new byte[]{fail};
-// break;
-// }
-// break;
-// case airMode:
-// int modify;
-// int low = (addBytes[3] & 0x0f);//鑾峰彇浣�4浣�
-// switch (arg2){
-// case airModeRefTem:
-//
-// modify = 0;
-// addBytes[3] = (byte)((modify<<4)|low);
-// break;
-// case airModeHeatTem:
-// modify = 1;
-// addBytes[3] = (byte)((modify<<4)|low);
-// break;
-// case airModeVen:
-// modify = 2;
-// addBytes[3] = (byte)((modify<<4)|low);
-// break;
-// case airModeAuto:
-// modify = 3;
-// addBytes[3] = (byte)((modify<<4)|low);
-// break;
-// case airModeDehum:
-// modify = 4;
-// addBytes[3] = (byte)((modify<<4)|low);
-// break;
-// default:
-// addBytes = new byte[]{fail};
-// break;
-// }
-// break;
-// case heatTem:
-// addBytes[2] = (byte) arg2;
-// addBytes[5] = (byte) arg2;
-// addBytes[6] = (byte) arg2;
-// addBytes[7] = (byte) arg2;
-// break;
-// case autoTem:
-// addBytes[2] = (byte) arg2;
-// addBytes[5] = (byte) arg2;
-// addBytes[6] = (byte) arg2;
-// addBytes[7] = (byte) arg2;
-// break;
-// case dehumTem:
-// addBytes[2] = (byte) arg2;
-// addBytes[5] = (byte) arg2;
-// addBytes[6] = (byte) arg2;
-// addBytes[7] = (byte) arg2;
-// break;
-// case upTem:
-//// int height2 = ((addBytes[3] & 0xf0) >> 4);//鑾峰彇楂�4浣�
-//// switch (height2){
-//// case 0:
-//// addBytes[2] = (byte) (arg2 + (airTem & 0xFF));
-//// break;
-//// case 1:
-//// addBytes[5] = (byte) (arg2 + (airTem & 0xFF));
-//// break;
-//// case 3:
-//// addBytes[6] = (byte) (arg2 + (airTem & 0xFF));
-//// break;
-//// case 4:
-//// addBytes[7] = (byte) (arg2 + (airTem & 0xFF));
-//// break;
-//// }
-// addBytes[2] = (byte) (arg2 + (airTem & 0xFF));
-// addBytes[5] = (byte) (arg2 + (airTem & 0xFF));
-// addBytes[6] = (byte) (arg2 + (airTem & 0xFF));
-// addBytes[7] = (byte) (arg2 + (airTem & 0xFF));
-// break;
-// case downTem:
-//// int height3= ((addBytes[3] & 0xf0) >> 4);//鑾峰彇楂�4浣�
-//// switch (height3){
-//// case 0:
-//// addBytes[2] = (byte) ((airTem & 0xFF)-arg2 );
-//// break;
-//// case 1:
-//// addBytes[5] = (byte) ((airTem & 0xFF)-arg2 );
-//// break;
-//// case 3:
-//// addBytes[6] = (byte) ((airTem & 0xFF)-arg2 );
-//// break;
-//// case 4:
-//// addBytes[7] = (byte) ((airTem & 0xFF)-arg2 );
-//// break;
-//// }
-// addBytes[2] = (byte) ((airTem & 0xFF)-arg2 );
-// addBytes[5] = (byte) ((airTem & 0xFF)-arg2 );
-// addBytes[6] = (byte) ((airTem & 0xFF)-arg2 );
-// addBytes[7] = (byte) ((airTem & 0xFF)-arg2 );
-// break;
-// default:
-// addBytes = new byte[]{fail};
-// break;
-// }
-// return addBytes;
-// }
+ public static byte[] getAirTechAddByte(AppliancesInfo appliancesInfo, int type, int state) {
+
+ try {
+ AppliancesInfo newInfo = null;
+ byte[] airBytes = null;
+ outter:
+ for (int i = 0; i < HDLDeviceManager.devicesDataList.size(); i++) {
+ if (appliancesInfo.getDeviceSubnetID() == HDLDeviceManager.devicesDataList.get(i).getSourceSubnetID()
+ && appliancesInfo.getDeviceDeviceID() == HDLDeviceManager.devicesDataList.get(i).getSourceDeviceID()) {
+ for (int j = 0; j < HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().size(); j++) {
+ if (HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getBigType() == Configuration.AIR_BIG_TYPE
+ && HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getDeviceType() == HDLApConfig.TYPE_AC_TECHSYS
+ && appliancesInfo.getChannelNum() == HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getChannelNum()) {
+ newInfo = HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j);
+ if (newInfo.getArrCurState() == null) {
+ newInfo.setArrCurState(new byte[19]);
+ }
+ airBytes = newInfo.getArrCurState();
+ break outter;
+ }
+
+ }
+ }
+ }
+ byte[] addBytes = new byte[19];
+ if (airBytes != null && airBytes.length >= 19) {
+ System.arraycopy(airBytes, 0, addBytes, 0, airBytes.length);
+ addBytes[0] = (byte) newInfo.getChannelNum();
+
+ switch (type) {
+ case airSwich://璁剧疆寮�鍏崇姸鎬�
+ if (state == airOff) {
+ addBytes[8] = 0;
+ } else {
+ addBytes[8] = 1;
+ }
+ break;
+ case refTem:
+ case heatTem:
+ case autoTem:
+ case dehumTem://璁剧疆娓╁害
+ addBytes[8] = 1;
+ addBytes[3] = (byte) state;
+ addBytes[4] = (byte) state;
+ addBytes[5] = (byte) state;
+ addBytes[6] = (byte) state;
+ addBytes[11] = (byte) state;
+ break;
+ case upTem://鍗囨俯
+ addBytes[8] = 1;
+ addBytes[3] = (byte) ((airBytes[2] & 0xff) + state);
+ addBytes[4] = (byte) ((airBytes[2] & 0xff) + state);
+ addBytes[5] = (byte) ((airBytes[2] & 0xff) + state);
+ addBytes[6] = (byte) ((airBytes[2] & 0xff) + state);
+ addBytes[11] = (byte) ((airBytes[2] & 0xff) + state);
+ break;
+ case downTem://闄嶆俯
+ addBytes[8] = 1;
+ addBytes[3] = (byte) ((airBytes[2] & 0xff) - state);
+ addBytes[4] = (byte) ((airBytes[2] & 0xff) - state);
+ addBytes[5] = (byte) ((airBytes[2] & 0xff) - state);
+ addBytes[6] = (byte) ((airBytes[2] & 0xff) - state);
+ addBytes[11] = (byte) ((airBytes[2] & 0xff) - state);
+ break;
+ case airMode://璁剧疆绌鸿皟妯″紡
+ addBytes[8] = 1;
+ addBytes[7] = (byte) (state * 16 + (airBytes[3] & 0xff));
+ addBytes[9] = (byte) state;
+ break;
+ case airSpeed://璁剧疆椋庨��
+ addBytes[8] = 1;
+ addBytes[7] = (byte) ((airBytes[1] & 0xff) * 16 + state);
+ addBytes[10] = (byte) state;
+ break;
+ }
+ } else {
+ addBytes[0] = (byte) newInfo.getChannelNum();
+ addBytes[1] = 0;
+ addBytes[2] = (byte) 28;
+ addBytes[3] = (byte) 28;
+ addBytes[4] = (byte) 28;
+ addBytes[5] = (byte) 28;
+ addBytes[6] = (byte) 28;
+ addBytes[7] = 0;
+ addBytes[8] = 1;
+ addBytes[9] = 0;
+ addBytes[10] = 0;
+ addBytes[11] = (byte) 28;
+ addBytes[12] = 0;
+ switch (type) {
+ case airSwich://璁剧疆寮�鍏崇姸鎬�
+ if (state == airOff) {
+ addBytes[8] = 0;
+ } else {
+ addBytes[8] = 1;
+ }
+ break;
+ case refTem:
+ case heatTem:
+ case autoTem:
+ case dehumTem://璁剧疆娓╁害
+ addBytes[8] = 1;
+ addBytes[3] = (byte) state;
+ addBytes[4] = (byte) state;
+ addBytes[5] = (byte) state;
+ addBytes[6] = (byte) state;
+ addBytes[11] = (byte) state;
+ break;
+ case upTem://鍗囨俯
+ addBytes[8] = 1;
+ addBytes[3] = (byte) (28 + state);
+ addBytes[4] = (byte) (28 + state);
+ addBytes[5] = (byte) (28 + state);
+ addBytes[6] = (byte) (28 + state);
+ addBytes[11] = (byte) (28 + state);
+ break;
+ case downTem://闄嶆俯
+ addBytes[8] = 1;
+ addBytes[3] = (byte) (28 - state);
+ addBytes[4] = (byte) (28 - state);
+ addBytes[5] = (byte) (28 - state);
+ addBytes[6] = (byte) (28 - state);
+ addBytes[11] = (byte) (28 - state);
+ break;
+ case airMode://璁剧疆绌鸿皟妯″紡
+ addBytes[8] = 1;
+ addBytes[7] = (byte) (state * 16);
+ addBytes[9] = (byte) state;
+ break;
+ case airSpeed://璁剧疆椋庨��
+ addBytes[8] = 1;
+ addBytes[7] = (byte) (state);
+ addBytes[10] = (byte) state;
+ break;
+ }
+ }
+
+ return addBytes;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return new byte[]{fail};
+ }
+
+ }
}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLDoorMachine/DoorMachineBackInfo.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLDoorMachine/DoorMachineBackInfo.java
new file mode 100644
index 0000000..3babaef
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLDoorMachine/DoorMachineBackInfo.java
@@ -0,0 +1,107 @@
+package com.hdl.sdk.ttl.HDLAppliances.HDLDoorMachine;
+
+
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
+
+import java.io.Serializable;
+
+/**
+ * Created by panlili on 2023-08-22
+ * 闄勫姞鏁版嵁锛� 闂ㄩ攣缂栧彿 + 闂ㄩ攣鐘舵�侊紙0鍏筹紝1寮�锛�2甯稿紑锛� + 甯稿紑妯″紡锛�0 鍏抽棴锛�1鎵撳紑锛� + 闊抽噺锛�0-100锛� + 鐢垫睜鐧惧垎姣旓紙0-100锛�
+ */
+public class DoorMachineBackInfo implements Serializable {
+ private AppliancesInfo appliancesInfo;
+ private String remarks;
+ private int channelNum;//鍥炶矾鍙�
+ private int doorStatus;//闂ㄩ攣鐘舵�侊紙0鍏筹紝1寮�锛�2甯稿紑锛�
+ private int normalOpenMode;//甯稿紑妯″紡锛�0 鍏抽棴锛�1鎵撳紑锛�
+ private int doorVolume;//闊抽噺
+ private int doorElectricity;//鐢垫睜鐧惧垎姣�
+
+ private byte[] curState;//鎺у埗鍥為淇℃伅
+
+ public DoorMachineBackInfo() {
+
+ }
+
+ public DoorMachineBackInfo(AppliancesInfo mAppliancesInfo) {
+ this.appliancesInfo = mAppliancesInfo;
+ this.curState = mAppliancesInfo.getArrCurState();
+ this.remarks = mAppliancesInfo.getRemarks();
+
+ if (this.curState == null) return;
+
+ if (this.curState.length >= 5) {
+ this.channelNum = this.curState[0] & 0xFF;
+ this.doorStatus = this.curState[1] & 0xFF;
+ this.normalOpenMode = this.curState[2] & 0xFF;
+ this.doorVolume = this.curState[3] & 0xFF;
+ this.doorElectricity = this.curState[4] & 0xFF;
+ }
+
+ }
+
+ 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 byte[] getCurState() {
+ return curState;
+ }
+
+ public void setCurState(byte[] curState) {
+ this.curState = curState;
+ }
+
+ public int getDoorStatus() {
+ return doorStatus;
+ }
+
+ public void setDoorStatus(int doorStatus) {
+ this.doorStatus = doorStatus;
+ }
+
+ public int getNormalOpenMode() {
+ return normalOpenMode;
+ }
+
+ public void setNormalOpenMode(int normalOpenMode) {
+ this.normalOpenMode = normalOpenMode;
+ }
+
+ public int getDoorVolume() {
+ return doorVolume;
+ }
+
+ public void setDoorVolume(int doorVolume) {
+ this.doorVolume = doorVolume;
+ }
+
+ public int getDoorElectricity() {
+ return doorElectricity;
+ }
+
+ public void setDoorElectricity(int doorElectricity) {
+ this.doorElectricity = doorElectricity;
+ }
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLDoorMachine/DoorMachineFristBackInfo.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLDoorMachine/DoorMachineFristBackInfo.java
new file mode 100644
index 0000000..3efd608
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLDoorMachine/DoorMachineFristBackInfo.java
@@ -0,0 +1,71 @@
+package com.hdl.sdk.ttl.HDLAppliances.HDLDoorMachine;
+
+
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
+
+import java.io.Serializable;
+
+/**
+ * Created by panlili on 2023-08-22
+ * 闄勫姞鏁版嵁锛� 闂ㄩ攣缂栧彿 + 闅忔満瀵嗛挜(8byte)
+ */
+public class DoorMachineFristBackInfo implements Serializable {
+ private AppliancesInfo appliancesInfo;
+
+ private int channelNum;//闂ㄩ攣缂栧彿
+ private byte[] secretBytes = new byte[9];
+
+ private byte[] curState;//鎺у埗鍥為淇℃伅
+
+ public DoorMachineFristBackInfo() {
+
+ }
+
+ public DoorMachineFristBackInfo(AppliancesInfo mAppliancesInfo) {
+ this.appliancesInfo = mAppliancesInfo;
+ this.curState = mAppliancesInfo.getArrCurState();
+
+ if (this.curState == null) return;
+
+ if (this.curState.length >= 9) {
+ this.channelNum = this.curState[0] & 0xFF;
+
+ for (int i = 0; i < this.curState.length; i++) {
+ secretBytes[i] = (byte) (this.curState[i] & 0xFF);
+ }
+ }
+
+ }
+
+ public AppliancesInfo getAppliancesInfo() {
+ return appliancesInfo;
+ }
+
+ public void setAppliancesInfo(AppliancesInfo appliancesInfo) {
+ this.appliancesInfo = appliancesInfo;
+ }
+
+ public int getChannelNum() {
+ return channelNum;
+ }
+
+ public void setChannelNum(int channelNum) {
+ this.channelNum = channelNum;
+ }
+
+ public byte[] getCurState() {
+ return curState;
+ }
+
+ public void setCurState(byte[] curState) {
+ this.curState = curState;
+ }
+
+ public byte[] getSecretBytes() {
+ return secretBytes;
+ }
+
+ public void setSecretBytes(byte[] secretBytes) {
+ this.secretBytes = secretBytes;
+ }
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLDoorMachine/DoorMachineWaringBackInfo.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLDoorMachine/DoorMachineWaringBackInfo.java
new file mode 100644
index 0000000..d3e494c
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLDoorMachine/DoorMachineWaringBackInfo.java
@@ -0,0 +1,21 @@
+package com.hdl.sdk.ttl.HDLAppliances.HDLDoorMachine;
+
+
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
+
+public class DoorMachineWaringBackInfo {
+ public AppliancesInfo appliancesInfo;
+ boolean isSuccess;
+
+ private String type;
+
+ public DoorMachineWaringBackInfo(AppliancesInfo appliancesInfo, boolean isSuccess, String type) {
+ this.appliancesInfo = appliancesInfo;
+ this.isSuccess = isSuccess;
+ this.type = type;
+ }
+
+ public String getType() {
+ return type;
+ }
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLDoorMachine/Parser/DoorMachineParser.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLDoorMachine/Parser/DoorMachineParser.java
new file mode 100644
index 0000000..11345fe
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLDoorMachine/Parser/DoorMachineParser.java
@@ -0,0 +1,161 @@
+package com.hdl.sdk.ttl.HDLAppliances.HDLDoorMachine.Parser;
+
+
+import android.util.Log;
+
+import com.hdl.sdk.ttl.Config.Configuration;
+import com.hdl.sdk.ttl.HDLAppliances.Config.HDLApConfig;
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
+import com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLDeviceManager;
+import com.hdl.sdk.ttl.Utils.HDLUtlis.AesUtil;
+import com.hdl.sdk.ttl.Utils.HDLUtlis.CommonHelper;
+
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Created by panlili on 2023/8/22
+ */
+public class DoorMachineParser {
+ // 闄勫姞鏁版嵁锛� 鍥炶矾鍙凤紝澶囨敞锛岀姸鎬�
+ public static final int fail = 0;
+
+ public static final int doorNum = 0;
+
+ public static final int doorStatus = 1;//闂ㄩ攣鐘舵��
+ public static final int doorStatusClose = 0;//鍏�
+ public static final int doorStatusOpen = 1;//寮�
+ public static final int doorStatusNormallyOpen = 2;//甯稿紑
+
+ public static final int normalOpenMode = 2;//甯稿紑妯″紡
+ public static final int normalOpenModeClose = 0;//鍏抽棴
+ public static final int normalOpenModeOpen = 1;//鎵撳紑
+
+ public static final int doorVolume = 3;//闊抽噺
+
+ public static final int doorElectricity = 4;//鐢垫睜鐧惧垎姣�
+
+ public static byte[] getDoorMachineAddByte(AppliancesInfo appliancesInfo, byte[] secretBytes, String password, int doorStatus) {
+ try {
+ AppliancesInfo newInfo = null;
+ byte[] doorMachineBytes = null;
+
+ outter:
+ for (int i = 0; i < HDLDeviceManager.devicesDataList.size(); i++) {
+ if (appliancesInfo.getDeviceSubnetID() == HDLDeviceManager.devicesDataList.get(i).getSourceSubnetID()
+ && appliancesInfo.getDeviceDeviceID() == HDLDeviceManager.devicesDataList.get(i).getSourceDeviceID()) {
+ for (int j = 0; j < HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().size(); j++) {
+ if (HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getBigType() == Configuration.DOOR_MACHINE_BIG_TYPE
+ && HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getDeviceType() == HDLApConfig.TYPE_DOOR_MACHINE
+ && appliancesInfo.getChannelNum() == HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getChannelNum()) {
+ newInfo = HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j);
+ if (newInfo.getArrCurState() == null) {
+ newInfo.setArrCurState(new byte[9]);
+ }
+ doorMachineBytes = newInfo.getArrCurState();
+ break outter;
+ }
+
+ }
+ }
+ }
+
+ byte[] passwordBytes = new byte[6];
+ byte[] dataBytes = new byte[32];
+
+ if (doorMachineBytes != null && doorMachineBytes.length >= 9) {
+ //寮�閿佸瘑鐮�6byte
+ if (password != null && password.length() == 6) {
+ for (int i = 0; i < password.length(); i++) {
+ String s = String.valueOf(password.charAt(i));
+ passwordBytes[i] = Byte.parseByte(s);
+ }
+ }
+ dataBytes = lockControlEncrypt(secretBytes, passwordBytes, doorStatus);
+ } else {
+
+ }
+
+ return dataBytes;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return new byte[]{fail};
+ }
+
+ }
+
+ public static byte[] getDoorMachineSettingPwdByte(AppliancesInfo appliancesInfo, String tempPassword, String startTime, String endTime) {
+ try {
+ byte[] addBytes = new byte[15];
+ addBytes[0] = (byte) appliancesInfo.getChannelNum();
+
+ //寮�閿佸瘑鐮�6byte
+ if (tempPassword != null && tempPassword.length() == 6) {
+ for (int i = 0; i < tempPassword.length(); i++) {
+ String s = String.valueOf(tempPassword.charAt(i));
+ addBytes[i] = Byte.parseByte(s);
+ }
+ }
+
+ //寮�濮嬫椂闂存埑4byte
+ long st = Long.parseLong(startTime);
+ addBytes[7] = (byte) (st / 255 / 255 / 255);
+ addBytes[8] = (byte) (st / 255 / 255);
+ addBytes[9] = (byte) (st / 255);
+ addBytes[10] = (byte) (st % 255);
+
+ //缁撴潫鏃堕棿鎴�4byte
+ long et = Long.parseLong(endTime);
+ addBytes[11] = (byte) (et / 255 / 255 / 255);
+ addBytes[12] = (byte) (et / 255 / 255);
+ addBytes[13] = (byte) (et / 255);
+ addBytes[14] = (byte) (et % 255);
+
+ return addBytes;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return new byte[]{fail};
+ }
+
+ }
+
+ public static byte[] lockControlEncrypt(byte[] usefulBytes, byte[] passwordBytes, int doorStatus) {
+ byte[] sendBytes = new byte[32];
+ int loopID = usefulBytes[0] & 0xFF;
+
+ byte[] randomBytes = Arrays.copyOfRange(usefulBytes, 1, 9);
+
+ byte[] passwordArray = new byte[6];
+ passwordArray[0] = Byte.parseByte("1");
+ passwordArray[1] = Byte.parseByte("2");
+ passwordArray[2] = Byte.parseByte("3");
+ passwordArray[3] = Byte.parseByte("1");
+ passwordArray[4] = Byte.parseByte("2");
+ passwordArray[5] = Byte.parseByte("3");
+
+ try {
+ //澶囨敞20浣�
+ byte[] deviceBytes = "HDL ON".getBytes("GB2312");
+
+ /*if (loopID > 0) {
+ loopID -= 1;
+ }*/
+ byte[] inpuptBytes = new byte[]{(byte) 0xE4, (byte) 0xF0, (byte) loopID, (byte) doorStatus};
+ byte[] allAddBytes = new byte[4 + 6 + 2 + 20];
+ System.arraycopy(inpuptBytes, 0, allAddBytes, 0, 4);
+ System.arraycopy(passwordBytes, 0, allAddBytes, 4, 6);
+ System.arraycopy(deviceBytes, 0, allAddBytes, 4 + 6 + 2, deviceBytes.length);
+
+ sendBytes = CommonHelper.Encryption(randomBytes, allAddBytes);
+ return sendBytes;
+
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ return sendBytes;
+ }
+
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLFreshAir/FreshAirBackInfo.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLFreshAir/FreshAirBackInfo.java
new file mode 100644
index 0000000..3a3ac2b
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLFreshAir/FreshAirBackInfo.java
@@ -0,0 +1,182 @@
+package com.hdl.sdk.ttl.HDLAppliances.HDLFreshAir;
+
+
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
+import com.hdl.sdk.ttl.Utils.HDLUtlis.HDLUtlis;
+
+import java.io.Serializable;
+
+/**
+ * Created by JLChen on 2020-07-20
+ * 闄勫姞鏁版嵁锛� 鏂伴閫氶亾鍙凤紙1 - 200锛� + 寮�鍏筹紙0锛�1锛� + 椋庨�燂紙0 鍏筹紝1浣庯紝2涓紝3楂橈級 + 妯″紡锛�0鎵嬪姩锛�1 鑷姩,2 鏅鸿兘锛�3 瀹氭椂锛�
+ */
+public class FreshAirBackInfo implements Serializable {
+ private AppliancesInfo appliancesInfo;
+ private String remarks;
+ private int channelNum;//鍥炶矾鍙�
+ private int isOn;//0=鍏筹紝1=寮�
+ private int freshAirSpeed;//椋庨�� 0 鍏筹紝1浣庯紝2涓紝3楂�
+ private int freshAirMode;//鏂伴妯″紡 0鎵嬪姩锛�1 鑷姩,2 鏅鸿兘锛�3 瀹氭椂
+
+ private int enableValue1;
+ private int enableValue2;
+ private float mInTemp;//瀹ゅ唴娓╁害
+ private float mOutTemp;//瀹ゅ娓╁害
+ private float mHumidty;//瀹ゅ唴婀垮害
+ private float mPM25;//PM2.5
+ private float mTVOC;//TVOC
+ private float mCO2;//CO2
+
+ private byte[] curState;//鎺у埗鍥為淇℃伅
+
+ public FreshAirBackInfo() {
+
+ }
+
+ public FreshAirBackInfo(AppliancesInfo mAppliancesInfo) {
+ this.appliancesInfo = mAppliancesInfo;
+ this.curState = mAppliancesInfo.getArrCurState();
+ this.remarks = mAppliancesInfo.getRemarks();
+
+ if (this.curState == null) return;
+
+ if (this.curState.length >= 30) {
+ this.channelNum = this.curState[0] & 0xFF;
+ this.isOn = this.curState[1] & 0xFF;
+ this.freshAirSpeed = this.curState[2] & 0xFF;
+ this.freshAirMode = this.curState[3] & 0xFF;
+ this.enableValue1 = this.curState[4] & 0xFF;
+ this.enableValue2 = this.curState[5] & 0xFF;
+ this.mInTemp = HDLUtlis.byteToFloat(this.curState[6], this.curState[7], this.curState[8], this.curState[9]);
+ this.mOutTemp = HDLUtlis.byteToFloat(this.curState[10], this.curState[11], this.curState[12], this.curState[13]);
+ this.mHumidty = HDLUtlis.byteToFloat(this.curState[14], this.curState[15], this.curState[16], this.curState[17]);
+ this.mPM25 = HDLUtlis.byteToFloat(this.curState[18], this.curState[19], this.curState[20], this.curState[21]);
+ this.mTVOC = HDLUtlis.byteToFloat(this.curState[22], this.curState[23], this.curState[24], this.curState[25]);
+ this.mCO2 = HDLUtlis.byteToFloat(this.curState[26], this.curState[27], this.curState[28], this.curState[29]);
+ }
+
+ }
+
+
+ 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 int getIsOn() {
+ return isOn;
+ }
+
+ public void setIsOn(int isOn) {
+ this.isOn = isOn;
+ }
+
+ public int getFreshAirSpeed() {
+ return freshAirSpeed;
+ }
+
+ public void setFreshAirSpeed(int freshAirSpeed) {
+ this.freshAirSpeed = freshAirSpeed;
+ }
+
+ public int getFreshAirMode() {
+ return freshAirMode;
+ }
+
+ public void setFreshAirMode(int freshAirMode) {
+ this.freshAirMode = freshAirMode;
+ }
+
+ public byte[] getCurState() {
+ return curState;
+ }
+
+ public void setCurState(byte[] curState) {
+ this.curState = curState;
+ }
+
+ public int getEnableValue1() {
+ return enableValue1;
+ }
+
+ public void setEnableValue1(int enableValue1) {
+ this.enableValue1 = enableValue1;
+ }
+
+ public int getEnableValue2() {
+ return enableValue2;
+ }
+
+ public void setEnableValue2(int enableValue2) {
+ this.enableValue2 = enableValue2;
+ }
+
+ public float getInTemp() {
+ return mInTemp;
+ }
+
+ public void setInTemp(float inTemp) {
+ mInTemp = inTemp;
+ }
+
+ public float getOutTemp() {
+ return mOutTemp;
+ }
+
+ public void setOutTemp(float outTemp) {
+ mOutTemp = outTemp;
+ }
+
+ public float getHumidty() {
+ return mHumidty;
+ }
+
+ public void setHumidty(float humidty) {
+ mHumidty = humidty;
+ }
+
+ public float getPM25() {
+ return mPM25;
+ }
+
+ public void setPM25(float PM25) {
+ mPM25 = PM25;
+ }
+
+ public float getTVOC() {
+ return mTVOC;
+ }
+
+ public void setTVOC(float TVOC) {
+ mTVOC = TVOC;
+ }
+
+ public float getCO2() {
+ return mCO2;
+ }
+
+ public void setCO2(float CO2) {
+ mCO2 = CO2;
+ }
+
+
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLFreshAir/FreshAirJinMaoBackInfo.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLFreshAir/FreshAirJinMaoBackInfo.java
new file mode 100644
index 0000000..7167d06
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLFreshAir/FreshAirJinMaoBackInfo.java
@@ -0,0 +1,180 @@
+package com.hdl.sdk.ttl.HDLAppliances.HDLFreshAir;
+
+
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
+
+import java.io.Serializable;
+
+/**
+ * Created by JLChen on 2020-07-20
+ * 闄勫姞鏁版嵁锛�
+ * 缂栧彿 澶囨敞 鍊煎煙
+ * 1 鏂伴缂栧彿 1~200
+ * 2 绫诲瀷 绗笁鏂圭被鍨� 0锛氶噾鑼傛柊椋�
+ * 3 寮�鍏� 0-鍏虫満锛�1-寮�鏈�
+ * 4 杩愯妯″紡 1-閫氶锛�2-鍔犳箍
+ * 5 鑺傝兘鑸掗�傞�夋嫨 1-鑸掗�傦紝2-鑺傝兘
+ * 6 椋庨�熸。浣� 0-鑷姩锛�1-1妗o紝2-2妗o紝3-3妗�
+ * 7 婀垮害璁惧畾 %
+ * 8 瀹ゅ唴娓╁害鍊� 鈩�
+ * 9 瀹ゅ唴婀垮害鍊� 鈩�
+ * 10 杩囨护缃戝墿浣� %
+ * 11 杩囨护缃戜娇鐢ㄨ秴鏃�
+ */
+public class FreshAirJinMaoBackInfo implements Serializable {
+ private AppliancesInfo appliancesInfo;
+ private String remarks;
+ private int channelNum;//鍥炶矾鍙�
+ private int typeId; //绫诲瀷 绗笁鏂圭被鍨� 0锛氶噾鑼傛柊椋�
+ private int isOn;//0=鍏筹紝1=寮�
+ private int freshAirSpeed;//椋庨�� 0-鑷姩锛�1-1妗o紝2-2妗o紝3-3妗�
+ private int freshAirMode = 1;//鏂伴妯″紡 1-閫氶锛�2-鍔犳箍
+ private int energySavingMode = 1;//鑺傝兘鑸掗�傞�夋嫨 1-鑸掗�傦紝2-鑺傝兘
+ private int setHumidty;//褰撳墠璁剧疆鐨勫鍐呮箍搴�
+ private int nowInTemp;//瀹ゅ唴娓╁害
+ private int nowInHumidty;//瀹ゅ唴婀垮害
+ private int filterRemaining;//杩囨护缃戝墿浣欓噺
+ private byte useTimeoutState;//鏄惁杩囨护缃戜娇鐢ㄨ秴鏃�
+
+ private byte[] curState;//鎺у埗鍥為淇℃伅
+
+ public FreshAirJinMaoBackInfo() {
+
+ }
+
+ public FreshAirJinMaoBackInfo(AppliancesInfo mAppliancesInfo) {
+ this.appliancesInfo = mAppliancesInfo;
+ this.curState = mAppliancesInfo.getArrCurState();
+ this.remarks = mAppliancesInfo.getRemarks();
+
+ if (this.curState == null) return;
+
+ if (this.curState.length >= 11) {
+
+ this.channelNum = this.curState[0] & 0xFF;
+ this.typeId = this.curState[1] & 0xFF;
+ this.isOn = this.curState[2] & 0xFF;
+ this.freshAirMode = this.curState[3] & 0xFF;
+ this.energySavingMode = this.curState[4] & 0xFF;
+ this.freshAirSpeed = this.curState[5] & 0xFF;
+ this.setHumidty = this.curState[6] & 0xFF;
+ this.nowInTemp = this.curState[7] & 0xFF;
+ this.nowInHumidty = this.curState[8] & 0xFF;
+ this.filterRemaining = this.curState[9] & 0xFF;
+ this.useTimeoutState = this.curState[10];
+ }
+
+ }
+
+ 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 int getTypeId() {
+ return typeId;
+ }
+
+ public void setTypeId(int typeId) {
+ this.typeId = typeId;
+ }
+
+ public int getIsOn() {
+ return isOn;
+ }
+
+ public void setIsOn(int isOn) {
+ this.isOn = isOn;
+ }
+
+ public int getFreshAirSpeed() {
+ return freshAirSpeed;
+ }
+
+ public void setFreshAirSpeed(int freshAirSpeed) {
+ this.freshAirSpeed = freshAirSpeed;
+ }
+
+ public int getFreshAirMode() {
+ return freshAirMode;
+ }
+
+ public void setFreshAirMode(int freshAirMode) {
+ this.freshAirMode = freshAirMode;
+ }
+
+ public int getEnergySavingMode() {
+ return energySavingMode;
+ }
+
+ public void setEnergySavingMode(int energySavingMode) {
+ this.energySavingMode = energySavingMode;
+ }
+
+ public int getSetHumidty() {
+ return setHumidty;
+ }
+
+ public void setSetHumidty(int setHumidty) {
+ this.setHumidty = setHumidty;
+ }
+
+ public int getNowInTemp() {
+ return nowInTemp;
+ }
+
+ public void setNowInTemp(int nowInTemp) {
+ this.nowInTemp = nowInTemp;
+ }
+
+ public int getNowInHumidty() {
+ return nowInHumidty;
+ }
+
+ public void setNowInHumidty(int nowInHumidty) {
+ this.nowInHumidty = nowInHumidty;
+ }
+
+ public int getFilterRemaining() {
+ return filterRemaining;
+ }
+
+ public void setFilterRemaining(int filterRemaining) {
+ this.filterRemaining = filterRemaining;
+ }
+
+ public byte getUseTimeoutState() {
+ return useTimeoutState;
+ }
+
+ public void setUseTimeoutState(byte useTimeoutState) {
+ this.useTimeoutState = useTimeoutState;
+ }
+
+ public byte[] getCurState() {
+ return curState;
+ }
+
+ public void setCurState(byte[] curState) {
+ this.curState = curState;
+ }
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLFreshAir/Parser/FreshAirJinMaoParser.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLFreshAir/Parser/FreshAirJinMaoParser.java
new file mode 100644
index 0000000..649c0ba
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLFreshAir/Parser/FreshAirJinMaoParser.java
@@ -0,0 +1,139 @@
+package com.hdl.sdk.ttl.HDLAppliances.HDLFreshAir.Parser;
+
+
+import com.hdl.sdk.ttl.Config.Configuration;
+import com.hdl.sdk.ttl.HDLAppliances.Config.HDLApConfig;
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
+import com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLDeviceManager;
+
+/**
+ * Created by JLChen on 2020-07-20
+ * 闄勫姞鏁版嵁锛�
+ * 缂栧彿 澶囨敞 鍊煎煙
+ * 0 鏂伴缂栧彿 1~200
+ * 1 绫诲瀷 绗笁鏂圭被鍨� 0锛氶噾鑼傛柊椋�
+ * 2 寮�鍏� 0-鍏虫満锛�1-寮�鏈�
+ * 3 杩愯妯″紡 1-閫氶锛�2-鍔犳箍
+ * 4 鑺傝兘鑸掗�傞�夋嫨 1-鑸掗�傦紝2-鑺傝兘
+ * 5 椋庨�熸。浣� 0-鑷姩锛�1-1妗o紝2-2妗o紝3-3妗�
+ * 6 婀垮害璁惧畾 %
+ * 7 瀹ゅ唴娓╁害鍊� 鈩�
+ * 8 瀹ゅ唴婀垮害鍊� 鈩�
+ * 9 杩囨护缃戝墿浣� %
+ * 10 杩囨护缃戜娇鐢ㄨ秴鏃�
+ */
+public class FreshAirJinMaoParser {
+
+ public static final int fail = 0;
+
+ public static final int SetSwich = 0;//璁剧疆寮�鍏崇姸鎬�
+ public static final int freshAirOn = 1;//鏂伴寮�
+ public static final int freshAirOff = 0;//鏂伴鍏�
+
+ public static final int SetSpeed = 1;//璁剧疆椋庨��
+ public static final int freshAirSpeedAuto = 0;//椋庨�� 鑷姩
+ public static final int freshAirSpeed1 = 1;//椋庨�� 1妗�
+ public static final int freshAirSpeed2 = 2;//椋庨�� 2妗�
+ public static final int freshAirSpeed3 = 3;//椋庨�� 3妗�
+
+ public static final int SetMode = 2;//璁剧疆杩愯妯″紡
+ public static final int freshAirModeVentilation = 1;//閫氶妯″紡
+ public static final int freshAirModeHumidify= 2;//鍔犳箍妯″紡
+
+ public static final int SetEnergySavingMode = 3;//璁剧疆鑺傝兘妯″紡
+ public static final int energySavingModeComfortable = 1;//鑸掗��
+ public static final int energySavingModeEs= 2;//鑺傝兘
+
+ public static final int SetHumidty= 4;//璁剧疆婀垮害
+
+
+
+
+ public static byte[] getFreshAirAddByte(AppliancesInfo appliancesInfo, int type, int state) {
+
+ try {
+ AppliancesInfo newInfo = appliancesInfo;
+ byte[] freshAirBytes = null;
+
+ outter:
+ for (int i = 0; i < HDLDeviceManager.devicesDataList.size(); i++) {
+ if (appliancesInfo.getDeviceSubnetID() == HDLDeviceManager.devicesDataList.get(i).getSourceSubnetID()
+ && appliancesInfo.getDeviceDeviceID() == HDLDeviceManager.devicesDataList.get(i).getSourceDeviceID()) {
+ for (int j = 0; j < HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().size(); j++) {
+ if (HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getBigType() == Configuration.FRESH_AIR_BIG_TYPE
+ && HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getDeviceType() == HDLApConfig.TYPE_FRESH_AIR_JINMAO
+ && appliancesInfo.getChannelNum() == HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getChannelNum()) {
+ newInfo = HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j);
+ if (newInfo.getArrCurState() == null) {
+ newInfo.setArrCurState(GetNewData(newInfo.getChannelNum()));
+ }
+ freshAirBytes = newInfo.getArrCurState();
+ break outter;
+ }
+
+ }
+ }
+ }
+
+ byte[] addBytes = new byte[11];
+ if (freshAirBytes != null && freshAirBytes.length >= 11) {
+ System.arraycopy(freshAirBytes, 0, addBytes, 0, freshAirBytes.length);
+ addBytes[0] = (byte) newInfo.getChannelNum();
+ }else {
+ addBytes = GetNewData(newInfo.getChannelNum());
+ }
+
+
+ switch (type) {
+ case SetSwich://璁剧疆寮�鍏崇姸鎬�
+ if (state == freshAirOn) {
+ addBytes[2] = 1;
+ } else {
+ addBytes[2] = 0;
+ }
+ break;
+ case SetMode://璁剧疆杩愯妯″紡
+ addBytes[2] = 1;
+ addBytes[3] = (byte) state;
+ break;
+ case SetEnergySavingMode://璁剧疆鑺傝兘妯″紡
+ addBytes[2] = 1;
+ addBytes[4] = (byte) state;
+ break;
+ case SetSpeed://璁剧疆椋庨��
+ addBytes[2] = 1;
+ addBytes[5] = (byte) state;
+ break;
+ case SetHumidty://璁剧疆婀垮害
+ addBytes[2] = 1;
+ addBytes[6] = (byte) state;
+ break;
+
+ }
+
+ return addBytes;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return new byte[]{fail};
+ }
+
+ }
+
+
+ public static byte[] GetNewData(int mChannelNum){
+ byte[] addBytes = new byte[11];
+ addBytes[0] = (byte) mChannelNum;
+ addBytes[1] = 0;
+ addBytes[2] = 0;//寮�鍏�
+ addBytes[3] = (byte)1;
+ addBytes[4] = (byte)1;
+ addBytes[5] = (byte)0;
+ addBytes[6] = (byte)0;
+ addBytes[7] = (byte)28;
+ addBytes[8] = (byte)0;
+ addBytes[9] = (byte)100;
+ addBytes[10] = (byte)1;
+ return addBytes;
+ }
+
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLFreshAir/Parser/FreshAirParser.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLFreshAir/Parser/FreshAirParser.java
new file mode 100644
index 0000000..2544b5d
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLFreshAir/Parser/FreshAirParser.java
@@ -0,0 +1,100 @@
+package com.hdl.sdk.ttl.HDLAppliances.HDLFreshAir.Parser;
+
+
+import com.hdl.sdk.ttl.Config.Configuration;
+import com.hdl.sdk.ttl.HDLAppliances.Config.HDLApConfig;
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
+import com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLDeviceManager;
+
+/**
+ * Created by JLChen on 2019/7/9
+ */
+public class FreshAirParser {
+ // 闄勫姞鏁版嵁锛� 鏂伴閫氶亾鍙凤紙1 - 200锛� + 寮�鍏筹紙0锛�1锛� + 椋庨�燂紙0 鍏筹紝1浣庯紝2涓紝3楂橈級 + 妯″紡锛�0鎵嬪姩锛�1 鑷姩,2 鏅鸿兘锛�3 瀹氭椂锛�
+ public static final int fail = 0;
+
+ public static final int freshAirSwich = 0;
+ public static final int freshAirOn = 1;//鏂伴寮�
+ public static final int freshAirOff = 0;//鏂伴鍏�
+
+ public static final int freshAirSpeed = 1;//椋庨��
+ public static final int freshAirSpeedAuto = 0;//椋庨�熷叧
+ public static final int freshAirSpeedLow = 1;//椋庨�熶綆
+ public static final int freshAirSpeedMid = 2;//椋庨�熶腑
+ public static final int freshAirSpeedHigh = 3;//椋庨�熼珮
+
+ public static final int freshAirMode = 2;//妯″紡
+ public static final int freshAirModeManual = 0;//鎵嬪姩
+ public static final int freshAirModeAuto = 1;//鑷姩
+ public static final int freshAirModeIntelligent = 2;//鏅鸿兘
+ public static final int freshAirModeTiming = 3;//瀹氭椂
+
+ public static byte[] getFreshAirAddByte(AppliancesInfo appliancesInfo, int type, int state) {
+ if (state > 3) {
+ return new byte[]{fail};
+ }
+
+ try {
+ AppliancesInfo newInfo = null;
+ byte[] freshAirBytes = null;
+
+ outter:
+ for (int i = 0; i < HDLDeviceManager.devicesDataList.size(); i++) {
+ if (appliancesInfo.getDeviceSubnetID() == HDLDeviceManager.devicesDataList.get(i).getSourceSubnetID()
+ && appliancesInfo.getDeviceDeviceID() == HDLDeviceManager.devicesDataList.get(i).getSourceDeviceID()) {
+ for (int j = 0; j < HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().size(); j++) {
+ if (HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getBigType() == Configuration.FRESH_AIR_BIG_TYPE
+ && HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getDeviceType() == HDLApConfig.TYPE_FRESH_AIR
+ && appliancesInfo.getChannelNum() == HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getChannelNum()) {
+ newInfo = HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j);
+ if (newInfo.getArrCurState() == null) {
+ newInfo.setArrCurState(new byte[30]);
+ }
+ freshAirBytes = newInfo.getArrCurState();
+ break outter;
+ }
+
+ }
+ }
+ }
+
+ byte[] addBytes = new byte[4];
+ if (freshAirBytes != null && freshAirBytes.length >= 4) {
+ addBytes[0] = (byte) appliancesInfo.getChannelNum();
+ addBytes[1] = freshAirBytes[1];
+ addBytes[2] = freshAirBytes[2];
+ addBytes[3] = freshAirBytes[3];
+
+ } else {
+ addBytes[0] = (byte) appliancesInfo.getChannelNum();
+ addBytes[1] = 0;//鍙戦�侀粯璁ゅ弬鏁�
+ addBytes[2] = 0;
+ addBytes[3] = 0;
+ }
+
+ switch (type) {
+ case freshAirSwich:
+ if (state == freshAirOff) {
+ addBytes[1] = 0;
+ } else {
+ addBytes[1] = 1;
+ }
+ break;
+ case freshAirSpeed:
+ addBytes[1] = 1;//鎵撳紑鎿嶄綔
+ addBytes[2] = (byte) state;
+ break;
+ case freshAirMode:
+ addBytes[1] = 1;//鎵撳紑鎿嶄綔
+ addBytes[3] = (byte) state;
+ break;
+ }
+ return addBytes;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return new byte[]{fail};
+ }
+
+ }
+
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLGeothermal/GeothermalBackInfo.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLGeothermal/GeothermalBackInfo.java
new file mode 100644
index 0000000..874c250
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLGeothermal/GeothermalBackInfo.java
@@ -0,0 +1,173 @@
+package com.hdl.sdk.ttl.HDLAppliances.HDLGeothermal;
+
+
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
+
+/**
+ * Created by JLChen on 2019/7/10
+ */
+public class GeothermalBackInfo {
+
+ private AppliancesInfo appliancesInfo;
+ private String remarks;
+ private int channelNum; //鍥炶矾鍙�
+ private int isOn; //0=鍏筹紝1=寮�
+ private int gMode; //鍦扮儹 1 = 鏅�氭ā寮�, 2 = 鐧藉ぉ妯″紡 , 3 = 澶滈棿妯″紡, 4 = 绂诲紑妯″紡, 5 = 鑷姩妯″紡
+
+ private int gNormalTemp;//鏅�氭ā寮忔俯搴�
+ private int gDayTemp; //鐧藉ぉ妯″紡娓╁害
+ private int gNightTemp; //澶滈棿妯″紡娓╁害
+ private int gLeaveTemp; //绂诲紑妯″紡娓╁害
+
+ private int gAutoTemp; //鑷姩妯″紡妯″紡娓╁害
+ private int gCurrentTemp;//褰撳墠娓╁害
+ private byte[] curState;//鎺у埗鍥為淇℃伅
+ private boolean bCtrlFeedback;
+
+ public GeothermalBackInfo() {
+
+ }
+
+ /**
+ * GeothermalBackInfo
+ * @param mAppliancesInfo
+ * @param bCtrlFeedback 鏄惁鎺у埗鐘舵�佺殑鍙嶉
+ */
+ public GeothermalBackInfo(AppliancesInfo mAppliancesInfo , boolean bCtrlFeedback) {
+ this.bCtrlFeedback = bCtrlFeedback;
+ this.appliancesInfo = mAppliancesInfo;
+ this.curState = mAppliancesInfo.getArrCurState();
+ this.remarks = mAppliancesInfo.getRemarks();
+
+ if (this.curState == null) return;
+
+ if (this.curState.length >= 10) {
+ this.channelNum = this.curState[0] & 0xFF;
+ this.isOn = this.curState[1] & 0x0F;//鍙彇浣�4浣�
+ this.gMode = this.curState[3] & 0xFF;
+ this.gNormalTemp = this.curState[4] & 0xFF;
+ this.gDayTemp = this.curState[5] & 0xFF;
+ this.gNightTemp = this.curState[6] & 0xFF;
+ this.gLeaveTemp = this.curState[7] & 0xFF;
+ this.gAutoTemp = this.curState[8] & 0xFF;
+// this.gCurrentTemp = this.curState[9] & 0xFF;
+ //褰撳墠娓╁害锛堢幆澧冩俯搴︼級 bit7 0=姝e�� 1=璐熷��
+ if(((this.curState[9] & 0xFF) >> 7) > 0){
+ this.gCurrentTemp = -(this.curState[9] & 0x7F);
+ }else{
+ this.gCurrentTemp = this.curState[9] & 0x7F;
+ }
+
+ }
+
+ }
+
+
+
+ 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 int getIsOn() {
+ return isOn;
+ }
+
+ public void setIsOn(int isOn) {
+ this.isOn = isOn;
+ }
+
+ public int getgMode() {
+ return gMode;
+ }
+
+ public void setgMode(int gMode) {
+ this.gMode = gMode;
+ }
+
+ public int getgNormalTemp() {
+ return gNormalTemp;
+ }
+
+ public void setgNormalTemp(int gNormalTemp) {
+ this.gNormalTemp = gNormalTemp;
+ }
+
+ public int getgDayTemp() {
+ return gDayTemp;
+ }
+
+ public void setgDayTemp(int gDayTemp) {
+ this.gDayTemp = gDayTemp;
+ }
+
+ public int getgNightTemp() {
+ return gNightTemp;
+ }
+
+ public void setgNightTemp(int gNightTemp) {
+ this.gNightTemp = gNightTemp;
+ }
+
+ public int getgLeaveTemp() {
+ return gLeaveTemp;
+ }
+
+ public void setgLeaveTemp(int gLeaveTemp) {
+ this.gLeaveTemp = gLeaveTemp;
+ }
+
+ public byte[] getCurState() {
+ return curState;
+ }
+
+ public void setCurState(byte[] curState) {
+ this.curState = curState;
+ }
+
+ public int getgAutoTemp() {
+ return gAutoTemp;
+ }
+
+ public void setgAutoTemp(int gAutoTemp) {
+ this.gAutoTemp = gAutoTemp;
+ }
+
+ public int getgCurrentTemp() {
+ return gCurrentTemp;
+ }
+
+ public void setgCurrentTemp(int gCurrentTemp) {
+ this.gCurrentTemp = gCurrentTemp;
+ }
+
+ public boolean isbCtrlFeedback() {
+ return bCtrlFeedback;
+ }
+
+ public void setbCtrlFeedback(boolean bCtrlFeedback) {
+ this.bCtrlFeedback = bCtrlFeedback;
+ }
+
+
+
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLGeothermal/Parser/GeothermalParser.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLGeothermal/Parser/GeothermalParser.java
new file mode 100644
index 0000000..cf3d023
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLGeothermal/Parser/GeothermalParser.java
@@ -0,0 +1,201 @@
+package com.hdl.sdk.ttl.HDLAppliances.HDLGeothermal.Parser;
+
+
+import com.hdl.sdk.ttl.Config.Configuration;
+import com.hdl.sdk.ttl.HDLAppliances.Config.HDLApConfig;
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
+import com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLDeviceManager;
+
+/**
+ * Created by JLChen on 2019/7/10
+ */
+public class GeothermalParser {
+
+ public static final int fail = 0;
+
+ public static final int gSwich = 2;
+ public static final int gSwichOn = 1;//鍦扮儹妯″潡寮�
+ public static final int gSwichOff = 0;//鍦扮儹妯″潡鍏�
+
+
+ public static final int gMode = 4; //妯″紡
+ public static final int gModeNormal = 1;//鏅�氭ā寮�
+ public static final int gModeDay = 2;//鐧藉ぉ妯″紡
+ public static final int gModeNight = 3;//澶滈棿妯″紡
+ public static final int gModeLeave = 4;//绂诲紑妯″紡
+ public static final int gModeAuto = 5;//鑷姩妯″紡
+
+ public static final int gNormalTemp = 5;//鏅�氭ā寮忔俯搴�
+ public static final int gDayTemp = 6;//鐧藉ぉ妯″紡娓╁害
+ public static final int gNightTemp = 7;//澶滈棿妯″紡娓╁害
+ public static final int gLeaveTemp = 8;//绂诲紑妯″紡娓╁害
+
+ // feedbackState [鍥炶矾锛屽紑鍏崇姸鎬侊紝娓╁害绫诲瀷锛屾ā寮忥紝鏅�氭俯搴︼紝鐧藉ぉ娓╁害锛屽闂存俯搴︼紝绂诲紑娓╁害锛岃嚜鍔ㄦ俯搴︼紝褰撳墠娓╁害]
+ public static byte[] getGeothermalAddByte(AppliancesInfo appliancesInfo, int type, int state) {
+ try {
+ AppliancesInfo newInfo = appliancesInfo;
+ byte[] airBytes = null;
+ outter:
+ for (int i = 0; i < HDLDeviceManager.devicesDataList.size(); i++) {
+ if (appliancesInfo.getDeviceSubnetID() == HDLDeviceManager.devicesDataList.get(i).getSourceSubnetID()
+ && appliancesInfo.getDeviceDeviceID() == HDLDeviceManager.devicesDataList.get(i).getSourceDeviceID()) {
+ for (int j = 0; j < HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().size(); j++) {
+ if (HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getBigType() == Configuration.GEOTHERMAL_BIG_TYPE
+ && (HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getDeviceType() == HDLApConfig.TYPE_GEOTHERMAL_MODULE
+ || HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getDeviceType() == HDLApConfig.TYPE_GEOTHERMAL_JINMAO)
+ && appliancesInfo.getChannelNum() == HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getChannelNum()) {
+ newInfo = HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j);
+ if (newInfo.getArrCurState() == null) {
+ newInfo.setArrCurState(new byte[10]);
+ }
+ airBytes = newInfo.getArrCurState();
+ break outter;
+ }
+
+ }
+ }
+ }
+
+ byte[] addBytes = new byte[10];
+ if (airBytes != null && airBytes.length >= 10) {
+ addBytes[0] = (byte) newInfo.getChannelNum();
+ addBytes[1] = airBytes[1];
+ addBytes[2] = 0;
+ addBytes[3] = airBytes[3];
+ addBytes[4] = airBytes[4];
+ addBytes[5] = airBytes[5];
+ addBytes[6] = airBytes[6];
+ addBytes[7] = airBytes[7];
+ addBytes[8] = 0;
+ addBytes[9] = 0;
+ } else {
+ addBytes[0] = (byte) newInfo.getChannelNum();
+ addBytes[1] = 0;
+ addBytes[2] = 0;
+ addBytes[3] = 1;
+ addBytes[4] = 30;
+ addBytes[5] = 30;
+ addBytes[6] = 30;
+ addBytes[7] = 30;
+ addBytes[8] = 0;
+ addBytes[9] = 0;
+ }
+
+ switch (type) {
+ case gSwich:
+ if (state == gSwichOff) {
+ addBytes[1] = 0;
+ } else {
+ addBytes[1] = 1;
+ }
+ break;
+ case gMode:
+ addBytes[1] = 1;
+ addBytes[3] = (byte) state;
+ break;
+ case gNormalTemp:
+ addBytes[1] = 1;//鎵撳紑
+ addBytes[4] = (byte) state;
+ break;
+ case gDayTemp:
+ addBytes[1] = 1;//鎵撳紑
+ addBytes[5] = (byte) state;
+ break;
+ case gNightTemp:
+ addBytes[1] = 1;//鎵撳紑
+ addBytes[6] = (byte) state;
+ break;
+ case gLeaveTemp:
+ addBytes[1] = 1;//鎵撳紑
+ addBytes[7] = (byte) state;
+ break;
+ }
+ return addBytes;
+
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ return new byte[]{fail};
+ }
+
+ }
+
+ //鏍规嵁褰撳墠妯″紡璁剧疆娓╁害
+ public static byte[] getGeothermalAddByteTemp(AppliancesInfo appliancesInfo, int state) {
+ try {
+ AppliancesInfo newInfo = null;
+ byte[] airBytes = null;
+ outter:
+ for (int i = 0; i < HDLDeviceManager.devicesDataList.size(); i++) {
+ if (appliancesInfo.getDeviceSubnetID() == HDLDeviceManager.devicesDataList.get(i).getSourceSubnetID()
+ && appliancesInfo.getDeviceDeviceID() == HDLDeviceManager.devicesDataList.get(i).getSourceDeviceID()) {
+ for (int j = 0; j < HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().size(); j++) {
+ if (HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getBigType() == Configuration.GEOTHERMAL_BIG_TYPE
+ && (HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getDeviceType() == HDLApConfig.TYPE_GEOTHERMAL_MODULE
+ || HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getDeviceType() == HDLApConfig.TYPE_GEOTHERMAL_JINMAO)
+ && appliancesInfo.getChannelNum() == HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getChannelNum()) {
+ newInfo = HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j);
+ if (newInfo.getArrCurState() == null) {
+ newInfo.setArrCurState(new byte[10]);
+ }
+ airBytes = newInfo.getArrCurState();
+ break outter;
+ }
+
+ }
+ }
+ }
+
+ byte[] addBytes = new byte[10];
+ if (airBytes != null && airBytes.length >= 10) {
+ addBytes[0] = (byte) newInfo.getChannelNum();
+ addBytes[1] = airBytes[1];
+ addBytes[2] = 0;
+ addBytes[3] = airBytes[3];
+ addBytes[4] = airBytes[4];
+ addBytes[5] = airBytes[5];
+ addBytes[6] = airBytes[6];
+ addBytes[7] = airBytes[7];
+ addBytes[8] = 0;
+ addBytes[9] = 0;
+ } else {
+ addBytes[0] = (byte) newInfo.getChannelNum();
+ addBytes[1] = 0;
+ addBytes[2] = 0;
+ addBytes[3] = 1;
+ addBytes[4] = 30;
+ addBytes[5] = 30;
+ addBytes[6] = 30;
+ addBytes[7] = 30;
+ addBytes[8] = 0;
+ addBytes[9] = 0;
+ }
+
+ switch (addBytes[3]) {
+ case gModeNormal:
+ addBytes[1] = 1;//鎵撳紑
+ addBytes[4] = (byte) state;
+ break;
+ case gModeDay:
+ addBytes[1] = 1;//鎵撳紑
+ addBytes[5] = (byte) state;
+ break;
+ case gModeNight:
+ addBytes[1] = 1;//鎵撳紑
+ addBytes[6] = (byte) state;
+ break;
+ case gModeLeave:
+ addBytes[1] = 1;//鎵撳紑
+ addBytes[7] = (byte) state;
+ break;
+ }
+ return addBytes;
+
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ return new byte[]{fail};
+ }
+
+ }
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLLight/ColourLightCtrlBackInfo.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLLight/ColourLightCtrlBackInfo.java
new file mode 100644
index 0000000..b1b188f
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLLight/ColourLightCtrlBackInfo.java
@@ -0,0 +1,145 @@
+package com.hdl.sdk.ttl.HDLAppliances.HDLLight;
+
+
+import android.graphics.Color;
+
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
+
+import java.io.Serializable;
+import java.util.Arrays;
+
+/**
+ * Created by panlili on 2023/8/22.
+ * CCT OR RGB
+ */
+
+public class ColourLightCtrlBackInfo implements Serializable {
+ AppliancesInfo appliancesInfo;
+ int channelNum;//鍥炶矾鍙�
+ String remarks;//澶囨敞
+ int brightness;//浜害
+ int type = 0;//绫诲瀷锛�1鍗曡矾锛�2CCT锛�3RGB
+ int colorTemp = 0;//鑹叉俯
+ int color;//RGB
+ /**
+ * 閫昏緫鐏被鍨媉鍗曡矾璋冭妭
+ */
+ public static final int CONTROL_TYPE_SINGLE = 1;
+ /**
+ * 閫昏緫鐏被鍨媉CCT
+ */
+ public static final int CONTROL_TYPE_CCT = 2;
+ /**
+ * 閫昏緫鐏被鍨媉RGB
+ */
+ public static final int CONTROL_TYPE_RGB = 3;
+
+ private byte[] curState;//鎺у埗鍥為淇℃伅
+
+ public ColourLightCtrlBackInfo() {
+
+ }
+
+ public ColourLightCtrlBackInfo(AppliancesInfo mAppliancesInfo) {
+ this.appliancesInfo = mAppliancesInfo;
+ this.curState = mAppliancesInfo.getArrCurState();
+ this.remarks = mAppliancesInfo.getRemarks();
+
+ if (this.curState == null) return;
+
+ if (this.curState.length >= 10) {
+ this.channelNum = this.curState[0] & 0xFF;
+ this.brightness = this.curState[1] & 0xFF;
+ this.type = this.curState[5] & 0xFF;
+ if (this.type == CONTROL_TYPE_CCT) {
+ this.colorTemp = (this.curState[6] & 0xFF) * 256 + (this.curState[7] & 0xFF);
+ } else if (this.type == CONTROL_TYPE_RGB) {
+ int color_r = this.curState[6] & 0xFF;
+ int color_g = this.curState[7] & 0xFF;
+ int color_b = this.curState[8] & 0xFF;
+ this.color = Color.rgb(color_r, color_g, color_b);
+ }
+ }
+
+ }
+
+
+ public String getRemarks() {
+ return remarks;
+ }
+
+ public void setRemarks(String remarks) {
+ this.remarks = remarks;
+ }
+
+ public AppliancesInfo getAppliancesInfo() {
+ return appliancesInfo;
+ }
+
+ public void setAppliancesInfo(AppliancesInfo appliancesInfo) {
+ this.appliancesInfo = appliancesInfo;
+ }
+
+ public int getChannelNum() {
+ return channelNum;
+ }
+
+ public void setChannelNum(int channelNum) {
+ this.channelNum = channelNum;
+ }
+
+
+ public int getBrightness() {
+ return brightness;
+ }
+
+ public void setBrightness(int brightness) {
+ this.brightness = brightness;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public void setType(int type) {
+ this.type = type;
+ }
+
+ public int getColorTemp() {
+ return colorTemp;
+ }
+
+ public void setColorTemp(int colorTemp) {
+ this.colorTemp = colorTemp;
+ }
+
+ public int getColor() {
+ return color;
+ }
+
+ public void setColor(int color) {
+ this.color = color;
+ }
+
+ public byte[] getCurState() {
+ return curState;
+ }
+
+ public void setCurState(byte[] curState) {
+ this.curState = curState;
+ }
+
+ @Override
+ public String toString() {
+ return "ColourLightCtrlBackInfo{" +
+ "appliancesInfo=" + appliancesInfo +
+ ", channelNum=" + channelNum +
+ ", remarks='" + remarks + '\'' +
+ ", brightness=" + brightness +
+ ", type=" + type +
+ ", colorTemp=" + colorTemp +
+ ", color=" + color +
+ ", curState=" + Arrays.toString(curState) +
+ '}';
+ }
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLLight/Parser/LightCtrlParser.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLLight/Parser/LightCtrlParser.java
new file mode 100644
index 0000000..ce9bbf8
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLLight/Parser/LightCtrlParser.java
@@ -0,0 +1,61 @@
+package com.hdl.sdk.ttl.HDLAppliances.HDLLight.Parser;
+
+import com.hdl.sdk.ttl.HDLAppliances.Config.HDLApConfig;
+import com.hdl.sdk.ttl.HDLAppliances.HDLLight.ColourLightCtrlBackInfo;
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
+
+/**
+ * Created by panlili on 2023/8/22.
+ */
+
+public class LightCtrlParser {
+ public static final int fail = 0;
+
+ public static byte[] getColourLightAddByte(AppliancesInfo appliancesInfo, int brightness, int color) {
+ try {
+ byte[] addBytes = new byte[10];
+ addBytes[0] = (byte) appliancesInfo.getChannelNum();
+ addBytes[1] = (byte) brightness;
+ addBytes[2] = (byte) 254;
+ addBytes[3] = (byte) 0;
+ addBytes[4] = (byte) 0;
+
+ if (appliancesInfo.getDeviceType() == HDLApConfig.TYPE_LIGHT_RGB || appliancesInfo.getDeviceType() == HDLApConfig.TYPE_LIGHT_DMX) {
+ addBytes[5] = ColourLightCtrlBackInfo.CONTROL_TYPE_RGB;
+ addBytes[6] = (byte) getColorR(color);
+ addBytes[7] = (byte) getColorG(color);
+ addBytes[8] = (byte) getColorB(color);
+ addBytes[9] = (byte) 0;
+
+ } else if (appliancesInfo.getDeviceType() == HDLApConfig.TYPE_LIGHT_CCT || appliancesInfo.getDeviceType() == HDLApConfig.TYPE_LIGHT_DALI) {
+ addBytes[5] = ColourLightCtrlBackInfo.CONTROL_TYPE_CCT;
+ addBytes[6] = (byte) (color / 256);
+ addBytes[7] = (byte) (color % 256);
+ addBytes[8] = (byte) 0;
+ addBytes[9] = (byte) 0;
+ }
+
+ return addBytes;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return new byte[]{fail};
+ }
+
+ }
+
+ public static int getColorR(int color) {
+ int red = (color & 0xff0000) >> 16;
+ return red;
+ }
+
+ public static int getColorG(int color) {
+ int green = (color & 0x00ff00) >> 8;
+ return green;
+ }
+
+ public static int getColorB(int color) {
+ int blue = (color & 0x0000ff);
+ return blue;
+ }
+
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLSecurity/Parser/SecurityParser.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLSecurity/Parser/SecurityParser.java
index 8e9ae9c..8e3b21b 100644
--- a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLSecurity/Parser/SecurityParser.java
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLSecurity/Parser/SecurityParser.java
@@ -91,7 +91,6 @@
case ALARM_CURRENT:
addBytes[1] = (byte) (1 << 4);
break;
-
case ALARM_SILENT:
addBytes[2] = (byte) (1 << 5);
break;
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/AppliancesInfo.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/AppliancesInfo.java
index 1568fae..63dd7a8 100644
--- a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/AppliancesInfo.java
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/AppliancesInfo.java
@@ -203,13 +203,12 @@
// }
public String getDeviceKey() {
- if (deviceKey == null) {
- deviceKey = "K" + this.bigType
- + "-" + this.littleType
- + "-" + this.deviceSubnetID
- + "-" + this.deviceDeviceID
- + "-" + this.channelNum;
- }
+ deviceKey = this.bigType
+ + "-" + this.littleType
+ + "-" + this.deviceSubnetID
+ + "-" + this.deviceDeviceID
+ + "-" + this.channelNum;
+
return deviceKey;
}
@@ -223,10 +222,10 @@
"deviceName='" + deviceName + '\'' +
", bigType=" + bigType +
", littleType=" + littleType +
- ", ctrlCommand=" + ctrlCommand +
- ", ctrlBackCommand=" + ctrlBackCommand +
- ", stateCommand=" + stateCommand +
- ", stateBackCommand=" + stateBackCommand +
+ ", ctrlCommand=" + Integer.toHexString(ctrlCommand) +
+ ", ctrlBackCommand=" + Integer.toHexString(ctrlBackCommand) +
+ ", stateCommand=" + Integer.toHexString(stateCommand) +
+ ", stateBackCommand=" + Integer.toHexString(stateBackCommand) +
", channelNum=" + channelNum +
", deviceSubnetID=" + deviceSubnetID +
", deviceDeviceID=" + deviceDeviceID +
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLCommand.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLCommand.java
index 84a4bb7..302b167 100644
--- a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLCommand.java
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLCommand.java
@@ -1,6 +1,7 @@
package com.hdl.sdk.ttl.HDLDeviceManger.Core;
import android.content.Context;
+import android.util.Log;
import com.hdl.sdk.ttl.Config.Configuration;
import com.hdl.sdk.ttl.Config.MCUConstants;
@@ -11,17 +12,32 @@
import com.hdl.sdk.ttl.HDLAppliances.HDLCommonSwitch.CommonSwitchBackInfo;
import com.hdl.sdk.ttl.HDLAppliances.HDLCurtain.CurtainCtrlBackInfo;
import com.hdl.sdk.ttl.HDLAppliances.HDLCurtain.Parser.CurtainCtrlParser;
+import com.hdl.sdk.ttl.HDLAppliances.HDLDoorMachine.DoorMachineBackInfo;
+import com.hdl.sdk.ttl.HDLAppliances.HDLDoorMachine.Parser.DoorMachineParser;
+import com.hdl.sdk.ttl.HDLAppliances.HDLFreshAir.FreshAirBackInfo;
+import com.hdl.sdk.ttl.HDLAppliances.HDLFreshAir.FreshAirJinMaoBackInfo;
+import com.hdl.sdk.ttl.HDLAppliances.HDLFreshAir.Parser.FreshAirJinMaoParser;
+import com.hdl.sdk.ttl.HDLAppliances.HDLFreshAir.Parser.FreshAirParser;
+import com.hdl.sdk.ttl.HDLAppliances.HDLGeothermal.GeothermalBackInfo;
+import com.hdl.sdk.ttl.HDLAppliances.HDLGeothermal.Parser.GeothermalParser;
+import com.hdl.sdk.ttl.HDLAppliances.HDLLight.ColourLightCtrlBackInfo;
import com.hdl.sdk.ttl.HDLAppliances.HDLLight.LightCtrlBackInfo;
+import com.hdl.sdk.ttl.HDLAppliances.HDLLight.Parser.LightCtrlParser;
import com.hdl.sdk.ttl.HDLAppliances.HDLLogic.LogicCtrlBackInfo;
import com.hdl.sdk.ttl.HDLAppliances.HDLSecurity.Parser.SecurityParser;
import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
import com.hdl.sdk.ttl.HDLDeviceManger.Bean.DeviceStateBean;
import com.hdl.sdk.ttl.HDLDeviceManger.Bean.MCUDataBean;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.AirFeedBackEvent;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.ColourLightFeedBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.CommonSwitchCtrlBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.CurtainFeedBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DeviceStateEvent;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DoorMachineFeedBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.EventCode;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.FreshAirFeedBackEvent;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.FreshAirJinMaoFeedBackEvent;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.GeothermalFeedBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.LightFeedBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.LogicFeedBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.MCUFeedBackEvent;
@@ -55,6 +71,9 @@
private static Timer securityCtrlFailTimer = null;//瀹夐槻妯″潡鎿嶄綔澶辫触Timer
private static Timer commonSwitchCtrlFailTimer = null;//閫氱敤寮�鍏冲け璐imer
+ private static Timer freshAirCtrlFailTimer = null;//鎺у埗鏂伴澶辫触Timer
+ private static Timer geothermalCtrlFailTimer = null;//鎺у埗鍦扮儹澶辫触Timer 2020-07-20
+ private static Timer doorMachineCtrlFailTimer = null;//鎺у埗闂ㄩ攣澶辫触Timer
// /**
// * 鍒濆鍖� SDK
@@ -87,6 +106,14 @@
*/
public static void getHomeDevices() {
HandleSearch.getHomeDevices();
+ }
+
+
+ /**
+ * 鑾峰彇瀹跺眳璁惧澶囨敞
+ */
+ public static void getDevRemarks() {
+ HandleSearch.getDevRemarks();
}
/**
@@ -233,6 +260,40 @@
}, mRequestTimeout);
}
+ /**
+ * 鎺у埗CCT OR RGB
+ *
+ * @param info
+ * @param brightness 浜害
+ * @param color
+ */
+ public static void colourLightCtrl(final AppliancesInfo info, int brightness, int color) {
+ HDLDeviceManager.setDeviceCtrlSuccessStateWithInfo(info, false);
+ if (lightCtrlFailTimer != null) {
+ lightCtrlFailTimer.cancel();
+ lightCtrlFailTimer = null;
+ }
+ if (info.getBigType() == Configuration.LIGTH_BIG_TYPE) {
+ addSendData(info, LightCtrlParser.getColourLightAddByte(info, brightness, color), Configuration.CONTROL);
+
+ lightCtrlFailTimer = new Timer();
+ lightCtrlFailTimer.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ if (!HDLDeviceManager.getDeviceCtrlSuccessStateWithInfo(info)) {
+ ColourLightCtrlBackInfo colourLightCtrlBackInfo = new ColourLightCtrlBackInfo(info);
+ EventBus.getDefault().post(new ColourLightFeedBackEvent(colourLightCtrlBackInfo, false));
+ }
+ }
+ }, mRequestTimeout);
+
+ } else {
+ HDLLog.I("鐏厜璁惧鎺у埗涓嶅湪鑼冨洿鍐�"
+ + " LittleType = " + info.getLittleType()
+ + " BigType = " + info.getBigType()
+ );
+ }
+ }
/**
* 鎺у埗绐楀笜
@@ -308,6 +369,11 @@
if (info.getBigType() == Configuration.AIR_BIG_TYPE) {
if (info.getDeviceType() == HDLApConfig.TYPE_AC_PANEL) {
addSendData(info, AirCtrlParser.getAirPanelAddByte(type, state), Configuration.CONTROL);
+ } else if (info.getDeviceType() == HDLApConfig.TYPE_AC_TECHSYS) {
+ byte[] airbytes = AirCtrlParser.getAirTechAddByte(info, type, state);
+ if (airbytes != null) {
+ addSendData(info, airbytes, Configuration.CONTROL);
+ }
} else {
byte[] airbytes = AirCtrlParser.getAcAddByte(info, type, state);
if (airbytes != null) {
@@ -379,6 +445,7 @@
/**
* 鑾峰彇閫氱敤寮�鍏崇姸鎬�
+ *
* @param info
*/
public static void getCommonSwitchStateFromNetwork(final AppliancesInfo info) {
@@ -400,6 +467,7 @@
/**
* 瀹夐槻妯″潡 甯冮槻璁剧疆
* 2019-7-29
+ *
* @param info
*/
public static void securityArmingCtrl(final AppliancesInfo info, int state) {
@@ -417,7 +485,7 @@
@Override
public void run() {
if (!HDLDeviceManager.getDeviceCtrlSuccessStateWithInfo(info)) {
- EventBus.getDefault().post(new SecurityArmingFeedBackEvent(info,0, false));
+ EventBus.getDefault().post(new SecurityArmingFeedBackEvent(info, 0, false));
}
}
}, 5000);
@@ -433,6 +501,7 @@
/**
* 瀹夐槻妯″潡 鎶ヨ璁剧疆
* 2019-7-29
+ *
* @param info
* @param state 鍙戦�佺殑鎶ヨ鍐呭锛屽彧鎶ヨ涓�绉�
*/
@@ -612,6 +681,7 @@
/**
* 鑾峰彇绐楀笜璁惧鐘舵��
+ *
* @param info
*/
public static void getCurtainDeviceStateFromNetwork(final AppliancesInfo info) {
@@ -633,6 +703,7 @@
/**
* 鑾峰彇鐏厜璁惧鐘舵��
+ *
* @param info
*/
public static void getLightDeviceStateFromNetwork(final AppliancesInfo info) {
@@ -645,7 +716,7 @@
case HDLApConfig.TYPE_LIGHT_RELAY:
case HDLApConfig.TYPE_LIGHT_MIX_DIMMER:
case HDLApConfig.TYPE_LIGHT_MIX_RELAY:
- //鍙戦�佽幏鐏厜鐘舵�佹暟鎹�
+ //鍙戦�佽幏鍙栫伅鍏夌姸鎬佹暟鎹�
addSendData(info, new byte[0], Configuration.STATE);
break;
default:
@@ -654,10 +725,35 @@
}
}
+ /**
+ * 鑾峰彇CTT or RGB鐏澶囩姸鎬�
+ *
+ * @param info
+ */
+ public static void getColourLightDeviceStateFromNetwork(final AppliancesInfo info) {
+ if (info == null) {
+ return;
+ }
+ HDLDeviceManager.isGetDeviceStateSuccess = false;
+ switch (info.getDeviceType()) {
+ case HDLApConfig.TYPE_LIGHT_CCT:
+ case HDLApConfig.TYPE_LIGHT_RGB:
+ case HDLApConfig.TYPE_LIGHT_DALI:
+ case HDLApConfig.TYPE_LIGHT_DMX:
+ //鍙戦�佽幏鍙栫伅鍏夌姸鎬佹暟鎹�
+ byte[] sendbytes = new byte[]{(byte) info.getChannelNum()};
+ addSendData(info, sendbytes, Configuration.STATE);
+ break;
+ default:
+ HDLLog.I("涓嶆槸CTT or RGB鐏厜璁惧");
+ break;
+ }
+ }
/**
* 鑾峰彇閫昏緫 鍦烘櫙鍙�
+ *
* @param info
*/
public static void getLogicDeviceStateFromNetwork(final AppliancesInfo info) {
@@ -679,6 +775,7 @@
/**
* 鑾峰彇瀹夐槻妯″潡鐘舵��
+ *
* @param info
*/
public static void getSecurityStateFromNetwork(final AppliancesInfo info) {
@@ -699,6 +796,7 @@
/**
* 鑾峰彇浼犳劅鍣ㄦā鍧楃姸鎬�
+ *
* @param info
*/
public static void getSensorStateFromNetwork(final AppliancesInfo info) {
@@ -752,6 +850,7 @@
/**
* 鑾峰彇骞叉帴鐐逛紶鎰熷櫒妯″潡鐘舵��
+ *
* @param info
*/
public static void getDryContactSensorStateFromNetwork(final AppliancesInfo info) {
@@ -804,6 +903,7 @@
/**
* 鑾峰彇HVAC绌鸿皟璁惧鐘舵��
+ *
* @param info
*/
public static void getHVACDeviceStateFromNetwork(final AppliancesInfo info) {
@@ -815,10 +915,32 @@
case HDLApConfig.TYPE_AC_HVAC:
// case HDLApConfig.TYPE_AC_PANEL:
//鍙戦�丠VAC鐘舵�佹暟鎹�
- addSendData(info, new byte[]{(byte) info.getChannelNum()}, Configuration.STATE);
+ addSendData(info, new byte[]{(byte) info.getChannelNum()}, Configuration.STATE);
break;
default:
HDLLog.I("涓嶆槸HVAC绌鸿皟璁惧");
+ break;
+ }
+ }
+
+
+ /**
+ * 鑾峰彇绉戞妧绯荤粺鐘舵��
+ *
+ * @param info
+ */
+ public static void getTechSysDeviceStateFromNetwork(final AppliancesInfo info) {
+ if (info == null) {
+ return;
+ }
+ HDLDeviceManager.isGetDeviceStateSuccess = false;
+ switch (info.getDeviceType()) {
+ case HDLApConfig.TYPE_AC_TECHSYS:
+ //鍙戦�佺鎶�绯荤粺鐘舵�佹暟鎹�
+ addSendData(info, new byte[]{(byte) info.getChannelNum()}, Configuration.STATE);
+ break;
+ default:
+ HDLLog.I("涓嶆槸绉戞妧绯荤粺璁惧");
break;
}
}
@@ -857,6 +979,7 @@
case HDLApConfig.TYPE_AC_COOLMASTER:
case HDLApConfig.TYPE_AC_INFRARED:
case HDLApConfig.TYPE_AC_PANEL:
+ case HDLApConfig.TYPE_AC_TECHSYS:
//2019-8-21 澧炲姞鍒ょ┖
byte[] acState = getACState(info);
if (acState != null && acState.length >= 4) {
@@ -1081,6 +1204,7 @@
switch (info.getDeviceType()) {
case HDLApConfig.TYPE_AC_HVAC:
case HDLApConfig.TYPE_AC_PANEL:
+ case HDLApConfig.TYPE_AC_TECHSYS:
curState = infos.get(j).getArrCurState();
break;
default:
@@ -1127,6 +1251,321 @@
}
+ /**
+ * 鑾峰彇鏂伴
+ *
+ * @param info
+ */
+ public static void getFreshAirDeviceStateFromNetwork(final AppliancesInfo info) {
+ if (info == null) {
+ return;
+ }
+ HDLDeviceManager.isGetDeviceStateSuccess = false;
+ switch (info.getDeviceType()) {
+ case HDLApConfig.TYPE_FRESH_AIR:
+ case HDLApConfig.TYPE_FRESH_AIR_JINMAO:
+ //鍙戦�佽幏鍙栨柊椋庣郴缁熸墍鏈夋暟鎹�
+ addSendData(info, new byte[]{(byte) info.getChannelNum()}, Configuration.STATE);
+ break;
+ default:
+ HDLLog.I("涓嶆槸鏂伴绯荤粺璁惧");
+ break;
+ }
+ }
+
+ /**
+ * 鎺у埗鏂伴绯荤粺
+ *
+ * @param info
+ * @param type
+ * @param state 2020-07-20
+ */
+ public static void freshAirCtrl(final AppliancesInfo info, int type, int state) {
+// HDLDeviceManager.isFreshAirCtrlSuccess = false;
+ HDLDeviceManager.setDeviceCtrlSuccessStateWithInfo(info, false);
+ if (freshAirCtrlFailTimer != null) {
+ freshAirCtrlFailTimer.cancel();
+ freshAirCtrlFailTimer = null;
+ }
+ if (info.getBigType() == Configuration.FRESH_AIR_BIG_TYPE) {
+ byte[] freshAirbytes = FreshAirParser.getFreshAirAddByte(info, type, state);
+ addSendData(info, freshAirbytes, Configuration.CONTROL);
+ freshAirCtrlFailTimer = new Timer();
+ freshAirCtrlFailTimer.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ if (!HDLDeviceManager.getDeviceCtrlSuccessStateWithInfo(info)) {
+ FreshAirBackInfo mFreshAirBackInfo = new FreshAirBackInfo();
+ mFreshAirBackInfo.setAppliancesInfo(info);
+ EventBus.getDefault().post(new FreshAirFeedBackEvent(mFreshAirBackInfo, false));
+ }
+ }
+ }, mRequestTimeout);
+
+
+ } else {
+ HDLLog.I("鏂伴璁惧鎺у埗涓嶅湪鑼冨洿鍐�"
+ + " LittleType = " + info.getLittleType()
+ + " BigType = " + info.getBigType()
+ );
+ }
+ }
+
+
+ /**
+ * 鑾峰彇閲戣寕鏂伴鐘舵��
+ *
+ * @param info
+ */
+ public static void getFreshAirJinMaoDeviceStateFromNetwork(final AppliancesInfo info) {
+ if (info == null) {
+ return;
+ }
+ HDLDeviceManager.isGetDeviceStateSuccess = false;
+ switch (info.getDeviceType()) {
+ case HDLApConfig.TYPE_FRESH_AIR_JINMAO:
+ //鍙戦�佽幏鍙栨柊椋庣郴缁熸墍鏈夋暟鎹�
+ addSendData(info, new byte[]{(byte) info.getChannelNum()}, Configuration.STATE);
+ break;
+ default:
+ HDLLog.I("涓嶆槸閲戣寕鏂伴绯荤粺璁惧");
+ break;
+ }
+ }
+
+ /**
+ * 鎺у埗閲戣寕鏂伴
+ *
+ * @param info
+ * @param type
+ * @param state 2020-07-20
+ */
+ public static void freshAirJinMaoCtrl(final AppliancesInfo info, int type, int state) {
+// HDLDeviceManager.isFreshAirCtrlSuccess = false;
+ HDLDeviceManager.setDeviceCtrlSuccessStateWithInfo(info, false);
+ if (freshAirCtrlFailTimer != null) {
+ freshAirCtrlFailTimer.cancel();
+ freshAirCtrlFailTimer = null;
+ }
+ if (info.getDeviceType() == HDLApConfig.TYPE_FRESH_AIR_JINMAO) {
+ byte[] sendBytes = FreshAirJinMaoParser.getFreshAirAddByte(info, type, state);
+ addSendData(info, sendBytes, Configuration.CONTROL);
+ freshAirCtrlFailTimer = new Timer();
+ freshAirCtrlFailTimer.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ if (!HDLDeviceManager.getDeviceCtrlSuccessStateWithInfo(info)) {
+ FreshAirJinMaoBackInfo mFreshAirJinMaoBackInfo = new FreshAirJinMaoBackInfo();
+ mFreshAirJinMaoBackInfo.setAppliancesInfo(info);
+ EventBus.getDefault().post(new FreshAirJinMaoFeedBackEvent(mFreshAirJinMaoBackInfo, false));
+ }
+ }
+ }, mRequestTimeout);
+
+
+ } else {
+ HDLLog.I("涓嶆槸閲戣寕鏂伴绯荤粺璁惧");
+ }
+ }
+
+
+ /**
+ * 鑾峰彇鍦扮儹鐘舵��
+ *
+ * @param info
+ */
+ public static void getGeothermalStateFromNetwork(final AppliancesInfo info) {
+ if (info == null) {
+ return;
+ }
+ HDLDeviceManager.isGetDeviceStateSuccess = false;
+ switch (info.getDeviceType()) {
+ case HDLApConfig.TYPE_GEOTHERMAL_JINMAO:
+ case HDLApConfig.TYPE_GEOTHERMAL_MODULE:
+ //鍙戦�佽幏鍙栧湴鐑郴缁熸墍鏈夋暟鎹�
+ addSendData(info, new byte[]{(byte) info.getChannelNum()}, Configuration.STATE);
+ break;
+ default:
+ HDLLog.I("涓嶆槸鍦扮儹璁惧");
+ break;
+ }
+ }
+
+ /**
+ * 鎺у埗鍦扮儹妯″潡娓╁害
+ *
+ * @param info
+ * @param tempInt 2020-03-15
+ */
+ public static void geothermalCtrlTemp(final AppliancesInfo info, int tempInt) {
+// HDLDeviceManager.isGeothermalCtrlSuccess = false;
+ HDLDeviceManager.setDeviceCtrlSuccessStateWithInfo(info, false);
+ if (geothermalCtrlFailTimer != null) {
+ geothermalCtrlFailTimer.cancel();
+ geothermalCtrlFailTimer = null;
+ }
+ if (info.getBigType() == Configuration.GEOTHERMAL_BIG_TYPE) {
+ byte[] sendbytes = GeothermalParser.getGeothermalAddByteTemp(info, tempInt);
+ addSendData(info, sendbytes, Configuration.CONTROL);
+
+ geothermalCtrlFailTimer = new Timer();
+ geothermalCtrlFailTimer.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ if (!HDLDeviceManager.getDeviceCtrlSuccessStateWithInfo(info)) {
+ GeothermalBackInfo mGeothermalBackInfo = new GeothermalBackInfo();
+ mGeothermalBackInfo.setAppliancesInfo(info);
+ EventBus.getDefault().post(new GeothermalFeedBackEvent(mGeothermalBackInfo, EventCode.FAILURE_TIMEOUT));
+ }
+ }
+ }, mRequestTimeout);
+
+
+ } else {
+ HDLLog.I("鍦扮儹妯″潡鎺у埗涓嶅湪鑼冨洿鍐�"
+ + " LittleType = " + info.getLittleType()
+ + " BigType = " + info.getBigType()
+ );
+ }
+ }
+
+ /**
+ * 鎺у埗鍦扮儹妯″潡
+ *
+ * @param info
+ * @param type
+ * @param state 2019-07-10
+ */
+ public static void geothermalCtrl(final AppliancesInfo info, int type, int state) {
+// HDLDeviceManager.isGeothermalCtrlSuccess = false;
+ HDLDeviceManager.setDeviceCtrlSuccessStateWithInfo(info, false);
+ if (geothermalCtrlFailTimer != null) {
+ geothermalCtrlFailTimer.cancel();
+ geothermalCtrlFailTimer = null;
+ }
+ if (info.getBigType() == Configuration.GEOTHERMAL_BIG_TYPE) {
+ byte[] sendbytes = GeothermalParser.getGeothermalAddByte(info, type, state);
+ addSendData(info, sendbytes, Configuration.CONTROL);
+
+ geothermalCtrlFailTimer = new Timer();
+ geothermalCtrlFailTimer.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ if (!HDLDeviceManager.getDeviceCtrlSuccessStateWithInfo(info)) {
+ GeothermalBackInfo mGeothermalBackInfo = new GeothermalBackInfo();
+ mGeothermalBackInfo.setAppliancesInfo(info);
+ EventBus.getDefault().post(new GeothermalFeedBackEvent(mGeothermalBackInfo, EventCode.FAILURE_TIMEOUT));
+ }
+ }
+ }, 5000);
+
+
+ } else {
+ HDLLog.I("鍦扮儹妯″潡鎺у埗涓嶅湪鑼冨洿鍐�"
+ + " LittleType = " + info.getLittleType()
+ + " BigType = " + info.getBigType()
+ );
+ }
+ }
+
+
+ /**
+ * 鑾峰彇闂ㄩ攣鐘舵��
+ *
+ * @param info
+ */
+ public static void getDoorMachineDeviceStateFromNetwork(final AppliancesInfo info) {
+ if (info == null) {
+ return;
+ }
+ HDLDeviceManager.isGetDeviceStateSuccess = false;
+ switch (info.getDeviceType()) {
+ case HDLApConfig.TYPE_DOOR_MACHINE:
+ //鍙戦�佽幏鍙栭棬閿佹墍鏈夋暟鎹�
+ addSendData(info, new byte[]{(byte) info.getChannelNum()}, Configuration.STATE);
+ break;
+ default:
+ HDLLog.I("涓嶆槸闂ㄩ攣璁惧");
+ break;
+ }
+ }
+
+ /**
+ * 闂ㄩ攣妯″潡 杩滅▼寮�閿佽幏鍙栧瘑閽�
+ * 2023-8-25
+ *
+ * @param info
+ */
+ public static void doorMachineGetSecret(final AppliancesInfo info) {
+ if (info.getBigType() == Configuration.DOOR_MACHINE_BIG_TYPE) {
+ byte[] sendbytes = new byte[]{(byte) info.getChannelNum()};
+ cusSendCommand(Configuration.DOOR_MACHINE_MODULE_CTRL_FRIST_COMMAND, info.getDeviceSubnetID(), info.getDeviceDeviceID(), sendbytes);
+ } else {
+ HDLLog.I("涓嶆槸闂ㄩ攣妯″潡"
+ + " LittleType = " + info.getLittleType()
+ + " BigType = " + info.getBigType()
+ );
+ }
+ }
+
+ /**
+ * 鎺у埗闂ㄩ攣杩滅▼寮�閿�
+ *
+ * @param info
+ * @param secretBytes 瀵嗛挜
+ * @param password 寮�閿佸瘑鐮� 2023-08-22
+ */
+ public static void doorMachineCtrl(final AppliancesInfo info, byte[] secretBytes, String password, int doorStatus) {
+ HDLDeviceManager.setDeviceCtrlSuccessStateWithInfo(info, false);
+ if (doorMachineCtrlFailTimer != null) {
+ doorMachineCtrlFailTimer.cancel();
+ doorMachineCtrlFailTimer = null;
+ }
+ if (info.getBigType() == Configuration.DOOR_MACHINE_BIG_TYPE) {
+ byte[] doorMachinebytes = DoorMachineParser.getDoorMachineAddByte(info, secretBytes, password, doorStatus);
+ addSendData(info, doorMachinebytes, Configuration.CONTROL);
+ doorMachineCtrlFailTimer = new Timer();
+ doorMachineCtrlFailTimer.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ if (!HDLDeviceManager.getDeviceCtrlSuccessStateWithInfo(info)) {
+ DoorMachineBackInfo mDoorMachineBackInfo = new DoorMachineBackInfo();
+ mDoorMachineBackInfo.setAppliancesInfo(info);
+ EventBus.getDefault().post(new DoorMachineFeedBackEvent(mDoorMachineBackInfo, false));
+ }
+ }
+ }, mRequestTimeout);
+
+
+ } else {
+ HDLLog.I("闂ㄩ攣鎺у埗涓嶅湪鑼冨洿鍐�"
+ + " LittleType = " + info.getLittleType()
+ + " BigType = " + info.getBigType()
+ );
+ }
+ }
+
+
+ /**
+ * 闂ㄩ攣妯″潡 璁剧疆涓存椂瀵嗙爜
+ * 2023-8-25
+ *
+ * @param info
+ * @param tempPassword 涓存椂瀵嗙爜
+ * @param startTime 寮�濮嬫椂闂存埑
+ * @param endTime 缁撴潫鏃堕棿鎴�
+ */
+ public static void doorMachineSettingPwd(final AppliancesInfo info, String tempPassword, String startTime, String endTime) {
+ if (info.getBigType() == Configuration.DOOR_MACHINE_BIG_TYPE) {
+ byte[] sendbytes = DoorMachineParser.getDoorMachineSettingPwdByte(info, tempPassword, startTime, endTime);
+ cusSendCommand(Configuration.DOOR_MACHINE_MODULE_SETTING_PASSWORD_COMMAND, info.getDeviceSubnetID(), info.getDeviceDeviceID(), sendbytes);
+ } else {
+ HDLLog.I("涓嶆槸闂ㄩ攣妯″潡"
+ + " LittleType = " + info.getLittleType()
+ + " BigType = " + info.getBigType()
+ );
+ }
+ }
/**
* 鑳屾櫙闊充箰鎺у埗
@@ -1347,34 +1786,19 @@
sendDatas.count++;
if (type == Configuration.STATE) {
sendDatas.command = info.getStateCommand();
+ HDLLog.I("---getDevice锛� " + info.getDeviceKey() + " ---getStateCommand锛� " + Integer.toHexString(info.getStateCommand()));//2019-8-2
sendDatas.isCtrlSuccess = HDLDeviceManager.isGetDeviceStateSuccess;
} else if (type == Configuration.CONTROL) {
sendDatas.command = info.getCtrlCommand();
- HDLLog.I("getDeviceKey锛� " + info.getDeviceKey());//2019-8-2
+ HDLLog.I("---getDevice锛� " + info.getDeviceKey() + " ---getCtrlCommand锛� " + Integer.toHexString(info.getCtrlCommand()));//2019-8-2
sendDatas.isCtrlSuccess = HDLDeviceManager.getDeviceCtrlSuccessStateWithInfo(info);
-
-// switch (info.getBigType()) {
-// case Configuration.LIGTH_BIG_TYPE:
-// sendDatas.isCtrlSuccess = HDLDeviceManager.isLightCtrlSuccess;
-// break;
-// case Configuration.CURTAIN_BIG_TYPE:
-// sendDatas.isCtrlSuccess = HDLDeviceManager.isCurtainCtrlSuccess;
-// break;
-// case Configuration.AIR_BIG_TYPE:
-// sendDatas.isCtrlSuccess = HDLDeviceManager.isACCtrlSuccess;
-// break;
-// case Configuration.LOGIC_BIG_TYPE:
-// sendDatas.isCtrlSuccess = HDLDeviceManager.isSceneCtrlSuccess;
-// break;
-// case Configuration.SECURITY_BIG_TYPE:
-// sendDatas.isCtrlSuccess = HDLDeviceManager.isSecurityCtrlSuccess;
-// break;
-// default:
-// sendDatas.isCtrlSuccess = false;
-// }
}
if (!sendDatas.isCtrlSuccess) {
- HDLLog.I("鎺у埗鍙戦�佺" + sendDatas.count + "娆�");
+ if (type == Configuration.STATE) {
+ HDLLog.I("璇诲彇鍙戦�佺" + sendDatas.count + "娆�");
+ } else if (type == Configuration.CONTROL) {
+ HDLLog.I("鎺у埗鍙戦�佺" + sendDatas.count + "娆�");
+ }
cusSendCommand(sendDatas.command, info.getDeviceSubnetID(), info.getDeviceDeviceID(), sendDatas.addBytes);
} else {
sendCycleTimer.cancel();
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLDeviceManager.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLDeviceManager.java
index b2ab1a2..89e0cdd 100644
--- a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLDeviceManager.java
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLDeviceManager.java
@@ -3,23 +3,39 @@
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
+import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;
import com.hdl.sdk.ttl.Config.MCUConstants;
import com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition.AirHVACBackInfo;
+import com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition.AirTechSysBackInfo;
import com.hdl.sdk.ttl.HDLAppliances.HDLCommonSwitch.CommonSwitchBackInfo;
+import com.hdl.sdk.ttl.HDLAppliances.HDLDoorMachine.DoorMachineBackInfo;
+import com.hdl.sdk.ttl.HDLAppliances.HDLDoorMachine.DoorMachineFristBackInfo;
+import com.hdl.sdk.ttl.HDLAppliances.HDLDoorMachine.DoorMachineWaringBackInfo;
+import com.hdl.sdk.ttl.HDLAppliances.HDLFreshAir.FreshAirBackInfo;
+import com.hdl.sdk.ttl.HDLAppliances.HDLFreshAir.FreshAirJinMaoBackInfo;
+import com.hdl.sdk.ttl.HDLAppliances.HDLGeothermal.GeothermalBackInfo;
+import com.hdl.sdk.ttl.HDLAppliances.HDLLight.ColourLightCtrlBackInfo;
import com.hdl.sdk.ttl.HDLAppliances.HDLSecurity.SecurityBackInfo;
import com.hdl.sdk.ttl.HDLAppliances.HDLSensor.DryContactSensorBackEvent;
import com.hdl.sdk.ttl.HDLAppliances.HDLSensor.SensorStateBackInfo;
import com.hdl.sdk.ttl.HDLDeviceManger.Bean.MCUConfigurationBean;
import com.hdl.sdk.ttl.HDLDeviceManger.Bean.MCUDataBean;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.AirHVACFeedBackEvent;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.AirTechSysFeedBackEvent;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.ColourLightFeedBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.CommonSwitchCtrlBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.CommonSwitchStateBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DiscoverNewDevicesEvent;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DoorMachineFeedBackEvent;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DoorMachineFeedFristBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.EventCode;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.FreshAirFeedBackEvent;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.FreshAirJinMaoFeedBackEvent;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.GeothermalFeedBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.MCUFeedBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.SecurityAlarmFeedBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.SecurityArmingFeedBackEvent;
@@ -138,6 +154,7 @@
* @param commandType 鍛戒护绫诲瀷
*/
public static void handle(UdpDataBean getDatas, int commandType) {
+ Log.e("panlili", "commandType=" + Integer.toHexString(commandType)+" desDeviceID=" + getDatas.desDeviceID + " sourceDeviceID=" + getDatas.sourceDeviceID);
switch (commandType) {
case Configuration.DEVICES_SEARCH_BACK_COMMAND:
if (HandleSearch.isGetRcuIp) {
@@ -157,6 +174,40 @@
}
}
break;
+ /***2020-07-20 鏂板鏂伴璁惧**/
+ case Configuration.FRESH_AIR_STATE_BACK_COMMAND:
+ handleFreshAirStateData(getDatas);
+ break;
+ case Configuration.FRESH_AIR_CTRL_BACK_COMMAND:
+ handleFreshAirCtrlBackData(getDatas);
+ break;
+ /***2020-07-20 閲戣寕鏂伴璁惧**/
+ case Configuration.FRESH_AIR_JINMAO_STATE_BACK_COMMAND:
+ handleFreshAirJINMAOStateData(getDatas);
+ break;
+ case Configuration.FRESH_AIR_JINMAO_CTRL_BACK_COMMAND:
+ handleFreshAirJINMAOCtrlBackData(getDatas);
+ break;
+ /***2020-07-20 鍦扮儹妯″潡**/
+ case Configuration.GEOTHERMAL_MODULE_STATE_BACK_COMMAND:
+ handleGeothermalStateData(getDatas);
+ break;
+ case Configuration.GEOTHERMAL_MODULE_CTRL_BACK_COMMAND:
+ handleGeothermalCtrlData(getDatas);
+ break;
+ /***2023-08-22 闂ㄩ攣妯″潡**/
+ case Configuration.DOOR_MACHINE_MODULE_STATE_BACK_COMMAND:
+ handleDoorMachineStateData(getDatas);
+ break;
+ case Configuration.DOOR_MACHINE_MODULE_CTRL_FRIST_BACK_COMMAND:
+ handleDoorMachineCtrlFristBackData(getDatas);
+ break;
+ case Configuration.DOOR_MACHINE_MODULE_CTRL_BACK_COMMAND:
+ handleDoorMachineCtrlBackData(getDatas);
+ break;
+ case Configuration.DOOR_MACHINE_BROADCAST_STATE_BACK_COMMAND:
+ handleDoorMachineBroadcastStateData(getDatas);
+ break;
/***2020-04-01 鏂板閫氱敤寮�鍏�**/
case Configuration.COMMON_SWITCH_CTRL_BACK_COMMAND:
handleCommonSwitchCtrlData(getDatas);
@@ -171,8 +222,12 @@
case Configuration.LOGIC_CTRL_BACK_COMMAND:
handleCtrlData(getDatas);
break;
+ case Configuration.LIGHT_RGB_CTRL_BACK_COMMAND:
+ handleColourLightStateData(getDatas);
+ break;
case Configuration.AIR_HVAC_CTRL_BACK_COMMAND:
handleHVACCtrlData(getDatas);
+ handleTechSysCtrlData(getDatas);//2023-08-21
break;
case Configuration.SECURITY_ARMING_CTRL_BACK_COMMAND://20190729鏂板
case Configuration.SECURITY_ALARM_CTRL_BACK_COMMAND://鎶ヨ璁剧疆鍙嶉
@@ -192,8 +247,6 @@
handleAirStateData(getDatas);
break;
case Configuration.SENSOR_STATE_BACK_COMMAND:
- handleSensorBroadcastStateData(getDatas);
- break;
case Configuration.SENSOR_BROADCAST_STATE_BACK_COMMAND:
handleSensorBroadcastStateData(getDatas);
break;
@@ -201,11 +254,15 @@
case Configuration.DRY_CONTACT_BROADCAST_STATE_COMMAND:
handleDryContactBroadcastStateData(getDatas);
break;
-
case Configuration.LIGHT_STATE_BACK_COMMAND:
handleLightStateData(getDatas);
+ break;
+ case Configuration.LIGHT_RGB_STATE_BACK_COMMAND:
+ handleColourLightStateData(getDatas);//2023-08-22
+ break;
case Configuration.CURTAIN_STATE_BACK_COMMAND:
handleCurtainStateData(getDatas);
+ break;
case Configuration.CURTAIN_STATE_BROADCAST_BACK_COMMAND:
handleCurtainBroadcastStateData(getDatas);
break;
@@ -214,7 +271,9 @@
break;
case Configuration.AIR_HVAC_STATE_BACK_COMMAND:
// handleRcuAirCastData(getDatas);
+ HDLLog.I("鍙戦�佺涓�娆″灞呮悳绱�");
handleHVACStateData(getDatas);//2019-06-27
+ handleTechSysStateData(getDatas);//2023-08-21
break;
case Configuration.LOGIC_STATE_BACK_COMMAND:
// handleRcuAirCastData(getDatas);
@@ -451,6 +510,40 @@
}
+ /**
+ * 澶勭悊CCT OR RGB鐏厜杩斿洖
+ * 2023-8-22
+ *
+ * @param getDatas
+ */
+ private static void handleColourLightCtrlData(UdpDataBean getDatas) {
+ outter:
+ for (int i = 0, len = devicesDataList.size(); i < len; i++) {
+ if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID
+ ) {
+ List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
+ for (int j = 0, len2 = infos.size(); j < len2; j++) {
+ if (infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {
+ AppliancesInfo lightInfo = infos.get(j);
+ devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes[2] & 0xFF);
+ devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(getDatas.addBytes[2] & 0xFF);
+ LightCtrlBackInfo info = new LightCtrlBackInfo();
+ info.setParentRemarks(lightInfo.getParentRemarks());
+ info.setAppliancesInfo(lightInfo);
+ info.setRemarks(lightInfo.getRemarks());
+ info.setChannelNum(getDatas.addBytes[0] & 0xFF);
+ info.setBrightness(getDatas.addBytes[1] & 0xFF);
+ setDeviceCtrlSuccessStateWithInfo(infos.get(j), true);
+ EventBus.getDefault().post(new LightFeedBackEvent(info, true));
+ break outter;
+ }
+
+ }
+ }
+ }
+ }
+
/**
* 澶勭悊璁惧鎺у埗鏁版嵁
@@ -464,62 +557,6 @@
break;
case Configuration.CURTAIN_CTRL_BACK_COMMAND:
-// if (TextUtils.isEmpty(HandleSearch.rcuIp)){
-//
-// }else{
-// AppliancesInfo curtainInfo = new AppliancesInfo();
-// for (int i = 0, len = devicesDataList.size(); i < len; i++) {
-// if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID
-// && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID
-// ) {
-// List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
-// for (int j = 0, len2 = infos.size(); j < len2; j++) {
-// if (infos.get(j).getBigType() == Configuration.CURTAIN_BIG_TYPE
-// && infos.get(j).getChannelNum() == (getDatas.addBytes[1] & 0xFF)) {
-// for (int k = 0; k < rcuCurtainList.size(); k++) {
-// if (devicesDataList.get(i).getAppliancesInfoList().get(j).getChannelNum() == rcuCurtainList.get(k).getChanelNum()
-// && devicesDataList.get(i).getAppliancesInfoList().get(j).getLittleType() == rcuCurtainList.get(k).getLittleType()
-// ) {
-// int state;
-// switch (getDatas.addBytes[2] & 0xFF) {
-// case 0:
-// state = CurtainCtrlParser.curtainPause;
-// break;
-// case 1:
-// state = CurtainCtrlParser.curtainOn;
-// break;
-// case 2:
-// state = CurtainCtrlParser.curtainOff;
-// break;
-// default:
-// state = 0;
-// break;
-// }
-// rcuCurtainList.get(k).setCurState(state);
-// devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes[2] & 0xFF);
-//// HDLLog.I("鎺у埗 rcuCurtainList鍥炶矾鍙凤細"+rcuCurtainList.get(k).getChanelNum()
-//// + " state = "+rcuCurtainList.get(k).getCurState()
-//// );
-// }
-// }
-//
-// curtainInfo = infos.get(j);
-// }
-//
-// }
-// }
-// }
-// CurtainCtrlBackInfo curtainCtrlBackInfo = new CurtainCtrlBackInfo();
-// curtainCtrlBackInfo.setRemarks(curtainInfo.getRemarks());
-// curtainCtrlBackInfo.setParentRemarks(curtainInfo.getParentRemarks());
-// curtainCtrlBackInfo.setAppliancesInfo(curtainInfo);
-// curtainCtrlBackInfo.setNum(getDatas.addBytes[1] & 0xFF);
-// curtainCtrlBackInfo.setState(getDatas.addBytes[2] & 0xFF);
-// isCurtainCtrlSuccess = true;
-// EventBus.getDefault().post(new CurtainFeedBackEvent(curtainCtrlBackInfo, true));
-// }
-
-
outter:
for (int i = 0, len = devicesDataList.size(); i < len; i++) {
if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID
@@ -707,193 +744,7 @@
}
}
}
-
-
break;
-// case Configuration.AIR_HVAC_CTRL_BACK_COMMAND: //2019-8-6 灞忚斀
-// outter:
-// for (int devIndex = 0, len = devicesDataList.size(); devIndex < len; devIndex++) {
-// if (devicesDataList.get(devIndex).getSourceSubnetID() == getDatas.sourceSubnetID
-// && devicesDataList.get(devIndex).getSourceDeviceID() == getDatas.sourceDeviceID
-// ) {
-// List<AppliancesInfo> infos = devicesDataList.get(devIndex).getAppliancesInfoList();
-// for (int appIndex = 0, len2 = infos.size(); appIndex < len2; appIndex++) {
-// if ((infos.get(appIndex).getDeviceType() == HDLApConfig.TYPE_AC_HVAC
-// || infos.get(appIndex).getDeviceType() == HDLApConfig.TYPE_AC_COOLMASTER
-// || infos.get(appIndex).getDeviceType() == HDLApConfig.TYPE_AC_INFRARED)
-// && infos.get(appIndex).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {
-//// String airbytes = "193b 闄勫姞鏁版嵁锛�";
-//// for (int i = 0; i < getDatas.addBytes.length; i++) {
-//// airbytes += (getDatas.addBytes[i] & 0xff) + ",";
-//// }
-//// HDLLog.I( airbytes);
-// AppliancesInfo airInfo = infos.get(appIndex);
-// int indexI = devIndex;
-// int indexJ = appIndex;
-//
-// final byte[] oldAirInfo;
-//// HDLLog.I("KKKKKKDD"+(getDatas.addBytes[0] & 0xFF));
-// switch (getDatas.addBytes[0] & 0xFF) {
-// case 1:
-// oldAirInfo = air1Info;
-// break;
-// case 2:
-// oldAirInfo = air2Info;
-// break;
-// case 3:
-// oldAirInfo = air3Info;
-// break;
-// case 4:
-// oldAirInfo = air4Info;
-// break;
-// default:
-// oldAirInfo = new byte[1];
-// break;
-// }
-// byte[] newAirInfo = getDatas.addBytes;
-// byte[] curAirInfo = new byte[]{0};
-// boolean isModeChange = false;
-// if (oldAirInfo == null || oldAirInfo.length == 0) {
-// return;
-// }
-// for (int oldAirInedx = 0; oldAirInedx < oldAirInfo.length; oldAirInedx++) {
-// if (oldAirInedx == 0) {
-// setDeviceCtrlSuccessStateWithInfo(infos.get(appIndex), true);
-// if (oldAirInfo[0] != newAirInfo[8]) {//2019-8-2 鍘绘帀鐩稿悓寮�鍏崇姸鎬佸垽鏂�,瑙e喅寮�鐘舵�佷笅,璋冪敤寮�鍛戒护鐘舵�佷笅,涓嶅仠閲嶅彂闂
-// oldAirInfo[0] = newAirInfo[8];
-// curAirInfo = new byte[]{AirCtrlParser.airSwich, newAirInfo[8]};
-// if (curAirInfo.length > 1) {
-// devicesDataList.get(indexI).getAppliancesInfoList().get(indexJ).setArrCurState(oldAirInfo);
-// airInfo.setArrCurState(oldAirInfo);
-// AirCtrlBackInfo airCtrlBackInfo = new AirCtrlBackInfo();
-// airCtrlBackInfo.setAppliancesInfo(airInfo);
-// airCtrlBackInfo.setCurState(curAirInfo);
-//// isACCtrlSuccess = true;
-//// setDeviceCtrlSuccessStateWithInfo(infos.get(appIndex), true);
-// EventBus.getDefault().post(new AirFeedBackEvent(airCtrlBackInfo, true));
-//
-// }
-//
-// }
-// } else if (oldAirInedx == 1) {
-//// int mode = ((newAirInfo[4] & 0xf0) >> 4);
-// int mode = newAirInfo[9] & 0xff;
-// setDeviceCtrlSuccessStateWithInfo(infos.get(appIndex), true);
-// if (oldAirInfo[1] != (byte) mode) {
-// isModeChange = true;
-// oldAirInfo[1] = (byte) mode;
-// curAirInfo = new byte[]{AirCtrlParser.airMode, (byte) mode};
-// devicesDataList.get(indexI).getAppliancesInfoList().get(indexJ).setArrCurState(oldAirInfo);
-// airInfo.setArrCurState(oldAirInfo);
-// AirCtrlBackInfo airCtrlBackInfo = new AirCtrlBackInfo();
-// airCtrlBackInfo.setAppliancesInfo(airInfo);
-// airCtrlBackInfo.setCurState(curAirInfo);
-//// isACCtrlSuccess = true;
-//// setDeviceCtrlSuccessStateWithInfo(infos.get(appIndex), true);
-// EventBus.getDefault().post(new AirFeedBackEvent(airCtrlBackInfo, true));
-//
-// }
-// } else if (oldAirInedx == 2) {
-// int mode = newAirInfo[9] & 0xff;
-// byte newAirTem = newAirInfo[11];
-// setDeviceCtrlSuccessStateWithInfo(infos.get(appIndex), true);
-//
-// if (oldAirInfo[2] != newAirTem) {
-// oldAirInfo[2] = newAirTem;
-// switch (mode) {
-// case 0:
-// curAirInfo = new byte[]{AirCtrlParser.refTem, newAirTem};
-// break;
-// case 1:
-// curAirInfo = new byte[]{AirCtrlParser.heatTem, newAirTem};
-// break;
-// case 3:
-// curAirInfo = new byte[]{AirCtrlParser.autoTem, newAirTem};
-// break;
-// case 4:
-// curAirInfo = new byte[]{AirCtrlParser.dehumTem, newAirTem};
-// break;
-// }
-// if (curAirInfo.length > 1) {
-// devicesDataList.get(indexI).getAppliancesInfoList().get(indexJ).setArrCurState(oldAirInfo);
-// airInfo.setArrCurState(oldAirInfo);
-// AirCtrlBackInfo airCtrlBackInfo = new AirCtrlBackInfo();
-// airCtrlBackInfo.setAppliancesInfo(airInfo);
-// airCtrlBackInfo.setCurState(curAirInfo);
-//// isACCtrlSuccess = true;
-//// setDeviceCtrlSuccessStateWithInfo(infos.get(appIndex), true);
-// EventBus.getDefault().post(new AirFeedBackEvent(airCtrlBackInfo, true));
-//
-// }
-// }
-// } else if (oldAirInedx == 3) {
-//// int speed = (newAirInfo[4] & 0x0f);//鑾峰彇浣�4浣�
-// int speed = newAirInfo[10];
-// setDeviceCtrlSuccessStateWithInfo(infos.get(appIndex), true);
-// if (oldAirInfo[3] != (byte) speed) {
-// oldAirInfo[3] = (byte) speed;
-// curAirInfo = new byte[]{AirCtrlParser.airSpeed, (byte) speed};
-// devicesDataList.get(indexI).getAppliancesInfoList().get(indexJ).setArrCurState(oldAirInfo);
-// airInfo.setArrCurState(oldAirInfo);
-// AirCtrlBackInfo airCtrlBackInfo = new AirCtrlBackInfo();
-// airCtrlBackInfo.setAppliancesInfo(airInfo);
-// airCtrlBackInfo.setCurState(curAirInfo);
-//// isACCtrlSuccess = true;
-//// setDeviceCtrlSuccessStateWithInfo(infos.get(appIndex), true);
-// EventBus.getDefault().post(new AirFeedBackEvent(airCtrlBackInfo, true));
-//
-// }
-// }
-// }
-//
-// switch (getDatas.addBytes[0] & 0xFF) {
-// case 1:
-// air1Info = oldAirInfo;
-// break;
-// case 2:
-// air2Info = oldAirInfo;
-// break;
-// case 3:
-// air3Info = oldAirInfo;
-// break;
-// case 4:
-// air4Info = oldAirInfo;
-// break;
-// }
-//
-//
-//// if (curAirInfo.length > 1) {
-////// if (isModeChange) {
-////// isACCtrlSuccess = true;
-////// getAirInfo(hvacInfo);
-////// } else {f
-////// airInfo.setArrCurState(oldAirInfo);
-////// AirCtrlBackInfo airCtrlBackInfo = new AirCtrlBackInfo();
-////// airCtrlBackInfo.setAppliancesInfo(airInfo);
-////// airCtrlBackInfo.setCurState(curAirInfo);
-////// isACCtrlSuccess = true;
-////// EventBus.getDefault().post(new AirFeedBackEvent(airCtrlBackInfo, true));
-////// }
-////
-//// devicesDataList.get(indexI).getAppliancesInfoList().get(indexJ).setArrCurState(oldAirInfo);
-//// airInfo.setArrCurState(oldAirInfo);
-//// AirCtrlBackInfo airCtrlBackInfo = new AirCtrlBackInfo();
-//// airCtrlBackInfo.setAppliancesInfo(airInfo);
-//// airCtrlBackInfo.setCurState(curAirInfo);
-////// isACCtrlSuccess = true;
-//// setDeviceCtrlSuccessStateWithInfo(infos.get(appIndex), true);
-//// EventBus.getDefault().post(new AirFeedBackEvent(airCtrlBackInfo, true));
-////
-//// }
-//
-//
-// break outter;
-// }
-// }
-// }
-// }
-//
-// break;
case Configuration.LOGIC_CTRL_BACK_COMMAND:
outter:
for (int i = 0, len = devicesDataList.size(); i < len; i++) {
@@ -1038,8 +889,6 @@
setDeviceCtrlSuccessStateWithInfo(infos.get(j), true);
EventBus.getDefault().post(new AirHVACFeedBackEvent(info, true));
break outter;
- } else {
- HDLLog.E("鎺у埗HVAC鐘舵�佸弽棣堟暟鎹紓甯�");
}
break outter;
}
@@ -1049,6 +898,43 @@
break;
}
+ }
+
+
+ /**
+ * 澶勭悊绉戞妧绯荤粺 鎺у埗鍥炶皟
+ * 2023-8-21
+ *
+ * @param getDatas
+ */
+ private static void handleTechSysCtrlData(UdpDataBean getDatas) {
+ switch (getDatas.command) {
+ case Configuration.AIR_HVAC_CTRL_BACK_COMMAND:
+ outter:
+ for (int i = 0, len = devicesDataList.size(); i < len; i++) {
+ if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID) {
+ List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
+ for (int j = 0, len2 = infos.size(); j < len2; j++) {
+ if (getDatas.addBytes.length > 0) {
+ if (infos.get(j).getBigType() == Configuration.AIR_BIG_TYPE
+ && infos.get(j).getDeviceType() == HDLApConfig.TYPE_AC_TECHSYS
+ && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {
+
+ devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes);
+ AppliancesInfo mTechSysAirInfo = devicesDataList.get(i).getAppliancesInfoList().get(j);
+ AirTechSysBackInfo info = new AirTechSysBackInfo(mTechSysAirInfo);
+ setDeviceCtrlSuccessStateWithInfo(infos.get(j), true);
+ EventBus.getDefault().post(new AirTechSysFeedBackEvent(info, true));
+ break outter;
+ }
+ }
+ }
+ break outter;
+ }
+ }
+ break;
+ }
}
@@ -1237,19 +1123,6 @@
String remarkStr = HDLStringUtils.byte2String(remarkByte);
HDLLog.I("remarkStr鍥炶矾锛�" + remarkStr);
-
-// byte[] remark = new byte[20];
-// //纭欢鐨勫瓧鑺傛祦鍗忚鎻愪緵鏈夎锛屾敹鍒版煇纭欢鎻愪緵澶囨敞涓嶈冻20闀垮害锛岃В鍐宠繖闂鐨勬潈瀹滀箣璁�
-// int length;
-// if (getDatas.addBytes.length < 20) {
-// length = getDatas.addBytes.length;
-// } else {
-// length = remark.length;
-// }
-// System.arraycopy(getDatas.addBytes, 3, remark, 0, length);
-
-// String remarkStr = HDLStringUtils.byte2String(remark);
-// HDLLog.I("remarkStr鍥炶矾锛�" + remarkStr);
devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setRemarks(remarkStr);
switch (infos.get(appPos).getBigType()) {
@@ -1319,30 +1192,9 @@
devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setIntCurState(curtainState);
break;
case 2:
-// if (!TextUtils.isEmpty(HandleSearch.rcuIp)) {
-// RcuCurtain rcuCurtain = new RcuCurtain();
-// rcuCurtain.setChanelNum(getDatas.addBytes[2] & 0xFF);
-// rcuCurtain.setLittleType(2);
-// int state = -1;
-// switch (getDatas.addBytes[getDatas.addBytes.length - 1] & 0xFF) {
-// case 0:
-// state = CurtainCtrlParser.curtainPause;
-// break;
-// case 1:
-// state = CurtainCtrlParser.curtainOn;
-// break;
-// case 2:
-// state = CurtainCtrlParser.curtainOff;
-// break;
-// }
-// rcuCurtain.setCurState(state);
-// rcuCurtainList.add(rcuCurtain);
-// }
-
devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setCurState(getDatas.addBytes[getDatas.addBytes.length - 1] & 0xFF);
devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setIntCurState(getDatas.addBytes[getDatas.addBytes.length - 1] & 0xFF);
break;
-
}
break;
@@ -1354,29 +1206,6 @@
hvacBytes[i - 23] = getDatas.addBytes[i];
}
devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setArrCurState(hvacBytes);
-// switch (devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).getChannelNum()) {
-// case 1:
-// if (air1Info == null) {
-// air1Info = hvacBytes;
-// }
-// break;
-// case 2:
-// if (air2Info == null) {
-// air2Info = hvacBytes;
-// }
-// break;
-// case 3:
-// if (air3Info == null) {
-// air3Info = hvacBytes;
-// }
-// break;
-// case 4:
-// if (air4Info == null) {
-// air4Info = hvacBytes;
-// }
-// break;
-//
-// }
break;
case 3:
byte[] newBytes = new byte[getDatas.addBytes.length - 24 + 1];
@@ -1387,24 +1216,24 @@
break;
}
break;
- case Configuration.SENSOR_BIG_TYPE://2019-07-03 灞忚斀
-// String aa = "浼犳劅鍣ㄥ娉細";
-// for (int i = 0; i < getDatas.addBytes.length; i++) {
-// aa += (getDatas.addBytes[i] & 0xff) + ",";
-// }
-// HDLLog.I( aa);
-
+ case Configuration.SENSOR_BIG_TYPE:
int curState;
- if (getDatas.addBytes.length >= 26) {//2019-11-7 鐗规畩澶勭悊锛屼慨鏀瑰洖璺彿
+ if (getDatas.addBytes.length >= 26) {//2023-11-14 鐗规畩澶勭悊锛屼慨鏀瑰洖璺彿涓虹墿鐞嗗洖璺紙鍥犱负ZigBee杞琤us杞崲鍣ㄧ敤鐨勯兘鏄墿鐞嗗洖璺紝灏嗛�昏緫鍥炶矾璁句负鐗╃悊鍥炶矾澶勭悊锛�
curState = (int) (getDatas.addBytes[24] & 0xff);
- devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setChannelNum(getDatas.addBytes[25] & 0xff);
-
} else {
curState = (int) (getDatas.addBytes[getDatas.addBytes.length - 1] & 0xff);
}
+ devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setChannelNum(getDatas.addBytes[getDatas.addBytes.length - 1] & 0xFF);
devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setCurState(curState);
devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setIntCurState((int) curState);
break;
+ case Configuration.DOOR_MACHINE_BIG_TYPE:
+ switch (infos.get(appPos).getLittleType()) {
+ case 4:
+ devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setChannelNum(getDatas.addBytes[getDatas.addBytes.length - 1] & 0xFF);
+ break;
+ }
+ break;
default:
HDLLog.I("鏈壘鍒版绫诲瀷璁惧锛�" + infos.get(appPos).getBigType());
break;
@@ -1860,198 +1689,105 @@
}
-// /**
-// * 澶勭悊浼犳劅鍣� 骞挎挱鏁版嵁
-// *
-// * @param getDatas
-// */
-// private static void handleSensorBroadcastStateData(UdpDataBean getDatas) {
-// outter:
-// for (int i = 0, len = devicesDataList.size(); i < len; i++) {
-// if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID
-// && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID
-// ) {
-// List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
-// for (int j = 0, len2 = infos.size(); j < len2; j++) {
-// switch (devicesDataList.get(i).getAppliancesInfoList().get(j).getBigType()) {
-// case Configuration.SENSOR_BIG_TYPE://2019-07-03 灞忚斀
-// isGetDeviceStateSuccess = true;
-// AppliancesInfo sensorInfo = devicesDataList.get(i).getAppliancesInfoList().get(j);
-// float value = HDLUtlis.byte2Float(Arrays.copyOfRange(getDatas.addBytes, 5, 8));
-// devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(value);
-// devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState((int) value);
-//
-// sensorInfo.setCurState(value);
-//
-//
-// String unite = "";
-// switch (sensorInfo.getDeviceType()) {
-// case HDLApConfig.TYPE_SENSOR_DRY_CONTACT:
-// unite = "";
-// break;
-// case HDLApConfig.TYPE_SENSOR_MOVEMENT_DETECTOR:
-// unite = "";
-// break;
-// case HDLApConfig.TYPE_SENSOR_TEMP:
-// if ((getDatas.addBytes[4] & 0xff) == 0) {
-// unite = "掳C";
-// } else {
-// unite = "掳F";
-// }
-//
-// break;
-// case HDLApConfig.TYPE_SENSOR_HUMIDITY:
-// unite = "%";
-// break;
-// case HDLApConfig.TYPE_SENSOR_ILLUMINACE:
-// unite = "LUX";
-// break;
-// case HDLApConfig.TYPE_SENSOR_VOC:
-// unite = "";
-// break;
-// case HDLApConfig.TYPE_SENSOR_PM_2_POINT_5:
-// switch (getDatas.addBytes[4] & 0xff) {
-// case 0:
-// unite = "mg/m3";
-// break;
-// case 1:
-// unite = "ppm";
-// break;
-// case 2:
-// unite = "渭m";
-// break;
-// default:
-// unite = "";
-// break;
-// }
-//
-// break;
-// case HDLApConfig.TYPE_SENSOR_C02:
-// switch (getDatas.addBytes[4] & 0xff) {
-// case 0:
-// unite = "mg/m3";
-// break;
-// case 1:
-// unite = "ppm";
-// break;
-// default:
-// unite = "";
-// break;
-// }
-// break;
-// case HDLApConfig.TYPE_SENSOR_LPG:
-// unite = "ppm";
-// break;
-// case HDLApConfig.TYPE_SENSOR_CO_H2:
-// unite = "ppm";
-// break;
-// case HDLApConfig.TYPE_SENSOR_CH4:
-// unite = "ppm";
-// break;
-// case HDLApConfig.TYPE_SENSOR_SMOG:
-// unite = "";
-// break;
-// case HDLApConfig.TYPE_SENSOR_WIND_SPEED:
-// unite = "m/s";
-// break;
-// case HDLApConfig.TYPE_SENSOR_WIND_PRESSURE:
-// unite = "Pa";
-// break;
-// case HDLApConfig.TYPE_SENSOR_LIQUID_FLOW:
-// unite = "";
-// break;
-// case HDLApConfig.TYPE_SENSOR_LIQUID_PRESSURE:
-// unite = "Pa";
-// break;
-// case HDLApConfig.TYPE_SENSOR_LIQUID_DEPTH:
-// unite = "mm";
-// break;
-// case HDLApConfig.TYPE_SENSOR_RAIN_FALL:
-// switch (getDatas.addBytes[4] & 0xff) {
-// case 0:
-// unite = "鏃犻洦";
-// break;
-// case 1:
-// unite = "灏忛洦";
-// break;
-// case 2:
-// unite = "澶ч洦";
-// break;
-// default:
-// unite = "";
-// break;
-// }
-// break;
-// case HDLApConfig.TYPE_SENSOR_WEIGHT:
-// unite = "KG";
-// break;
-// case HDLApConfig.TYPE_SENSOR_HEIGHT_LENGTH:
-// unite = "mm";
-// break;
-// case HDLApConfig.TYPE_SENSOR_OBJECT_SPEED:
-// unite = "m/s";
-// break;
-// case HDLApConfig.TYPE_SENSOR_SHAKE:
-// unite = "mm";
-// break;
-// case HDLApConfig.TYPE_SENSOR_VOLTAGE:
-// switch (getDatas.addBytes[4] & 0xff) {
-// case 0:
-// unite = "V";
-// break;
-// case 1:
-// unite = "渭V";
-// break;
-// default:
-// unite = "";
-// break;
-// }
-// break;
-// case HDLApConfig.TYPE_SENSOR_ELECTRICITY:
-// switch (getDatas.addBytes[4] & 0xff) {
-// case 0:
-// unite = "A";
-// break;
-// case 1:
-// unite = "渭A";
-// break;
-// default:
-// unite = "";
-// break;
-// }
-// break;
-// case HDLApConfig.TYPE_SENSOR_POWER:
-// unite = "W";
-// break;
-// case HDLApConfig.TYPE_SENSOR_FLOODING:
-// unite = "";
-// break;
-// case HDLApConfig.TYPE_SENSOR_DOOR_MAGNET:
-// unite = "";
-// break;
-// case HDLApConfig.TYPE_SENSOR_EMERGENCY_BUTTON:
-// unite = "";
-// break;
-// default:
-// unite = "鏈煡鍗曚綅";
-// break;
-// }
-//
-//
-//// EventBus.getDefault().post(new DeviceStateEvent(sensorInfo, true));
-// HDLLog.I("鍙戦�佷紶鎰熷櫒閫氱煡鏇存柊");
-// EventBus.getDefault().post(new SensorStateBackInfo(sensorInfo, true, unite));
-// break;
-// default:
-// HDLLog.I("handle state 娌℃湁鎵惧埌鍖归厤绫诲瀷");
-// break;
-// }
-//
-// }
-// break outter;
-// }
-// }
-// }
+ /**
+ * panlili
+ * 澶勭悊闂ㄩ攣鐘舵�佸拰鎶ヨ 骞挎挱鏁版嵁
+ *
+ * @param getDatas
+ */
+ private static void handleDoorMachineBroadcastStateData(UdpDataBean getDatas) {
+ outter:
+ for (int i = 0, len = devicesDataList.size(); i < len; i++) {
+ if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID
+ ) {
+ List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
+ for (int j = 0, len2 = infos.size(); j < len2; j++) {
+ if (infos.get(j).getBigType() == Configuration.DOOR_MACHINE_BIG_TYPE
+ && infos.get(j).getDeviceType() == HDLApConfig.TYPE_DOOR_MACHINE) {
+ String type = "";
+ /*寮�閿�:
+ 0x*1锛氭寚绾瑰紑閿�
+ 0x*2锛氬瘑鐮佸紑閿�
+ 0x*3锛氭劅搴斿崱寮�閿�
+ 0x*4锛氭満姊伴挜鍖欏紑閿�
+ 0x*5锛氳繙绋嬫巿鏉冨紑閿�
+ 0x*6锛氫复鏃跺瘑鐮佸紑閿�
+ 0x*7-0x*f锛氾紙棰勭暀锛�
+
+ 鎶ヨ:
+ 0x1*锛氬瘑鐮侀獙璇侀敊璇姤璀︼紙瀵嗙爜杩炵画3娆℃閿欒锛�
+ 0x2*锛氶棬鏈攣濂芥姤璀︼紙闂ㄩ攣鏈叧濂斤紝 褰撻棬閿佸ソ鏃朵笂鎶ヨВ闄ゆ姤璀︼級
+ 0x3*锛氬姭鎸佹姤璀︼紙杈撳叆闃插姭鎸佸瘑鐮佹垨鑰呴槻鍔寔鎸囩汗寮�閿佹椂鎶ヨ锛�
+ 0x4*锛氶槻鎾姤璀︼紙闂ㄩ攣琚挰寮�鏃舵姤璀︼級
+ 0x5*锛氱數閲忎笉瓒虫姤璀︼紙鐢甸噺涓嶈冻鏃舵姤璀︼級
+ 0x6*锛氭寚绾归獙璇侀敊璇姤璀︼紙寮�闂ㄩ獙璇佽緭鍏ユ寚绾硅繛缁敊璇鏁拌揪鍒伴棬閿佽瀹�3娆℃椂鎶ヨ锛�
+ 0x7*锛氬崱鐗囬獙璇侀敊璇姤璀︼紙寮�闂ㄩ獙璇佽緭鍏ュ崱鐗囪繛缁敊璇鏁拌揪鍒伴棬閿佽瀹�3娆℃姤璀︼級
+ 0x8*锛氶棬閿佹仮澶嶅嚭鍘傝缃�
+ 0x9*-0xf*锛氾紙棰勭暀锛�*/
+ switch (getDatas.addBytes[2] & 0xFF) {
+ case 1:
+ type = "鎸囩汗寮�閿�";
+ break;
+ case 2:
+ type = "瀵嗙爜寮�閿�";
+ break;
+ case 3:
+ type = "鎰熷簲鍗″紑閿�";
+ break;
+ case 4:
+ type = "鏈烘閽ュ寵寮�閿�";
+ break;
+ case 5:
+ type = "杩滅▼鎺堟潈寮�閿�";
+ break;
+ case 6:
+ type = "涓存椂瀵嗙爜寮�閿�";
+ break;
+ case 10:
+ type = "瀵嗙爜楠岃瘉閿欒鎶ヨ";
+ break;
+ case 20:
+ type = "闂ㄦ湭閿佸ソ鎶ヨ";
+ break;
+ case 30:
+ type = "鍔寔鎶ヨ";
+ break;
+ case 40:
+ type = "闃叉挰鎶ヨ";
+ break;
+ case 50:
+ type = "鐢甸噺涓嶈冻鎶ヨ";
+ break;
+ case 60:
+ type = "鎸囩汗楠岃瘉閿欒鎶ヨ";
+ break;
+ case 70:
+ type = "鍗$墖楠岃瘉閿欒鎶ヨ";
+ break;
+ case 80:
+ type = "闂ㄩ攣鎭㈠鍑哄巶璁剧疆";
+ break;
+ default:
+ break;
+ }
+ devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes[j] & 0xFF);
+ devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(getDatas.addBytes[j] & 0xFF);
+
+ AppliancesInfo doorMachineInfo = devicesDataList.get(i).getAppliancesInfoList().get(j);
+ int state = getDatas.addBytes[2] & 0xFF;
+ doorMachineInfo.setCurState(state);
+
+ HDLLog.I("鍙戦�侀棬閿佺姸鎬佸拰鎶ヨ閫氱煡");
+ EventBus.getDefault().post(new DoorMachineWaringBackInfo(doorMachineInfo, true, type));
+ } else {
+ HDLLog.I("handleDoorMachineBroadcastStateData 娌℃湁鎵惧埌鍖归厤绫诲瀷");
+ }
+ }
+ break outter;
+ }
+ }
+ }
/**
@@ -2068,7 +1804,7 @@
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
- if (infos.get(j).getBigType() == Configuration.LIGTH_BIG_TYPE) { //2019-07-26鍥犱负鏌ョ伅鍏夌姸鎬佹槸鏌ヨ鎵�浠ュ洖璺紝鎵�浠ヨ鎶婃墍鏈夊洖璺伅鍏夌姸鎬侀兘鎺ㄩ�佷竴娆�
+ if (infos.get(j).getBigType() == Configuration.LIGTH_BIG_TYPE && (infos.get(j).getDeviceType() != HDLApConfig.TYPE_LIGHT_CCT && infos.get(j).getDeviceType() != HDLApConfig.TYPE_LIGHT_RGB && infos.get(j).getDeviceType() != HDLApConfig.TYPE_LIGHT_DALI && infos.get(j).getDeviceType() != HDLApConfig.TYPE_LIGHT_DMX)) { //2019-07-26鍥犱负鏌ョ伅鍏夌姸鎬佹槸鏌ヨ鎵�浠ュ洖璺紝鎵�浠ヨ鎶婃墍鏈夊洖璺伅鍏夌姸鎬侀兘鎺ㄩ�佷竴娆�
isGetDeviceStateSuccess = true;
devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes[j + 1] & 0xFF);
devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(getDatas.addBytes[j + 1] & 0xFF);
@@ -2076,6 +1812,37 @@
// HDLLog.I("HDLlightState" + devicesDataList.get(i).getAppliancesInfoList().get(j).toString());
} else {
HDLLog.I("handleLightStateData 娌℃湁鎵惧埌鍖归厤绫诲瀷");
+ }
+ }
+ break outter;
+ }
+ }
+ }
+
+ /**
+ * 澶勭悊CCT OR RGB鐏厜妯″潡鍥炶皟
+ * 20230822鏂板
+ *
+ * @param getDatas
+ */
+ private static void handleColourLightStateData(UdpDataBean getDatas) {
+ outter:
+ for (int i = 0, len = devicesDataList.size(); i < len; i++) {
+ if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID
+ ) {
+ List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
+ for (int j = 0, len2 = infos.size(); j < len2; j++) {
+ if (infos.get(j).getBigType() == Configuration.LIGTH_BIG_TYPE && (infos.get(j).getDeviceType() == HDLApConfig.TYPE_LIGHT_CCT || infos.get(j).getDeviceType() == HDLApConfig.TYPE_LIGHT_RGB || infos.get(j).getDeviceType() == HDLApConfig.TYPE_LIGHT_DALI || infos.get(j).getDeviceType() == HDLApConfig.TYPE_LIGHT_DMX)) {
+ isGetDeviceStateSuccess = true;
+ devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes);
+ AppliancesInfo appliancesInfo = devicesDataList.get(i).getAppliancesInfoList().get(j);
+ ColourLightCtrlBackInfo colourLightCtrlBackInfo = new ColourLightCtrlBackInfo(appliancesInfo);
+ setDeviceCtrlSuccessStateWithInfo(infos.get(j), true);
+ EventBus.getDefault().post(new ColourLightFeedBackEvent(colourLightCtrlBackInfo, true));
+
+ } else {
+ HDLLog.I("handleColourLightStateData 娌℃湁鎵惧埌鍖归厤绫诲瀷");
}
}
break outter;
@@ -2393,6 +2160,37 @@
/**
+ * 璇诲彇绉戞妧绯荤粺鐘舵�佸弽棣�
+ *
+ * @param getDatas
+ */
+ private static void handleTechSysStateData(UdpDataBean getDatas) {
+ outter:
+ for (int i = 0, len = devicesDataList.size(); i < len; i++) {
+ if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID
+ ) {
+ List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
+ for (int j = 0, len2 = infos.size(); j < len2; j++) {
+ if (infos.get(j).getBigType() == Configuration.AIR_BIG_TYPE
+ && infos.get(j).getDeviceType() == HDLApConfig.TYPE_AC_TECHSYS
+ && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {//2019-8-6
+
+ isGetDeviceStateSuccess = true;
+ devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes);
+ EventBus.getDefault().post(new DeviceStateEvent(devicesDataList.get(i).getAppliancesInfoList().get(j), true));
+ break outter;
+ } else {
+ HDLLog.I("handleTechSysStateData 娌℃湁鎵惧埌鍖归厤绫诲瀷");
+ }
+ }
+ break outter;
+ }
+ }
+ }
+
+
+ /**
* 骞叉帴鐐瑰箍鎾姸鎬佸弽棣堝弽棣�
* 20191105鏂板
*
@@ -2407,7 +2205,7 @@
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
if (infos.get(j).getBigType() == Configuration.SENSOR_BIG_TYPE
- && infos.get(j).getChannelNum() == (getDatas.addBytes[1] & 0xFF)) {//2019-07-29
+ && infos.get(j).getChannelNum() == ((getDatas.addBytes[1] & 0xFF) - 1)) {//2019-07-29
if (getDatas.addBytes.length >= 3) {
isGetDeviceStateSuccess = true;
int state = getDatas.addBytes[2] & 0xFF;
@@ -3153,4 +2951,316 @@
}
+ /**
+ * 澶勭悊鏂伴璁惧鐘舵�佹暟鎹�
+ * 2020-07-20 鏂板
+ *
+ * @param getDatas
+ */
+ private static void handleFreshAirStateData(UdpDataBean getDatas) {
+ outter:
+ for (int i = 0, len = devicesDataList.size(); i < len; i++) {
+ if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID
+ ) {
+ List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
+ for (int j = 0, len2 = infos.size(); j < len2; j++) {
+ if (infos.get(j).getBigType() == Configuration.FRESH_AIR_BIG_TYPE
+ && infos.get(j).getDeviceType() == HDLApConfig.TYPE_FRESH_AIR
+ && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {//2019-07-17
+
+ isGetDeviceStateSuccess = true;
+ devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes);
+ EventBus.getDefault().post(new DeviceStateEvent(devicesDataList.get(i).getAppliancesInfoList().get(j), true));
+ break outter;
+ } else {
+ HDLLog.I("handleFreshAirStateData 娌℃湁鎵惧埌鍖归厤绫诲瀷");
+ }
+ }
+ break outter;
+ }
+ }
+ }
+
+ /**
+ * 澶勭悊鏂伴鎺у埗鎴愬姛鐘舵�佹暟鎹�
+ * 2020-07-20 鏂板
+ *
+ * @param getDatas
+ */
+ private static void handleFreshAirCtrlBackData(UdpDataBean getDatas) {
+ outter:
+ for (int i = 0, len = devicesDataList.size(); i < len; i++) {
+ if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID
+ ) {
+ List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
+ for (int j = 0, len2 = infos.size(); j < len2; j++) {
+ if (infos.get(j).getBigType() == Configuration.FRESH_AIR_BIG_TYPE
+ && infos.get(j).getDeviceType() == HDLApConfig.TYPE_FRESH_AIR
+ && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {
+
+ devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes);
+ AppliancesInfo mFreshAirInfo = devicesDataList.get(i).getAppliancesInfoList().get(j);
+ FreshAirBackInfo info = new FreshAirBackInfo(mFreshAirInfo);
+// isFreshAirCtrlSuccess = true;
+ setDeviceCtrlSuccessStateWithInfo(infos.get(j), true);
+ EventBus.getDefault().post(new FreshAirFeedBackEvent(info, true));
+ break outter;
+ }
+
+ }
+ }
+ }
+
+ }
+
+ /**
+ * 澶勭悊閲戣寕鏂伴璁惧鐘舵�佹暟鎹�
+ * 2020-07-20 鏂板
+ *
+ * @param getDatas
+ */
+ private static void handleFreshAirJINMAOStateData(UdpDataBean getDatas) {
+ outter:
+ for (int i = 0, len = devicesDataList.size(); i < len; i++) {
+ if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID
+ ) {
+ List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
+ for (int j = 0, len2 = infos.size(); j < len2; j++) {
+ if (infos.get(j).getBigType() == Configuration.FRESH_AIR_BIG_TYPE
+ && infos.get(j).getDeviceType() == HDLApConfig.TYPE_FRESH_AIR_JINMAO
+ && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {//2019-07-17
+
+ isGetDeviceStateSuccess = true;
+ devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes);
+ EventBus.getDefault().post(new DeviceStateEvent(devicesDataList.get(i).getAppliancesInfoList().get(j), true));
+ break outter;
+ } else {
+ HDLLog.I("handleFreshAirStateData 娌℃湁鎵惧埌鍖归厤绫诲瀷");
+ }
+ }
+ break outter;
+ }
+ }
+ }
+
+ /**
+ * 澶勭悊閲戣寕鏂伴鎺у埗鎴愬姛鐘舵�佹暟鎹�
+ * 2020-07-20 鏂板
+ *
+ * @param getDatas
+ */
+ private static void handleFreshAirJINMAOCtrlBackData(UdpDataBean getDatas) {
+ outter:
+ for (int i = 0, len = devicesDataList.size(); i < len; i++) {
+ if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID
+ ) {
+ List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
+ for (int j = 0, len2 = infos.size(); j < len2; j++) {
+ if (infos.get(j).getBigType() == Configuration.FRESH_AIR_BIG_TYPE
+ && infos.get(j).getDeviceType() == HDLApConfig.TYPE_FRESH_AIR_JINMAO
+ && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {
+
+ devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes);
+ AppliancesInfo mFreshAirInfo = devicesDataList.get(i).getAppliancesInfoList().get(j);
+ FreshAirJinMaoBackInfo info = new FreshAirJinMaoBackInfo(mFreshAirInfo);
+ setDeviceCtrlSuccessStateWithInfo(infos.get(j), true);
+ EventBus.getDefault().post(new FreshAirJinMaoFeedBackEvent(info, true));
+ break outter;
+ }
+
+ }
+ }
+ }
+
+
+ }
+
+ /**
+ * 澶勭悊鍦扮儹璁惧鐘舵�佹暟鎹�
+ * 2020-07-20 鏂板
+ *
+ * @param getDatas
+ */
+ private static void handleGeothermalStateData(UdpDataBean getDatas) {
+ outter:
+ for (int i = 0, len = devicesDataList.size(); i < len; i++) {
+ if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID
+ ) {
+ List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
+ for (int j = 0, len2 = infos.size(); j < len2; j++) {
+ if (infos.get(j).getBigType() == Configuration.GEOTHERMAL_BIG_TYPE
+ && (infos.get(j).getDeviceType() == HDLApConfig.TYPE_GEOTHERMAL_MODULE || infos.get(j).getDeviceType() == HDLApConfig.TYPE_GEOTHERMAL_JINMAO)
+ && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {//2019-07-17
+ if (getDatas.addBytes.length >= 10) {
+ byte[] getBytes = devicesDataList.get(i).getAppliancesInfoList().get(j).getArrCurState();
+ if (getBytes == null || getBytes.length < 10) {
+ getBytes = new byte[10];
+ }
+ System.arraycopy(getDatas.addBytes, 0, getBytes, 0, 10);//20190710鏌ヨ鍦扮儹鐘舵�佸弽棣堬紝鍙彇鍓�10浣嶆暟鎹�
+ devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getBytes);
+ isGetDeviceStateSuccess = true;
+ EventBus.getDefault().post(new DeviceStateEvent(devicesDataList.get(i).getAppliancesInfoList().get(j), true));
+ } else {
+ HDLLog.E("鍦扮儹鐘舵�佸弽棣堟暟鎹紓甯�");
+ }
+
+ break outter;
+ } else {
+ HDLLog.I("handleFreshAirStateData 娌℃湁鎵惧埌鍖归厤绫诲瀷");
+ }
+ }
+ break outter;
+ }
+ }
+ }
+
+ /**
+ * 澶勭悊鍦扮儹璁惧鎺у埗鏁版嵁
+ * 2020-07-20
+ *
+ * @param getDatas
+ */
+ private static void handleGeothermalCtrlData(UdpDataBean getDatas) {
+ switch (getDatas.command) {
+ //2019-07-09 鍦扮儹妯″潡
+ case Configuration.GEOTHERMAL_MODULE_CTRL_BACK_COMMAND:
+ outter:
+ for (int i = 0, len = devicesDataList.size(); i < len; i++) {
+ if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID
+ ) {
+
+ List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
+ for (int j = 0, len2 = infos.size(); j < len2; j++) {
+ if (getDatas.addBytes.length > 0) {
+ if (infos.get(j).getBigType() == Configuration.GEOTHERMAL_BIG_TYPE
+ && (infos.get(j).getDeviceType() == HDLApConfig.TYPE_GEOTHERMAL_MODULE || infos.get(j).getDeviceType() == HDLApConfig.TYPE_GEOTHERMAL_JINMAO)
+ && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {
+ if (getDatas.addBytes.length >= 8) {
+ byte[] getBytes = devicesDataList.get(i).getAppliancesInfoList().get(j).getArrCurState();
+ if (getBytes == null || getBytes.length < 10) {
+ getBytes = new byte[10];
+ }
+ System.arraycopy(getDatas.addBytes, 0, getBytes, 0, 8);//鎺у埗鍦扮儹鐘舵�佸弽棣堬紝鍙彇鍓�8浣嶆暟鎹�
+ devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getBytes);
+ AppliancesInfo mInfo = devicesDataList.get(i).getAppliancesInfoList().get(j);
+
+ GeothermalBackInfo info = new GeothermalBackInfo(mInfo, true);
+// isGeothermalCtrlSuccess = true;
+ setDeviceCtrlSuccessStateWithInfo(infos.get(j), true);
+ EventBus.getDefault().post(new GeothermalFeedBackEvent(info, EventCode.SUCCESS));
+ } else {
+
+ HDLLog.E("鎺у埗鍦扮儹鐘舵�佸弽棣堟暟鎹紓甯�");
+ }
+ break outter;
+ }
+ }
+ }
+ }
+ }
+
+ break;
+ }
+ }
+
+
+ /**
+ * 澶勭悊闂ㄩ攣璁惧鐘舵�佹暟鎹�
+ * 2023-08-22 鏂板
+ *
+ * @param getDatas
+ */
+ private static void handleDoorMachineStateData(UdpDataBean getDatas) {
+ outter:
+ for (int i = 0, len = devicesDataList.size(); i < len; i++) {
+ if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID
+ ) {
+ List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
+ for (int j = 0, len2 = infos.size(); j < len2; j++) {
+ if (infos.get(j).getBigType() == Configuration.DOOR_MACHINE_BIG_TYPE
+ && infos.get(j).getDeviceType() == HDLApConfig.TYPE_DOOR_MACHINE
+ && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {//2019-07-17
+
+ isGetDeviceStateSuccess = true;
+ devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes);
+ EventBus.getDefault().post(new DeviceStateEvent(devicesDataList.get(i).getAppliancesInfoList().get(j), true));
+ break outter;
+ } else {
+ HDLLog.I("handleDoorMachineStateData 娌℃湁鎵惧埌鍖归厤绫诲瀷");
+ }
+ }
+ break outter;
+ }
+ }
+ }
+
+ /**
+ * 澶勭悊闂ㄩ攣杩滅▼寮�閿佽繛鎺ユ帶鍒舵垚鍔熺姸鎬佹暟鎹�
+ * 2023-08-22 鏂板
+ *
+ * @param getDatas
+ */
+ private static void handleDoorMachineCtrlFristBackData(UdpDataBean getDatas) {
+ outter:
+ for (int i = 0, len = devicesDataList.size(); i < len; i++) {
+ if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID
+ ) {
+ List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
+ for (int j = 0, len2 = infos.size(); j < len2; j++) {
+ if (infos.get(j).getBigType() == Configuration.DOOR_MACHINE_BIG_TYPE
+ && infos.get(j).getDeviceType() == HDLApConfig.TYPE_DOOR_MACHINE
+ && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {
+
+ devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes);
+ AppliancesInfo mDoorMachineInfo = devicesDataList.get(i).getAppliancesInfoList().get(j);
+ DoorMachineFristBackInfo info = new DoorMachineFristBackInfo(mDoorMachineInfo);
+ setDeviceCtrlSuccessStateWithInfo(infos.get(j), true);
+ EventBus.getDefault().post(new DoorMachineFeedFristBackEvent(info, true));
+ break outter;
+ }
+
+ }
+ }
+ }
+ }
+
+ /**
+ * 澶勭悊闂ㄩ攣杩滅▼寮�閿佹帶鍒舵垚鍔熺姸鎬佹暟鎹�
+ * 2023-08-22 鏂板
+ *
+ * @param getDatas
+ */
+ private static void handleDoorMachineCtrlBackData(UdpDataBean getDatas) {
+ outter:
+ for (int i = 0, len = devicesDataList.size(); i < len; i++) {
+ if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID
+ ) {
+ List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
+ for (int j = 0, len2 = infos.size(); j < len2; j++) {
+ if (infos.get(j).getBigType() == Configuration.DOOR_MACHINE_BIG_TYPE
+ && infos.get(j).getDeviceType() == HDLApConfig.TYPE_DOOR_MACHINE
+ && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {
+
+ devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes);
+ AppliancesInfo appliancesInfo = devicesDataList.get(i).getAppliancesInfoList().get(j);
+ DoorMachineBackInfo doorMachineBackInfo = new DoorMachineBackInfo(appliancesInfo);
+ setDeviceCtrlSuccessStateWithInfo(infos.get(j), true);
+ EventBus.getDefault().post(new DoorMachineFeedBackEvent(doorMachineBackInfo, true));
+ break outter;
+ }
+
+ }
+ }
+ }
+ }
+
}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLSerialPortCore.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLSerialPortCore.java
index ec3647e..670c4c9 100644
--- a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLSerialPortCore.java
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLSerialPortCore.java
@@ -1,19 +1,15 @@
package com.hdl.sdk.ttl.HDLDeviceManger.Core;
-import android.serialport.api.SerialPort;
-import android.widget.TextView;
+//import android.serialport.api.SerialPort;
+
+import android.serialport.SerialPort;
+import android.util.Log;
import com.hdl.sdk.ttl.Config.Configuration;
-import com.hdl.sdk.ttl.Config.MCUConstants;
-import com.hdl.sdk.ttl.HDLDeviceManger.Bean.MCUDataBean;
import com.hdl.sdk.ttl.HDLDeviceManger.Bean.UdpDataBean;
-import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.EventCode;
import com.hdl.sdk.ttl.HDLDeviceManger.HDLListener.IMcuOtaListener;
-import com.hdl.sdk.ttl.Utils.HDLUtlis.HDLStringUtils;
-import com.hdl.sdk.ttl.Utils.HDLUtlis.HDLUtlis;
import com.hdl.sdk.ttl.Utils.LogUtils.HDLLog;
-
import java.io.File;
import java.io.IOException;
@@ -58,7 +54,7 @@
public static SerialPort getSerialPort() throws SecurityException, IOException, InvalidParameterException {
if (mSerialPort == null) {
- mSerialPort = new SerialPort(new File(mPathname), mBaudrate, 0);
+ mSerialPort = new SerialPort(new File(mPathname), mBaudrate);
mInputStream = mSerialPort.getInputStream();//璋冪敤瀵硅薄SerialPort鏂规硶锛岃幏鍙栦覆鍙d腑"璇诲拰鍐�"鐨勬暟鎹祦
mOutputStream = mSerialPort.getOutputStream();
bOpenSuccess = true;
@@ -92,7 +88,7 @@
try {
mPathname = mmPathname;
mBaudrate = mmBaudrate;
- mSerialPort = new SerialPort(new File(mPathname), mBaudrate, 0);
+ mSerialPort = new SerialPort(new File(mPathname), mBaudrate);
HDLLog.I("HDLSDK 涓插彛鍚姩鎴愬姛");
//璋冪敤瀵硅薄SerialPort鏂规硶锛岃幏鍙栦覆鍙d腑"璇诲拰鍐�"鐨勬暟鎹祦
mInputStream = mSerialPort.getInputStream();
@@ -468,24 +464,12 @@
if (receiveBytes.length < 14) {
return;
}
-// 鎵撳嵃鎺ユ敹鏁版嵁
-// HDLLog.I("receiveBytes HandleHDLdata: " + HDLStringUtils.ByteArrToHex(receiveBytes, 0, receiveBytes.length));
//2019-8-21 鏍¢獙Crc
if (!Crc.checkCRC(receiveBytes)) {
- HDLLog.I("checkCRC锛氭楠屽け璐�");
+// HDLLog.I("checkCRC锛氭楠屽け璐�");
return;
}
-// HDLLog.I("checkCRC锛氭楠屾垚鍔�");
-
-// //鏍¢獙鏄惁涓�0xAA 0xAA 寮�澶存暟鎹暟鎹�
-// if (!isHDLDataWithHead(receiveBytes)) {
-// return;
-// }
-
- //鎵撳嵃鎺ユ敹鏁版嵁
-// HDLLog.I("receiveBytes HandleHDLdata: " + HDLStringUtils.ByteArrToHex(receiveBytes, 0, receiveBytes.length));
-
//鏁版嵁闀垮害
int addDataLength = (receiveBytes[2] & 0xFF) - 11;
//闄勫姞鏁版嵁
@@ -503,17 +487,6 @@
int targetSubnetID = receiveBytes[9] & 0xFF;
//鐩爣璁惧鍙�
int targetDeviceID = receiveBytes[10] & 0xFF;
-// //鍙傛暟
-// UdpDataBean udpDataBean = new UdpDataBean();
-// udpDataBean.sourceSubnetID = sourceSubnetID;
-// udpDataBean.sourceDeviceID = sourceDeviceID;
-// udpDataBean.desSubnetID = targetSubnetID;
-// udpDataBean.desDeviceID = targetDeviceID;
-// udpDataBean.command = command;
-//
-// udpDataBean.addBytes = usefulBytes;
-//// HandleOutsideData(targetSubnetID, targetDeviceID, command, usefulBytes, receiveBytes, udpDataBean);
-// HandleInsideData(udpDataBean);
//s2019-8-20 澧炲姞鐩爣瀛愮綉鍙疯澶囧彿鍒ゆ柇
if ((targetSubnetID == 0xFF && targetDeviceID == 0xFF)
@@ -549,13 +522,6 @@
HDLDeviceManager.handle(sendDatas, sendDatas.command);
}
} else {
-// if (sendDatas.addBytes[0] == HandleSearch.random1
-// && sendDatas.addBytes[1] == HandleSearch.random2
-// && HandleSearch.rcuIp.equals(sendDatas.ipAddress)
-// ) {
-// HDLDeviceManager.handle(sendDatas, sendDatas.command);
-//
-// }
if (sendDatas.addBytes[0] == HandleSearch.random1
&& sendDatas.addBytes[1] == HandleSearch.random2
) {
@@ -569,11 +535,13 @@
case Configuration.COMMON_SWITCH_CTRL_BACK_COMMAND:
case Configuration.COMMON_SWITCH_STATE_BACK_COMMAND:
case Configuration.LIGHT_CTRL_BACK_COMMAND:
+ case Configuration.LIGHT_RGB_CTRL_BACK_COMMAND:
case Configuration.CURTAIN_CTRL_BACK_COMMAND:
case Configuration.AIR_CTRL_BACK_COMMAND:
case Configuration.LOGIC_CTRL_BACK_COMMAND:
case Configuration.LOGIC_STATE_BACK_COMMAND:
case Configuration.LIGHT_STATE_BACK_COMMAND:
+ case Configuration.LIGHT_RGB_STATE_BACK_COMMAND:
case Configuration.SECURITY_ARMING_CTRL_BACK_COMMAND://20190729瀹夐槻妯″潡 甯冮槻璁剧疆鍙嶉
case Configuration.SECURITY_STATE_BACK_COMMAND://20190729 璇诲彇瀹夐槻璁剧疆鍙嶉
case Configuration.SECURITY_ALARM_CTRL_BACK_COMMAND://20190729 鎶ヨ璁剧疆鍙嶉
@@ -596,7 +564,16 @@
case Configuration.AUDIO_CTRL_READ_BACK_COMMAND:
// case Configuration.AUDIO_MenuPlay_INSTRUCTION_COMMAND:
case Configuration.AUDIO_MenuPlay_INSTRUCTION_BACK_COMMAND:
-
+ case Configuration.FRESH_AIR_CTRL_BACK_COMMAND://2020-07-20 鏂板 鏂伴绯荤粺
+ case Configuration.FRESH_AIR_STATE_BACK_COMMAND://2020-07-20 鏂板 鏂伴绯荤粺
+ case Configuration.FRESH_AIR_JINMAO_CTRL_BACK_COMMAND://2020-07-20 鏂板 閲戣寕鏂伴
+ case Configuration.FRESH_AIR_JINMAO_STATE_BACK_COMMAND://2020-07-20 鏂板 閲戣寕鏂伴
+ case Configuration.GEOTHERMAL_MODULE_CTRL_BACK_COMMAND://2020-07-20 鏂板 鍦扮儹妯″潡
+ case Configuration.GEOTHERMAL_MODULE_STATE_BACK_COMMAND://2020-07-20 鏂板 鍦扮儹妯″潡
+ case Configuration.DOOR_MACHINE_MODULE_CTRL_FRIST_BACK_COMMAND://2023-08-22 鏂板 闂ㄩ攣
+ case Configuration.DOOR_MACHINE_MODULE_CTRL_BACK_COMMAND://2023-08-22 鏂板 闂ㄩ攣
+ case Configuration.DOOR_MACHINE_MODULE_STATE_BACK_COMMAND://2023-08-22 鏂板 闂ㄩ攣
+ case Configuration.DOOR_MACHINE_BROADCAST_STATE_BACK_COMMAND://2023-08-25 鏂板闂ㄩ攣鐘舵�佸拰鎶ヨ骞挎挱
HDLDeviceManager.handle(sendDatas, sendDatas.command);
break;
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HandleSearch.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HandleSearch.java
index 84d5095..f714a60 100644
--- a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HandleSearch.java
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HandleSearch.java
@@ -43,7 +43,7 @@
private static final int SEARCH_BROACAST = 101;//骞挎挱
private static final int SEARCH_MULTICAST = 102;//缁勬挱
- private static boolean bSearchAll = true; //鏄惁鍏ㄩ儴閲嶆柊鎼滅储锛屾垨鑰呭彂鐜版柊璁惧鎼滅储
+ private static boolean bSearchAll = true; //鏄惁鍏ㄩ儴閲嶆柊鎼滅储锛屾垨鑰呭彂鐜版柊璁惧鎼滅储
/**
* 閰掑簵鎼滅储
@@ -250,7 +250,7 @@
public void run() {
if (bean.getCount() < 3) {
HDLLog.I("娌℃湁鏀跺埌鏂拌澶囷紝鍙戦�佺 " + (bean.getCount() + 1) + " 娆℃悳绱㈠懡浠�");
- secondTimeSearch(random1, random2, HDLDeviceManager.realDevicesDataList);
+ secondTimeSearch(random1, random2, (bean.getCount() + 1), HDLDeviceManager.realDevicesDataList);
} else {
if (searchTimer != null) {
searchTimer.cancel();
@@ -275,7 +275,7 @@
}
}
- }, 500, 500);
+ }, 800, 800);
}
/**
@@ -293,7 +293,7 @@
}
isRefreshAllDevicesState = false;
/*** 鍏ㄩ儴閲嶆柊鎼滅储鎵嶆竻绌簂ist鏁扮粍*/
- if(bSearchAll) {
+ if (bSearchAll) {
HDLDeviceManager.devicesDataList.clear();
HDLDeviceManager.realDevicesDataList.clear();
HDLDeviceManager.listRemarks.clear();
@@ -329,7 +329,7 @@
* @param arg2 闅忔満鏁�2
* @param devicesDataList 鎵�鏈夎澶囦俊鎭泦
*/
- public static void secondTimeSearch(byte arg1, byte arg2, List<DevicesData> devicesDataList) {
+ public static void secondTimeSearch(byte arg1, byte arg2, int countSend, List<DevicesData> devicesDataList) {
if (devicesDataList == null || devicesDataList.size() == 0) {
return;
}
@@ -375,7 +375,7 @@
sendData += (bytes[i] & 0xff) + ",";
}
}
- HDLLog.I("绗簩娆″彂閫佺殑鎼滅储鏁版嵁锛�" + sendData);
+ HDLLog.I("绗�" + countSend + "娆″彂閫佺殑鎼滅储鏁版嵁锛�" + sendData);
HDLCommand.cusSendCommand(Configuration.DEVICES_SEARCH_COMMAND, 255, 255, bytes);
}
}
@@ -477,7 +477,7 @@
}
if ((HDLDeviceManager.listRemarks != null && HDLDeviceManager.listRemarks.size() == 0) || isSearching) {
isRefreshAllDevicesState = false;
- if(HDLDeviceManager.devicesDataList != null && HDLDeviceManager.devicesDataList.size() > 0){
+ if (HDLDeviceManager.devicesDataList != null && HDLDeviceManager.devicesDataList.size() > 0) {
HandleSearch.OnDeviceListGetSuccessCallBack();
}
return;
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/AirTechSysFeedBackEvent.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/AirTechSysFeedBackEvent.java
new file mode 100644
index 0000000..336c338
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/AirTechSysFeedBackEvent.java
@@ -0,0 +1,28 @@
+package com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent;
+
+import com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition.AirTechSysBackInfo;
+
+/**
+ * Created by panlili on 2023/8/21
+ */
+public class AirTechSysFeedBackEvent {
+ AirTechSysBackInfo mAirTechSysBackInfo;
+ boolean isSuccess;
+
+ public AirTechSysFeedBackEvent(AirTechSysBackInfo airTechSysBackInfo, boolean isSuccess){
+ this.mAirTechSysBackInfo = airTechSysBackInfo;
+ this.isSuccess = isSuccess;
+ }
+
+ public AirTechSysBackInfo getAirTechSysBackInfo() {
+ return mAirTechSysBackInfo;
+ }
+
+ public void setAirTechSysBackInfo(AirTechSysBackInfo mAirTechSysBackInfo) {
+ this.mAirTechSysBackInfo = mAirTechSysBackInfo;
+ }
+
+ public boolean isSuccess() {
+ return isSuccess;
+ }
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/ColourLightFeedBackEvent.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/ColourLightFeedBackEvent.java
new file mode 100644
index 0000000..5e23edb
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/ColourLightFeedBackEvent.java
@@ -0,0 +1,30 @@
+package com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent;
+
+
+import com.hdl.sdk.ttl.HDLAppliances.HDLLight.ColourLightCtrlBackInfo;
+
+/**
+ * Created by djl on 2023/8/22.
+ */
+
+public class ColourLightFeedBackEvent {
+ ColourLightCtrlBackInfo colourLightCtrlBackInfo;
+ boolean isSuccess;
+
+ public ColourLightFeedBackEvent(ColourLightCtrlBackInfo colourLightCtrlBackInfo, boolean isSuccess) {
+ this.isSuccess = isSuccess;
+ this.colourLightCtrlBackInfo = colourLightCtrlBackInfo;
+ }
+
+ public boolean isSuccess() {
+ return isSuccess;
+ }
+
+ public ColourLightCtrlBackInfo getColourLightCtrlBackInfo() {
+ return colourLightCtrlBackInfo;
+ }
+
+ public void setColourLightCtrlBackInfo(ColourLightCtrlBackInfo colourLightCtrlBackInfo) {
+ this.colourLightCtrlBackInfo = colourLightCtrlBackInfo;
+ }
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/DoorMachineFeedBackEvent.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/DoorMachineFeedBackEvent.java
new file mode 100644
index 0000000..5bed538
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/DoorMachineFeedBackEvent.java
@@ -0,0 +1,32 @@
+package com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent;
+
+
+import com.hdl.sdk.ttl.HDLAppliances.HDLDoorMachine.DoorMachineBackInfo;
+
+/**
+ * Created by panlili on 2023-08-22
+ */
+public class DoorMachineFeedBackEvent {
+ DoorMachineBackInfo mDoorMachineBackInfo;
+
+ boolean isSuccess;
+
+ public DoorMachineFeedBackEvent(DoorMachineBackInfo doorMachineBackInfo, boolean isSuccess) {
+ this.mDoorMachineBackInfo = doorMachineBackInfo;
+ this.isSuccess = isSuccess;
+ }
+
+ public DoorMachineBackInfo getDoorMachineBackInfo() {
+ return mDoorMachineBackInfo;
+ }
+
+ public void setDoorMachineBackInfo(DoorMachineBackInfo doorMachineBackInfo) {
+ this.mDoorMachineBackInfo = doorMachineBackInfo;
+ }
+
+ public boolean isSuccess() {
+ return isSuccess;
+ }
+
+
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/DoorMachineFeedFristBackEvent.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/DoorMachineFeedFristBackEvent.java
new file mode 100644
index 0000000..d244211
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/DoorMachineFeedFristBackEvent.java
@@ -0,0 +1,31 @@
+package com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent;
+
+
+import com.hdl.sdk.ttl.HDLAppliances.HDLDoorMachine.DoorMachineFristBackInfo;
+
+/**
+ * Created by panlili on 2023-08-22
+ */
+public class DoorMachineFeedFristBackEvent {
+ DoorMachineFristBackInfo mDoorMachineFristBackInfo;
+
+ boolean isSuccess;
+
+ public DoorMachineFeedFristBackEvent(DoorMachineFristBackInfo doorMachineFristBackInfo, boolean isSuccess) {
+ this.mDoorMachineFristBackInfo = doorMachineFristBackInfo;
+ this.isSuccess = isSuccess;
+ }
+
+ public DoorMachineFristBackInfo getDoorMachineFristBackInfo() {
+ return mDoorMachineFristBackInfo;
+ }
+
+ public void setDoorMachineFristBackInfo(DoorMachineFristBackInfo mDoorMachineFristBackInfo) {
+ this.mDoorMachineFristBackInfo = mDoorMachineFristBackInfo;
+ }
+
+ public boolean isSuccess() {
+ return isSuccess;
+ }
+
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/FreshAirFeedBackEvent.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/FreshAirFeedBackEvent.java
new file mode 100644
index 0000000..35b4c1d
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/FreshAirFeedBackEvent.java
@@ -0,0 +1,28 @@
+package com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent;
+
+
+import com.hdl.sdk.ttl.HDLAppliances.HDLFreshAir.FreshAirBackInfo;
+
+/**
+ * Created by JLChen on 2020-07-20
+ */
+public class FreshAirFeedBackEvent {
+ FreshAirBackInfo mFreshAirBackInfo;
+
+ boolean isSuccess;
+
+ public FreshAirFeedBackEvent(FreshAirBackInfo freshAirBackInfo, boolean isSuccess){
+ this.mFreshAirBackInfo = freshAirBackInfo;
+ this.isSuccess = isSuccess;
+ }
+
+ public FreshAirBackInfo getFreshAirBackInfo() {
+ return mFreshAirBackInfo;
+ }
+
+ public boolean isSuccess() {
+ return isSuccess;
+ }
+
+
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/FreshAirJinMaoFeedBackEvent.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/FreshAirJinMaoFeedBackEvent.java
new file mode 100644
index 0000000..d544210
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/FreshAirJinMaoFeedBackEvent.java
@@ -0,0 +1,27 @@
+package com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent;
+
+import com.hdl.sdk.ttl.HDLAppliances.HDLFreshAir.FreshAirJinMaoBackInfo;
+
+/**
+ * Created by JLChen on 2020-07-20
+ */
+public class FreshAirJinMaoFeedBackEvent {
+ FreshAirJinMaoBackInfo mFreshAirJinMaoBackInfo;
+
+ boolean isSuccess;
+
+ public FreshAirJinMaoFeedBackEvent(FreshAirJinMaoBackInfo mFreshAirJinMaoBackInfo, boolean isSuccess){
+ this.mFreshAirJinMaoBackInfo = mFreshAirJinMaoBackInfo;
+ this.isSuccess = isSuccess;
+ }
+
+
+ public FreshAirJinMaoBackInfo getFreshAirJinMaoBackInfo() {
+ return mFreshAirJinMaoBackInfo;
+ }
+
+ public boolean isSuccess() {
+ return isSuccess;
+ }
+
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/GeothermalFeedBackEvent.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/GeothermalFeedBackEvent.java
new file mode 100644
index 0000000..86ce277
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/GeothermalFeedBackEvent.java
@@ -0,0 +1,42 @@
+package com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent;
+
+
+import com.hdl.sdk.ttl.HDLAppliances.HDLGeothermal.GeothermalBackInfo;
+
+/**
+ * Created by JLChen on 2020-07-20
+ * 鍦扮儹妯″潡
+ */
+public class GeothermalFeedBackEvent {
+ GeothermalBackInfo mGeothermalBackInfo;
+// boolean isSuccess;
+
+ int mStatusID;
+
+ public GeothermalFeedBackEvent(GeothermalBackInfo geothermalBackInfo, int mStatusID){
+ this.mGeothermalBackInfo = geothermalBackInfo;
+ this.mStatusID = mStatusID;
+ }
+
+ public GeothermalBackInfo getGeothermalBackInfo() {
+ return mGeothermalBackInfo;
+ }
+
+ public int getStatusID() {
+ return mStatusID;
+ }
+
+
+// public GeothermalFeedBackEvent( GeothermalBackInfo geothermalBackInfo, boolean isSuccess){
+// this.mGeothermalBackInfo = geothermalBackInfo;
+// this.isSuccess = isSuccess;
+// }
+//
+// public GeothermalBackInfo getGeothermalBackInfo() {
+// return mGeothermalBackInfo;
+// }
+//
+// public boolean isSuccess() {
+// return isSuccess;
+// }
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Parser/DeviceParser.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Parser/DeviceParser.java
index abf4465..e1aeedc 100644
--- a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Parser/DeviceParser.java
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Parser/DeviceParser.java
@@ -1,17 +1,18 @@
package com.hdl.sdk.ttl.HDLDeviceManger.Parser;
+import static com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLDeviceManager.devicesDataList;
+
+import android.util.Log;
+
import com.hdl.sdk.ttl.Config.Configuration;
import com.hdl.sdk.ttl.HDLAppliances.Config.HDLApConfig;
import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
import com.hdl.sdk.ttl.HDLDeviceManger.Bean.DevicesData;
-import com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLDeviceManager;
import com.hdl.sdk.ttl.HDLDeviceManger.Core.HandleSearch;
import com.hdl.sdk.ttl.Utils.LogUtils.HDLLog;
import java.util.ArrayList;
import java.util.List;
-
-import static com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLDeviceManager.devicesDataList;
/**
* Created by djl on 2017/3/29.
@@ -72,13 +73,21 @@
case Configuration.SECURITY_BIG_TYPE://2019-7-29 鏂板
parseSecurityData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, 0, "");
break;
- case Configuration.SENSOR_BIG_TYPE://2019-07-03 灞忚斀
+ case Configuration.SENSOR_BIG_TYPE:
parseSensorData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, 0, "");
break;
case Configuration.COMMON_SWITCH_BIG_TYPE://2020-04-01 閫氱敤寮�鍏�
parseCommonSwitchData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, 0, "");
break;
-
+ case Configuration.FRESH_AIR_BIG_TYPE://2020-07-20 鏂板鏂伴
+ parseFreshAirData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, 0, "");
+ break;
+ case Configuration.GEOTHERMAL_BIG_TYPE://鍦扮儹
+ parseGeothermalData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, 0, "");
+ break;
+ case Configuration.DOOR_MACHINE_BIG_TYPE://闂ㄩ攣
+ parseDoorMachineData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, 0, "");//闂ㄩ攣鐨勯�氶亾鍙烽渶瑕�-1
+ break;
default:
// appliancesInfo.setDeviceName(Configuration.UNKNOW_TYPE);
break;
@@ -93,9 +102,9 @@
appliancesInfo.setDeviceKey(key);//2019-8-2 娣诲姞鍞竴鏍囪瘑key
appliancesInfoList.add(appliancesInfo);
-// HDLLog.I( "鍚戞ā鍧楁坊鍔犲洖璺細"+"澶х被锛�" + bigType + " 灏忕被锛�" + littleType +" 妯″潡澶囨敞" + devicesData.getRemark() );
+ HDLLog.I("鍚戞ā鍧楁坊鍔犲洖璺細" + "澶х被锛�" + bigType + " 灏忕被锛�" + littleType + " 妯″潡澶囨敞" + devicesData.getRemark());
} else {
-// HDLLog.I( "涓嶆槸瑕佹坊鍔犵殑璁惧锛氬ぇ绫伙細" + bigType + " 灏忕被锛�" + littleType +" 妯″潡澶囨敞" + devicesData.getRemark() );
+ HDLLog.I("涓嶆槸瑕佹坊鍔犵殑璁惧锛氬ぇ绫伙細" + bigType + " 灏忕被锛�" + littleType + " 妯″潡澶囨敞" + devicesData.getRemark());
}
}
}
@@ -128,14 +137,12 @@
case Configuration.LIGTH_BIG_TYPE:
switch (littleType) {
case 0:
- isWant = true;
- break;
case 1:
- isWant = true;
- break;
+ case 2:
+ case 3:
+ case 7:
+ case 8:
case 9:
- isWant = true;
- break;
case 10:
isWant = true;
break;
@@ -163,9 +170,8 @@
case Configuration.AIR_BIG_TYPE:
switch (littleType) {
case 0:
- isWant = true;
- break;
case 3:
+ case 100:
isWant = true;
break;
default:
@@ -245,6 +251,38 @@
break;
}
break;
+ case Configuration.FRESH_AIR_BIG_TYPE://鏂伴璁惧 2020-07-20
+ switch (littleType) {
+ case 0:
+ case 1:
+ isWant = true;
+ break;
+ default:
+ isWant = false;
+ break;
+ }
+ break;
+ case Configuration.GEOTHERMAL_BIG_TYPE://鍦扮儹璁惧 2020-07-20
+ switch (littleType) {
+ case 0:
+ case 3:
+ isWant = true;
+ break;
+ default:
+ isWant = false;
+ break;
+ }
+ break;
+ case Configuration.DOOR_MACHINE_BIG_TYPE://闂ㄩ攣璁惧 2023-08-22
+ switch (littleType) {
+ case 4:
+ isWant = true;
+ break;
+ default:
+ isWant = false;
+ break;
+ }
+ break;
default:
isWant = false;
break;
@@ -264,10 +302,12 @@
appliancesInfo.setDeviceType(HDLApConfig.TYPE_LIGHT_RELAY);
break;
case 2:
- appliancesInfo.setDeviceName("閫昏緫鐏帶鍒�");
+ appliancesInfo.setDeviceName("閫昏緫鐏帶鍒禖CT");
+ appliancesInfo.setDeviceType(HDLApConfig.TYPE_LIGHT_CCT);
break;
case 3:
appliancesInfo.setDeviceName("閫昏緫鐏疪GB");
+ appliancesInfo.setDeviceType(HDLApConfig.TYPE_LIGHT_RGB);
break;
case 4:
appliancesInfo.setDeviceName("閫昏緫鐏疪GBW");
@@ -280,9 +320,11 @@
break;
case 7:
appliancesInfo.setDeviceName("DALI");
+ appliancesInfo.setDeviceType(HDLApConfig.TYPE_LIGHT_DALI);
break;
case 8:
appliancesInfo.setDeviceName("鑷畾涔夐�昏緫鐏�");
+ appliancesInfo.setDeviceType(HDLApConfig.TYPE_LIGHT_DMX);
break;
case 9:
appliancesInfo.setDeviceName("娣峰悎璋冨厜绫�");
@@ -300,10 +342,18 @@
appliancesInfo.setChannelNum(channelNum);
appliancesInfo.setBigType(Configuration.LIGTH_BIG_TYPE);
appliancesInfo.setLittleType(littleType);
- appliancesInfo.setCtrlCommand(Configuration.LIGHT_CTRL_COMMAND);
- appliancesInfo.setCtrlBackCommand(Configuration.LIGHT_CTRL_BACK_COMMAND);
- appliancesInfo.setStateCommand(Configuration.LIGHT_STATE_COMMAND);
- appliancesInfo.setStateBackCommand(Configuration.LIGHT_STATE_BACK_COMMAND);
+
+ if (appliancesInfo.getDeviceType() == HDLApConfig.TYPE_LIGHT_CCT || appliancesInfo.getDeviceType() == HDLApConfig.TYPE_LIGHT_RGB || appliancesInfo.getDeviceType() == HDLApConfig.TYPE_LIGHT_DALI || appliancesInfo.getDeviceType() == HDLApConfig.TYPE_LIGHT_DMX) {
+ appliancesInfo.setCtrlCommand(Configuration.LIGHT_RGB_CTRL_COMMAND);
+ appliancesInfo.setCtrlBackCommand(Configuration.LIGHT_RGB_CTRL_BACK_COMMAND);
+ appliancesInfo.setStateCommand(Configuration.LIGHT_RGB_STATE_COMMAND);
+ appliancesInfo.setStateBackCommand(Configuration.LIGHT_RGB_STATE_BACK_COMMAND);
+ } else {
+ appliancesInfo.setCtrlCommand(Configuration.LIGHT_CTRL_COMMAND);
+ appliancesInfo.setCtrlBackCommand(Configuration.LIGHT_CTRL_BACK_COMMAND);
+ appliancesInfo.setStateCommand(Configuration.LIGHT_STATE_COMMAND);
+ appliancesInfo.setStateBackCommand(Configuration.LIGHT_STATE_BACK_COMMAND);
+ }
appliancesInfo.setDeviceSubnetID(devicesData.getSourceSubnetID());
appliancesInfo.setDeviceDeviceID(devicesData.getSourceDeviceID());
appliancesInfo.setParentRemarks(parentRemarks);
@@ -365,6 +415,10 @@
appliancesInfo.setDeviceName("閫氱敤绌鸿皟闈㈡澘");
appliancesInfo.setDeviceType(HDLApConfig.TYPE_AC_PANEL);
break;
+ case 100:
+ appliancesInfo.setDeviceName("绉戞妧绯荤粺");
+ appliancesInfo.setDeviceType(HDLApConfig.TYPE_AC_TECHSYS);
+ break;
default:
appliancesInfo.setDeviceName(Configuration.UNKNOW_TYPE);
break;
@@ -379,7 +433,7 @@
appliancesInfo.setParentRemarks(parentRemarks);
// appliancesInfo.setPort(port);
// appliancesInfo.setIpAddress(ipAddress);
- if (littleType == 0) {
+ if (littleType == 0 || littleType == 100) {//绉戞妧绯荤粺璧�0x193A鍜�0x1938
appliancesInfo.setCtrlCommand(Configuration.AIR_HVAC_CTRL_COMMAND);
appliancesInfo.setCtrlBackCommand(Configuration.AIR_HVAC_CTRL_BACK_COMMAND);
appliancesInfo.setStateCommand(Configuration.AIR_HVAC_STATE_COMMAND);
@@ -674,32 +728,137 @@
appliancesInfo.setChannelNum(curChannelNum);
appliancesInfo.setBigType(Configuration.SENSOR_BIG_TYPE);
appliancesInfo.setLittleType(littleType);
-// appliancesInfo.setCtrlCommand(Configuration.LOGIC_CTRL_COMMAND);
-// appliancesInfo.setCtrlBackCommand(Configuration.LOGIC_CTRL_BACK_COMMAND);
-// appliancesInfo.setStateCommand(Configuration.SENSOR_STATE_COMMAND);
-// appliancesInfo.setStateBackCommand(Configuration.SENSOR_STATE_BACK_COMMAND);
appliancesInfo.setDeviceSubnetID(devicesData.getSourceSubnetID());
appliancesInfo.setDeviceDeviceID(devicesData.getSourceDeviceID());
appliancesInfo.setParentRemarks(parentRemarks);
- if (littleType == 1) {//鍚搁《绾㈠浼犳劅鍣�
- appliancesInfo.setStateCommand(Configuration.DRY_CONTACT_STATE_COMMAND);
- appliancesInfo.setStateBackCommand(Configuration.DRY_CONTACT_STATE_BACK_COMMAND);
- } else {
+ appliancesInfo.setStateCommand(Configuration.DRY_CONTACT_STATE_COMMAND);
+ appliancesInfo.setStateBackCommand(Configuration.DRY_CONTACT_STATE_BACK_COMMAND);
- appliancesInfo.setStateCommand(Configuration.DRY_CONTACT_STATE_COMMAND);
- appliancesInfo.setStateBackCommand(Configuration.DRY_CONTACT_STATE_BACK_COMMAND);
-
- }
}
-
}
+
+
+ /**
+ * 2020-07-20
+ * 鏂伴绯荤粺
+ */
+ private static void parseFreshAirData(int littleType, AppliancesInfo appliancesInfo, DevicesData devicesData, String parentRemarks, int channelNum, int port, String ipAddress) {
+ switch (littleType) {
+ case 0:
+ appliancesInfo.setDeviceName("鏂伴绯荤粺妯″潡");
+ appliancesInfo.setDeviceType(HDLApConfig.TYPE_FRESH_AIR);
+ appliancesInfo.setCtrlCommand(Configuration.FRESH_AIR_CTRL_COMMAND);
+ appliancesInfo.setCtrlBackCommand(Configuration.FRESH_AIR_CTRL_BACK_COMMAND);
+ appliancesInfo.setStateCommand(Configuration.FRESH_AIR_STATE_COMMAND);
+ appliancesInfo.setStateBackCommand(Configuration.FRESH_AIR_STATE_BACK_COMMAND);
+ break;
+ case 1:
+ appliancesInfo.setDeviceName("閲戣寕鏂伴");
+ appliancesInfo.setDeviceType(HDLApConfig.TYPE_FRESH_AIR_JINMAO);
+ appliancesInfo.setCtrlCommand(Configuration.FRESH_AIR_JINMAO_CTRL_COMMAND);
+ appliancesInfo.setCtrlBackCommand(Configuration.FRESH_AIR_JINMAO_CTRL_BACK_COMMAND);
+ appliancesInfo.setStateCommand(Configuration.FRESH_AIR_JINMAO_STATE_COMMAND);
+ appliancesInfo.setStateBackCommand(Configuration.FRESH_AIR_JINMAO_STATE_BACK_COMMAND);
+ break;
+ default:
+ appliancesInfo.setDeviceName(Configuration.UNKNOW_TYPE);
+ break;
+ }
+
+ if (devicesData != null) {
+ appliancesInfo.setChannelNum(channelNum);
+ appliancesInfo.setBigType(Configuration.FRESH_AIR_BIG_TYPE);
+ appliancesInfo.setLittleType(littleType);
+ appliancesInfo.setDeviceSubnetID(devicesData.getSourceSubnetID());
+ appliancesInfo.setDeviceDeviceID(devicesData.getSourceDeviceID());
+ appliancesInfo.setParentRemarks(parentRemarks);
+ }
+ }
+
+
+ /**
+ * 鍦扮儹
+ */
+ private static void parseGeothermalData(int littleType, AppliancesInfo appliancesInfo, DevicesData devicesData, String parentRemarks, int channelNum, int port, String ipAddress) {
+ switch (littleType) {
+ case 0:
+ appliancesInfo.setDeviceName("鍦扮儹妯″潡");
+ appliancesInfo.setDeviceType(HDLApConfig.TYPE_GEOTHERMAL_MODULE);
+ break;
+// case 1:
+// appliancesInfo.setDeviceName("甯歌鍦扮儹闈㈡澘");
+// appliancesInfo.setDeviceType(HDLApConfig.TYPE_GEOTHERMAL_MODULE_PANEL);
+// break;
+// case 2:
+// appliancesInfo.setDeviceName("甯I杩愮畻鐨勫湴鐑潰鏉�");
+// appliancesInfo.setDeviceType(HDLApConfig.TYPE_GEOTHERMAL_MODULE_PI);
+// break;
+ case 3:
+ appliancesInfo.setDeviceName("鐗规畩鍦扮儹妯″潡");
+ appliancesInfo.setDeviceType(HDLApConfig.TYPE_GEOTHERMAL_JINMAO);
+ break;
+ default:
+ appliancesInfo.setDeviceName(Configuration.UNKNOW_TYPE);
+ break;
+
+ }
+ if (devicesData != null) {
+ appliancesInfo.setChannelNum(channelNum);
+ appliancesInfo.setBigType(Configuration.GEOTHERMAL_BIG_TYPE);
+ appliancesInfo.setLittleType(littleType);
+ appliancesInfo.setDeviceSubnetID(devicesData.getSourceSubnetID());
+ appliancesInfo.setDeviceDeviceID(devicesData.getSourceDeviceID());
+ appliancesInfo.setParentRemarks(parentRemarks);
+// appliancesInfo.setPort(port);
+// appliancesInfo.setIpAddress(ipAddress);
+
+ appliancesInfo.setCtrlCommand(Configuration.GEOTHERMAL_MODULE_CTRL_COMMAND);
+ appliancesInfo.setCtrlBackCommand(Configuration.GEOTHERMAL_MODULE_CTRL_BACK_COMMAND);
+ appliancesInfo.setStateCommand(Configuration.GEOTHERMAL_MODULE_STATE_COMMAND);
+ appliancesInfo.setStateBackCommand(Configuration.GEOTHERMAL_MODULE_STATE_BACK_COMMAND);
+
+
+ }
+ }
+
+
+ /**
+ * 闂ㄩ攣
+ */
+ private static void parseDoorMachineData(int littleType, AppliancesInfo appliancesInfo, DevicesData devicesData, String parentRemarks, int channelNum, int port, String ipAddress) {
+ switch (littleType) {
+ case 4:
+ appliancesInfo.setDeviceName("闂ㄩ攣妯″潡");
+ appliancesInfo.setDeviceType(HDLApConfig.TYPE_DOOR_MACHINE);
+ break;
+ default:
+ appliancesInfo.setDeviceName(Configuration.UNKNOW_TYPE);
+ break;
+ }
+ if (devicesData != null) {
+ appliancesInfo.setChannelNum(channelNum);
+ appliancesInfo.setBigType(Configuration.DOOR_MACHINE_BIG_TYPE);
+ appliancesInfo.setLittleType(littleType);
+ appliancesInfo.setDeviceSubnetID(devicesData.getSourceSubnetID());
+ appliancesInfo.setDeviceDeviceID(devicesData.getSourceDeviceID());
+ appliancesInfo.setParentRemarks(parentRemarks);
+
+ appliancesInfo.setCtrlCommand(Configuration.DOOR_MACHINE_MODULE_CTRL_COMMAND);
+ appliancesInfo.setCtrlBackCommand(Configuration.DOOR_MACHINE_MODULE_CTRL_BACK_COMMAND);
+ appliancesInfo.setStateCommand(Configuration.DOOR_MACHINE_MODULE_STATE_COMMAND);
+ appliancesInfo.setStateBackCommand(Configuration.DOOR_MACHINE_MODULE_STATE_BACK_COMMAND);
+
+ }
+ }
+
/**
* 2020-04-01
* 鏂板閫氱敤寮�鍏�
+ *
* @param littleType
* @param appliancesInfo
* @param devicesData
@@ -886,13 +1045,21 @@
case Configuration.SECURITY_BIG_TYPE://2019-7-29 鏂板
parseSecurityData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, 0, "");
break;
- case Configuration.SENSOR_BIG_TYPE://2019-07-03 灞忚斀
+ case Configuration.SENSOR_BIG_TYPE:
parseSensorData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, 0, "");
break;
case Configuration.COMMON_SWITCH_BIG_TYPE://2020-04-01 閫氱敤寮�鍏�
parseCommonSwitchData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, 0, "");
break;
-
+ case Configuration.FRESH_AIR_BIG_TYPE://2020-07-20 鏂板鏂伴
+ parseFreshAirData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, 0, "");
+ break;
+ case Configuration.GEOTHERMAL_BIG_TYPE://2020-07-20 鍦扮儹
+ parseGeothermalData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, 0, "");
+ break;
+ case Configuration.DOOR_MACHINE_BIG_TYPE://2023-08-22 闂ㄩ攣
+ parseDoorMachineData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, 0, "");
+ break;
default:
// appliancesInfo.setDeviceName(Configuration.UNKNOW_TYPE);
break;
@@ -911,9 +1078,9 @@
/**
- *
* 娣诲姞璁惧鍥炶矾
* 濡傛灉瀛樺湪鐩稿悓瀛愮綉鍙� 璁惧鍙凤紝鍒欏綋鎴愭贩鍚堟ā鍧楁坊鍔犲埌璇ュ洖璺笅锛屼笉瀛樺湪鍒欐柊娣诲姞妯″潡
+ *
* @param bigType
* @param littleType
* @param mSubnetID
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Utils/HDLUtlis/AesUtil.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Utils/HDLUtlis/AesUtil.java
new file mode 100644
index 0000000..e10c0a6
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Utils/HDLUtlis/AesUtil.java
@@ -0,0 +1,161 @@
+package com.hdl.sdk.ttl.Utils.HDLUtlis;
+
+import android.util.Log;
+
+import java.io.UnsupportedEncodingException;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.NoSuchAlgorithmException;
+
+import javax.crypto.BadPaddingException;
+import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.NoSuchPaddingException;
+import javax.crypto.spec.IvParameterSpec;
+import javax.crypto.spec.SecretKeySpec;
+
+/**
+ * Aes 鍔犺В瀵嗗伐鍏风被
+ *
+ * @author yangtao
+ * 2020骞�10鏈�29鏃�
+ */
+public class AesUtil {
+
+ private static final String CIPHER_INSTANCE = "AES/CBC/PKCS7Padding";
+ private static final String AES_ALGORITHM = "AES";
+
+// static {
+// //AES/CBC/PKCS7Padding 渚濊禆
+// Security.addProvider(new BouncyCastleProvider());
+// }
+
+ /**
+ * AES鍔犲瘑
+ *
+ * @param key
+ * @return
+ * @throws Exception
+ */
+ public static byte[] aesEncrypt(byte[] content, String key) {
+ return encrypt(content, key.getBytes(), CIPHER_INSTANCE, true, null);
+ }
+
+ /**
+ * AES瑙e瘑
+ *
+ * @param key
+ * @return
+ * @throws Exception
+ */
+ public static byte[] aesDecrypt(byte[] content, String key) {
+ return decrypt(content, key.getBytes(), CIPHER_INSTANCE, true, null);
+ }
+
+
+ /**
+ * 鍔犲瘑
+ *
+ * @param content 寰呭姞瀵嗗瓧绗︿覆
+ * @param keyByte aesKye鐨刪exStr
+ * @param cipherInstance AES绠楁硶濉厖鏂瑰紡
+ * @param isIv 鏄惁浣跨敤鍋忕Щ閲� ECB妯″紡涓嶅彲鐢�
+ * @param iv 鍋忕Щ閲� 涓嶄紶榛樿瀵嗛挜
+ * @return
+ */
+ public static byte[] encrypt(byte[] content, byte[] keyByte, String cipherInstance, Boolean isIv, byte[] iv) {
+ try {
+ //KEY杞崲
+ Key key = new SecretKeySpec(keyByte, AES_ALGORITHM);
+ //鍔犲瘑
+ Cipher cipher = Cipher.getInstance(cipherInstance);
+ if (isIv != null && isIv) {
+ //鍋忕Щ閲� 涓嶄紶榛樿瀵嗛挜
+ if (iv == null) {
+ iv = keyByte;
+ }
+ IvParameterSpec ivps = new IvParameterSpec(iv);
+ cipher.init(Cipher.ENCRYPT_MODE, key, ivps);
+ } else {
+ cipher.init(Cipher.ENCRYPT_MODE, key);
+ }
+ byte[] result = cipher.doFinal(content);
+ return result;
+ } catch (NoSuchAlgorithmException e) {
+ Log.e("AesUtil",e.getMessage());
+ } catch (InvalidKeyException e) {
+ Log.e("AesUtil",e.getMessage());
+ } catch (NoSuchPaddingException e) {
+ Log.e("AesUtil",e.getMessage());
+ } catch (BadPaddingException e) {
+ Log.e("AesUtil",e.getMessage());
+ } catch (IllegalBlockSizeException e) {
+ Log.e("AesUtil",e.getMessage());
+ } catch (InvalidAlgorithmParameterException e) {
+ Log.e("AesUtil",e.getMessage());
+ }
+ return null;
+ }
+
+ /**
+ * 瑙e瘑
+ *
+ * @param contentByte 寰呰В瀵嗗緟瀛楃涓瞙exStr
+ * @param contentByte 瀵嗛挜
+ * @param cipherInstance AES绠楁硶濉厖鏂瑰紡
+ * @param isIv 鏄惁浣跨敤鍋忕Щ閲� ECB妯″紡涓嶅彲鐢�
+ * @param iv 鍋忕Щ閲� 涓嶄紶榛樿瀵嗛挜
+ * @return
+ */
+ public static byte[] decrypt(byte[] contentByte, byte[] keyByte, String cipherInstance, Boolean isIv, byte[] iv) {
+ try {
+ //KEY杞崲
+ Key key = new SecretKeySpec(keyByte, AES_ALGORITHM);
+ //瑙e瘑
+ Cipher cipher = Cipher.getInstance(cipherInstance);
+ if (isIv != null && isIv) {
+ //鍋忕Щ閲� 涓嶄紶榛樿瀵嗛挜
+ if (iv == null) {
+ iv = keyByte;
+ }
+ IvParameterSpec ivps = new IvParameterSpec(iv);
+ cipher.init(Cipher.DECRYPT_MODE, key, ivps);
+ } else {
+ cipher.init(Cipher.DECRYPT_MODE, key);
+ }
+ byte[] result = cipher.doFinal(contentByte);
+ return result;
+ } catch (NoSuchAlgorithmException e) {
+ Log.e("AesUtil",e.getMessage());
+ } catch (InvalidKeyException e) {
+ Log.e("AesUtil",e.getMessage());
+ } catch (NoSuchPaddingException e) {
+ Log.e("AesUtil",e.getMessage());
+ } catch (BadPaddingException e) {
+ Log.e("AesUtil",e.getMessage());
+ } catch (IllegalBlockSizeException e) {
+ Log.e("AesUtil",e.getMessage());
+ } catch (InvalidAlgorithmParameterException e) {
+ Log.e("AesUtil",e.getMessage());
+ }
+ return null;
+ }
+
+
+ /**
+ * 瀛楃涓瞭o Bytes
+ * @param str 瀛楃涓�
+ * @return
+ */
+ public static byte[] stringToBytes(String str) {
+ try {
+ // 浣跨敤鎸囧畾鐨勫瓧绗﹂泦灏嗘瀛楃涓茬紪鐮佷负byte搴忓垪骞跺瓨鍒颁竴涓猙yte鏁扮粍涓�
+ return str.getBytes("utf-8");
+ } catch (UnsupportedEncodingException e) {
+ e.printStackTrace();
+ }
+ return new byte[]{};
+ }
+
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Utils/HDLUtlis/CommonHelper.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Utils/HDLUtlis/CommonHelper.java
new file mode 100644
index 0000000..179a94b
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Utils/HDLUtlis/CommonHelper.java
@@ -0,0 +1,79 @@
+package com.hdl.sdk.ttl.Utils.HDLUtlis;
+
+/**
+ * @author: Gao Sheng
+ * @since: 2021-04-23
+ */
+public class CommonHelper {
+
+ /**
+ * byte杞琲nt
+ *
+ * @param b
+ * @return int鍊�
+ */
+ public static int byteToInt(byte b) {
+ return b & 0xFF;
+ }
+
+ static int[] fsb =
+ {
+ 0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F, 0xC5,
+ 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76,
+ 0xCA, 0x82, 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0,
+ 0xAD, 0xD4, 0xA2, 0xAF, 0x9C, 0xA4, 0x72, 0xC0,
+ 0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC,
+ 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15,
+ 0x04, 0xC7, 0x23, 0xC3, 0x18, 0x96, 0x05, 0x9A,
+ 0x07, 0x12, 0x80, 0xE2, 0xEB, 0x27, 0xB2, 0x75,
+ 0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0,
+ 0x52, 0x3B, 0xD6, 0xB3, 0x29, 0xE3, 0x2F, 0x84,
+ 0x53, 0xD1, 0x00, 0xED, 0x20, 0xFC, 0xB1, 0x5B,
+ 0x6A, 0xCB, 0xBE, 0x39, 0x4A, 0x4C, 0x58, 0xCF,
+ 0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85,
+ 0x45, 0xF9, 0x02, 0x7F, 0x50, 0x3C, 0x9F, 0xA8,
+ 0x51, 0xA3, 0x40, 0x8F, 0x92, 0x9D, 0x38, 0xF5,
+ 0xBC, 0xB6, 0xDA, 0x21, 0x10, 0xFF, 0xF3, 0xD2,
+ 0xCD, 0x0C, 0x13, 0xEC, 0x5F, 0x97, 0x44, 0x17,
+ 0xC4, 0xA7, 0x7E, 0x3D, 0x64, 0x5D, 0x19, 0x73,
+ 0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A, 0x90, 0x88,
+ 0x46, 0xEE, 0xB8, 0x14, 0xDE, 0x5E, 0x0B, 0xDB,
+ 0xE0, 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C,
+ 0xC2, 0xD3, 0xAC, 0x62, 0x91, 0x95, 0xE4, 0x79,
+ 0xE7, 0xC8, 0x37, 0x6D, 0x8D, 0xD5, 0x4E, 0xA9,
+ 0x6C, 0x56, 0xF4, 0xEA, 0x65, 0x7A, 0xAE, 0x08,
+ 0xBA, 0x78, 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6,
+ 0xE8, 0xDD, 0x74, 0x1F, 0x4B, 0xBD, 0x8B, 0x8A,
+ 0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E,
+ 0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E,
+ 0xE1, 0xF8, 0x98, 0x11, 0x69, 0xD9, 0x8E, 0x94,
+ 0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55, 0x28, 0xDF,
+ 0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68,
+ 0x41, 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16
+ };
+
+ public static byte[] Encryption(byte[] randomBytes, byte[] inputBytes) {
+ byte i;
+ int x, y, a, b;
+
+ byte[] outPutBytes = new byte[inputBytes.length];
+
+ x = randomBytes[0] ^ randomBytes[2] ^ randomBytes[6] ^ randomBytes[7] ^ 0x63;
+ y = randomBytes[1] ^ randomBytes[3] ^ randomBytes[4] ^ randomBytes[5];
+
+ for (i = 0; i < inputBytes.length; i++) {
+ try {
+ x = (x + 1) & 0xFF;
+ a = fsb[x];
+ y = (y + a) & 0xFF;
+ b = fsb[y];
+ int ab = ((a + b) & 0xFF);
+ int ff = inputBytes[i] ^ fsb[ab];
+ outPutBytes[i] = (byte) ff;
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }
+ }
+ return outPutBytes;
+ }
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Utils/HDLUtlis/HDLUtlis.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Utils/HDLUtlis/HDLUtlis.java
index 8bd411c..135fb82 100644
--- a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Utils/HDLUtlis/HDLUtlis.java
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Utils/HDLUtlis/HDLUtlis.java
@@ -89,4 +89,53 @@
}
return progress;
}
+
+
+ /**
+ * 4 byte 杞崲涓篺loat绫诲瀷
+ *
+ * @param b1
+ * @param b2
+ * @param b3
+ * @param b4
+ * @return
+ */
+ public static float byteToFloat(byte b1, byte b2, byte b3, byte b4) {
+ byte[] mByte = new byte[4];
+ mByte[0] = b1;
+ mByte[1] = b2;
+ mByte[2] = b3;
+ mByte[3] = b4;
+ return byteArrayToFloat(mByte);
+ }
+
+
+ /**
+ * byte[4]鏁扮粍 杞崲涓篺loat绫诲瀷
+ *
+ * @param arr 闀垮害涓�4
+ * @return
+ */
+ public static float byteArrayToFloat(byte[] arr) {
+ try {
+ return Float.intBitsToFloat(getInt(arr));
+ } catch (Exception e) {
+ e.printStackTrace();
+ return 0;
+ }
+ }
+
+
+ /**
+ * 杩炵画4涓瓧鑺傝幏寰椾竴涓猧nt
+ *
+ * @param arr
+ * @return int
+ */
+ public static int getInt(byte[] arr) {
+ return (0xff000000 & (arr[0] << 24)) |
+ (0x00ff0000 & (arr[1] << 16)) |
+ (0x0000ff00 & (arr[2] << 8)) |
+ (0x000000ff & arr[3]);
+ }
}
diff --git a/app/build.gradle b/app/build.gradle
index 24ce481..150ddbf 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -54,13 +54,14 @@
implementation 'org.greenrobot:eventbus:3.0.0'
implementation 'pub.devrel:easypermissions:2.0.1'
implementation 'com.afollestad.material-dialogs:commons:0.9.6.0'
+ api 'com.google.code.gson:gson:2.8.8'
// implementation 'com.afollestad.material-dialogs'
// implementation 'com.afollestad.material-dialogs:core:3.0.2'
// implementation 'com.jakewharton:butterknife:9.0.0'
// annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0'
-// api 'com.google.code.gson:gson:2.8.5'
+
// implementation project(':gson')
}
diff --git a/app/libs/HDL_TTLSDK-release.aar b/app/libs/HDL_TTLSDK-release.aar
deleted file mode 100644
index 6953587..0000000
--- a/app/libs/HDL_TTLSDK-release.aar
+++ /dev/null
Binary files differ
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 9075512..f06eedd 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -42,7 +42,13 @@
<activity android:name=".activity.CtrlLogicActivity" />
<activity android:name=".activity.CtrlAirActivity" />
<activity android:name=".activity.CtrlLightActivity" />
+ <activity android:name=".activity.CtrlColourLightActivity" />
<activity android:name=".activity.CtrlAirHVACActivity" />
+ <activity android:name=".activity.CtrlAirTechSysActivity" />
+ <activity android:name=".activity.FreshAirActivity" />
+ <activity android:name=".activity.FreshAirJinMaoActivity" />
+ <activity android:name=".activity.GeothermalActivity" />
+ <activity android:name=".activity.DoorMachineActivity" />
<receiver android:name=".activity.BootComplete">
<intent-filter>
diff --git a/app/src/main/java/com/hdl/sdk/ttl_sdk/HDLApplication.java b/app/src/main/java/com/hdl/sdk/ttl_sdk/HDLApplication.java
index ad18296..495b756 100644
--- a/app/src/main/java/com/hdl/sdk/ttl_sdk/HDLApplication.java
+++ b/app/src/main/java/com/hdl/sdk/ttl_sdk/HDLApplication.java
@@ -9,7 +9,7 @@
*/
public class HDLApplication extends Application {
- public static final String HDL_UART_PATH = "/dev/ttyS2"; //涓插彛璁惧璺緞鍚�
+ public static final String HDL_UART_PATH = "/dev/ttyS1"; //涓插彛璁惧璺緞鍚�
public static final int HDL_BAUDRATE = 115200; //娉㈢壒鐜�
@Override
diff --git a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/AppliancesListActivity.java b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/AppliancesListActivity.java
index 538e49b..a955401 100644
--- a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/AppliancesListActivity.java
+++ b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/AppliancesListActivity.java
@@ -32,14 +32,16 @@
public class AppliancesListActivity extends BaseActivity {
private RecyclerView mRecyclerView;
-// private List<String> listString = new ArrayList<>();
+ // private List<String> listString = new ArrayList<>();
private List<AppliancesInfo> appliancesInfos = new ArrayList<>();
private String remarkStr;
private HDLAppliancesListAdapter mAppliancesAdapter;
- /**Topbar*/
+ /**
+ * Topbar
+ */
private RelativeLayout topBarBack;
private TextView topBarTitle;
@@ -50,7 +52,7 @@
initToolbar();
appliancesInfos = (List<AppliancesInfo>) getIntent().getSerializableExtra("Appliances");
initRecyclerView();
- topBarTitle.setText(appliancesInfos.get(0).getDeviceName());
+ topBarTitle.setText(appliancesInfos.get(0).getParentRemarks());
}
/**
@@ -129,7 +131,11 @@
switch (mBigType) {
case Configuration.LIGTH_BIG_TYPE:
//鐏厜妯″潡
- intent.setClass(AppliancesListActivity.this, CtrlLightActivity.class);
+ if (appliancesInfos.get(position).getDeviceType() == HDLApConfig.TYPE_LIGHT_CCT || appliancesInfos.get(position).getDeviceType() == HDLApConfig.TYPE_LIGHT_RGB || appliancesInfos.get(position).getDeviceType() == HDLApConfig.TYPE_LIGHT_DALI || appliancesInfos.get(position).getDeviceType() == HDLApConfig.TYPE_LIGHT_DMX) {
+ intent.setClass(AppliancesListActivity.this, CtrlColourLightActivity.class);
+ } else {
+ intent.setClass(AppliancesListActivity.this, CtrlLightActivity.class);
+ }
break;
case Configuration.CURTAIN_BIG_TYPE:
//绐楀笜妯″潡
@@ -137,9 +143,11 @@
break;
case Configuration.AIR_BIG_TYPE:
//绌鸿皟妯″潡
- if(appliancesInfos.get(position).getDeviceType() == HDLApConfig.TYPE_AC_HVAC){
+ if (appliancesInfos.get(position).getDeviceType() == HDLApConfig.TYPE_AC_HVAC) {
intent.setClass(AppliancesListActivity.this, CtrlAirHVACActivity.class);
- }else {
+ } else if (appliancesInfos.get(position).getDeviceType() == HDLApConfig.TYPE_AC_TECHSYS) {
+ intent.setClass(AppliancesListActivity.this, CtrlAirTechSysActivity.class);
+ } else {
intent.setClass(AppliancesListActivity.this, CtrlAirActivity.class);
}
break;
@@ -163,9 +171,24 @@
//澶х被鏄�氱敤寮�鍏冲垯璺宠浆鍒癈trlCommonSwitchActivity
intent.setClass(AppliancesListActivity.this, CtrlCommonSwitchActivity.class);
break;
+ case Configuration.FRESH_AIR_BIG_TYPE://2020-07-20 鏂板鏂伴
+ //鏂伴妯″潡
+ if (appliancesInfos.get(position).getDeviceType() == HDLApConfig.TYPE_FRESH_AIR_JINMAO) {
+ //閲戣寕瀹氬埗鏂伴璁惧
+ intent.setClass(AppliancesListActivity.this, FreshAirJinMaoActivity.class);
+ } else {
+ intent.setClass(AppliancesListActivity.this, FreshAirActivity.class);
+ }
+ break;
+ case Configuration.GEOTHERMAL_BIG_TYPE://2020-07-20 鏂板鍦扮儹
+ //澶х被鏄湴鐑垯璺宠浆鍒癎eothermalActivity
+ intent.setClass(AppliancesListActivity.this, GeothermalActivity.class);
+ break;
+ case Configuration.DOOR_MACHINE_BIG_TYPE://2023-08-22 鏂板闂ㄩ攣
+ intent.setClass(AppliancesListActivity.this, DoorMachineActivity.class);
+ break;
default:
intent.setClass(AppliancesListActivity.this, CtrlActivity.class);
-
break;
}
diff --git a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlActivity.java b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlActivity.java
index 134416a..3e2a09d 100644
--- a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlActivity.java
+++ b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlActivity.java
@@ -34,7 +34,7 @@
private RelativeLayout topBarBack;
private TextView topBarTitle;
private Button lightBtn, curtainBtn, curtainBtn2, curtainBtn3, curtainBtn4, curtainBtn5,
- logicBtn, airBtnSwitch, airBtnMode, airBtnTemp, airBtnSpeed, sensorBtn;
+ logicBtn, airBtnSwitch, airBtnMode, airBtnTemp, airBtnSpeed;
private TextView lightText, curText1, curText2, airText, logicText, sensorText;
private EditText airTempEd;
private LinearLayout airDisplay;
@@ -95,7 +95,6 @@
curtainBtn4 = findViewById(R.id.curtainbtn4);
curtainBtn5 = findViewById(R.id.curtainbtn5);
logicBtn = findViewById(R.id.logicbtn);
- sensorBtn = findViewById(R.id.sensorbtn);
airDisplay = findViewById(R.id.air);
airBtnSwitch = findViewById(R.id.airbtn_switch);
@@ -143,7 +142,6 @@
airText.setVisibility(View.GONE);
logicText.setVisibility(View.GONE);
- sensorBtn.setVisibility(View.GONE);
sensorText.setVisibility(View.GONE);
@@ -174,7 +172,6 @@
lightText.setVisibility(View.GONE);
airText.setVisibility(View.GONE);
logicText.setVisibility(View.GONE);
- sensorBtn.setVisibility(View.GONE);
sensorText.setVisibility(View.GONE);
if (appliancesInfo.getDeviceType() == HDLApConfig.TYPE_CURTAIN_MODULE) {
//绐楀笜妯″潡
@@ -229,6 +226,7 @@
break;
case HDLApConfig.TYPE_AC_HVAC:
case HDLApConfig.TYPE_AC_PANEL:
+ case HDLApConfig.TYPE_AC_TECHSYS:
lightBtn.setVisibility(View.GONE);
curtainBtn.setVisibility(View.GONE);
curtainBtn2.setVisibility(View.GONE);
@@ -241,7 +239,6 @@
curText2.setVisibility(View.GONE);
lightText.setVisibility(View.GONE);
logicText.setVisibility(View.GONE);
- sensorBtn.setVisibility(View.GONE);
sensorText.setVisibility(View.GONE);
@@ -389,7 +386,6 @@
curText1.setVisibility(View.GONE);
curText2.setVisibility(View.GONE);
lightText.setVisibility(View.GONE);
- sensorBtn.setVisibility(View.GONE);
sensorText.setVisibility(View.GONE);
break;
@@ -436,7 +432,7 @@
logicText.setVisibility(View.GONE);
if (appliancesInfo.getCurState() != null) {
float value = (float) appliancesInfo.getCurState();
- sensorBtn.setText("浼犳劅鍣ㄦ暟鍊硷細" + value);
+ sensorText.setText("浼犳劅鍣ㄦ暟鍊硷細" + value);
}
break;
@@ -515,7 +511,12 @@
appliancesInfo.setArrCurState(deviceStateBean.getArrCurState());
}
break;
-
+ case HDLApConfig.TYPE_AC_TECHSYS:
+ //鍒ゆ柇鏄摢涓洖璺殑璁惧
+ if (deviceStateBean.getChannelNum() == appliancesInfo.getChannelNum()) {
+ appliancesInfo.setArrCurState(deviceStateBean.getArrCurState());
+ }
+ break;
default:
break;
@@ -700,13 +701,6 @@
@Override
public void onClick(View view) {
HDLCommand.logicCtrl(appliancesInfo);
- }
- });
-
- sensorBtn.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- HDLCommand.getDeviceStateFromLocal(appliancesInfo);
}
});
}
@@ -1026,6 +1020,7 @@
break;
case HDLApConfig.TYPE_AC_HVAC:
case HDLApConfig.TYPE_AC_PANEL:
+ case HDLApConfig.TYPE_AC_TECHSYS:
if (appliancesInfo.getChannelNum() == event.getAppliancesInfo().getChannelNum()) {
if (!event.isSuccess()) {
showToast("鑾峰彇绌鸿皟鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
diff --git a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlAirActivity.java b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlAirActivity.java
index 9dbe52d..c772c4d 100644
--- a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlAirActivity.java
+++ b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlAirActivity.java
@@ -419,7 +419,6 @@
) {
//杩欎釜杩斿洖鐨勪俊鎭槸褰撳墠鐘舵�佺殑
switch (event.getAppliancesInfo().getDeviceType()) {
-// case HDLApConfig.TYPE_AC_HVAC:
case HDLApConfig.TYPE_AC_PANEL:
if (appliancesInfo.getChannelNum() == event.getAppliancesInfo().getChannelNum()) {
if (!event.isSuccess()) {
@@ -430,130 +429,6 @@
byte[] curState = event.getAppliancesInfo().getArrCurState();
readAirState(curState);
-// switch (curState[0] & 0xFF) {
-// case AirCtrlParser.airSwich:
-// switch (curState[1] & 0xFF) {
-// case AirCtrlParser.airOff:
-// airSwitchState = 0;
-// airText.setText("绌鸿皟鍏�");
-// showToast("绌鸿皟鍏�");
-// HDLLog.Log("绌鸿皟鍏�");
-// break;
-// case AirCtrlParser.airOn:
-// airSwitchState = 1;
-// airText.setText("绌鸿皟寮�");
-// showToast("绌鸿皟寮�");
-// HDLLog.Log("绌鸿皟寮�");
-// break;
-// default:
-// break;
-// }
-//
-// break;
-//
-// case AirCtrlParser.airSpeed:
-// switch (curState[1] & 0xFF) {
-// case AirCtrlParser.airSpeedAuto:
-// airSpeedState = 0;
-// airText.setText("绌鸿皟椋庨�燂紝椋庨�熸ā寮忎负锛歛irSpeedAuto鑷姩椋庨��");
-// showToast("绌鸿皟椋庨�燂紝椋庨�熸ā寮忎负锛歛irSpeedAuto鑷姩椋庨��");
-// HDLLog.Log("绌鸿皟椋庨�燂紝椋庨�熸ā寮忎负锛歛irSpeedAuto鑷姩椋庨��");
-// break;
-// case AirCtrlParser.airSpeedHigh:
-// airSpeedState = 1;
-// airText.setText("绌鸿皟椋庨�燂紝椋庨�熸ā寮忎负锛歛irSpeedHigh椋庨�熼珮");
-// showToast("绌鸿皟椋庨�燂紝椋庨�熸ā寮忎负锛歛irSpeedHigh椋庨�熼珮");
-// HDLLog.Log("绌鸿皟椋庨�燂紝椋庨�熸ā寮忎负锛歛irSpeedHigh椋庨�熼珮");
-// break;
-// case AirCtrlParser.airSpeedMid:
-// airSpeedState = 2;
-// airText.setText("绌鸿皟椋庨�燂紝椋庨�熸ā寮忎负锛歛irSpeedMid椋庨�熶腑");
-// showToast("绌鸿皟椋庨�燂紝椋庨�熸ā寮忎负锛歛irSpeedMid椋庨�熶腑");
-// HDLLog.Log("绌鸿皟椋庨�燂紝椋庨�熸ā寮忎负锛歛irSpeedMid椋庨�熶腑");
-// break;
-// case AirCtrlParser.airSpeedLow:
-// airSpeedState = 3;
-// airText.setText("绌鸿皟椋庨�燂紝椋庨�熸ā寮忎负锛歛irSpeedLow椋庨�熶綆");
-// showToast("绌鸿皟椋庨�燂紝椋庨�熸ā寮忎负锛歛irSpeedLow椋庨�熶綆");
-// HDLLog.Log("绌鸿皟椋庨�燂紝椋庨�熸ā寮忎负锛歛irSpeedLow椋庨�熶綆");
-// break;
-// default:
-// break;
-// }
-// break;
-// case AirCtrlParser.airMode:
-// switch (curState[1] & 0xFF) {
-// case AirCtrlParser.airModeRefTem:
-// airModeState = 0;
-// airText.setText("绌鸿皟妯″紡锛屾ā寮忎负锛氬埗鍐�");
-// showToast("绌鸿皟妯″紡锛屾ā寮忎负锛氬埗鍐�");
-// HDLLog.Log("绌鸿皟妯″紡锛屾ā寮忎负锛氬埗鍐�");
-// break;
-// case AirCtrlParser.airModeHeatTem:
-// airModeState = 1;
-// airText.setText("绌鸿皟妯″紡锛屾ā寮忎负锛氬埗鐑�");
-// showToast("绌鸿皟妯″紡锛屾ā寮忎负锛氬埗鐑�");
-// HDLLog.Log("绌鸿皟妯″紡锛屾ā寮忎负锛氬埗鐑�");
-// break;
-// case AirCtrlParser.airModeVen:
-// airModeState = 2;
-// airText.setText("绌鸿皟妯″紡锛屾ā寮忎负锛氶�氶");
-// showToast("绌鸿皟妯″紡锛屾ā寮忎负锛氶�氶");
-// HDLLog.Log("绌鸿皟妯″紡锛屾ā寮忎负锛氶�氶");
-// break;
-// case AirCtrlParser.airModeAuto:
-// airModeState = 3;
-// airText.setText("绌鸿皟妯″紡锛屾ā寮忎负锛氳嚜鍔�");
-// showToast("绌鸿皟妯″紡锛屾ā寮忎负锛氳嚜鍔�");
-// HDLLog.Log("绌鸿皟妯″紡锛屾ā寮忎负锛氳嚜鍔�");
-// break;
-// case AirCtrlParser.airModeDehum:
-// airModeState = 4;
-// airText.setText("绌鸿皟妯″紡锛屾ā寮忎负锛氭娊婀�");
-// showToast("绌鸿皟妯″紡锛屾ā寮忎负锛氭娊婀�");
-// HDLLog.Log("绌鸿皟妯″紡锛屾ā寮忎负锛氭娊婀�");
-// break;
-// default:
-// break;
-// }
-// break;
-// case AirCtrlParser.refTem:
-// airTempState = curState[1] & 0xFF;
-// airText.setText("绌鸿皟鍒跺喎锛屾俯搴︿负锛�" + (curState[1] & 0xFF));
-// showToast("绌鸿皟鍒跺喎锛屾俯搴︿负锛�" + (curState[1] & 0xFF));
-// HDLLog.Log("绌鸿皟鍒跺喎锛屾俯搴︿负锛�" + (curState[1] & 0xFF));
-// break;
-// case AirCtrlParser.heatTem:
-// airTempState = curState[1] & 0xFF;
-// airText.setText("绌鸿皟鍒剁儹锛屽埗鐑俯搴︿负" + (curState[1] & 0xFF));
-// showToast("绌鸿皟鍒剁儹锛屽埗鐑俯搴︿负" + (curState[1] & 0xFF));
-// HDLLog.Log("绌鸿皟鍒剁儹锛屽埗鐑俯搴︿负" + (curState[1] & 0xFF));
-// break;
-// case AirCtrlParser.autoTem:
-// airTempState = curState[1] & 0xFF;
-// airText.setText("绌鸿皟鑷姩锛岃嚜鍔ㄦ俯搴︿负" + (curState[1] & 0xFF));
-// showToast("绌鸿皟鑷姩锛岃嚜鍔ㄦ俯搴︿负" + (curState[1] & 0xFF));
-// HDLLog.Log("绌鸿皟鑷姩锛岃嚜鍔ㄦ俯搴︿负" + (curState[1] & 0xFF));
-// break;
-// case AirCtrlParser.dehumTem:
-// airTempState = curState[1] & 0xFF;
-// airText.setText("绌鸿皟鎶芥箍锛屾娊婀挎俯搴︿负" + (curState[1] & 0xFF));
-// showToast("绌鸿皟鎶芥箍锛屾娊婀挎俯搴︿负" + (curState[1] & 0xFF));
-// HDLLog.Log("绌鸿皟鎶芥箍锛屾娊婀挎俯搴︿负" + (curState[1] & 0xFF));
-// break;
-// case AirCtrlParser.upTem:
-// airTempState = curState[1] & 0xFF;
-// airText.setText("绌鸿皟璋冩俯锛屼笂鍗囨俯搴︼細" + (curState[1] & 0xFF));
-// showToast("绌鸿皟璋冩俯锛屼笂鍗囨俯搴︼細" + (curState[1] & 0xFF));
-// HDLLog.Log("绌鸿皟璋冩俯锛屼笂鍗囨俯搴︼細" + (curState[1] & 0xFF));
-// break;
-// case AirCtrlParser.downTem:
-// airTempState = curState[1] & 0xFF;
-// airText.setText("绌鸿皟璋冩俯锛屼笅闄嶆俯搴︼細" + (curState[1] & 0xFF));
-// showToast("绌鸿皟璋冩俯锛屼笅闄嶆俯搴︼細" + (curState[1] & 0xFF));
-// HDLLog.Log("绌鸿皟璋冩俯锛屼笅闄嶆俯搴︼細" + (curState[1] & 0xFF));
-// break;
-// }
}
break;
default:
@@ -687,7 +562,7 @@
airTempState = curState[1] & 0xFF;
tv_tempet.setText("" + airTempState);
- mes = "绌鸿皟鍒跺喎锛屾俯搴︿负锛�" + (airTempState);
+ mes = "绌鸿皟鍒跺喎锛屽埗鍐锋俯搴︿负锛�" + (airTempState);
tv_mesSetText(mes);
HDLLog.Log(mes);
diff --git a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlAirHVACActivity.java b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlAirHVACActivity.java
index 046f9be..583308b 100644
--- a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlAirHVACActivity.java
+++ b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlAirHVACActivity.java
@@ -248,6 +248,7 @@
stringState += "\n" + getModeStateString(mAirHVACBackInfo.getAirMode());//妯″紡
stringState += "\n" + getSpeedStateString(mAirHVACBackInfo.getAirSpeed());//椋庨��
+ stringState += "\n瀹ゅ唴娓╁害锛�" + mAirHVACBackInfo.getIndoorTemp();
stringState += "\n鍒跺喎妯″紡娓╁害锛�" + mAirHVACBackInfo.getRefTemp();
stringState += "\n鍒剁儹妯″紡娓╁害锛�" + mAirHVACBackInfo.getHeatTemp();
stringState += "\n鑷姩妯″紡娓╁害锛�" + mAirHVACBackInfo.getAutoTemp();
@@ -353,6 +354,7 @@
message = getSwichStateString(mAirHVACBackInfo.getIsOn());
message += "\n" + getModeStateString(mAirHVACBackInfo.getAirMode());//妯″紡
message += "\n" + getSpeedStateString(mAirHVACBackInfo.getAirSpeed());//椋庨��
+ message += "\n瀹ゅ唴娓╁害锛�" + mAirHVACBackInfo.getIndoorTemp();
message += "\n鍒跺喎妯″紡娓╁害锛�" + mAirHVACBackInfo.getRefTemp();
message += "\n鍒剁儹妯″紡娓╁害锛�" + mAirHVACBackInfo.getHeatTemp();
message += "\n鑷姩妯″紡娓╁害锛�" + mAirHVACBackInfo.getAutoTemp();
diff --git a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlAirTechSysActivity.java b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlAirTechSysActivity.java
new file mode 100644
index 0000000..8b045c2
--- /dev/null
+++ b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlAirTechSysActivity.java
@@ -0,0 +1,314 @@
+package com.hdl.sdk.ttl_sdk.activity;
+
+
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import com.hdl.sdk.ttl.HDLAppliances.Config.HDLApConfig;
+import com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition.AirTechSysBackInfo;
+import com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition.Parser.AirCtrlParser;
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
+import com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLCommand;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.AirTechSysFeedBackEvent;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DeviceStateEvent;
+import com.hdl.sdk.ttl_sdk.R;
+import com.hdl.sdk.ttl_sdk.base.BaseActivity;
+import com.hdl.sdk.ttl_sdk.utlis.HDLLog;
+
+import org.greenrobot.eventbus.Subscribe;
+import org.greenrobot.eventbus.ThreadMode;
+
+
+/**
+ * Created by panlili on 2023/8/21
+ * 绌鸿皟绫绘ā鍧楁帶鍒堕〉闈�
+ * 绉戞妧绯荤粺 绫诲瀷绌鸿皟妯″潡
+ * 16~30鎽勬皬搴�(鈩�)
+ */
+public class CtrlAirTechSysActivity extends BaseActivity {
+ /**
+ * Topbar
+ */
+ private RelativeLayout topBarBack;
+ private TextView topBarTitle;
+
+ private Button airBtnMode, airBtnTemp;
+ private TextView airText;
+ private EditText airTempEd;
+ private AppliancesInfo appliancesInfo;
+
+
+ private int airSwitchState;//Demo浠呬互姝や綔涓烘紨绀猴紝瀹為檯璇锋牴鎹渶姹傚紑鍙戣璁�
+ private int airModeState;
+ private int airTempState;
+
+ /**
+ * 澶嶅啓isRegisterEventBus() 瑕佹敞鍐屼娇鐢‥ventBus锛岃繖閲岃璁剧疆杩斿洖true
+ *
+ * @return true
+ */
+ @Override
+ protected boolean isRegisterEventBus() {
+ return true;
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_ctrl_technology_system);
+ initToolbar();
+ initView();
+ initOnClick();
+ initcurState();
+ showStateView();
+
+ HDLCommand.getTechSysDeviceStateFromNetwork(appliancesInfo);
+ }
+
+ /**
+ * 鍒濆鍖朤oolbar
+ */
+ private void initToolbar() {
+ topBarBack = findViewById(R.id.ll_top_b_left);
+ setViewVisible(topBarBack);
+ topBarTitle = findViewById(R.id.tv_top_b_header_title);
+ topBarBack.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ finish();
+ }
+ });
+ }
+
+ private void initcurState() {
+ appliancesInfo = (AppliancesInfo) getIntent().getSerializableExtra("hdl");
+ String titleStr = appliancesInfo.getRemarks();
+ topBarTitle.setText(titleStr);
+ }
+
+ private void initView() {
+ airBtnMode = findViewById(R.id.airbtn_mode);
+ airBtnTemp = findViewById(R.id.airbtn_tempBtn);
+ airTempEd = findViewById(R.id.airet_tempet);
+ airText = findViewById(R.id.airText);
+ }
+
+ private void initOnClick() {
+ //绉戞妧绯荤粺涓嶆敮鎸佸紑鍏�
+ /*airBtnSwitch.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ //婕旂ず褰撳墠鐘舵�佷负鍏筹紝璁剧疆涓哄紑銆傚紑锛岃缃负鍏炽��
+ if (airSwitchState == 0) {
+ HDLCommand.airCtrl(appliancesInfo, AirCtrlParser.airSwich, AirCtrlParser.airOn);//绌鸿皟寮�
+ } else {
+ HDLCommand.airCtrl(appliancesInfo, AirCtrlParser.airSwich, AirCtrlParser.airOff);//绌鸿皟鍏�
+ }
+ }
+ });*/
+
+ airBtnMode.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ switch (airModeState) {
+ case 0:
+ //鑻ュ綋鍓嶇┖璋冩ā寮忎负鍒跺喎锛屽垯鐐瑰嚮鎸夐挳璁剧疆涓哄埗鐑�
+ HDLCommand.airCtrl(appliancesInfo, AirCtrlParser.airMode, AirCtrlParser.airModeHeatTem);//绌鸿皟妯″紡鍒剁儹
+ break;
+ case 1:
+ //鑻ュ綋鍓嶇┖璋冩ā寮忎负鍒剁儹锛屽垯鐐瑰嚮鎸夐挳璁剧疆涓哄埗鍐�
+ HDLCommand.airCtrl(appliancesInfo, AirCtrlParser.airMode, AirCtrlParser.airModeRefTem);//绌鸿皟妯″紡鍒跺喎
+ break;
+ }
+ }
+ });
+
+ airBtnTemp.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ String tempStr = airTempEd.getText().toString();
+ if (TextUtils.isEmpty(tempStr)) {
+ showToast("璁剧疆鐨勬俯搴︿笉鑳戒负绌�");
+ return;
+ }
+ int tempInt = Integer.parseInt(tempStr);
+
+ if (tempInt < 16 || tempInt > 30) {
+ showToast("娓╁害璁剧疆鑼冨洿涓猴細16~30鎽勬皬搴�(鈩�)");
+ return;
+ }
+
+ switch (airModeState) {
+ case 0:
+ //褰撳墠绌鸿皟妯″紡涓哄埗鍐�
+ HDLCommand.airCtrl(appliancesInfo, AirCtrlParser.refTem, tempInt);//鍒跺喎娓╁害
+ break;
+ case 1:
+ //褰撳墠绌鸿皟妯″紡涓哄埗鐑�
+ HDLCommand.airCtrl(appliancesInfo, AirCtrlParser.heatTem, tempInt);//鍒剁儹娓╁害
+ break;
+ }
+ }
+ });
+ }
+
+
+ private void showStateView() {
+ if (appliancesInfo.getArrCurState() != null) {
+ AirTechSysBackInfo mAirTechSysBackInfo = new AirTechSysBackInfo(appliancesInfo);
+ String stringState = "";
+ if (mAirTechSysBackInfo.getIsOn() == AirCtrlParser.airOff) {
+ stringState = "绉戞妧绯荤粺妯″潡锛氬叧闂�";
+ } else if (mAirTechSysBackInfo.getIsOn() == AirCtrlParser.airOn) {
+ stringState = "绉戞妧绯荤粺妯″潡锛氭墦寮�";
+
+ stringState += "\n" + getModeStateString(mAirTechSysBackInfo.getAirMode());//妯″紡
+ stringState += "\n瀹ゅ唴娓╁害锛�" + mAirTechSysBackInfo.getIndoorTemp();
+
+ if (AirCtrlParser.airModeRefTem == mAirTechSysBackInfo.getAirMode()) {
+ stringState += "\n鍒跺喎妯″紡娓╁害锛�" + mAirTechSysBackInfo.getRefTemp();
+ } else if (AirCtrlParser.airModeHeatTem == mAirTechSysBackInfo.getAirMode()) {
+ stringState += "\n鍒剁儹妯″紡娓╁害锛�" + mAirTechSysBackInfo.getHeatTemp();
+ }
+
+ } else {
+ stringState = "鏈煡寮�鍏崇姸鎬�";
+ }
+ airText.setText(stringState);
+ } else {
+ airText.setText("鏈幏鍙栧埌绉戞妧绯荤粺妯″潡鐘舵��");
+ }
+ }
+
+
+ /**
+ * getModeStateString
+ *
+ * @param mState
+ * @return
+ */
+ private String getModeStateString(int mState) {
+ String mStrState = "鏈煡";
+ airModeState = mState; //鏇存柊妯″紡鐘舵��
+ switch (mState) {
+ case AirCtrlParser.airModeRefTem:
+ mStrState = "妯″紡锛氬埗鍐�";
+ break;
+ case AirCtrlParser.airModeHeatTem:
+ mStrState = "妯″紡锛氬埗鐑�";
+ break;
+ default:
+ mStrState = "鏈煡妯″紡鐘舵��";
+ break;
+ }
+ return mStrState;
+ }
+
+
+ /**
+ * getSwichStateString
+ *
+ * @param mState
+ * @return
+ */
+ private String getSwichStateString(int mState) {
+ String mStrState = "鏈煡";
+ airSwitchState = mState; //鏇存柊寮�鍏崇姸鎬�
+ switch (mState) {
+ case AirCtrlParser.airOn:
+ mStrState = "绉戞妧绯荤粺妯″潡锛氭墦寮�";
+ break;
+ case AirCtrlParser.airOff:
+ mStrState = "绉戞妧绯荤粺妯″潡锛氬叧闂�";
+ break;
+ default:
+ mStrState = "鏈煡鐘舵��";
+ break;
+ }
+ return mStrState;
+ }
+
+
+ private void showAirTechSysBackInfo(AirTechSysBackInfo mAirTechSysBackInfo) {
+ String message = "";
+ if (mAirTechSysBackInfo.getIsOn() == AirCtrlParser.airOn) {
+ message = getSwichStateString(mAirTechSysBackInfo.getIsOn());
+ message += "\n" + getModeStateString(mAirTechSysBackInfo.getAirMode());//妯″紡
+ message += "\n瀹ゅ唴娓╁害锛�" + mAirTechSysBackInfo.getIndoorTemp();
+
+ if (AirCtrlParser.airModeRefTem == mAirTechSysBackInfo.getAirMode()) {
+ message += "\n鍒跺喎妯″紡娓╁害锛�" + mAirTechSysBackInfo.getRefTemp();
+ } else if (AirCtrlParser.airModeHeatTem == mAirTechSysBackInfo.getAirMode()) {
+ message += "\n鍒剁儹妯″紡娓╁害锛�" + mAirTechSysBackInfo.getHeatTemp();
+ }
+
+ } else {
+ message = getSwichStateString(mAirTechSysBackInfo.getIsOn());
+ }
+ airText.setText(message);
+ showToast(message);
+ HDLLog.Log(message);
+ }
+
+ /**
+ * 绉戞妧绯荤粺妯″潡鎺у埗鍥炶皟Event
+ *
+ * @param event
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onAirTechSysFeedBackEventMain(AirTechSysFeedBackEvent event) {
+ if (event.getAirTechSysBackInfo().getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
+ && event.getAirTechSysBackInfo().getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
+ && event.getAirTechSysBackInfo().getAppliancesInfo().getChannelNum() == appliancesInfo.getChannelNum()
+ ) {
+ // 鍏堝垽鏂槸鍚﹁秴鏃�
+ if (!event.isSuccess()) {
+ showToast("绉戞妧绯荤粺鎺у埗瓒呮椂锛岃閲嶆柊鍐嶈瘯");
+ return;
+ }
+ AirTechSysBackInfo mAirTechSysBackInfo = event.getAirTechSysBackInfo();
+ showAirTechSysBackInfo(mAirTechSysBackInfo);
+ }
+ }
+
+ /**
+ * 鑾峰彇鍗曚竴璁惧鐘舵�佸洖璋僂vent
+ *
+ * @param event
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onDeviceStateEventMain(DeviceStateEvent event) {
+ if (event.getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
+ && event.getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
+ ) {
+ //杩欎釜杩斿洖鐨勪俊鎭槸褰撳墠鐘舵�佺殑
+ switch (event.getAppliancesInfo().getDeviceType()) {
+ case HDLApConfig.TYPE_AC_TECHSYS:
+ if (appliancesInfo.getChannelNum() == event.getAppliancesInfo().getChannelNum()) {
+ if (!event.isSuccess()) {
+ showToast("鑾峰彇绉戞妧绯荤粺鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
+ return;
+ }
+ AirTechSysBackInfo mAirTechSysBackInfo = new AirTechSysBackInfo(event.getAppliancesInfo());
+ if (mAirTechSysBackInfo == null) {
+ showToast("鑾峰彇绉戞妧鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
+ return;
+ }
+ showAirTechSysBackInfo(mAirTechSysBackInfo);
+ }
+ break;
+ default:
+ //涓嶅鐞�
+ break;
+ }
+ }
+ }
+
+
+}
diff --git a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlColourLightActivity.java b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlColourLightActivity.java
new file mode 100644
index 0000000..5cff502
--- /dev/null
+++ b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlColourLightActivity.java
@@ -0,0 +1,321 @@
+package com.hdl.sdk.ttl_sdk.activity;
+
+
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import com.hdl.sdk.ttl.HDLAppliances.Config.HDLApConfig;
+import com.hdl.sdk.ttl.HDLAppliances.HDLDoorMachine.DoorMachineBackInfo;
+import com.hdl.sdk.ttl.HDLAppliances.HDLDoorMachine.Parser.DoorMachineParser;
+import com.hdl.sdk.ttl.HDLAppliances.HDLLight.ColourLightCtrlBackInfo;
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
+import com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLCommand;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.ColourLightFeedBackEvent;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DeviceStateEvent;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.LightFeedBackEvent;
+import com.hdl.sdk.ttl_sdk.R;
+import com.hdl.sdk.ttl_sdk.base.BaseActivity;
+import com.hdl.sdk.ttl_sdk.utlis.HDLLog;
+import com.hdl.sdk.ttl_sdk.utlis.HDLUtlis;
+import com.hdl.sdk.ttl_sdk.utlis.RGBColorPicker;
+
+import org.greenrobot.eventbus.Subscribe;
+import org.greenrobot.eventbus.ThreadMode;
+
+/**
+ * Created by panlili on 2023/8/22
+ * CCT鑹叉俯鐏紝RGB鐏帶鍒堕〉闈�
+ */
+public class CtrlColourLightActivity extends BaseActivity {
+ /**
+ * Topbar
+ */
+ private RelativeLayout topBarBack;
+ private TextView topBarTitle;
+ private Button lightBtn, brightnessBtn, cctBtn;
+ private EditText brightnessEt, cctEt;
+ private TextView lightText,rgbText;
+ private RGBColorPicker rgbColorPicker;
+ private AppliancesInfo appliancesInfo;
+ private int lightState;
+ private ColourLightCtrlBackInfo colourLightCtrlBackInfo;
+
+ /**
+ * 澶嶅啓isRegisterEventBus() 瑕佹敞鍐屼娇鐢‥ventBus锛岃繖閲岃璁剧疆杩斿洖true
+ *
+ * @return true
+ */
+ @Override
+ protected boolean isRegisterEventBus() {
+ return true;
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_ctrl_colour_light);
+ initToolbar();
+ initView();
+ initOnClick();
+ initcurState();
+ displayStateView();
+
+ //浠庣綉缁滀笂鏌ヨ鍒锋柊涓�娆¤澶囩姸鎬侊紝寰呰皟璇�
+ HDLCommand.getColourLightDeviceStateFromNetwork(appliancesInfo);
+ }
+
+ /**
+ * 鍒濆鍖朤oolbar
+ */
+ private void initToolbar() {
+ topBarBack = findViewById(R.id.ll_top_b_left);
+ setViewVisible(topBarBack);
+ topBarTitle = findViewById(R.id.tv_top_b_header_title);
+ topBarBack.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ finish();
+ }
+ });
+ }
+
+ private void initcurState() {
+ appliancesInfo = (AppliancesInfo) getIntent().getSerializableExtra("hdl");
+ String titleStr = appliancesInfo.getRemarks();
+ topBarTitle.setText(titleStr);
+ }
+
+ private void initView() {
+ lightBtn = findViewById(R.id.ctrlbtn);
+ lightText = findViewById(R.id.lightText);
+ brightnessBtn = findViewById(R.id.ctrl_brightness);
+ brightnessEt = findViewById(R.id.et_brightness);
+ cctBtn = findViewById(R.id.ctrl_cct);
+ cctEt = findViewById(R.id.et_cct);
+ rgbText = findViewById(R.id.ctrl_rgb);
+ rgbColorPicker = findViewById(R.id.rgb_bar);
+
+ }
+
+ private void initOnClick() {
+
+ lightBtn.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ //閫氳繃浜害鏉ユ帶鍒剁伅鐨勫紑鍏筹紝0涓哄叧锛�100涓哄紑
+ if (colourLightCtrlBackInfo.getType() == ColourLightCtrlBackInfo.CONTROL_TYPE_CCT) {
+ HDLCommand.colourLightCtrl(appliancesInfo, lightState, colourLightCtrlBackInfo.getColorTemp());
+ } else if (colourLightCtrlBackInfo.getType() == ColourLightCtrlBackInfo.CONTROL_TYPE_RGB) {
+ HDLCommand.colourLightCtrl(appliancesInfo, lightState, colourLightCtrlBackInfo.getColor());
+ }
+ HDLLog.Log("lightBtn: 寮�鍏崇伅" + lightState);
+ }
+ });
+ brightnessBtn.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ String brightnessStr = brightnessEt.getText().toString();
+ if (TextUtils.isEmpty(brightnessStr)) {
+ showToast("璁剧疆鐨勪寒搴︿笉鑳戒负绌�");
+ return;
+ }
+ if (colourLightCtrlBackInfo.getType() == ColourLightCtrlBackInfo.CONTROL_TYPE_CCT) {
+ HDLCommand.colourLightCtrl(appliancesInfo, Integer.parseInt(brightnessStr), colourLightCtrlBackInfo.getColorTemp());
+ HDLLog.Log("brightnessBtn: 璁剧疆浜害=" + brightnessStr + " getColorTemp=" + colourLightCtrlBackInfo.getColorTemp());
+ } else if (colourLightCtrlBackInfo.getType() == ColourLightCtrlBackInfo.CONTROL_TYPE_RGB) {
+ HDLCommand.colourLightCtrl(appliancesInfo, Integer.parseInt(brightnessStr), colourLightCtrlBackInfo.getColor());
+ HDLLog.Log("brightnessBtn: 璁剧疆浜害=" + brightnessStr + " getColorTemp=" + colourLightCtrlBackInfo.getColor());
+ }
+
+ }
+ });
+ cctBtn.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ String cctStr = cctEt.getText().toString();
+ if (TextUtils.isEmpty(cctStr)) {
+ showToast("璁剧疆鐨勮壊娓╀笉鑳戒负绌�");
+ return;
+ }
+ if (colourLightCtrlBackInfo.getType() == ColourLightCtrlBackInfo.CONTROL_TYPE_CCT) {
+ HDLCommand.colourLightCtrl(appliancesInfo, colourLightCtrlBackInfo.getBrightness(), Integer.parseInt(cctStr));
+ }
+ HDLLog.Log("cctBtn: 璁剧疆鑹叉俯=" + cctStr + " getBrightness=" + colourLightCtrlBackInfo.getBrightness());
+ }
+ });
+
+ rgbColorPicker.setColorListener(new RGBColorPicker.DelayColorListener() {
+ @Override
+ public void onDelayColorChanged(int color, boolean fromUser) {
+ if (colourLightCtrlBackInfo.getType() == ColourLightCtrlBackInfo.CONTROL_TYPE_RGB) {
+ HDLCommand.colourLightCtrl(appliancesInfo, colourLightCtrlBackInfo.getBrightness(), color);
+ }
+ HDLLog.Log("rgbBtn: 璁剧疆RGB=" + color + " getBrightness=" + colourLightCtrlBackInfo.getBrightness());
+ }
+
+ @Override
+ public void onColorChange(int color, boolean fromUser) {
+ super.onColorChange(color, fromUser);
+ }
+ });
+ }
+
+ private void displayStateView() {
+ switch (appliancesInfo.getDeviceType()) {
+ case HDLApConfig.TYPE_LIGHT_CCT:
+ case HDLApConfig.TYPE_LIGHT_RGB:
+ case HDLApConfig.TYPE_LIGHT_DALI:
+ case HDLApConfig.TYPE_LIGHT_DMX:
+ if (appliancesInfo.getCurState() != null) {
+ ColourLightCtrlBackInfo colourLightCtrlBackInfo = new ColourLightCtrlBackInfo(appliancesInfo);
+ String stringState = getSwichStateString(colourLightCtrlBackInfo.getBrightness());
+ stringState += "\n褰撳墠浜害锛�" + colourLightCtrlBackInfo.getBrightness();
+
+ if (colourLightCtrlBackInfo.getType() == ColourLightCtrlBackInfo.CONTROL_TYPE_CCT) {
+ stringState += "\n鑹叉俯锛�" + colourLightCtrlBackInfo.getColorTemp();
+ } else if (colourLightCtrlBackInfo.getType() == ColourLightCtrlBackInfo.CONTROL_TYPE_RGB) {
+ stringState += "\nRGB锛�" + colourLightCtrlBackInfo.getColor();
+ }
+ lightText.setText(stringState);
+
+ if (colourLightCtrlBackInfo.getBrightness() == 0) {
+ lightState = 100;
+ lightBtn.setText("寮�鐏�");
+ } else {
+ lightState = 0;
+ lightBtn.setText("鍏崇伅");
+ }
+ } else {
+ lightText.setText("鏈幏鍙栧埌鐏厜鐘舵��");
+ lightBtn.setText("鏈幏鍙栧埌鐏厜鐘舵��");
+ }
+ break;
+
+ default:
+ finish();//璁惧绫诲瀷涓嶅缁撴潫椤甸潰
+ break;
+ }
+ /**鏍规嵁闇�姹傛槸鍚﹀彂閫佷竴娆¤幏鍙栧埛鏂扮姸鎬佽姹�*/
+ }
+
+ /**
+ * 鐏厜鎺у埗鍥炶皟Event
+ *
+ * @param event
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onColourLightFeedBackEventMain(ColourLightFeedBackEvent event) {
+ if (event.getColourLightCtrlBackInfo().getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
+ && event.getColourLightCtrlBackInfo().getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
+ && event.getColourLightCtrlBackInfo().getAppliancesInfo().getChannelNum() == appliancesInfo.getChannelNum()) {
+ //鍏堝垽鏂槸鍚﹁秴鏃�
+ if (!event.isSuccess()) {
+ showToast("鐏厜鎺у埗瓒呮椂锛岃閲嶆柊鍐嶈瘯");
+ lightBtn.setText("鐏厜鎺у埗瓒呮椂锛岃閲嶆柊鍐嶈瘯");
+ return;
+ }
+ colourLightCtrlBackInfo = event.getColourLightCtrlBackInfo();
+ Log.d("panlili", "CtrlColourLightActivity.java:onColourLightFeedBackEventMain-----> " + colourLightCtrlBackInfo.toString());
+
+ if (colourLightCtrlBackInfo == null) {
+ showToast("鐏厜鎺у埗瓒呮椂锛岃閲嶆柊鍐嶈瘯");
+ return;
+ }
+
+ showColourLightCtrlBackInfo(colourLightCtrlBackInfo);
+ }
+ }
+
+ /**
+ * 鑾峰彇鍗曚竴璁惧鐘舵�佸洖璋僂vent
+ *
+ * @param event
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onDeviceStateEventMain(DeviceStateEvent event) {
+ if (event.getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
+ && event.getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
+ ) {
+ //杩欎釜杩斿洖鐨勪俊鎭槸褰撳墠鐘舵�佺殑
+ switch (event.getAppliancesInfo().getDeviceType()) {
+ case HDLApConfig.TYPE_LIGHT_CCT:
+ case HDLApConfig.TYPE_LIGHT_RGB:
+ case HDLApConfig.TYPE_LIGHT_DALI:
+ case HDLApConfig.TYPE_LIGHT_DMX:
+ if (appliancesInfo.getChannelNum() == event.getAppliancesInfo().getChannelNum()) {
+ if (!event.isSuccess()) {
+ showToast("鑾峰彇鐏厜鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
+ return;
+ }
+ colourLightCtrlBackInfo = new ColourLightCtrlBackInfo(event.getAppliancesInfo());
+ Log.d("panlili", "CtrlColourLightActivity.java:onDeviceStateEventMain-----> " + colourLightCtrlBackInfo.toString());
+
+ if (colourLightCtrlBackInfo == null) {
+ showToast("鑾峰彇鐏厜鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
+ return;
+ }
+
+ showColourLightCtrlBackInfo(colourLightCtrlBackInfo);
+ }
+ break;
+ default:
+ //涓嶅鐞�
+ break;
+ }
+ }
+ }
+
+ /**
+ * showColourLightCtrlBackInfo
+ *
+ * @param colourLightCtrlBackInfo
+ */
+ private void showColourLightCtrlBackInfo(ColourLightCtrlBackInfo colourLightCtrlBackInfo) {
+ String message = "";
+
+ message = getSwichStateString(colourLightCtrlBackInfo.getBrightness());
+ message += "\n" + "褰撳墠浜害锛�" + colourLightCtrlBackInfo.getBrightness();
+ if (colourLightCtrlBackInfo.getType() == ColourLightCtrlBackInfo.CONTROL_TYPE_CCT) {
+ message += "\n鑹叉俯锛�" + colourLightCtrlBackInfo.getColorTemp();
+ } else if (colourLightCtrlBackInfo.getType() == ColourLightCtrlBackInfo.CONTROL_TYPE_RGB) {
+ message += "\nRGB锛�" + colourLightCtrlBackInfo.getColor();
+ }
+
+ lightText.setText(message);
+
+ if (colourLightCtrlBackInfo.getBrightness() == 0) {
+ lightState = 100;
+ lightBtn.setText("寮�鐏�");
+ } else {
+ lightState = 0;
+ lightBtn.setText("鍏崇伅");
+ }
+
+ showToast(message);
+ HDLLog.Log(message);
+ }
+
+
+ /**
+ * getSwichStateString
+ *
+ * @param mState
+ * @return
+ */
+ private String getSwichStateString(int mState) {
+ String mStrState = "鏈煡";
+
+ if (mState == 0) {
+ mStrState = "寮�鍏崇姸鎬侊細鍏抽棴";
+ } else {
+ mStrState = "寮�鍏崇姸鎬侊細鎵撳紑";
+ }
+ return mStrState;
+ }
+}
diff --git a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlCurtainActivity.java b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlCurtainActivity.java
index f5f33a5..648dc8d 100644
--- a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlCurtainActivity.java
+++ b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlCurtainActivity.java
@@ -145,7 +145,7 @@
if (appliancesInfo.getCurState() != null) {
String stringCurtainState = "";
- /**娉ㄦ剰绫诲瀷 curState淇濆瓨鏈湴鍐嶈幏鍙栧悗鍚庡彉锛屾垚Double绫诲瀷浜�*/
+ /**娉ㄦ剰绫诲瀷 curState淇濆瓨鏈湴鍐嶈幏鍙栧悗鍚庡彉鎴怐ouble绫诲瀷浜�*/
int curCurtainState = HDLUtlis.getIntegerByObject(appliancesInfo.getCurState());
HDLLog.Log("curCurtainState = " + curCurtainState);
diff --git a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlLightActivity.java b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlLightActivity.java
index dc273ad..22d41ae 100644
--- a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlLightActivity.java
+++ b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlLightActivity.java
@@ -2,8 +2,10 @@
import android.os.Bundle;
+import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
+import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView;
@@ -25,10 +27,13 @@
* 璋冨厜妯″潡锛岀户鐢靛櫒妯″潡鎺у埗椤甸潰
*/
public class CtrlLightActivity extends BaseActivity {
- /**Topbar*/
+ /**
+ * Topbar
+ */
private RelativeLayout topBarBack;
private TextView topBarTitle;
- private Button lightBtn;
+ private Button lightBtn, brightnessBtn;
+ private EditText brightnessEt;
private TextView lightText;
private AppliancesInfo appliancesInfo;
private int lightState;
@@ -83,6 +88,8 @@
private void initView() {
lightBtn = findViewById(R.id.ctrlbtn);
lightText = findViewById(R.id.lightText);
+ brightnessBtn = findViewById(R.id.ctrl_brightness);
+ brightnessEt = findViewById(R.id.et_brightness);
}
@@ -92,8 +99,19 @@
@Override
public void onClick(View v) {
HDLCommand.lightCtrl(appliancesInfo, lightState);
- HDLLog.Log("lightBtn: 璁剧疆浜害" + lightState);
-// HDLCommand.lightCtrl(appliancesInfo,50);
+ HDLLog.Log("lightBtn: 寮�鍏崇伅" + lightState);
+ }
+ });
+ brightnessBtn.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ String brightnessStr = brightnessEt.getText().toString();
+ if (TextUtils.isEmpty(brightnessStr)) {
+ showToast("璁剧疆鐨勪寒搴︿笉鑳戒负绌�");
+ return;
+ }
+ HDLCommand.lightCtrl(appliancesInfo, Integer.parseInt(brightnessStr));
+ HDLLog.Log("brightnessBtn: 璁剧疆浜害" + brightnessStr);
}
});
}
@@ -105,14 +123,16 @@
case HDLApConfig.TYPE_LIGHT_MIX_DIMMER:
case HDLApConfig.TYPE_LIGHT_MIX_RELAY:
if (appliancesInfo.getCurState() != null) {
- int curLightState = HDLUtlis.getIntegerByObject(appliancesInfo.getCurState());
+ int curLightState = HDLUtlis.getIntegerByObject(appliancesInfo.getCurState());
lightText.setText("褰撳墠鐏厜浜害锛�" + curLightState);
- lightBtn.setText("褰撳墠鐏厜浜害锛�" + curLightState);
- if (curLightState == 100) {
- lightState = 0;
- } else {
+
+ if (curLightState == 0) {
lightState = 100;
+ lightBtn.setText("寮�鐏�");
+ } else {
+ lightState = 0;
+ lightBtn.setText("鍏崇伅");
}
} else {
lightText.setText("鏈幏鍙栧埌鐏厜浜害");
@@ -148,9 +168,16 @@
return;
}
int brightness = event.getLightCtrlBackInfo().getBrightness();
- lightState = brightness == 100 ? 0 : 100;//濡傛灉杩斿洖100閲嶇疆鐘舵�佷负0锛屽弽涔嬮噸缃姸鎬�100
- lightBtn.setText("褰撳墠浜害 = " + brightness);
lightText.setText("褰撳墠浜害 = " + brightness);
+
+ if (brightness == 0) {
+ lightState = 100;
+ lightBtn.setText("寮�鐏�");
+ } else {
+ lightState = 0;
+ lightBtn.setText("鍏崇伅");
+ }
+
/*浠ヤ笅涓虹伅鍏夋帹閫佺ず渚嬩唬鐮侊紝鍙互璇嗗埆鍝釜缁х數鍣紝鍝釜璋冨厜鐏紝鍝釜鍥炶矾锛屼篃鍙敤浣滄帶鍒跺洖棣堛��
鎸夐渶姹傝皟鐢�*/
String remarks = event.getLightCtrlBackInfo().getRemarks();//鑾峰彇杩斿洖鐨勭伅鍏夊娉ㄣ�傚鏋滄瘡涓伅鍏夊洖璺娉ㄩ兘鍞竴锛屽彲浠ョ洿鎺ラ�氳繃澶囨敞鍒ゆ柇
@@ -182,10 +209,16 @@
showToast("鑾峰彇鐏厜鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
return;
}
- int brightness = HDLUtlis.getIntegerByObject(event.getAppliancesInfo().getCurState());
- lightBtn.setText("浜害 = " + brightness);
+ int brightness = HDLUtlis.getIntegerByObject(event.getAppliancesInfo().getCurState());
+ if (brightness == 0) {
+ lightState = 100;
+ lightBtn.setText("寮�鐏�");
+ } else {
+ lightState = 0;
+ lightBtn.setText("鍏崇伅");
+ }
lightText.setText("褰撳墠浜害 = " + brightness);
- showToast("鑾峰彇鐘舵�佽繑鍥烇細浜害 = " + brightness);
+ showToast("鑾峰彇鐘舵�佽繑鍥烇細浜害 = " + brightness);
}
break;
default:
diff --git a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/DoorMachineActivity.java b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/DoorMachineActivity.java
new file mode 100644
index 0000000..29f1a95
--- /dev/null
+++ b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/DoorMachineActivity.java
@@ -0,0 +1,334 @@
+package com.hdl.sdk.ttl_sdk.activity;
+
+
+import android.app.ProgressDialog;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import com.hdl.sdk.ttl.HDLAppliances.Config.HDLApConfig;
+import com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition.Parser.AirCtrlParser;
+import com.hdl.sdk.ttl.HDLAppliances.HDLDoorMachine.DoorMachineBackInfo;
+import com.hdl.sdk.ttl.HDLAppliances.HDLDoorMachine.DoorMachineFristBackInfo;
+import com.hdl.sdk.ttl.HDLAppliances.HDLDoorMachine.DoorMachineWaringBackInfo;
+import com.hdl.sdk.ttl.HDLAppliances.HDLDoorMachine.Parser.DoorMachineParser;
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
+import com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLCommand;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DeviceStateEvent;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DoorMachineFeedBackEvent;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DoorMachineFeedFristBackEvent;
+import com.hdl.sdk.ttl.Utils.LogUtils.HDLLog;
+import com.hdl.sdk.ttl_sdk.R;
+import com.hdl.sdk.ttl_sdk.base.BaseActivity;
+import com.hdl.sdk.ttl_sdk.utlis.HDLUtlis;
+
+import org.greenrobot.eventbus.Subscribe;
+import org.greenrobot.eventbus.ThreadMode;
+
+/**
+ * 闂ㄩ攣鎺у埗鐣岄潰
+ */
+public class DoorMachineActivity extends BaseActivity {
+ /**
+ * Topbar
+ */
+ private RelativeLayout topBarBack;
+ private TextView topBarTitle;
+
+ private Button btn_switch;
+ private EditText et_password;
+ private TextView mTextView;
+ private AppliancesInfo appliancesInfo;
+
+ private int gSwitchState;//Demo浠呬互姝や綔涓烘紨绀猴紝瀹為檯璇锋牴鎹渶姹傚紑鍙戣璁�
+
+ private ProgressDialog proDialog;
+ private byte[] secretBytes = new byte[9];//杩欓噷鏄洖璺彿+8byte瀵嗛挜
+ private DoorMachineBackInfo doorMachineBackInfo;
+
+ /**
+ * 瑕佹敞鍐屼娇鐢‥ventBus锛岃繖閲岃璁剧疆杩斿洖true
+ *
+ * @return true
+ */
+ @Override
+ protected boolean isRegisterEventBus() {
+ return true;
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_door_machine);
+ initToolbar();
+ initcurState();
+ initView();
+ initClickOnEvent();
+ showStateView();
+
+ Log.d("panlili", "DoorMachineActivity.java:appliancesInfo-----> " + appliancesInfo.toString());
+ HDLCommand.getDoorMachineDeviceStateFromNetwork(appliancesInfo);
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ proDialog.dismiss();
+ HDLLog.I("onDestroy: DoorMachineActivity");
+ }
+
+ /**
+ * 鍒濆鍖朤oolbar
+ */
+ private void initToolbar() {
+ topBarBack = findViewById(R.id.ll_top_b_left);
+ setViewVisible(topBarBack);
+ topBarTitle = findViewById(R.id.tv_top_b_header_title);
+ topBarBack.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ finish();
+ }
+ });
+ }
+
+
+ private void initcurState() {
+ appliancesInfo = (AppliancesInfo) getIntent().getSerializableExtra("hdl");
+ String titleStr = appliancesInfo.getRemarks();
+ if (TextUtils.isEmpty(titleStr) || titleStr.equals(HDLUtlis.REMAEK_NULL)) {
+ if (TextUtils.isEmpty(appliancesInfo.getDeviceName())) {
+ titleStr = "澶囨敞涓虹┖";
+ } else {
+ titleStr = appliancesInfo.getDeviceName();
+ }
+ }
+ topBarTitle.setText(titleStr);
+ }
+
+ private void initView() {
+ mTextView = findViewById(R.id.tv_door_machine);
+ btn_switch = findViewById(R.id.btn_switch);
+ et_password = findViewById(R.id.et_password);
+
+ proDialog = new ProgressDialog(this);
+ proDialog.setTitle("姝e湪鍙戦�佹帶鍒跺懡浠�...");
+ proDialog.setMessage("璇疯�愬績绛夊緟");
+ proDialog.onStart();
+ }
+
+ private void initClickOnEvent() {
+ btn_switch.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ String tempStr = et_password.getText().toString();
+ if (TextUtils.isEmpty(tempStr)) {
+ showToast("寮�閿佸瘑鐮佷笉鑳戒负绌�");
+ return;
+ }
+ proDialog.show();
+ //杩滅▼寮�閿侊紝鍏堣幏鍙栧瘑閽�
+ HDLCommand.doorMachineGetSecret(appliancesInfo);
+ }
+ });
+ }
+
+ private void showStateView() {
+ if (appliancesInfo.getArrCurState() != null) {
+ DoorMachineBackInfo doorMachineBackInfo = new DoorMachineBackInfo(appliancesInfo);
+
+ String stringState = "";
+ if (doorMachineBackInfo.getDoorStatus() == DoorMachineParser.doorStatusClose) {
+ stringState = "闂ㄩ攣鐘舵�侊細鍏抽棴";
+ } else if (doorMachineBackInfo.getDoorStatus() == DoorMachineParser.doorStatusOpen) {
+ stringState = "闂ㄩ攣鐘舵�侊細鎵撳紑";
+ } else if (doorMachineBackInfo.getDoorStatus() == DoorMachineParser.doorStatusNormallyOpen) {
+ stringState = "闂ㄩ攣鐘舵�侊細甯稿紑";
+ } else {
+ stringState = "鏈煡寮�鍏崇姸鎬�";
+ }
+
+ if (doorMachineBackInfo.getNormalOpenMode() == DoorMachineParser.normalOpenModeClose) {
+ stringState += "\n甯稿紑妯″紡锛氬叧闂�";
+ } else if (doorMachineBackInfo.getDoorStatus() == DoorMachineParser.normalOpenModeOpen) {
+ stringState += "\n甯稿紑妯″紡锛氭墦寮�";
+ } else {
+ stringState += "\n鏈煡甯稿紑妯″紡寮�鍏崇姸鎬�";
+ }
+
+ stringState += "\n闊抽噺锛�" + doorMachineBackInfo.getDoorVolume();
+
+ stringState += "\n鐢垫睜鐧惧垎姣旓細" + doorMachineBackInfo.getDoorElectricity();
+
+ mTextView.setText(stringState);
+ } else {
+ mTextView.setText("鏈幏鍙栧埌闂ㄩ攣鐘舵��");
+ }
+
+ }
+
+
+ /**
+ * getSwichStateString
+ *
+ * @param mState
+ * @return
+ */
+ private String getSwichStateString(int mState) {
+ String mStrState = "鏈煡";
+ gSwitchState = mState; //鏇存柊寮�鍏崇姸鎬�
+ switch (mState) {
+ case DoorMachineParser.doorStatusOpen:
+ mStrState = "闂ㄩ攣鐘舵�侊細鎵撳紑";
+ break;
+ case DoorMachineParser.doorStatusClose:
+ mStrState = "闂ㄩ攣鐘舵�侊細鍏抽棴";
+ break;
+ case DoorMachineParser.doorStatusNormallyOpen:
+ mStrState = "闂ㄩ攣鐘舵�侊細甯稿紑";
+ break;
+ default:
+ mStrState = "鏈煡鐘舵��";
+ break;
+ }
+ return mStrState;
+ }
+
+
+ /**
+ * getNormalOpenModeStateString
+ *
+ * @param mState
+ * @return
+ */
+ private String getNormalOpenModeStateString(int mState) {
+ String mStrState = "鏈煡";
+ switch (mState) {
+ case DoorMachineParser.normalOpenModeClose:
+ mStrState = "甯稿紑妯″紡锛氬叧闂�";
+ break;
+ case DoorMachineParser.normalOpenModeOpen:
+ mStrState = "甯稿紑妯″紡锛氭墦寮�";
+ break;
+ default:
+ mStrState = "鏈煡鐘舵��";
+ break;
+ }
+ return mStrState;
+ }
+
+
+ /**
+ * 闂ㄩ攣杩滅▼寮�閿佹帶鍒跺洖璋僂vent
+ *
+ * @param event
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void DoorMachineFeedFristBackEventMain(DoorMachineFeedFristBackEvent event) {
+ proDialog.dismiss();
+ if (event.getDoorMachineFristBackInfo().getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
+ && event.getDoorMachineFristBackInfo().getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
+ && event.getDoorMachineFristBackInfo().getAppliancesInfo().getChannelNum() == appliancesInfo.getChannelNum()) {
+ //鍏堝垽鏂槸鍚﹁秴鏃�
+ if (!event.isSuccess()) {
+ showToast("闂ㄩ攣杩滅▼寮�閿佹帶鍒惰秴鏃讹紝璇烽噸鏂板啀璇�");
+ return;
+ }
+
+ DoorMachineFristBackInfo doorMachineFristBackInfo = event.getDoorMachineFristBackInfo();
+ if (doorMachineFristBackInfo != null && doorMachineBackInfo != null) {
+ secretBytes = doorMachineFristBackInfo.getSecretBytes();
+ HDLCommand.doorMachineCtrl(appliancesInfo, secretBytes, et_password.getText().toString(), doorMachineBackInfo.getDoorStatus());
+ }
+ }
+ }
+
+
+ /**
+ * 闂ㄩ攣杩滅▼寮�閿佹帶鍒跺洖璋僂vent
+ *
+ * @param event
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onDoorMachineFeedBackEventMain(DoorMachineFeedBackEvent event) {
+ proDialog.dismiss();
+ if (event.getDoorMachineBackInfo().getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
+ && event.getDoorMachineBackInfo().getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
+ && event.getDoorMachineBackInfo().getAppliancesInfo().getChannelNum() == appliancesInfo.getChannelNum()) {
+
+ showToast("闂ㄩ攣杩滅▼寮�閿佹垚鍔�");
+ HDLLog.I("闂ㄩ攣杩滅▼寮�閿佹垚鍔�");
+ }
+ }
+
+
+ /**
+ * 闂ㄩ攣鐘舵�佸拰鎶ヨ骞挎挱Event
+ *
+ * @param event
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onDoorMachineWaringBackInfoMain(DoorMachineWaringBackInfo event) {
+ if (event.appliancesInfo.getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
+ && event.appliancesInfo.getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
+ && event.appliancesInfo.getChannelNum() == appliancesInfo.getChannelNum()) {
+
+ String type = ((DoorMachineWaringBackInfo) event).getType();
+ showToast("鏀跺埌闂ㄩ攣1F4D骞挎挱锛�" + type);
+ HDLLog.I("鏀跺埌闂ㄩ攣1F4D骞挎挱锛�" + type);
+ }
+ }
+
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onDeviceStateEventMain(DeviceStateEvent event) {
+ proDialog.dismiss();
+ if (event.getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
+ && event.getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
+ ) {
+ //杩欎釜杩斿洖鐨勪俊鎭槸褰撳墠鐘舵�佺殑
+ switch (event.getAppliancesInfo().getDeviceType()) {
+ case HDLApConfig.TYPE_DOOR_MACHINE:
+ if (appliancesInfo.getChannelNum() == event.getAppliancesInfo().getChannelNum()) {
+ if (!event.isSuccess()) {
+ showToast("鑾峰彇闂ㄩ攣鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
+ return;
+ }
+ String message = "";
+ doorMachineBackInfo = new DoorMachineBackInfo(event.appliancesInfo);
+
+ if (doorMachineBackInfo == null) {
+ showToast("鑾峰彇闂ㄩ攣鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
+ return;
+ }
+
+ showDoorMachineBackInfo(doorMachineBackInfo);
+
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * showDoorMachineBackInfo
+ *
+ * @param doorMachineBackInfo
+ */
+ private void showDoorMachineBackInfo(DoorMachineBackInfo doorMachineBackInfo) {
+ String message = "";
+
+ message = getSwichStateString(doorMachineBackInfo.getDoorStatus());
+ message += "\n" + getNormalOpenModeStateString(doorMachineBackInfo.getNormalOpenMode());
+ message += "\n" + "闊抽噺锛�" + doorMachineBackInfo.getDoorVolume();
+ message += "\n" + "鐢垫睜鐧惧垎姣旓細" + doorMachineBackInfo.getDoorElectricity();
+
+ mTextView.setText(message);
+ showToast(message);
+ HDLLog.I(message);
+ }
+}
diff --git a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/FreshAirActivity.java b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/FreshAirActivity.java
new file mode 100644
index 0000000..e8ba1df
--- /dev/null
+++ b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/FreshAirActivity.java
@@ -0,0 +1,413 @@
+package com.hdl.sdk.ttl_sdk.activity;
+
+
+import android.app.ProgressDialog;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import com.hdl.sdk.ttl.HDLAppliances.Config.HDLApConfig;
+import com.hdl.sdk.ttl.HDLAppliances.HDLFreshAir.FreshAirBackInfo;
+import com.hdl.sdk.ttl.HDLAppliances.HDLFreshAir.Parser.FreshAirParser;
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
+import com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLCommand;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DeviceStateEvent;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.FreshAirFeedBackEvent;
+import com.hdl.sdk.ttl.Utils.LogUtils.HDLLog;
+import com.hdl.sdk.ttl_sdk.R;
+import com.hdl.sdk.ttl_sdk.base.BaseActivity;
+
+import org.greenrobot.eventbus.Subscribe;
+import org.greenrobot.eventbus.ThreadMode;
+
+
+/**
+ * 鏂伴绯荤粺鎺у埗鐣岄潰
+ */
+public class FreshAirActivity extends BaseActivity {
+
+ /**Topbar*/
+ private RelativeLayout topBarBack;
+ private TextView topBarTitle;
+
+ private Button btn_switch, btn_mode, btn_speed;
+ private TextView mTextView;
+ private AppliancesInfo appliancesInfo;
+
+ private int airSwitchState;//Demo浠呬互姝や綔涓烘紨绀猴紝瀹為檯璇锋牴鎹渶姹傚紑鍙戣璁�
+ private int airModeState;
+ private int airSpeedState;
+ private int ctrlId;
+
+ private ProgressDialog proDialog;
+
+ /**
+ * 瑕佹敞鍐屼娇鐢‥ventBus锛岃繖閲岃璁剧疆杩斿洖true
+ *
+ * @return true
+ */
+ @Override
+ protected boolean isRegisterEventBus() {
+ return true;
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_fresh_air);
+ initToolbar();
+ initcurState();
+ initView();
+ initClickOnEvent();
+ showStateView();
+ //姝ゆ柟娉曚负涓诲姩鑾峰彇鍗曚竴璁惧鐘舵�侊紝閫昏緫妯″潡銆佽儗鏅煶涔愭ā鍧楁病鏈夎繖涓猘pi
+ //鐩墠浠呮敮鎸佺伅鍏夛紝绐楀笜锛岀┖璋冧笉鍙戦�佽幏鍙栫姸鎬佸懡浠ゅ彧浠嶴DK鏈湴鑾峰彇锛屼紶鎰熷櫒锛屽湴鐑ā鍧楋紝鏂伴绯荤粺鏄彂閫佽幏鍙栫姸鎬佸懡浠や粠缃戠粶涓婅幏鍙栥��
+ HDLCommand.getFreshAirDeviceStateFromNetwork(appliancesInfo);
+ }
+
+
+ /**
+ * 鍒濆鍖朤oolbar
+ */
+ private void initToolbar() {
+ topBarBack = findViewById(R.id.ll_top_b_left);
+ setViewVisible(topBarBack);
+ topBarTitle = findViewById(R.id.tv_top_b_header_title);
+ topBarBack.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ finish();
+ }
+ });
+ }
+
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ proDialog.dismiss();
+ HDLLog.I("onDestroy: FreshAirActivity");
+ }
+
+ private void initcurState() {
+ appliancesInfo = (AppliancesInfo) getIntent().getSerializableExtra("hdl");
+
+ String titleStr = appliancesInfo.getRemarks();
+ topBarTitle.setText(titleStr);
+ }
+
+ private void initView() {
+ mTextView = findViewById(R.id.tv_fresh_air);
+ btn_switch = findViewById(R.id.btn_switch);
+ btn_speed = findViewById(R.id.btn_speed);
+ btn_mode = findViewById(R.id.btn_mode);
+
+ proDialog = new ProgressDialog(this);
+ proDialog.setTitle("姝e湪鍙戦�佹帶鍒跺懡浠�...");
+ proDialog.setMessage("璇疯�愬績绛夊緟");
+ proDialog.onStart();
+ }
+
+ private void initClickOnEvent() {
+
+ btn_switch.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ proDialog.show();
+ ctrlId = FreshAirParser.freshAirSwich;
+ //婕旂ず褰撳墠鐘舵�佷负鍏筹紝璁剧疆涓哄紑銆傚紑锛岃缃负鍏炽��
+ if (airSwitchState == 0) {
+ //鏂伴寮�
+ HDLCommand.freshAirCtrl(appliancesInfo, FreshAirParser.freshAirSwich, FreshAirParser.freshAirOn);
+ } else {
+ //鏂伴鍏�
+ HDLCommand.freshAirCtrl(appliancesInfo, FreshAirParser.freshAirSwich, FreshAirParser.freshAirOff);
+ }
+ }
+ });
+
+ // 0 鑷姩锛�1浣庯紝2涓紝3楂�
+ btn_speed.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ proDialog.show();
+ ctrlId = FreshAirParser.freshAirSpeed;
+ switch (airSpeedState) {
+ case 0:
+ //鑻ュ綋鍓嶉閫熶负鑷姩锛屽垯鐐瑰嚮鎸夐挳璁剧疆涓轰綆閫�
+ HDLCommand.freshAirCtrl(appliancesInfo, FreshAirParser.freshAirSpeed, FreshAirParser.freshAirSpeedLow);
+ break;
+ case 1:
+ //鑻ュ綋鍓嶉閫熶负浣庨�燂紝鍒欑偣鍑绘寜閽缃负涓��
+ HDLCommand.freshAirCtrl(appliancesInfo, FreshAirParser.freshAirSpeed, FreshAirParser.freshAirSpeedMid);
+ break;
+ case 2:
+ //鑻ュ綋鍓嶉閫熶负涓�燂紝鍒欑偣鍑绘寜閽缃负楂橀��
+ HDLCommand.freshAirCtrl(appliancesInfo, FreshAirParser.freshAirSpeed, FreshAirParser.freshAirSpeedHigh);
+ break;
+ case 3:
+ //鑻ュ綋鍓嶉閫熶负楂橀�燂紝鍒欑偣鍑绘寜閽缃负鑷姩
+ HDLCommand.freshAirCtrl(appliancesInfo, FreshAirParser.freshAirSpeed, FreshAirParser.freshAirSpeedAuto);
+ break;
+ default:
+ //璁剧疆涓鸿嚜鍔�
+ HDLCommand.freshAirCtrl(appliancesInfo, FreshAirParser.freshAirSpeed, FreshAirParser.freshAirSpeedAuto);
+ break;
+
+
+ }
+ }
+ });
+
+
+// 0鎵嬪姩锛�1 鑷姩,2 鏅鸿兘锛�3 瀹氭椂
+ btn_mode.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ proDialog.show();
+ ctrlId = FreshAirParser.freshAirMode;
+ switch (airModeState) {
+ case 0:
+ //鑻ュ綋鍓嶆ā寮忎负鎵嬪姩锛屽垯鐐瑰嚮鎸夐挳璁剧疆涓鸿嚜鍔�
+ HDLCommand.freshAirCtrl(appliancesInfo, FreshAirParser.freshAirMode, FreshAirParser.freshAirModeAuto);
+ break;
+ case 1:
+ //鑻ュ綋鍓嶆ā寮忎负鑷姩锛屽垯鐐瑰嚮鎸夐挳璁剧疆涓烘櫤鑳�
+ HDLCommand.freshAirCtrl(appliancesInfo, FreshAirParser.freshAirMode, FreshAirParser.freshAirModeIntelligent);
+ break;
+ case 2:
+ //鑻ュ綋鍓嶆ā寮忔櫤鑳斤紝鍒欑偣鍑绘寜閽缃负瀹氭椂
+ HDLCommand.freshAirCtrl(appliancesInfo, FreshAirParser.freshAirMode, FreshAirParser.freshAirModeTiming);
+ break;
+ case 3:
+ //鑻ュ綋鍓嶆ā寮忓畾鏃讹紝鍒欑偣鍑绘寜閽缃负鎵嬪姩
+ HDLCommand.freshAirCtrl(appliancesInfo, FreshAirParser.freshAirMode, FreshAirParser.freshAirModeManual);
+ break;
+ default:
+// 鎵嬪姩
+ HDLCommand.freshAirCtrl(appliancesInfo, FreshAirParser.freshAirMode, FreshAirParser.freshAirModeManual);
+ break;
+
+ }
+
+
+ }
+ });
+
+
+ }
+
+ /**
+ * mTextView 涓婃樉绀哄綋鍓嶇姸鎬�
+ */
+ private void showStateView() {
+ if (appliancesInfo.getArrCurState() != null) {
+ String stringFAState = "";
+ //鏂规硶2锛�
+ FreshAirBackInfo mFreshAirBackInfo = new FreshAirBackInfo(appliancesInfo);
+ if (mFreshAirBackInfo == null) {
+ stringFAState = "鏈幏鍙栧埌鏂伴绯荤粺鐘舵��";
+ } else {
+
+ if (mFreshAirBackInfo.getIsOn() == 0) {
+ stringFAState = "鏂伴绯荤粺锛氬叧闂�";
+ } else if (mFreshAirBackInfo.getIsOn() == 1) {
+ stringFAState = "鏂伴绯荤粺锛氭墦寮�";
+ stringFAState += "\n" + getSpeedStateString(mFreshAirBackInfo.getFreshAirSpeed());
+ stringFAState += "\n" + getModeStateString(mFreshAirBackInfo.getFreshAirMode());
+ } else {
+ stringFAState = "鏈煡寮�鍏崇姸鎬�";
+ }
+
+ }
+ mTextView.setText(stringFAState);
+ } else {
+ mTextView.setText("鏈幏鍙栧埌鏂伴璁惧鐘舵��");
+ }
+
+ }
+
+ /**
+ * 鏂伴妯″潡鎺у埗鍥炶皟Event
+ *
+ * @param event
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onFreshAirFeedBackEventMain(FreshAirFeedBackEvent event) {
+ proDialog.dismiss();
+ if (event.getFreshAirBackInfo().getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
+ && event.getFreshAirBackInfo().getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
+ && event.getFreshAirBackInfo().getAppliancesInfo().getChannelNum() == appliancesInfo.getChannelNum()
+ ) {
+ //鍏堝垽鏂槸鍚﹁秴鏃�
+ if (!event.isSuccess()) {
+ showToast("鏂伴鎺у埗瓒呮椂锛岃閲嶆柊鍐嶈瘯");
+ return;
+ }
+
+ String message = "";
+ FreshAirBackInfo mFreshAirBackInfo = event.getFreshAirBackInfo();
+ switch (ctrlId) { //ctrlId 褰撳墠鎺у埗绫诲瀷
+ case FreshAirParser.freshAirSwich:
+ message = getSwichStateString(mFreshAirBackInfo.getIsOn());
+ break;
+ case FreshAirParser.freshAirSpeed:
+ message = getSpeedStateString(mFreshAirBackInfo.getFreshAirSpeed());
+ break;
+ case FreshAirParser.freshAirMode:
+ message = getModeStateString(mFreshAirBackInfo.getFreshAirMode());
+ break;
+ default:
+ break;
+
+ }
+
+ //*********鏍规嵁闇�姹傛樉绀�*********
+ message += "\n" + "瀹ゅ唴娓╁害锛�" + mFreshAirBackInfo.getInTemp();
+ message += "\n" + "瀹ゅ娓╁害锛�" + mFreshAirBackInfo.getOutTemp();
+ message += "\n" + "瀹ゅ唴婀垮害锛�" + mFreshAirBackInfo.getHumidty();
+ message += "\n" + "PM2.5锛�" + mFreshAirBackInfo.getInTemp();
+ message += "\n" + "TVOC锛�" + mFreshAirBackInfo.getInTemp();
+ message += "\n" + "CO2锛�" + mFreshAirBackInfo.getInTemp();
+ //*********鏍规嵁闇�姹傛樉绀�*********
+
+ mTextView.setText(message);
+ showToast(message);
+ HDLLog.I(message);
+ }
+ }
+
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onDeviceStateEventMain(DeviceStateEvent event) {
+ proDialog.dismiss();
+ if (event.getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
+ && event.getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
+ ) {
+ //杩欎釜杩斿洖鐨勪俊鎭槸褰撳墠鐘舵�佺殑
+ switch (event.getAppliancesInfo().getDeviceType()) {
+ case HDLApConfig.TYPE_FRESH_AIR:
+ if (appliancesInfo.getChannelNum() == event.getAppliancesInfo().getChannelNum()) {
+ if (!event.isSuccess()) {
+ showToast("鑾峰彇鏂伴鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
+ return;
+ }
+ String message = "";
+ FreshAirBackInfo mFreshAirBackInfo = new FreshAirBackInfo(event.getAppliancesInfo());
+ if (mFreshAirBackInfo == null) {
+ showToast("鑾峰彇鏂伴鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
+ return;
+ }
+
+ if(mFreshAirBackInfo.getIsOn() == FreshAirParser.freshAirOn) {
+ message = getSwichStateString(mFreshAirBackInfo.getIsOn());
+ message += "\n" + getSpeedStateString(mFreshAirBackInfo.getFreshAirSpeed());
+ message += "\n" + getModeStateString(mFreshAirBackInfo.getFreshAirMode());
+
+ message += "\n" + "瀹ゅ唴娓╁害锛�" + mFreshAirBackInfo.getInTemp();
+ message += "\n" + "瀹ゅ娓╁害锛�" + mFreshAirBackInfo.getOutTemp();
+ message += "\n" + "瀹ゅ唴婀垮害锛�" + mFreshAirBackInfo.getHumidty();
+ message += "\n" + "PM2.5锛�" + mFreshAirBackInfo.getInTemp();
+ message += "\n" + "TVOC锛�" + mFreshAirBackInfo.getInTemp();
+ message += "\n" + "CO2锛�" + mFreshAirBackInfo.getInTemp();
+ }else {
+ message = getSwichStateString(mFreshAirBackInfo.getIsOn());
+ }
+
+ mTextView.setText(message);
+ showToast(message);
+ HDLLog.I(message);
+
+ }
+ break;
+ }
+ }
+ }
+
+
+ /**
+ * getSwichStateString
+ *
+ * @param mState
+ * @return
+ */
+ private String getSwichStateString(int mState) {
+ String mStrState = "鏈煡";
+ airSwitchState = mState; //鏇存柊寮�鍏崇姸鎬�
+
+ switch (mState) {
+ case FreshAirParser.freshAirOn:
+ mStrState = "鏂伴绯荤粺锛氭墦寮�";
+ break;
+ case FreshAirParser.freshAirOff:
+ mStrState = "鏂伴绯荤粺锛氬叧闂�";
+ break;
+
+ default:
+ mStrState = "鏈煡鐘舵��";
+ break;
+ }
+ return mStrState;
+ }
+
+ /**
+ * getSpeedStateString
+ *
+ * @param mState
+ * @return
+ */
+ private String getSpeedStateString(int mState) {
+ String mStrState = "鏈煡";
+ airSpeedState = mState; //鏇存柊褰撳墠椋庨�熺姸鎬�
+ switch (mState) {
+ case FreshAirParser.freshAirSpeedAuto:
+ mStrState = "椋庨�燂細鑷姩";
+ break;
+ case FreshAirParser.freshAirSpeedLow:
+ mStrState = "椋庨�燂細浣�";
+ break;
+ case FreshAirParser.freshAirSpeedMid:
+ mStrState = "椋庨�燂細涓�";
+ break;
+ case FreshAirParser.freshAirSpeedHigh:
+ mStrState = "椋庨�燂細楂�";
+ break;
+
+ default:
+ mStrState = "鏈煡椋庨�熺姸鎬�";
+ break;
+ }
+ return mStrState;
+ }
+
+ /**
+ * getModeStateString
+ *
+ * @param mState
+ * @return
+ */
+ private String getModeStateString(int mState) {
+ String mStrState = "鏈煡";
+ airModeState = mState; //鏇存柊妯″紡鐘舵��
+ switch (mState) {
+ case FreshAirParser.freshAirModeManual:
+ mStrState = "妯″紡锛氭墜鍔�";
+ break;
+ case FreshAirParser.freshAirModeAuto:
+ mStrState = "妯″紡锛氳嚜鍔�";
+ break;
+ case FreshAirParser.freshAirModeIntelligent:
+ mStrState = "妯″紡锛氭櫤鑳�";
+ break;
+ case FreshAirParser.freshAirModeTiming:
+ mStrState = "妯″紡锛氬畾鏃�";
+ break;
+
+ default:
+ mStrState = "鏈煡妯″紡鐘舵��";
+ break;
+ }
+ return mStrState;
+ }
+}
diff --git a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/FreshAirJinMaoActivity.java b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/FreshAirJinMaoActivity.java
new file mode 100644
index 0000000..031c835
--- /dev/null
+++ b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/FreshAirJinMaoActivity.java
@@ -0,0 +1,461 @@
+package com.hdl.sdk.ttl_sdk.activity;
+
+
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import com.hdl.sdk.ttl.HDLAppliances.Config.HDLApConfig;
+import com.hdl.sdk.ttl.HDLAppliances.HDLFreshAir.FreshAirJinMaoBackInfo;
+import com.hdl.sdk.ttl.HDLAppliances.HDLFreshAir.Parser.FreshAirJinMaoParser;
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
+import com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLCommand;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DeviceStateEvent;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.FreshAirJinMaoFeedBackEvent;
+import com.hdl.sdk.ttl_sdk.R;
+import com.hdl.sdk.ttl_sdk.base.BaseActivity;
+import com.hdl.sdk.ttl_sdk.utlis.HDLLog;
+
+import org.greenrobot.eventbus.Subscribe;
+import org.greenrobot.eventbus.ThreadMode;
+
+
+/**
+ * 閲戣寕鏂伴璁惧
+ * * 寮�鍏� 0-鍏虫満锛�1-寮�鏈�
+ * * 杩愯妯″紡 1-閫氶锛�2-鍔犳箍
+ * * 鑺傝兘鑸掗�傞�夋嫨 1-鑸掗�傦紝2-鑺傝兘
+ * * 椋庨�熸。浣� 0-鑷姩锛�1-浣庨�燂紝2-涓�燂紝3-楂橀��
+ */
+public class FreshAirJinMaoActivity extends BaseActivity {
+ /**
+ * Topbar
+ */
+ private RelativeLayout topBarBack;
+ private TextView topBarTitle;
+
+ private TextView tv_nowInTemp, tv_nowInHumidty, tv_filterRemaining, tv_timeout;
+ private Button btn_switch, btn_mode, btn_mode2, btn_speed, btn_setHumidty;
+ private TextView mesText;
+ private EditText et_Humidty;
+ private AppliancesInfo appliancesInfo;
+
+
+ private int switchState;//Demo浠呬互姝や綔涓烘紨绀猴紝瀹為檯璇锋牴鎹渶姹傚紑鍙戣璁�
+ private int modeState;//杩愯妯″紡鐘舵��
+ private int mode2State;//鑺傝兘妯″紡鐘舵��
+ private int speedState;
+ private int humidtyState;
+
+
+ /**
+ * 澶嶅啓isRegisterEventBus() 瑕佹敞鍐屼娇鐢‥ventBus锛岃繖閲岃璁剧疆杩斿洖true
+ *
+ * @return true
+ */
+ @Override
+ protected boolean isRegisterEventBus() {
+ return true;
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_ctrl_jinmao_freshair);
+ initToolbar();
+ initView();
+ initOnClick();
+ initcurState();
+ showStateView();
+
+ HDLCommand.getFreshAirDeviceStateFromNetwork(appliancesInfo);
+
+// HDLCommand.getHVACDeviceStateFromNetwork(appliancesInfo);
+ }
+
+
+ /**
+ * 鍒濆鍖朤oolbar
+ */
+ private void initToolbar() {
+ topBarBack = findViewById(R.id.ll_top_b_left);
+ setViewVisible(topBarBack);
+ topBarTitle = findViewById(R.id.tv_top_b_header_title);
+ topBarBack.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ finish();
+ }
+ });
+ }
+
+ private void initcurState() {
+ appliancesInfo = (AppliancesInfo) getIntent().getSerializableExtra("hdl");
+ String titleStr = appliancesInfo.getRemarks();
+ topBarTitle.setText(titleStr);
+ }
+
+
+ private void initView() {
+ tv_nowInTemp = findViewById(R.id.tv_nowInTemp);
+ tv_nowInHumidty = findViewById(R.id.tv_nowInHumidty);
+ tv_filterRemaining = findViewById(R.id.tv_filterRemaining);
+ tv_timeout = findViewById(R.id.tv_timeout);
+ mesText = findViewById(R.id.mesText);
+
+
+ btn_switch = findViewById(R.id.btn_switch);
+ btn_mode = findViewById(R.id.btn_mode);
+ btn_mode2 = findViewById(R.id.btn_mode2);
+ btn_speed = findViewById(R.id.btn_speed);
+ btn_setHumidty = findViewById(R.id.btn_setHumidty);
+
+ et_Humidty = findViewById(R.id.et_Humidty);
+
+ }
+
+ private void initOnClick() {
+ /**
+ * 寮�鍏崇姸鎬佹帶鍒�
+ */
+ btn_switch.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ //婕旂ず褰撳墠鐘舵�佷负鍏筹紝璁剧疆涓哄紑銆傚紑锛岃缃负鍏炽��
+ if (switchState == FreshAirJinMaoParser.freshAirOff) {
+ HDLCommand.freshAirJinMaoCtrl(appliancesInfo, FreshAirJinMaoParser.SetSwich, FreshAirJinMaoParser.freshAirOn);//鎵撳紑
+ } else {
+ HDLCommand.freshAirJinMaoCtrl(appliancesInfo, FreshAirJinMaoParser.SetSwich, FreshAirJinMaoParser.freshAirOff);//鍏抽棴
+ }
+ }
+ });
+
+ /**
+ * 杩愯妯″紡鎺у埗
+ */
+ btn_mode.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ switch (modeState) {
+ case FreshAirJinMaoParser.freshAirModeVentilation:
+ //鑻ュ綋鍓嶆柊椋庤繍琛屾ā寮忎负閫氶锛屽垯鐐瑰嚮鎸夐挳璁剧疆涓哄姞婀�
+ HDLCommand.freshAirJinMaoCtrl(appliancesInfo, FreshAirJinMaoParser.SetMode, FreshAirJinMaoParser.freshAirModeHumidify);
+ break;
+ case FreshAirJinMaoParser.freshAirModeHumidify:
+ //鑻ュ綋鍓嶆柊椋庤繍琛屾ā寮忎负鍔犳箍锛屽垯鐐瑰嚮鎸夐挳璁剧疆涓洪�氶
+ HDLCommand.freshAirJinMaoCtrl(appliancesInfo, FreshAirJinMaoParser.SetMode, FreshAirJinMaoParser.freshAirModeVentilation);
+ break;
+ default:
+ //璁剧疆涓洪�氶妯″紡
+ HDLCommand.freshAirJinMaoCtrl(appliancesInfo, FreshAirJinMaoParser.SetMode, FreshAirJinMaoParser.freshAirModeVentilation);
+ break;
+ }
+
+ }
+ });
+
+ /**
+ * 鑺傝兘鑸掗�傛ā寮忔帶鍒�
+ */
+ btn_mode2.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ switch (mode2State) {
+ case FreshAirJinMaoParser.energySavingModeComfortable:
+ //鑻ュ綋鍓嶆柊椋庝负鑸掗�傦紝鍒欑偣鍑绘寜閽缃负鑺傝兘
+ HDLCommand.freshAirJinMaoCtrl(appliancesInfo, FreshAirJinMaoParser.SetEnergySavingMode, FreshAirJinMaoParser.energySavingModeEs);
+ break;
+ case FreshAirJinMaoParser.energySavingModeEs:
+ //鑻ュ綋鍓嶆柊椋庝负鑺傝兘锛屽垯鐐瑰嚮鎸夐挳璁剧疆涓鸿垝閫�
+ HDLCommand.freshAirJinMaoCtrl(appliancesInfo, FreshAirJinMaoParser.SetEnergySavingMode, FreshAirJinMaoParser.energySavingModeComfortable);
+ break;
+ default:
+ //璁剧疆涓鸿垝閫傛ā寮�
+ HDLCommand.freshAirJinMaoCtrl(appliancesInfo, FreshAirJinMaoParser.SetEnergySavingMode, FreshAirJinMaoParser.energySavingModeComfortable);
+ break;
+ }
+
+ }
+ });
+
+
+ /**
+ * 椋庨�熸。浣嶈缃�
+ */
+ btn_speed.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ switch (speedState) {
+ case FreshAirJinMaoParser.freshAirSpeedAuto:
+ //鑻ュ綋鍓嶉閫熶负鑷姩锛屽垯鐐瑰嚮鎸夐挳璁剧疆涓轰綆閫�
+ HDLCommand.freshAirJinMaoCtrl(appliancesInfo, FreshAirJinMaoParser.SetSpeed, FreshAirJinMaoParser.freshAirSpeed1);
+ break;
+ case FreshAirJinMaoParser.freshAirSpeed1:
+ //鑻ュ綋鍓嶉閫熶负浣庨�燂紝鍒欑偣鍑绘寜閽缃负涓��
+ HDLCommand.freshAirJinMaoCtrl(appliancesInfo, FreshAirJinMaoParser.SetSpeed, FreshAirJinMaoParser.freshAirSpeed2);
+ break;
+ case FreshAirJinMaoParser.freshAirSpeed2:
+ //鑻ュ綋鍓嶉閫熶负涓�燂紝鍒欑偣鍑绘寜閽缃负楂橀��
+ HDLCommand.freshAirJinMaoCtrl(appliancesInfo, FreshAirJinMaoParser.SetSpeed, FreshAirJinMaoParser.freshAirSpeed3);
+ break;
+ case FreshAirJinMaoParser.freshAirSpeed3:
+ //鑻ュ綋鍓嶉閫熶负楂橀�燂紝鍒欑偣鍑绘寜閽缃负鑷姩
+ HDLCommand.freshAirJinMaoCtrl(appliancesInfo, FreshAirJinMaoParser.SetSpeed, FreshAirJinMaoParser.freshAirSpeedAuto);
+ break;
+ default:
+ //璁剧疆涓鸿嚜鍔�
+ HDLCommand.freshAirJinMaoCtrl(appliancesInfo, FreshAirJinMaoParser.SetSpeed, FreshAirJinMaoParser.freshAirSpeedAuto);
+ break;
+
+ }
+ }
+ });
+
+ /**
+ * 婀垮害璁剧疆
+ */
+ btn_setHumidty.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ String mHumidtyStr = et_Humidty.getText().toString();
+ if (TextUtils.isEmpty(mHumidtyStr)) {
+ showToast("璁剧疆鐨勬箍搴︿笉鑳戒负绌�");
+ return;
+ }
+ int mHumidtyInt = Integer.parseInt(mHumidtyStr);
+
+ if (mHumidtyInt < 0 || mHumidtyInt > 100) {
+ showToast("婀垮害璁剧疆鑼冨洿涓猴細0~100%");
+ return;
+ }
+
+ HDLCommand.freshAirJinMaoCtrl(appliancesInfo, FreshAirJinMaoParser.SetHumidty, mHumidtyInt);
+
+
+ }
+ });
+
+
+ }
+
+ /**
+ *
+ */
+ private void showStateView() {
+ if (appliancesInfo.getArrCurState() != null) {
+ FreshAirJinMaoBackInfo mFreshAirJinMaoBackInfo = new FreshAirJinMaoBackInfo(appliancesInfo);
+ showFreshAirJinMaoBackInfo(mFreshAirJinMaoBackInfo);
+ } else {
+ mesText.setText("鏈幏鍙栧埌鏂伴鐘舵��");
+ }
+ }
+
+ /**
+ * 鍒锋柊璁惧鐘舵��
+ */
+ private void refreshState(FreshAirJinMaoBackInfo mFreshAirJinMaoBackInfo) {
+ switchState = mFreshAirJinMaoBackInfo.getIsOn();
+ modeState = mFreshAirJinMaoBackInfo.getFreshAirMode();
+ mode2State = mFreshAirJinMaoBackInfo.getEnergySavingMode();
+ speedState = mFreshAirJinMaoBackInfo.getFreshAirSpeed();
+ humidtyState = mFreshAirJinMaoBackInfo.getSetHumidty();
+
+
+ tv_nowInTemp.setText(mFreshAirJinMaoBackInfo.getNowInTemp() + "鈩�");
+ tv_nowInHumidty.setText(mFreshAirJinMaoBackInfo.getNowInHumidty() + "%");
+ tv_filterRemaining.setText(mFreshAirJinMaoBackInfo.getFilterRemaining() + "%");
+ String timeoutStateStr = mFreshAirJinMaoBackInfo.getUseTimeoutState() > 0 ? "瓒呮椂锛岃鏇存崲" : "姝e父";
+ tv_timeout.setText(timeoutStateStr);
+ if (mFreshAirJinMaoBackInfo.getUseTimeoutState() > 0) {
+ showToast("鎶ヨ淇℃伅锛氭护缃戜娇鐢ㄨ秴鏃讹紝闇�瑕佹洿鎹紒");
+ }
+ }
+
+ /**
+ * getModeStateString
+ *
+ * @param mState
+ * @return
+ */
+ private String getModeStateString(int mState) {
+ String mStrState = "鏈煡";
+ modeState = mState; //鏇存柊妯″紡鐘舵��
+ switch (mState) {
+ case 1:
+ mStrState = "杩愯妯″紡锛氶�氶";
+ break;
+ case 2:
+ mStrState = "杩愯妯″紡锛氬姞婀�";
+ break;
+ default:
+ mStrState = "鏈煡杩愯妯″紡";
+ break;
+ }
+ return mStrState;
+ }
+
+ /**
+ * @param mState
+ * @return
+ */
+ private String getMode2StateString(int mState) {
+ String mStrState = "鏈煡";
+ mode2State = mState; //鏇存柊鑺傝兘妯″紡鐘舵��
+ switch (mState) {
+ case 1:
+ mStrState = "鑺傝兘妯″紡锛氳垝閫�";
+ break;
+ case 2:
+ mStrState = "鑺傝兘妯″紡锛氳妭鑳�";
+ break;
+ default:
+ mStrState = "鏈煡鑺傝兘妯″紡";
+ break;
+ }
+ return mStrState;
+ }
+
+ /**
+ * getSpeedStateString
+ *
+ * @param mState
+ * @return
+ */
+ private String getSpeedStateString(int mState) {
+ String mStrState = "鏈煡";
+ speedState = mState; //鏇存柊褰撳墠椋庨�熺姸鎬�
+ switch (mState) {
+ case 0:
+ mStrState = "椋庨�燂細鑷姩";
+ break;
+ case 1:
+ mStrState = "椋庨�燂細浣庨��";
+ break;
+ case 2:
+ mStrState = "椋庨�燂細涓��";
+ break;
+ case 3:
+ mStrState = "椋庨�燂細楂橀��";
+ break;
+
+ default:
+ mStrState = "鏈煡椋庨�熺姸鎬�";
+ break;
+ }
+ return mStrState;
+ }
+
+
+ /**
+ * getSwichStateString
+ *
+ * @param mState
+ * @return
+ */
+ private String getSwichStateString(int mState) {
+ String mStrState = "鏈煡";
+ switchState = mState; //鏇存柊寮�鍏崇姸鎬�
+ switch (mState) {
+ case FreshAirJinMaoParser.freshAirOn:
+ mStrState = "鏂伴锛氭墦寮�";
+ break;
+ case FreshAirJinMaoParser.freshAirOff:
+ mStrState = "鏂伴锛氬叧闂�";
+ break;
+
+ default:
+ mStrState = "鏈煡鐘舵��";
+ break;
+ }
+ return mStrState;
+ }
+
+
+ /**
+ * 澶勭悊璁惧鐘舵��
+ *
+ * @param mFreshAirJinMaoBackInfo
+ */
+ private void showFreshAirJinMaoBackInfo(FreshAirJinMaoBackInfo mFreshAirJinMaoBackInfo) {
+ if (mFreshAirJinMaoBackInfo != null) {
+ String message = "";
+ if (mFreshAirJinMaoBackInfo.getIsOn() == FreshAirJinMaoParser.freshAirOn) {
+ message = getSwichStateString(mFreshAirJinMaoBackInfo.getIsOn());
+ message += "\n" + getModeStateString(mFreshAirJinMaoBackInfo.getFreshAirMode());//杩愯妯″紡
+ message += "\n" + getMode2StateString(mFreshAirJinMaoBackInfo.getEnergySavingMode());//鑺傝兘妯″紡
+ message += "\n" + getSpeedStateString(mFreshAirJinMaoBackInfo.getFreshAirSpeed());//椋庨��
+ message += "\n褰撳墠璁剧疆婀垮害锛�" + mFreshAirJinMaoBackInfo.getSetHumidty();//褰撳墠婀垮害璁剧疆鍊�
+ refreshState(mFreshAirJinMaoBackInfo);
+ } else {
+ message = getSwichStateString(mFreshAirJinMaoBackInfo.getIsOn());
+ }
+ mesText.setText(message);
+ showToast(message);
+ HDLLog.Log(message);
+ } else {
+ mesText.setText("鏈幏鍙栧埌鏂伴鐘舵��");
+ }
+ }
+
+
+ /**
+ * 鏂伴鎺у埗鍥炶皟Event
+ *
+ * @param event
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onFreshAirJinMaoFeedBackEventEventMain(FreshAirJinMaoFeedBackEvent event) {
+ if (event.getFreshAirJinMaoBackInfo().getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
+ && event.getFreshAirJinMaoBackInfo().getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
+ && event.getFreshAirJinMaoBackInfo().getAppliancesInfo().getChannelNum() == appliancesInfo.getChannelNum()) {
+ //鍏堝垽鏂槸鍚﹁秴鏃�
+ if (!event.isSuccess()) {
+ showToast("鏂伴鎺у埗瓒呮椂锛岃閲嶆柊鍐嶈瘯");
+ return;
+ }
+ FreshAirJinMaoBackInfo mFreshAirJinMaoBackInfo = event.getFreshAirJinMaoBackInfo();
+ showFreshAirJinMaoBackInfo(mFreshAirJinMaoBackInfo);
+
+ }
+ }
+
+ /**
+ * 鑾峰彇鍗曚竴璁惧鐘舵�佸洖璋僂vent
+ *
+ * @param event
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onDeviceStateEventMain(DeviceStateEvent event) {
+ if (event.getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
+ && event.getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
+ ) {
+ //杩欎釜杩斿洖鐨勪俊鎭槸褰撳墠鐘舵�佺殑
+ switch (event.getAppliancesInfo().getDeviceType()) {
+ case HDLApConfig.TYPE_FRESH_AIR_JINMAO:
+ if (appliancesInfo.getChannelNum() == event.getAppliancesInfo().getChannelNum()) {
+ if (!event.isSuccess()) {
+ showToast("鑾峰彇鏂伴鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
+ return;
+ }
+ FreshAirJinMaoBackInfo mFreshAirJinMaoBackInfo = new FreshAirJinMaoBackInfo(event.getAppliancesInfo());
+
+ if (mFreshAirJinMaoBackInfo == null) {
+ showToast("鑾峰彇鏂伴鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
+ return;
+ }
+ showFreshAirJinMaoBackInfo(mFreshAirJinMaoBackInfo);
+ }
+ break;
+ default:
+ //涓嶅鐞�
+ break;
+ }
+ }
+ }
+
+
+}
diff --git a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/GeothermalActivity.java b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/GeothermalActivity.java
new file mode 100644
index 0000000..23d4569
--- /dev/null
+++ b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/GeothermalActivity.java
@@ -0,0 +1,383 @@
+package com.hdl.sdk.ttl_sdk.activity;
+
+
+import android.app.ProgressDialog;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import com.hdl.sdk.ttl.HDLAppliances.Config.HDLApConfig;
+import com.hdl.sdk.ttl.HDLAppliances.HDLGeothermal.GeothermalBackInfo;
+import com.hdl.sdk.ttl.HDLAppliances.HDLGeothermal.Parser.GeothermalParser;
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
+import com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLCommand;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DeviceStateEvent;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.EventCode;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.GeothermalFeedBackEvent;
+import com.hdl.sdk.ttl.Utils.LogUtils.HDLLog;
+import com.hdl.sdk.ttl_sdk.R;
+import com.hdl.sdk.ttl_sdk.base.BaseActivity;
+
+import org.greenrobot.eventbus.Subscribe;
+import org.greenrobot.eventbus.ThreadMode;
+
+/**
+ * 鍦扮儹妯″潡鎺у埗鐣岄潰
+ */
+public class GeothermalActivity extends BaseActivity {
+ /**Topbar*/
+ private RelativeLayout topBarBack;
+ private TextView topBarTitle;
+
+ private Button btn_switch, btn_mode, btn_temp;
+ private TextView mTextView;
+ private EditText tempEditText;
+ private AppliancesInfo appliancesInfo;
+
+ private int gSwitchState;//Demo浠呬互姝や綔涓烘紨绀猴紝瀹為檯璇锋牴鎹渶姹傚紑鍙戣璁�
+ private int gModeState;
+//
+ private ProgressDialog proDialog;
+ /**
+ * 瑕佹敞鍐屼娇鐢‥ventBus锛岃繖閲岃璁剧疆杩斿洖true
+ *
+ * @return true
+ */
+ @Override
+ protected boolean isRegisterEventBus() {
+ return true;
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_geothermal);
+ initToolbar();
+ initcurState();
+ initView();
+ initClickOnEvent();
+ showStateView();
+
+ HDLCommand.getGeothermalStateFromNetwork(appliancesInfo);
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ proDialog.dismiss();
+ HDLLog.I("onDestroy: GeothermalActivity");
+ }
+
+ /**
+ * 鍒濆鍖朤oolbar
+ */
+ private void initToolbar() {
+ topBarBack = findViewById(R.id.ll_top_b_left);
+ setViewVisible(topBarBack);
+ topBarTitle = findViewById(R.id.tv_top_b_header_title);
+ topBarBack.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ finish();
+ }
+ });
+ }
+
+
+ private void initcurState() {
+ appliancesInfo = (AppliancesInfo) getIntent().getSerializableExtra("hdl");
+ String titleStr = appliancesInfo.getRemarks();
+ topBarTitle.setText(titleStr);
+ }
+
+ private void initView() {
+ mTextView = findViewById(R.id.tv_geothermal);
+ btn_switch = findViewById(R.id.btn_switch);
+ btn_mode = findViewById(R.id.btn_mode);
+ btn_temp = findViewById(R.id.btn_temp);
+ tempEditText = findViewById(R.id.et_temp);
+
+ proDialog = new ProgressDialog(this);
+ proDialog.setTitle("姝e湪鍙戦�佹帶鍒跺懡浠�...");
+ proDialog.setMessage("璇疯�愬績绛夊緟");
+ proDialog.onStart();
+ }
+
+ private void initClickOnEvent() {
+ btn_switch.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ proDialog.show();
+ //婕旂ず褰撳墠鐘舵�佷负鍏筹紝璁剧疆涓哄紑銆傚紑锛岃缃负鍏炽��
+ if (gSwitchState == 0) {
+ //鍦扮儹寮�
+ HDLCommand.geothermalCtrl(appliancesInfo, GeothermalParser.gSwich, GeothermalParser.gSwichOn);
+ } else {
+ //鍦扮儹鍏�
+ HDLCommand.geothermalCtrl(appliancesInfo, GeothermalParser.gSwich, GeothermalParser.gSwichOff);
+ }
+ }
+ });
+
+
+// 0鎵嬪姩锛�1 鑷姩,2 鏅鸿兘锛�3 瀹氭椂
+ btn_mode.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ proDialog.show();
+ switch (gModeState) {
+ case 1:
+ //鑻ュ綋鍓嶆ā寮忎负鏅�氾紝鍒欑偣鍑绘寜閽缃负鐧藉ぉ妯″紡
+ HDLCommand.geothermalCtrl(appliancesInfo, GeothermalParser.gMode, GeothermalParser.gModeDay);
+ break;
+ case 2:
+ //鑻ュ綋鍓嶆ā寮忕櫧澶╋紝鍒欑偣鍑绘寜閽缃负澶滈棿妯″紡
+ HDLCommand.geothermalCtrl(appliancesInfo, GeothermalParser.gMode, GeothermalParser.gModeNight);
+ break;
+ case 3:
+ //鑻ュ綋鍓嶆ā寮忓闂达紝鍒欑偣鍑绘寜閽缃负绂诲紑妯″紡
+ HDLCommand.geothermalCtrl(appliancesInfo, GeothermalParser.gMode, GeothermalParser.gModeLeave);
+ break;
+ case 4:
+ //鑻ュ綋鍓嶆ā寮忕寮�锛屽垯鐐瑰嚮鎸夐挳璁剧疆涓鸿嚜鍔ㄦā寮�
+ HDLCommand.geothermalCtrl(appliancesInfo, GeothermalParser.gMode, GeothermalParser.gModeAuto);
+ break;
+ case 5:
+ //鑻ュ綋鍓嶆ā寮忚嚜鍔ㄦā寮忥紝鍒欑偣鍑绘寜閽缃负鏅�氭ā寮�
+ HDLCommand.geothermalCtrl(appliancesInfo, GeothermalParser.gMode, GeothermalParser.gModeNormal);
+ break;
+ default:
+// 鏅�氭ā寮�
+ HDLCommand.geothermalCtrl(appliancesInfo, GeothermalParser.gMode, GeothermalParser.gModeNormal);
+ break;
+
+ }
+
+
+
+ }
+ });
+
+
+ btn_temp.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+
+ String tempStr = tempEditText.getText().toString();
+ if (TextUtils.isEmpty(tempStr)) {
+ showToast("璁剧疆鐨勬俯搴︿笉鑳戒负绌�");
+ return;
+ }
+ int tempInt = Integer.parseInt(tempStr);
+
+ if (tempInt < 16 || tempInt > 35) {
+ showToast("娓╁害璁剧疆鑼冨洿涓猴細16~35鎽勬皬搴�(鈩�)");
+ return;
+ }
+ proDialog.show();
+// HDLCommand.geothermalCtrlTemp(appliancesInfo, tempInt);//鑷姩鏍规嵁褰撳墠妯″紡璁剧疆褰撳墠妯″紡鐨勬俯搴︺��
+
+ switch (gModeState) {
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ HDLCommand.geothermalCtrlTemp(appliancesInfo, tempInt);//鑷姩鏍规嵁褰撳墠妯″紡璁剧疆褰撳墠妯″紡鐨勬俯搴︺��
+ break;
+ case 5:
+ proDialog.dismiss();
+ //褰撳墠鍦扮儹妯″紡涓鸿嚜鍔�
+ showToast("鑷姩妯″紡锛屼笉鑳芥帶鍒舵俯搴�");
+ break;
+ default:
+ proDialog.dismiss();
+ //褰撳墠鍦扮儹妯″紡涓鸿嚜鍔�
+ showToast("鏈煡妯″紡锛屼笉鑳芥帶鍒舵俯搴�");
+ break;
+
+ }
+
+ }
+ });
+
+
+ }
+
+ private void showStateView() {
+ if (appliancesInfo.getArrCurState() != null) {
+ GeothermalBackInfo mGeothermalBackInfo = new GeothermalBackInfo(appliancesInfo, false);
+
+ String stringState = "";
+ if (mGeothermalBackInfo.getIsOn() == GeothermalParser.gSwichOff) {
+ stringState = "鍦扮儹妯″潡锛氬叧闂�";
+ } else if (mGeothermalBackInfo.getIsOn() == GeothermalParser.gSwichOn) {
+ stringState = "鍦扮儹妯″潡锛氭墦寮�";
+
+ stringState += "\n" + getModeStateString(mGeothermalBackInfo.getgMode());
+
+ stringState += "\n瀹ゅ唴娓╁害锛�" + mGeothermalBackInfo.getgCurrentTemp();
+
+ stringState += "\n鏅�氭ā寮忔俯搴︼細" + mGeothermalBackInfo.getgNormalTemp();
+
+ stringState += "\n鐧藉ぉ妯″紡娓╁害锛�" + mGeothermalBackInfo.getgDayTemp();
+
+ stringState += "\n澶滈棿妯″紡娓╁害锛�" + mGeothermalBackInfo.getgNightTemp();
+
+ stringState += "\n绂诲紑妯″紡娓╁害锛�" + mGeothermalBackInfo.getgLeaveTemp();
+ } else {
+ stringState = "鏈煡寮�鍏崇姸鎬�";
+ }
+
+ mTextView.setText(stringState);
+ } else {
+ mTextView.setText("鏈幏鍙栧埌鍦扮儹妯″潡鐘舵��");
+ }
+
+ }
+
+
+ /**
+ * getSwichStateString
+ *
+ * @param mState
+ * @return
+ */
+ private String getSwichStateString(int mState) {
+ String mStrState = "鏈煡";
+ gSwitchState = mState; //鏇存柊寮�鍏崇姸鎬�
+ switch (mState) {
+ case GeothermalParser.gSwichOn:
+ mStrState = "鍦扮儹妯″潡锛氭墦寮�";
+ break;
+ case GeothermalParser.gSwichOff:
+ mStrState = "鍦扮儹妯″潡锛氬叧闂�";
+ break;
+
+ default:
+ mStrState = "鏈煡鐘舵��";
+ break;
+ }
+ return mStrState;
+ }
+
+
+ /**
+ * getModeStateString
+ *
+ * @param mState
+ * @return
+ */
+ private String getModeStateString(int mState) {
+ String mStrState = "鏈煡";
+ gModeState = mState; //鏇存柊妯″紡鐘舵��
+ switch (mState) {
+ case GeothermalParser.gModeNormal:
+ mStrState = "妯″紡锛氭櫘閫�";
+ break;
+ case GeothermalParser.gModeDay:
+ mStrState = "妯″紡锛氱櫧澶�";
+ break;
+ case GeothermalParser.gModeNight:
+ mStrState = "妯″紡锛氬闂�";
+ break;
+ case GeothermalParser.gModeLeave:
+ mStrState = "妯″紡锛氱寮�";
+ break;
+ case GeothermalParser.gModeAuto:
+ mStrState = "妯″紡锛氳嚜鍔�";
+ break;
+
+ default:
+ mStrState = "鏈煡妯″紡鐘舵��";
+ break;
+ }
+ return mStrState;
+ }
+
+ /**
+ * 鍦扮儹鎺у埗鍥炶皟Event
+ *
+ * @param event
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onGeothermalFeedBackEventMain(GeothermalFeedBackEvent event) {
+ proDialog.dismiss();
+ if (event.getGeothermalBackInfo().getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
+ && event.getGeothermalBackInfo().getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
+ && event.getGeothermalBackInfo().getAppliancesInfo().getChannelNum() == appliancesInfo.getChannelNum()
+ ) {
+ //鍏堝垽鏂槸鍚﹁秴鏃�
+ if (event.getStatusID() == EventCode.FAILURE_TIMEOUT) {
+ showToast("鍦扮儹妯″潡鎺у埗瓒呮椂锛岃閲嶆柊鍐嶈瘯");
+ return;
+ }
+
+ if (event.getStatusID() == EventCode.FAILURE_DATA_ERROR) {
+ showToast("鍦扮儹妯″潡,杩斿洖鏁版嵁涓虹┖");
+ return;
+ }
+ GeothermalBackInfo mGeothermalBackInfo = event.getGeothermalBackInfo();
+ showGeothermalBackInfo(mGeothermalBackInfo);
+
+ }
+ }
+
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onDeviceStateEventMain(DeviceStateEvent event) {
+ proDialog.dismiss();
+ if (event.getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
+ && event.getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
+ ) {
+ //杩欎釜杩斿洖鐨勪俊鎭槸褰撳墠鐘舵�佺殑
+ switch (event.getAppliancesInfo().getDeviceType()) {
+ case HDLApConfig.TYPE_GEOTHERMAL_MODULE:
+ case HDLApConfig.TYPE_GEOTHERMAL_JINMAO:
+ if (appliancesInfo.getChannelNum() == event.getAppliancesInfo().getChannelNum()) {
+ if (!event.isSuccess()) {
+ showToast("鑾峰彇鍦扮儹鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
+ return;
+ }
+ String message = "";
+ GeothermalBackInfo mGeothermalBackInfo = new GeothermalBackInfo(event.appliancesInfo, false);
+
+ if (mGeothermalBackInfo == null) {
+ showToast("鑾峰彇鍦扮儹鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
+ return;
+ }
+
+ showGeothermalBackInfo(mGeothermalBackInfo);
+
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * showGeothermalBackInfo
+ * @param mGeothermalBackInfo
+ */
+ private void showGeothermalBackInfo(GeothermalBackInfo mGeothermalBackInfo){
+ String message = "";
+ if(mGeothermalBackInfo.getIsOn() == GeothermalParser.gSwichOn) {
+ message = getSwichStateString(mGeothermalBackInfo.getIsOn());
+
+ message += "\n" + getModeStateString(mGeothermalBackInfo.getgMode());
+ message += "\n" + "鏅�氭ā寮忔俯搴︼細" + mGeothermalBackInfo.getgNormalTemp();
+ message += "\n" + "鐧藉ぉ妯″紡娓╁害锛�" + mGeothermalBackInfo.getgDayTemp();
+ message += "\n" + "澶滈棿妯″紡娓╁害锛�" + mGeothermalBackInfo.getgNightTemp();
+ message += "\n" + "绂诲紑妯″紡娓╁害锛�" + mGeothermalBackInfo.getgLeaveTemp();
+ }else {
+ message = getSwichStateString(mGeothermalBackInfo.getIsOn());
+ }
+
+
+ mTextView.setText(message);
+ showToast(message);
+ HDLLog.I(message);
+ }
+}
diff --git a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/MainActivity.java b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/MainActivity.java
index 27ba6a5..9a573b4 100644
--- a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/MainActivity.java
+++ b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/MainActivity.java
@@ -88,7 +88,7 @@
private List<String> mAllDevicesList = new ArrayList<>();//鎼滅储鍒扮殑璁惧鐨勫娉ㄥ悕
private ProgressDialog mProgressDialog;
-// private static String HDL_PATH_NAME = "/dev/ttyS2"; //涓插彛璁惧璺緞鍚�
+ // private static String HDL_PATH_NAME = "/dev/ttyS2"; //涓插彛璁惧璺緞鍚�
// private static int HDL_BAUDRATE = 115200; //娉㈢壒鐜�
private Boolean bOpen = false;
private int remarkId = 0;
@@ -188,6 +188,7 @@
public void onClick(View v) {
/**鍏ㄩ儴閲嶆柊鎼滅储,娓呯┖鍘熻澶囧垪琛ㄦ暟鎹�*/
clearListView();
+ HDLDeviceManager.clearAllDeviceList();
HDLCommand.getHomeDevices();
mProgressDialog.show();
}
@@ -339,9 +340,9 @@
for (int i = 0; i < mDevicesDataList.size(); i++) {
if (TextUtils.isEmpty(mDevicesDataList.get(i).getRemark())) {
- mAllDevicesList.add("鏆傛棤澶囨敞");
+ mAllDevicesList.add("鏆傛棤澶囨敞" + "-" + mDevicesDataList.get(i).getSourceSubnetID() + "-" + mDevicesDataList.get(i).getSourceDeviceID());
} else {
- mAllDevicesList.add(mDevicesDataList.get(i).getRemark());
+ mAllDevicesList.add(mDevicesDataList.get(i).getRemark() + "-" + mDevicesDataList.get(i).getSourceSubnetID() + "-" + mDevicesDataList.get(i).getSourceDeviceID());
}
}
mHDLMainListAdapter.notifyDataSetChanged();
@@ -437,12 +438,10 @@
}
-
-
@SuppressWarnings("unused")
- private void closePhone(Context context, String[] shutdown){
+ private void closePhone(Context context, String[] shutdown) {
try {
- Process process = Runtime.getRuntime().exec(shutdown);
+ Process process = Runtime.getRuntime().exec(shutdown);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
diff --git a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/SensorActivity.java b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/SensorActivity.java
index a894570..7be74e8 100644
--- a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/SensorActivity.java
+++ b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/SensorActivity.java
@@ -2,6 +2,8 @@
import android.os.Bundle;
+import android.text.TextUtils;
+import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.RelativeLayout;
@@ -14,6 +16,7 @@
import com.hdl.sdk.ttl_sdk.R;
import com.hdl.sdk.ttl_sdk.base.BaseActivity;
import com.hdl.sdk.ttl_sdk.utlis.HDLLog;
+import com.hdl.sdk.ttl_sdk.utlis.HDLUtlis;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
@@ -24,7 +27,6 @@
*/
private RelativeLayout topBarBack;
private TextView topBarTitle;
- private Button sensorbtn;
private TextView sensorText;
private AppliancesInfo appliancesInfo;
@@ -46,10 +48,10 @@
initToolbar();
initcurState();
initView();
- initOnClick();
displayStateView();
- //浠庣綉缁滀笂鏌ヨ鍒锋柊涓�娆¤澶囩姸鎬侊紝寰呰皟璇�
- HDLCommand.getDryContactSensorStateFromNetwork(appliancesInfo);
+
+ Log.d("panlili", "SensorActivity.java:appliancesInfo-----> " + appliancesInfo.toString());
+ //浼犳劅鍣ㄦ棤鐘舵�佽幏鍙栵紝鍙兘瑙﹀彂浜嬩欢涓婃姤
}
/**
@@ -70,61 +72,24 @@
private void initcurState() {
appliancesInfo = (AppliancesInfo) getIntent().getSerializableExtra("hdl");
String titleStr = appliancesInfo.getRemarks();
- topBarTitle.setText(titleStr);
+ if (TextUtils.isEmpty(titleStr) || titleStr.equals(HDLUtlis.REMAEK_NULL)) {
+ if (TextUtils.isEmpty(appliancesInfo.getDeviceName())) {
+ titleStr = "澶囨敞涓虹┖";
+ } else {
+ titleStr = appliancesInfo.getDeviceName();
+ }
+ }
+ topBarTitle.setText(titleStr + appliancesInfo.getDeviceType());
}
private void initView() {
- sensorbtn = findViewById(R.id.sensorbtn);
sensorText = findViewById(R.id.sensorText);
-
-
- }
-
- private void initOnClick() {
-
- sensorbtn.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- //浠庣綉缁滀笂鏌ヨ鍒锋柊涓�娆¤澶囩姸鎬侊紝寰呰皟璇�
- HDLCommand.getDryContactSensorStateFromNetwork(appliancesInfo);
- }
- });
}
private void displayStateView() {
switch (appliancesInfo.getDeviceType()) {
-// case HDLApConfig.TYPE_SENSOR_DRY_CONTACT://2019-07-03 灞忚斀
-// case HDLApConfig.TYPE_SENSOR_MOVEMENT_DETECTOR:
-// case HDLApConfig.TYPE_SENSOR_TEMP:
-// case HDLApConfig.TYPE_SENSOR_HUMIDITY:
-// case HDLApConfig.TYPE_SENSOR_ILLUMINACE:
-// case HDLApConfig.TYPE_SENSOR_VOC:
-// case HDLApConfig.TYPE_SENSOR_PM_2_POINT_5:
-// case HDLApConfig.TYPE_SENSOR_C02:
-// case HDLApConfig.TYPE_SENSOR_LPG:
-// case HDLApConfig.TYPE_SENSOR_CO_H2:
-// case HDLApConfig.TYPE_SENSOR_CH4:
-// case HDLApConfig.TYPE_SENSOR_SMOG:
-// case HDLApConfig.TYPE_SENSOR_WIND_SPEED:
-// case HDLApConfig.TYPE_SENSOR_WIND_PRESSURE:
-// case HDLApConfig.TYPE_SENSOR_LIQUID_FLOW:
-// case HDLApConfig.TYPE_SENSOR_LIQUID_PRESSURE:
-// case HDLApConfig.TYPE_SENSOR_LIQUID_DEPTH:
-// case HDLApConfig.TYPE_SENSOR_RAIN_FALL:
-// case HDLApConfig.TYPE_SENSOR_WEIGHT:
-// case HDLApConfig.TYPE_SENSOR_HEIGHT_LENGTH:
-// case HDLApConfig.TYPE_SENSOR_OBJECT_SPEED:
-// case HDLApConfig.TYPE_SENSOR_SHAKE:
-// case HDLApConfig.TYPE_SENSOR_VOLTAGE:
-// case HDLApConfig.TYPE_SENSOR_ELECTRICITY:
-// case HDLApConfig.TYPE_SENSOR_POWER:
-// case HDLApConfig.TYPE_SENSOR_FLOODING:
-// case HDLApConfig.TYPE_SENSOR_DOOR_MAGNET:
-// case HDLApConfig.TYPE_SENSOR_EMERGENCY_BUTTON:
-
-
case HDLApConfig.TYPE_SENSOR_MOVEMENT_DETECTOR: //绾㈠鎰熷簲浼犳劅鍣�
case HDLApConfig.TYPE_SENSOR_CO_H2: //鐓ゆ皵浼犳劅鍣�
case HDLApConfig.TYPE_SENSOR_SMOG: //鐑熼浘浼犳劅鍣�
@@ -142,7 +107,7 @@
/**
* 浼犳劅鍣ㄧ姸鎬佸洖璋� Event
- * 骞茶妭鐐圭姸鎬佷富鍔ㄥ箍鎾� 鍜� 琚姩鏌ヨ鐘舵�佸弽棣�
+ * 骞茶妭鐐圭姸鎬佷富鍔ㄥ箍鎾�--->15D0
*
* @param event
*/
@@ -153,21 +118,23 @@
&& event.getAppliancesInfo().getChannelNum() == appliancesInfo.getChannelNum()
) {
- //浼犳劅鍣� 骞叉帴鐐� 銆傚彧鏈夊紑鍏崇姸鎬�
if (!event.isSuccess()) {
- showToast("鑾峰彇浼犳劅鍣ㄧ姸鎬佸け璐ワ紝璇烽噸鏂板啀璇�");
+ showToast("浼犳劅鍣ㄧ姸鎬佷笂鎶ュけ璐ワ紝璇烽噸鏂板啀璇�");
return;
}
String mData = "";
- if (appliancesInfo.getDeviceType() == HDLApConfig.TYPE_SENSOR_MOVEMENT_DETECTOR) {
- mData = event.getState() == 0 ? "鏃犲姩闈�" : "鏈夊姩闈�";
+ if (appliancesInfo.getDeviceType() == HDLApConfig.TYPE_SENSOR_MOVEMENT_DETECTOR) {//绾㈠鎰熷簲浼犳劅鍣�
+ mData = event.getState() == 0 ? "鏃犱汉" : "鏈変汉";
+ } else if (appliancesInfo.getDeviceType() == HDLApConfig.TYPE_SENSOR_FLOODING) {//姘存蹈浼犳劅鍣�
+ mData = event.getState() == 0 ? "姝e父" : "婕忔按";
+ } else if (appliancesInfo.getDeviceType() == HDLApConfig.TYPE_SENSOR_DOOR_MAGNET) {//闂ㄧ浼犳劅鍣�
+ mData = event.getState() == 0 ? "闂悎" : "鎵撳紑";
} else {
- mData = event.getState() == 0 ? "闂悎" : "鏂紑";
+ mData = event.getState() == 0 ? "姝e父" : "鎶ヨ";
}
- sensorText.setText("浼犳劅鍣�---骞叉帴鐐圭姸鎬侊細" + mData);
-// showToast("浼犳劅鍣�---骞叉帴鐐圭姸鎬侊細" + mData);
- HDLLog.Log("浼犳劅鍣�---骞叉帴鐐圭姸鎬侊細" + mData);
+ sensorText.setText("浼犳劅鍣ㄧ姸鎬侊細" + mData);
+ HDLLog.Log("浼犳劅鍣ㄧ姸鎬侊細" + mData);
}
}
diff --git a/app/src/main/java/com/hdl/sdk/ttl_sdk/adapter/HDLAppliancesListAdapter.java b/app/src/main/java/com/hdl/sdk/ttl_sdk/adapter/HDLAppliancesListAdapter.java
index 215fb63..cf2b9a2 100644
--- a/app/src/main/java/com/hdl/sdk/ttl_sdk/adapter/HDLAppliancesListAdapter.java
+++ b/app/src/main/java/com/hdl/sdk/ttl_sdk/adapter/HDLAppliancesListAdapter.java
@@ -34,7 +34,7 @@
private OnItemClickLitener mOnItemClickLitener;
- public HDLAppliancesListAdapter(Context context, List<AppliancesInfo> mmAppliancesInfoList){
+ public HDLAppliancesListAdapter(Context context, List<AppliancesInfo> mmAppliancesInfoList) {
this.mContext = context;
this.mAppliancesInfoList = mmAppliancesInfoList;
}
@@ -49,17 +49,21 @@
@Override
public void onBindViewHolder(final HDLViewHolder holder, final int position) {
AppliancesInfo mAppliancesInfo = mAppliancesInfoList.get(position);
- String mName = mAppliancesInfo.getRemarks();
+ String mName = mAppliancesInfo.getRemarks();
if (TextUtils.isEmpty(mName) || mName.equals(HDLUtlis.REMAEK_NULL)) {
- mName = "澶囨敞涓虹┖";
+ if (TextUtils.isEmpty(mAppliancesInfo.getDeviceName())) {
+ mName = "澶囨敞涓虹┖";
+ } else {
+ mName = mAppliancesInfo.getDeviceName();
+ }
}
holder.mTextView.setText(mName);
- if(mOnItemClickLitener != null){
+ if (mOnItemClickLitener != null) {
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// int pos = holder.getLayoutPosition();
- mOnItemClickLitener.onItemClick( position);
+ mOnItemClickLitener.onItemClick(position);
}
});
}
@@ -90,6 +94,15 @@
//澶х被鏄煶涔愮被鍒欒烦杞埌AudioActivity
holder.mImageView.setBackgroundResource(R.mipmap.ic_item_audio);
break;
+ case Configuration.FRESH_AIR_BIG_TYPE:
+ holder.mImageView.setBackgroundResource(R.mipmap.icon_fresh_air);
+ break;
+ case Configuration.GEOTHERMAL_BIG_TYPE:
+ holder.mImageView.setBackgroundResource(R.mipmap.ic_geothermal);
+ break;
+ case Configuration.DOOR_MACHINE_BIG_TYPE:
+ holder.mImageView.setBackgroundResource(R.mipmap.icon_common_switch);
+ break;
default:
holder.mImageView.setVisibility(View.GONE);
break;
@@ -103,7 +116,7 @@
return mAppliancesInfoList.size();
}
- public static class HDLViewHolder extends RecyclerView.ViewHolder{
+ public static class HDLViewHolder extends RecyclerView.ViewHolder {
private TextView mTextView;
private TextView mTextView_mes;
@@ -118,11 +131,11 @@
}
- public interface OnItemClickLitener{
+ public interface OnItemClickLitener {
void onItemClick(int position);
}
- public void setOnItemClickLitener(OnItemClickLitener onItemClickLitener){
+ public void setOnItemClickLitener(OnItemClickLitener onItemClickLitener) {
this.mOnItemClickLitener = onItemClickLitener;
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/hdl/sdk/ttl_sdk/utlis/RGBColorPicker.java b/app/src/main/java/com/hdl/sdk/ttl_sdk/utlis/RGBColorPicker.java
new file mode 100644
index 0000000..9b82188
--- /dev/null
+++ b/app/src/main/java/com/hdl/sdk/ttl_sdk/utlis/RGBColorPicker.java
@@ -0,0 +1,463 @@
+package com.hdl.sdk.ttl_sdk.utlis;
+
+import android.animation.ValueAnimator;
+import android.content.Context;
+import android.content.res.Resources;
+import android.content.res.TypedArray;
+import android.graphics.BlurMaskFilter;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.MaskFilter;
+import android.graphics.Paint;
+import android.graphics.Path;
+import android.graphics.Point;
+import android.graphics.RadialGradient;
+import android.graphics.RectF;
+import android.graphics.Region;
+import android.graphics.Shader;
+import android.graphics.SweepGradient;
+import android.support.annotation.ColorInt;
+import android.support.annotation.Nullable;
+import android.util.AttributeSet;
+import android.util.DisplayMetrics;
+import android.view.MotionEvent;
+import android.view.View;
+
+import com.hdl.sdk.ttl_sdk.R;
+
+import java.util.Locale;
+
+/**
+ * Created by Tong on 2021/10/27.
+ * Rgb棰滆壊鍦嗙幆閫夋嫨鍣�
+ */
+public class RGBColorPicker extends View {
+
+ private int mWidth, mHeight;
+
+ //鑹�
+ private SweepGradient mHueShader;
+ //楗卞拰搴�
+ private RadialGradient mSaturationShader;
+
+ //鑹叉澘鐢荤瑪
+ private Paint mPalettePaint;
+
+ //鍦嗙洏鑼冨洿
+ private final Region mPaletteScopeRegion = new Region();
+
+ private Paint paint;
+
+
+ //鎸囬拡鍗婂緞
+ private int markSize;
+ private int markColor;
+
+ private int mCurrentColor;
+
+ private MaskFilter maskFilter;
+
+ private float touchX = Float.MAX_VALUE;
+ private float touchY = Float.MAX_VALUE;
+
+ private ColorListener listener;
+
+ private ValueAnimator mDelayAnim;
+
+ public abstract static class DelayColorListener implements ColorListener {
+
+ /**
+ * 寤惰繜500姣
+ */
+ private static final long DEF_DELAY = 500;
+
+ private long lastTime = 0;
+
+ private long delay = DEF_DELAY;
+
+ public DelayColorListener(long delay) {
+ this.delay = delay;
+ }
+
+ public DelayColorListener() {
+ }
+
+ public abstract void onDelayColorChanged(@ColorInt int color, boolean fromUser);
+
+
+ @Override
+ public void onColorSelected(int color, boolean fromUser) {
+ onDelayColorChanged(color, fromUser);
+ }
+
+ @Override
+ public void onColorChange(int color, boolean fromUser) {
+ if (System.currentTimeMillis() - lastTime > delay) {
+ onDelayColorChanged(color, fromUser);
+ lastTime = System.currentTimeMillis();
+ }
+ }
+ }
+
+ public interface ColorListener {
+ /**
+ * 绋冲畾
+ */
+ void onColorSelected(@ColorInt int color, boolean fromUser);
+
+ /**
+ * 棰滆壊鍙樺寲
+ */
+ void onColorChange(@ColorInt int color, boolean fromUser);
+ }
+
+ public RGBColorPicker(Context context) {
+ this(context, null);
+ }
+
+ public RGBColorPicker(Context context, @Nullable AttributeSet attrs) {
+ this(context, attrs, 0);
+ }
+
+ public RGBColorPicker(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ if (attrs != null) {
+ TypedArray a = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.RGBColorPicker, defStyleAttr, 0);
+ markColor = a.getColor(R.styleable.RGBColorPicker_markColor, Color.WHITE);
+
+ markSize = a.getDimensionPixelOffset(R.styleable.RGBColorPicker_markSize, 0);
+
+ mCurrentColor = a.getColor(R.styleable.RGBColorPicker_markColor, Color.WHITE);
+
+ a.recycle();
+ }
+ init();
+ }
+
+ private void init() {
+
+ setLayerType(View.LAYER_TYPE_SOFTWARE, null);
+ paint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ paint.setStyle(Paint.Style.FILL);
+ paint.setStrokeCap(Paint.Cap.ROUND);
+
+
+ mPalettePaint = new Paint();
+
+ }
+
+ @Override
+ protected void onSizeChanged(int w, int h, int oldw, int oldh) {
+ super.onSizeChanged(w, h, oldw, oldh);
+ this.mWidth = getWidth();
+ this.mHeight = getHeight();
+ initPalette();
+
+ }
+
+
+ public void setColorListener(ColorListener listener) {
+ this.listener = listener;
+ }
+
+ @Override
+ protected void onDraw(Canvas canvas) {
+ drawPalette(canvas);
+ drawDropper(canvas);
+ }
+
+ /**
+ * 鍒濆鍖栬皟鑹叉澘
+ */
+ private void initPalette() {
+ float centerX = mWidth * 0.5f;
+ float centerY = mHeight * 0.5f;
+ float radius = Math.min(centerX, centerY);
+
+ mHueShader =
+ new SweepGradient(
+ mWidth * 0.5f,
+ mHeight * 0.5f,
+ new int[]{
+ Color.RED,
+ Color.MAGENTA,
+ Color.BLUE,
+ Color.CYAN,
+ Color.GREEN,
+ Color.YELLOW,
+ Color.RED,
+
+ },
+ new float[]{0.000f, 0.166f, 0.333f, 0.499f, 0.666f, 0.833f, 0.999f});
+
+
+ mSaturationShader =
+ new RadialGradient(
+ centerX, centerY, radius, Color.WHITE, Color.parseColor("#00FFFFFF"), Shader.TileMode.CLAMP);
+
+
+ //鑹茬洏鑼冨洿
+ final Path mPaletteScopePath = new Path();
+ mPaletteScopePath.addCircle(centerX, centerY, radius - markSize * 0.5f, Path.Direction.CW);
+
+ final RectF bounds = new RectF();
+ mPaletteScopePath.computeBounds(bounds, true);
+
+ mPaletteScopeRegion.setPath(mPaletteScopePath, new Region((int) bounds.left, (int) bounds.top, (int) bounds.right, (int) bounds.bottom));
+
+ maskFilter = new BlurMaskFilter(markSize * 0.1f, BlurMaskFilter.Blur.OUTER);
+
+ }
+
+ /**
+ * 鐢诲彇鑹插櫒
+ */
+ private void drawDropper(Canvas canvas) {
+ if (maskFilter == null) return;
+ final float centerX = mWidth * 0.5f;
+ final float centerY = mHeight * 0.5f;
+ final float radius = Math.min(centerX, centerY);
+ final Point point = getNearPoint(touchX, touchY, centerX, centerY, radius, markSize / 2);
+
+ float x = point.x;
+ float y = point.y;
+
+ paint.reset();
+ paint.setStyle(Paint.Style.STROKE);
+ paint.setFlags(Paint.ANTI_ALIAS_FLAG);
+ paint.setMaskFilter(maskFilter);
+ paint.setColor(Color.BLACK);
+ canvas.drawCircle(x, y, markSize * 0.5f, paint);
+
+ paint.reset();
+ paint.setStyle(Paint.Style.FILL);
+ paint.setFlags(Paint.ANTI_ALIAS_FLAG);
+ paint.setColor(markColor);
+ paint.setStrokeWidth(dp2pxAdapt(0.5f));
+ paint.setColor(Color.WHITE);
+ paint.setStyle(Paint.Style.STROKE);
+ canvas.drawCircle(x, y, markSize * 0.5f, paint);
+ }
+
+ /**
+ * 鐢昏皟鑹叉澘
+ */
+ private void drawPalette(Canvas canvas) {
+ final float centerX = mWidth * 0.5f;
+ final float centerY = mHeight * 0.5f;
+ final float radius = Math.min(centerX, centerY);
+
+ mPalettePaint.reset();
+ mPalettePaint.setFlags(Paint.ANTI_ALIAS_FLAG);
+ mPalettePaint.setShader(mHueShader);
+ canvas.drawCircle(centerX, centerY, radius, mPalettePaint);
+
+
+ mPalettePaint.reset();
+ mPalettePaint.setFlags(Paint.ANTI_ALIAS_FLAG);
+ mPalettePaint.setShader(mSaturationShader);
+ canvas.drawCircle(centerX, centerY, radius, mPalettePaint);
+
+
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+ if (mDelayAnim != null) {
+ mDelayAnim.cancel();
+ }
+ float x = event.getX();
+ float y = event.getY();
+
+ int color = getColorByPoint(x, y);
+ this.mCurrentColor = color;
+ switch (event.getAction()) {
+ case MotionEvent.ACTION_DOWN:
+ case MotionEvent.ACTION_MOVE:
+
+ if (listener != null) {
+ listener.onColorChange(color, true);
+ }
+ touchX = x;
+ touchY = y;
+ invalidate();
+
+
+ return true;
+ case MotionEvent.ACTION_UP:
+
+ if (listener != null) {
+ listener.onColorChange(color, true);
+ listener.onColorSelected(color, true);
+ }
+ touchX = x;
+ touchY = y;
+ invalidate();
+
+ return true;
+
+ }
+ return super.onTouchEvent(event);
+
+ }
+
+
+ /**
+ * 鎸囧畾鍧愭爣鏄惁鍦ㄥ渾涓�,鍑忎簡灏忓渾鍦堝崐寰�
+ */
+ private boolean isPointInPalette(float x, float y) {
+ return mPaletteScopeRegion.contains((int) x, (int) y);
+ }
+
+
+ /**
+ * RGB 0绾� 120 缁� 240钃�
+ */
+ private int getColorByPoint(float x, float y) {
+ final float centerX = mWidth * 0.5f;
+ final float centerY = mHeight * 0.5f;
+ final float radius = Math.min(centerX, centerY);
+
+ x = x - centerX;
+ y = y - centerY;
+
+ //鑹茶皟0-360锛岄ケ鍜屽害0-1锛屼寒搴﹁寖鍥�0-1
+ float[] hsv = {0, 0, 1};
+ //鑹茶皟璁$畻瑙掑害
+ hsv[0] = (float) (Math.atan2(y, -x) * 180f / Math.PI) + 180;
+ //楗卞拰搴︼紝浠庡渾蹇冨嚭鍙�0~1
+ double r = Math.sqrt(x * x + y * y);
+ hsv[1] = Math.max(0f, Math.min(1f, (float) (r / radius)));
+ return Color.HSVToColor(hsv);
+ }
+
+ public void setCurrentColor(int mCurrentColor) {
+ if (mDelayAnim != null) {
+ mDelayAnim.cancel();
+ }
+ setCurrentColorInner(mCurrentColor);
+
+ }
+
+ private void setCurrentColorInner(int currentColor) {
+ this.mCurrentColor = currentColor;
+ post(new Runnable() {
+ @Override
+ public void run() {
+ Point point = getPointByColor(mCurrentColor);
+ touchX = point.x;
+ touchY = point.y;
+ invalidate();
+ }
+ });
+
+
+ }
+
+ public void setCurrentColorDelay(final int color) {
+ if (mDelayAnim != null) {
+ mDelayAnim.cancel();
+ }
+
+ //涓嶇浉绛夋墠澶勭悊
+ if (mCurrentColor != color) {
+
+ mDelayAnim = ValueAnimator.ofFloat(0, 1);
+ mDelayAnim.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
+ @Override
+ public void onAnimationUpdate(ValueAnimator animation) {
+ final float p = (float) animation.getAnimatedValue();
+ if (p == 1) {
+ setCurrentColorInner(color);
+ }
+ }
+ });
+ mDelayAnim.setStartDelay(300);
+ mDelayAnim.setDuration(100);
+ mDelayAnim.start();
+ }
+
+
+ }
+
+
+ public int getCurrentColor() {
+ return mCurrentColor;
+ }
+
+ public static String getHexCode(@ColorInt int color) {
+ int a = Color.alpha(color);
+ int r = Color.red(color);
+ int g = Color.green(color);
+ int b = Color.blue(color);
+ return String.format(Locale.getDefault(), "%02X%02X%02X%02X", a, r, g, b);
+ }
+
+ /**
+ * 閫氳繃棰滆壊鑾峰彇鍧愭爣
+ * 鐩稿鍧愭爣
+ */
+ private Point getPointByColor(@ColorInt int color) {
+
+ float[] hsv = {0, 0, 1};
+ Color.colorToHSV(color, hsv);
+ final float centerX = mWidth * 0.5f;
+ final float centerY = mHeight * 0.5f;
+ final float radius = Math.min(centerX, centerY);
+
+ final float d = hsv[1] * radius;
+ //杞负寮у害
+ double radians = Math.toRadians(hsv[0]);
+
+
+ int x = (int) (centerX + (float) (d * Math.cos(radians)));
+ int y = (int) (centerY - (float) (d * Math.sin(radians)));
+
+ return new Point(x, y);
+ }
+
+ /**
+ * 鑾峰彇鏈�杩戣窛绂诲潗鏍囩偣
+ */
+ private Point getNearPoint(float x, float y, float centerX, float centerY, float parentRadius, float markRadius) {
+ Point point = new Point();
+
+ if (isPointInPalette(x, y)) {
+ point.x = (int) x;
+ point.y = (int) y;
+ } else {
+ //璁$畻鏈�杩戝潗鏍�
+ x = x - parentRadius;
+ y = y - parentRadius;
+ int r = (int) (parentRadius - markRadius);
+ //瑙掑害
+ float angle = (float) (Math.atan2(y, -x) * 180f / Math.PI) + 180;
+ //杞负寮у害
+ double radians = Math.toRadians(angle);
+ point.x = (int) (centerX + (float) (r * Math.cos(radians)));
+ point.y = (int) (centerY - (float) (r * Math.sin(radians)));
+ }
+ return point;
+ }
+
+
+ public void setMarkColor(int markColor) {
+ this.markColor = markColor;
+ }
+
+ private static final float WIDTH_DP_BASE = 360;
+
+ //==================鏍规嵁瀵嗗害閫傞厤=========================
+ public static int dp2pxAdapt(float dp) {
+ return dp2pxAdapt(dp, WIDTH_DP_BASE);
+ }
+
+ public static int dp2pxAdapt(float dp, float widthDpBase) {
+ DisplayMetrics dm = Resources.getSystem().getDisplayMetrics();
+ float density = dm.density;
+ float heightDP = dm.heightPixels / density;
+ float widthDP = dm.widthPixels / density;
+ float w = Math.min(widthDP, heightDP);
+ return (int) (dp * w / widthDpBase * density + 0.5f);
+ }
+}
diff --git a/app/src/main/res/layout/activity_ctrl.xml b/app/src/main/res/layout/activity_ctrl.xml
index 1b07e99..afb3bbf 100644
--- a/app/src/main/res/layout/activity_ctrl.xml
+++ b/app/src/main/res/layout/activity_ctrl.xml
@@ -149,12 +149,8 @@
android:id="@+id/sensorText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="杩欎釜鎸夐挳鍋氫紶鎰熷櫒婕旂ず" />
+ android:text="杩欎釜鎸夐挳鍋氫紶鎰熷櫒婕旂ず锛岃Е鍙戜簨浠朵笂鎶ョ姸鎬�" />
- <Button
- android:id="@+id/sensorbtn"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="鑾峰彇浼犳劅鍣ㄧ姸鎬�" />
+
</LinearLayout>
</RelativeLayout>
diff --git a/app/src/main/res/layout/activity_ctrl_air.xml b/app/src/main/res/layout/activity_ctrl_air.xml
index eb547eb..8130367 100644
--- a/app/src/main/res/layout/activity_ctrl_air.xml
+++ b/app/src/main/res/layout/activity_ctrl_air.xml
@@ -4,7 +4,7 @@
android:id="@+id/activity_ctrl"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context="com.hdl.sdk.ttl_sdk.activity.CtrlLightActivity">
+ tools:context="com.hdl.sdk.ttl_sdk.activity.CtrlAirActivity">
<include
android:id="@+id/hdl_top_bar_layout"
diff --git a/app/src/main/res/layout/activity_ctrl_air_hvac.xml b/app/src/main/res/layout/activity_ctrl_air_hvac.xml
index 24e50d6..1483e38 100644
--- a/app/src/main/res/layout/activity_ctrl_air_hvac.xml
+++ b/app/src/main/res/layout/activity_ctrl_air_hvac.xml
@@ -4,7 +4,7 @@
android:id="@+id/activity_ctrl"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context="com.hdl.sdk.ttl_sdk.activity.CtrlLightActivity">
+ tools:context="com.hdl.sdk.ttl_sdk.activity.CtrlAirHVACActivity">
<include
android:id="@+id/hdl_top_bar_layout"
diff --git a/app/src/main/res/layout/activity_ctrl_colour_light.xml b/app/src/main/res/layout/activity_ctrl_colour_light.xml
new file mode 100644
index 0000000..bb671d4
--- /dev/null
+++ b/app/src/main/res/layout/activity_ctrl_colour_light.xml
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/activity_ctrl"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context="com.hdl.sdk.ttl_sdk.activity.CtrlColourLightActivity">
+
+ <include
+ android:id="@+id/hdl_top_bar_layout"
+ layout="@layout/hdl_toolbar_top_view_b" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_below="@+id/hdl_top_bar_layout"
+ android:layout_marginLeft="20dp"
+ android:layout_marginRight="20dp"
+ android:orientation="vertical">
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="40dp"
+ android:gravity="center|left"
+ android:text="CCT鑹叉俯鐏�丷GB鐏ā鍧�"
+ android:textColor="@color/black"
+ android:textSize="@dimen/ts_24" />
+
+ <TextView
+ android:id="@+id/lightText"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="10dp"
+ android:text="杩欎釜鎸夐挳鍋氱伅鍏夌殑婕旂ず"
+ android:textSize="@dimen/ts_20" />
+
+ <Button
+ android:id="@+id/ctrlbtn"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鍏崇伅" />
+
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <Button
+ android:id="@+id/ctrl_brightness"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="璁剧疆浜害锛�" />
+
+ <EditText
+ android:id="@+id/et_brightness"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:inputType="number" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <Button
+ android:id="@+id/ctrl_cct"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="璁剧疆鑹叉俯锛�" />
+
+ <EditText
+ android:id="@+id/et_cct"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:hint="2700-6500"
+ android:inputType="number" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <TextView
+ android:id="@+id/ctrl_rgb"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="璁剧疆RGB锛�" />
+
+ <!--rgb-->
+ <com.hdl.sdk.ttl_sdk.utlis.RGBColorPicker
+ android:id="@+id/rgb_bar"
+ android:layout_width="197dp"
+ android:layout_height="197dp"
+ android:layout_centerHorizontal="true"
+ app:markColor="@color/transparent"
+ app:markSize="32dp" />
+
+ </LinearLayout>
+ </LinearLayout>
+
+</RelativeLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_ctrl_common_switch.xml b/app/src/main/res/layout/activity_ctrl_common_switch.xml
index 634ba97..84450ae 100644
--- a/app/src/main/res/layout/activity_ctrl_common_switch.xml
+++ b/app/src/main/res/layout/activity_ctrl_common_switch.xml
@@ -4,7 +4,7 @@
android:id="@+id/activity_ctrl"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context="com.hdl.sdk.ttl_sdk.activity.CtrlLightActivity">
+ tools:context="com.hdl.sdk.ttl_sdk.activity.CtrlCommonSwitchActivity">
<include
android:id="@+id/hdl_top_bar_layout"
layout="@layout/hdl_toolbar_top_view_b"/>
diff --git a/app/src/main/res/layout/activity_ctrl_jinmao_freshair.xml b/app/src/main/res/layout/activity_ctrl_jinmao_freshair.xml
new file mode 100644
index 0000000..e728390
--- /dev/null
+++ b/app/src/main/res/layout/activity_ctrl_jinmao_freshair.xml
@@ -0,0 +1,166 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/activity_ctrl"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context="com.hdl.sdk.ttl_sdk.activity.FreshAirJinMaoActivity">
+
+ <include
+ android:id="@+id/hdl_top_bar_layout"
+ layout="@layout/hdl_toolbar_top_view_b"/>
+
+ <ScrollView
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_below="@+id/hdl_top_bar_layout">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginRight="20dp"
+ android:layout_marginLeft="20dp"
+ android:orientation="vertical">
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="40dp"
+ android:text="閲戣寕鏂伴璁惧"
+ android:gravity="center|left"
+ android:textSize="@dimen/ts_24"
+ android:textColor="@color/black"
+ />
+
+
+ <LinearLayout
+ android:id="@+id/air"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+
+
+ <LinearLayout
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ <TextView
+ android:textSize="@dimen/ts_15"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="瀹ゅ唴娓╁害锛�" />
+ <TextView
+ android:id="@+id/tv_nowInTemp"
+ android:textSize="@dimen/ts_16"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="@color/black"
+ android:text="20" />
+
+ <TextView
+ android:textSize="@dimen/ts_15"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="50dp"
+ android:text="瀹ゅ唴婀垮害锛�" />
+ <TextView
+ android:id="@+id/tv_nowInHumidty"
+ android:textSize="@dimen/ts_16"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="@color/black"
+ android:text="30%" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ <TextView
+ android:textSize="@dimen/ts_15"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="杩囨护缃戝墿浣欓噺锛�" />
+ <TextView
+ android:id="@+id/tv_filterRemaining"
+ android:textSize="@dimen/ts_16"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="@color/black"
+ android:text="100%" />
+
+ <TextView
+ android:textSize="@dimen/ts_15"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="50dp"
+ android:text="婊ょ綉浣跨敤瓒呮椂锛�" />
+
+ <TextView
+ android:id="@+id/tv_timeout"
+ android:textSize="@dimen/ts_16"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textColor="@color/black"
+ android:text="姝e父" />
+
+ </LinearLayout>
+
+
+ <TextView
+ android:id="@+id/mesText"
+ android:textSize="@dimen/ts_20"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="20dp"
+ android:text="杩欎釜鎸夐挳鍋氭柊椋庤澶囩殑婕旂ず" />
+
+ <Button
+ android:id="@+id/btn_switch"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鏂伴寮�鍏�" />
+
+
+ <Button
+ android:id="@+id/btn_mode"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="杩愯妯″紡" />
+ <Button
+ android:id="@+id/btn_mode2"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鑺傝兘妯″紡" />
+ <Button
+ android:id="@+id/btn_speed"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="椋庨�熸。浣�" />
+ <LinearLayout
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ <Button
+ android:id="@+id/btn_setHumidty"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鐐瑰嚮璁剧疆婀垮害:" />
+ <EditText
+ android:id="@+id/et_Humidty"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:inputType="number"
+ android:hint="婀垮害鑼冨洿锛� 0~100"
+ android:text="20"
+ />
+ </LinearLayout>
+
+
+
+
+ </LinearLayout>
+ </LinearLayout>
+
+ </ScrollView>
+
+</RelativeLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_ctrl_light.xml b/app/src/main/res/layout/activity_ctrl_light.xml
index 41f3336..07c48cf 100644
--- a/app/src/main/res/layout/activity_ctrl_light.xml
+++ b/app/src/main/res/layout/activity_ctrl_light.xml
@@ -8,37 +8,56 @@
<include
android:id="@+id/hdl_top_bar_layout"
- layout="@layout/hdl_toolbar_top_view_b"/>
+ layout="@layout/hdl_toolbar_top_view_b" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:layout_marginRight="20dp"
- android:layout_marginLeft="20dp"
android:layout_below="@+id/hdl_top_bar_layout"
+ android:layout_marginLeft="20dp"
+ android:layout_marginRight="20dp"
android:orientation="vertical">
+
<TextView
android:layout_width="match_parent"
android:layout_height="40dp"
- android:text="鐏厜绫绘ā鍧�"
android:gravity="center|left"
- android:textSize="@dimen/ts_24"
+ android:text="鐏厜绫绘ā鍧�"
android:textColor="@color/black"
- />
+ android:textSize="@dimen/ts_24" />
<TextView
android:id="@+id/lightText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
- android:textSize="@dimen/ts_20"
- android:text="杩欎釜鎸夐挳鍋氱伅鍏夌殑婕旂ず" />
+ android:text="杩欎釜鎸夐挳鍋氱伅鍏夌殑婕旂ず"
+ android:textSize="@dimen/ts_20" />
<Button
android:id="@+id/ctrlbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="鍏崇伅" />
+
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <Button
+ android:id="@+id/ctrl_brightness"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="璁剧疆浜害锛�" />
+
+ <EditText
+ android:id="@+id/et_brightness"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:inputType="number" />
+ </LinearLayout>
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_ctrl_logic.xml b/app/src/main/res/layout/activity_ctrl_logic.xml
index cc4559f..d57887d 100644
--- a/app/src/main/res/layout/activity_ctrl_logic.xml
+++ b/app/src/main/res/layout/activity_ctrl_logic.xml
@@ -4,7 +4,7 @@
android:id="@+id/activity_ctrl"
android:layout_width="match_parent"
android:layout_height="match_parent"
- tools:context="com.hdl.sdk.ttl_sdk.activity.CtrlLightActivity">
+ tools:context="com.hdl.sdk.ttl_sdk.activity.CtrlLogicActivity">
<include
android:id="@+id/hdl_top_bar_layout"
layout="@layout/hdl_toolbar_top_view_b"/>
diff --git a/app/src/main/res/layout/activity_ctrl_technology_system.xml b/app/src/main/res/layout/activity_ctrl_technology_system.xml
new file mode 100644
index 0000000..e15fb11
--- /dev/null
+++ b/app/src/main/res/layout/activity_ctrl_technology_system.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/activity_ctrl"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context="com.hdl.sdk.ttl_sdk.activity.CtrlAirTechSysActivity">
+
+ <include
+ android:id="@+id/hdl_top_bar_layout"
+ layout="@layout/hdl_toolbar_top_view_b"/>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_below="@+id/hdl_top_bar_layout"
+ android:layout_marginRight="20dp"
+ android:layout_marginLeft="20dp"
+ android:orientation="vertical">
+
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="40dp"
+ android:text="绉戞妧绯荤粺鍔熻兘绫绘ā鍧�"
+ android:gravity="center|left"
+ android:textSize="@dimen/ts_24"
+ android:textColor="@color/black"
+ />
+
+ <LinearLayout
+ android:id="@+id/air"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <TextView
+ android:id="@+id/airText"
+ android:textSize="@dimen/ts_20"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="杩欎釜鎸夐挳鍋氱鎶�绯荤粺鐨勬紨绀�" />
+
+ <Button
+ android:id="@+id/airbtn_mode"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="绌鸿皟妯″紡" />
+
+ <LinearLayout
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ <Button
+ android:id="@+id/airbtn_tempBtn"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鐐瑰嚮璁剧疆绌鸿皟娓╁害:" />
+ <EditText
+ android:id="@+id/airet_tempet"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:inputType="number"/>
+ </LinearLayout>
+
+ </LinearLayout>
+ </LinearLayout>
+
+</RelativeLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_door_machine.xml b/app/src/main/res/layout/activity_door_machine.xml
new file mode 100644
index 0000000..7e5a083
--- /dev/null
+++ b/app/src/main/res/layout/activity_door_machine.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/activity_ctrl"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context="com.hdl.sdk.ttl_sdk.activity.DoorMachineActivity">
+
+ <include
+ android:id="@+id/hdl_top_bar_layout"
+ layout="@layout/hdl_toolbar_top_view_b" />
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_below="@+id/hdl_top_bar_layout"
+ android:layout_marginLeft="20dp"
+ android:layout_marginRight="20dp"
+ android:orientation="vertical">
+
+ <LinearLayout
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ <Button
+ android:id="@+id/btn_switch"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="杩滅▼寮�閿�:" />
+ <EditText
+ android:id="@+id/et_password"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:inputType="number"/>
+ </LinearLayout>
+
+ <TextView
+ android:id="@+id/tv_door_machine"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="10dp"
+ android:text="杩欎釜鎸夐挳鍋氶棬閿佺殑婕旂ず"
+ android:textSize="25sp" />
+
+
+ </LinearLayout>
+
+</RelativeLayout>
diff --git a/app/src/main/res/layout/activity_fresh_air.xml b/app/src/main/res/layout/activity_fresh_air.xml
new file mode 100644
index 0000000..1d38b36
--- /dev/null
+++ b/app/src/main/res/layout/activity_fresh_air.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/activity_ctrl"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context="com.hdl.sdk.ttl_sdk.activity.FreshAirActivity">
+
+ <include
+ android:id="@+id/hdl_top_bar_layout"
+ layout="@layout/hdl_toolbar_top_view_b"/>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_below="@+id/hdl_top_bar_layout"
+ android:layout_marginRight="20dp"
+ android:layout_marginLeft="20dp"
+ android:orientation="vertical">
+
+
+ <Button
+ android:id="@+id/btn_switch"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鏂伴绯荤粺寮�鍏�" />
+
+ <Button
+ android:id="@+id/btn_speed"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鏂伴绯荤粺椋庨��" />
+
+ <Button
+ android:id="@+id/btn_mode"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鏂伴绯荤粺妯″紡" />
+
+ <TextView
+ android:id="@+id/tv_fresh_air"
+ android:textSize="25sp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="杩欎釜鎸夐挳鍋氱┖璋冮潰鏉跨殑婕旂ず"
+
+ />
+
+
+
+
+ </LinearLayout>
+
+</RelativeLayout>
diff --git a/app/src/main/res/layout/activity_geothermal.xml b/app/src/main/res/layout/activity_geothermal.xml
new file mode 100644
index 0000000..e4a1be7
--- /dev/null
+++ b/app/src/main/res/layout/activity_geothermal.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/activity_ctrl"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context="com.hdl.sdk.ttl_sdk.activity.GeothermalActivity">
+
+ <include
+ android:id="@+id/hdl_top_bar_layout"
+ layout="@layout/hdl_toolbar_top_view_b"/>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_below="@+id/hdl_top_bar_layout"
+ android:layout_marginRight="20dp"
+ android:layout_marginLeft="20dp"
+ android:orientation="vertical">
+
+ <Button
+ android:id="@+id/btn_switch"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鍦扮儹寮�鍏�" />
+ <Button
+ android:id="@+id/btn_mode"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鍦扮儹妯″紡" />
+
+
+ <LinearLayout
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="50dp"
+ android:focusable="true"
+ android:focusableInTouchMode="true">
+ <Button
+ android:id="@+id/btn_temp"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鐐瑰嚮璁剧疆鍦扮儹娓╁害:" />
+ <EditText
+ android:id="@+id/et_temp"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:inputType="number"
+ />
+
+
+ </LinearLayout>
+ <TextView
+ android:id="@+id/tv_geothermal"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="10dp"
+ android:textSize="25sp"
+ android:text="杩欎釜鎸夐挳鍋氬湴鐑ā鍧楃殑婕旂ず" />
+
+
+
+ </LinearLayout>
+
+</RelativeLayout>
diff --git a/app/src/main/res/layout/activity_sensor.xml b/app/src/main/res/layout/activity_sensor.xml
index e8af678..7e7470e 100644
--- a/app/src/main/res/layout/activity_sensor.xml
+++ b/app/src/main/res/layout/activity_sensor.xml
@@ -4,7 +4,7 @@
android:id="@+id/activity_ctrl"
android:layout_width="match_parent"
android:layout_height="match_parent"
-tools:context="com.hdl.sdk.ttl_sdk.activity.MCUActivity">
+tools:context="com.hdl.sdk.ttl_sdk.activity.SensorActivity">
<include
android:id="@+id/hdl_top_bar_layout"
@@ -25,13 +25,8 @@
android:id="@+id/sensorText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="杩欎釜鎸夐挳鍋氫紶鎰熷櫒婕旂ず" />
+ android:text="杩欎釜鎸夐挳鍋氫紶鎰熷櫒婕旂ず锛岃Е鍙戜簨浠朵笂鎶ョ姸鎬�" />
- <Button
- android:id="@+id/sensorbtn"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="鑾峰彇浼犳劅鍣ㄧ姸鎬�" />
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-mdpi/ic_geothermal.png b/app/src/main/res/mipmap-mdpi/ic_geothermal.png
new file mode 100644
index 0000000..f45b1ae
--- /dev/null
+++ b/app/src/main/res/mipmap-mdpi/ic_geothermal.png
Binary files differ
diff --git a/app/src/main/res/mipmap-mdpi/icon_common_switch.png b/app/src/main/res/mipmap-mdpi/icon_common_switch.png
new file mode 100644
index 0000000..240d807
--- /dev/null
+++ b/app/src/main/res/mipmap-mdpi/icon_common_switch.png
Binary files differ
diff --git a/app/src/main/res/mipmap-mdpi/icon_fresh_air.png b/app/src/main/res/mipmap-mdpi/icon_fresh_air.png
new file mode 100644
index 0000000..6b24483
--- /dev/null
+++ b/app/src/main/res/mipmap-mdpi/icon_fresh_air.png
Binary files differ
diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml
new file mode 100644
index 0000000..188c411
--- /dev/null
+++ b/app/src/main/res/values/attrs.xml
@@ -0,0 +1,424 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <declare-styleable name="OcDialView">
+
+ <!--鏈�澶у埢搴﹀��-->
+ <attr name="maxScale" format="integer" />
+ <attr name="minScale" format="integer" />
+ <attr name="scaleGap" format="integer" />
+
+ <!--鍒诲害-->
+ <attr name="scaleHeight" format="dimension" />
+ <attr name="scaleWidth" format="dimension" />
+ <attr name="scaleColor" format="color|reference" />
+
+ <!--鎸囬拡-->
+ <attr name="pointerHeight" format="dimension" />
+ <attr name="pointerWidth" format="dimension" />
+ <attr name="pointerColor" format="color|reference" />
+ <!--鎸囬拡宸﹁竟鑼冨洿鎴栬�呭彸杈硅寖鍥�-->
+ <attr name="pointerLimit" format="integer" />
+ <!--鏂囧瓧澶у皬-->
+ <attr name="android:textSize" />
+ <attr name="android:textColor" />
+ </declare-styleable>
+
+ <attr name="markColor" format="color|reference" />
+ <attr name="markSize" format="dimension" />
+
+ <declare-styleable name="SeekBarView">
+ <!--鑳屾櫙-->
+ <attr name="trackTopLeftRadius" format="dimension" />
+ <attr name="trackTopRightRadius" format="dimension" />
+ <attr name="trackBottomLeftRadius" format="dimension" />
+ <attr name="trackBottomRightRadius" format="dimension" />
+ <attr name="trackRadius" format="dimension" />
+
+ <!--婊戝姩杞ㄨ抗-->
+ <attr name="thumbTopLeftRadius" format="dimension" />
+ <attr name="thumbTopRightRadius" format="dimension" />
+ <attr name="thumbBottomLeftRadius" format="dimension" />
+ <attr name="thumbBottomRightRadius" format="dimension" />
+ <attr name="thumbRadius" format="dimension" />
+
+ <attr name="trackColor" format="color|reference" />
+ <attr name="trackSecondColor" format="color|reference" />
+ <attr name="thumbColor" format="color|reference" />
+ <attr name="thumbSecondColor" format="color|reference" />
+
+ <attr name="markColor" />
+ <attr name="markSize" />
+
+ <attr name="maxProgress" format="integer" />
+ <attr name="minProgress" format="integer" />
+ <attr name="progress" format="integer" />
+ <attr name="barSize" format="dimension" />
+
+ <attr name="orientation">
+ <enum name="horizontal" value="0" />
+ <enum name="vertical" value="1" />
+ </attr>
+
+ </declare-styleable>
+
+
+ <attr name="currentColor" format="color|reference" />
+ <declare-styleable name="RingColorPicker">
+ <!--榛樿瑙掑害-->
+ <attr name="angle" format="float" />
+ <!--鍦嗗舰閫夋嫨鍣ㄥ~鍏呰壊-->
+ <attr name="markBackground" format="color|reference" />
+ <!--鍦嗗舰閫夋嫨鍣ㄨ竟妗嗛鑹�-->
+ <attr name="markStrokeColor" format="color|reference" />
+ <!--鍦嗗舰閫夋嫨鍣ㄦ弿杈�-->
+ <attr name="isMarkStroke" format="boolean" />
+ <!--鍦嗙幆瀹藉害-->
+ <attr name="ringWidth" format="dimension" />
+ <!--閫夋嫨鍣ㄨ嚜鍔ㄨ壊-->
+ <attr name="isMarkAutoColor" format="boolean" />
+ <!--鎵╂暎鐗规晥閫忔槑搴�-->
+ <attr name="spreadAlpha" format="integer" />
+ <!--閫夋嫨鍣ㄦ弿杈瑰搴�-->
+ <attr name="markStrokeWidth" format="dimension|reference" />
+ <!--涓績鎸夐挳鍥惧儚璧勬簮-->
+ <attr name="srcCompat" />
+ <!--涓績鎸夐挳鍥惧儚閫忔槑搴�-->
+ <attr name="centerImageAlpha" format="integer" />
+ <!--涓績澶嶉�夌姸鎬�-->
+ <attr name="checked" format="boolean" />
+ <!--褰撳墠鎸囧悜鐨勯鑹�-->
+ <attr name="currentColor" />
+ <!--杩囨护棰滆壊-->
+ <attr name="tint" />
+ <!--瑙嗗浘鏍峰紡-->
+ <attr name="colorPickerStyle" format="enum">
+ <enum name="MARK_RING_INNER" value="0" />
+ <enum name="MARK_RING_OUTER" value="1" />
+ <enum name="MARK_RING_DOWN_OUTER" value="2" />
+ </attr>
+ </declare-styleable>
+
+ <declare-styleable name="RGBColorPicker">
+ <attr name="markColor" />
+ <attr name="markSize" />
+ <attr name="currentColor" />
+ </declare-styleable>
+
+ <!--绫讳技棣栭〉鍗$墖鐢ㄥ埌-->
+ <attr name="cardBackgroundColor" format="color" />
+ <attr name="cardBorderWidth" format="reference|dimension" />
+ <attr name="cardRadius" format="reference|dimension" />
+ <declare-styleable name="ExpandLayout">
+ <attr name="android:radius" />
+
+ <attr name="cardBorderWidth" />
+ <attr name="cardBackgroundColor" />
+
+ </declare-styleable>
+
+
+ <declare-styleable name="CardLayout">
+ <attr name="cardRadius" />
+ <attr name="cardBorderWidth" />
+ <attr name="cardBackgroundColor" />
+ </declare-styleable>
+ <!--绫讳技棣栭〉鍗$墖鐢ㄥ埌-->
+
+ <!--瑙掓爣-->
+ <declare-styleable name="BadgeView">
+ <attr name="badgePadding" format="reference|dimension" />
+ <attr name="badgeTextSize" format="reference|dimension" />
+ <attr name="badgeBackgroundColor" format="color|reference" />
+ <attr name="badgeBorderWidth" format="reference|dimension" />
+ <attr name="badgeBorderColor" format="reference|dimension" />
+ <attr name="badgeTextColor" format="color|reference" />
+ <attr name="showShadow" format="boolean" />
+ </declare-styleable>
+
+ <declare-styleable name="LoadingView">
+
+ </declare-styleable>
+
+
+ <!--SeekBar-->
+ <declare-styleable name="SmartSeekBar">
+
+ <!--鏈�澶у��-->
+ <attr name="sb_max" format="float" />
+ <!--鏈�灏忓��-->
+ <attr name="sb_min" format="float" />
+
+ <attr name="sb_gravity" format="enum">
+ <enum name="top" value="0" />
+ <enum name="bottom" value="1" />
+ <enum name="center" value="2" />
+ </attr>
+
+ <!--鍒诲害-->
+
+ <!--鏈�灏忛棿闅�-->
+ <attr name="sb_min_interval" format="float" />
+ <!-- 0 for the normal mode, greater than 1 to switch to scale mode-->
+ <attr name="sb_tick_mark_number" format="integer" />
+
+ <attr name="sb_tick_mark_mode" format="enum">
+ <!--鎸夋暟缁勬潵-->
+ <enum name="number" value="0" />
+ <!--骞冲垎-->
+ <enum name="other" value="1" />
+ </attr>
+
+ <!--The tick mark text gravity -->
+ <attr name="sb_tick_mark_gravity" format="enum">
+ <enum name="left" value="0" />
+ <enum name="center" value="1" />
+ <enum name="right" value="2" />
+ </attr>
+
+ <!--The tick mark text layout gravity -->
+ <attr name="sb_tick_mark_layout_gravity" format="enum">
+ <enum name="top" value="0" />
+ <enum name="bottom" value="1" />
+ </attr>
+
+ <!--The tick mark text array -->
+ <attr name="sb_tick_mark_text_array" format="reference" />
+
+ <!--The tick mark text margin bottom to progress -->
+ <attr name="sb_tick_mark_text_margin" format="dimension" />
+
+ <attr name="sb_tick_mark_text_size" format="dimension" />
+
+ <attr name="sb_tick_mark_text_color" format="color" />
+
+ <!--it just work in range && number mode now-->
+ <attr name="sb_tick_mark_in_range_text_color" format="color" />
+
+ <!--杩涘害鏉�-->
+ <attr name="sb_progress_height" format="dimension" />
+ <attr name="sb_progress_radius" format="dimension" />
+ <attr name="sb_progress_color" format="color" />
+ <attr name="sb_progress_drawable" format="reference" />
+
+ <!--搴�-->
+ <attr name="sb_progress_default_color" format="color" />
+ <attr name="sb_progress_drawable_default" format="reference" />
+
+
+ <!--鎸囩ず鍣�-->
+ <attr name="sb_indicator_show_mode" format="enum">
+ <enum name="showWhenTouch" value="0" />
+ <enum name="alwaysHide" value="1" />
+ <enum name="alwaysShowAfterTouch" value="2" />
+ <enum name="alwaysShow" value="3" />
+ </attr>
+
+ <attr name="sb_indicator_height" format="dimension" />
+ <attr name="sb_indicator_width" format="dimension" />
+ <attr name="sb_indicator_margin" format="dimension" />
+ <attr name="sb_indicator_text_size" format="dimension" />
+ <attr name="sb_indicator_text_color" format="color" />
+ <attr name="sb_indicator_arrow_size" format="dimension" />
+ <attr name="sb_indicator_drawable" format="reference" />
+ <attr name="sb_indicator_background_color" format="color" />
+ <attr name="sb_indicator_padding_left" format="dimension" />
+ <attr name="sb_indicator_padding_right" format="dimension" />
+ <attr name="sb_indicator_padding_top" format="dimension" />
+ <attr name="sb_indicator_padding_bottom" format="dimension" />
+ <attr name="sb_indicator_radius" format="dimension" />
+
+
+ <!--瑙︽懜鍧�-->
+ <attr name="sb_thumb_drawable" format="reference" />
+ <attr name="sb_thumb_inactivated_drawable" format="reference" />
+ <attr name="sb_thumb_width" format="dimension" />
+ <attr name="sb_thumb_height" format="dimension" />
+ <attr name="sb_thumb_scale_ratio" format="float" />
+
+
+ <!--鍒嗘-->
+ <attr name="sb_steps" format="integer" />
+ <attr name="sb_step_color" format="color" />
+ <attr name="sb_step_width" format="dimension" />
+ <attr name="sb_step_height" format="dimension" />
+ <attr name="sb_step_radius" format="dimension" />
+ <attr name="sb_step_auto_bonding" format="boolean" />
+ <attr name="sb_step_drawable" format="reference" />
+
+ </declare-styleable>
+
+ <declare-styleable name="VerticalSmartSeekBar">
+ <!--the vertical RangeSeekBar draw orientation-->
+ <attr name="sb_orientation" format="enum">
+ <enum name="top" value="1" />
+ <enum name="bottom" value="2" />
+ </attr>
+ <attr name="sb_tick_mark_orientation" format="enum">
+ <enum name="vertical" value="1" />
+ <enum name="horizontal" value="2" />
+ </attr>
+ <attr name="sb_indicator_text_orientation" format="enum">
+ <enum name="vertical" value="1" />
+ <enum name="horizontal" value="2" />
+ </attr>
+ </declare-styleable>
+ <!--SeekBar-->
+
+ <declare-styleable name="RangeSeekBar">
+ <!--RangeSeekBar common attrs-->
+
+ <!--The maximum-->
+ <attr name="rsb_max" format="float"/>
+
+ <!--The minimum-->
+ <attr name="rsb_min" format="float"/>
+
+ <!--RangeSeekBar mode, single is normal seekBar, range is RangeSeekBar-->
+ <attr name="rsb_mode" format="enum">
+ <enum name="single" value="1"/>
+ <enum name="range" value="2"/>
+ </attr>
+
+ <!--RangeSeekBar gravity-->
+ <attr name="rsb_gravity" format="enum">
+ <enum name="top" value="0"/>
+ <enum name="bottom" value="1"/>
+ <enum name="center" value="2"/>
+ </attr>
+
+ <!--The min interval of the thumbs -->
+ <attr name="rsb_min_interval" format="float"/>
+
+ <!-- 0 for the normal mode, greater than 1 to switch to scale mode-->
+ <attr name="rsb_tick_mark_number" format="integer"/>
+
+ <!--Scale mode
+ Number according to the scale of the actual proportion of the distribution of the location (markTextArray must be a number)
+ Other bisects the current layout (markTextArray can be any character)
+ -->
+ <attr name="rsb_tick_mark_mode" format="enum">
+ <enum name="number" value="0"/>
+ <enum name="other" value="1"/>
+ </attr>
+
+ <!--The tick mark text gravity -->
+ <attr name="rsb_tick_mark_gravity" format="enum">
+ <enum name="left" value="0"/>
+ <enum name="center" value="1"/>
+ <enum name="right" value="2"/>
+ </attr>
+
+ <!--The tick mark text layout gravity -->
+ <attr name="rsb_tick_mark_layout_gravity" format="enum">
+ <enum name="top" value="0"/>
+ <enum name="bottom" value="1"/>
+ </attr>
+
+ <!--The tick mark text array -->
+ <attr name="rsb_tick_mark_text_array" format="reference"/>
+
+ <!--The tick mark text margin bottom to progress -->
+ <attr name="rsb_tick_mark_text_margin" format="dimension" />
+
+ <attr name="rsb_tick_mark_text_size" format="dimension" />
+
+ <attr name="rsb_tick_mark_text_color" format="color" />
+
+ <!--it just work in range && number mode now-->
+ <attr name="rsb_tick_mark_in_range_text_color" format="color" />
+
+ <attr name="rsb_progress_height" format="dimension"/>
+
+ <attr name="rsb_progress_radius" format="dimension"/>
+
+ <!--the color of progress bar when in progress-->
+ <attr name="rsb_progress_color" format="color"/>
+ <!--the default color of the progress bar-->
+ <attr name="rsb_progress_default_color" format="color"/>
+
+ <attr name="rsb_progress_drawable" format="reference"/>
+
+ <attr name="rsb_progress_drawable_default" format="reference"/>
+
+ <!--SeekBar attrs-->
+ <attr name="rsb_indicator_show_mode" format="enum">
+ <enum name="showWhenTouch" value="0"/>
+ <enum name="alwaysHide" value="1"/>
+ <enum name="alwaysShowAfterTouch" value="2"/>
+ <enum name="alwaysShow" value="3"/>
+ </attr>
+ <attr name="rsb_indicator_height" format="dimension" >
+ <enum name="wrap_content" value="-1" />
+ </attr>
+ <attr name="rsb_indicator_width" format="dimension" >
+ <enum name="wrap_content" value="-1" />
+ </attr>
+ <!--indicator margin bottom to progress bar-->
+ <attr name="rsb_indicator_margin" format="dimension" />
+ <attr name="rsb_indicator_text_size" format="dimension" />
+ <attr name="rsb_indicator_text_color" format="color" />
+ <!--indicator arrow size, it just work when you not use rsb_indicator_drawable -->
+ <attr name="rsb_indicator_arrow_size" format="dimension" />
+ <!-- must use 9 path 锛侊紒锛�-->
+ <attr name="rsb_indicator_drawable" format="reference"/>
+ <attr name="rsb_indicator_background_color" format="color" />
+ <attr name="rsb_indicator_padding_left" format="dimension" />
+ <attr name="rsb_indicator_padding_right" format="dimension" />
+ <attr name="rsb_indicator_padding_top" format="dimension" />
+ <attr name="rsb_indicator_padding_bottom" format="dimension" />
+ <attr name="rsb_indicator_radius" format="dimension" />
+ <attr name="rsb_thumb_drawable" format="reference"/>
+ <!--the thumb inactivated is when you don't touch the thumb button-->
+ <attr name="rsb_thumb_inactivated_drawable" format="reference"/>
+ <attr name="rsb_thumb_width" format="dimension"/>
+ <attr name="rsb_thumb_height" format="dimension"/>
+ <attr name="rsb_thumb_scale_ratio" format="float"/>
+
+ <!--steps SeekBar-->
+ <attr name="rsb_steps" format="integer"/>
+ <attr name="rsb_step_color" format="color"/>
+ <attr name="rsb_step_width" format="dimension"/>
+ <attr name="rsb_step_height" format="dimension"/>
+ <attr name="rsb_step_radius" format="dimension"/>
+ <attr name="rsb_step_auto_bonding" format="boolean"/>
+ <attr name="rsb_step_drawable" format="reference"/>
+
+ </declare-styleable>
+
+ <declare-styleable name="VerticalRangeSeekBar">
+ <!--the vertical RangeSeekBar draw orientation-->
+ <attr format="enum" name="rsb_orientation">
+ <enum name="left" value="1"/>
+ <enum name="right" value="2"/>
+ </attr>
+ <attr format="enum" name="rsb_tick_mark_orientation">
+ <enum name="vertical" value="1"/>
+ <enum name="horizontal" value="2"/>
+ </attr>
+ <attr format="enum" name="rsb_indicator_text_orientation">
+ <enum name="vertical" value="1"/>
+ <enum name="horizontal" value="2"/>
+ </attr>
+ </declare-styleable>
+
+ <declare-styleable name="GifImageView">
+ <!--gif鏂囦欢寮曠敤-->
+ <attr name="gif_src" format="reference" />
+ <!--鏄惁鍔犺浇瀹岃嚜鍔ㄦ挱鏀�-->
+ <attr name="auth_play" format="boolean" />
+ <!--鎾斁娆℃斁锛岄粯璁ゆ案杩滄挱鏀�-->
+ <attr name="play_count" format="integer" />
+ <!--鎾斁瀹屾垚鍚庢槸鍚﹀仠鐣欏湪鏈�鍚庝竴甯э紝榛樿false-->
+ <attr name="end_last_frame" format="boolean" />
+ </declare-styleable>
+
+ <declare-styleable name="Battery">
+ <attr name="batteryOrientation">
+ <enum name="horizontal" value="0"/>
+ <enum name="vertical" value="1"/>
+ </attr>
+ <attr name="batteryColor" format="color"/>
+ <attr name="batteryPower" format="integer"/>
+ </declare-styleable>
+</resources>
\ No newline at end of file
--
Gitblit v1.8.0