From 071a8328823a2861f93ce556a4da3e4119cab1a3 Mon Sep 17 00:00:00 2001
From: panlili2024 <14743743+panlili2024@user.noreply.gitee.com>
Date: 星期四, 19 九月 2024 16:24:28 +0800
Subject: [PATCH] 完成金茂定制功能
---
.idea/deploymentTargetSelector.xml | 10
app/src/main/java/com/hdl/sdk/ttl_sdk/activity/AppliancesListActivity.java | 7
app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlCurtainActivity.java | 177 +
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLLogic/LogicMode.java | 2
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/ScenesData.java | 84
.idea/encodings.xml | 2
bussdk.jks | 0
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLTtlSdk.java | 2
app/src/main/java/com/hdl/sdk/ttl_sdk/utlis/HDLUriUtils.java | 5
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLDeviceManager.java | 1154 +++++------
gradlew.bat | 43
.idea/misc.xml | 152 -
app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlLightActivity.java | 2
app/src/main/java/com/hdl/sdk/ttl_sdk/adapter/HDLSceneListAdapter.java | 94
.idea/migrations.xml | 10
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Config/Global.java | 17
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAirCondition/AirTechSysBackInfo.java | 9
app/src/main/res/layout/activity_ctrl_knxtechnology_system.xml | 81
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAudio/HDLAudio.java | 9
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAirCondition/AirHVACBackInfo.java | 1
app/src/main/res/layout/activity_main.xml | 105
app/src/main/res/layout/activity_appliances_new.xml | 4
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/ListSceneRemarks.java | 26
app/build.gradle | 1
app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlCommonSwitchActivity.java | 2
gradlew | 286 +-
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Utils/HDLUtlis/HDLStringUtils.java | 4
app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlActivity.java | 71
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Config/Configuration.java | 16
app/src/main/res/layout/activity_ctrl_scene.xml | 45
app/src/main/res/values/strings.xml | 2
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/DevicesData.java | 34
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/SendDatas.java | 352 +++
app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlSceneActivity.java | 193 +
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/Crc.java | 32
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLDoorMachine/Parser/DoorMachineParser.java | 4
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/SceneFeedBackEvent.java | 30
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLSerialPortCore.java | 191 -
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/AppliancesInfo.java | 69
app/src/main/java/com/hdl/sdk/ttl_sdk/activity/SensorActivity.java | 444 +---
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Utils/HDLUtlis/HDLUtlis.java | 39
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HandleSearch.java | 407 +++-
app/src/main/java/com/hdl/sdk/ttl_sdk/HDLApplication.java | 4
app/src/main/res/layout/activity_ctrl_curtain.xml | 61
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLCurtain/CurtainCtrlBackInfo.java | 78
app/src/main/java/com/hdl/sdk/ttl_sdk/activity/MainActivity.java | 40
app/src/main/res/layout/activity_sensor.xml | 7
app/src/main/java/com/hdl/sdk/ttl_sdk/activity/SendTestActivity.java | 15
gradle/wrapper/gradle-wrapper.jar | 0
app/src/main/java/com/hdl/sdk/ttl_sdk/base/BaseActivity.java | 7
gradle/wrapper/gradle-wrapper.properties | 3
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLFreshAir/Parser/FreshAirJinMaoParser.java | 4
app/src/main/java/com/hdl/sdk/ttl_sdk/adapter/HDLAppliancesListAdapter.java | 12
app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlAirKNXTechSysActivity.java | 319 +++
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLGeothermal/Parser/GeothermalParser.java | 8
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/ScenesInfoEvent.java | 33
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/CurtainDeviceStateEvent.java | 34
build.gradle | 3
hdlhome.jks | 0
HDL_TTLSDK485/build.gradle | 6
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/Config/HDLApConfig.java | 4
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Parser/DeviceParser.java | 130
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/ReceiveData.java | 7
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLFreshAir/Parser/FreshAirParser.java | 4
app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlAirHVACActivity.java | 3
app/src/main/java/com/hdl/sdk/ttl_sdk/adapter/HDLMainListAdapter.java | 7
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLCommand.java | 248 +
app/src/main/java/com/hdl/sdk/ttl_sdk/activity/AddDevicesManuallyActivity.java | 3
app/src/main/AndroidManifest.xml | 2
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLLogic/SceneCtrlBackInfo.java | 38
app/src/main/res/layout/hdl_toolbar_top_view_b.xml | 4
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Utils/HDLUtlis/SerialPortSendAndReceiveUtil.java | 389 ++++
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLCurtain/Parser/CurtainCtrlParser.java | 10
gradle.properties | 6
app/src/main/java/com/hdl/sdk/ttl_sdk/utlis/RGBColorPicker.java | 5
HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAirCondition/Parser/AirCtrlParser.java | 19
app/src/androidTest/java/com/hdl/sdk/ttl_sdk/ExampleInstrumentedTest.java | 54
77 files changed, 3,806 insertions(+), 1,979 deletions(-)
diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml
new file mode 100644
index 0000000..b268ef3
--- /dev/null
+++ b/.idea/deploymentTargetSelector.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="deploymentTargetSelector">
+ <selectionStates>
+ <SelectionState runConfigName="app">
+ <option name="selectionMode" value="DROPDOWN" />
+ </SelectionState>
+ </selectionStates>
+ </component>
+</project>
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
index 97626ba..c3f501e 100644
--- a/.idea/encodings.xml
+++ b/.idea/encodings.xml
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
+ <file url="file://$PROJECT_DIR$/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/ReceiveData.java" charset="GBK" />
+ <file url="file://$PROJECT_DIR$/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Utils/HDLUtlis/SPDataSet.java" charset="GBK" />
<file url="PROJECT" charset="UTF-8" />
</component>
</project>
\ No newline at end of file
diff --git a/.idea/migrations.xml b/.idea/migrations.xml
new file mode 100644
index 0000000..f8051a6
--- /dev/null
+++ b/.idea/migrations.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectMigrations">
+ <option name="MigrateToGradleLocalJavaHome">
+ <set>
+ <option value="$PROJECT_DIR$" />
+ </set>
+ </option>
+ </component>
+</project>
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 4b6796a..af0d780 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,156 +1,6 @@
-<?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" />
- </component>
- <component name="MarkdownProjectSettings">
- <PreviewSettings splitEditorLayout="SPLIT" splitEditorPreview="PREVIEW" useGrayscaleRendering="false" zoomFactor="1.0" maxImageWidth="0" showGitHubPageIfSynced="false" allowBrowsingInPreview="false" synchronizePreviewPosition="true" highlightPreviewType="NONE" highlightFadeOut="5" highlightOnTyping="true" synchronizeSourcePosition="true" verticallyAlignSourceAndPreviewSyncPosition="true" showSearchHighlightsInPreview="false" showSelectionInPreview="true">
- <PanelProvider>
- <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.panel" providerName="Default - Swing" />
- </PanelProvider>
- </PreviewSettings>
- <ParserSettings gitHubSyntaxChange="false">
- <PegdownExtensions>
- <option name="ABBREVIATIONS" value="false" />
- <option name="ANCHORLINKS" value="true" />
- <option name="ASIDE" value="false" />
- <option name="ATXHEADERSPACE" value="true" />
- <option name="AUTOLINKS" value="true" />
- <option name="DEFINITIONS" value="false" />
- <option name="DEFINITION_BREAK_DOUBLE_BLANK_LINE" value="false" />
- <option name="FENCED_CODE_BLOCKS" value="true" />
- <option name="FOOTNOTES" value="false" />
- <option name="HARDWRAPS" value="false" />
- <option name="HTML_DEEP_PARSER" value="false" />
- <option name="INSERTED" value="false" />
- <option name="QUOTES" value="false" />
- <option name="RELAXEDHRULES" value="true" />
- <option name="SMARTS" value="false" />
- <option name="STRIKETHROUGH" value="true" />
- <option name="SUBSCRIPT" value="false" />
- <option name="SUPERSCRIPT" value="false" />
- <option name="SUPPRESS_HTML_BLOCKS" value="false" />
- <option name="SUPPRESS_INLINE_HTML" value="false" />
- <option name="TABLES" value="true" />
- <option name="TASKLISTITEMS" value="true" />
- <option name="TOC" value="false" />
- <option name="WIKILINKS" value="true" />
- </PegdownExtensions>
- <ParserOptions>
- <option name="COMMONMARK_LISTS" value="true" />
- <option name="DUMMY" value="false" />
- <option name="EMOJI_SHORTCUTS" value="true" />
- <option name="FLEXMARK_FRONT_MATTER" value="false" />
- <option name="GFM_LOOSE_BLANK_LINE_AFTER_ITEM_PARA" value="false" />
- <option name="GFM_TABLE_RENDERING" value="true" />
- <option name="GITBOOK_URL_ENCODING" value="false" />
- <option name="GITHUB_EMOJI_URL" value="false" />
- <option name="GITHUB_LISTS" value="false" />
- <option name="GITHUB_WIKI_LINKS" value="true" />
- <option name="JEKYLL_FRONT_MATTER" value="false" />
- <option name="SIM_TOC_BLANK_LINE_SPACER" value="true" />
- </ParserOptions>
- </ParserSettings>
- <HtmlSettings headerTopEnabled="false" headerBottomEnabled="false" bodyTopEnabled="false" bodyBottomEnabled="false" embedUrlContent="false" addPageHeader="true">
- <GeneratorProvider>
- <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.generator" providerName="Default Swing HTML Generator" />
- </GeneratorProvider>
- <headerTop />
- <headerBottom />
- <bodyTop />
- <bodyBottom />
- </HtmlSettings>
- <CssSettings previewScheme="UI_SCHEME" cssUri="" isCssUriEnabled="false" isCssTextEnabled="false" isDynamicPageWidth="true">
- <StylesheetProvider>
- <provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.css" providerName="Default Swing Stylesheet" />
- </StylesheetProvider>
- <ScriptProviders />
- <cssText />
- </CssSettings>
- <HtmlExportSettings updateOnSave="false" parentDir="$ProjectFileDir$" targetDir="$ProjectFileDir$" cssDir="" scriptDir="" plainHtml="false" imageDir="" copyLinkedImages="false" imageUniquifyType="0" targetExt="" useTargetExt="false" noCssNoScripts="false" linkToExportedHtml="true" exportOnSettingsChange="true" regenerateOnProjectOpen="false" />
- <LinkMapSettings>
- <textMaps />
- </LinkMapSettings>
- </component>
- <component name="NullableNotNullManager">
- <option name="myDefaultNullable" value="android.support.annotation.Nullable" />
- <option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
- <option name="myNullables">
- <value>
- <list size="15">
- <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
- <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
- <item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
- <item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
- <item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
- <item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
- <item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
- <item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.Nullable" />
- <item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" />
- <item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" />
- <item index="10" class="java.lang.String" itemvalue="android.annotation.Nullable" />
- <item index="11" class="java.lang.String" itemvalue="com.android.annotations.Nullable" />
- <item index="12" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.Nullable" />
- <item index="13" class="java.lang.String" itemvalue="io.reactivex.annotations.Nullable" />
- <item index="14" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.Nullable" />
- </list>
- </value>
- </option>
- <option name="myNotNulls">
- <value>
- <list size="14">
- <item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
- <item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
- <item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
- <item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
- <item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
- <item index="5" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
- <item index="6" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.NonNull" />
- <item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" />
- <item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" />
- <item index="9" class="java.lang.String" itemvalue="android.annotation.NonNull" />
- <item index="10" class="java.lang.String" itemvalue="com.android.annotations.NonNull" />
- <item index="11" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.NonNull" />
- <item index="12" class="java.lang.String" itemvalue="io.reactivex.annotations.NonNull" />
- <item index="13" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.NonNull" />
- </list>
- </value>
- </option>
- </component>
- <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
+ <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="corretto-1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
- </component>
- <component name="ProjectType">
- <option name="id" value="Android" />
</component>
</project>
\ No newline at end of file
diff --git a/HDL_TTLSDK485/build.gradle b/HDL_TTLSDK485/build.gradle
index 922a725..fdec5b7 100644
--- a/HDL_TTLSDK485/build.gradle
+++ b/HDL_TTLSDK485/build.gradle
@@ -7,8 +7,8 @@
defaultConfig {
minSdkVersion 17
targetSdkVersion 28
- versionCode 2
- versionName "1.1.0"
+ versionCode 6
+ versionName "1.2.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
ndk {
@@ -35,7 +35,7 @@
*/
android.libraryVariants.all { variant ->
variant.outputs.all {
- outputFileName = "HDL_TTLSDK485_V" +
+ outputFileName = "HDL_BusSDK485_V" +
defaultConfig.versionName + ".B" + defaultConfig.versionCode + "." + releaseTime() + ".aar"
}
}
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 2766550..f9e5ed4 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
@@ -120,6 +120,20 @@
public static final int DEVICES_SEARCH_BACK_COMMAND = 0xE549;
public static final int DEVICES_READ_COMMAND = 0xE44A;//绠�鏄撶紪绋嬩緷娆′粠璁惧璇诲彇(鑾峰彇澶囨敞淇℃伅)
public static final int DEVICES_READ_BACK_COMMAND = 0xE44B;//绠�鏄撶紪绋嬭鍙栬繑鍥�(鏀跺埌澶囨敞淇℃伅)
+ //****************2023-11-27鏂板****************浠庣綉鍏宠鍙栬澶囧拰澶囨敞淇℃伅
+ public static final int SEARCH_GATEWAY_COMMAND = 0x000E;//鎼滅储缃戝叧
+ public static final int SEARCH_GATEWAY_BACK_COMMAND = 0x000F;//鎼滅储缃戝叧鍥炲
+ public static final int DEVICES_SEARCH_FROM_GATEWAY_COMMAND = 0xF548;//璇诲彇缃戝叧宸查厤缃姛鑳�
+ public static final int DEVICES_SEARCH_FROM_GATEWAY_BACK_COMMAND = 0xF549;//璇诲彇缃戝叧宸查厤缃姛鑳借繑鍥�
+ public static final int DEVICES_READ_FROM_GATEWAY_COMMAND = 0xF44A;//渚濇璇诲彇璁惧淇℃伅
+ public static final int DEVICES_READ_FROM_GATEWAY_BACK_COMMAND = 0xF44B;//渚濇璇诲彇璁惧淇℃伅杩斿洖
+ //****************2024-01-18鏂板****************浠庣綉鍏宠鍙栧満鏅拰鍦烘櫙淇℃伅
+ public static final int SCENE_SEARCH_FROM_GATEWAY_COMMAND = 0xF44C;//璇诲彇缃戝叧鍦烘櫙鏁伴噺
+ public static final int SCENE_SEARCH_FROM_GATEWAY_BACK_COMMAND = 0xF44D;//璇诲彇缃戝叧宸查厤缃満鏅繑鍥�
+ public static final int SCENE_READ_FROM_GATEWAY_COMMAND = 0xF44E;//渚濇璇诲彇鍦烘櫙淇℃伅
+ public static final int SCENE_READ_FROM_GATEWAY_BACK_COMMAND = 0xF44F;//渚濇璇诲彇鍦烘櫙淇℃伅杩斿洖
+
+
//****************2019-07鏂板****************
public static final int DEVICES_MODIFY_COMMAND = 0xE44C;//绠�鏄撶紪绋嬩慨鏀瑰熀鏈俊鎭紙鍗曠嫭淇敼鍥炶矾澶囨敞锛�
public static final int DEVICES_MODIFY_BACK_COMMAND = 0xE44D;//绠�鏄撶紪绋嬩慨鏀瑰熀鏈俊鎭洖澶�
@@ -178,7 +192,7 @@
public static final int DRY_CONTACT_BROADCAST_STATE_COMMAND = 0x15D0;//骞茶妭鐐圭姸鎬佷富鍔ㄥ箍鎾弽棣�
- //鍏鍙d氦鎹㈡満浼犳劅鍣� 浼犳劅鍣ㄦ搷浣滅爜
+ //璇诲彇浼犳劅鍣ㄧ姸鎬�
public static final int SENSOR_STATE_COMMAND = 0xE4F9;
public static final int SENSOR_STATE_BACK_COMMAND = 0xE4FA;
public static final int SENSOR_BROADCAST_STATE_BACK_COMMAND = 0x353A;
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Config/Global.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Config/Global.java
new file mode 100644
index 0000000..6457c7e
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Config/Global.java
@@ -0,0 +1,17 @@
+package com.hdl.sdk.ttl.Config;
+
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.ReceiveData;
+
+/**
+ * Created by panlili on 2023/11/30
+ * description:
+ */
+public class Global {
+
+ public final static int subnetID = 0;
+ public final static int deviceID = 0;
+
+ public static ReceiveData mReceiveData = null;
+ // 璁惧绫诲瀷
+ public static int DeviceType = 0xE2BC;
+}
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 69a13f7..b932101 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
@@ -18,12 +18,14 @@
public static final int TYPE_CURTAIN_GLYSTRO = 201;
public static final int TYPE_CURTAIN_ROLLER = 202;
public static final int TYPE_CURTAIN_MODULE = 203;
+ public static final int TYPE_CURTAIN_SHANGRILA = 206;
public static final int TYPE_AC_HVAC = 301;
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_AC_KNXTECHSYS = 306;
public static final int TYPE_MUSIC_MODULE = 401;
@@ -62,10 +64,10 @@
public static final int TYPE_SENSOR_VOLTAGE = 623;
public static final int TYPE_SENSOR_ELECTRICITY = 624;
public static final int TYPE_SENSOR_POWER = 625;
-
public static final int TYPE_SENSOR_FLOODING = 626; //姘存蹈//2019-11-4 鏂板
public static final int TYPE_SENSOR_DOOR_MAGNET= 627; //闂ㄧ銆佺獥纾�
public static final int TYPE_SENSOR_EMERGENCY_BUTTON = 628; //绱ф�ユ寜閽�
+ public static final int TYPE_SENSOR_PM_10 = 632;
//2020-07-20
public static final int TYPE_GEOTHERMAL_MODULE = 801; //鍦扮儹妯″潡锛�0锛� 鍥炶矾鍙凤紝澶囨敞锛屽湴鐑姸鎬�
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 14b1a9b..668572a 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
@@ -40,6 +40,7 @@
this.refTemp = this.curState[3] & 0xFF;//鍒跺喎娓╁害鐐� 0-84
this.heatTemp = this.curState[4] & 0xFF;//鍒剁儹娓╁害鐐� 0-84
this.autoTemp = this.curState[5] & 0xFF;//鑷姩娓╁害鐐� 0-84
+ this.wettedTemp = this.curState[6] & 0xFF;//鑷姩娓╁害鐐� 0-84
this.isOn = this.curState[8] & 0xFF;//鍙彇浣�4浣�
this.airMode = this.curState[9] & 0xFF;
this.airSpeed = this.curState[10] & 0xFF;
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
index 18426c4..c6b0aab 100644
--- 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
@@ -15,6 +15,7 @@
private int channelNum;//鍥炶矾鍙�
private int isOn;//0=鍏筹紝1=寮�
private String indoorTemp;//瀹ゅ唴娓╁害鐐� 0-84
+ private String indoorHumidity;//瀹ゅ唴婀垮害 0-100
private int indoorTempInt;//瀹ゅ唴娓╁害鐐规暣鏁伴儴鍒�
private int indoorTempFloat;//瀹ゅ唴娓╁害鐐瑰皬鏁伴儴鍒�
private int refTemp;//鍒跺喎娓╁害鐐� 0-84
@@ -53,6 +54,14 @@
this.indoorTemp = indoorTemp;
}
+ public String getIndoorHumidity() {
+ return indoorHumidity;
+ }
+
+ public void setIndoorHumidity(String indoorHumidity) {
+ this.indoorHumidity = indoorHumidity;
+ }
+
public AppliancesInfo getAppliancesInfo() {
return appliancesInfo;
}
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 29eab72..6b0ec25 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
@@ -1,6 +1,8 @@
package com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition.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;
@@ -127,15 +129,15 @@
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()) {
+ if (appliancesInfo.getDeviceSubnetID() == HDLDeviceManager.devicesDataList.get(i).getDeviceSubnetID()
+ && appliancesInfo.getDeviceDeviceID() == HDLDeviceManager.devicesDataList.get(i).getDeviceDeviceID()) {
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_PANEL
&& 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[13]);
+ newInfo.setArrCurState(new byte[19]);
}
airBytes = newInfo.getArrCurState();
break outter;
@@ -144,8 +146,8 @@
}
}
}
- byte[] addBytes = new byte[13];
- if (airBytes != null && airBytes.length >= 13) {
+ byte[] addBytes = new byte[19];
+ if (airBytes != null && airBytes.length >= 19) {
System.arraycopy(airBytes, 0, addBytes, 0, airBytes.length);
addBytes[0] = (byte) newInfo.getChannelNum();
@@ -273,11 +275,12 @@
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()) {
+ if (appliancesInfo.getDeviceSubnetID() == HDLDeviceManager.devicesDataList.get(i).getDeviceSubnetID()
+ && appliancesInfo.getDeviceDeviceID() == HDLDeviceManager.devicesDataList.get(i).getDeviceDeviceID()) {
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
+ && (HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getDeviceType() == HDLApConfig.TYPE_AC_TECHSYS
+ || HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getDeviceType() == HDLApConfig.TYPE_AC_KNXTECHSYS)
&& appliancesInfo.getChannelNum() == HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getChannelNum()) {
newInfo = HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j);
if (newInfo.getArrCurState() == null) {
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAudio/HDLAudio.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAudio/HDLAudio.java
index 68498d4..fa9b3d1 100644
--- a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAudio/HDLAudio.java
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLAudio/HDLAudio.java
@@ -134,8 +134,8 @@
numStr.clear();
songNameList.clear();
AppliancesInfo info = new AppliancesInfo();
- info.setDeviceSubnetID(getDatas.sourceSubnetID);
- info.setDeviceDeviceID(getDatas.sourceDeviceID);
+// info.setDeviceSubnetID(getDatas.sourceSubnetID);
+// info.setDeviceDeviceID(getDatas.sourceDeviceID);
HDLCommand.audioCtrl(info, HDLAudio.GET_AUDIO_LIST, audioListInfo[0]);
}
@@ -284,9 +284,8 @@
} else {
EventBus.getDefault().post(new AudioInfoEvent(CALLBACK_SONG_NAME_LIST, songNameList, audioInfo));
AppliancesInfo info = new AppliancesInfo();
- info.setDeviceSubnetID(getDatas.sourceSubnetID);
- info.setDeviceDeviceID(getDatas.sourceDeviceID);
-
+ info.setSourceSubnetID(getDatas.sourceSubnetID);
+ info.setSourceDeviceID(getDatas.sourceDeviceID);
}
}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLCurtain/CurtainCtrlBackInfo.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLCurtain/CurtainCtrlBackInfo.java
index f1d1c09..70573c4 100644
--- a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLCurtain/CurtainCtrlBackInfo.java
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLCurtain/CurtainCtrlBackInfo.java
@@ -1,9 +1,13 @@
package com.hdl.sdk.ttl.HDLAppliances.HDLCurtain;
+import android.util.Log;
+
+import com.hdl.sdk.ttl.HDLAppliances.HDLCurtain.Parser.CurtainCtrlParser;
import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
import java.io.Serializable;
+import java.util.Arrays;
/**
* Created by djl on 2017/4/1.
@@ -11,17 +15,57 @@
*/
public class CurtainCtrlBackInfo implements Serializable {
+ public AppliancesInfo appliancesInfo;
//绐楀笜鍙�
int num;
- int state;
+ int state;//0=鍋滐紱1=寮�锛�2=鍏�
+ int precent;//鐧惧垎姣�
+ int type;//鍔熻兘绫诲瀷
String remarks;
String parentRemarks;
+ private byte[] curState;//鎺у埗鍥為淇℃伅
- public AppliancesInfo appliancesInfo;
+ public CurtainCtrlBackInfo() {
+ }
+
+ public CurtainCtrlBackInfo(AppliancesInfo mAppliancesInfo) {
+ this.appliancesInfo = mAppliancesInfo;
+ this.curState = mAppliancesInfo.getArrCurState();
+ this.remarks = mAppliancesInfo.getRemarks();
+
+ if (this.curState == null) return;
+
+ if (this.curState.length >= 3) {
+ this.type = this.curState[2] & 0xFF;
+ Log.d("panlili", "CurtainCtrlBackInfo.java:CurtainCtrlBackInfo----->type= " + type);
+ if (type == 1) {//=绐楀笜鎺у埗V1.1寮�鍏冲仠
+ this.state = this.curState[1] & 0xFF;
+ switch (state) {//杩欓噷鏀规垚0锛�1锛�2
+ case 0:
+ state = CurtainCtrlParser.curtainPause;
+ break;
+ case 1:
+ state = CurtainCtrlParser.curtainOn;
+ break;
+ case 2:
+ state = CurtainCtrlParser.curtainOff;
+ break;
+ default:
+ state = 0;
+ break;
+ }
+ } else if (type == 2) {//=绐楀笜鎺у埗V1.1鐧惧垎姣�
+ this.precent = this.curState[1] & 0xFF;
+ } else if (type == 0) {
+ this.state = this.curState[1] & 0xFF;
+ }
+ }
+
+ }
public String getRemarks() {
@@ -64,13 +108,41 @@
this.parentRemarks = parentRemarks;
}
+ public int getPrecent() {
+ return precent;
+ }
+
+ public void setPrecent(int precent) {
+ this.precent = precent;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public void setType(int type) {
+ this.type = type;
+ }
+
+ public byte[] getCurState() {
+ return curState;
+ }
+
+ public void setCurState(byte[] curState) {
+ this.curState = curState;
+ }
+
@Override
public String toString() {
return "CurtainCtrlBackInfo{" +
- "num=" + num +
+ "appliancesInfo=" + appliancesInfo +
+ ", num=" + num +
", state=" + state +
+ ", precent=" + precent +
+ ", type=" + type +
", remarks='" + remarks + '\'' +
", parentRemarks='" + parentRemarks + '\'' +
+ ", curState=" + Arrays.toString(curState) +
'}';
}
}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLCurtain/Parser/CurtainCtrlParser.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLCurtain/Parser/CurtainCtrlParser.java
index 8c03e98..aaa02b7 100644
--- a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLCurtain/Parser/CurtainCtrlParser.java
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLCurtain/Parser/CurtainCtrlParser.java
@@ -13,8 +13,7 @@
public static final int TYPE_STATE_OPEN = 1;
public static final int TYPE_STATE_CLOSE = 2;
-// //杩欎釜鏂规硶鍙鐞嗕簡绐楀笜鍙峰皬浜�17鐨勬儏鍐�
- public static byte[] getCurtainAddByte(int curtainNum, int state){
+ public static byte[] getCurtainAddByte(int curtainNum, int state, int type){
byte[] addBytes;
int newState = state;
switch (state){
@@ -30,13 +29,8 @@
default:
break;
}
- addBytes = new byte[]{(byte) curtainNum, (byte) newState};
+ addBytes = new byte[]{(byte) curtainNum, (byte) newState, (byte) type};
return addBytes;
}
-
-// //杩欎釜鏂规硶鍙鐞嗕簡绐楀笜鍙峰皬浜�17鐨勬儏鍐�
-// public static byte[] getCurtainAddByte(int curtainNum, int state){
-// return new byte[]{(byte) curtainNum, (byte) state};
-// }
}
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
index 11345fe..1bc9d10 100644
--- 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
@@ -45,8 +45,8 @@
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()) {
+ if (appliancesInfo.getDeviceSubnetID() == HDLDeviceManager.devicesDataList.get(i).getDeviceSubnetID()
+ && appliancesInfo.getDeviceDeviceID() == HDLDeviceManager.devicesDataList.get(i).getDeviceDeviceID()) {
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
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
index 649c0ba..fcc58cd 100644
--- 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
@@ -57,8 +57,8 @@
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()) {
+ if (appliancesInfo.getDeviceSubnetID() == HDLDeviceManager.devicesDataList.get(i).getDeviceSubnetID()
+ && appliancesInfo.getDeviceDeviceID() == HDLDeviceManager.devicesDataList.get(i).getDeviceDeviceID()) {
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
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
index 2544b5d..b91d355 100644
--- 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
@@ -40,8 +40,8 @@
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()) {
+ if (appliancesInfo.getDeviceSubnetID() == HDLDeviceManager.devicesDataList.get(i).getDeviceSubnetID()
+ && appliancesInfo.getDeviceDeviceID() == HDLDeviceManager.devicesDataList.get(i).getDeviceDeviceID()) {
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
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
index cf3d023..b079781 100644
--- 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
@@ -37,8 +37,8 @@
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()) {
+ if (appliancesInfo.getDeviceSubnetID() == HDLDeviceManager.devicesDataList.get(i).getDeviceSubnetID()
+ && appliancesInfo.getDeviceDeviceID() == HDLDeviceManager.devicesDataList.get(i).getDeviceDeviceID()) {
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
@@ -127,8 +127,8 @@
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()) {
+ if (appliancesInfo.getDeviceSubnetID() == HDLDeviceManager.devicesDataList.get(i).getDeviceSubnetID()
+ && appliancesInfo.getDeviceDeviceID() == HDLDeviceManager.devicesDataList.get(i).getDeviceDeviceID()) {
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
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLLogic/LogicMode.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLLogic/LogicMode.java
index 2085a9e..589bc65 100644
--- a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLLogic/LogicMode.java
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLLogic/LogicMode.java
@@ -1,5 +1,7 @@
package com.hdl.sdk.ttl.HDLAppliances.HDLLogic;
+import com.hdl.sdk.ttl.Config.Configuration;
+
import java.io.Serializable;
/**
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLLogic/SceneCtrlBackInfo.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLLogic/SceneCtrlBackInfo.java
new file mode 100644
index 0000000..0d033cc
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLAppliances/HDLLogic/SceneCtrlBackInfo.java
@@ -0,0 +1,38 @@
+package com.hdl.sdk.ttl.HDLAppliances.HDLLogic;
+
+
+/**
+ * Created by panlili on 2024/1/19.
+ * 鍦烘櫙妯″潡
+ */
+
+public class SceneCtrlBackInfo {
+
+ int areaCodeID;//鍖哄彿
+ int sceneID;//鍦烘櫙鍙�
+ int loopNum;//鍥炶矾鎬绘暟
+
+ public int getAreaCodeID() {
+ return areaCodeID;
+ }
+
+ public void setAreaCodeID(int areaCodeID) {
+ this.areaCodeID = areaCodeID;
+ }
+
+ public int getSceneID() {
+ return sceneID;
+ }
+
+ public void setSceneID(int sceneID) {
+ this.sceneID = sceneID;
+ }
+
+ public int getLoopNum() {
+ return loopNum;
+ }
+
+ public void setLoopNum(int loopNum) {
+ this.loopNum = loopNum;
+ }
+}
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 63dd7a8..928d154 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
@@ -20,35 +20,20 @@
private int channelNum;//鍥炶矾鍙�
private int deviceSubnetID;//璁惧瀛愮綉鍙�
private int deviceDeviceID;//璁惧鍙�
+ private int sourceSubnetID;//婧愬瓙缃戝彿
+ private int sourceDeviceID;//婧愯澶囧彿
private Object curState;//褰撳墠鐘舵��
private String remarks;//澶囨敞
private String parentRemarks;//妯″潡澶囨敞
private byte[] arrCurState;//鐘舵�佸弽棣堣褰曟暟鎹�
private int deviceType;//璁惧绫诲瀷
- // private int port;
-// private String ipAddress;
+
private LogicMode logicMode;//閫昏緫妯″潡鐗规湁
private int physicsChannelNum;//RCU 鐏厜鐗规湁
-// private byte[] feedbackState;//鐘舵�佸弽棣堣褰曟暟鎹� 20190729鏂板
private int intCurState;
private String deviceKey;
-
-// public int getPort() {
-// return port;
-// }
-//
-// public void setPort(int port) {
-// this.port = port;
-// }
-//
-// public String getIpAddress() {
-// return ipAddress;
-// }
-//
-// public void setIpAddress(String ipAddress) {
-// this.ipAddress = ipAddress;
-// }
+ private boolean isGetDeviceStateSuccess;
public int getDeviceType() {
return deviceType;
@@ -104,6 +89,22 @@
public void setDeviceDeviceID(int deviceDeviceID) {
this.deviceDeviceID = deviceDeviceID;
+ }
+
+ public int getSourceSubnetID() {
+ return sourceSubnetID;
+ }
+
+ public void setSourceSubnetID(int sourceSubnetID) {
+ this.sourceSubnetID = sourceSubnetID;
+ }
+
+ public int getSourceDeviceID() {
+ return sourceDeviceID;
+ }
+
+ public void setSourceDeviceID(int sourceDeviceID) {
+ this.sourceDeviceID = sourceDeviceID;
}
public int getLittleType() {
@@ -194,13 +195,13 @@
this.intCurState = intCurState;
}
-// public byte[] getFeedbackState() {
-// return feedbackState;
-// }
-//
-// public void setFeedbackState(byte[] feedbackState) {
-// this.feedbackState = feedbackState;
-// }
+ public boolean isGetDeviceStateSuccess() {
+ return isGetDeviceStateSuccess;
+ }
+
+ public void setGetDeviceStateSuccess(boolean getDeviceStateSuccess) {
+ isGetDeviceStateSuccess = getDeviceStateSuccess;
+ }
public String getDeviceKey() {
deviceKey = this.bigType
@@ -222,22 +223,24 @@
"deviceName='" + deviceName + '\'' +
", bigType=" + bigType +
", littleType=" + littleType +
- ", ctrlCommand=" + Integer.toHexString(ctrlCommand) +
- ", ctrlBackCommand=" + Integer.toHexString(ctrlBackCommand) +
- ", stateCommand=" + Integer.toHexString(stateCommand) +
- ", stateBackCommand=" + Integer.toHexString(stateBackCommand) +
+ ", ctrlCommand=" + ctrlCommand +
+ ", ctrlBackCommand=" + ctrlBackCommand +
+ ", stateCommand=" + stateCommand +
+ ", stateBackCommand=" + stateBackCommand +
", channelNum=" + channelNum +
", deviceSubnetID=" + deviceSubnetID +
", deviceDeviceID=" + deviceDeviceID +
+ ", sourceSubnetID=" + sourceSubnetID +
+ ", sourceDeviceID=" + sourceDeviceID +
", curState=" + curState +
", remarks='" + remarks + '\'' +
", parentRemarks='" + parentRemarks + '\'' +
-// ", arrCurState=" + Arrays.toString(arrCurState) +
+ ", arrCurState=" + Arrays.toString(arrCurState) +
", deviceType=" + deviceType +
-// ", port=" + port +
-// ", ipAddress='" + ipAddress + '\'' +
", logicMode=" + logicMode +
", physicsChannelNum=" + physicsChannelNum +
+ ", intCurState=" + intCurState +
+ ", deviceKey='" + deviceKey + '\'' +
'}';
}
}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/DevicesData.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/DevicesData.java
index ce1b6a2..c5b4147 100644
--- a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/DevicesData.java
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/DevicesData.java
@@ -12,6 +12,10 @@
List<AppliancesInfo> appliancesInfoList;
int sourceSubnetID;
int sourceDeviceID;
+ int deviceSubnetID;
+ int deviceDeviceID;
+ int deviceSize;
+ int deviceIndex;
byte[] addByte;
String remark;
@@ -55,5 +59,35 @@
this.addByte = addByte;
}
+ public int getDeviceSubnetID() {
+ return deviceSubnetID;
+ }
+ public void setDeviceSubnetID(int deviceSubnetID) {
+ this.deviceSubnetID = deviceSubnetID;
+ }
+
+ public int getDeviceDeviceID() {
+ return deviceDeviceID;
+ }
+
+ public void setDeviceDeviceID(int deviceDeviceID) {
+ this.deviceDeviceID = deviceDeviceID;
+ }
+
+ public int getDeviceSize() {
+ return deviceSize;
+ }
+
+ public void setDeviceSize(int deviceSize) {
+ this.deviceSize = deviceSize;
+ }
+
+ public int getDeviceIndex() {
+ return deviceIndex;
+ }
+
+ public void setDeviceIndex(int deviceIndex) {
+ this.deviceIndex = deviceIndex;
+ }
}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/ListSceneRemarks.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/ListSceneRemarks.java
new file mode 100644
index 0000000..3414c89
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/ListSceneRemarks.java
@@ -0,0 +1,26 @@
+package com.hdl.sdk.ttl.HDLDeviceManger.Bean;
+
+/**
+ * Created by panlili on 2024/01/21.
+ */
+
+public class ListSceneRemarks {
+ boolean isCallBack;
+ ScenesData scenesData;
+
+ public boolean isCallBack() {
+ return isCallBack;
+ }
+
+ public void setCallBack(boolean callBack) {
+ isCallBack = callBack;
+ }
+
+ public ScenesData getScenesData() {
+ return scenesData;
+ }
+
+ public void setScenesData(ScenesData scenesData) {
+ this.scenesData = scenesData;
+ }
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/ReceiveData.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/ReceiveData.java
new file mode 100644
index 0000000..66f8823
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/ReceiveData.java
@@ -0,0 +1,7 @@
+package com.hdl.sdk.ttl.HDLDeviceManger.Bean;
+
+public interface ReceiveData {
+
+ void receiveData(final int command, final int desSubnetID, final int desDeviceID, final int subnetID,
+ final int deviceID, final byte[] usefulBytes);
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/ScenesData.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/ScenesData.java
new file mode 100644
index 0000000..cb634c3
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/ScenesData.java
@@ -0,0 +1,84 @@
+package com.hdl.sdk.ttl.HDLDeviceManger.Bean;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * Created by panlili on 2024/01/18.
+ * 鍦烘櫙
+ */
+
+public class ScenesData implements Serializable {
+ int index;
+ int sourceSubnetID;
+ int sourceDeviceID;
+ int areaCodeID;
+ int sceneID;
+ byte[] addByte;
+ String remark;
+ boolean isCallBack;
+
+ public String getRemark() {
+ return remark;
+ }
+
+ public void setRemark(String remark) {
+ this.remark = remark;
+ }
+
+ public int getSourceSubnetID() {
+ return sourceSubnetID;
+ }
+
+ public void setSourceSubnetID(int sourceSubnetID) {
+ this.sourceSubnetID = sourceSubnetID;
+ }
+
+ public int getSourceDeviceID() {
+ return sourceDeviceID;
+ }
+
+ public void setSourceDeviceID(int sourceDeviceID) {
+ this.sourceDeviceID = sourceDeviceID;
+ }
+
+ public byte[] getAddByte() {
+ return addByte;
+ }
+
+ public void setAddByte(byte[] addByte) {
+ this.addByte = addByte;
+ }
+
+ public int getIndex() {
+ return index;
+ }
+
+ public void setIndex(int index) {
+ this.index = index;
+ }
+
+ public int getAreaCodeID() {
+ return areaCodeID;
+ }
+
+ public void setAreaCodeID(int areaCodeID) {
+ this.areaCodeID = areaCodeID;
+ }
+
+ public int getSceneID() {
+ return sceneID;
+ }
+
+ public void setSceneID(int sceneID) {
+ this.sceneID = sceneID;
+ }
+
+ public boolean isCallBack() {
+ return isCallBack;
+ }
+
+ public void setCallBack(boolean callBack) {
+ isCallBack = callBack;
+ }
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/SendDatas.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/SendDatas.java
new file mode 100644
index 0000000..ef511a5
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Bean/SendDatas.java
@@ -0,0 +1,352 @@
+package com.hdl.sdk.ttl.HDLDeviceManger.Bean;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+
+import com.hdl.sdk.ttl.Config.Global;
+import com.hdl.sdk.ttl.HDLDeviceManger.Core.Crc;
+
+import java.net.InetAddress;
+
+public class SendDatas {
+ // finish
+ public static final int FINISH = 10;
+ public static final int SEND_ONLY_ONCE = 0;
+ public static final int SEND_MAX = 3;
+ /**
+ * 閲嶅彂鍒楄〃
+ */
+ private static ArrayList<SendDatas> RetransmissionDateList = new ArrayList<SendDatas>();
+ /**
+ * 鍙彂閫佷竴娆★紝鍙戦�佸畬灏辩Щ闄�
+ */
+ public static ArrayList<SendDatas> sendDataArrayList = new ArrayList<SendDatas>(100);
+ // 宸茬粡鍙戦�佸嚭鍘荤殑娆℃暟
+ public int SendCount = 0;
+ public Calendar StartCalendar =null;
+ // 瀛愮綉鍙�
+ public int DesSubnetID;
+ // 璁惧鍙�
+ public int DesDeviceID;
+ // 鍙戦�佸嚭鍘荤殑闄勫姞鏁版嵁
+ public byte[] AddBytes = new byte[]{};
+ // 鑾峰彇鍙戦�佸嚭鍘荤殑鏁版嵁,姣忚皟鐢ㄨ繖涓柟娉曠殑鏃跺�欙紝鏁版嵁閮戒細閲嶆柊鎺掑垪涓�涓嬶紝寰楀埌鐪熷疄鐨勬暟鎹�
+ public InetAddress InetAddress;
+ public int Port;
+ public InetAddress TargetAddress;
+
+ /**
+ * 璁惧鍗忚绫诲瀷
+ */
+ public int protocolType;
+
+ public byte[] GetSendBytes() {
+
+ // 瑕佽绠桟RC鐨勬暟鎹拰CRC涓や釜瀛楄妭
+ byte[] crcBytes = new byte[9 + this.AddBytes.length + 2];
+
+ // 鍙戦�佸嚭鍘荤殑鏁版嵁
+ byte[] sendBytes = new byte[16 + crcBytes.length];
+
+ /*String[] ip = Net.CurrentNet.getPsdnIp().split("\\.");
+ // IP鍦板潃
+ sendBytes[0] = (byte) GetStringToInteger(ip[0]);
+ sendBytes[1] = (byte) GetStringToInteger(ip[1]);
+ sendBytes[2] = (byte) GetStringToInteger(ip[2]);
+ sendBytes[3] = (byte) GetStringToInteger(ip[3]);*/
+
+ // HDL--HOTEL
+ if (this.Port == 6006) {
+
+ sendBytes[4] = (byte) 0x48;
+ sendBytes[5] = (byte) 0x44;
+ sendBytes[6] = (byte) 0x4c;
+ sendBytes[7] = (byte) 0x4d;
+ sendBytes[8] = (byte) 0x49;
+ sendBytes[9] = (byte) 0x52;
+ sendBytes[10] = (byte) 0x41;
+ sendBytes[11] = (byte) 0x43;
+ sendBytes[12] = (byte) 0x4c;
+ sendBytes[13] = (byte) 0x45;
+ } else {
+ // HDLMIRACLE
+ sendBytes[4] = (byte) 0x48;
+ sendBytes[5] = (byte) 0x44;
+ sendBytes[6] = (byte) 0x4c;
+ sendBytes[7] = (byte) 0x4d;
+ sendBytes[8] = (byte) 0x49;
+ sendBytes[9] = (byte) 0x52;
+ sendBytes[10] = (byte) 0x41;
+ sendBytes[11] = (byte) 0x43;
+ sendBytes[12] = (byte) 0x4c;
+ sendBytes[13] = (byte) 0x45;
+ }
+ // 寮曞鐮�
+ sendBytes[14] = (byte) 0xAA;
+ sendBytes[15] = (byte) 0xAA;
+
+ // 16 鏁版嵁鍖呴暱搴� 11-78
+ crcBytes[0] = (byte) crcBytes.length;
+ // 17 婧愬瓙缃戝湴鍧� 0-254
+ crcBytes[1] = (byte) Global.subnetID;
+ // 18 婧愯澶囧湴鍧� 0-254
+ crcBytes[2] = (byte) Global.deviceID;
+ // 19 婧愯澶囩被鍨嬮珮浣�
+ crcBytes[3] = (byte) (Global.DeviceType / 256);
+ // 20 婧愯澶囩被鍨嬩綆浣�
+ crcBytes[4] = (byte) (Global.DeviceType % 256);
+ // 21 鎿嶄綔鐮侀珮浣�
+ crcBytes[5] = (byte) (this.Command / 256);
+ // 22 鎿嶄綔鐮佷綆浣�
+ crcBytes[6] = (byte) (this.Command % 256);
+ // 23 鐩爣瀛愮綉鍦板潃 0-254
+ crcBytes[7] = (byte) this.DesSubnetID;
+ // 24 鐩爣璁惧鍦板潃 0-254
+ crcBytes[8] = (byte) this.DesDeviceID;
+ // 25~n闄勫姞鏁版嵁
+ System.arraycopy(this.AddBytes, 0, crcBytes, 9, this.AddBytes.length);
+ // CRC鏍¢獙
+ Crc.ConCRC(crcBytes, crcBytes.length - 2);
+
+ // 澶嶅埗CRC鏁版嵁鍒板彂閫佹暟鎹噷闈�
+ System.arraycopy(crcBytes, 0, sendBytes, 16, crcBytes.length);
+
+ /*
+ * int sss[] = new int[sendBytes.length]; for(int i
+ * =0;i<sendBytes.length;i++){ sss[i] =
+ * Global.GetByteToUbyte(sendBytes[i]); }
+ */
+
+ return sendBytes;
+
+ }
+
+ /**
+ * 鑾峰彇涓插彛鍙戦�佹暟鎹�
+ *
+ * @return -
+ */
+ public byte[] GetSerialPortSendBytes() {
+
+ //Data and to compute the CRC of CRC two bytes
+ byte[] crcBytes = new byte[9 + this.AddBytes.length + 2];
+
+ //Send out the data
+ byte[] sendBytes = new byte[2 + crcBytes.length];
+
+ //Boot code
+ sendBytes[0] = (byte) 0xAA;
+ sendBytes[1] = (byte) 0xAA;
+
+ //16 The length of the packet 11-78
+ crcBytes[0] = (byte) crcBytes.length;
+ //17 Source subnet addresses 0-254
+ crcBytes[1] = (byte) Global.subnetID;// Global.subnetId;/
+ //18 source device address 0-254
+ crcBytes[2] = (byte) Global.deviceID;//Global.deviceId;
+ //19 High source device type
+ crcBytes[3] = (byte) (Global.DeviceType / 256);
+ //20 The source device type low
+ crcBytes[4] = (byte) (Global.DeviceType % 256);
+ //21 Opcode high
+ crcBytes[5] = (byte) (this.Command / 256);
+ //22 Opcode low
+ crcBytes[6] = (byte) (this.Command % 256);
+ //23 The target subnet addresses 0-254
+ crcBytes[7] = (byte) this.DesSubnetID;
+ //24 The destination address 0-254
+ crcBytes[8] = (byte) this.DesDeviceID;
+ //25~n Additional data
+ System.arraycopy(this.AddBytes, 0, crcBytes, 9, this.AddBytes.length);
+ //Check CRC
+ Crc.ConCRC(crcBytes, crcBytes.length - 2);
+
+ //Copy the CRC data to send data
+ System.arraycopy(crcBytes, 0, sendBytes, 2, crcBytes.length);
+
+ return sendBytes;
+
+ }
+
+ // 鎿嶄綔鐮�
+ public int Command;
+ // 姣忎釜瀛楄妭瀵瑰簲鏄惁宸茬粡鍙戦�佸嚭鍘荤殑鏁版
+ public boolean[] HaveSend = new boolean[]{false, false, false};
+ // 涓存椂琛ㄧず鍙戦�佸嚭鍘荤殑鏁版嵁鐨勫紩鐢�
+ private static SendDatas currentSendBytesInfo = null;
+
+ // 杩欎釜鍑芥暟鍙互澧炲姞涓�涓爣璇嗭紝閫夋嫨褰撳墠杩欐潯鏁版嵁闇�瑕佸彂閫佸灏戞锛岃繖浜蹭娇鐢ㄨ捣鏉ュ氨姣旇緝鏂逛究鐐�
+ // 鏈夊彲鑳借繕闇�瑕佸姞鍏ュ摢鏉℃暟鎹殑鍙戦�佷紭鍏堢骇锛岃繖浜查渶瑕佸厛鍙戦�佺殑鏁版嵁灏卞彂閫佸揩鐐广��
+ // 澧炲姞瑕佸彂閫佺殑鏁版嵁
+ public static void AddSendData(int command, int desSubnetID, int desDeviceID, byte[] addBytes, int sendCount,
+ InetAddress ip, int port, int _protocolType) {
+ SendDatas sendDatas = new SendDatas();
+ sendDatas.Command = command; // 杩欓噷鐨勬搷浣滅爜鏈�濂芥槸鐢ㄦ灇涓撅紝杩欐牱鎵嶄笉浼氬嚭閿欏張鏂逛究
+ sendDatas.DesSubnetID = desSubnetID;
+ sendDatas.DesDeviceID = desDeviceID;
+ sendDatas.AddBytes = addBytes;
+ sendDatas.SendCount = sendCount; // 濡傛灉杩欎釜鍊�
+ // 澶т簬绛変簬500琛ㄧず鍙渶瑕佸彂閫佷袱娆★紝濡傛灉澶т簬绛変簬1000琛ㄧず鍙渶瑕佸彂閫佷竴娆★紝濡傛灉澶т簬绛変簬1500锛岃〃绀轰笉闇�瑕佸啀鍙戦�佹暟鎹簡
+ sendDatas.InetAddress = ip;
+ sendDatas.Port = port;
+ sendDatas.protocolType = _protocolType;
+ synchronized (SendDatas.sendDataArrayList) {
+ sendDataArrayList.add(sendDatas);// 鍔犲叆鍒板彂閫佺紦鍐插尯锛岀瓑寰呭彂閫佺嚎绋嬫潵鍙戦�佹暟鎹�
+ }
+ }
+
+ public static void AddSendData(int command, int desSubnetID, int desDeviceID, byte[] addBytes) {
+ SendDatas sendDatas = new SendDatas();
+ sendDatas.Command = command; // 杩欓噷鐨勬搷浣滅爜鏈�濂芥槸鐢ㄦ灇涓撅紝杩欐牱鎵嶄笉浼氬嚭閿欏張鏂逛究
+ sendDatas.DesSubnetID = desSubnetID;
+ sendDatas.DesDeviceID = desDeviceID;
+ sendDatas.AddBytes = addBytes;
+ sendDatas.SendCount = 0; // 濡傛灉杩欎釜鍊煎ぇ浜�2琛ㄧず涓嶉渶瑕侀噸鍙戜簡
+ sendDatas.Port = 6000;
+ synchronized (SendDatas.sendDataArrayList) {
+ sendDataArrayList.add(sendDatas);// 鍔犲叆鍒板彂閫佺紦鍐插尯锛岀瓑寰呭彂閫佺嚎绋嬫潵鍙戦�佹暟鎹�
+ }
+ }
+
+ public static void AddSendData(int command, int desSubnetID, int desDeviceID, byte[] addBytes, int sendCount) {
+ SendDatas sendDatas = new SendDatas();
+ sendDatas.Command = command; // 杩欓噷鐨勬搷浣滅爜鏈�濂芥槸鐢ㄦ灇涓撅紝杩欐牱鎵嶄笉浼氬嚭閿欏張鏂逛究
+ sendDatas.DesSubnetID = desSubnetID;
+ sendDatas.DesDeviceID = desDeviceID;
+ sendDatas.AddBytes = addBytes;
+ sendDatas.SendCount = sendCount; // 濡傛灉杩欎釜鍊煎ぇ浜�2琛ㄧず涓嶉渶瑕侀噸鍙戜簡
+ sendDatas.Port = 6000;
+ synchronized (SendDatas.sendDataArrayList) {
+ sendDataArrayList.add(sendDatas);// 鍔犲叆鍒板彂閫佺紦鍐插尯锛岀瓑寰呭彂閫佺嚎绋嬫潵鍙戦�佹暟鎹�
+ }
+ }
+
+ public static void AddSendData(int command, int desSubnetID, int desDeviceID, byte[] addBytes, int sendCount, InetAddress ip, int port) {
+ SendDatas sendDatas = new SendDatas();
+ sendDatas.Command = command; // 杩欓噷鐨勬搷浣滅爜鏈�濂芥槸鐢ㄦ灇涓撅紝杩欐牱鎵嶄笉浼氬嚭閿欏張鏂逛究
+ sendDatas.DesSubnetID = desSubnetID;
+ sendDatas.DesDeviceID = desDeviceID;
+ sendDatas.AddBytes = addBytes;
+ sendDatas.SendCount = sendCount; // 濡傛灉杩欎釜鍊煎ぇ浜�2琛ㄧず涓嶉渶瑕侀噸鍙戜簡
+ sendDatas.InetAddress = ip;
+ sendDatas.Port = port;
+ synchronized (SendDatas.sendDataArrayList) {
+ sendDataArrayList.add(sendDatas);// 鍔犲叆鍒板彂閫佺紦鍐插尯锛岀瓑寰呭彂閫佺嚎绋嬫潵鍙戦�佹暟鎹�
+ }
+ }
+
+ /**
+ * 鏇存柊鍙戦�佹槸鍚︽垚鍔熺殑淇℃伅
+ *
+ * @param command
+ * @param subnetID
+ * @param deviceID
+ * @param usefulBytes
+ */
+ public static void ReceiveBytes(int command, int subnetID, int deviceID, byte[] usefulBytes) {
+
+ try {
+
+ if (usefulBytes.length < 1) return;
+
+ for (int i = 0; i < SendDatas.sendDataArrayList.size(); i++) {
+
+ currentSendBytesInfo = sendDataArrayList.get(i);
+
+ if (currentSendBytesInfo.DesSubnetID != subnetID || currentSendBytesInfo.DesDeviceID != deviceID || currentSendBytesInfo.Command + 1 != command)
+ continue;
+
+ switch (command) {
+ case 0x0032:// 鍗曡矾璋冭妭鎺у埗鍙嶉
+ case 0x1939:// 妯″潡绌鸿皟璇诲彇鍙嶉
+ case 0x193B:// 绌鸿皟妯″潡鎺у埗鍙嶉
+ case 0xE01D:// 閫氱敤寮�鍏冲洖澶�
+ case 0xE3D9:// 闈㈡澘鎺у埗鍙嶉
+ case 0xE3E3:// 绐楀笜寮�鍏宠鍙栧洖澶�
+ case 0xE45D:// 閫昏緫鐏疪GB鎺у埗杩斿洖
+ case 0xE473:// 閫昏緫鐏疪GB璇诲彇鍙嶉
+ case 0x1c5f:// 鍦扮儹m妯″潡璇诲彇鍙嶉
+ case 0x1c5d:// 鍦扮儹妯″潡鎺у埗鍙嶉
+ if (currentSendBytesInfo.AddBytes[0] == usefulBytes[0]) {
+ currentSendBytesInfo.SendCount = FINISH;
+ }
+ break;
+ case 0x0003:// 鍦烘櫙鎺у埗鍙嶉
+ case 0x001B:// 搴忓垪鎺у埗鍙嶉
+ case 0x0034:// 鐏厜璇诲彇鍙嶉
+ case 0x16A7:// 閫氱敤鎺у埗鍙嶉
+ case 0xE3E1:// 绐楀笜寮�鍏冲洖澶�
+ case 0x1945:// 鍦扮儹闈㈡澘璇诲彇鍙嶉
+ case 0x1947:// 鍦扮儹闈㈡澘鎺у埗鍙嶉
+ currentSendBytesInfo.SendCount = FINISH;
+ break;
+ }
+ }
+ } catch (Exception e) {
+ e.getMessage();
+ }
+ }
+
+ // 鍔犲叆閲嶅彂鍒楄〃
+ public static void AddSendDataList(SendDatas sendDatas) {
+
+ synchronized (RetransmissionDateList) {
+
+ for (int i = 0; i < RetransmissionDateList.size(); i++) {
+
+ SendDatas _data = RetransmissionDateList.get(i);
+
+ switch (_data.Command) {
+ case 0x0031:// 鍗曡矾璋冭妭鎺у埗鍙嶉
+ case 0xE45C:// 閫昏緫鐏疪GB鎺у埗杩斿洖
+ case 0xE472:// 閫昏緫鐏疪GB璇诲彇鍙嶉
+ case 0xE01C:// 閫氱敤寮�鍏冲洖澶�
+ case 0xE3E0:// 绐楀笜寮�鍏冲洖澶�
+ case 0x193A:// 绌鸿皟妯″潡鎺у埗鍙嶉
+ case 0x1938:// 妯″潡绌鸿皟璇诲彇鍙嶉
+ case 0xE3D8:// 闈㈡澘鎺у埗鍙嶉
+ case 0xE3E2:// 绐楀笜寮�鍏宠鍙栧洖澶�
+ if (_data.DesSubnetID == sendDatas.DesSubnetID && _data.DesDeviceID == sendDatas.DesDeviceID
+ && _data.Command == sendDatas.Command && _data.AddBytes[0] == sendDatas.AddBytes[0]) {
+ return;
+ }
+ break;
+ case 0x192E://闊充箰鎺у埗
+ case 0x1970:
+ return;
+ case 0x0034:// 鐏厜璇诲彇鍙嶉
+ case 0x0003:// 鍦烘櫙鎺у埗鍙嶉
+ case 0x001B:// 搴忓垪鎺у埗鍙嶉
+ case 0x16A7:// 閫氱敤鎺у埗鍙嶉
+ default:
+ if (_data.DesSubnetID == sendDatas.DesSubnetID && _data.DesDeviceID == sendDatas.DesDeviceID
+ && _data.Command == sendDatas.Command) {
+ return;
+ }
+ break;
+ }
+ }
+ RetransmissionDateList.add(sendDatas);
+ }
+ }
+
+ public static ArrayList<SendDatas> GetSendDataList() {
+ return RetransmissionDateList;
+ }
+
+
+ /**
+ * 瀛楃涓茶浆鎹负鏁存暟
+ *
+ * @param s
+ * @return
+ */
+ public static int GetStringToInteger(String s) {
+
+ try {
+ return Integer.parseInt(s);
+ } catch (Exception e) {
+ return 0;
+ }
+ }
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/Crc.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/Crc.java
index 54a87db..759293f 100644
--- a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/Crc.java
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/Crc.java
@@ -140,6 +140,38 @@
}
+ private static int[] Modbus_crc_tab = new int[]
+ {
+ 0x0000, 0xCC01, 0xD801, 0x1400, 0xF001, 0x3C00, 0x2800, 0xE401,
+ 0xA001, 0x6C00, 0x7800, 0xB401, 0x5000, 0x9C01, 0x8801, 0x4400,
+ };
+
+ public static void CRC16_MODBUS(byte[] buffer, int len) {
+ int crc;
+ byte dat;
+ int i;
+ crc = 0XFFFF;
+ for (i = 0; i < len - 2; i++) {
+ dat = buffer[i];
+ crc = Modbus_crc_tab[(dat ^ crc) & 15] ^ (crc >> 4);
+ crc = Modbus_crc_tab[((dat >> 4) ^ crc) & 15] ^ (crc >> 4);
+ }
+ buffer[i] = (byte) (crc & 0xff);
+ buffer[i + 1] = (byte) (crc >> 8);
+ }
+
+ public static boolean CRC16_MODBUS_MATCH(byte[] buffer, int len) {
+ int crc;
+ byte dat;
+ int i;
+ crc = 0XFFFF;
+ for (i = 0; i < len - 2; i++) {
+ dat = buffer[i];
+ crc = Modbus_crc_tab[(dat ^ crc) & 15] ^ (crc >> 4);
+ crc = Modbus_crc_tab[((dat >> 4) ^ crc) & 15] ^ (crc >> 4);
+ }
+ return (buffer[i] & 0xFF) == (crc & 0xff) && (buffer[i + 1] & 0xFF) == (crc >> 8);
+ }
//
// // 2.閫氫俊鍗忚
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 302b167..bbe4f12 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
@@ -24,10 +24,13 @@
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.HDLLogic.SceneCtrlBackInfo;
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.Bean.ScenesData;
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.SendDatas;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.AirFeedBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.ColourLightFeedBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.CommonSwitchCtrlBackEvent;
@@ -41,6 +44,7 @@
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.LightFeedBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.LogicFeedBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.MCUFeedBackEvent;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.SceneFeedBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.SecurityArmingFeedBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.UpdateRemarkFeedBackEvent;
import com.hdl.sdk.ttl.Utils.HDLUtlis.HDLUtlis;
@@ -61,6 +65,7 @@
public class HDLCommand {
public static int mRequestTimeout = 5000;//榛樿璇锋眰瓒呮椂鏃堕棿
+ public static int mRequestCurtainTimeout = 8000;//榛樿璇锋眰瓒呮椂鏃堕棿
private static Timer getStateFailTimer = null;//鑾峰彇璁惧鐘舵�佸け璐imer
private static Timer lightCtrlFailTimer = null;//鎺у埗鐏厜澶辫触Timer
private static Timer curtainCtrlFailTimer = null;//鎺у埗绐楀笜澶辫触Timer
@@ -101,13 +106,27 @@
// HDLDeviceManager.release();
// }
+
+ /**
+ * 鎼滅储缃戝叧
+ */
+ public static void seachGateway() {
+ HandleSearch.seachGateway();
+ }
+
/**
* 鑾峰彇瀹跺眳璁惧
*/
- public static void getHomeDevices() {
- HandleSearch.getHomeDevices();
+ public static void getHomeDevices(int subnetID, int deviceID) {
+ HandleSearch.getHomeDevices(subnetID, deviceID);
}
+ /**
+ * 鑾峰彇瀹跺眳鍦烘櫙
+ */
+ public static void getHomeScenes(int subnetID, int deviceID) {
+ HandleSearch.seachHomeScenes(subnetID, deviceID);
+ }
/**
* 鑾峰彇瀹跺眳璁惧澶囨敞
@@ -119,8 +138,8 @@
/**
* 鍙戠幇鏂拌澶囨悳绱�,涓嶄細娓呯┖鍘熻澶囧垪琛ㄦ暟鎹�
*/
- public static void getNewHomeDevices() {
- HandleSearch.getNewHomeDevices();
+ public static void getNewHomeDevices(int subnetID, int deviceID) {
+ HandleSearch.getNewHomeDevices(subnetID, deviceID);
}
/**
@@ -301,8 +320,7 @@
* @param info
* @param state
*/
- public static void curtainCtrl(final AppliancesInfo info, int state) {
-// HDLDeviceManager.isCurtainCtrlSuccess = false;
+ public static void curtainCtrl(final AppliancesInfo info, int state, int type) {
HDLDeviceManager.setDeviceCtrlSuccessStateWithInfo(info, false);
if (curtainCtrlFailTimer != null) {
curtainCtrlFailTimer.cancel();
@@ -310,19 +328,23 @@
}
byte[] bytes;
if (info.getBigType() == Configuration.CURTAIN_BIG_TYPE) {
- if (info.getLittleType() == 1 || info.getLittleType() == 0) {
- //杩欓噷鏄垽鏂嵎甯樼數鏈哄拰寮�鍚堝笜鐢垫満
+ if (info.getLittleType() == 1 || info.getLittleType() == 0 || info.getLittleType() == 3) {//鍒ゆ柇鍗峰笜鐢垫満/寮�鍚堝笜鐢垫満/棣欐牸閲屾媺甯樼數鏈�
int newChannelNum;
- if (state == CurtainCtrlParser.curtainOff
- || state == CurtainCtrlParser.curtainOn
- || state == CurtainCtrlParser.curtainPause) {
- newChannelNum = info.getChannelNum();
+ if (type == 0) {
+ if (state == CurtainCtrlParser.curtainOff
+ || state == CurtainCtrlParser.curtainOn
+ || state == CurtainCtrlParser.curtainPause) {
+ newChannelNum = info.getChannelNum();
+ } else {
+ newChannelNum = info.getChannelNum() + 16;
+ }
} else {
- newChannelNum = info.getChannelNum() + 16;
+ newChannelNum = info.getChannelNum();
}
- bytes = CurtainCtrlParser.getCurtainAddByte(newChannelNum, state);
+
+ bytes = CurtainCtrlParser.getCurtainAddByte(newChannelNum, state, type);
} else {
- bytes = CurtainCtrlParser.getCurtainAddByte(info.getChannelNum(), state);
+ bytes = CurtainCtrlParser.getCurtainAddByte(info.getChannelNum(), state, type);
}
addSendData(info, bytes, Configuration.CONTROL);
@@ -336,11 +358,11 @@
CurtainCtrlBackInfo curtainCtrlBackInfo = new CurtainCtrlBackInfo();
curtainCtrlBackInfo.setAppliancesInfo(info);
curtainCtrlBackInfo.setNum(info.getChannelNum());
+
EventBus.getDefault().post(new CurtainFeedBackEvent(curtainCtrlBackInfo, false));
}
}
- }, mRequestTimeout);
-
+ }, mRequestCurtainTimeout);
} else {
HDLLog.I("djlCtrl; 涓嶆槸绐楀笜璁惧"
@@ -369,7 +391,7 @@
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) {
+ } else if (info.getDeviceType() == HDLApConfig.TYPE_AC_TECHSYS || info.getDeviceType() == HDLApConfig.TYPE_AC_KNXTECHSYS) {
byte[] airbytes = AirCtrlParser.getAirTechAddByte(info, type, state);
if (airbytes != null) {
addSendData(info, airbytes, Configuration.CONTROL);
@@ -553,56 +575,42 @@
}
}, mRequestTimeout);
} else {
- HDLLog.I("djlCtrl: 閫昏緫妯″潡璁惧鎺у埗涓嶅湪鑼冨洿鍐�"
+ HDLLog.I("閫昏緫妯″潡璁惧鎺у埗涓嶅湪鑼冨洿鍐�"
+ " LittleType = " + info.getLittleType()
+ " BigType = " + info.getBigType()
);
}
}
- // 鑾峰彇鍗曚竴鍥炶矾璁惧鐘舵��
- // 璇诲彇璁惧鐘舵��
-// public static void getDeviceState(final AppliancesInfo I) {
-// HDLDeviceManager.isGetDeviceStateSuccess = false;
-// switch (I.getBigType()) {
-// case Configuration.LIGTH_BIG_TYPE:
-// addSendData(I, new byte[]{}, Configuration.STATE);
-// break;
-// case Configuration.CURTAIN_BIG_TYPE:
-// if (I.getDeviceType() == HDLApConfig.TYPE_CURTAIN_MODULE) {
-// addSendData(I, new byte[]{(byte) I.getChannelNum()}, Configuration.STATE);
-// } else {
-// addSendData(I, new byte[]{(byte) (I.getChannelNum() + 16)}, Configuration.STATE);
-// }
-// break;
-// case Configuration.AIR_BIG_TYPE:
-// addSendData(I, new byte[]{AirCtrlParser.airSwich}, Configuration.STATE);
-//// addSendData(I,new byte[]{AirCtrlParser.refTem},Configuration.STATE);
-// addSendData(I, new byte[]{AirCtrlParser.airSpeed}, Configuration.STATE);
-// addSendData(I, new byte[]{AirCtrlParser.airMode}, Configuration.STATE);
-//// addSendData(I,new byte[]{AirCtrlParser.heatTem},Configuration.STATE);
-//// addSendData(I,new byte[]{AirCtrlParser.autoTem},Configuration.STATE);
-// break;
-// }
-//
-// if (I.getBigType() == Configuration.AIR_BIG_TYPE) {
-// return;
-// }
-// if (getStateFailTimer != null) {
-// getStateFailTimer.cancel();
-// getStateFailTimer = null;
-// }
-// getStateFailTimer = new Timer();
-// getStateFailTimer.schedule(new TimerTask() {
-// @Override
-// public void run() {
-// if (!HDLDeviceManager.isGetDeviceStateSuccess) {
-// EventBus.getDefault().post(new DeviceStateEvent(I, false));
-// }
-// }
-// }, mRequestTimeout);
-//
-// }
+ /**
+ * 鍦烘櫙鎺у埗
+ *
+ * @param scenesData
+ */
+ public static void sceneCtrl(final ScenesData scenesData) {
+ cusSendCommand(Configuration.LOGIC_CTRL_COMMAND, scenesData.getSourceSubnetID(), scenesData.getSourceDeviceID(), new byte[]{
+ (byte) (scenesData.getAreaCodeID()),
+ (byte) (scenesData.getSceneID())
+ });
+
+ if (sceneCtrlFailTimer != null) {
+ sceneCtrlFailTimer.cancel();
+ sceneCtrlFailTimer = null;
+ }
+ sceneCtrlFailTimer = new Timer();
+ sceneCtrlFailTimer.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ if (!HDLDeviceManager.isSceneCtrlSuccess()) {
+ HDLLog.I("鍦烘櫙鎺у埗澶辫触");
+ SceneCtrlBackInfo sceneCtrlBackInfo = new SceneCtrlBackInfo();
+ sceneCtrlBackInfo.setAreaCodeID(scenesData.getAreaCodeID());
+ sceneCtrlBackInfo.setSceneID(scenesData.getSceneID());
+ EventBus.getDefault().post(new SceneFeedBackEvent(sceneCtrlBackInfo, false));
+ }
+ }
+ }, mRequestTimeout);
+ }
/**
* 鎺у埗绐楀笜
@@ -690,10 +698,14 @@
}
HDLDeviceManager.isGetDeviceStateSuccess = false;
switch (info.getDeviceType()) {
+ case HDLApConfig.TYPE_CURTAIN_MODULE:
+ addSendData(info, new byte[]{(byte) info.getChannelNum(), 0, 1}, Configuration.STATE);
+ break;
case HDLApConfig.TYPE_CURTAIN_GLYSTRO:
case HDLApConfig.TYPE_CURTAIN_ROLLER:
- case HDLApConfig.TYPE_CURTAIN_MODULE:
- addSendData(info, new byte[]{(byte) info.getChannelNum()}, Configuration.STATE);
+ case HDLApConfig.TYPE_CURTAIN_SHANGRILA:
+ //鍙鍙栫櫨鍒嗘瘮锛屼笉璇诲彇寮�鍏冲仠
+ addSendData(info, new byte[]{(byte) info.getChannelNum(), 0, 2}, Configuration.STATE);
break;
default:
HDLLog.I("涓嶆槸绐楀笜璁惧");
@@ -717,7 +729,8 @@
case HDLApConfig.TYPE_LIGHT_MIX_DIMMER:
case HDLApConfig.TYPE_LIGHT_MIX_RELAY:
//鍙戦�佽幏鍙栫伅鍏夌姸鎬佹暟鎹�
- addSendData(info, new byte[0], Configuration.STATE);
+ byte[] sendbytes = new byte[]{(byte) info.getChannelNum()};
+ addSendData(info, sendbytes, Configuration.STATE);
break;
default:
HDLLog.I("涓嶆槸鐏厜璁惧");
@@ -805,34 +818,11 @@
}
HDLDeviceManager.isGetDeviceStateSuccess = false;
switch (info.getDeviceType()) {
- case HDLApConfig.TYPE_SENSOR_DRY_CONTACT:
- 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_PM_10:
//鍙戦�佽幏浼犳劅鍣ㄦā鍧楃姸鎬佹暟鎹�
byte[] sendDatabyte = new byte[]{
(byte) info.getBigType(),
@@ -887,6 +877,7 @@
case HDLApConfig.TYPE_SENSOR_FLOODING:
case HDLApConfig.TYPE_SENSOR_DOOR_MAGNET:
case HDLApConfig.TYPE_SENSOR_EMERGENCY_BUTTON:
+ case HDLApConfig.TYPE_SENSOR_PM_10:
//鍙戦�佽幏浼犳劅鍣ㄦā鍧楃姸鎬佹暟鎹�
byte[] sendDatabyte = new byte[]{
(byte) 1,
@@ -936,8 +927,35 @@
HDLDeviceManager.isGetDeviceStateSuccess = false;
switch (info.getDeviceType()) {
case HDLApConfig.TYPE_AC_TECHSYS:
+ case HDLApConfig.TYPE_AC_KNXTECHSYS:
//鍙戦�佺鎶�绯荤粺鐘舵�佹暟鎹�
addSendData(info, new byte[]{(byte) info.getChannelNum()}, Configuration.STATE);
+ break;
+ default:
+ HDLLog.I("涓嶆槸绉戞妧绯荤粺璁惧");
+ break;
+ }
+ }
+
+ /**
+ * 鑾峰彇绉戞妧绯荤粺瀹ゅ唴婀垮害鐘舵��
+ *
+ * @param info
+ */
+ public static void getTechSysDeviceHumidityFromNetwork(final AppliancesInfo info) {
+ if (info == null) {
+ return;
+ }
+ info.setGetDeviceStateSuccess(false);
+ switch (info.getDeviceType()) {
+ case HDLApConfig.TYPE_AC_KNXTECHSYS:
+ //鍙戦�佺鎶�绯荤粺鐘舵�佹暟鎹�
+ byte[] sendDatabyte = new byte[]{
+ (byte) info.getBigType(),
+ (byte) info.getLittleType(),
+ (byte) info.getChannelNum()
+ };
+ addCommandSendData(info, sendDatabyte, Configuration.SENSOR_STATE_COMMAND);
break;
default:
HDLLog.I("涓嶆槸绉戞妧绯荤粺璁惧");
@@ -970,6 +988,7 @@
case HDLApConfig.TYPE_CURTAIN_GLYSTRO:
case HDLApConfig.TYPE_CURTAIN_ROLLER:
case HDLApConfig.TYPE_CURTAIN_MODULE:
+ case HDLApConfig.TYPE_CURTAIN_SHANGRILA:
int curtainState = getCurtainState(info);
info.setCurState(curtainState);
EventBus.getDefault().post(new DeviceStateEvent(info, true));
@@ -980,6 +999,7 @@
case HDLApConfig.TYPE_AC_INFRARED:
case HDLApConfig.TYPE_AC_PANEL:
case HDLApConfig.TYPE_AC_TECHSYS:
+ case HDLApConfig.TYPE_AC_KNXTECHSYS:
//2019-8-21 澧炲姞鍒ょ┖
byte[] acState = getACState(info);
if (acState != null && acState.length >= 4) {
@@ -1205,6 +1225,7 @@
case HDLApConfig.TYPE_AC_HVAC:
case HDLApConfig.TYPE_AC_PANEL:
case HDLApConfig.TYPE_AC_TECHSYS:
+ case HDLApConfig.TYPE_AC_KNXTECHSYS:
curState = infos.get(j).getArrCurState();
break;
default:
@@ -1780,7 +1801,7 @@
@Override
public void run() {
//2019-07 鎺у埗鍙戦�佹鏁�
- if (sendDatas.count >= 4) {
+ if (sendDatas.count >= 3) {
sendCycleTimer.cancel();
} else {
sendDatas.count++;
@@ -1807,10 +1828,44 @@
}
}, 1, 500);
-
-
}
+ /**
+ * 鍗曡澶囧彂閫佸懡浠�
+ * 鐩墠鎺у埗鍙戦�佹鏁颁负3娆�
+ * 鍙戜竴鏉�,琛ュ彂3鏉★紝闂撮殧500ms
+ *
+ * @param info
+ * @param addBytes
+ */
+ private static void addCommandSendData(final AppliancesInfo info, byte[] addBytes, final int command) {
+
+ final Crc sendDatas = new Crc(info.getStateCommand(), info.getDeviceSubnetID(), info.getDeviceDeviceID(), addBytes);
+ sendDatas.count = 0;
+
+ final Timer sendCycleTimer = new Timer();
+ sendCycleTimer.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ //2019-07 鎺у埗鍙戦�佹鏁�
+ if (sendDatas.count >= 3) {
+ sendCycleTimer.cancel();
+ } else {
+ sendDatas.count++;
+ sendDatas.command = command;
+ HDLLog.I("---getDevice锛� " + info.getDeviceKey() + " ---command锛� " + Integer.toHexString(command));//2019-8-2
+ sendDatas.isCtrlSuccess = info.isGetDeviceStateSuccess();
+
+ if (!sendDatas.isCtrlSuccess) {
+ HDLLog.I("璇诲彇鍙戦�佺" + sendDatas.count + "娆�");
+ cusSendCommand(sendDatas.command, info.getDeviceSubnetID(), info.getDeviceDeviceID(), sendDatas.addBytes);
+ } else {
+ sendCycleTimer.cancel();
+ }
+ }
+ }
+ }, 1, 500);
+ }
/**
* 鍙戦�佸箍鎾垨鐐瑰鐐瑰懡浠�
@@ -1821,9 +1876,12 @@
* @param addBytes 闄勫姞鏁版嵁
*/
public static void cusSendCommand(int command, int subnetID, int deviceID, byte[] addBytes) {
- Crc sendDatas = new Crc(command, subnetID, deviceID, addBytes);
- HDLSerialPortCore.sendData(sendDatas);
-
+ if (HDLSerialPortCore.getIsModule()) {
+ Crc sendDatas = new Crc(command, subnetID, deviceID, addBytes);
+ HDLSerialPortCore.sendData(sendDatas);
+ } else {
+ SendDatas.AddSendData(command, subnetID, deviceID, addBytes);
+ }
}
/**
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 89e0cdd..6f5f7a6 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
@@ -8,10 +8,17 @@
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;
+import com.hdl.sdk.ttl.Config.Configuration;
import com.hdl.sdk.ttl.Config.MCUConstants;
+import com.hdl.sdk.ttl.HDLAppliances.Config.HDLApConfig;
+import com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition.AirCtrlBackInfo;
import com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition.AirHVACBackInfo;
import com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition.AirTechSysBackInfo;
+import com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition.Parser.AirCtrlParser;
+import com.hdl.sdk.ttl.HDLAppliances.HDLAudio.HDLAudio;
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.DoorMachineFristBackInfo;
import com.hdl.sdk.ttl.HDLAppliances.HDLDoorMachine.DoorMachineWaringBackInfo;
@@ -19,16 +26,33 @@
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.HDLLight.LightCtrlBackInfo;
+import com.hdl.sdk.ttl.HDLAppliances.HDLLogic.LogicCtrlBackInfo;
+import com.hdl.sdk.ttl.HDLAppliances.HDLLogic.LogicMode;
+import com.hdl.sdk.ttl.HDLAppliances.HDLLogic.SceneCtrlBackInfo;
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.HDLAppliances.HDLWarning.WarningType;
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.DevicesData;
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.ListRemarks;
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.ListSceneRemarks;
import com.hdl.sdk.ttl.HDLDeviceManger.Bean.MCUConfigurationBean;
import com.hdl.sdk.ttl.HDLDeviceManger.Bean.MCUDataBean;
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.RcuCurtain;
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.RcuLight;
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.ScenesData;
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.UdpDataBean;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.AirFeedBackEvent;
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.CurtainDeviceStateEvent;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.CurtainFeedBackEvent;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DeviceStateEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DiscoverNewDevicesEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DoorMachineFeedBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DoorMachineFeedFristBackEvent;
@@ -36,39 +60,19 @@
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;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.SceneFeedBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.SecurityAlarmFeedBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.SecurityArmingFeedBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.UpdateRemarkFeedBackEvent;
-import com.hdl.sdk.ttl.HDLDeviceManger.Parser.DeviceParser;
-import com.hdl.sdk.ttl.Config.Configuration;
-import com.hdl.sdk.ttl.HDLAppliances.Config.HDLApConfig;
-import com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition.AirCtrlBackInfo;
-import com.hdl.sdk.ttl.HDLAppliances.HDLAirCondition.Parser.AirCtrlParser;
-import com.hdl.sdk.ttl.HDLAppliances.HDLAudio.HDLAudio;
-import com.hdl.sdk.ttl.HDLAppliances.HDLCurtain.CurtainCtrlBackInfo;
-import com.hdl.sdk.ttl.HDLAppliances.HDLCurtain.Parser.CurtainCtrlParser;
-import com.hdl.sdk.ttl.HDLAppliances.HDLLight.LightCtrlBackInfo;
-import com.hdl.sdk.ttl.HDLAppliances.HDLLogic.LogicCtrlBackInfo;
-import com.hdl.sdk.ttl.HDLAppliances.HDLLogic.LogicMode;
-import com.hdl.sdk.ttl.HDLAppliances.HDLWarning.WarningType;
-import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
-import com.hdl.sdk.ttl.HDLDeviceManger.Bean.DevicesData;
-import com.hdl.sdk.ttl.HDLDeviceManger.Bean.ListRemarks;
-import com.hdl.sdk.ttl.HDLDeviceManger.Bean.RcuCurtain;
-import com.hdl.sdk.ttl.HDLDeviceManger.Bean.RcuLight;
-import com.hdl.sdk.ttl.HDLDeviceManger.Bean.UdpDataBean;
-import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.AirFeedBackEvent;
-import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.CurtainFeedBackEvent;
-import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DeviceStateEvent;
-import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.LightFeedBackEvent;
-import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.LogicFeedBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.WarningInfoEvent;
+import com.hdl.sdk.ttl.HDLDeviceManger.Parser.DeviceParser;
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 com.hdl.sdk.ttl.Utils.SPUtils.SPUtils;
-//import com.hdl.sdk.ttl.Utils.TransformUtils.DataConverseUtils;
import org.greenrobot.eventbus.EventBus;
@@ -93,22 +97,19 @@
public class HDLDeviceManager {
public static List<String> rcuIpList = new ArrayList<>();//缁熻Rcu ip鍦板潃鍒楄〃
- public static List<DevicesData> devicesDataList = new ArrayList<>();//缁熻鎼滅储鍒楄〃
- public static List<DevicesData> realDevicesDataList = new ArrayList<>();//缁熻鎼滅储鍒楄〃
+ public static List<DevicesData> devicesDataList = new ArrayList<>();//缁熻璁惧鎼滅储鍒楄〃
+ public static List<DevicesData> realDevicesDataList = new ArrayList<>();//缁熻璁惧鎼滅储鍒楄〃
+ public static int totalDeviceSize = 0;
+ public static List<ScenesData> scenesDataList = new ArrayList<>();//缁熻鍦烘櫙鎼滅储鍒楄〃
private static Context viewContext;
public static List<ListRemarks> listRemarks = new ArrayList<>();
+ public static List<ListSceneRemarks> listSceneRemarks = new ArrayList<>();
public static List<RcuLight> rcuLightList = new ArrayList<>();
public static List<RcuCurtain> rcuCurtainList = new ArrayList<>();
public static boolean isLogicCtrl = false;
public static ConcurrentHashMap<String, Boolean> ctrlSuccessStateHashMap = new ConcurrentHashMap<>();//2019-8-2
-
-// public static byte[] air1Info = null;
-// public static byte[] air2Info = null;
-// public static byte[] air3Info = null;
-// public static byte[] air4Info = null;
-
- public static boolean isGetDeviceStateSuccess = false; //鍒ゆ柇鑾峰彇璁惧鐘舵�佹槸鍚︽帶鍒舵垚鍔�
+ public static boolean isGetDeviceStateSuccess = false; //鍒ゆ柇鑾峰彇璁惧鐘舵�佹槸鍚﹁鍙栨垚鍔�
public static boolean isUpdateRemarkSuccess = false; //鍒ゆ柇淇敼璁惧鍚嶆槸鍚︽垚鍔�
public static boolean isMCUCtrlSuccess = false; //鍒ゆ柇鏄惁涓嶮CU閫氫俊鎴愬姛
@@ -116,9 +117,12 @@
// public static boolean isLightCtrlSuccess = false; //鍒ゆ柇鐏厜鏄惁鎺у埗鎴愬姛
// public static boolean isCurtainCtrlSuccess = false; //鍒ゆ柇绐楀笜鏄惁鎺у埗鎴愬姛
// public static boolean isACCtrlSuccess = false; //鍒ゆ柇绌鸿皟鏄惁鎺у埗鎴愬姛
-// public static boolean isSceneCtrlSuccess = false; //鍒ゆ柇鍦烘櫙鏄惁鎺у埗鎴愬姛
+
// public static boolean isSecurityCtrlSuccess = false; //鍒ゆ柇瀹夐槻妯″潡鏄惁閫氫俊鎴愬姛
+ public static boolean isGetBusLightState = false;
+ public static boolean isGetSceneRemarkSuccess = false; //鍒ゆ柇鑾峰彇鍦烘櫙璇︽儏鎴愬姛
+ public static boolean isSceneCtrlSuccess = false; //鍒ゆ柇鍦烘櫙鏄惁鎺у埗鎴愬姛
/**
* 鍒濆鍖� SDK HDLDeviceManager鍒濆鍖�
@@ -140,6 +144,14 @@
}
}
+ public static boolean getIsGetBusLightState() {
+ return isGetBusLightState;
+ }
+
+ public static void setIsGetBusLightState(boolean isGetBusLightState) {
+ HDLDeviceManager.isGetBusLightState = isGetBusLightState;
+ }
+
/**
* 閲婃斁鍏抽棴涓插彛
*/
@@ -154,25 +166,26 @@
* @param commandType 鍛戒护绫诲瀷
*/
public static void handle(UdpDataBean getDatas, int commandType) {
- Log.e("panlili", "commandType=" + Integer.toHexString(commandType)+" desDeviceID=" + getDatas.desDeviceID + " sourceDeviceID=" + getDatas.sourceDeviceID);
+// Log.e("panlili", "commandType=" + Integer.toHexString(commandType) + " sourceSubnetID=" + getDatas.sourceSubnetID + " sourceDeviceID=" + getDatas.sourceDeviceID);
switch (commandType) {
- case Configuration.DEVICES_SEARCH_BACK_COMMAND:
- if (HandleSearch.isGetRcuIp) {
-// handleRcuIp(getDatas);
+ case Configuration.SEARCH_GATEWAY_BACK_COMMAND:
+ break;
+ case Configuration.DEVICES_SEARCH_FROM_GATEWAY_BACK_COMMAND://璇诲彇缃戝叧宸查厤缃姛鑳�
+ handleSearchData(getDatas);
+ break;
+ case Configuration.DEVICES_READ_FROM_GATEWAY_BACK_COMMAND://渚濇璇诲彇璁惧淇℃伅
+ if (isLogicCtrl) {
+ isLogicCtrl = false;
+ handleLogicAir(getDatas);
} else {
- boolean isExit = false;
- for (DevicesData value : realDevicesDataList) {
- if (value.getSourceDeviceID() == getDatas.sourceDeviceID
- && value.getSourceSubnetID() == getDatas.sourceSubnetID) {
- HDLLog.I("Device is Exit " + value.getRemark());
- isExit = true;
- break;
- }
- }
- if (!isExit) {
- handleSearchData(getDatas);
- }
+ handleRemarkCurStateData(getDatas);
}
+ break;
+ case Configuration.SCENE_SEARCH_FROM_GATEWAY_BACK_COMMAND:
+ handleSearchSceneData(getDatas);
+ break;
+ case Configuration.SCENE_READ_FROM_GATEWAY_BACK_COMMAND:
+ handleSceneCurStateData(getDatas);
break;
/***2020-07-20 鏂板鏂伴璁惧**/
case Configuration.FRESH_AIR_STATE_BACK_COMMAND:
@@ -219,8 +232,11 @@
case Configuration.LIGHT_CTRL_BACK_COMMAND:
case Configuration.CURTAIN_CTRL_BACK_COMMAND:
case Configuration.AIR_CTRL_BACK_COMMAND:
- case Configuration.LOGIC_CTRL_BACK_COMMAND:
handleCtrlData(getDatas);
+ break;
+ case Configuration.LOGIC_CTRL_BACK_COMMAND:
+ handleLogicCtrlData(getDatas);//閫昏緫妯″潡鎺у埗
+ handleSceneCtrlData(getDatas);//鍦烘櫙鎺у埗
break;
case Configuration.LIGHT_RGB_CTRL_BACK_COMMAND:
handleColourLightStateData(getDatas);
@@ -233,15 +249,6 @@
case Configuration.SECURITY_ALARM_CTRL_BACK_COMMAND://鎶ヨ璁剧疆鍙嶉
handleSecurityCtrlData(getDatas);
break;
-// 鑾峰彇璁惧澶囨敞
- case Configuration.DEVICES_READ_BACK_COMMAND:
- if (isLogicCtrl) {
- isLogicCtrl = false;
- handleLogicAir(getDatas);
- } else {
- handleRemarkCurStateData(getDatas);
- }
- break;
// 鑾峰彇璁惧鐘舵��
case Configuration.AIR_STATE_BACK_COMMAND:
handleAirStateData(getDatas);
@@ -249,6 +256,7 @@
case Configuration.SENSOR_STATE_BACK_COMMAND:
case Configuration.SENSOR_BROADCAST_STATE_BACK_COMMAND:
handleSensorBroadcastStateData(getDatas);
+ handleKNXTechSysStateData(getDatas);
break;
case Configuration.DRY_CONTACT_STATE_BACK_COMMAND:
case Configuration.DRY_CONTACT_BROADCAST_STATE_COMMAND:
@@ -271,7 +279,6 @@
break;
case Configuration.AIR_HVAC_STATE_BACK_COMMAND:
// handleRcuAirCastData(getDatas);
- HDLLog.I("鍙戦�佺涓�娆″灞呮悳绱�");
handleHVACStateData(getDatas);//2019-06-27
handleTechSysStateData(getDatas);//2023-08-21
break;
@@ -302,8 +309,10 @@
case Configuration.MANUAL_ADD_DEVICE_COMMAND:
boolean isExit = false;
for (DevicesData value : realDevicesDataList) {
- if (value.getSourceDeviceID() == getDatas.sourceDeviceID
- && value.getSourceSubnetID() == getDatas.sourceSubnetID) {
+ if (value.getSourceSubnetID() == getDatas.sourceSubnetID
+ && value.getSourceDeviceID() == getDatas.sourceDeviceID
+ && value.getDeviceSubnetID() == (getDatas.addBytes[6] & 0xFF)
+ && value.getDeviceDeviceID() == (getDatas.addBytes[7] & 0xFF)) {
isExit = true;
break;
}
@@ -379,25 +388,38 @@
devicesData.setSourceSubnetID(getDatas.sourceSubnetID);
devicesData.setSourceDeviceID(getDatas.sourceDeviceID);
devicesData.setAddByte(getDatas.addBytes);
- byte[] remarkByte;
- if (getDatas.addBytes.length >= 22) {
- remarkByte = new byte[20];
- System.arraycopy(getDatas.addBytes, 2, remarkByte, 0, remarkByte.length);
- } else {
- remarkByte = new byte[getDatas.addBytes.length - 2];
- System.arraycopy(getDatas.addBytes, 2, remarkByte, 0, getDatas.addBytes.length - 2);
- }
+ int size = (getDatas.addBytes[2] & 0xFF) * 256 + (getDatas.addBytes[3] & 0xFF);
+ int index = (getDatas.addBytes[4] & 0xFF) * 256 + (getDatas.addBytes[5] & 0xFF);
+ devicesData.setDeviceSize(size);
+ totalDeviceSize = size;
+ devicesData.setDeviceIndex(index);
+
+ byte[] remarkByte = new byte[getDatas.addBytes.length];
String remarkStr = HDLStringUtils.byte2String(remarkByte);
- HDLLog.I("remarkStr锛�" + remarkStr);
devicesData.setRemark(remarkStr);
+
boolean isExitData = DeviceParser.parse(getDatas.addBytes, devicesData, remarkStr);
- realDevicesDataList.add(devicesData);//璁板綍鎵�鏈夌殑鎺ユ敹鍒拌澶囷紝鍖呮嫭SDK涓嶆敮鎸佺殑璁惧绉嶇被銆備綔鐢細浣滀负鍙戦�佺浜屾鎼滅储鍛戒护鏃剁敤鍒�
+ boolean isExist = false;
+ for (DevicesData value : realDevicesDataList) {
+ if (value.getSourceSubnetID() == getDatas.sourceSubnetID
+ && value.getSourceDeviceID() == getDatas.sourceDeviceID
+ && value.getDeviceSubnetID() == (getDatas.addBytes[6] & 0xFF)
+ && value.getDeviceDeviceID() == (getDatas.addBytes[7] & 0xFF)) {
+ HDLLog.I("Device is isExist " + value.getRemark());
+ isExist = true;
+ break;
+ }
+ }
+ if (!isExist) {
+ realDevicesDataList.add(devicesData);//璁板綍鎵�鏈夌殑鎺ユ敹鍒拌澶囷紝鍖呮嫭SDK涓嶆敮鎸佺殑璁惧绉嶇被銆備綔鐢細浣滀负鍙戦�佺浜屾鎼滅储鍛戒护鏃剁敤鍒�
+ HDLLog.I("---totalDeviceSize=" + totalDeviceSize + " realDevicesDataList=" + realDevicesDataList.size());
+ }
/********************杈呭姪璋冭瘯鎵撳嵃*******************/
String addData = "";
- for (int i = 22, len = getDatas.addBytes.length; i < len; i++) {
+ for (int i = 0, len = getDatas.addBytes.length; i < len; i++) {
addData += " arr" + i + " = " + (getDatas.addBytes[i] & 0xFF) + ",";
}
HDLLog.I("鎵�鏈夎澶囧垪琛� 绗� " + realDevicesDataList.size() + " 涓ā鍧� "
@@ -411,12 +433,12 @@
// 鍒ゆ柇鏄惁绗﹀悎瑕佹眰鐨勫ぇ绫诲皬绫�
- if (isExitData) {
+ if (!isExist && isExitData) {
devicesDataList.add(devicesData);//璁板綍鎵�鏈夌殑鎺ユ敹鍒拌澶囷紝涓嶅寘鎷琒DK涓嶆敮鎸佺殑璁惧绉嶇被
/**2019-07-03 鍙戠幇鏂拌澶囷紝杩欓噷鍙互鍙戦�侀�氱煡浜嬩欢锛屽苟浼犻�掓柊鐨勮澶囨暟鎹�*/
EventBus.getDefault().post(new DiscoverNewDevicesEvent(devicesData));
-// 杩囨护鎺夎儗鏅煶涔愶紝鑳屾櫙闊充箰娌℃湁澶囨敞杩斿洖
+ //杩囨护鎺夎儗鏅煶涔愶紝鑳屾櫙闊充箰娌℃湁澶囨敞杩斿洖
if (devicesDataList.get(devicesDataList.size() - 1).getAppliancesInfoList().get(0).getBigType() != Configuration.AUDIO_BIG_TYPE) {
for (int i = 0, len = devicesDataList.get(devicesDataList.size() - 1).getAppliancesInfoList().size(); i < len; i++) {
ListRemarks listRemarksTemp = new ListRemarks();
@@ -425,8 +447,6 @@
listRemarks.add(listRemarksTemp);
}
}
-
-// HDLCommand.HDLgetDevRemarks(devicesDataList.get(devicesDataList.size()-1).getAppliancesInfoList());
/********************杈呭姪璋冭瘯鎵撳嵃*******************/
String deviceName = "";
@@ -447,6 +467,33 @@
}
/**
+ * 澶勭悊鎼滅储鍦烘櫙鏁版嵁
+ *
+ * @param getDatas
+ */
+ private static void handleSearchSceneData(UdpDataBean getDatas) {
+ int size = getDatas.addBytes[0] * 256 + getDatas.addBytes[1];
+
+ /********************杈呭姪璋冭瘯鎵撳嵃*******************/
+ for (int i = 0, len = size; i < len; i++) {
+ ScenesData scenesData = new ScenesData();
+ scenesData.setSourceSubnetID(getDatas.sourceSubnetID);
+ scenesData.setSourceDeviceID(getDatas.sourceDeviceID);
+ scenesData.setAddByte(getDatas.addBytes);
+ scenesData.setIndex(i + 1);
+ scenesDataList.add(scenesData);
+ HDLLog.I("鎵�鏈夊満鏅垪琛� 绗� " + scenesDataList.size() + " 涓ā鍧� "
+ + " \n婧愬瓙缃戝彿 = " + (getDatas.sourceSubnetID)
+ + " \n婧愯澶囧彿 = " + (getDatas.sourceDeviceID)
+ + " \n鍦烘櫙绱㈠紩 = " + scenesData.getIndex()
+ );
+ }
+
+ /********************杈呭姪璋冭瘯鎵撳嵃*******************/
+
+ }
+
+ /**
* 澶勭悊鐏厜杩斿洖
* 2020-1-18
* 淇娣峰悎璋冨厜娣峰悎寮�鍏� 绫绘ā鍧楅棶棰�
@@ -456,8 +503,8 @@
private static void handleLightCtrlData(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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
@@ -519,8 +566,8 @@
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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
@@ -554,13 +601,15 @@
switch (getDatas.command) {
case Configuration.LIGHT_CTRL_BACK_COMMAND:
handleLightCtrlData(getDatas);
-
+ if (!HDLDeviceManager.isGetBusLightState) {
+ isGetDeviceStateSuccess = true;
+ }
break;
case Configuration.CURTAIN_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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
inner:
@@ -584,12 +633,13 @@
curtainCtrlBackInfo.setRemarks(curtainInfo.getRemarks());
curtainCtrlBackInfo.setParentRemarks(curtainInfo.getParentRemarks());
curtainCtrlBackInfo.setAppliancesInfo(curtainInfo);
-// isCurtainCtrlSuccess = true;
setDeviceCtrlSuccessStateWithInfo(infos.get(j), true);
+
if (curtainInfo.getDeviceType() == HDLApConfig.TYPE_CURTAIN_GLYSTRO
- || curtainInfo.getDeviceType() == HDLApConfig.TYPE_CURTAIN_ROLLER) {
+ || curtainInfo.getDeviceType() == HDLApConfig.TYPE_CURTAIN_ROLLER
+ || curtainInfo.getDeviceType() == HDLApConfig.TYPE_CURTAIN_SHANGRILA) {
if ((getDatas.addBytes[0] & 0xFF) >= 17) {
- int curState = getDatas.addBytes[1] & 0xFF;
+ int curState = getDatas.addBytes[1] & 0xFF;//V1.0鐧惧垎姣�
if (curState == 1) {
//杩欎釜鍒ゆ柇寰堝偦锛岀獥甯樺叧鍒扮櫨鍒嗘瘮涓�0锛屼細璺冲埌1杩斿洖鍥炴潵锛屽彧鑳藉己鍒舵敼涓�0
curState = 0;
@@ -598,16 +648,23 @@
curState = 100;
}
curtainCtrlBackInfo.setState(curState);
+
devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(curState);
- devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(curState);
+ devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes);
curtainCtrlBackInfo.setNum((getDatas.addBytes[0] & 0xFF) - 16);
EventBus.getDefault().post(new CurtainFeedBackEvent(curtainCtrlBackInfo, true));
+ } else {
+ if (getDatas.addBytes.length >= 3) {
+ curtainCtrlBackInfo = new CurtainCtrlBackInfo(devicesDataList.get(i).getAppliancesInfoList().get(j));
+ devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes);
+ curtainCtrlBackInfo.setNum(getDatas.addBytes[0] & 0xFF);
+ EventBus.getDefault().post(new CurtainFeedBackEvent(curtainCtrlBackInfo, true));
+ }
}
- }
- if (curtainInfo.getDeviceType() == HDLApConfig.TYPE_CURTAIN_MODULE) {
+ } else if (curtainInfo.getDeviceType() == HDLApConfig.TYPE_CURTAIN_MODULE) {
if ((getDatas.addBytes[0] & 0xFF) < 17) {
int state = getDatas.addBytes[1] & 0xFF;
- switch (getDatas.addBytes[1] & 0xFF) {//杩欓噷涔熷簲璇ユ敼鎴�0锛�1锛�2
+ switch (state) {//杩欓噷涔熷簲璇ユ敼鎴�0锛�1锛�2
case 0:
state = CurtainCtrlParser.curtainPause;
break;
@@ -624,15 +681,11 @@
curtainCtrlBackInfo.setState(state);
curtainCtrlBackInfo.setNum(getDatas.addBytes[0] & 0xFF);
devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(state);
- devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(state);
+ devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes);
EventBus.getDefault().post(new CurtainFeedBackEvent(curtainCtrlBackInfo, true));
}
}
-
-
break outter;
-
-
}
}
}
@@ -641,8 +694,8 @@
case Configuration.AIR_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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
@@ -745,39 +798,82 @@
}
}
break;
+ }
+ }
+
+ /**
+ * 澶勭悊閫昏緫 鎺у埗鍥炶皟
+ * 2024-1-19
+ *
+ * @param getDatas
+ */
+ private static void handleLogicCtrlData(UdpDataBean getDatas) {
+ switch (getDatas.command) {
case Configuration.LOGIC_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 ((infos.get(j).getBigType() == Configuration.LOGIC_BIG_TYPE
- || infos.get(j).getBigType() == Configuration.GLOBAL_LOGIC_BIG_TYPE)
- && infos.get(j).getLogicMode().getAreaNum() == (getDatas.addBytes[0] & 0xFF)
- && infos.get(j).getLogicMode().getAreaSceneNum() == (getDatas.addBytes[1] & 0xFF)
- ) {
- AppliancesInfo sceneInfo = infos.get(j);
- LogicMode logicMode = new LogicMode();
- logicMode.setAreaNum(getDatas.addBytes[0] & 0xFF);
- logicMode.setAreaSceneNum(getDatas.addBytes[1] & 0xFF);
- sceneInfo.setLogicMode(logicMode);
+ if (devicesDataList != null && devicesDataList.size() != 0) {
+ for (int i = 0, len = devicesDataList.size(); i < len; i++) {
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == 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.LOGIC_BIG_TYPE
+ || infos.get(j).getBigType() == Configuration.GLOBAL_LOGIC_BIG_TYPE)
+ && infos.get(j).getLogicMode().getAreaNum() == (getDatas.addBytes[0] & 0xFF)
+ && infos.get(j).getLogicMode().getAreaSceneNum() == (getDatas.addBytes[1] & 0xFF)) {
+ AppliancesInfo sceneInfo = infos.get(j);
+ LogicMode logicMode = new LogicMode();
+ logicMode.setAreaNum(getDatas.addBytes[0] & 0xFF);
+ logicMode.setAreaSceneNum(getDatas.addBytes[1] & 0xFF);
+ sceneInfo.setLogicMode(logicMode);
- LogicCtrlBackInfo logicCtrlBackInfo = new LogicCtrlBackInfo();
- logicCtrlBackInfo.setAppliancesInfo(sceneInfo);
- logicCtrlBackInfo.setAreaNum(getDatas.addBytes[0] & 0xFF);
- logicCtrlBackInfo.setSceneNum(getDatas.addBytes[1] & 0xFF);
+ LogicCtrlBackInfo logicCtrlBackInfo = new LogicCtrlBackInfo();
+ logicCtrlBackInfo.setAppliancesInfo(sceneInfo);
+ logicCtrlBackInfo.setAreaNum(getDatas.addBytes[0] & 0xFF);
+ logicCtrlBackInfo.setSceneNum(getDatas.addBytes[1] & 0xFF);
// isSceneCtrlSuccess = true;
- setDeviceCtrlSuccessStateWithInfo(infos.get(j), true);
- EventBus.getDefault().post(new LogicFeedBackEvent(logicCtrlBackInfo, true));
+ setDeviceCtrlSuccessStateWithInfo(infos.get(j), true);
+ EventBus.getDefault().post(new LogicFeedBackEvent(logicCtrlBackInfo, true));
- break outter;
+ break outter;
+ }
}
}
}
}
+ break;
+ }
+ }
+ /**
+ * 澶勭悊鍦烘櫙 鎺у埗鍥炶皟
+ * 2024-1-19
+ *
+ * @param getDatas
+ */
+ private static void handleSceneCtrlData(UdpDataBean getDatas) {
+ switch (getDatas.command) {
+ case Configuration.LOGIC_CTRL_BACK_COMMAND:
+ outter:
+ if (scenesDataList != null && scenesDataList.size() != 0) {
+ for (int i = 0, len = scenesDataList.size(); i < len; i++) {
+ if (scenesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID
+ && scenesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID
+ && scenesDataList.get(i).getAreaCodeID() == (getDatas.addBytes[0] & 0xFF)
+ && scenesDataList.get(i).getSceneID() == (getDatas.addBytes[1] & 0xFF)) {
+
+ SceneCtrlBackInfo sceneCtrlBackInfo = new SceneCtrlBackInfo();
+ sceneCtrlBackInfo.setAreaCodeID(getDatas.addBytes[0] & 0xFF);
+ sceneCtrlBackInfo.setSceneID(getDatas.addBytes[1] & 0xFF);
+ sceneCtrlBackInfo.setLoopNum(getDatas.addBytes[2] & 0xFF);
+
+ setSceneCtrlSuccess(true);
+ EventBus.getDefault().post(new SceneFeedBackEvent(sceneCtrlBackInfo, true));
+
+ break outter;
+ }
+ }
+ }
break;
}
}
@@ -794,8 +890,8 @@
case Configuration.SECURITY_ARMING_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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
@@ -825,8 +921,8 @@
case Configuration.SECURITY_ALARM_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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
@@ -873,8 +969,8 @@
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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
@@ -912,13 +1008,14 @@
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) {
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == 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).getDeviceType() == HDLApConfig.TYPE_AC_TECHSYS
+ || infos.get(j).getDeviceType() == HDLApConfig.TYPE_AC_KNXTECHSYS)
&& infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {
devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes);
@@ -964,8 +1061,8 @@
private static void handleLogicAir(UdpDataBean getDatas) {
AppliancesInfo newInfo1 = null;
for (int devPos = 0, len = devicesDataList.size(); devPos < len; devPos++) {
- if (devicesDataList.get(devPos).getSourceSubnetID() == getDatas.sourceSubnetID
- && devicesDataList.get(devPos).getSourceDeviceID() == getDatas.sourceDeviceID
+ if (devicesDataList.get(devPos).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(devPos).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(devPos).getAppliancesInfoList();
for (int appPos = 0, len2 = infos.size(); appPos < len2; appPos++) {
@@ -1102,151 +1199,45 @@
outter:
for (int devPos = 0, len = devicesDataList.size(); devPos < len; devPos++) {
if (devicesDataList.get(devPos).getSourceSubnetID() == getDatas.sourceSubnetID
- && devicesDataList.get(devPos).getSourceDeviceID() == getDatas.sourceDeviceID
- ) {
+ && devicesDataList.get(devPos).getSourceDeviceID() == getDatas.sourceDeviceID) {
List<AppliancesInfo> infos = devicesDataList.get(devPos).getAppliancesInfoList();
for (int appPos = 0, len2 = infos.size(); appPos < len2; appPos++) {
- if ((infos.get(appPos).getBigType()) == (getDatas.addBytes[0] & 0xFF)
- && ((infos.get(appPos).getLittleType()) == (getDatas.addBytes[1] & 0xFF))
+ if ((infos.get(appPos).getDeviceSubnetID()) == (getDatas.addBytes[0] & 0xFF)
+ && (infos.get(appPos).getDeviceDeviceID()) == (getDatas.addBytes[1] & 0xFF)
&& ((infos.get(appPos).getChannelNum()) == (getDatas.addBytes[2] & 0xFF))
- ) {
+ && (infos.get(appPos).getBigType()) == (getDatas.addBytes[3] & 0xFF)
+ && ((infos.get(appPos).getLittleType()) == (getDatas.addBytes[4] & 0xFF))) {
- //2019-8-20
+ //2023-11-30
byte[] remarkByte;
- if (getDatas.addBytes.length >= 23) {
+ if (getDatas.addBytes.length >= 26) {
remarkByte = new byte[20];
- System.arraycopy(getDatas.addBytes, 3, remarkByte, 0, remarkByte.length);
+ System.arraycopy(getDatas.addBytes, 6, remarkByte, 0, remarkByte.length);
} else {
remarkByte = new byte[getDatas.addBytes.length - 3];
- System.arraycopy(getDatas.addBytes, 3, remarkByte, 0, getDatas.addBytes.length - 3);
+ System.arraycopy(getDatas.addBytes, 6, remarkByte, 0, getDatas.addBytes.length - 3);
}
String remarkStr = HDLStringUtils.byte2String(remarkByte);
- HDLLog.I("remarkStr鍥炶矾锛�" + remarkStr);
+ HDLLog.I("remarkStr鑾峰彇鐨勫娉ㄥ悕涓猴細" + remarkStr);
+ devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setChannelNum(getDatas.addBytes[5] & 0xFF);
devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setRemarks(remarkStr);
- switch (infos.get(appPos).getBigType()) {
- case Configuration.LOGIC_BIG_TYPE:
- case Configuration.GLOBAL_LOGIC_BIG_TYPE:
- LogicMode logicMode = new LogicMode();
- logicMode.setAreaNum(getDatas.addBytes[getDatas.addBytes.length - 2] & 0xFF);
- logicMode.setAreaSceneNum(getDatas.addBytes[getDatas.addBytes.length - 1] & 0xFF);
+ String key = "K" + devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).getBigType()
+ + "-" + devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).getLittleType()
+ + "-" + devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).getDeviceSubnetID()
+ + "-" + devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).getDeviceDeviceID()
+ + "-" + devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).getChannelNum();
+ devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setDeviceKey(key);
- devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setLogicMode(logicMode);
-
- break;
- case Configuration.LIGTH_BIG_TYPE:
- switch (infos.get(appPos).getLittleType()) {
- case 0:
- 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;
- case 1:
- 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;
- case 9:
- RcuLight rcuLight = new RcuLight();
- rcuLight.setPhysicsChanelNum(getDatas.addBytes[getDatas.addBytes.length - 1] & 0xFF);
- rcuLight.setCurState(getDatas.addBytes[getDatas.addBytes.length - 2] & 0xFF);
- rcuLight.setLittleType(9);
- rcuLightList.add(rcuLight);
- devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setPhysicsChannelNum(getDatas.addBytes[getDatas.addBytes.length - 1] & 0xFF);
- devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setCurState(getDatas.addBytes[getDatas.addBytes.length - 2] & 0xFF);
- devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setIntCurState(getDatas.addBytes[getDatas.addBytes.length - 2] & 0xFF);
- break;
- case 10:
- RcuLight rcu2Light = new RcuLight();
- rcu2Light.setPhysicsChanelNum(getDatas.addBytes[getDatas.addBytes.length - 1] & 0xFF);
- rcu2Light.setCurState(getDatas.addBytes[getDatas.addBytes.length - 2] & 0xFF);
- rcu2Light.setLittleType(10);
- rcuLightList.add(rcu2Light);
- devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setPhysicsChannelNum(getDatas.addBytes[getDatas.addBytes.length - 1] & 0xFF);
- devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setCurState(getDatas.addBytes[getDatas.addBytes.length - 2] & 0xFF);
- devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setIntCurState(getDatas.addBytes[getDatas.addBytes.length - 2] & 0xFF);
- break;
-
- }
- break;
- case Configuration.CURTAIN_BIG_TYPE:
- int curtainState;
- switch (infos.get(appPos).getLittleType()) {
- case 0:
- curtainState = getDatas.addBytes[25] & 0xFF;
- if (curtainState == 1) {
- curtainState = 0;
- } else if (curtainState == 99) {
- curtainState = 100;
- }
- devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setCurState(curtainState);
- devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setIntCurState(curtainState);
- break;
- case 1:
- curtainState = getDatas.addBytes[23] & 0xFF;
- if (curtainState == 1) {
- curtainState = 0;
- } else if (curtainState == 99) {
- curtainState = 100;
- }
- devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setCurState(curtainState);
- devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setIntCurState(curtainState);
- break;
- case 2:
- 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;
-
- case Configuration.AIR_BIG_TYPE:
- switch (infos.get(appPos).getLittleType()) {
- case 0:
- byte[] hvacBytes = new byte[getDatas.addBytes.length - 23];
- for (int i = 23; i < getDatas.addBytes.length; i++) {
- hvacBytes[i - 23] = getDatas.addBytes[i];
- }
- devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setArrCurState(hvacBytes);
- break;
- case 3:
- byte[] newBytes = new byte[getDatas.addBytes.length - 24 + 1];
- for (int i = 24; i < getDatas.addBytes.length; i++) {
- newBytes[i - 24] = getDatas.addBytes[i];
- }
- devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setArrCurState(newBytes);
- break;
- }
- break;
- case Configuration.SENSOR_BIG_TYPE:
- int curState;
- if (getDatas.addBytes.length >= 26) {//2023-11-14 鐗规畩澶勭悊锛屼慨鏀瑰洖璺彿涓虹墿鐞嗗洖璺紙鍥犱负ZigBee杞琤us杞崲鍣ㄧ敤鐨勯兘鏄墿鐞嗗洖璺紝灏嗛�昏緫鍥炶矾璁句负鐗╃悊鍥炶矾澶勭悊锛�
- curState = (int) (getDatas.addBytes[24] & 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;
- }
listRemarksOutter:
for (int lRPos = 0, len3 = listRemarks.size(); lRPos < len3; lRPos++) {
- //鎵惧埌E44B瀵瑰簲鐨勮澶囧洖璺紝鍒ゆ柇鏄惁宸茬粡鎷垮埌浜嗘暟鎹��
- if (listRemarks.get(lRPos).getAppliancesInfo().getDeviceSubnetID() == getDatas.sourceSubnetID
- && listRemarks.get(lRPos).getAppliancesInfo().getDeviceDeviceID() == getDatas.sourceDeviceID
- && listRemarks.get(lRPos).getAppliancesInfo().getBigType() == (getDatas.addBytes[0] & 0xFF)
- && listRemarks.get(lRPos).getAppliancesInfo().getLittleType() == (getDatas.addBytes[1] & 0xFF)
+ //鎵惧埌F44B瀵瑰簲鐨勮澶囧洖璺紝鍒ゆ柇鏄惁宸茬粡鎷垮埌浜嗘暟鎹��
+ if (listRemarks.get(lRPos).getAppliancesInfo().getDeviceSubnetID() == (getDatas.addBytes[0] & 0xFF)
+ && listRemarks.get(lRPos).getAppliancesInfo().getDeviceDeviceID() == (getDatas.addBytes[1] & 0xFF)
&& listRemarks.get(lRPos).getAppliancesInfo().getChannelNum() == (getDatas.addBytes[2] & 0xFF)
- ) {
+ && listRemarks.get(lRPos).getAppliancesInfo().getBigType() == (getDatas.addBytes[3] & 0xFF)
+ && listRemarks.get(lRPos).getAppliancesInfo().getLittleType() == (getDatas.addBytes[4] & 0xFF)) {
//鑻ユ病鎷垮埌鏁版嵁锛屽垯鎷挎暟鎹紱鑻ュ凡缁忔嬁鍒版暟鎹紝闇�瑕佸垽鏂璴istRemarks鍏ㄩ儴鏉$洰鏄惁鎷垮埌澶囨敞銆�
@@ -1289,6 +1280,70 @@
}
/**
+ * 澶勭悊鎵�鏈夊満鏅鎯呮暟鎹�佽缃綋鍓嶅満鏅姸鎬�
+ *
+ * @param getDatas
+ */
+ private static void handleSceneCurStateData(UdpDataBean getDatas) {
+ outter:
+ for (int devPos = 0, len = scenesDataList.size(); devPos < len; devPos++) {
+ if (scenesDataList.get(devPos).getSourceSubnetID() == getDatas.sourceSubnetID
+ && scenesDataList.get(devPos).getSourceDeviceID() == getDatas.sourceDeviceID
+ && scenesDataList.get(devPos).getIndex() == (getDatas.addBytes[0] * 256 + getDatas.addBytes[1])) {
+ //2024-01-18
+ byte[] remarkByte;
+ String remarkStr = "";
+ if (getDatas.addBytes.length >= 36) {
+ remarkByte = new byte[32];
+ System.arraycopy(getDatas.addBytes, 4, remarkByte, 0, remarkByte.length);
+ remarkStr = HDLStringUtils.byte2String(remarkByte);
+ }
+
+ HDLLog.I("remarkStr鑾峰彇鐨勫満鏅娉ㄥ悕涓猴細" + remarkStr);
+ scenesDataList.get(devPos).setAreaCodeID(getDatas.addBytes[2] & 0xFF);
+ scenesDataList.get(devPos).setSceneID(getDatas.addBytes[3] & 0xFF);
+ scenesDataList.get(devPos).setRemark(remarkStr);
+
+ listRemarksOutter:
+ for (int lRPos = 0, len3 = scenesDataList.size(); lRPos < len3; lRPos++) {
+ //鎵惧埌F44B瀵瑰簲鐨勮澶囧洖璺紝鍒ゆ柇鏄惁宸茬粡鎷垮埌浜嗘暟鎹��
+ if (scenesDataList.get(lRPos).getAreaCodeID() == (getDatas.addBytes[2] & 0xFF)
+ && scenesDataList.get(lRPos).getSceneID() == (getDatas.addBytes[3] & 0xFF)) {
+
+ //鑻ユ病鎷垮埌鏁版嵁锛屽垯鎷挎暟鎹紱鑻ュ凡缁忔嬁鍒版暟鎹紝闇�瑕佸垽鏂璴istRemarks鍏ㄩ儴鏉$洰鏄惁鎷垮埌澶囨敞銆�
+ if (scenesDataList.get(lRPos).isCallBack()) {
+ for (int lR2Pos = 0, len4 = scenesDataList.size(); lR2Pos < len4; lR2Pos++) {
+ if (scenesDataList.get(lR2Pos).isCallBack()) {
+ if (lR2Pos == (len4 - 1)) {
+ HDLLog.I("鏀跺埌澶囨敞鍛戒护锛屽凡瀛樺湪姝ゅ満鏅娉紝杩囨护");
+ break listRemarksOutter;
+ }
+ } else {
+ HDLLog.I("涓嶅瓨鍦ㄧ殑鍦烘櫙澶囨敞锛屽啀娆℃悳绱㈠娉ㄣ�傚尯鍙凤細" + scenesDataList.get(lRPos).getAreaCodeID()
+ + ",鍦烘櫙鍙凤細" + scenesDataList.get(lRPos).getSceneID());
+ HandleSearch.getSceneDetails();
+ break listRemarksOutter;
+ }
+ }
+ } else {
+ HDLLog.I("杩斿洖澶囨敞鍦烘櫙锛氬尯鍙凤細" + scenesDataList.get(lRPos).getAreaCodeID()
+ + ",鍦烘櫙鍙凤細" + scenesDataList.get(lRPos).getSceneID());
+ scenesDataList.get(lRPos).setCallBack(true);
+ HandleSearch.getSceneDetails();
+ break listRemarksOutter;
+ }
+
+ }
+ }
+
+ break outter;
+
+ }
+ }
+ }
+
+
+ /**
* 澶勭悊淇敼璁惧澶囨敞鍚庣殑鍥炶皟
*
* @param getDatas
@@ -1309,8 +1364,8 @@
private static void handleStateData(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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
@@ -1323,7 +1378,6 @@
devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState((int) value);
sensorInfo.setCurState(value);
-
String unite = "";
switch (sensorInfo.getDeviceType()) {
@@ -1351,6 +1405,7 @@
unite = "";
break;
case HDLApConfig.TYPE_SENSOR_PM_2_POINT_5:
+ case HDLApConfig.TYPE_SENSOR_PM_10:
switch (getDatas.addBytes[4] & 0xff) {
case 0:
unite = "mg/m3";
@@ -1478,8 +1533,6 @@
unite = "鏈煡鍗曚綅";
break;
}
-
-
// EventBus.getDefault().post(new DeviceStateEvent(sensorInfo, true));
HDLLog.I("鍙戦�佷紶鎰熷櫒閫氱煡鏇存柊");
EventBus.getDefault().post(new SensorStateBackInfo(sensorInfo, true, unite));
@@ -1496,16 +1549,16 @@
}
/**
- * 澶勭悊浼犳劅鍣� 骞挎挱鏁版嵁
- * 2019-11-4 鏂颁慨鏀�
+ * 澶勭悊浼犳劅鍣� 鐘舵�佽鍙栥�佸箍鎾暟鎹�
+ * 2024-2-2 鏂版敮鎸�
*
* @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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
@@ -1514,7 +1567,14 @@
&& infos.get(j).getChannelNum() == (getDatas.addBytes[2] & 0xFF)) {//2019-07-29
isGetDeviceStateSuccess = true;
AppliancesInfo sensorInfo = devicesDataList.get(i).getAppliancesInfoList().get(j);
- float value = HDLUtlis.byte2Float(Arrays.copyOfRange(getDatas.addBytes, 5, 8));
+ float value = 0;
+ if ((getDatas.addBytes[3] & 0xFF) == 1 || (getDatas.addBytes[3] & 0xFF) == 2) {//鏁村瀷
+ value = HDLUtlis.getInt(Arrays.copyOfRange(getDatas.addBytes, 5, 9));
+ } else if ((getDatas.addBytes[3] & 0xFF) == 3) {//娴偣鍨�
+ value = HDLUtlis.byteToFloat(getDatas.addBytes[5], getDatas.addBytes[6], getDatas.addBytes[7], getDatas.addBytes[8]);
+ }
+
+ Log.d("panlili", "HDLDeviceManager.java:handleSensorBroadcastStateData----->value= " + value);
devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(value);
devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState((int) value);
@@ -1546,6 +1606,7 @@
unite = "";
break;
case HDLApConfig.TYPE_SENSOR_PM_2_POINT_5:
+ case HDLApConfig.TYPE_SENSOR_PM_10:
switch (getDatas.addBytes[4] & 0xff) {
case 0:
unite = "mg/m3";
@@ -1690,6 +1751,51 @@
}
/**
+ * 澶勭悊KNX绉戞妧甯屾 鐘舵�佽鍙栥�佸箍鎾暟鎹�
+ * 2024-5-28 鏂版敮鎸�
+ *
+ * @param getDatas
+ */
+ private static void handleKNXTechSysStateData(UdpDataBean getDatas) {
+ outter:
+ for (int i = 0, len = devicesDataList.size(); i < len; i++) {
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == 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).getLittleType() == 101
+ && infos.get(j).getChannelNum() == (getDatas.addBytes[2] & 0xFF)) {
+
+ AppliancesInfo info = devicesDataList.get(i).getAppliancesInfoList().get(j);
+ info.setGetDeviceStateSuccess(true);
+ float value = 0;
+ //00014 2024骞�5鏈�29鏃�9:44:03:806: 14 64 C8 11 F7 35 3A FF FF 05 03 01 03 00 00 00 00 36 53 81
+ if ((getDatas.addBytes[3] & 0xFF) == 1 || (getDatas.addBytes[3] & 0xFF) == 2) {//鏁村瀷
+ value = HDLUtlis.getInt(Arrays.copyOfRange(getDatas.addBytes, 5, 9));
+ } else if ((getDatas.addBytes[3] & 0xFF) == 3) {//娴偣鍨�
+// value = HDLUtlis.byteToFloat(getDatas.addBytes[8], getDatas.addBytes[7], getDatas.addBytes[6], getDatas.addBytes[5]);
+ value = HDLUtlis.getInt(Arrays.copyOfRange(getDatas.addBytes, 5, 9));
+ }
+ Log.d("panlili", "HDLDeviceManager.java:handleKNXTechSysStateData----->value= " + value);
+
+ AirTechSysBackInfo mAirTechSysBackInfo = new AirTechSysBackInfo(info);
+ mAirTechSysBackInfo.setIndoorHumidity(value + "");//璁剧疆婀垮害
+
+ EventBus.getDefault().post(new AirTechSysFeedBackEvent(mAirTechSysBackInfo, true));
+ HDLLog.I("鍙戦�佺鎶�绯荤粺婀垮害閫氱煡鏇存柊");
+
+ break outter;
+ } else {
+ HDLLog.I("handle state 娌℃湁鎵惧埌鍖归厤绫诲瀷");
+ }
+ }
+ break outter;
+ }
+ }
+ }
+
+ /**
* panlili
* 澶勭悊闂ㄩ攣鐘舵�佸拰鎶ヨ 骞挎挱鏁版嵁
*
@@ -1698,8 +1804,8 @@
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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
@@ -1799,8 +1905,8 @@
private static void handleLightStateData(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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
@@ -1828,8 +1934,8 @@
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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
@@ -1859,8 +1965,8 @@
private static void handleCurtainBroadcastStateData(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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
@@ -1909,8 +2015,8 @@
private static void handleCurtainStateData(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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
@@ -1918,7 +2024,6 @@
int state = 0;
if (infos.get(j).getDeviceType() == HDLApConfig.TYPE_CURTAIN_MODULE//绐楀笜妯″潡
&& infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {//2019-07-17
-
switch (getDatas.addBytes[1] & 0xFF) {//杩欓噷涔熷簲璇ユ敼鎴�0锛�1锛�2
case 0:
state = CurtainCtrlParser.curtainPause;
@@ -1941,38 +2046,59 @@
EventBus.getDefault().post(new DeviceStateEvent(curtainInfo, true));
break outter;
- } else if (infos.get(j).getDeviceType() == HDLApConfig.TYPE_CURTAIN_GLYSTRO || infos.get(j).getDeviceType() == HDLApConfig.TYPE_CURTAIN_ROLLER) {
- if ((getDatas.addBytes[0] & 0xFF) >= 17
- && ((getDatas.addBytes[0] & 0xFF) - 16) == infos.get(j).getChannelNum()) {//绐楀笜鍙峰ぇ浜庣瓑浜�17 鍑� 16 = 褰撳墠绐楀笜鍥炶矾鍙�
- state = getDatas.addBytes[1] & 0xFF;
- if (state == 1) {
- state = 0;//杩欎釜鍒ゆ柇鏄皢鐧惧垎姣斾负1锛屽己鍒舵敼涓�0.
+ } else if (infos.get(j).getDeviceType() == HDLApConfig.TYPE_CURTAIN_GLYSTRO || infos.get(j).getDeviceType() == HDLApConfig.TYPE_CURTAIN_ROLLER
+ || infos.get(j).getDeviceType() == HDLApConfig.TYPE_CURTAIN_SHANGRILA) {
+
+ if (getDatas.addBytes.length >= 3) {//鏂板崗璁嫇灞曞瓧娈�
+ if ((getDatas.addBytes[0] & 0xFF) >= 17
+ && ((getDatas.addBytes[0] & 0xFF) - 16) == infos.get(j).getChannelNum()) {//绐楀笜鍙峰ぇ浜庣瓑浜�17 鍑� 16 = 褰撳墠绐楀笜鍥炶矾鍙�
+ state = getDatas.addBytes[1] & 0xFF;
+ if (state == 1) {
+ state = 0;//杩欎釜鍒ゆ柇鏄皢鐧惧垎姣斾负1锛屽己鍒舵敼涓�0.
+ }
+ if (state == 99) {
+ state = 100;//杩欎釜鍒ゆ柇鏄皢鐧惧垎姣斾负99锛屽己鍒舵敼涓�100.
+ }
+ isGetDeviceStateSuccess = true;
+ devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(state);
+ devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes);
+
+ AppliancesInfo curtainInfo = devicesDataList.get(i).getAppliancesInfoList().get(j);
+
+ CurtainCtrlBackInfo curtainCtrlBackInfo = new CurtainCtrlBackInfo();
+ curtainCtrlBackInfo.setRemarks(curtainInfo.getRemarks());
+ curtainCtrlBackInfo.setParentRemarks(curtainInfo.getParentRemarks());
+ curtainCtrlBackInfo.setAppliancesInfo(curtainInfo);
+ curtainInfo.setCurState(state);
+
+ curtainCtrlBackInfo.setState(state);
+
+ devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(state);
+ devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes);
+ curtainCtrlBackInfo.setNum((getDatas.addBytes[0] & 0xFF) - 16);
+
+ EventBus.getDefault().post(new CurtainDeviceStateEvent(curtainCtrlBackInfo, true));
+ break outter;
+ } else {
+ if ((getDatas.addBytes[0] & 0xFF) == infos.get(j).getChannelNum()) {
+ isGetDeviceStateSuccess = true;
+
+ devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes);
+ devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes);
+ AppliancesInfo appliancesInfo = devicesDataList.get(i).getAppliancesInfoList().get(j);
+ CurtainCtrlBackInfo info = new CurtainCtrlBackInfo(appliancesInfo);
+ EventBus.getDefault().post(new CurtainDeviceStateEvent(info, true));
+ }
}
- if (state == 99) {
- state = 100;//杩欎釜鍒ゆ柇鏄皢鐧惧垎姣斾负99锛屽己鍒舵敼涓�100.
- }
- isGetDeviceStateSuccess = true;
- devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes[1] & 0xFF);
- devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(getDatas.addBytes[1] & 0xFF);
- AppliancesInfo curtainInfo = devicesDataList.get(i).getAppliancesInfoList().get(j);
- curtainInfo.setCurState(state);
- EventBus.getDefault().post(new DeviceStateEvent(curtainInfo, true));
- break outter;
- } else {
- if ((getDatas.addBytes[0] & 0xFF) == infos.get(j).getChannelNum()) {
- switch (getDatas.addBytes[1] & 0xFF) {//杩欓噷涔熷簲璇ユ敼鎴�0锛�1锛�2
- case 0:
- state = CurtainCtrlParser.curtainPause;
- break;
- case 1:
- state = CurtainCtrlParser.curtainOn;
- break;
- case 2:
- state = CurtainCtrlParser.curtainOff;
- break;
- default:
- state = 0;
- break;
+ } else {//鍏煎鏃у崗璁�
+ if ((getDatas.addBytes[0] & 0xFF) >= 17
+ && ((getDatas.addBytes[0] & 0xFF) - 16) == infos.get(j).getChannelNum()) {//绐楀笜鍙峰ぇ浜庣瓑浜�17 鍑� 16 = 褰撳墠绐楀笜鍥炶矾鍙�
+ state = getDatas.addBytes[1] & 0xFF;
+ if (state == 1) {
+ state = 0;//杩欎釜鍒ゆ柇鏄皢鐧惧垎姣斾负1锛屽己鍒舵敼涓�0.
+ }
+ if (state == 99) {
+ state = 100;//杩欎釜鍒ゆ柇鏄皢鐧惧垎姣斾负99锛屽己鍒舵敼涓�100.
}
isGetDeviceStateSuccess = true;
devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes[1] & 0xFF);
@@ -1981,12 +2107,34 @@
curtainInfo.setCurState(state);
EventBus.getDefault().post(new DeviceStateEvent(curtainInfo, true));
break outter;
+ } else {
+ if ((getDatas.addBytes[0] & 0xFF) == infos.get(j).getChannelNum()) {
+ switch (getDatas.addBytes[1] & 0xFF) {//杩欓噷涔熷簲璇ユ敼鎴�0锛�1锛�2
+ case 0:
+ state = CurtainCtrlParser.curtainPause;
+ break;
+ case 1:
+ state = CurtainCtrlParser.curtainOn;
+ break;
+ case 2:
+ state = CurtainCtrlParser.curtainOff;
+ break;
+ default:
+ state = 0;
+ break;
+ }
+ isGetDeviceStateSuccess = true;
+ devicesDataList.get(i).getAppliancesInfoList().get(j).setCurState(getDatas.addBytes[1] & 0xFF);
+ devicesDataList.get(i).getAppliancesInfoList().get(j).setIntCurState(getDatas.addBytes[1] & 0xFF);
+ AppliancesInfo curtainInfo = devicesDataList.get(i).getAppliancesInfoList().get(j);
+ curtainInfo.setCurState(state);
+ EventBus.getDefault().post(new DeviceStateEvent(curtainInfo, true));
+ break outter;
+ }
}
-
}
}
-
} else {
HDLLog.I("handleCurtainStateData 娌℃湁鎵惧埌鍖归厤绫诲瀷");
@@ -2006,8 +2154,8 @@
private static void handleAirStateData(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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
@@ -2059,8 +2207,8 @@
private static void handleLOGICStateData(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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
@@ -2101,8 +2249,8 @@
private static void handleSecurityStateData(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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
@@ -2136,8 +2284,8 @@
private static void handleHVACStateData(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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
@@ -2167,13 +2315,14 @@
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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == 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).getDeviceType() == HDLApConfig.TYPE_AC_TECHSYS
+ || infos.get(j).getDeviceType() == HDLApConfig.TYPE_AC_KNXTECHSYS)
&& infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {//2019-8-6
isGetDeviceStateSuccess = true;
@@ -2199,13 +2348,13 @@
private static void handleDryContactBroadcastStateData(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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == 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.SENSOR_BIG_TYPE
- && infos.get(j).getChannelNum() == ((getDatas.addBytes[1] & 0xFF) - 1)) {//2019-07-29
+ && infos.get(j).getChannelNum() == (getDatas.addBytes[1] & 0xFF)) {
if (getDatas.addBytes.length >= 3) {
isGetDeviceStateSuccess = true;
int state = getDatas.addBytes[2] & 0xFF;
@@ -2235,8 +2384,8 @@
private static void handleCommonSwitchCtrlData(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) {
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
@@ -2272,8 +2421,8 @@
private static void handleCommonSwitchStateData(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) {
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
@@ -2303,286 +2452,6 @@
}
}
-// /**
-// * 璇诲彇HVAC鐘舵�佸弽棣�
-// *
-// * @param getDatas
-// */
-// private static void handleHVACStateData(UdpDataBean getDatas) {
-// int count = getDatas.addBytes.length / 11;
-//
-// for (int airIndex = 0; airIndex < count; airIndex++) {
-// outter:
-// for (int indexI = 0, len = devicesDataList.size(); indexI < len; indexI++) {
-// if (devicesDataList.get(indexI).getSourceSubnetID() == getDatas.sourceSubnetID
-// && devicesDataList.get(indexI).getSourceDeviceID() == getDatas.sourceDeviceID
-// ) {
-// List<AppliancesInfo> infos = devicesDataList.get(indexI).getAppliancesInfoList();
-// for (int indexJ = 0, len2 = infos.size(); indexJ < len2; indexJ++) {
-// if (infos.get(indexJ).getBigType() == Configuration.AIR_BIG_TYPE
-// && infos.get(indexJ).getDeviceType() != HDLApConfig.TYPE_AC_PANEL
-// && infos.get(indexJ).getChannelNum() == (getDatas.addBytes[airIndex * 11] & 0xFF)) {
-// AppliancesInfo appliancesInfo = devicesDataList.get(indexI).getAppliancesInfoList().get(indexJ);
-//
-// switch (getDatas.addBytes[airIndex * 11] & 0xff) {
-// case 1:
-// handleAirCastData(getDatas, air1Info, airIndex, appliancesInfo);
-// air1Info[0] = getDatas.addBytes[1 + 0 * 11];
-// air1Info[1] = (byte) ((getDatas.addBytes[3 + 0 * 11] & 0xf0) >> 4);
-// switch (air1Info[0] & 0xff) {
-// case 0:
-// air1Info[2] = getDatas.addBytes[2 + 0 * 11];
-// break;
-// case 1:
-// air1Info[2] = getDatas.addBytes[6 + 0 * 11];
-// break;
-// case 3:
-// air1Info[2] = getDatas.addBytes[8 + 0 * 11];
-// break;
-// case 4:
-// air1Info[2] = getDatas.addBytes[9 + 0 * 11];
-// break;
-//
-// }
-//
-// air1Info[3] = (byte) (getDatas.addBytes[3 + 0 * 11] & 0x0f);
-// air1Info[4] = getDatas.addBytes[5 + 0 * 11];
-// air1Info[5] = getDatas.addBytes[10 + 0 * 11];
-//// HDLLog.info( "209a air1Info = " + air1Info[0] + " " + air1Info[1] + " " + air1Info[2] + " " + air1Info[3] + " " + air1Info[4] + " " + air1Info[5]);
-//// String arrString = "209a 闄勫姞鏁版嵁锛�";
-//// for (int i = 0; i < getDatas.addBytes.length; i++) {
-//// arrString += (getDatas.addBytes[i] & 0xff) + ",";
-//// }
-//// HDLLog.info( arrString);
-// devicesDataList.get(indexI).getAppliancesInfoList().get(indexJ).setArrCurState(air1Info);
-// break;
-// case 2:
-// handleAirCastData(getDatas, air2Info, airIndex, appliancesInfo);
-// air2Info[0] = getDatas.addBytes[1 + 1 * 11];
-// air2Info[1] = (byte) ((getDatas.addBytes[3 + 1 * 11] & 0xf0) >> 4);
-// switch (air2Info[0] & 0xff) {
-// case 0:
-// air2Info[2] = getDatas.addBytes[2 + 1 * 11];
-// break;
-// case 1:
-// air2Info[2] = getDatas.addBytes[6 + 1 * 11];
-// break;
-// case 3:
-// air2Info[2] = getDatas.addBytes[8 + 1 * 11];
-// break;
-// case 4:
-// air2Info[2] = getDatas.addBytes[9 + 1 * 11];
-// break;
-//
-// }
-// air2Info[3] = (byte) (getDatas.addBytes[3 + 1 * 11] & 0x0f);
-// air2Info[4] = getDatas.addBytes[5 + 1 * 11];
-// air2Info[5] = getDatas.addBytes[10 + 1 * 11];
-// devicesDataList.get(indexI).getAppliancesInfoList().get(indexJ).setArrCurState(air2Info);
-// break;
-// case 3:
-// handleAirCastData(getDatas, air3Info, airIndex, appliancesInfo);
-// air3Info[0] = getDatas.addBytes[1 + 2 * 11];
-// air3Info[1] = (byte) ((getDatas.addBytes[3 + 2 * 11] & 0xf0) >> 4);
-// switch (air3Info[0] & 0xff) {
-// case 0:
-// air3Info[2] = getDatas.addBytes[2 + 2 * 11];
-// break;
-// case 1:
-// air3Info[2] = getDatas.addBytes[6 + 2 * 11];
-// break;
-// case 3:
-// air3Info[2] = getDatas.addBytes[8 + 2 * 11];
-// break;
-// case 4:
-// air3Info[2] = getDatas.addBytes[9 + 2 * 11];
-// break;
-// }
-// air3Info[3] = (byte) (getDatas.addBytes[3 + 2 * 11] & 0x0f);
-// air3Info[4] = getDatas.addBytes[5 + 2 * 11];
-// air3Info[5] = getDatas.addBytes[10 + 2 * 11];
-// devicesDataList.get(indexI).getAppliancesInfoList().get(indexJ).setArrCurState(air3Info);
-// break;
-// case 4:
-// handleAirCastData(getDatas, air4Info, airIndex, appliancesInfo);
-// air4Info[0] = getDatas.addBytes[1 + 3 * 11];
-// air4Info[1] = (byte) ((getDatas.addBytes[3 + 3 * 11] & 0xf0) >> 4);
-// switch (air4Info[0] & 0xff) {
-// case 0:
-// air4Info[2] = getDatas.addBytes[2 + 3 * 11];
-// break;
-// case 1:
-// air4Info[2] = getDatas.addBytes[6 + 3 * 11];
-// break;
-// case 3:
-// air4Info[2] = getDatas.addBytes[8 + 3 * 11];
-// break;
-// case 4:
-// air4Info[2] = getDatas.addBytes[9 + 3 * 11];
-// break;
-// }
-// air4Info[3] = (byte) (getDatas.addBytes[3 + 3 * 11] & 0x0f);
-// air4Info[4] = getDatas.addBytes[5 + 3 * 11];
-// air4Info[5] = getDatas.addBytes[10 + 3 * 11];
-// devicesDataList.get(indexI).getAppliancesInfoList().get(indexJ).setArrCurState(air4Info);
-// break;
-//
-// }
-// }
-//
-// }
-// }
-// }
-//
-//
-// }
-//
-//
-// }
-//
-//
-// /**
-// * 澶勭悊瀹跺眳绌鸿皟骞挎挱娑堟伅
-// *
-// * @param getDatas
-// * @param airInfo
-// * @param airIndex
-// * @param oldInfo
-// */
-// private static void handleAirCastData(UdpDataBean getDatas, final byte[] airInfo, int airIndex, final AppliancesInfo oldInfo) {
-// if (airInfo[0] != getDatas.addBytes[1 + airIndex * 11]) {
-//
-//// EventBus.getDefault().post(new DeviceStateEvent(newInfo, true));
-// new Timer().schedule(new TimerTask() {
-// @Override
-// public void run() {
-// final AppliancesInfo newInfo = oldInfo;
-// newInfo.setArrCurState(new byte[]{AirCtrlParser.airSwich, airInfo[0]});
-//// HDLLog.info( "0x209A in 绌鸿皟寮�鍏虫敼鍙�" + " appliancesInfo subid = " + newInfo.getDeviceSubnetID()
-//// + " devID = " + newInfo.getDeviceDeviceID() + " 鍥炶矾鍙凤細" + newInfo.getChannelNum() + " devType" + newInfo.getDeviceType());
-// EventBus.getDefault().post(new DeviceStateEvent(newInfo, true));
-// }
-// }, 500);
-// }
-//
-//// HDLLog.info( "airIndex = " + airIndex + " 209a 妯″紡鍊� = " + ((getDatas.addBytes[3 + airIndex * 11] & 0xf0) >> 4) + " 鎴� = " + ((getDatas.addBytes[7 + airIndex * 11] & 0xf0) >> 4));
-// if (airInfo[1] != (byte) ((getDatas.addBytes[3 + airIndex * 11] & 0xf0) >> 4)) {
-// new Timer().schedule(new TimerTask() {
-// @Override
-// public void run() {
-// final AppliancesInfo newInfo = oldInfo;
-// newInfo.setArrCurState(new byte[]{AirCtrlParser.airMode, airInfo[1]});
-//// HDLLog.info( "0x209A in 绌鸿皟妯″紡鏀瑰彉" + " appliancesInfo subid = " + newInfo.getDeviceSubnetID()
-//// + " devID = " + newInfo.getDeviceDeviceID() + " 鍥炶矾鍙凤細" + newInfo.getChannelNum() + " devType" + newInfo.getDeviceType());
-// EventBus.getDefault().post(new DeviceStateEvent(newInfo, true));
-// }
-// }, 1000);
-// }
-//
-//
-// switch (airInfo[1] & 0xff) {
-// case 0:
-// if (airInfo[2] != getDatas.addBytes[2 + airIndex * 11]) {
-// new Timer().schedule(new TimerTask() {
-// @Override
-// public void run() {
-// final AppliancesInfo newInfo = oldInfo;
-// newInfo.setArrCurState(new byte[]{AirCtrlParser.refTem, airInfo[2]});
-//// HDLLog.info( "0x209A in 绌鸿皟娓╁害鏀瑰彉" + " appliancesInfo subid = " + newInfo.getDeviceSubnetID()
-//// + " devID = " + newInfo.getDeviceDeviceID() + " 鍥炶矾鍙凤細" + newInfo.getChannelNum() + " devType" + newInfo.getDeviceType());
-// EventBus.getDefault().post(new DeviceStateEvent(newInfo, true));
-// }
-// }, 1500);
-// }
-//
-// break;
-// case 1:
-// if (airInfo[2] != getDatas.addBytes[6 + airIndex * 11]) {
-//// airInfo[2] = getDatas.addBytes[6 + airIndex * 11];
-//
-//// EventBus.getDefault().post(new DeviceStateEvent(newInfo, true));
-// new Timer().schedule(new TimerTask() {
-// @Override
-// public void run() {
-// final AppliancesInfo newInfo = oldInfo;
-// newInfo.setArrCurState(new byte[]{AirCtrlParser.heatTem, airInfo[2]});
-//// HDLLog.info( "0x209A in 绌鸿皟娓╁害鏀瑰彉" + " appliancesInfo subid = " + newInfo.getDeviceSubnetID()
-//// + " devID = " + newInfo.getDeviceDeviceID() + " 鍥炶矾鍙凤細" + newInfo.getChannelNum() + " devType" + newInfo.getDeviceType());
-// EventBus.getDefault().post(new DeviceStateEvent(newInfo, true));
-// }
-// }, 1500);
-// }
-//
-// break;
-// case 3:
-// if (airInfo[2] != getDatas.addBytes[8 + airIndex * 11]) {
-//// airInfo[2] = getDatas.addBytes[8 + airIndex * 11];
-//
-//// EventBus.getDefault().post(new DeviceStateEvent(newInfo, true));
-// new Timer().schedule(new TimerTask() {
-// @Override
-// public void run() {
-// final AppliancesInfo newInfo = oldInfo;
-// newInfo.setArrCurState(new byte[]{AirCtrlParser.autoTem, airInfo[2]});
-//// HDLLog.info( "0x209A in 绌鸿皟娓╁害鏀瑰彉" + " appliancesInfo subid = " + newInfo.getDeviceSubnetID()
-//// + " devID = " + newInfo.getDeviceDeviceID() + " 鍥炶矾鍙凤細" + newInfo.getChannelNum() + " devType" + newInfo.getDeviceType());
-// EventBus.getDefault().post(new DeviceStateEvent(newInfo, true));
-// }
-// }, 1500);
-// }
-//
-// break;
-// case 4:
-// if (airInfo[2] != getDatas.addBytes[9 + airIndex * 11]) {
-//// airInfo[2] = getDatas.addBytes[9 + airIndex * 11];
-//
-//// EventBus.getDefault().post(new DeviceStateEvent(newInfo, true));
-// new Timer().schedule(new TimerTask() {
-// @Override
-// public void run() {
-// final AppliancesInfo newInfo = oldInfo;
-// newInfo.setArrCurState(new byte[]{AirCtrlParser.dehumTem, airInfo[2]});
-//// HDLLog.info( "0x209A in 绌鸿皟娓╁害鏀瑰彉" + " appliancesInfo subid = " + newInfo.getDeviceSubnetID()
-//// + " devID = " + newInfo.getDeviceDeviceID() + " 鍥炶矾鍙凤細" + newInfo.getChannelNum() + " devType" + newInfo.getDeviceType());
-// EventBus.getDefault().post(new DeviceStateEvent(newInfo, true));
-// }
-// }, 1500);
-// }
-//
-// break;
-// }
-//
-//// HDLLog.info( "airInfo[3] = " + (airInfo[3] & 0xff) + " 绗�3浣� 浣�4浣嶉閫� = "+(getDatas.addBytes[3 + airIndex * 11] & 0x0f));
-//// HDLLog.info( "airInfo[3] = " + (airInfo[3] & 0xff) + " 绗�7浣� 浣�4浣嶉閫� = "+(getDatas.addBytes[7 + airIndex * 11] & 0x0f));
-// if (airInfo[3] != (byte) (getDatas.addBytes[3 + airIndex * 11] & 0x0f)) {
-//// airInfo[3] = (byte) (getDatas.addBytes[3 + airIndex * 11] & 0x0f);
-//
-//// EventBus.getDefault().post(new DeviceStateEvent(newInfo, true));
-//
-// new Timer().schedule(new TimerTask() {
-// @Override
-// public void run() {
-//
-// final AppliancesInfo newInfo = oldInfo;
-// newInfo.setArrCurState(new byte[]{AirCtrlParser.airSpeed, airInfo[3]});
-//// HDLLog.info( "绌鸿皟椋庨�熸敼鍙�" + " appliancesInfo subid = " + newInfo.getDeviceSubnetID()
-//// + " devID = " + newInfo.getDeviceDeviceID() + " 鍥炶矾鍙凤細" + newInfo.getChannelNum() + " devType" + newInfo.getDeviceType());
-//// HDLLog.info( "鍙戦�佺┖璋冩敼鍙橀閫焏ata = " + Arrays.toString(newInfo.getArrCurState()));
-// EventBus.getDefault().post(new DeviceStateEvent(newInfo, true));
-// }
-// }, 2000);
-// }
-//
-// //瀹ゆ俯銆佹憜椋庢病鏈夎繑鍥炪�備笅涓増鏈渶瑕佽�冭檻
-// if (airInfo[4] != getDatas.addBytes[5 + airIndex * 11]) {
-//// airInfo[4] = getDatas.addBytes[5 + airIndex * 11];
-// }
-//
-// if (airInfo[5] != getDatas.addBytes[10 + airIndex * 11]) {
-//// airInfo[5] = getDatas.addBytes[10 + airIndex * 11];
-// }
-// }
-
/**
* 姝ゆ柟娉曞熀鏈病鐢ㄥ埌锛岄�昏緫妯″潡鐨勬帶鍒朵俊鎭凡缁忓湪handleCtrlData涓鐞嗚繃浜�
* <p>
@@ -2592,8 +2461,8 @@
*/
private static void handleLogicData(UdpDataBean getDatas) {
for (int i = 0, len = devicesDataList.size(); i < len; i++) {
- if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID
- && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
@@ -2652,8 +2521,8 @@
private static void handleAudioData(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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
@@ -2790,7 +2659,6 @@
*/
public static void setDeviceCtrlSuccessStateWithInfo(AppliancesInfo info, Boolean success) {
// if(info.getDeviceKey() == null) return;
-
ctrlSuccessStateHashMap.put(info.getDeviceKey(), success);
}
@@ -2806,6 +2674,14 @@
Boolean success = ctrlSuccessStateHashMap.get(info.getDeviceKey());
if (success == null) success = false;
return success;
+ }
+
+ public static boolean isSceneCtrlSuccess() {
+ return isSceneCtrlSuccess;
+ }
+
+ public static void setSceneCtrlSuccess(boolean isSceneCtrlSuccess) {
+ HDLDeviceManager.isSceneCtrlSuccess = isSceneCtrlSuccess;
}
/**
@@ -2887,8 +2763,8 @@
boolean bCanAdd = false;
outter:
for (int i = 0, len = devicesDataList.size(); i < len; i++) {
- if (devicesDataList.get(i).getSourceSubnetID() == mSubnetID
- && devicesDataList.get(i).getSourceDeviceID() == mDeviceID
+ if (devicesDataList.get(i).getDeviceSubnetID() == mSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == mDeviceID
) {
bExistSubnetID = true;
DevicesData mDevicesData = devicesDataList.get(i);
@@ -2960,8 +2836,8 @@
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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
@@ -2991,8 +2867,8 @@
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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
@@ -3024,8 +2900,8 @@
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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
@@ -3055,8 +2931,8 @@
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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
@@ -3088,8 +2964,8 @@
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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
@@ -3131,8 +3007,8 @@
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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
@@ -3179,14 +3055,14 @@
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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == 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
+ && infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {
isGetDeviceStateSuccess = true;
devicesDataList.get(i).getAppliancesInfoList().get(j).setArrCurState(getDatas.addBytes);
@@ -3210,8 +3086,8 @@
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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
@@ -3241,8 +3117,8 @@
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
+ if (devicesDataList.get(i).getDeviceSubnetID() == getDatas.sourceSubnetID
+ && devicesDataList.get(i).getDeviceDeviceID() == getDatas.sourceDeviceID
) {
List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
for (int j = 0, len2 = infos.size(); j < len2; j++) {
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 670c4c9..64546f2 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
@@ -9,6 +9,7 @@
import com.hdl.sdk.ttl.Config.Configuration;
import com.hdl.sdk.ttl.HDLDeviceManger.Bean.UdpDataBean;
import com.hdl.sdk.ttl.HDLDeviceManger.HDLListener.IMcuOtaListener;
+import com.hdl.sdk.ttl.Utils.HDLUtlis.SerialPortSendAndReceiveUtil;
import com.hdl.sdk.ttl.Utils.LogUtils.HDLLog;
import java.io.File;
@@ -25,14 +26,14 @@
*/
public class HDLSerialPortCore {
//涓插彛璁惧璺緞鍚�
- private static String mPathname = "/dev/ttyS2";
+ private static String mPathname = "/dev/ttyS4";
//娉㈢壒鐜�
private static int mBaudrate = 115200;
// public static SerialPortFinder mSerialPortFinder = new SerialPortFinder();
- private static SerialPort mSerialPort = null;
- private static InputStream mInputStream = null;
- private static OutputStream mOutputStream = null;
+ public static SerialPort mSerialPort = null;
+ public static InputStream mInputStream = null;
+ public static OutputStream mOutputStream = null;
// private static HDLReadDatasThread mHDLReadDatasThread = new HDLReadDatasThread();
// private static HDLRead485DatasThread mHDLRead485DatasThread = new HDLRead485DatasThread();
@@ -43,7 +44,7 @@
private static List<Byte> mReceiveDatasList = new ArrayList<Byte>();//鎺ユ敹鏁版嵁闃熷垪
// private static List<Byte> mReceive485DatasList = new ArrayList<Byte>();//485鎺ユ敹鏁版嵁闃熷垪
- public static Boolean bPassThrough = false; //鍒ゆ柇鏄惁閫忎紶
+ public static Boolean isModule = false; //鍒ゆ柇鏄惁甯︽ā缁�
public static IMcuOtaListener mIMcuOtaListener;
public static byte[] upgradeFileDatas; //鍗囩骇鏂囦欢鏁版嵁
@@ -94,7 +95,12 @@
mInputStream = mSerialPort.getInputStream();
mOutputStream = mSerialPort.getOutputStream();
bOpenSuccess = true;
- startHDLThread();
+
+ if (HDLSerialPortCore.getIsModule()) {//甯︽ā缁勶紝璧版爣鍑嗕覆鍙�
+ startHDLThread();
+ } else {//涓嶅甫妯$粍锛岃蛋閫忎紶
+ SerialPortSendAndReceiveUtil.getInstance().start();
+ }
} catch (IOException e) {
e.printStackTrace();
bOpenSuccess = false;
@@ -148,74 +154,11 @@
* 鍚姩涓插彛 鍙戦�佸拰鎺ユ敹绾跨▼
*/
private static void startHDLThread() {
-// mHDLRead485DatasThread = new HDLRead485DatasThread();
mHDLReadMCUDatasThread = new HDLReadMCUDatasThread();
mHDLSendDatasThread = new HDLSendDatasThread();
-// mHDLRead485DatasThread.start();
mHDLReadMCUDatasThread.start();
mHDLSendDatasThread.start();
}
-
-//
-// /**
-// * 涓插彛鎺ユ敹绾跨▼
-// *
-// * @author 2019骞�06鏈�26鏃�
-// */
-// private static class HDLReadDatasThread extends Thread {
-//
-// @Override
-// public void run() {
-// super.run();
-// HDLLog.I("鎺ユ敹绾跨▼ 寮�鍚�");
-//
-// while (bOpenSuccess) {
-// int size = 0;
-// try {
-// if (mInputStream == null) return;
-//
-// byte[] buffer = new byte[64];
-// size = mInputStream.read(buffer);
-// for (int i = 0; i < size; i++) {
-// mReceiveDatasList.add(buffer[i]);
-// }
-//
-// while (0 < mReceiveDatasList.size()) {
-// HDLLog.I("arraylist.size():" + mReceiveDatasList.size());
-// if (mReceiveDatasList.size() < 3) break;//2019-07-02
-// int len = -1;
-// int startIndex = 0;
-// for (startIndex = 0; startIndex < mReceiveDatasList.size(); startIndex++) {
-// if ((mReceiveDatasList.get(startIndex) & 0xFF) == 0xAA
-// && (mReceiveDatasList.get(startIndex + 1) & 0xFF) == 0xAA) {
-// len = (mReceiveDatasList.get(startIndex + 2) & 0xFF) + 2;//鍙戠幇len浼氬嚭鐜拌礋鏁板鍔� & 0xFF 杩愮畻
-// break;
-// }
-// }
-// if (len == -1 || mReceiveDatasList.size() < len) break;
-//
-// HDLLog.I("startIndex:" + startIndex + " LEN:" + len);
-// for (int i = 0; i < startIndex; i++) {
-// if (mReceiveDatasList.size() < 1) break;//2019-07-02
-// mReceiveDatasList.remove(0);
-// }
-// byte[] tempBytes = new byte[len];
-// for (int i = 0; i < tempBytes.length; i++) {
-// if (mReceiveDatasList.size() < 1) break;//2019-07-02
-//
-// tempBytes[i] = mReceiveDatasList.get(0);
-// mReceiveDatasList.remove(0);
-// }
-// HandleHDLdata(tempBytes);
-// }
-// } catch (Exception e) {
-// e.printStackTrace();
-// HDLLog.I("error:" + e.getMessage());
-// }
-// }
-// HDLLog.I("鎺ユ敹绾跨▼ 鍏抽棴");
-// }
-// }
/**
* 涓插彛鎺ユ敹绾跨▼
@@ -244,6 +187,7 @@
mReceiveDatasList.add(buffer[i]);
}
+
while (0 < mReceiveDatasList.size()) {
// HDLLog.I("arraylist.size():" + mReceiveDatasList.size());
if (mReceiveDatasList.size() < 3) break;//2019-07-02
@@ -262,7 +206,6 @@
break;
}
}
-
if (len == -1 || mReceiveDatasList.size() < len) break;
// HDLLog.I("startIndex:" + startIndex + " LEN:" + len);
for (int i = 0; i < startIndex; i++) {
@@ -288,63 +231,6 @@
HDLLog.I("鎺ユ敹绾跨▼ 鍏抽棴");
}
}
-
-// /**
-// * 485鏁版嵁鎺ユ敹绾跨▼
-// *
-// * @author 2019骞�06鏈�26鏃�
-// */
-// private static class HDLRead485DatasThread extends Thread {
-//
-// @Override
-// public void run() {
-// super.run();
-// HDLLog.I("485鎺ユ敹绾跨▼ 寮�鍚�");
-// while (bOpenSuccess) {
-// int size = 0;
-// try {
-// Thread.sleep(10);
-// while (0 < mReceive485DatasList.size()) {
-//// HDLLog.I("485arraylist.size():" + mReceive485DatasList.size());
-// if (mReceive485DatasList.size() < 3) break;//2019-07-02
-// if (mReceive485DatasList.size() > 500) { //鏁版嵁缂撳瓨澶閿欒鎯呭喌涓� 娓呯┖涓�娆�
-// mReceive485DatasList.clear();
-// break;//2019-07-24
-// }
-// int len = -1;
-// int startIndex = 0;
-// for (startIndex = 0; startIndex < mReceive485DatasList.size(); startIndex++) {
-// if ((mReceive485DatasList.get(startIndex) & 0xFF) == 0xAA
-// && (mReceive485DatasList.get(startIndex + 1) & 0xFF) == 0xAA) {
-// len = (mReceive485DatasList.get(startIndex + 2) & 0xFF) + 2;//鍙戠幇len浼氬嚭鐜拌礋鏁板鍔� & 0xFF 杩愮畻
-// break;
-// }
-// }
-// if (len == -1 || mReceive485DatasList.size() < len) break;
-//
-//// HDLLog.I("startIndex:" + startIndex + " LEN:" + len);
-// for (int i = 0; i < startIndex; i++) {
-// if (mReceive485DatasList.size() < 1) break;//2019-07-02
-// mReceive485DatasList.remove(0);
-// }
-// byte[] tempBytes = new byte[len];
-// for (int i = 0; i < tempBytes.length; i++) {
-// if (mReceive485DatasList.size() < 1) break;//2019-07-02
-//
-// tempBytes[i] = mReceive485DatasList.get(0);
-// mReceive485DatasList.remove(0);
-// }
-// HandleHDLdata(tempBytes);
-// }
-// } catch (Exception e) {
-// e.printStackTrace();
-// HDLLog.I("error:" + e.getMessage());
-// }
-// }
-// HDLLog.I("485鎺ユ敹绾跨▼ 鍏抽棴");
-// }
-// }
-
/**
* 涓插彛鍙戦�佺嚎绋�
@@ -387,7 +273,15 @@
}
}
-// /**
+ public static Boolean getIsModule() {
+ return isModule;
+ }
+
+ public static void setIsModule(Boolean isModule) {
+ HDLSerialPortCore.isModule = isModule;
+ }
+
+ // /**
// * 鍙戦�丮UC涓插彛鍗忚鏁版嵁鍖�
// * @param mcuDataList
// * @param bPassThrough 鏄惁涓洪�忎紶
@@ -460,7 +354,7 @@
*
* @param receiveBytes
*/
- private synchronized static void HandleHDLdata(byte[] receiveBytes) {
+ public synchronized static void HandleHDLdata(byte[] receiveBytes) {
if (receiveBytes.length < 14) {
return;
}
@@ -470,6 +364,10 @@
// HDLLog.I("checkCRC锛氭楠屽け璐�");
return;
}
+
+ //鎿嶄綔鐮�
+ int command = (receiveBytes[7] & 0xFF) * 256 + (receiveBytes[8] & 0xFF);
+
//鏁版嵁闀垮害
int addDataLength = (receiveBytes[2] & 0xFF) - 11;
//闄勫姞鏁版嵁
@@ -477,8 +375,6 @@
//澶嶅埗闄勫姞鏁版嵁
System.arraycopy(receiveBytes, 11, usefulBytes, 0, addDataLength);
- //鎿嶄綔鐮�
- int command = (receiveBytes[7] & 0xFF) * 256 + (receiveBytes[8] & 0xFF);
//婧愬瓙缃戝彿
int sourceSubnetID = receiveBytes[3] & 0xFF;
//婧愯澶囧彿
@@ -512,9 +408,9 @@
*
* @param sendDatas
*/
- private static void HandleInsideData(UdpDataBean sendDatas) {
+ public static void HandleInsideData(UdpDataBean sendDatas) {
switch (sendDatas.command) {
- case Configuration.DEVICES_SEARCH_BACK_COMMAND:
+ case Configuration.DEVICES_SEARCH_FROM_GATEWAY_BACK_COMMAND:
// 鍏堝垽鏂悳绱㈡ā寮忥紝瀹跺眳鎼滅储鍒欏彧闇�瑕佸垽鏂袱涓殢鏈烘暟銆傞厭搴楁悳绱㈠垯闇�瑕佸垽鏂袱涓殢鏈烘暟鍜宨p鍦板潃
if (HandleSearch.curSearchMode == HandleSearch.GET_BUS_DEVICES) {
if (sendDatas.addBytes[0] == HandleSearch.random1
@@ -523,12 +419,10 @@
}
} else {
if (sendDatas.addBytes[0] == HandleSearch.random1
- && sendDatas.addBytes[1] == HandleSearch.random2
- ) {
+ && sendDatas.addBytes[1] == HandleSearch.random2) {
HDLDeviceManager.handle(sendDatas, sendDatas.command);
}
}
-
break;
/***2020-04-01 鏂板閫氱敤寮�鍏�**/
@@ -552,7 +446,7 @@
case Configuration.AIR_HVAC_STATE_BACK_COMMAND:
// case Configuration.RCU_ROOM_CAST_COMMAND:
// case Configuration.RCU_CURTAIN_CAST_COMMAND:
- case Configuration.DEVICES_READ_BACK_COMMAND://璇诲彇澶囨敞鍛戒护
+ case Configuration.DEVICES_READ_FROM_GATEWAY_BACK_COMMAND://璇诲彇澶囨敞鍛戒护
case Configuration.DEVICES_MODIFY_BACK_COMMAND://淇敼鍩烘湰淇℃伅鍥炲
case Configuration.MODULE_UPDATE_REMARK_BACK_COMMAND://淇敼妯″潡澶囨敞鍥炲
case Configuration.WARNING_COMMAND:
@@ -574,29 +468,10 @@
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 鏂板闂ㄩ攣鐘舵�佸拰鎶ヨ骞挎挱
+ case Configuration.SCENE_SEARCH_FROM_GATEWAY_BACK_COMMAND:
+ case Configuration.SCENE_READ_FROM_GATEWAY_BACK_COMMAND:
HDLDeviceManager.handle(sendDatas, sendDatas.command);
break;
-
-
-// case Configuration.RCU_SEARCH_COMMAND:
-//// if (sendDatas.port == Configuration.RCU_SEND_PORT) {
-// HDLLog.I( "鏀跺埌鎼滅储RCU鍛戒护");
-// HDLDeviceManager.handle(sendDatas, sendDatas.command);
-//// }
-//
-// break;
-// case Configuration.RCU_READ_SDK_INFO_COMMAND:
-//// if (sendDatas.desSubnetID == Crc.localSubnetID && sendDatas.desDeviceID == Crc.localDeviceID
-//// ) {
-//// HDLLog.I( "E508鏀跺埌");
-//// HDLDeviceManager.handle(sendDatas, Configuration.RCU_READ);
-//// }
-//// if (sendDatas.port == Configuration.RCU_SEND_PORT) {
-// HDLLog.I( "鏀跺埌璇诲彇SDK淇℃伅鍛戒护");
-// HDLDeviceManager.handle(sendDatas, sendDatas.command);
-//// }
-
-// break;
case Configuration.MANUAL_ADD_DEVICE_COMMAND:
//鍥哄畾闅忔満鏁�181銆�250
if (sendDatas.addBytes[0] == ((byte) 181)
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLTtlSdk.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLTtlSdk.java
index 97df209..327d325 100644
--- a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLTtlSdk.java
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/Core/HDLTtlSdk.java
@@ -16,6 +16,8 @@
*/
public static void init(Context context, String mPathname, int mBaudrate) {
HDLDeviceManager.init(context);
+ HDLDeviceManager.setIsGetBusLightState(false);//鏍规嵁鏄惁bus缃戝叧璁剧疆
+ HDLSerialPortCore.setIsModule(true);//鏍规嵁鏄惁甯︽ā缁勮缃�
HDLSerialPortCore.initHDLSerialPort(mPathname, mBaudrate);
}
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 f714a60..4fee86d 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
@@ -1,16 +1,22 @@
package com.hdl.sdk.ttl.HDLDeviceManger.Core;
+import android.util.Log;
+
import com.hdl.sdk.ttl.Config.Configuration;
import com.hdl.sdk.ttl.HDLDeviceManger.Bean.DevicesData;
import com.hdl.sdk.ttl.HDLDeviceManger.Bean.RemarkTimes;
import com.hdl.sdk.ttl.HDLDeviceManger.Bean.SearchCountBean;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DevicesInfoEvent;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.ScenesInfoEvent;
import com.hdl.sdk.ttl.Utils.LogUtils.HDLLog;
import org.greenrobot.eventbus.EventBus;
+import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
import java.util.Random;
+import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
@@ -19,25 +25,33 @@
*/
public class HandleSearch {
public static boolean isSearching = true;
+ public static boolean isSceneSearching = true;
public static int curSearchMode = 0;
// public static String rcuIp = "";//涓诲姩浼犲叆鐨剅cu ip鍦板潃
// private static Timer getRcuIpTimer = null;//鑾峰彇Rcuip Timer
// private static Timer getRcuIpFailorSuccessTimer = null;//鑾峰彇Rcuip Timer
public static boolean isGetRcuIp = false;
private static boolean isRefreshAllDevicesState = false;
+ private static boolean isRefreshAllScenesState = false;
public static Timer searchTimer = null;//鍙戦�佺涓�娆℃悳绱imer
public static Timer searchTwiceTimer = null;//鍙戦�佺浜屾鎼滅储Timer
+ public static Timer searchByIndexTimer = null;//鍙戦�佽澶囨悳绱imer
public static Timer searchFailTimer = null;//鍙戦�佹悳绱㈠け璐imer
public static Timer remarkTimer = null;//鎼滅储澶囨敞Timer
private static Timer refreshTimer = null;
+ public static Timer searchSceneTimer = null;//鍙戦�佸満鏅涓�娆℃悳绱imer
+ public static Timer searchSceneFailTimer = null;//鍙戦�佹悳绱㈠け璐imer
+ public static Timer remarkSceneTimer = null;//鎼滅储鍦烘櫙澶囨敞Timer
private static int curDevSize;//璁板綍璁惧鎬绘暟銆備綔鐢細姣旇緝鎼滅储鍑烘潵鐨勬�昏澶囨暟
+ private static int curSceneSize;//璁板綍鍦烘櫙鎬绘暟銆備綔鐢細姣旇緝鎼滅储鍑烘潵鐨勬�诲満鏅暟
public static byte random1 = 0;//闅忔満鏁�1
public static byte random2 = 0;//闅忔満鏁�2
public static final int GET_RCU_DEVICES = 0;//鑾峰彇Rcu妯″潡璁惧
public static final int GET_BUS_DEVICES = 1;//鑾峰彇瀹跺眳妯″潡 璁惧
+ public static final int GET_BUS_SCENES = 2;//鑾峰彇瀹跺眳妯″潡 鍦烘櫙
private static final int SEARCH_POINT_TO_POINT = 100;//鐐瑰鐐�
private static final int SEARCH_BROACAST = 101;//骞挎挱
@@ -132,22 +146,38 @@
/**
+ * 鎼滅储缃戝叧
+ */
+ public static void seachGateway() {
+ HDLCommand.cusSendCommand(Configuration.SEARCH_GATEWAY_COMMAND,
+ 255, 255, new byte[]{random1, random2});
+ }
+
+ /**
* 鍏ㄩ儴閲嶆柊鎼滅储,娓呯┖鍘熻澶囧垪琛ㄦ暟鎹�
*/
- public static void getHomeDevices() {
+ public static void getHomeDevices(int subnetID, int deviceID) {
bSearchAll = true;
curSearchMode = GET_BUS_DEVICES;
- searchDevices(GET_BUS_DEVICES, SEARCH_BROACAST, Configuration.PORT);//瀹跺眳鎼滅储
+ searchDevices(GET_BUS_DEVICES, SEARCH_POINT_TO_POINT, subnetID, deviceID);//瀹跺眳鎼滅储
}
/**
* 鍙戠幇鏂拌澶囨悳绱�,涓嶄細娓呯┖鍘熻澶囧垪琛ㄦ暟鎹�
* 鍙兘鎼滅储鍙戠幇涓嶅瓨鍦╮ealDevicesDataList閲岄潰鐨勬柊璁惧
*/
- public static void getNewHomeDevices() {
+ public static void getNewHomeDevices(int subnetID, int deviceID) {
bSearchAll = false;
curSearchMode = GET_BUS_DEVICES;
- searchDevices(GET_BUS_DEVICES, SEARCH_BROACAST, Configuration.PORT);//瀹跺眳鎼滅储
+ searchDevices(GET_BUS_DEVICES, SEARCH_POINT_TO_POINT, subnetID, deviceID);//瀹跺眳鎼滅储
+ }
+
+ /**
+ * 鎼滅储鍦烘櫙
+ */
+ public static void seachHomeScenes(int subnetID, int deviceID) {
+ HDLDeviceManager.scenesDataList.clear();
+ searchScenes(subnetID, deviceID);
}
/**
@@ -157,7 +187,7 @@
* @param baseSearchType 鍩虹鎼滅储绫诲瀷
* @param
*/
- private static void searchDevices(final int searchMode, final int baseSearchType, final int port) {
+ private static void searchDevices(final int searchMode, final int baseSearchType, final int subnetID, final int deviceID) {
isSearching = true;
isRefreshAllDevicesState = false;
@@ -166,11 +196,15 @@
searchTimer.purge();
searchTimer = null;
}
-
if (searchFailTimer != null) {
searchFailTimer.cancel();
searchFailTimer.purge();
searchFailTimer = null;
+ }
+ if (searchByIndexTimer != null) {
+ searchByIndexTimer.cancel();
+ searchByIndexTimer.purge();
+ searchByIndexTimer = null;
}
if (remarkTimer != null) {
remarkTimer.cancel();
@@ -180,13 +214,14 @@
searchTimer = new Timer();
searchFailTimer = new Timer();
+ searchByIndexTimer = new Timer();
int max = 254;
int min = 1;
random1 = (byte) (new Random().nextInt(max + 1) % (max - min + 1) + min);
random2 = (byte) (new Random().nextInt(max + 1) % (max - min + 1) + min);
- baseSearch(baseSearchType, port);
+ baseSearch(baseSearchType, subnetID, deviceID);
// 鍒濆鍖栨悳绱㈣秴鏃讹紝5000姣鍚庯紝鏃犳悳绱㈣澶囨暟鎹繑鍥炲垯鎼滅储瓒呮椂
searchFailTimer.schedule(new TimerTask() {
@@ -234,57 +269,82 @@
HDLLog.I("鏈夋柊璁惧闃绘柇鍙戦�佹悳绱㈠懡浠�");
}
if (HDLDeviceManager.realDevicesDataList.size() == 0) {
- baseSearch(baseSearchType, port);
+ baseSearch(baseSearchType, subnetID, deviceID);
} else {
curDevSize = HDLDeviceManager.realDevicesDataList.size();
HDLLog.I("鏈夋柊璁惧锛岀户缁瓑寰�500姣");
}
} else {
- if (searchTwiceTimer == null) {
- searchTwiceTimer = new Timer();
- final SearchCountBean bean = new SearchCountBean();
- bean.setCount(0);
- searchTwiceTimer.schedule(new TimerTask() {
- @Override
- public void run() {
- if (bean.getCount() < 3) {
- HDLLog.I("娌℃湁鏀跺埌鏂拌澶囷紝鍙戦�佺 " + (bean.getCount() + 1) + " 娆℃悳绱㈠懡浠�");
- secondTimeSearch(random1, random2, (bean.getCount() + 1), HDLDeviceManager.realDevicesDataList);
- } else {
- if (searchTimer != null) {
- searchTimer.cancel();
- searchTimer.purge();
- searchTimer = null;
+ HDLLog.I("缃戝叧璁惧鎬绘暟锛�" + HDLDeviceManager.totalDeviceSize + " 鎺ユ敹鍒扮殑璁惧鎬绘暟锛�" + HDLDeviceManager.realDevicesDataList.size());
+ if (HDLDeviceManager.totalDeviceSize != HDLDeviceManager.realDevicesDataList.size()) {
+ if (searchByIndexTimer != null) {
+ searchByIndexTimer.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ if (HDLDeviceManager.totalDeviceSize != HDLDeviceManager.realDevicesDataList.size()) {
+ searchByIndex(HDLDeviceManager.realDevicesDataList, subnetID, deviceID);
+ } else {
+ if (searchByIndexTimer != null) {
+ searchByIndexTimer.cancel();
+ searchByIndexTimer.purge();
+ searchByIndexTimer = null;
+ }
}
- if (searchTwiceTimer != null) {
- searchTwiceTimer.cancel();
- searchTwiceTimer.purge();
- searchTwiceTimer = null;
- }
-
- isSearching = false;
- HDLLog.I("寮�濮嬭幏鍙栨瘡涓ā鍧楃殑鍥炶矾鐘舵�佷笌澶囨敞");
- getDevRemarks();//寮�濮嬭幏鍙栫涓�澶囨敞锛岄�愪竴鑾峰彇銆�
}
- bean.setCount(bean.getCount() + 1);
- }
- }, 1, 800);
- }
+ }, 5000, 5000);
+ }
+ } else {
+ if (searchTwiceTimer == null) {
+ searchTwiceTimer = new Timer();
+ final SearchCountBean bean = new SearchCountBean();
+ bean.setCount(0);
+ searchTwiceTimer.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ if (bean.getCount() < 3) {
+ HDLLog.I("娌℃湁鏀跺埌鏂拌澶囷紝鍙戦�佺 " + (bean.getCount() + 1) + " 娆℃悳绱㈠懡浠�");
+ secondTimeSearch(random1, random2, (bean.getCount() + 1), HDLDeviceManager.realDevicesDataList, subnetID, deviceID);
+ } else {
+ if (searchTimer != null) {
+ searchTimer.cancel();
+ searchTimer.purge();
+ searchTimer = null;
+ }
+ if (searchTwiceTimer != null) {
+ searchTwiceTimer.cancel();
+ searchTwiceTimer.purge();
+ searchTwiceTimer = null;
+ }
+ if (searchByIndexTimer != null) {
+ searchByIndexTimer.cancel();
+ searchByIndexTimer.purge();
+ searchByIndexTimer = null;
+ }
+ isSearching = false;
+ HDLLog.I("寮�濮嬭幏鍙栨瘡涓ā鍧楃殑鍥炶矾鐘舵�佷笌澶囨敞");
+ getDevRemarks();//寮�濮嬭幏鍙栫涓�澶囨敞锛岄�愪竴鑾峰彇銆�
+ }
+ bean.setCount(bean.getCount() + 1);
+ }
+ }, 1, 800);
+ }
+ }
}
}
- }, 800, 800);
+ }, 5000, 5000);
}
/**
* 鍙戦�佺涓�娆℃悳绱�
*
- * @param type 鎼滅储绫诲瀷
- * @param port 绔彛鍙�
+ * @param type 鎼滅储绫诲瀷
+ * @param subnetID 缃戝叧瀛愮綉鍙�
+ * @param deviceID 缃戝叧璁惧鍙�
*/
- private static void baseSearch(int type, int port) {
+ private static void baseSearch(int type, int subnetID, int deviceID) {
// 璁惧鍒楄〃銆佽澶囧娉ㄥ垪琛ㄥ垵濮嬪寲娓呯┖
if (remarkTimer != null) {
remarkTimer.cancel();
@@ -298,22 +358,23 @@
HDLDeviceManager.realDevicesDataList.clear();
HDLDeviceManager.listRemarks.clear();
curDevSize = 0;
+ HDLDeviceManager.totalDeviceSize = 0;
}
// 鍙戦�佺涓�娆℃悳绱㈠懡浠�
switch (type) {
case SEARCH_POINT_TO_POINT:
- HDLLog.I("鍙戦�佺涓�娆CU鎼滅储");
- HDLCommand.cusSendCommand(Configuration.DEVICES_SEARCH_COMMAND,
- 255, 255, new byte[]{random1, random2});
+ HDLLog.I("鍙戦�佺涓�娆″灞呮悳绱�");
+ HDLCommand.cusSendCommand(Configuration.DEVICES_SEARCH_FROM_GATEWAY_COMMAND,
+ subnetID, deviceID, new byte[]{random1, random2, 0, 0});
break;
case SEARCH_BROACAST:
HDLLog.I("鍙戦�佺涓�娆″灞呮悳绱�");
- HDLCommand.cusSendCommand(Configuration.DEVICES_SEARCH_COMMAND,
+ HDLCommand.cusSendCommand(Configuration.DEVICES_SEARCH_FROM_GATEWAY_COMMAND,
255, 255, new byte[]{random1, random2});
break;
case SEARCH_MULTICAST:
- HDLCommand.cusSendMulticastCommand(Configuration.DEVICES_SEARCH_COMMAND,
+ HDLCommand.cusSendMulticastCommand(Configuration.DEVICES_SEARCH_FROM_GATEWAY_COMMAND,
255, 255
, new byte[]{random1, random2});
break;
@@ -329,39 +390,23 @@
* @param arg2 闅忔満鏁�2
* @param devicesDataList 鎵�鏈夎澶囦俊鎭泦
*/
- public static void secondTimeSearch(byte arg1, byte arg2, int countSend, List<DevicesData> devicesDataList) {
+ public static void secondTimeSearch(byte arg1, byte arg2, int countSend, List<DevicesData> devicesDataList, int subnetID, int deviceID) {
if (devicesDataList == null || devicesDataList.size() == 0) {
return;
}
int devicesCount = 32;
int count = devicesDataList.size() / devicesCount;
int remainder = devicesDataList.size() % devicesCount;
-// HDLLog.I("kkkkcount:"+count+" remainder: "+remainder);
if (remainder != 0) {
count++;
}
outter:
for (int j = 0; j < count; j++) {
- byte[] bytes;
- int remainder2;
- if (j != count - 1
- || (count == 1 && remainder == 0)
- ) {
- remainder2 = devicesCount;
- } else {
- remainder2 = remainder;
- }
-
- bytes = new byte[2 + remainder2 * 2];
+ byte[] bytes = new byte[4];
bytes[0] = arg1;
bytes[1] = arg2;
- for (int k = 0; k < remainder2; k++) {
- if ((devicesCount * j + k >= devicesDataList.size()) || ((2 + 2 * k + 1) >= bytes.length)) {
- break outter;
- }
- bytes[2 + 2 * k] = (byte) devicesDataList.get(devicesCount * j + k).getSourceSubnetID();
- bytes[2 + 2 * k + 1] = (byte) devicesDataList.get(devicesCount * j + k).getSourceDeviceID();
- }
+ bytes[2] = 0;
+ bytes[3] = 0;
String sendData = "";
for (int i = 0; i < bytes.length; i++) {
@@ -376,35 +421,111 @@
}
}
HDLLog.I("绗�" + countSend + "娆″彂閫佺殑鎼滅储鏁版嵁锛�" + sendData);
- HDLCommand.cusSendCommand(Configuration.DEVICES_SEARCH_COMMAND, 255, 255, bytes);
+ HDLCommand.cusSendCommand(Configuration.DEVICES_SEARCH_FROM_GATEWAY_COMMAND, subnetID, deviceID, bytes);
}
}
-//
-// /**
-// * 杩斿洖璁惧鍒楄〃
-// */
-// public static void deviceListCallBack() {
-// byte[] debugBytes = new byte[6 + HDLDeviceManager.devicesDataList.size() * 2];
-// debugBytes[0] = 1;
-// debugBytes[1] = 1;
-// debugBytes[2] = 1;
-// debugBytes[3] = 1;
-// debugBytes[4] = 1;
-// debugBytes[5] = 1;
-//
-// for (int i = 0; i < HDLDeviceManager.devicesDataList.size(); i++) {
-// debugBytes[6 + i + i] = (byte) HDLDeviceManager.devicesDataList.get(i).getSourceSubnetID();
-// debugBytes[6 + i + i + 1] = (byte) HDLDeviceManager.devicesDataList.get(i).getSourceDeviceID();
-// String device = "绗� " + (i + 1) + " 涓ā鍧楋細妯″潡澶囨敞鍚嶇О锛�" + HDLDeviceManager.devicesDataList.get(i).getRemark()
-// + ",瀛愮綉鍙凤細" + HDLDeviceManager.devicesDataList.get(i).getSourceSubnetID()
-// + ",璁惧鍙凤細" + HDLDeviceManager.devicesDataList.get(i).getSourceDeviceID()
-// + ",鍥炶矾鏁帮細" + HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().size() + "\n";
-// HDLLog.I(device);
-// }
-//// HDLSerialPortCore.sendTestCMD(debugBytes, HDLTest.SEND_TEST_PORT);
-// EventBus.getDefault().post(new DevicesInfoEvent(HDLDeviceManager.devicesDataList, true));
-// }
+ public static void searchByIndex(List<DevicesData> devicesDataList, int subnetID, int deviceID) {
+
+ HDLLog.I("searchByIndex 缃戝叧璁惧鎬绘暟锛�" + HDLDeviceManager.totalDeviceSize + " 鎺ユ敹鍒扮殑璁惧鎬绘暟锛�" + HDLDeviceManager.realDevicesDataList.size());
+
+ if (HDLDeviceManager.totalDeviceSize != devicesDataList.size()) {
+ List<Integer> indexList = new ArrayList<>();
+ for (int i = 0; i < devicesDataList.size(); i++) {
+ DevicesData devicesData = devicesDataList.get(i);
+ indexList.add(devicesData.getDeviceIndex());
+ }
+
+ //鍒涘缓鍖呭惈鎵�鏈夌储寮曠殑闆嗗悎
+ Set<Integer> allIndices = new HashSet<>();
+ for (int i = 1; i <= HDLDeviceManager.totalDeviceSize; i++) {
+ allIndices.add(i);
+ }
+ //灏唅ndexList杞崲涓洪泦鍚�
+ Set<Integer> indexSet = new HashSet<>(indexList);
+ //璁$畻鏈寘鍚殑绱㈠紩
+ allIndices.removeAll(indexSet);
+ //灏嗙粨鏋滆浆鎹负鍒楄〃
+ List<Integer> newIndexList = new ArrayList<>(allIndices);
+ HDLLog.I("鏈寘鍚殑璁惧鎬绘暟锛�" + newIndexList.size() + " 璁惧绱㈠紩锛�" + newIndexList.toString());
+
+ int max = 254;
+ int min = 1;
+
+ for (int i = 0; i < newIndexList.size(); i++) {
+ random1 = (byte) (new Random().nextInt(max + 1) % (max - min + 1) + min);
+ random2 = (byte) (new Random().nextInt(max + 1) % (max - min + 1) + min);
+ HDLLog.I("鍙戦�佹悳绱㈣澶囩殑绱㈠紩锛�" + newIndexList.get(i));
+
+ HDLCommand.cusSendCommand(Configuration.DEVICES_SEARCH_FROM_GATEWAY_COMMAND,
+ subnetID, deviceID, new byte[]{random1, random2, (byte) (newIndexList.get(i) / 256), (byte) (newIndexList.get(i) % 256)});
+ }
+ }
+ }
+
+ /**
+ * 鍒濆鍖栨悳绱㈠満鏅�
+ *
+ * @param
+ */
+ private static void searchScenes(int subnetID, int deviceID) {
+ isSceneSearching = true;
+ isRefreshAllScenesState = false;
+
+ if (searchSceneTimer != null) {
+ searchSceneTimer.cancel();
+ searchSceneTimer.purge();
+ searchSceneTimer = null;
+ }
+
+ if (searchSceneFailTimer != null) {
+ searchSceneFailTimer.cancel();
+ searchSceneFailTimer.purge();
+ searchSceneFailTimer = null;
+ }
+
+ searchSceneTimer = new Timer();
+ searchSceneFailTimer = new Timer();
+
+ HDLCommand.cusSendCommand(Configuration.SCENE_SEARCH_FROM_GATEWAY_COMMAND,
+ subnetID, deviceID, new byte[]{0, 0});
+
+// 鍒濆鍖栨悳绱㈣秴鏃讹紝5000姣鍚庯紝鏃犳悳绱㈣澶囨暟鎹繑鍥炲垯鎼滅储瓒呮椂
+ searchSceneFailTimer.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ if (HDLDeviceManager.scenesDataList.size() == 0) {
+// 杩斿洖鎼滅储瓒呮椂
+ if (searchSceneTimer != null) {
+ searchSceneTimer.cancel();
+ searchSceneTimer.purge();
+ searchSceneTimer = null;
+ }
+ EventBus.getDefault().post(new ScenesInfoEvent(false));//涓嶈繘琛屽満鏅悳绱紝鐩存帴鍋滄
+ }
+ }
+ }, 5000);
+
+ if (searchSceneTimer == null) {
+ return;
+ }
+ searchSceneTimer.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ if (HDLDeviceManager.scenesDataList.size() != 0) {
+ if (searchSceneTimer != null) {
+ searchSceneTimer.cancel();
+ searchSceneTimer.purge();
+ searchSceneTimer = null;
+ }
+
+ isSceneSearching = false;
+ HDLLog.I("寮�濮嬭幏鍙栨瘡涓満鏅殑璇︾粏淇℃伅");
+ getSceneDetails();//寮�濮嬭幏鍙栫涓�鍦烘櫙锛岄�愪竴鑾峰彇銆�
+ }
+ }
+ }, 1, 800);
+ }
/**
* 杩斿洖璁惧鍒楄〃
@@ -414,6 +535,14 @@
EventBus.getDefault().post(new DevicesInfoEvent(HDLDeviceManager.devicesDataList, true));
/**鎼滅储璁惧鎴愬姛锛屾墽琛屼竴娆′繚瀛樺埌鏈湴*/
HDLDeviceManager.saveDevicesDataList();
+ }
+
+ /**
+ * 杩斿洖鍦烘櫙鍒楄〃
+ * 2024-01-18
+ */
+ public static void OnSceneListGetSuccessCallBack() {
+ EventBus.getDefault().post(new ScenesInfoEvent(HDLDeviceManager.scenesDataList, true));
}
@@ -472,7 +601,6 @@
public static void getDevRemarks() {
if (remarkTimer != null) {
remarkTimer.cancel();
-// remarkTimer.purge();
remarkTimer = null;
}
if ((HDLDeviceManager.listRemarks != null && HDLDeviceManager.listRemarks.size() == 0) || isSearching) {
@@ -482,6 +610,7 @@
}
return;
}
+
int pos = -1;
for (int i = 0; i < HDLDeviceManager.listRemarks.size(); i++) {
if (!HDLDeviceManager.listRemarks.get(i).isCallBack()) {
@@ -515,34 +644,24 @@
remarkTimer.schedule(new TimerTask() {
@Override
public void run() {
- if (remarkTimes.getCount() < 3) {
+ if (remarkTimes.getCount() < 1) {
remarkTimes.setCount(remarkTimes.getCount() + 1);
if (newPos < HDLDeviceManager.listRemarks.size()) {
-// int port = 0;
-// String ipAddress = "";
- switch (curSearchMode) {
- case HandleSearch.GET_RCU_DEVICES:
-// ipAddress = rcuIp;
-// port = Configuration.RCU_SEND_PORT;
- break;
- case HandleSearch.GET_BUS_DEVICES:
-// ipAddress = NetWorkUtil.getLocalBroadCast();
-// ipAddress = HDLDeviceManager.listRemarks.get(newPos).getAppliancesInfo().getIpAddress();
-// port = Configuration.PORT;
- break;
- }
HDLLog.I("----->鍙戦�佽幏鍙栧娉ㄥ懡浠ゃ�傚叡" + HDLDeviceManager.listRemarks.size() + "涓ā鍧椼�傜"
+ newPos + "涓ā鍧椼�傜 " + (HDLDeviceManager.listRemarks.get(newPos).getAppliancesInfo().getChannelNum())
+ " 鍥炶矾锛屽瓙缃戝彿锛�" + HDLDeviceManager.listRemarks.get(newPos).getAppliancesInfo().getDeviceSubnetID()
+ "锛岃澶囧彿锛�" + HDLDeviceManager.listRemarks.get(newPos).getAppliancesInfo().getDeviceDeviceID()
+ " 绗� " + remarkTimes.getCount() + " 娆�");
- HDLCommand.cusSendCommand(Configuration.DEVICES_READ_COMMAND,
- HDLDeviceManager.listRemarks.get(newPos).getAppliancesInfo().getDeviceSubnetID()
- , HDLDeviceManager.listRemarks.get(newPos).getAppliancesInfo().getDeviceDeviceID(),
+ HDLCommand.cusSendCommand(Configuration.DEVICES_READ_FROM_GATEWAY_COMMAND,
+ HDLDeviceManager.listRemarks.get(newPos).getAppliancesInfo().getSourceSubnetID()
+ , HDLDeviceManager.listRemarks.get(newPos).getAppliancesInfo().getSourceDeviceID(),
new byte[]{
+ (byte) HDLDeviceManager.listRemarks.get(newPos).getAppliancesInfo().getDeviceSubnetID(),
+ (byte) HDLDeviceManager.listRemarks.get(newPos).getAppliancesInfo().getDeviceDeviceID(),
+ (byte) HDLDeviceManager.listRemarks.get(newPos).getAppliancesInfo().getChannelNum(),
(byte) HDLDeviceManager.listRemarks.get(newPos).getAppliancesInfo().getBigType(),
(byte) HDLDeviceManager.listRemarks.get(newPos).getAppliancesInfo().getLittleType(),
- (byte) HDLDeviceManager.listRemarks.get(newPos).getAppliancesInfo().getChannelNum()});
+ });
}
} else {
@@ -557,4 +676,72 @@
}, 1, 1200);
}
+
+ /**
+ * 鑾峰彇鍦烘櫙璇︽儏
+ *
+ * @param
+ */
+ public static void getSceneDetails() {
+ if (HDLDeviceManager.scenesDataList.size() == 0) {
+ return;
+ }
+ if (remarkSceneTimer != null) {
+ remarkSceneTimer.cancel();
+ remarkSceneTimer = null;
+ }
+
+ int pos = -1;
+ for (int i = 0; i < HDLDeviceManager.scenesDataList.size(); i++) {
+ if (!HDLDeviceManager.scenesDataList.get(i).isCallBack()) {
+ pos = i;
+ break;
+ }
+ }
+
+ //鍒ゆ柇鏄惁鑾峰彇鍦烘櫙澶囨敞瀹屽叏锛岃嫢瀹屽叏鍒欒繑鍥炴墍鏈夊満鏅垪琛ㄣ��
+ if (HDLDeviceManager.scenesDataList != null && HDLDeviceManager.scenesDataList.size() != 0 && pos == -1) {
+ HandleSearch.OnSceneListGetSuccessCallBack();
+ return;
+ }
+
+ remarkSceneTimer = new Timer();
+ final int newPos = pos;
+ final RemarkTimes remarkTimes = new RemarkTimes();
+ remarkTimes.setCount(0);
+
+ if (remarkSceneTimer == null) {
+ return;
+ }
+
+ remarkSceneTimer.schedule(new TimerTask() {
+ @Override
+ public void run() {
+ if (remarkTimes.getCount() < 1) {
+ remarkTimes.setCount(remarkTimes.getCount() + 1);
+ if (newPos < HDLDeviceManager.scenesDataList.size()) {
+
+ HDLLog.I("----->鍙戦�佽幏鍙栧娉ㄥ懡浠ゃ�傚叡" + HDLDeviceManager.scenesDataList.size() + "涓満鏅�傜"
+ + (HDLDeviceManager.scenesDataList.get(newPos).getIndex())
+ + "涓満鏅��");
+ HDLCommand.cusSendCommand(Configuration.SCENE_READ_FROM_GATEWAY_COMMAND,
+ HDLDeviceManager.scenesDataList.get(newPos).getSourceSubnetID()
+ , HDLDeviceManager.scenesDataList.get(newPos).getSourceDeviceID(),
+ new byte[]{
+ (byte) (HDLDeviceManager.scenesDataList.get(newPos).getIndex() / 256),
+ (byte) (HDLDeviceManager.scenesDataList.get(newPos).getIndex() % 256)
+ });
+ }
+ } else {
+ if (HDLDeviceManager.scenesDataList != null
+ && HDLDeviceManager.scenesDataList.size() != 0
+ && newPos < HDLDeviceManager.scenesDataList.size()) {
+ HDLDeviceManager.scenesDataList.get(newPos).setCallBack(true);
+ }
+ getSceneDetails();
+ }
+
+ }
+ }, 1, 2000);
+ }
}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/CurtainDeviceStateEvent.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/CurtainDeviceStateEvent.java
new file mode 100644
index 0000000..4ea4a2e
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/CurtainDeviceStateEvent.java
@@ -0,0 +1,34 @@
+package com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent;
+
+
+import com.hdl.sdk.ttl.HDLAppliances.HDLCurtain.CurtainCtrlBackInfo;
+
+/**
+ * Created by panlili on 2024/01/23.
+ */
+
+public class CurtainDeviceStateEvent {
+ public CurtainCtrlBackInfo curtainCtrlBackInfo;
+ boolean isSuccess;
+
+ public CurtainDeviceStateEvent(CurtainCtrlBackInfo curtainCtrlBackInfo, boolean isSuccess){
+ this.curtainCtrlBackInfo = curtainCtrlBackInfo;
+ this.isSuccess = isSuccess;
+ }
+
+ public boolean isSuccess() {
+ return isSuccess;
+ }
+
+ public void setSuccess(boolean success) {
+ isSuccess = success;
+ }
+
+ public CurtainCtrlBackInfo getCurtainCtrlBackInfo() {
+ return curtainCtrlBackInfo;
+ }
+
+ public void setCurtainCtrlBackInfo(CurtainCtrlBackInfo curtainCtrlBackInfo) {
+ this.curtainCtrlBackInfo = curtainCtrlBackInfo;
+ }
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/SceneFeedBackEvent.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/SceneFeedBackEvent.java
new file mode 100644
index 0000000..ec952b6
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/SceneFeedBackEvent.java
@@ -0,0 +1,30 @@
+package com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent;
+
+
+import com.hdl.sdk.ttl.HDLAppliances.HDLLogic.SceneCtrlBackInfo;
+
+/**
+ * Created by panlili on 2024/1/19.
+ */
+
+public class SceneFeedBackEvent {
+ SceneCtrlBackInfo sceneCtrlBackInfo;
+ boolean isSuccess;
+
+ public SceneFeedBackEvent(SceneCtrlBackInfo sceneCtrlBackInfo, boolean isSuccess){
+ this.isSuccess = isSuccess;
+ this.sceneCtrlBackInfo = sceneCtrlBackInfo;
+ }
+
+ public boolean isSuccess() {
+ return isSuccess;
+ }
+
+ public SceneCtrlBackInfo getSceneCtrlBackInfo() {
+ return sceneCtrlBackInfo;
+ }
+
+ public void setSceneCtrlBackInfo(SceneCtrlBackInfo sceneCtrlBackInfo) {
+ this.sceneCtrlBackInfo = sceneCtrlBackInfo;
+ }
+}
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/ScenesInfoEvent.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/ScenesInfoEvent.java
new file mode 100644
index 0000000..825821d
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/HDLDeviceManger/EventBusEvent/ScenesInfoEvent.java
@@ -0,0 +1,33 @@
+package com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent;
+
+
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.ScenesData;
+
+import java.util.List;
+
+/**
+ * Created by panlili on 2024/01/18.
+ */
+
+public class ScenesInfoEvent {
+ public List<ScenesData> desSceneList;
+ public boolean isSuccess;
+
+ public ScenesInfoEvent(List<ScenesData> desSceneList, boolean isSuccess) {
+ this.desSceneList = desSceneList;
+ this.isSuccess = isSuccess;
+ }
+
+ public ScenesInfoEvent(boolean isSuccess) {
+ this.isSuccess = isSuccess;
+ }
+
+
+ public boolean isSuccess() {
+ return isSuccess;
+ }
+
+ public List<ScenesData> getDesSceneList() {
+ return desSceneList;
+ }
+}
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 e1aeedc..9e67ea5 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
@@ -30,7 +30,7 @@
*/
public static boolean parse(byte[] addBytes, DevicesData devicesData, String parentRemarks) {
boolean isExitData = false;
- int residue = addBytes.length - 22;
+ int residue = addBytes.length - 8;
int sumCount = residue / 3;//璁板綍鎬诲叡鏈夊灏戠璁惧
List<AppliancesInfo> appliancesInfoList = new ArrayList<>();
if (sumCount == 0) {
@@ -38,18 +38,32 @@
appliancesInfo.setDeviceName(Configuration.UNKNOW_TYPE);
appliancesInfoList.add(appliancesInfo);
}
-// HDLLog.I("sumCount" + sumCount);
+// 00008 2023骞�11鏈�29鏃�16:58:01:800: 0F FE 58 01 A8 F5 48 64 00 0F 18 00 00 3E A0
+// 00009 2023骞�11鏈�29鏃�16:58:01:816: 16 64 00 11 F7 F5 49 FE 58 0F 18 00 03 00 01 2A 60 07 03 01 35 59
+// 00010 2023骞�11鏈�29鏃�16:58:01:832: 19 64 00 11 F7 F5 49 FE 58 0F 18 00 03 00 02 64 80 05 09 01 0E 04 01 FE 35
+// 00011 2023骞�11鏈�29鏃�16:58:01:848: 16 64 00 11 F7 F5 49 FE 58 0F 18 00 03 00 03 64 0A 01 01 04 D5 C7
int curCount = 0;//寰幆閬嶅巻鎵�鏈夎澶囨鏁�
while (curCount < sumCount) {
- int bigType = addBytes[21 + (2 * curCount) + (curCount + 1)] & 0xFF;
- int littleType = addBytes[21 + (2 * curCount) + (curCount + 2)] & 0xFF;
- int channelNum = addBytes[21 + (2 * curCount) + (curCount + 3)] & 0xFF;
+
+ int subnetID = addBytes[6] & 0xFF;
+ int deviceID = addBytes[7] & 0xFF;
+ devicesData.setDeviceSubnetID(subnetID);
+ devicesData.setDeviceDeviceID(deviceID);
+
+ int bigType = addBytes[7 + (2 * curCount) + (curCount + 1)] & 0xFF;
+ int littleType = addBytes[7 + (2 * curCount) + (curCount + 2)] & 0xFF;
+ //閫氶亾鎬绘暟
+ int channelNum = addBytes[7 + (2 * curCount) + (curCount + 3)] & 0xFF;
+
curCount++;
int curChannelNum = 0;
while (curChannelNum < channelNum) {
curChannelNum++;
if (isWantData(bigType, littleType)) {
AppliancesInfo appliancesInfo = new AppliancesInfo();
+ appliancesInfo.setDeviceSubnetID(subnetID);
+ appliancesInfo.setDeviceDeviceID(deviceID);
+
/**鏍规嵁绫诲埆锛岃祴鍊兼搷浣滅爜绛変竴浜涢噸瑕佷俊鎭�*/
switch (bigType) {
case Configuration.LIGTH_BIG_TYPE:
@@ -86,7 +100,7 @@
parseGeothermalData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, 0, "");
break;
case Configuration.DOOR_MACHINE_BIG_TYPE://闂ㄩ攣
- parseDoorMachineData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, 0, "");//闂ㄩ攣鐨勯�氶亾鍙烽渶瑕�-1
+ parseDoorMachineData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, 0, "");
break;
default:
// appliancesInfo.setDeviceName(Configuration.UNKNOW_TYPE);
@@ -123,7 +137,7 @@
* @param littleType
* @return SDK鐩墠鏀寔鐨勫ぇ绫伙細灏忕被
* 鐏厜绫�1锛�0 锛�1锛�9锛�10
- * 绐楀笜绫�2锛�0锛�1锛�2
+ * 绐楀笜绫�2锛�0锛�1锛�2,6
* 浼犳劅鍣�5锛�0~24
* 绌鸿皟绫�7锛�0锛�3
* 鑳屾櫙闊充箰鍔熻兘9锛�0
@@ -154,12 +168,9 @@
case Configuration.CURTAIN_BIG_TYPE:
switch (littleType) {
case 0:
- isWant = true;
- break;
case 1:
- isWant = true;
- break;
case 2:
+ case 6:
isWant = true;
break;
default:
@@ -172,6 +183,7 @@
case 0:
case 3:
case 100:
+ case 101:
isWant = true;
break;
default:
@@ -195,14 +207,11 @@
break;
}
break;
- case Configuration.SENSOR_BIG_TYPE: //灞忚斀浼犳劅鍣ㄥぇ绫�
-// if (littleType >= 0 && littleType <= 27) {
-// isWant = true;
-// } else {
-// isWant = false;
-// }
-
- if (littleType == 1 || littleType == 9 || littleType == 11 || (littleType > 24 && littleType <= 27)) {//2019-11-5 鏀逛负鍙敮鎸�6绉嶆劅搴斿櫒
+ case Configuration.SENSOR_BIG_TYPE:
+ if (littleType == 1 || littleType == 2 || littleType == 3
+ || (littleType > 4 && littleType <= 11)
+ || littleType == 20 || (littleType > 24 && littleType <= 27)
+ || littleType == 32) {
isWant = true;
} else {
isWant = false;
@@ -354,8 +363,8 @@
appliancesInfo.setStateCommand(Configuration.LIGHT_STATE_COMMAND);
appliancesInfo.setStateBackCommand(Configuration.LIGHT_STATE_BACK_COMMAND);
}
- appliancesInfo.setDeviceSubnetID(devicesData.getSourceSubnetID());
- appliancesInfo.setDeviceDeviceID(devicesData.getSourceDeviceID());
+ appliancesInfo.setSourceSubnetID(devicesData.getSourceSubnetID());
+ appliancesInfo.setSourceDeviceID(devicesData.getSourceDeviceID());
appliancesInfo.setParentRemarks(parentRemarks);
// appliancesInfo.setPort(port);
// appliancesInfo.setIpAddress(ipAddress);
@@ -376,6 +385,10 @@
appliancesInfo.setDeviceName("绐楀笜妯″潡");
appliancesInfo.setDeviceType(HDLApConfig.TYPE_CURTAIN_MODULE);
break;
+ case 6:
+ appliancesInfo.setDeviceName("棣欐牸閲屾媺甯樼數鏈�");
+ appliancesInfo.setDeviceType(HDLApConfig.TYPE_CURTAIN_SHANGRILA);
+ break;
default:
appliancesInfo.setDeviceName(Configuration.UNKNOW_TYPE);
break;
@@ -389,11 +402,9 @@
appliancesInfo.setCtrlBackCommand(Configuration.CURTAIN_CTRL_BACK_COMMAND);
appliancesInfo.setStateCommand(Configuration.CURTAIN_STATE_COMMAND);
appliancesInfo.setStateBackCommand(Configuration.CURTAIN_STATE_BACK_COMMAND);
- appliancesInfo.setDeviceSubnetID(devicesData.getSourceSubnetID());
- appliancesInfo.setDeviceDeviceID(devicesData.getSourceDeviceID());
+ appliancesInfo.setSourceSubnetID(devicesData.getSourceSubnetID());
+ appliancesInfo.setSourceDeviceID(devicesData.getSourceDeviceID());
appliancesInfo.setParentRemarks(parentRemarks);
-// appliancesInfo.setPort(port);
-// appliancesInfo.setIpAddress(ipAddress);
}
}
@@ -419,6 +430,10 @@
appliancesInfo.setDeviceName("绉戞妧绯荤粺");
appliancesInfo.setDeviceType(HDLApConfig.TYPE_AC_TECHSYS);
break;
+ case 101:
+ appliancesInfo.setDeviceName("KNX绉戞妧绯荤粺");
+ appliancesInfo.setDeviceType(HDLApConfig.TYPE_AC_KNXTECHSYS);
+ break;
default:
appliancesInfo.setDeviceName(Configuration.UNKNOW_TYPE);
break;
@@ -428,12 +443,10 @@
appliancesInfo.setChannelNum(channelNum);
appliancesInfo.setBigType(Configuration.AIR_BIG_TYPE);
appliancesInfo.setLittleType(littleType);
- appliancesInfo.setDeviceSubnetID(devicesData.getSourceSubnetID());
- appliancesInfo.setDeviceDeviceID(devicesData.getSourceDeviceID());
+ appliancesInfo.setSourceSubnetID(devicesData.getSourceSubnetID());
+ appliancesInfo.setSourceDeviceID(devicesData.getSourceDeviceID());
appliancesInfo.setParentRemarks(parentRemarks);
-// appliancesInfo.setPort(port);
-// appliancesInfo.setIpAddress(ipAddress);
- if (littleType == 0 || littleType == 100) {//绉戞妧绯荤粺璧�0x193A鍜�0x1938
+ if (littleType == 0 || littleType == 100 || littleType == 101) {//绉戞妧绯荤粺璧�0x193A鍜�0x1938
appliancesInfo.setCtrlCommand(Configuration.AIR_HVAC_CTRL_COMMAND);
appliancesInfo.setCtrlBackCommand(Configuration.AIR_HVAC_CTRL_BACK_COMMAND);
appliancesInfo.setStateCommand(Configuration.AIR_HVAC_STATE_COMMAND);
@@ -476,11 +489,9 @@
appliancesInfo.setCtrlBackCommand(Configuration.AUDIO_CTRL_READ_BACK_COMMAND);
appliancesInfo.setStateCommand(Configuration.AUDIO_MenuPlay_INSTRUCTION_COMMAND);
appliancesInfo.setStateBackCommand(Configuration.AUDIO_MenuPlay_INSTRUCTION_BACK_COMMAND);
- appliancesInfo.setDeviceSubnetID(devicesData.getSourceSubnetID());
- appliancesInfo.setDeviceDeviceID(devicesData.getSourceDeviceID());
+ appliancesInfo.setSourceSubnetID(devicesData.getSourceSubnetID());
+ appliancesInfo.setSourceDeviceID(devicesData.getSourceDeviceID());
appliancesInfo.setParentRemarks(parentRemarks);
-// appliancesInfo.setPort(port);
-// appliancesInfo.setIpAddress(ipAddress);
}
HDLLog.I("闊充箰妯″潡锛�" + parentRemarks);
}
@@ -504,12 +515,9 @@
appliancesInfo.setCtrlBackCommand(Configuration.LOGIC_CTRL_BACK_COMMAND);
appliancesInfo.setStateCommand(Configuration.LOGIC_STATE_COMMAND);
appliancesInfo.setStateBackCommand(Configuration.LOGIC_STATE_BACK_COMMAND);
- appliancesInfo.setDeviceSubnetID(devicesData.getSourceSubnetID());
- appliancesInfo.setDeviceDeviceID(devicesData.getSourceDeviceID());
+ appliancesInfo.setSourceSubnetID(devicesData.getSourceSubnetID());
+ appliancesInfo.setSourceDeviceID(devicesData.getSourceDeviceID());
appliancesInfo.setParentRemarks(parentRemarks);
-// appliancesInfo.setPort(port);
-// appliancesInfo.setIpAddress(ipAddress);
-
}
}
@@ -533,12 +541,9 @@
appliancesInfo.setCtrlBackCommand(Configuration.LOGIC_CTRL_BACK_COMMAND);
appliancesInfo.setStateCommand(Configuration.LOGIC_STATE_COMMAND);
appliancesInfo.setStateBackCommand(Configuration.LOGIC_STATE_BACK_COMMAND);
- appliancesInfo.setDeviceSubnetID(devicesData.getSourceSubnetID());
- appliancesInfo.setDeviceDeviceID(devicesData.getSourceDeviceID());
+ appliancesInfo.setSourceSubnetID(devicesData.getSourceSubnetID());
+ appliancesInfo.setSourceDeviceID(devicesData.getSourceDeviceID());
appliancesInfo.setParentRemarks(parentRemarks);
-// appliancesInfo.setPort(port);
-// appliancesInfo.setIpAddress(ipAddress);
-
}
}
@@ -573,11 +578,9 @@
appliancesInfo.setChannelNum(channelNum);
appliancesInfo.setBigType(Configuration.SECURITY_BIG_TYPE);
appliancesInfo.setLittleType(littleType);
- appliancesInfo.setDeviceSubnetID(devicesData.getSourceSubnetID());
- appliancesInfo.setDeviceDeviceID(devicesData.getSourceDeviceID());
+ appliancesInfo.setSourceSubnetID(devicesData.getSourceSubnetID());
+ appliancesInfo.setSourceDeviceID(devicesData.getSourceDeviceID());
appliancesInfo.setParentRemarks(parentRemarks);
-// appliancesInfo.setPort(port);
-// appliancesInfo.setIpAddress(ipAddress);
appliancesInfo.setCtrlCommand(Configuration.SECURITY_ARMING_CTRL_COMMAND);//甯冮槻
appliancesInfo.setCtrlBackCommand(Configuration.SECURITY_ARMING_CTRL_BACK_COMMAND);//甯冮槻璁剧疆鍙嶉
appliancesInfo.setStateCommand(Configuration.SECURITY_STATE_COMMAND);//璇诲彇瀹夐槻璁剧疆
@@ -717,6 +720,10 @@
appliancesInfo.setDeviceName("浼犳劅鍣� 绱ф�ユ寜閽�");
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_EMERGENCY_BUTTON);
break;
+ case 32:
+ appliancesInfo.setDeviceName("浼犳劅鍣� PM10");
+ appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_PM_10);
+ break;
default:
appliancesInfo.setDeviceName(Configuration.UNKNOW_TYPE);
@@ -729,13 +736,12 @@
appliancesInfo.setBigType(Configuration.SENSOR_BIG_TYPE);
appliancesInfo.setLittleType(littleType);
- appliancesInfo.setDeviceSubnetID(devicesData.getSourceSubnetID());
- appliancesInfo.setDeviceDeviceID(devicesData.getSourceDeviceID());
+ appliancesInfo.setSourceSubnetID(devicesData.getSourceSubnetID());
+ appliancesInfo.setSourceDeviceID(devicesData.getSourceDeviceID());
appliancesInfo.setParentRemarks(parentRemarks);
- appliancesInfo.setStateCommand(Configuration.DRY_CONTACT_STATE_COMMAND);
- appliancesInfo.setStateBackCommand(Configuration.DRY_CONTACT_STATE_BACK_COMMAND);
-
+ appliancesInfo.setStateCommand(Configuration.SENSOR_STATE_COMMAND);
+ appliancesInfo.setStateBackCommand(Configuration.SENSOR_STATE_BACK_COMMAND);
}
}
@@ -772,8 +778,8 @@
appliancesInfo.setChannelNum(channelNum);
appliancesInfo.setBigType(Configuration.FRESH_AIR_BIG_TYPE);
appliancesInfo.setLittleType(littleType);
- appliancesInfo.setDeviceSubnetID(devicesData.getSourceSubnetID());
- appliancesInfo.setDeviceDeviceID(devicesData.getSourceDeviceID());
+ appliancesInfo.setSourceSubnetID(devicesData.getSourceSubnetID());
+ appliancesInfo.setSourceDeviceID(devicesData.getSourceDeviceID());
appliancesInfo.setParentRemarks(parentRemarks);
}
}
@@ -809,11 +815,9 @@
appliancesInfo.setChannelNum(channelNum);
appliancesInfo.setBigType(Configuration.GEOTHERMAL_BIG_TYPE);
appliancesInfo.setLittleType(littleType);
- appliancesInfo.setDeviceSubnetID(devicesData.getSourceSubnetID());
- appliancesInfo.setDeviceDeviceID(devicesData.getSourceDeviceID());
+ appliancesInfo.setSourceSubnetID(devicesData.getSourceSubnetID());
+ appliancesInfo.setSourceDeviceID(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);
@@ -842,8 +846,8 @@
appliancesInfo.setChannelNum(channelNum);
appliancesInfo.setBigType(Configuration.DOOR_MACHINE_BIG_TYPE);
appliancesInfo.setLittleType(littleType);
- appliancesInfo.setDeviceSubnetID(devicesData.getSourceSubnetID());
- appliancesInfo.setDeviceDeviceID(devicesData.getSourceDeviceID());
+ appliancesInfo.setSourceSubnetID(devicesData.getSourceSubnetID());
+ appliancesInfo.setSourceDeviceID(devicesData.getSourceDeviceID());
appliancesInfo.setParentRemarks(parentRemarks);
appliancesInfo.setCtrlCommand(Configuration.DOOR_MACHINE_MODULE_CTRL_COMMAND);
@@ -882,8 +886,8 @@
appliancesInfo.setChannelNum(channelNum);
appliancesInfo.setBigType(Configuration.COMMON_SWITCH_BIG_TYPE);
appliancesInfo.setLittleType(littleType);
- appliancesInfo.setDeviceSubnetID(devicesData.getSourceSubnetID());
- appliancesInfo.setDeviceDeviceID(devicesData.getSourceDeviceID());
+ appliancesInfo.setSourceSubnetID(devicesData.getSourceSubnetID());
+ appliancesInfo.setSourceDeviceID(devicesData.getSourceDeviceID());
appliancesInfo.setParentRemarks(parentRemarks);
appliancesInfo.setCtrlCommand(Configuration.COMMON_SWITCH_CTRL_COMMAND);//甯冮槻
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Utils/HDLUtlis/HDLStringUtils.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Utils/HDLUtlis/HDLStringUtils.java
index d5a3150..18c5f8b 100644
--- a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Utils/HDLUtlis/HDLStringUtils.java
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Utils/HDLUtlis/HDLStringUtils.java
@@ -22,7 +22,7 @@
String result = "";
try {
- result = new String(remarkBytes, "GB2312");
+ result = new String(remarkBytes, "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
@@ -32,7 +32,7 @@
public static byte[] stringtoBytes(String str) {
byte[] bytes = new byte[20];
try {
- bytes = str.getBytes("GB2312");
+ bytes = str.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
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 135fb82..5cf4442 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
@@ -2,6 +2,7 @@
import java.math.BigDecimal;
import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
/**
* Created by JLChen on 2019/7/25
@@ -10,24 +11,25 @@
/**
* 灏唎bject杞负Integer绫诲瀷
+ *
* @param object
* @return
*/
- public static Integer getIntegerByObject(Object object){
+ public static Integer getIntegerByObject(Object object) {
Integer in = null;
- if(object!=null){
- if(object instanceof Integer){
- in = (Integer)object;
- }else if(object instanceof String){
- in = Integer.parseInt((String)object);
- }else if(object instanceof Double){
- in = (int)((double)object);
- }else if(object instanceof Float){
- in = (int)((float)object);
- }else if(object instanceof BigDecimal){
- in = ((BigDecimal)object).intValue();
- }else if(object instanceof Long){
- in = ((Long)object).intValue();
+ if (object != null) {
+ if (object instanceof Integer) {
+ in = (Integer) object;
+ } else if (object instanceof String) {
+ in = Integer.parseInt((String) object);
+ } else if (object instanceof Double) {
+ in = (int) ((double) object);
+ } else if (object instanceof Float) {
+ in = (int) ((float) object);
+ } else if (object instanceof BigDecimal) {
+ in = ((BigDecimal) object).intValue();
+ } else if (object instanceof Long) {
+ in = ((Long) object).intValue();
}
}
return in;
@@ -35,6 +37,7 @@
/**
* int绫诲瀷杞�4瀛楄妭byte鏁扮粍
+ *
* @param mInt
* @return 4瀛楄妭byte鏁扮粍
*/
@@ -50,6 +53,7 @@
/**
* byte[]杞琲nt
+ *
* @param bytes
* @return
*/
@@ -65,12 +69,12 @@
public static float byte2Float(byte[] bytes) {
- if (bytes.length != 4) {
+ /* if (bytes.length != 4) {
return 0;
- }
+ }*/
byte b[] = bytes;
ByteBuffer buf = ByteBuffer.allocateDirect(4);
-// buf=buf.order(ByteOrder.LITTLE_ENDIAN);灏忕鐢ㄨ繖琛屼唬鐮侊紝榛樿澶х杞崲
+ buf = buf.order(ByteOrder.LITTLE_ENDIAN);//灏忕鐢ㄨ繖琛屼唬鐮侊紝榛樿澶х杞崲
buf.put(b);
buf.rewind();
float f2 = buf.getFloat();
@@ -79,6 +83,7 @@
/**
* 璋冩暣int 绫诲瀷鍙傛暟
+ *
* @return progress
*/
public static int getTrueProgressInt(int progress) {
diff --git a/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Utils/HDLUtlis/SerialPortSendAndReceiveUtil.java b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Utils/HDLUtlis/SerialPortSendAndReceiveUtil.java
new file mode 100644
index 0000000..c975e28
--- /dev/null
+++ b/HDL_TTLSDK485/src/main/java/com/hdl/sdk/ttl/Utils/HDLUtlis/SerialPortSendAndReceiveUtil.java
@@ -0,0 +1,389 @@
+package com.hdl.sdk.ttl.Utils.HDLUtlis;
+
+import android.os.SystemClock;
+import android.util.Log;
+
+import com.hdl.sdk.ttl.Config.Global;
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.ReceiveData;
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.SendDatas;
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.UdpDataBean;
+import com.hdl.sdk.ttl.HDLDeviceManger.Core.Crc;
+import com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLSerialPortCore;
+
+import java.net.InetAddress;
+import java.nio.ByteBuffer;
+import java.util.Calendar;
+
+/**
+ * Created by hxb on 2023/10/18.
+ */
+public class SerialPortSendAndReceiveUtil {
+ private static volatile SerialPortSendAndReceiveUtil instance = null;
+
+ /**
+ * 鍙戦�佺嚎绋�
+ */
+ private Thread sendThread;
+
+ /**
+ * 鎺ユ敹绾跨▼
+ */
+ private Thread receiveThread;
+
+
+ private SerialPortSendAndReceiveUtil() {
+ sendThread = new Thread(new SendRunnable());
+ receiveThread = new Thread(new ReceiveRunnable());
+ }
+
+ public static SerialPortSendAndReceiveUtil getInstance() {
+ if (instance == null) {
+ synchronized (SerialPortSendAndReceiveUtil.class) {
+ if (instance == null) {
+ instance = new SerialPortSendAndReceiveUtil();
+ }
+ }
+ }
+ return instance;
+ }
+
+ public void start() {
+ sendThread.start();
+ receiveThread.start();
+
+ Global.mReceiveData = data;
+ }
+
+ /**
+ * 鑾峰彇灏佽鏁版嵁
+ *
+ * @param body 鍙戦�佹暟鎹唴瀹�
+ * @param writeOrRead 璇诲啓鏍囪瘑锛�1琛ㄧず鍐欙紝2琛ㄧず璇诲彇
+ * @return
+ */
+ private static byte[] getSendByte(byte[] body, int writeOrRead) {
+ byte[] crcBytes = new byte[2 + 1 + 1 + body.length + 2];
+ crcBytes[0] = (byte) 0XFE;
+ crcBytes[1] = (byte) 0xFE;
+ crcBytes[2] = (byte) writeOrRead;
+ crcBytes[3] = (byte) body.length;
+ System.arraycopy(body, 0, crcBytes, 4, body.length);
+
+ //Check CRC
+ Crc.CRC16_MODBUS(crcBytes, crcBytes.length);
+
+ return crcBytes;
+ }
+
+
+ static class SendRunnable implements Runnable {
+ /**
+ * 鍙戦�佷竴鏉″悗浼戠湢鏃堕棿
+ */
+ private int sleepTime = 30;
+ /**
+ * 閲嶅彂闂撮殧鏃堕棿
+ */
+ private int intervalTime = 500;
+
+ /**
+ * 閲嶅彂娆℃暟
+ */
+ private int reSendCount = 3;
+
+ /**
+ * 绾跨▼杩愯鐘舵��
+ */
+ private boolean run = true;
+
+ @Override
+ public void run() {
+ while (run) {
+ try {
+ SystemClock.sleep(sleepTime);
+ if (HDLSerialPortCore.mSerialPort == null) {
+ Log.i("涓插彛-鍙戦��->", "涓插彛娌℃湁鍒濆鍖�");
+ continue;
+ }
+
+ for (int i = 0; i < SendDatas.sendDataArrayList.size(); i++) {
+ SendDatas sendDatas = SendDatas.sendDataArrayList.get(i);
+
+ //绗竴娆″彂閫侊紝鏃堕棿鍏堝垵濮嬪寲
+ if (sendDatas.StartCalendar == null) {
+ sendDatas.StartCalendar = Calendar.getInstance();
+ } else {
+ //璺濈涓婃鍙戦�佺殑鏃堕棿濡傝繕鍦ㄩ噸鍙戞椂闂村唴锛屽厛涓嶅彂
+ if (Calendar.getInstance().getTimeInMillis() - sendDatas.StartCalendar.getTimeInMillis() < intervalTime) {
+ continue;
+ }
+ }
+ //瓒呭嚭鐗归噸鍙戞暟娆″氨涓嶅彂閫侊紝骞剁Щ闄ゅ嚭鍒楄〃
+ if (sendDatas.SendCount >= reSendCount) {
+ synchronized (SendDatas.sendDataArrayList) {
+ SendDatas.sendDataArrayList.remove(i--);
+ }
+ continue;
+ }
+
+ sendDatas.StartCalendar = Calendar.getInstance();//閲嶇疆鍙戦�佹椂闂�
+ sendDatas.SendCount++;
+
+ byte[] sendBytes = SerialPortSendAndReceiveUtil.getSendByte(sendDatas.GetSerialPortSendBytes(), 1);
+
+ HDLSerialPortCore.mSerialPort.getOutputStream().write(sendBytes);
+ HDLSerialPortCore.mSerialPort.getOutputStream().flush();
+ SystemClock.sleep(sleepTime);
+ }
+
+ //鍙戦�佸畬鎴愬悗閫氱煡璇诲彇缂撳瓨鏁版嵁
+ read();
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ }
+
+ /**
+ * 閫氱煡璇诲彇鎬荤嚎缂撳瓨鏁版嵁
+ */
+ void read() {
+ try {
+ byte[] body = new byte[]{(byte) 0xFE, (byte) 0xFE, 0x02, 0x01, 0x00, (byte) 0x9C, 0x6C};
+ // 鍙戦�丏ata
+ HDLSerialPortCore.mSerialPort.getOutputStream().write(body);
+ HDLSerialPortCore.mSerialPort.getOutputStream().flush();
+ Log.d("涓插彛-鍙戦��->", "鍙戦�佽鍙�");
+ } catch (Exception ignored) {
+ }
+ }
+ }
+
+ private static ReceiveData data = new ReceiveData() {
+
+ @Override
+ public void receiveData(int command, int desSubnetID, int desDeviceID, int subnetID, int deviceID, byte[] usefulBytes) {
+ // 鏇存柊鍙戦�佹槸鍚︽垚鍔熺殑淇℃伅
+ SendDatas.ReceiveBytes(command, subnetID, deviceID, usefulBytes);
+ //2019-8-20 澧炲姞鐩爣瀛愮綉鍙疯澶囧彿鍒ゆ柇
+ if ((desSubnetID == 0xFF && desSubnetID == 0xFF)
+ || (desSubnetID == Crc.localSubnetID && desSubnetID == Crc.localDeviceID)) {
+ //鍙傛暟
+ UdpDataBean udpDataBean = new UdpDataBean();
+ udpDataBean.sourceSubnetID = subnetID;
+ udpDataBean.sourceDeviceID = deviceID;
+ udpDataBean.desSubnetID = desSubnetID;
+ udpDataBean.desDeviceID = desDeviceID;
+ udpDataBean.command = command;
+
+ udpDataBean.addBytes = usefulBytes;
+ HDLSerialPortCore.HandleInsideData(udpDataBean);
+
+ }
+
+ }
+ };
+
+ static class ReceiveRunnable implements Runnable {
+ /**
+ * 绾跨▼杩愯鐘舵��
+ */
+ private boolean run = true;
+
+ private byte[] head = new byte[]{(byte) 0xFE, (byte) 0xFE};
+
+ /**
+ * 缂撳瓨鍖�
+ */
+ private final ByteBuffer byteBuffer = ByteBuffer.allocate(1024);
+
+ @Override
+ public void run() {
+ while (run) {
+ try {
+ if (HDLSerialPortCore.mSerialPort == null) {
+ Log.i("涓插彛-璇诲彇->", "涓插彛娌℃湁鍒濆鍖�");
+ continue;
+ }
+ byte[] data = new byte[1024];
+ int size = HDLSerialPortCore.mSerialPort.getInputStream().read(data);
+ if (size <= 0) {
+ continue;
+ }
+
+ try {
+ byteBuffer.put(data, 0, size);
+ Log.d("涓插彛->鍥炲", byteToHex(data, 0, size) + " position:" + byteBuffer.position());
+ } catch (Exception e) {
+ byteBuffer.flip();
+ byteBuffer.clear();
+ }
+
+ while (true) {
+ removeInVoidBytes();
+
+ //娌℃湁鏂扮殑鏁版嵁锛岃繑鍥�
+ if (!haveData()) {
+ break;
+ }
+
+
+ int bodyIndex = 2 + 1 + 1;
+ int lenght = byteBuffer.get(3) & 0xFF;
+
+ byte[] packet = getBody(0, bodyIndex + lenght + 2);
+ //鏄惁宸茬粡鑾峰彇瀹屾暣鎵�鏈夌殑鏁版嵁
+ byte[] tempBytes = getBody(bodyIndex, lenght);
+ remove(bodyIndex + lenght + 2);
+
+ if (!Crc.CRC16_MODBUS_MATCH(packet, packet.length)) {
+ Log.d("涓插彛->鍥炲", "CRC涓嶅");
+ continue;
+ }
+ if (tempBytes == null) {
+ Log.d("涓插彛->鍥炲", "褰撳墠鏁版嵁杩樻病鏈夋帴鏀跺畬鎴�");
+ //褰撳墠鏁版嵁杩樻病鏈夋帴鏀跺畬鎴�
+ continue;
+ }
+
+ if (lenght <= 1) {
+ //璁惧鍥炲鐨勫崗璁暟鎹�
+ continue;
+ }
+
+ int command = (tempBytes[7] & 0xFF) * 256 + (tempBytes[8] & 0xFF);
+
+ int subnetID = tempBytes[3] & 0xFF;
+ int deviceID = tempBytes[4] & 0xFF;
+ int desSubnetID = tempBytes[9] & 0xFF;
+ int desDeviceID = tempBytes[10] & 0xFF;
+ //濡傛灉涓嶆槸鍙戠粰鑷繁鐨勬暟鎹垨鑰呬笉鏄箍鎾殑鏁版嵁锛屼笉澶勭悊
+ if (desSubnetID != Global.subnetID || desDeviceID != Global.deviceID) {
+ if (desSubnetID != 0xFF || desDeviceID != 0xFF) {
+ Log.d("涓插彛->鍥炲", "杩囨护鎺�=={鐩爣瀛愮綉:" + desSubnetID + ",鐩爣璁惧:" + desDeviceID + "}");
+ continue;
+ }
+ }
+
+ byte[] usefulBytes = new byte[(tempBytes[2] & 0xFF) - 11];
+ // 澶嶅埗闄勫姞鏁版嵁
+ System.arraycopy(tempBytes, 11, usefulBytes, 0, usefulBytes.length);
+ if (Global.mReceiveData != null) {
+ Global.mReceiveData.receiveData(command, desSubnetID, desDeviceID, subnetID, deviceID, usefulBytes);
+ }
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ private String byteToHex(byte[] bytes, int index, int length) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = index; i < length; i++) {
+ sb.append(String.format(" %02X", bytes[i]));
+ }
+ return sb.toString();
+ }
+
+ /**
+ * 鑾峰彇澶撮儴鏁版嵁
+ *
+ * @return
+ */
+ boolean haveData() {
+
+ int length = 2 + 1 + 1 + (byteBuffer.get(3) & 0xFF) + 2;
+
+ //鏁版嵁杩樻病鏈夋帴鏀跺叏
+ if (byteBuffer.position() < length) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * 鑾峰彇鏁版嵁鍐呭
+ *
+ * @param lenght
+ * @return
+ */
+ byte[] getBody(int index, int lenght) {
+ //鏄惁宸茬粡鑾峰彇瀹屾暣鎵�鏈夌殑鏁版嵁
+ byte[] bodyBytes = new byte[lenght];
+ if (index < 0 || byteBuffer.position() < index + lenght) {
+ //褰撳墠鏁版嵁杩樻病鏈夋帴鏀跺畬鎴�
+ return null;
+ }
+
+ for (int i = 0; i < bodyBytes.length; i++) {
+ bodyBytes[i] = byteBuffer.get(index + i);
+ }
+ return bodyBytes;
+ }
+
+ /**
+ * 绉婚櫎鍙兘瀛樺湪鐨勬棤鏁堟暟鎹�
+ */
+ void removeInVoidBytes() {
+ for (int i = 0; i < dddd.length; i++) {
+ dddd[i] = byteBuffer.get(i);
+ }
+// Log.d("涓插彛->鍥炲", "position:"+byteBuffer.position()+" 澶勭悊鍓嶇殑鏁版嵁"+byteToHex(dddd, 0, 100));
+ int index = 0;
+ boolean isMatch = false;
+ for (; index < byteBuffer.position() - head.length; index++) {
+ isMatch = true;
+ for (int j = 0; j < head.length; j++) {
+ if (head[j] != byteBuffer.get(index + j)) {
+ isMatch = false;
+ break;
+ }
+ }
+ if (isMatch) {
+ break;
+ }
+ }
+ int endIndex = 0;
+ if (0 < index && isMatch) {
+ endIndex = byteBuffer.position();
+ byteBuffer.clear();
+ for (int i = index; i < endIndex; i++) {
+ byteBuffer.put(byteBuffer.get(i));
+ }
+ }
+
+ for (int i = 0; i < dddd.length; i++) {
+ dddd[i] = byteBuffer.get(i);
+ }
+ }
+
+ byte[] dddd = new byte[100];
+
+ /**
+ * 绉婚櫎鍒版寚瀹氫綅缃墠闈㈢殑鏁版嵁
+ *
+ * @param position 鎸囧畾浣嶇疆
+ */
+ void remove(int position) {
+ int endIndex = byteBuffer.position();
+ byteBuffer.clear();
+ //TODO 娓呯┖涔嬪墠鐨勬暟鎹�
+ for (int i = position; i < endIndex; i++) {
+ byteBuffer.put(byteBuffer.get(i));
+ }
+
+ for (int i = 0; i < dddd.length; i++) {
+ dddd[i] = byteBuffer.get(i);
+ }
+
+// Log.d("涓插彛->鍥炲", "position:"+byteBuffer.position()+" 绉婚櫎鍚庣殑鏁版嵁"+byteToHex(dddd, 0, 100));
+ }
+ }
+
+}
diff --git a/app/build.gradle b/app/build.gradle
index 150ddbf..00cd3d0 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -45,6 +45,7 @@
// implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
+ implementation 'androidx.test.ext:junit:1.1.5'
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'
diff --git a/app/src/androidTest/java/com/hdl/sdk/ttl_sdk/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/hdl/sdk/ttl_sdk/ExampleInstrumentedTest.java
index 4208b82..376a06c 100644
--- a/app/src/androidTest/java/com/hdl/sdk/ttl_sdk/ExampleInstrumentedTest.java
+++ b/app/src/androidTest/java/com/hdl/sdk/ttl_sdk/ExampleInstrumentedTest.java
@@ -1,26 +1,28 @@
-package com.hdl.sdk.ttl_sdk;
-
-import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static org.junit.Assert.*;
-
-/**
- * Instrumented test, which will execute on an Android device.
- *
- * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
- */
-@RunWith(AndroidJUnit4.class)
-public class ExampleInstrumentedTest {
- @Test
- public void useAppContext() {
- // Context of the app under test.
- Context appContext = InstrumentationRegistry.getTargetContext();
-
- assertEquals("com.hdl.sdk.hdl_sdk", appContext.getPackageName());
- }
-}
+//package com.hdl.sdk.ttl_sdk;
+//
+//import android.content.Context;
+//import android.support.test.InstrumentationRegistry;
+//import android.support.test.runner.AndroidJUnit4;
+//
+//import org.junit.Test;
+//import org.junit.runner.RunWith;
+//
+//import static org.junit.Assert.*;
+//
+//import androidx.test.ext.junit.runners.AndroidJUnit4;
+//
+///**
+// * Instrumented test, which will execute on an Android device.
+// *
+// * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
+// */
+//@RunWith(AndroidJUnit4.class)
+//public class ExampleInstrumentedTest {
+// @Test
+// public void useAppContext() {
+// // Context of the app under test.
+// Context appContext = InstrumentationRegistry.getTargetContext();
+//
+// assertEquals("com.hdl.sdk.hdl_sdk", appContext.getPackageName());
+// }
+//}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index f06eedd..e462c9a 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -45,10 +45,12 @@
<activity android:name=".activity.CtrlColourLightActivity" />
<activity android:name=".activity.CtrlAirHVACActivity" />
<activity android:name=".activity.CtrlAirTechSysActivity" />
+ <activity android:name=".activity.CtrlAirKNXTechSysActivity" />
<activity android:name=".activity.FreshAirActivity" />
<activity android:name=".activity.FreshAirJinMaoActivity" />
<activity android:name=".activity.GeothermalActivity" />
<activity android:name=".activity.DoorMachineActivity" />
+ <activity android:name=".activity.CtrlSceneActivity" />
<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 495b756..728c877 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/ttyS1"; //涓插彛璁惧璺緞鍚�
+ public static final String HDL_UART_PATH = "/dev/ttyS9"; //涓插彛璁惧璺緞鍚�
public static final int HDL_BAUDRATE = 115200; //娉㈢壒鐜�
@Override
@@ -28,7 +28,5 @@
HDLTtlSdk.init(this, HDL_UART_PATH, HDL_BAUDRATE);
//HDLTtlSdk.setHDLLogOpen(false);//閰嶇疆鏄惁寮�鍚疭DK鎵撳嵃鏃ュ織锛岄粯璁や负鎵撳紑
}
-
-
}
diff --git a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/AddDevicesManuallyActivity.java b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/AddDevicesManuallyActivity.java
index 461fe27..cfe6ca6 100644
--- a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/AddDevicesManuallyActivity.java
+++ b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/AddDevicesManuallyActivity.java
@@ -2,7 +2,6 @@
import android.os.Bundle;
-import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.view.View;
import android.widget.AdapterView;
@@ -13,6 +12,8 @@
import android.widget.Spinner;
import android.widget.TextView;
+import androidx.annotation.NonNull;
+
import com.afollestad.materialdialogs.DialogAction;
import com.afollestad.materialdialogs.MaterialDialog;
import com.hdl.sdk.ttl.Config.Configuration;
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 a955401..bf1b3af 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
@@ -4,14 +4,15 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView;
+
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
import com.hdl.sdk.ttl.Config.Configuration;
import com.hdl.sdk.ttl.HDLAppliances.Config.HDLApConfig;
@@ -147,6 +148,8 @@
intent.setClass(AppliancesListActivity.this, CtrlAirHVACActivity.class);
} else if (appliancesInfos.get(position).getDeviceType() == HDLApConfig.TYPE_AC_TECHSYS) {
intent.setClass(AppliancesListActivity.this, CtrlAirTechSysActivity.class);
+ } else if (appliancesInfos.get(position).getDeviceType() == HDLApConfig.TYPE_AC_KNXTECHSYS) {
+ intent.setClass(AppliancesListActivity.this, CtrlAirKNXTechSysActivity.class);
} else {
intent.setClass(AppliancesListActivity.this, CtrlAirActivity.class);
}
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 3e2a09d..acc6c9d 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
@@ -8,6 +8,7 @@
import android.widget.LinearLayout;
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.HDLCurtain.Parser.CurtainCtrlParser;
@@ -27,10 +28,13 @@
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
+
import java.util.List;
public class CtrlActivity extends BaseActivity {
- /**Topbar*/
+ /**
+ * Topbar
+ */
private RelativeLayout topBarBack;
private TextView topBarTitle;
private Button lightBtn, curtainBtn, curtainBtn2, curtainBtn3, curtainBtn4, curtainBtn5,
@@ -48,11 +52,9 @@
private int airSpeedState;
-
-
-
/**
* 瑕佹敞鍐屼娇鐢‥ventBus锛岃繖閲屽繀椤昏璁剧疆杩斿洖true
+ *
* @return true
*/
@Override
@@ -146,7 +148,7 @@
if (appliancesInfo.getCurState() != null) {
- int curLightState = HDLUtlis.getIntegerByObject(appliancesInfo.getCurState());
+ int curLightState = HDLUtlis.getIntegerByObject(appliancesInfo.getCurState());
lightText.setText("褰撳墠鐏厜浜害锛�" + curLightState);
lightBtn.setText("褰撳墠鐏厜浜害锛�" + curLightState);
@@ -165,6 +167,7 @@
case HDLApConfig.TYPE_CURTAIN_GLYSTRO:
case HDLApConfig.TYPE_CURTAIN_ROLLER:
case HDLApConfig.TYPE_CURTAIN_MODULE:
+ case HDLApConfig.TYPE_CURTAIN_SHANGRILA:
lightBtn.setVisibility(View.GONE);
logicBtn.setVisibility(View.GONE);
airDisplay.setVisibility(View.GONE);
@@ -183,7 +186,7 @@
if (appliancesInfo.getCurState() != null) {
String stringCurtainState = "";
- int curCurtainState = HDLUtlis.getIntegerByObject(appliancesInfo.getCurState());
+ int curCurtainState = HDLUtlis.getIntegerByObject(appliancesInfo.getCurState());
HDLLog.Log("curCurtainState = " + curCurtainState);
switch (curCurtainState) {
case CurtainCtrlParser.TYPE_STATE_PAUSE:
@@ -227,6 +230,7 @@
case HDLApConfig.TYPE_AC_HVAC:
case HDLApConfig.TYPE_AC_PANEL:
case HDLApConfig.TYPE_AC_TECHSYS:
+ case HDLApConfig.TYPE_AC_KNXTECHSYS:
lightBtn.setVisibility(View.GONE);
curtainBtn.setVisibility(View.GONE);
curtainBtn2.setVisibility(View.GONE);
@@ -417,6 +421,7 @@
case HDLApConfig.TYPE_SENSOR_FLOODING:
case HDLApConfig.TYPE_SENSOR_DOOR_MAGNET:
case HDLApConfig.TYPE_SENSOR_EMERGENCY_BUTTON:
+ case HDLApConfig.TYPE_SENSOR_PM_10:
lightBtn.setVisibility(View.GONE);
curtainBtn.setVisibility(View.GONE);
curtainBtn2.setVisibility(View.GONE);
@@ -482,36 +487,18 @@
}
break;
case HDLApConfig.TYPE_CURTAIN_GLYSTRO:
- //鍒ゆ柇鏄摢涓洖璺殑璁惧
- if (deviceStateBean.getChannelNum() == appliancesInfo.getChannelNum()) {
- appliancesInfo.setCurState(deviceStateBean.getCurState());
- }
- break;
case HDLApConfig.TYPE_CURTAIN_ROLLER:
- //鍒ゆ柇鏄摢涓洖璺殑璁惧
- if (deviceStateBean.getChannelNum() == appliancesInfo.getChannelNum()) {
- appliancesInfo.setCurState(deviceStateBean.getCurState());
- }
- break;
case HDLApConfig.TYPE_CURTAIN_MODULE:
+ case HDLApConfig.TYPE_CURTAIN_SHANGRILA:
//鍒ゆ柇鏄摢涓洖璺殑璁惧
if (deviceStateBean.getChannelNum() == appliancesInfo.getChannelNum()) {
appliancesInfo.setCurState(deviceStateBean.getCurState());
}
break;
case HDLApConfig.TYPE_AC_HVAC:
- //鍒ゆ柇鏄摢涓洖璺殑璁惧
- if (deviceStateBean.getChannelNum() == appliancesInfo.getChannelNum()) {
- appliancesInfo.setArrCurState(deviceStateBean.getArrCurState());
- }
- break;
case HDLApConfig.TYPE_AC_PANEL:
- //鍒ゆ柇鏄摢涓洖璺殑璁惧
- if (deviceStateBean.getChannelNum() == appliancesInfo.getChannelNum()) {
- appliancesInfo.setArrCurState(deviceStateBean.getArrCurState());
- }
- break;
case HDLApConfig.TYPE_AC_TECHSYS:
+ case HDLApConfig.TYPE_AC_KNXTECHSYS:
//鍒ゆ柇鏄摢涓洖璺殑璁惧
if (deviceStateBean.getChannelNum() == appliancesInfo.getChannelNum()) {
appliancesInfo.setArrCurState(deviceStateBean.getArrCurState());
@@ -539,7 +526,7 @@
@Override
public void onClick(View view) {
//绐楀笜妯″潡绗簩涓弬鏁� 涓篊urtainCtrlParser.curtainOn锛孋urtainCtrlParser.curtainOff锛孋urtainCtrlParser.curtainPause鍏朵腑涓�涓�
- HDLCommand.curtainCtrl(appliancesInfo, curtainState);
+ HDLCommand.curtainCtrl(appliancesInfo, curtainState, 0);
if (curtainState == CurtainCtrlParser.curtainOn) {
curtainState = CurtainCtrlParser.curtainOff;
} else {
@@ -552,28 +539,28 @@
curtainBtn2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- HDLCommand.curtainCtrl(appliancesInfo, CurtainCtrlParser.curtainOn);
+ HDLCommand.curtainCtrl(appliancesInfo, CurtainCtrlParser.curtainOn, 0);
}
});
curtainBtn3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- HDLCommand.curtainCtrl(appliancesInfo, CurtainCtrlParser.curtainOff);
+ HDLCommand.curtainCtrl(appliancesInfo, CurtainCtrlParser.curtainOff, 0);
}
});
curtainBtn4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- HDLCommand.curtainCtrl(appliancesInfo, CurtainCtrlParser.curtainPause);
+ HDLCommand.curtainCtrl(appliancesInfo, CurtainCtrlParser.curtainPause, 0);
}
});
curtainBtn5.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- HDLCommand.curtainCtrl(appliancesInfo, 50);
+ HDLCommand.curtainCtrl(appliancesInfo, 50, 0);
}
});
@@ -713,6 +700,7 @@
/**
* 鐏厜鎺у埗鍥炶皟Event
+ *
* @param event
*/
@Subscribe(threadMode = ThreadMode.MAIN)
@@ -737,13 +725,14 @@
String remarks = event.getLightCtrlBackInfo().getRemarks();//鑾峰彇杩斿洖鐨勭伅鍏夊娉ㄣ�傚鏋滄瘡涓伅鍏夊洖璺娉ㄩ兘鍞竴锛屽彲浠ョ洿鎺ラ�氳繃澶囨敞鍒ゆ柇
String parentRemarks = event.getLightCtrlBackInfo().getParentRemarks();//鑾峰彇缁х數鍣ㄦ垨璋冨厜鐏娉ㄣ�傝繖閲屽彲浠ョ煡閬撴槸鍝釜璁惧杩斿洖鐨�
int num = event.getLightCtrlBackInfo().getChannelNum();//鑾峰彇鍥炶矾鍙枫�傝繖閲屽彲浠ヨ幏鍙栧埌杩欎釜缁х數鍣ㄦ垨璋冨厜鐏殑鍥炶矾鍙�
- showToast("妯″潡锛�"+ parentRemarks + " 鐨� " + remarks + " 鍥炶矾锛屽洖璺彿涓猴細" + num + " 杩斿洖" + " 浜害涓猴細" + brightness);
+ showToast(remarks + " 鍥炶矾锛屽洖璺彿涓猴細" + num + " 杩斿洖" + " 浜害涓猴細" + brightness);
HDLLog.Log("褰撳墠浜害 = " + brightness);
}
}
/**
* 绐楀笜妯″潡鎺у埗鍥炶皟Event
+ *
* @param event
*/
@Subscribe(threadMode = ThreadMode.MAIN)
@@ -801,6 +790,7 @@
/**
* 绌鸿皟妯″潡鎺у埗鍥炶皟Event
+ *
* @param event
*/
@Subscribe(threadMode = ThreadMode.MAIN)
@@ -947,6 +937,7 @@
/**
* 閫昏緫妯″潡鎺у埗鍥炶皟Event
+ *
* @param event
*/
@Subscribe(threadMode = ThreadMode.MAIN)
@@ -966,6 +957,7 @@
/**
* 鑾峰彇鍗曚竴璁惧鐘舵�佸洖璋僂vent
+ *
* @param event
*/
@Subscribe(threadMode = ThreadMode.MAIN)
@@ -990,6 +982,7 @@
case HDLApConfig.TYPE_CURTAIN_GLYSTRO:
case HDLApConfig.TYPE_CURTAIN_ROLLER:
case HDLApConfig.TYPE_CURTAIN_MODULE:
+ case HDLApConfig.TYPE_CURTAIN_SHANGRILA:
if (appliancesInfo.getChannelNum() == event.getAppliancesInfo().getChannelNum()) {
if (!event.isSuccess()) {
showToast("鑾峰彇绐楀笜鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
@@ -1021,6 +1014,7 @@
case HDLApConfig.TYPE_AC_HVAC:
case HDLApConfig.TYPE_AC_PANEL:
case HDLApConfig.TYPE_AC_TECHSYS:
+ case HDLApConfig.TYPE_AC_KNXTECHSYS:
if (appliancesInfo.getChannelNum() == event.getAppliancesInfo().getChannelNum()) {
if (!event.isSuccess()) {
showToast("鑾峰彇绌鸿皟鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
@@ -1462,12 +1456,21 @@
showToast("浼犳劅鍣�---绱ф�ユ寜閽細" + emergencyButtonValue + emergencyButtonUnite);
HDLLog.Log("浼犳劅鍣�---绱ф�ユ寜閽細" + emergencyButtonValue + emergencyButtonUnite);
break;
+ case HDLApConfig.TYPE_SENSOR_PM_10:
+ //浼犳劅鍣� pm10
+ if (appliancesInfo.getChannelNum() != event.getAppliancesInfo().getChannelNum() || !event.isSuccess()) {
+ showToast("鑾峰彇浼犳劅鍣�---pm10鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
+ return;
+ }
+ float pm10Value = (float) event.getAppliancesInfo().getCurState();
+ String pm10ValueUnit = ((SensorStateBackInfo) event).getUnite();
+ showToast("浼犳劅鍣�---pm10锛�" + pm10Value + pm10ValueUnit);
+ HDLLog.Log("浼犳劅鍣�---pm10锛�" + pm10Value + pm10ValueUnit);
+ break;
}
}
}
-
-
}
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 583308b..25eedc5 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
@@ -276,6 +276,9 @@
case AirCtrlParser.airModeRefTem:
mStrState = "妯″紡锛氬埗鍐�";
break;
+ case AirCtrlParser.airModeHeatTem:
+ mStrState = "妯″紡锛氬埗鐑�";
+ break;
case AirCtrlParser.airModeVen:
mStrState = "妯″紡锛氶�氶";
break;
diff --git a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlAirKNXTechSysActivity.java b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlAirKNXTechSysActivity.java
new file mode 100644
index 0000000..be0c4b1
--- /dev/null
+++ b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlAirKNXTechSysActivity.java
@@ -0,0 +1,319 @@
+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.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 2024/5/28
+ * KNX绉戞妧甯屾鎺у埗椤甸潰
+ * 绉戞妧绯荤粺 灏忕被101
+ * 5~35鎽勬皬搴�(鈩�)
+ */
+public class CtrlAirKNXTechSysActivity extends BaseActivity {
+ /**
+ * Topbar
+ */
+ private RelativeLayout topBarBack;
+ private TextView topBarTitle;
+
+ private Button airBtnSwitch, airBtnMode, airBtnTemp;
+ private TextView airText, airHumidity;
+ 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_knxtechnology_system);
+ initToolbar();
+ initView();
+ initOnClick();
+ initcurState();
+ showStateView();
+
+ HDLCommand.getTechSysDeviceStateFromNetwork(appliancesInfo);
+ HDLCommand.getTechSysDeviceHumidityFromNetwork(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() {
+ airBtnSwitch = findViewById(R.id.airbtn_switch);
+ airBtnMode = findViewById(R.id.airbtn_mode);
+ airBtnTemp = findViewById(R.id.airbtn_tempBtn);
+ airTempEd = findViewById(R.id.airet_tempet);
+ airText = findViewById(R.id.airText);
+ airHumidity = findViewById(R.id.airText_humidity);
+ }
+
+ 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 < 5 || tempInt > 35) {
+ showToast("娓╁害璁剧疆鑼冨洿涓猴細5~35鎽勬皬搴�(鈩�)");
+ 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 = "KNX绉戞妧绯荤粺妯″潡锛氬叧闂�";
+ } else if (mAirTechSysBackInfo.getIsOn() == AirCtrlParser.airOn) {
+ stringState = "KNX绉戞妧绯荤粺妯″潡锛氭墦寮�";
+
+ 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("鏈幏鍙栧埌KNX绉戞妧绯荤粺妯″潡鐘舵��");
+ }
+ }
+
+
+ /**
+ * 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 = "KNX绉戞妧绯荤粺妯″潡锛氭墦寮�";
+ break;
+ case AirCtrlParser.airOff:
+ mStrState = "KNX绉戞妧绯荤粺妯″潡锛氬叧闂�";
+ 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);
+ HDLLog.Log("瀹ゅ唴婀垮害锛�" + mAirTechSysBackInfo.getIndoorHumidity());
+ }
+
+ /**
+ * 绉戞妧绯荤粺妯″潡鎺у埗鍥炶皟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("KNX绉戞妧绯荤粺鎺у埗瓒呮椂锛岃閲嶆柊鍐嶈瘯");
+ return;
+ }
+ AirTechSysBackInfo mAirTechSysBackInfo = event.getAirTechSysBackInfo();
+ showAirTechSysBackInfo(mAirTechSysBackInfo);
+ if (!TextUtils.isEmpty(mAirTechSysBackInfo.getIndoorHumidity())){
+ airHumidity.setText("瀹ゅ唴婀垮害锛�" + mAirTechSysBackInfo.getIndoorHumidity());
+ }
+ }
+ }
+
+ /**
+ * 鑾峰彇鍗曚竴璁惧鐘舵�佸洖璋僂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_KNXTECHSYS:
+ 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/CtrlCommonSwitchActivity.java b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlCommonSwitchActivity.java
index 4eb85ca..59c39e9 100644
--- a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlCommonSwitchActivity.java
+++ b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlCommonSwitchActivity.java
@@ -1,6 +1,5 @@
package com.hdl.sdk.ttl_sdk.activity;
-import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
@@ -12,7 +11,6 @@
import com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLCommand;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.CommonSwitchCtrlBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.CommonSwitchStateBackEvent;
-import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.LogicFeedBackEvent;
import com.hdl.sdk.ttl_sdk.R;
import com.hdl.sdk.ttl_sdk.base.BaseActivity;
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 648dc8d..3613bf8 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
@@ -2,15 +2,20 @@
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 android.widget.Toast;
import com.hdl.sdk.ttl.HDLAppliances.Config.HDLApConfig;
import com.hdl.sdk.ttl.HDLAppliances.HDLCurtain.Parser.CurtainCtrlParser;
import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
import com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLCommand;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.CurtainDeviceStateEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.CurtainFeedBackEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DeviceStateEvent;
import com.hdl.sdk.ttl_sdk.R;
@@ -28,14 +33,18 @@
* 绐楀笜绫绘ā鍧楁帶鍒堕〉闈�
*/
public class CtrlCurtainActivity extends BaseActivity {
- /**Topbar*/
+ /**
+ * Topbar
+ */
private RelativeLayout topBarBack;
private TextView topBarTitle;
- private Button curtainBtn, curtainBtn2, curtainBtn3, curtainBtn4, curtainBtn5;
+ private Button curtainBtn, curtainOpenBtn, curtainCloseBtn, curtainStopBtn, curtainPrecentBtn;
+ private Button curtainUp, curtainDown;
private TextView curText1, curText2;
private AppliancesInfo appliancesInfo;
private int curtainState;
private String showMessage;
+ private EditText etPrecent;
/**
* 澶嶅啓isRegisterEventBus() 瑕佹敞鍐屼娇鐢‥ventBus锛岃繖閲岃璁剧疆杩斿洖true
@@ -82,15 +91,26 @@
private void initView() {
curtainBtn = findViewById(R.id.curtainbtn);
- curtainBtn2 = findViewById(R.id.curtainbtn2);
- curtainBtn3 = findViewById(R.id.curtainbtn3);
- curtainBtn4 = findViewById(R.id.curtainbtn4);
- curtainBtn5 = findViewById(R.id.curtainbtn5);
+ curtainOpenBtn = findViewById(R.id.curtain_openbtn);
+ curtainCloseBtn = findViewById(R.id.curtain_closebtn);
+ curtainStopBtn = findViewById(R.id.curtain_stopbtn);
+ curtainPrecentBtn = findViewById(R.id.curtain_precentbtn);
curText1 = findViewById(R.id.curtainText1);
curText2 = findViewById(R.id.curtainText2);
+ curtainUp = findViewById(R.id.curtain_upbtn);
+ curtainDown = findViewById(R.id.curtain_downbtn);
+ etPrecent = findViewById(R.id.et_curtain_precent);
}
private void initOnClick() {
+ /*type锛�
+ 0= HDL 绐楀笜鎺у埗鐗堟湰V1.0(绐楀笜鍙�<17 0 = 鍋滄, 1 = 鎵撳紑, 2 = 鍏抽棴
+ 绐楀笜鍙�>=17 0-100%锛岃〃绀烘墦寮�鐧惧垎姣�)
+ 1=绐楀笜鎺у埗V1.1寮�鍏冲仠
+ 2=绐楀笜鎺у埗V1.1鐧惧垎姣�
+ 3=绐楀笜鎺у埗V1.1瑙掑害鍚戜笂
+ 4=绐楀笜鎺у埗V1.1瑙掑害鍚戜笅
+ 5=鐐瑰姩*/
curtainBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
@@ -100,36 +120,56 @@
} else {
curtainState = CurtainCtrlParser.curtainOn;
}
- HDLCommand.curtainCtrl(appliancesInfo, curtainState);
+ //绐楀笜妯″潡鐢╒1.0
+ HDLCommand.curtainCtrl(appliancesInfo, curtainState, 0);
}
});
- curtainBtn2.setOnClickListener(new View.OnClickListener() {
+ curtainOpenBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- HDLCommand.curtainCtrl(appliancesInfo, CurtainCtrlParser.curtainOn);
+ HDLCommand.curtainCtrl(appliancesInfo, CurtainCtrlParser.curtainOn, 1);
}
});
- curtainBtn3.setOnClickListener(new View.OnClickListener() {
+ curtainCloseBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- HDLCommand.curtainCtrl(appliancesInfo, CurtainCtrlParser.curtainOff);
+ HDLCommand.curtainCtrl(appliancesInfo, CurtainCtrlParser.curtainOff, 1);
}
});
- curtainBtn4.setOnClickListener(new View.OnClickListener() {
+ curtainStopBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- HDLCommand.curtainCtrl(appliancesInfo, CurtainCtrlParser.curtainPause);
+ HDLCommand.curtainCtrl(appliancesInfo, CurtainCtrlParser.curtainPause, 1);
}
});
- curtainBtn5.setOnClickListener(new View.OnClickListener() {
+ curtainPrecentBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- HDLCommand.curtainCtrl(appliancesInfo, 50);
+ if (TextUtils.isEmpty(etPrecent.getText().toString())) {
+ Toast.makeText(CtrlCurtainActivity.this, "璇疯緭鍏ラ渶瑕佹帶鍒剁殑绐楀笜鐧惧垎姣旓紒", Toast.LENGTH_SHORT).show();
+ return;
+ }
+
+ HDLCommand.curtainCtrl(appliancesInfo, Integer.parseInt(etPrecent.getText().toString()), 2);//50涓虹櫨鍒嗘瘮
+ }
+ });
+
+ curtainUp.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ HDLCommand.curtainCtrl(appliancesInfo, 0, 5);//涓婄偣鍔�0x00锛宻tate鍥哄畾涓�0
+ }
+ });
+
+ curtainDown.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ HDLCommand.curtainCtrl(appliancesInfo, 128, 5);//涓婄偣鍔�0x80锛宻tate鍥哄畾涓�128
}
});
}
@@ -138,10 +178,12 @@
if (appliancesInfo.getDeviceType() == HDLApConfig.TYPE_CURTAIN_MODULE) {
//绐楀笜妯″潡
curText2.setVisibility(View.GONE);
- curtainBtn2.setVisibility(View.GONE);
- curtainBtn3.setVisibility(View.GONE);
- curtainBtn4.setVisibility(View.GONE);
- curtainBtn5.setVisibility(View.GONE);
+ curtainOpenBtn.setVisibility(View.GONE);
+ curtainCloseBtn.setVisibility(View.GONE);
+ curtainStopBtn.setVisibility(View.GONE);
+ curtainPrecentBtn.setVisibility(View.GONE);
+ curtainUp.setVisibility(View.GONE);
+ curtainDown.setVisibility(View.GONE);
if (appliancesInfo.getCurState() != null) {
String stringCurtainState = "";
@@ -179,6 +221,17 @@
//寮�鍚堝笜銆佸嵎甯�
curText1.setVisibility(View.GONE);
curtainBtn.setVisibility(View.GONE);
+ curtainUp.setVisibility(View.GONE);
+ curtainDown.setVisibility(View.GONE);
+ if (appliancesInfo.getCurState() != null) {
+ curText2.setText("褰撳墠绐楀笜鐘舵�侊細" + HDLUtlis.getIntegerByObject(appliancesInfo.getCurState()));
+ } else {
+ curText2.setText("鏈幏鍙栧埌绐楀笜妯″潡鐘舵��");
+ }
+ } else if (appliancesInfo.getDeviceType() == HDLApConfig.TYPE_CURTAIN_SHANGRILA) {
+ //棣欐牸閲屾媺甯�
+ curText1.setVisibility(View.GONE);
+ curtainBtn.setVisibility(View.GONE);
if (appliancesInfo.getCurState() != null) {
curText2.setText("褰撳墠绐楀笜鐘舵�侊細" + HDLUtlis.getIntegerByObject(appliancesInfo.getCurState()));
} else {
@@ -202,11 +255,9 @@
@Subscribe(threadMode = ThreadMode.MAIN)
public void onCurtainFeedBackInfoEventMain(CurtainFeedBackEvent event) {
// 鍏堝垽鏂槸鍚﹁秴鏃�
- HDLLog.Log("onCurtainFeedBackInfoEventMain in");
if (event.getCurtainCtrlBackInfo().getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
&& event.getCurtainCtrlBackInfo().getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
- && event.getCurtainCtrlBackInfo().getNum() == appliancesInfo.getChannelNum()
- ) {
+ && event.getCurtainCtrlBackInfo().getNum() == appliancesInfo.getChannelNum()) {
if (!event.isSuccess()) {
showToast("绐楀笜鎺у埗瓒呮椂锛岃閲嶆柊鍐嶈瘯");
@@ -214,15 +265,15 @@
}
int curState = event.getCurtainCtrlBackInfo().getState();
+ int precent = event.getCurtainCtrlBackInfo().getPrecent();
//绐楀笜妯″潡锛歝urState:0=鍋滄,1=鎵撳紑,2=鍏抽棴銆�
- //寮�鍚堝笜鐢垫満锛屽嵎甯樼數鏈猴細curState:1-100寮�鍚堝害銆備篃浼氳繑鍥�0锛�1锛�2鐨勭姸鎬�
+ //寮�鍚堝笜鐢垫満锛屽嵎甯樼數鏈�,棣欐牸閲屾媺甯橈細curState:1-100寮�鍚堝害銆備篃浼氳繑鍥�0锛�1锛�2鐨勭姸鎬�
+ // precent:1-100寮�鍚堝害
//寤鸿寮�鍚堝笜鐢垫満锛屽嵎甯樼數鏈烘寜鍋滄鍚庡啀璇诲彇褰撳墠鐘舵�佹潵鑾峰彇褰撳墠鐘舵�佸��
String remarks = event.getCurtainCtrlBackInfo().getRemarks();
- String parentRemarks = event.getCurtainCtrlBackInfo().getParentRemarks();
int num = event.getCurtainCtrlBackInfo().getNum();
-// showToast(parentRemarks+" 鐨� "+remarks+" 鍥炶矾鍙凤細"+num+" 杩斿洖"+" 鐘舵�佷负锛�"+curState);
- HDLLog.Log(parentRemarks + " 鐨� " + remarks + " 鍥炶矾鍙凤細" + num + " 杩斿洖" + " 鐘舵�佷负锛�" + curState);
+ HDLLog.Log(remarks + " 鍥炶矾鍙凤細" + num + " 杩斿洖" + " 鐘舵�佷负锛�" + curState);
if (event.getCurtainCtrlBackInfo().getAppliancesInfo().getDeviceType() == HDLApConfig.TYPE_CURTAIN_MODULE) {
showMessage = "";
//鍒ゆ柇鏄惁涓虹獥甯樻ā鍧�
@@ -251,14 +302,76 @@
}
showToast(showMessage);
} else {
- //寮�鍚堝笜鎴栧嵎甯� 鏄剧ず鐧惧垎姣�
-// curtainBtn5.setText("绐楀笜寮�鍒�" + curState + "%");
- curText2.setText("绐楀笜寮�鍒�" + curState + "%");
- curtainState = curState;
+ //鏂板崗璁紝type=2涓虹櫨鍒嗘瘮
+ if (event.getCurtainCtrlBackInfo().getType() == 2) {
+ //寮�鍚堝笜鎴栧嵎甯� 鏄剧ず鐧惧垎姣�
+ curText2.setText("绐楀笜寮�鍒�" + precent + "%");
+ curtainState = precent;
+ } else if (event.getCurtainCtrlBackInfo().getType() == 0) {
+ //寮�鍚堝笜鎴栧嵎甯� 鏄剧ず鐧惧垎姣�
+ curText2.setText("绐楀笜寮�鍒�" + curState + "%");
+ curtainState = curState;
+ } else {
+ //寮�鍚堝笜鎴栧嵎甯� 鏄剧ず鐧惧垎姣�
+ curText2.setText("绐楀笜寮�鍒�" + curState + "%");
+ curtainState = curState;
+ }
}
}
+ }
+
+ /**
+ * 绐楀笜鏂板崗璁姸鎬佽鍙栧洖璋僂vent
+ *
+ * @param event
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onCurtainDeviceStateEventMain(CurtainDeviceStateEvent event) {
+ if (event.getCurtainCtrlBackInfo().getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
+ && event.getCurtainCtrlBackInfo().getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
+ && event.getCurtainCtrlBackInfo().getAppliancesInfo().getChannelNum() == appliancesInfo.getChannelNum()) {
+
+ if (!event.isSuccess()) {
+ showToast("鑾峰彇绐楀笜鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
+ return;
+ }
+
+ int curState = event.getCurtainCtrlBackInfo().getState();
+ int curPrecent = event.getCurtainCtrlBackInfo().getPrecent();
+ //绐楀笜妯″潡锛歝urState:0=鍋滄,1=鎵撳紑,2=鍏抽棴銆�
+ //寮�鍚堝笜鐢垫満锛屽嵎甯樼數鏈�,棣欐牸閲屾媺甯橈細curState:1-100寮�鍚堝害銆備篃浼氳繑鍥�0锛�1锛�2鐨勭姸鎬�
+ // precent:1-100寮�鍚堝害
+ //寤鸿寮�鍚堝笜鐢垫満锛屽嵎甯樼數鏈烘寜鍋滄鍚庡啀璇诲彇褰撳墠鐘舵�佹潵鑾峰彇褰撳墠鐘舵�佸��
+
+ String remarks = event.getCurtainCtrlBackInfo().getRemarks();
+ int num = event.getCurtainCtrlBackInfo().getNum();
+ HDLLog.Log(remarks + " 鍥炶矾鍙凤細" + num + " 杩斿洖" + " 鐘舵�佷负锛�" + curState);
+
+ switch (event.getCurtainCtrlBackInfo().getAppliancesInfo().getDeviceType()) {
+ case HDLApConfig.TYPE_CURTAIN_GLYSTRO:
+ case HDLApConfig.TYPE_CURTAIN_ROLLER:
+ case HDLApConfig.TYPE_CURTAIN_SHANGRILA:
+ if (event.getCurtainCtrlBackInfo().getType() == 2) {//鏂板崗璁紝type=2涓虹櫨鍒嗘瘮
+ //寮�鍚堝笜鎴栧嵎甯� 鏄剧ず鐧惧垎姣�
+ int precent = event.getCurtainCtrlBackInfo().getPrecent();
+ showMessage = "绐楀笜寮�鍒�" + precent + "%";
+ curText2.setText(showMessage);
+ showToast("鑾峰彇鎴愬姛锛�" + showMessage);
+ } else if (event.getCurtainCtrlBackInfo().getType() == 0) {//鏃у崗璁紝type=0涓虹櫨鍒嗘瘮
+ //寮�鍚堝笜鎴栧嵎甯� 鏄剧ず鐧惧垎姣�
+ int state = event.getCurtainCtrlBackInfo().getState();
+ showMessage = "绐楀笜寮�鍒�" + state + "%";
+ curText2.setText(showMessage);
+ showToast("鑾峰彇鎴愬姛锛�" + showMessage);
+ }
+
+ break;
+ default:
+ break;
+ }
+ }
}
/**
@@ -276,6 +389,7 @@
case HDLApConfig.TYPE_CURTAIN_GLYSTRO:
case HDLApConfig.TYPE_CURTAIN_ROLLER:
case HDLApConfig.TYPE_CURTAIN_MODULE:
+ case HDLApConfig.TYPE_CURTAIN_SHANGRILA:
if (appliancesInfo.getChannelNum() == event.getAppliancesInfo().getChannelNum()) {
if (!event.isSuccess()) {
showToast("鑾峰彇绐楀笜鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
@@ -308,7 +422,7 @@
}
} else {
showMessage = "绐楀笜寮�鍒�" + curState + "%";
-// curtainBtn5.setText(showMessage);
+ curText2.setText(showMessage);
curtainState = curState;
}
@@ -316,7 +430,6 @@
}
break;
default:
- //涓嶅鐞�
break;
}
}
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 22d41ae..c2f772c 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
@@ -183,7 +183,7 @@
String remarks = event.getLightCtrlBackInfo().getRemarks();//鑾峰彇杩斿洖鐨勭伅鍏夊娉ㄣ�傚鏋滄瘡涓伅鍏夊洖璺娉ㄩ兘鍞竴锛屽彲浠ョ洿鎺ラ�氳繃澶囨敞鍒ゆ柇
String parentRemarks = event.getLightCtrlBackInfo().getParentRemarks();//鑾峰彇缁х數鍣ㄦ垨璋冨厜鐏娉ㄣ�傝繖閲屽彲浠ョ煡閬撴槸鍝釜璁惧杩斿洖鐨�
int num = event.getLightCtrlBackInfo().getChannelNum();//鑾峰彇鍥炶矾鍙枫�傝繖閲屽彲浠ヨ幏鍙栧埌杩欎釜缁х數鍣ㄦ垨璋冨厜鐏殑鍥炶矾鍙�
- showToast("妯″潡锛�" + parentRemarks + " 鐨� " + remarks + " 鍥炶矾锛屽洖璺彿涓猴細" + num + " 杩斿洖" + " 浜害涓猴細" + brightness);
+ showToast(remarks + " 鍥炶矾锛屽洖璺彿涓猴細" + num + " 杩斿洖" + " 浜害涓猴細" + brightness);
HDLLog.Log("褰撳墠浜害 = " + brightness);
}
}
diff --git a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlSceneActivity.java b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlSceneActivity.java
new file mode 100644
index 0000000..ff3e6db
--- /dev/null
+++ b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/CtrlSceneActivity.java
@@ -0,0 +1,193 @@
+package com.hdl.sdk.ttl_sdk.activity;
+
+
+import android.app.ProgressDialog;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.view.View;
+import android.widget.Button;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+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.Bean.ScenesData;
+import com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLCommand;
+import com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLDeviceManager;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DevicesInfoEvent;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.LogicFeedBackEvent;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.SceneFeedBackEvent;
+import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.ScenesInfoEvent;
+import com.hdl.sdk.ttl.Utils.LogUtils.HDLLog;
+import com.hdl.sdk.ttl_sdk.R;
+import com.hdl.sdk.ttl_sdk.adapter.HDLMainListAdapter;
+import com.hdl.sdk.ttl_sdk.adapter.HDLSceneListAdapter;
+import com.hdl.sdk.ttl_sdk.base.BaseActivity;
+
+import org.greenrobot.eventbus.Subscribe;
+import org.greenrobot.eventbus.ThreadMode;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by panlili on 2024/01/19
+ * 鍦烘櫙鎺у埗椤甸潰
+ */
+public class CtrlSceneActivity extends BaseActivity {
+ /**
+ * Topbar
+ */
+ private RelativeLayout topBarBack;
+ private TextView topBarTitle;
+ private Button btnSearch;
+ private RecyclerView mRecyclerView;
+ private TextView tvResult;
+
+ private List<ScenesData> mScenesDataList = new ArrayList<>();
+ private ScenesData scenesData;
+ private HDLSceneListAdapter hdlSceneListAdapter;
+ private String subnetID, deviceID;
+ private ProgressDialog mProgressDialog;
+
+ public static void open(Context mContext, String subnetID, String deviceID) {
+ Intent intent = new Intent(mContext, CtrlSceneActivity.class);
+ intent.putExtra("subnetID", subnetID);
+ intent.putExtra("deviceID", deviceID);
+ mContext.startActivity(intent);
+ }
+
+ /**
+ * 澶嶅啓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_scene);
+
+ subnetID = getIntent().getStringExtra("subnetID");
+ deviceID = getIntent().getStringExtra("deviceID");
+ initToolbar();
+ initView();
+ }
+
+ /**
+ * 鍒濆鍖朤oolbar
+ */
+ private void initToolbar() {
+ topBarBack = findViewById(R.id.ll_top_b_left);
+ setViewVisible(topBarBack);
+ topBarTitle = findViewById(R.id.tv_top_b_header_title);
+ topBarTitle.setText("鍦烘櫙");
+ topBarBack.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ finish();
+ }
+ });
+ }
+
+ private void initView() {
+ btnSearch = findViewById(R.id.btn_search);
+ btnSearch.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (TextUtils.isEmpty(subnetID) || TextUtils.isEmpty(deviceID)) {
+ Toast.makeText(CtrlSceneActivity.this, "璇疯緭鍏ョ綉鍏崇殑瀛愮綉鍙疯澶囧彿锛�", Toast.LENGTH_SHORT).show();
+ return;
+ }
+ /**鍏ㄩ儴閲嶆柊鎼滅储,娓呯┖鍘熷満鏅垪琛ㄦ暟鎹�*/
+ clearListView();
+
+ HDLCommand.getHomeScenes(Integer.parseInt(subnetID), Integer.parseInt(deviceID));
+ mProgressDialog.show();
+ }
+ });
+
+ tvResult = findViewById(R.id.tv_scene);
+
+ mRecyclerView = findViewById(R.id.listView_scenes);
+ // 瀹氫箟涓�涓嚎鎬у竷灞�绠$悊鍣�
+ LinearLayoutManager manager = new LinearLayoutManager(this);
+ // 璁剧疆甯冨眬绠$悊鍣�
+ mRecyclerView.setLayoutManager(manager);
+ // 璁剧疆adapter
+ hdlSceneListAdapter = new HDLSceneListAdapter(this, mScenesDataList);
+ mRecyclerView.setAdapter(hdlSceneListAdapter);
+
+ hdlSceneListAdapter.setOnItemClickLitener(new HDLSceneListAdapter.OnItemClickLitener() {
+ @Override
+ public void onItemClick(int position) {
+ //鎵ц鍦烘櫙
+ scenesData = mScenesDataList.get(position);
+ HDLCommand.sceneCtrl(scenesData);
+ }
+ });
+
+ mProgressDialog = new ProgressDialog(CtrlSceneActivity.this);
+ mProgressDialog.setTitle("姝e湪鑾峰彇鏁版嵁...");
+ mProgressDialog.setMessage("璇疯�愬績绛夊緟");
+ mProgressDialog.onStart();
+
+ }
+
+ /**
+ * 娓呯┖鏁版嵁骞跺埛鏂板垪琛�
+ */
+ private void clearListView() {
+ if (mScenesDataList != null) mScenesDataList.clear();
+
+ hdlSceneListAdapter.notifyDataSetChanged();
+ }
+
+ /**
+ * ====================EventBus 璁㈤槄浜嬩欢 ====================
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onScenesInfoEventMain(ScenesInfoEvent event) {
+ mProgressDialog.dismiss();
+ if (!event.isSuccess()) {
+ Toast.makeText(CtrlSceneActivity.this, "鎼滅储瓒呮椂锛岃閲嶆柊鍐嶈瘯", Toast.LENGTH_SHORT).show();
+ tvResult.setText("鎼滅储瓒呮椂锛岃閲嶆柊鍐嶈瘯");
+ return;
+ }
+ mScenesDataList = event.getDesSceneList();
+ HDLLog.I("onScenesInfoEventMain size=" + mScenesDataList.size());
+ hdlSceneListAdapter.setData(mScenesDataList);
+ hdlSceneListAdapter.notifyDataSetChanged();
+ }
+
+ /**
+ * 鍦烘櫙鎺у埗鍥炶皟Event
+ *
+ * @param event
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onSceneFeedBackEventMain(SceneFeedBackEvent event) {
+// 鍏堝垽鏂槸鍚﹁秴鏃�
+ if (event.getSceneCtrlBackInfo().getAreaCodeID() == scenesData.getAreaCodeID()
+ && event.getSceneCtrlBackInfo().getSceneID() == scenesData.getSceneID()) {
+ if (!event.isSuccess()) {
+ showToast("鍦烘櫙鎺у埗瓒呮椂锛岃閲嶆柊鍐嶈瘯");
+ return;
+ }
+ showToast("鍦烘櫙鎺у埗鎴愬姛");
+ }
+ }
+
+
+}
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 9a573b4..59fe73f 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
@@ -1,13 +1,14 @@
package com.hdl.sdk.ttl_sdk.activity;
+import static com.hdl.sdk.ttl_sdk.HDLApplication.HDL_BAUDRATE;
+import static com.hdl.sdk.ttl_sdk.HDLApplication.HDL_UART_PATH;
+
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
@@ -15,25 +16,22 @@
import android.widget.TextView;
import android.widget.Toast;
-import com.hdl.sdk.ttl.Config.Configuration;
-import com.hdl.sdk.ttl.HDLAppliances.Config.HDLApConfig;
-import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
import com.hdl.sdk.ttl.HDLDeviceManger.Bean.DevicesData;
import com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLCommand;
import com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLDeviceManager;
import com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLSerialPortCore;
import com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLTtlSdk;
-import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.BgmInfoEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DevicesInfoEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.DiscoverNewDevicesEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.UpdateRemarkFeedBackEvent;
-import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.ThirdPartyBgmInfoEvent;
import com.hdl.sdk.ttl.HDLDeviceManger.EventBusEvent.WarningInfoEvent;
import com.hdl.sdk.ttl.Utils.HDLUtlis.HDLStringUtils;
import com.hdl.sdk.ttl_sdk.R;
import com.hdl.sdk.ttl_sdk.adapter.HDLMainListAdapter;
import com.hdl.sdk.ttl_sdk.base.BaseActivity;
-//import com.hdl.sdk.ttl_sdk.bean.ZigbeeActivity2;
import com.hdl.sdk.ttl_sdk.utlis.HDLLog;
import com.hdl.sdk.ttl_sdk.utlis.HDLWarningType;
@@ -44,9 +42,6 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-
-import static com.hdl.sdk.ttl_sdk.HDLApplication.HDL_BAUDRATE;
-import static com.hdl.sdk.ttl_sdk.HDLApplication.HDL_UART_PATH;
/**
* Modify by JLChen on 2019/6/27
@@ -72,7 +67,10 @@
// private RelativeLayout topBarBack;
private TextView topBarTitle;
private TextView tvVersion;
+ private EditText etGatewaySubID;
+ private EditText etGatewaydeviceID;
private Button btnSearch;
+ private Button btnSearchScene;
private Button btnGetLocal;
private Button btnClose;
private Button btnOpen;
@@ -123,7 +121,10 @@
private void initView() {
topBarTitle = findViewById(R.id.tv_top_b_header_title);
tvVersion = findViewById(R.id.tv_version);
+ etGatewaySubID = findViewById(R.id.et_gateway_subID);
+ etGatewaydeviceID = findViewById(R.id.et_gateway_deviceID);
btnSearch = findViewById(R.id.btn_search);
+ btnSearchScene = findViewById(R.id.btn_searchScene);
btnGetLocal = findViewById(R.id.btn_getlocal);
btnClose = findViewById(R.id.btn_close);
btnOpen = findViewById(R.id.btn_open);
@@ -186,11 +187,22 @@
btnSearch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
+ if (TextUtils.isEmpty(etGatewaySubID.getText().toString()) || TextUtils.isEmpty(etGatewaydeviceID.getText().toString())) {
+ Toast.makeText(MainActivity.this, "璇疯緭鍏ョ綉鍏崇殑瀛愮綉鍙疯澶囧彿锛�", Toast.LENGTH_SHORT).show();
+ return;
+ }
/**鍏ㄩ儴閲嶆柊鎼滅储,娓呯┖鍘熻澶囧垪琛ㄦ暟鎹�*/
clearListView();
HDLDeviceManager.clearAllDeviceList();
- HDLCommand.getHomeDevices();
+ HDLCommand.getHomeDevices(Integer.parseInt(etGatewaySubID.getText().toString()), Integer.parseInt(etGatewaydeviceID.getText().toString()));
mProgressDialog.show();
+ }
+ });
+
+ btnSearchScene.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ CtrlSceneActivity.open(MainActivity.this, etGatewaySubID.getText().toString(), etGatewaydeviceID.getText().toString());
}
});
@@ -340,9 +352,9 @@
for (int i = 0; i < mDevicesDataList.size(); i++) {
if (TextUtils.isEmpty(mDevicesDataList.get(i).getRemark())) {
- mAllDevicesList.add("鏆傛棤澶囨敞" + "-" + mDevicesDataList.get(i).getSourceSubnetID() + "-" + mDevicesDataList.get(i).getSourceDeviceID());
+ mAllDevicesList.add("妯″潡瀛愮綉璁惧鍙�" + "锛�" + mDevicesDataList.get(i).getDeviceSubnetID() + "-" + mDevicesDataList.get(i).getDeviceDeviceID());
} else {
- mAllDevicesList.add(mDevicesDataList.get(i).getRemark() + "-" + mDevicesDataList.get(i).getSourceSubnetID() + "-" + mDevicesDataList.get(i).getSourceDeviceID());
+ mAllDevicesList.add(mDevicesDataList.get(i).getRemark() + "锛�" + mDevicesDataList.get(i).getDeviceSubnetID() + "-" + mDevicesDataList.get(i).getDeviceDeviceID());
}
}
mHDLMainListAdapter.notifyDataSetChanged();
diff --git a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/SendTestActivity.java b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/SendTestActivity.java
index 74dd686..5118c56 100644
--- a/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/SendTestActivity.java
+++ b/app/src/main/java/com/hdl/sdk/ttl_sdk/activity/SendTestActivity.java
@@ -1,9 +1,11 @@
package com.hdl.sdk.ttl_sdk.activity;
+import static com.hdl.sdk.ttl.Config.Configuration.LIGHT_CTRL_COMMAND;
+import static com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLCommand.cusSendCommand;
+
+import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
-import android.support.v7.app.AppCompatActivity;
-import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
@@ -11,18 +13,9 @@
import android.widget.RelativeLayout;
import android.widget.TextView;
-import com.hdl.sdk.ttl.HDLDeviceManger.Bean.RemarkTimes;
-import com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLSerialPortCore;
-import com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLTtlSdk;
import com.hdl.sdk.ttl.Utils.LogUtils.HDLLog;
-import com.hdl.sdk.ttl.Utils.SPUtils.SPUtils;
import com.hdl.sdk.ttl_sdk.R;
import com.hdl.sdk.ttl_sdk.base.BaseActivity;
-
-import java.io.IOException;
-
-import static com.hdl.sdk.ttl.Config.Configuration.LIGHT_CTRL_COMMAND;
-import static com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLCommand.cusSendCommand;
public class SendTestActivity extends BaseActivity {
/**Topbar*/
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 7be74e8..2ff34b2 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
@@ -5,12 +5,12 @@
import android.text.TextUtils;
import android.util.Log;
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.HDLSensor.DryContactSensorBackEvent;
+import com.hdl.sdk.ttl.HDLAppliances.HDLSensor.SensorStateBackInfo;
import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
import com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLCommand;
import com.hdl.sdk.ttl_sdk.R;
@@ -28,7 +28,9 @@
private RelativeLayout topBarBack;
private TextView topBarTitle;
private TextView sensorText;
+ private TextView sensorStatusText;
private AppliancesInfo appliancesInfo;
+ private String showMessage;
/**
@@ -51,7 +53,9 @@
displayStateView();
Log.d("panlili", "SensorActivity.java:appliancesInfo-----> " + appliancesInfo.toString());
- //浼犳劅鍣ㄦ棤鐘舵�佽幏鍙栵紝鍙兘瑙﹀彂浜嬩欢涓婃姤
+ //瀹夐槻浼犳劅鍣ㄦ棤鐘舵�佽幏鍙栵紝鍙兘瑙﹀彂浜嬩欢涓婃姤
+ //鐜浼犳劅鍣ㄨ幏鍙栫姸鎬�
+ HDLCommand.getSensorStateFromNetwork(appliancesInfo);
}
/**
@@ -85,17 +89,26 @@
private void initView() {
sensorText = findViewById(R.id.sensorText);
+ sensorStatusText = findViewById(R.id.sensorStatusText);
}
private void displayStateView() {
switch (appliancesInfo.getDeviceType()) {
case HDLApConfig.TYPE_SENSOR_MOVEMENT_DETECTOR: //绾㈠鎰熷簲浼犳劅鍣�
- case HDLApConfig.TYPE_SENSOR_CO_H2: //鐓ゆ皵浼犳劅鍣�
+ case HDLApConfig.TYPE_SENSOR_LPG: //鐓ゆ皵浼犳劅鍣� 娑插寲鐭虫补姘�
+ case HDLApConfig.TYPE_SENSOR_CO_H2: //鐓ゆ皵浼犳劅鍣� 浜哄伐鐓ゆ皵锛圕O锛孒2锛�
+ case HDLApConfig.TYPE_SENSOR_CH4: //鐓ゆ皵浼犳劅鍣� 澶╃劧姘旓紙CH4)
case HDLApConfig.TYPE_SENSOR_SMOG: //鐑熼浘浼犳劅鍣�
case HDLApConfig.TYPE_SENSOR_FLOODING: //姘存蹈浼犳劅鍣�
case HDLApConfig.TYPE_SENSOR_DOOR_MAGNET: //闂ㄧ浼犳劅鍣�
case HDLApConfig.TYPE_SENSOR_EMERGENCY_BUTTON://绱ф�ユ寜閽�
+ case HDLApConfig.TYPE_SENSOR_TEMP://娓╁害
+ case HDLApConfig.TYPE_SENSOR_HUMIDITY://婀垮害
+ case HDLApConfig.TYPE_SENSOR_VOC://VOC
+ case HDLApConfig.TYPE_SENSOR_PM_2_POINT_5://PM2.5
+ case HDLApConfig.TYPE_SENSOR_C02://C02
+ case HDLApConfig.TYPE_SENSOR_PM_10://PM10
break;
default:
finish();//璁惧绫诲瀷涓嶅缁撴潫椤甸潰
@@ -133,337 +146,110 @@
mData = event.getState() == 0 ? "姝e父" : "鎶ヨ";
}
+ sensorText.setVisibility(View.VISIBLE);
+ sensorStatusText.setVisibility(View.GONE);
sensorText.setText("浼犳劅鍣ㄧ姸鎬侊細" + mData);
HDLLog.Log("浼犳劅鍣ㄧ姸鎬侊細" + mData);
}
}
-// /**
-// * 浼犳劅鍣ㄧ姸鎬佸洖璋� Event
-// *
-// * @param event
-// */
-// @Subscribe(threadMode = ThreadMode.MAIN)
-// public void onSensorStateBackInfoMain(SensorStateBackInfo event) {
-// if (event.getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
-// && event.getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
-// && event.getAppliancesInfo().getChannelNum() == appliancesInfo.getChannelNum()
-// ) {
-// //杩欎釜杩斿洖鐨勪俊鎭槸褰撳墠鐘舵�佺殑
-// switch (event.getAppliancesInfo().getDeviceType()) {
-// case HDLApConfig.TYPE_SENSOR_DRY_CONTACT://2019-07-03 灞忚斀
-// //浼犳劅鍣� 骞叉帴鐐� 銆傚彧鏈夊紑鍏崇姸鎬�
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---骞叉帴鐐圭姸鎬佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float dryContactValue = (float) event.getAppliancesInfo().getCurState();
-// String dryContactUnit = ((SensorStateBackInfo) event).getUnite();
-// showToast("浼犳劅鍣�---骞叉帴鐐圭姸鎬侊細" + dryContactValue + dryContactUnit);
-// HDLLog.Log("浼犳劅鍣�---骞叉帴鐐圭姸鎬侊細" + dryContactValue + dryContactUnit);
-// break;
-// case HDLApConfig.TYPE_SENSOR_MOVEMENT_DETECTOR:
-// //浼犳劅鍣� 绉诲姩鎺㈡祴 銆傜伒鏁忓害
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---绉诲姩鎺㈡祴鐏垫晱搴︾姸鎬佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float mdValue = (float) event.getAppliancesInfo().getCurState();
-// String mdValueUnit = ((SensorStateBackInfo) event).getUnite();
-// showToast("浼犳劅鍣�---绉诲姩鎺㈡祴鐏垫晱搴︼細" + mdValue + mdValueUnit);
-// HDLLog.Log("浼犳劅鍣�---绉诲姩鎺㈡祴鐏垫晱搴︼細" + mdValue + mdValueUnit);
-// break;
-// case HDLApConfig.TYPE_SENSOR_TEMP:
-// //浼犳劅鍣� 娓╁害
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---娓╁害鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float tempValue = (float) event.getAppliancesInfo().getCurState();
-// String tempValueUnit = ((SensorStateBackInfo) event).getUnite();
-// showToast("浼犳劅鍣�---娓╁害锛�" + tempValue + tempValueUnit);
-// HDLLog.Log("浼犳劅鍣�---娓╁害锛�" + tempValue + tempValueUnit);
-// break;
-// case HDLApConfig.TYPE_SENSOR_HUMIDITY:
-// //浼犳劅鍣� 婀垮害
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---婀垮害鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float humidityValue = (float) event.getAppliancesInfo().getCurState();
-// String humidityValueUnit = ((SensorStateBackInfo) event).getUnite();
-// showToast("浼犳劅鍣�---婀垮害锛�" + humidityValue + humidityValueUnit);
-// HDLLog.Log("浼犳劅鍣�---婀垮害锛�" + humidityValue + humidityValueUnit);
-// break;
-// case HDLApConfig.TYPE_SENSOR_ILLUMINACE:
-// //浼犳劅鍣� 鐓у害
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---鐓у害鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float illuminaceValue = (float) event.getAppliancesInfo().getCurState();
-// String illuminaceValueUnit = ((SensorStateBackInfo) event).getUnite();
-// showToast("浼犳劅鍣�---鐓у害锛�" + illuminaceValue + illuminaceValueUnit);
-// HDLLog.Log("浼犳劅鍣�---鐓у害锛�" + illuminaceValue + illuminaceValueUnit);
-// break;
-// case HDLApConfig.TYPE_SENSOR_VOC:
-// //浼犳劅鍣� 褰撳墠绌烘皵璐ㄩ噺绛夌骇
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---褰撳墠绌烘皵璐ㄩ噺绛夌骇鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float vocValue = (float) event.getAppliancesInfo().getCurState();
-// String vocValueUnit = ((SensorStateBackInfo) event).getUnite();
-// showToast("浼犳劅鍣�---褰撳墠绌烘皵璐ㄩ噺绛夌骇锛�" + vocValue + vocValueUnit);
-// HDLLog.Log("浼犳劅鍣�---褰撳墠绌烘皵璐ㄩ噺绛夌骇锛�" + vocValue + vocValueUnit);
-// break;
-// case HDLApConfig.TYPE_SENSOR_PM_2_POINT_5:
-// //浼犳劅鍣� pm2.5
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---pm2.5鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float pm2_5Value = (float) event.getAppliancesInfo().getCurState();
-// String pm2_5ValueUnit = ((SensorStateBackInfo) event).getUnite();
-// showToast("浼犳劅鍣�---pm2.5锛�" + pm2_5Value + pm2_5ValueUnit);
-// HDLLog.Log("浼犳劅鍣�---pm2.5锛�" + pm2_5Value + pm2_5ValueUnit);
-// break;
-// case HDLApConfig.TYPE_SENSOR_C02:
-// //浼犳劅鍣� 浜屾哀鍖栫⒊
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---浜屾哀鍖栫⒊鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float co2Value = (float) event.getAppliancesInfo().getCurState();
-// String co2ValueUnit = ((SensorStateBackInfo) event).getUnite();
-// showToast("浼犳劅鍣�---浜屾哀鍖栫⒊锛�" + co2Value + co2ValueUnit);
-// HDLLog.Log("浼犳劅鍣�---浜屾哀鍖栫⒊锛�" + co2Value + co2ValueUnit);
-// break;
-// case HDLApConfig.TYPE_SENSOR_LPG:
-// //浼犳劅鍣� 娑插寲鐭虫补姘�
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---娑插寲鐭虫补姘旂姸鎬佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float lpgValue = (float) event.getAppliancesInfo().getCurState();
-// String lpgValueUnit = ((SensorStateBackInfo) event).getUnite();
-// showToast("浼犳劅鍣�---娑插寲鐭虫补姘旓細" + lpgValue + lpgValueUnit);
-// HDLLog.Log("浼犳劅鍣�---娑插寲鐭虫补姘旓細" + lpgValue + lpgValueUnit);
-// break;
-// case HDLApConfig.TYPE_SENSOR_CO_H2:
-// //浼犳劅鍣� 浜哄伐鐓ゆ皵
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---浜哄伐鐓ゆ皵鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float coh2Value = (float) event.getAppliancesInfo().getCurState();
-// String coh2ValueUnit = ((SensorStateBackInfo) event).getUnite();
-// showToast("浼犳劅鍣�---浜哄伐鐓ゆ皵锛�" + coh2Value + coh2ValueUnit);
-// HDLLog.Log("浼犳劅鍣�---浜哄伐鐓ゆ皵锛�" + coh2Value + coh2ValueUnit);
-// break;
-// case HDLApConfig.TYPE_SENSOR_CH4:
-// //浼犳劅鍣� 澶╃劧姘�
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---澶╃劧姘旂姸鎬佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float ch4Value = (float) event.getAppliancesInfo().getCurState();
-// String ch4ValueUnit = ((SensorStateBackInfo) event).getUnite();
-// showToast("浼犳劅鍣�---澶╃劧姘旓細" + ch4Value + ch4ValueUnit);
-// HDLLog.Log("浼犳劅鍣�---澶╃劧姘旓細" + ch4Value + ch4ValueUnit);
-// break;
-// case HDLApConfig.TYPE_SENSOR_SMOG:
-// //浼犳劅鍣� 鐑熼浘
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---鐑熼浘鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float smogValue = (float) event.getAppliancesInfo().getCurState();
-// String smogValueUnit = ((SensorStateBackInfo) event).getUnite();
-// showToast("浼犳劅鍣�---鐑熼浘锛�" + smogValue + smogValueUnit);
-// HDLLog.Log("浼犳劅鍣�---鐑熼浘锛�" + smogValue + smogValueUnit);
-// break;
-// case HDLApConfig.TYPE_SENSOR_WIND_SPEED:
-// //浼犳劅鍣� 椋庨��
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---椋庨�熺姸鎬佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float windSpeedValue = (float) event.getAppliancesInfo().getCurState();
-// String windSpeedValueUnit = ((SensorStateBackInfo) event).getUnite();
-// showToast("浼犳劅鍣�---椋庨�燂細" + windSpeedValue + windSpeedValueUnit);
-// HDLLog.Log("浼犳劅鍣�---椋庨�燂細" + windSpeedValue + windSpeedValueUnit);
-// break;
-// case HDLApConfig.TYPE_SENSOR_WIND_PRESSURE:
-// //浼犳劅鍣� 椋庡帇
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---椋庡帇鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float windPressureValue = (float) event.getAppliancesInfo().getCurState();
-// String windPressureValueUnit = ((SensorStateBackInfo) event).getUnite();
-// showToast("浼犳劅鍣�---椋庡帇锛�" + windPressureValue + windPressureValueUnit);
-// HDLLog.Log("浼犳劅鍣�---椋庡帇锛�" + windPressureValue + windPressureValueUnit);
-// break;
-// case HDLApConfig.TYPE_SENSOR_LIQUID_FLOW:
-// //浼犳劅鍣� 娑蹭綋娴侀噺
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---娑蹭綋娴侀噺鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float liquidFlowValue = (float) event.getAppliancesInfo().getCurState();
-// String liquidFlowValueUnit = ((SensorStateBackInfo) event).getUnite();
-// showToast("浼犳劅鍣�---娑蹭綋娴侀噺锛�" + liquidFlowValue + liquidFlowValueUnit);
-// HDLLog.Log("浼犳劅鍣�---娑蹭綋娴侀噺锛�" + liquidFlowValue + liquidFlowValueUnit);
-// break;
-// case HDLApConfig.TYPE_SENSOR_LIQUID_PRESSURE:
-// //浼犳劅鍣� 娑蹭綋鍘嬪姏
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---娑蹭綋鍘嬪姏鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float liquidPressureValue = (float) event.getAppliancesInfo().getCurState();
-// String liquidPressureValueUnit = ((SensorStateBackInfo) event).getUnite();
-// showToast("浼犳劅鍣�---娑蹭綋鍘嬪姏锛�" + liquidPressureValue + liquidPressureValueUnit);
-// HDLLog.Log("浼犳劅鍣�---娑蹭綋鍘嬪姏锛�" + liquidPressureValue + liquidPressureValueUnit);
-// break;
-// case HDLApConfig.TYPE_SENSOR_LIQUID_DEPTH:
-// //浼犳劅鍣� 娑蹭綋娣卞害
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---娑蹭綋娣卞害鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float liquidDepthValue = (float) event.getAppliancesInfo().getCurState();
-// String liquidDepthValueUnit = ((SensorStateBackInfo) event).getUnite();
-// showToast("浼犳劅鍣�---娑蹭綋娣卞害锛�" + liquidDepthValue + liquidDepthValueUnit);
-// HDLLog.Log("浼犳劅鍣�---娑蹭綋娣卞害锛�" + liquidDepthValue + liquidDepthValueUnit);
-// break;
-// case HDLApConfig.TYPE_SENSOR_RAIN_FALL:
-// //浼犳劅鍣� 闆ㄩ噺
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---闆ㄩ噺鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float rainFallValue = (float) event.getAppliancesInfo().getCurState();
-// String rainFallValueUnit = ((SensorStateBackInfo) event).getUnite();
-// showToast("浼犳劅鍣�---闆ㄩ噺锛�" + rainFallValue + rainFallValueUnit);
-// HDLLog.Log("浼犳劅鍣�---闆ㄩ噺锛�" + rainFallValue + rainFallValueUnit);
-// break;
-// case HDLApConfig.TYPE_SENSOR_WEIGHT:
-// //浼犳劅鍣� 閲嶉噺
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---閲嶉噺鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float weightValue = (float) event.getAppliancesInfo().getCurState();
-// String weightValueUnit = ((SensorStateBackInfo) event).getUnite();
-// showToast("浼犳劅鍣�---閲嶉噺锛�" + weightValue + weightValueUnit);
-// HDLLog.Log("浼犳劅鍣�---閲嶉噺锛�" + weightValue + weightValueUnit);
-// break;
-// case HDLApConfig.TYPE_SENSOR_HEIGHT_LENGTH:
-// //浼犳劅鍣� 閲嶉噺
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---閲嶉噺鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float height_lengthValue = (float) event.getAppliancesInfo().getCurState();
-// String height_lengthValueUnit = ((SensorStateBackInfo) event).getUnite();
-// showToast("浼犳劅鍣�---閲嶉噺锛�" + height_lengthValue + height_lengthValueUnit);
-// HDLLog.Log("浼犳劅鍣�---閲嶉噺锛�" + height_lengthValue + height_lengthValueUnit);
-// break;
-// case HDLApConfig.TYPE_SENSOR_OBJECT_SPEED:
-// //浼犳劅鍣� 鐗╀綋閫熷害
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---鐗╀綋閫熷害鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float objectSpeedValue = (float) event.getAppliancesInfo().getCurState();
-// String objectSpeedUnite = ((SensorStateBackInfo) event).getUnite();//鏁板�煎崟浣�
-// showToast("浼犳劅鍣�---鐗╀綋閫熷害锛�" + objectSpeedValue + objectSpeedUnite);
-// HDLLog.Log("浼犳劅鍣�---鐗╀綋閫熷害锛�" + objectSpeedValue + objectSpeedUnite);
-// break;
-// case HDLApConfig.TYPE_SENSOR_SHAKE:
-// //浼犳劅鍣� 闇囧姩
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---闇囧姩鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float shakeValue = (float) event.getAppliancesInfo().getCurState();
-// String shakeValueUnite = ((SensorStateBackInfo) event).getUnite();//鏁板�煎崟浣�
-// showToast("浼犳劅鍣�---闇囧姩锛�" + shakeValue + shakeValueUnite);
-// HDLLog.Log("浼犳劅鍣�---闇囧姩锛�" + shakeValue + shakeValueUnite);
-// break;
-// case HDLApConfig.TYPE_SENSOR_VOLTAGE:
-// //浼犳劅鍣� 鐢靛帇
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---鐢靛帇鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float voltageValue = (float) event.getAppliancesInfo().getCurState();
-// String voltageValueUnite = ((SensorStateBackInfo) event).getUnite();//鏁板�煎崟浣�
-// showToast("浼犳劅鍣�---鐢靛帇锛�" + voltageValue + voltageValueUnite);
-// HDLLog.Log("浼犳劅鍣�---鐢靛帇锛�" + voltageValue + voltageValueUnite);
-// break;
-// case HDLApConfig.TYPE_SENSOR_ELECTRICITY:
-// //浼犳劅鍣� 鐢垫祦
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---鐢垫祦鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float electricityValue = (float) event.getAppliancesInfo().getCurState();
-// String electricityValueUnite = ((SensorStateBackInfo) event).getUnite();//鏁板�煎崟浣�
-// showToast("浼犳劅鍣�---鐢垫祦锛�" + electricityValue + electricityValueUnite);
-// HDLLog.Log("浼犳劅鍣�---鐢垫祦锛�" + electricityValue + electricityValueUnite);
-// break;
-// case HDLApConfig.TYPE_SENSOR_POWER:
-// //浼犳劅鍣� 鍔熺巼
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---鍔熺巼鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float powerValue = (float) event.getAppliancesInfo().getCurState();
-// String powerValueUnite = ((SensorStateBackInfo) event).getUnite();//鏁板�煎崟浣�
-// showToast("浼犳劅鍣�---鍔熺巼锛�" + powerValue + powerValueUnite);
-// HDLLog.Log("浼犳劅鍣�---鍔熺巼锛�" + powerValue + powerValueUnite);
-// break;
-// case HDLApConfig.TYPE_SENSOR_FLOODING:
-// //浼犳劅鍣� 姘存蹈
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---姘存蹈鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float floodingValue = (float) event.getAppliancesInfo().getCurState();
-// String floodingValueUnite = ((SensorStateBackInfo) event).getUnite();//鏁板�煎崟浣�
-// showToast("浼犳劅鍣�---姘存蹈锛�" + floodingValue + floodingValueUnite);
-// HDLLog.Log("浼犳劅鍣�---姘存蹈锛�" + floodingValue + floodingValueUnite);
-// break;
-// case HDLApConfig.TYPE_SENSOR_DOOR_MAGNET:
-// //浼犳劅鍣� 闂ㄧ绐楃
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---闂ㄧ绐楃鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float doorMagnetValue = (float) event.getAppliancesInfo().getCurState();
-// String doorMagnetValueUnite = ((SensorStateBackInfo) event).getUnite();//鏁板�煎崟浣�
-// showToast("浼犳劅鍣�---闂ㄧ绐楃锛�" + doorMagnetValue + doorMagnetValueUnite);
-// HDLLog.Log("浼犳劅鍣�---闂ㄧ绐楃锛�" + doorMagnetValue + doorMagnetValueUnite);
-// break;
-// case HDLApConfig.TYPE_SENSOR_EMERGENCY_BUTTON:
-// //浼犳劅鍣� 绱ф�ユ寜閽�
-// if (!event.isSuccess()) {
-// showToast("鑾峰彇浼犳劅鍣�---绱ф�ユ寜閽姸鎬佸け璐ワ紝璇烽噸鏂板啀璇�");
-// return;
-// }
-// float emergencyButtonValue = (float) event.getAppliancesInfo().getCurState();
-// String emergencyButtonUnite = ((SensorStateBackInfo) event).getUnite();//鏁板�煎崟浣�
-// showToast("浼犳劅鍣�---绱ф�ユ寜閽細" + emergencyButtonValue + emergencyButtonUnite);
-// HDLLog.Log("浼犳劅鍣�---绱ф�ユ寜閽細" + emergencyButtonValue + emergencyButtonUnite);
-// break;
-//
-//
-// }
-// }
-// }
+ /**
+ * 浼犳劅鍣ㄧ姸鎬佸洖璋� Event
+ *
+ * @param event
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onSensorStateBackInfoMain(SensorStateBackInfo event) {
+ if (event.getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
+ && event.getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
+ && event.getAppliancesInfo().getChannelNum() == appliancesInfo.getChannelNum()
+ ) {
+ showMessage = "";
+ sensorText.setVisibility(View.GONE);
+ sensorStatusText.setVisibility(View.VISIBLE);
+ //杩欎釜杩斿洖鐨勪俊鎭槸褰撳墠鐘舵�佺殑
+ switch (event.getAppliancesInfo().getDeviceType()) {
+ case HDLApConfig.TYPE_SENSOR_TEMP:
+ //浼犳劅鍣� 娓╁害
+ if (!event.isSuccess()) {
+ showToast("鑾峰彇浼犳劅鍣�---娓╁害鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
+ return;
+ }
+ float tempValue = (float) event.getAppliancesInfo().getCurState();
+ String tempValueUnit = ((SensorStateBackInfo) event).getUnite();
+ showMessage = tempValue + tempValueUnit;
+ sensorStatusText.setText("浼犳劅鍣�---娓╁害锛�" + showMessage);
+ showToast("浼犳劅鍣�---娓╁害锛�" + tempValue + tempValueUnit);
+ HDLLog.Log("浼犳劅鍣�---娓╁害锛�" + tempValue + tempValueUnit);
+ break;
+ case HDLApConfig.TYPE_SENSOR_HUMIDITY:
+ //浼犳劅鍣� 婀垮害
+ if (!event.isSuccess()) {
+ showToast("鑾峰彇浼犳劅鍣�---婀垮害鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
+ return;
+ }
+ float humidityValue = (float) event.getAppliancesInfo().getCurState();
+ String humidityValueUnit = ((SensorStateBackInfo) event).getUnite();
+ showMessage = humidityValue + humidityValueUnit;
+ sensorStatusText.setText("浼犳劅鍣�---婀垮害锛�" + showMessage);
+ showToast("浼犳劅鍣�---婀垮害锛�" + humidityValue + humidityValueUnit);
+ HDLLog.Log("浼犳劅鍣�---婀垮害锛�" + humidityValue + humidityValueUnit);
+ break;
+ case HDLApConfig.TYPE_SENSOR_VOC:
+ //浼犳劅鍣� 褰撳墠绌烘皵璐ㄩ噺绛夌骇
+ if (!event.isSuccess()) {
+ showToast("鑾峰彇浼犳劅鍣�---褰撳墠绌烘皵璐ㄩ噺绛夌骇鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
+ return;
+ }
+ float vocValue = (float) event.getAppliancesInfo().getCurState();
+ String vocValueUnit = ((SensorStateBackInfo) event).getUnite();
+ showMessage = vocValue + vocValueUnit;
+ sensorStatusText.setText("浼犳劅鍣�---褰撳墠绌烘皵璐ㄩ噺绛夌骇锛�" + showMessage);
+ showToast("浼犳劅鍣�---褰撳墠绌烘皵璐ㄩ噺绛夌骇锛�" + vocValue + vocValueUnit);
+ HDLLog.Log("浼犳劅鍣�---褰撳墠绌烘皵璐ㄩ噺绛夌骇锛�" + vocValue + vocValueUnit);
+ break;
+ case HDLApConfig.TYPE_SENSOR_PM_2_POINT_5:
+ //浼犳劅鍣� pm2.5
+ if (!event.isSuccess()) {
+ showToast("鑾峰彇浼犳劅鍣�---pm2.5鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
+ return;
+ }
+ float pm2_5Value = (float) event.getAppliancesInfo().getCurState();
+ String pm2_5ValueUnit = ((SensorStateBackInfo) event).getUnite();
+ showMessage = pm2_5Value + pm2_5ValueUnit;
+ sensorStatusText.setText("浼犳劅鍣�---pm2.5锛�" + showMessage);
+ showToast("浼犳劅鍣�---pm2.5锛�" + pm2_5Value + pm2_5ValueUnit);
+ HDLLog.Log("浼犳劅鍣�---pm2.5锛�" + pm2_5Value + pm2_5ValueUnit);
+ break;
+ case HDLApConfig.TYPE_SENSOR_C02:
+ //浼犳劅鍣� 浜屾哀鍖栫⒊
+ if (!event.isSuccess()) {
+ showToast("鑾峰彇浼犳劅鍣�---浜屾哀鍖栫⒊鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
+ return;
+ }
+ float co2Value = (float) event.getAppliancesInfo().getCurState();
+ String co2ValueUnit = ((SensorStateBackInfo) event).getUnite();
+ showMessage = co2Value + co2ValueUnit;
+ sensorStatusText.setText("浼犳劅鍣�---浜屾哀鍖栫⒊锛�" + showMessage);
+ showToast("浼犳劅鍣�---浜屾哀鍖栫⒊锛�" + co2Value + co2ValueUnit);
+ HDLLog.Log("浼犳劅鍣�---浜屾哀鍖栫⒊锛�" + co2Value + co2ValueUnit);
+ break;
+ case HDLApConfig.TYPE_SENSOR_PM_10:
+ //浼犳劅鍣� pm10
+ if (appliancesInfo.getChannelNum() != event.getAppliancesInfo().getChannelNum() || !event.isSuccess()) {
+ showToast("鑾峰彇浼犳劅鍣�---pm10鐘舵�佸け璐ワ紝璇烽噸鏂板啀璇�");
+ return;
+ }
+ float pm10Value = (float) event.getAppliancesInfo().getCurState();
+ String pm10ValueUnit = ((SensorStateBackInfo) event).getUnite();
+ showMessage = pm10Value + pm10ValueUnit;
+ sensorStatusText.setText("浼犳劅鍣�---pm10锛�" + showMessage);
+ showToast("浼犳劅鍣�---pm10锛�" + pm10Value + pm10ValueUnit);
+ HDLLog.Log("浼犳劅鍣�---pm10锛�" + pm10Value + pm10ValueUnit);
+ break;
+ }
+ }
+ }
}
\ No newline at end of file
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 cf2b9a2..ef8454d 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
@@ -1,8 +1,6 @@
package com.hdl.sdk.ttl_sdk.adapter;
import android.content.Context;
-import android.support.annotation.NonNull;
-import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
@@ -10,16 +8,12 @@
import android.widget.ImageView;
import android.widget.TextView;
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
import com.hdl.sdk.ttl.Config.Configuration;
import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
import com.hdl.sdk.ttl_sdk.R;
-import com.hdl.sdk.ttl_sdk.activity.AppliancesListActivity;
-import com.hdl.sdk.ttl_sdk.activity.CtrlActivity;
-import com.hdl.sdk.ttl_sdk.activity.CtrlAirActivity;
-import com.hdl.sdk.ttl_sdk.activity.CtrlAudioActivity;
-import com.hdl.sdk.ttl_sdk.activity.CtrlCurtainActivity;
-import com.hdl.sdk.ttl_sdk.activity.CtrlLightActivity;
-import com.hdl.sdk.ttl_sdk.activity.CtrlLogicActivity;
import com.hdl.sdk.ttl_sdk.utlis.HDLUtlis;
import java.util.List;
diff --git a/app/src/main/java/com/hdl/sdk/ttl_sdk/adapter/HDLMainListAdapter.java b/app/src/main/java/com/hdl/sdk/ttl_sdk/adapter/HDLMainListAdapter.java
index ef33d06..e75e294 100644
--- a/app/src/main/java/com/hdl/sdk/ttl_sdk/adapter/HDLMainListAdapter.java
+++ b/app/src/main/java/com/hdl/sdk/ttl_sdk/adapter/HDLMainListAdapter.java
@@ -1,15 +1,14 @@
package com.hdl.sdk.ttl_sdk.adapter;
import android.content.Context;
-import android.support.annotation.NonNull;
-import android.support.v7.widget.RecyclerView;
-import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
-import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
import com.hdl.sdk.ttl_sdk.R;
import java.util.List;
diff --git a/app/src/main/java/com/hdl/sdk/ttl_sdk/adapter/HDLSceneListAdapter.java b/app/src/main/java/com/hdl/sdk/ttl_sdk/adapter/HDLSceneListAdapter.java
new file mode 100644
index 0000000..868f11e
--- /dev/null
+++ b/app/src/main/java/com/hdl/sdk/ttl_sdk/adapter/HDLSceneListAdapter.java
@@ -0,0 +1,94 @@
+package com.hdl.sdk.ttl_sdk.adapter;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.hdl.sdk.ttl.HDLDeviceManger.Bean.ScenesData;
+import com.hdl.sdk.ttl_sdk.R;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by panlili on 2023/01/19
+ */
+public class HDLSceneListAdapter extends RecyclerView.Adapter<HDLSceneListAdapter.HDLViewHolder> {
+
+ private Context mContext;
+ private List<ScenesData> mList;
+ private OnItemClickLitener mOnItemClickLitener;
+
+ public HDLSceneListAdapter(Context context, List<ScenesData> mmList) {
+ this.mContext = context;
+ this.mList = new ArrayList<>();
+ this.mList.addAll(mmList);
+ }
+
+ @NonNull
+ @Override
+ public HDLViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View view = LayoutInflater.from(mContext).inflate(R.layout.list_item_device_list, parent, false);
+ return new HDLViewHolder(view);
+ }
+
+ @Override
+ public void onBindViewHolder(final HDLViewHolder holder, final int position) {
+
+ holder.mTextView.setText(mList.get(position).getRemark());
+ holder.imageView.setVisibility(View.GONE);
+ if (mOnItemClickLitener != null) {
+ holder.itemView.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ mOnItemClickLitener.onItemClick(position);
+ }
+ });
+ }
+ }
+
+ @Override
+ public int getItemCount() {
+ return mList.size();
+ }
+
+ public List<ScenesData> getData() {
+ if (mList == null) {
+ return mList = new ArrayList<>();
+ }
+ return mList;
+ }
+
+ public void setData(List<ScenesData> mData) {
+ if (mData != null) {
+ this.mList = mData;
+ }
+ }
+
+ public static class HDLViewHolder extends RecyclerView.ViewHolder {
+
+ private TextView mTextView;
+ private ImageView imageView;
+
+ public HDLViewHolder(View itemView) {
+ super(itemView);
+ mTextView = (TextView) itemView.findViewById(R.id.tv_device);
+ imageView = itemView.findViewById(R.id.iv_device_arrow);
+ }
+ }
+
+
+ public interface OnItemClickLitener {
+ void onItemClick(int position);
+ }
+
+ 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/base/BaseActivity.java b/app/src/main/java/com/hdl/sdk/ttl_sdk/base/BaseActivity.java
index 98a8fd7..b89631c 100644
--- a/app/src/main/java/com/hdl/sdk/ttl_sdk/base/BaseActivity.java
+++ b/app/src/main/java/com/hdl/sdk/ttl_sdk/base/BaseActivity.java
@@ -1,15 +1,12 @@
package com.hdl.sdk.ttl_sdk.base;
import android.content.Intent;
-import android.content.res.TypedArray;
-import android.graphics.Color;
import android.os.Bundle;
-import android.support.v7.app.AppCompatActivity;
-import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Toast;
-import com.hdl.sdk.ttl_sdk.R;
+import androidx.appcompat.app.AppCompatActivity;
+
import org.greenrobot.eventbus.EventBus;
diff --git a/app/src/main/java/com/hdl/sdk/ttl_sdk/utlis/HDLUriUtils.java b/app/src/main/java/com/hdl/sdk/ttl_sdk/utlis/HDLUriUtils.java
index 87488dc..26645fa 100644
--- a/app/src/main/java/com/hdl/sdk/ttl_sdk/utlis/HDLUriUtils.java
+++ b/app/src/main/java/com/hdl/sdk/ttl_sdk/utlis/HDLUriUtils.java
@@ -9,8 +9,9 @@
import android.os.Environment;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
-import android.support.annotation.NonNull;
-import android.support.v4.content.FileProvider;
+
+import androidx.annotation.NonNull;
+import androidx.core.content.FileProvider;
import java.io.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
index 9b82188..62319d8 100644
--- 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
@@ -16,13 +16,14 @@
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 androidx.annotation.ColorInt;
+import androidx.annotation.Nullable;
+
import com.hdl.sdk.ttl_sdk.R;
import java.util.Locale;
diff --git a/app/src/main/res/layout/activity_appliances_new.xml b/app/src/main/res/layout/activity_appliances_new.xml
index 16723d5..58ba4ff 100644
--- a/app/src/main/res/layout/activity_appliances_new.xml
+++ b/app/src/main/res/layout/activity_appliances_new.xml
@@ -15,13 +15,13 @@
android:layout_height="match_parent"
android:layout_below="@+id/hdl_top_bar_layout">
- <android.support.v7.widget.RecyclerView
+ <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView_hl"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/transparent">
- </android.support.v7.widget.RecyclerView>
+ </androidx.recyclerview.widget.RecyclerView>
</LinearLayout>
</RelativeLayout>
diff --git a/app/src/main/res/layout/activity_ctrl_curtain.xml b/app/src/main/res/layout/activity_ctrl_curtain.xml
index 5c8b8fb..0e505e1 100644
--- a/app/src/main/res/layout/activity_ctrl_curtain.xml
+++ b/app/src/main/res/layout/activity_ctrl_curtain.xml
@@ -8,33 +8,32 @@
<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/curtainText1"
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/curtainbtn"
@@ -46,8 +45,8 @@
android:id="@+id/curtainText2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:textSize="@dimen/ts_20"
- android:text="杩欎釜鎸夐挳鍋氱獥甯樼數鏈虹殑婕旂ず銆傚紑鍚堝笜鐢垫満锛屽嵎甯樼數鏈虹被浼�" />
+ android:text="杩欎釜鎸夐挳鍋氱獥甯樼數鏈虹殑婕旂ず銆傚紑鍚堝笜鐢垫満锛屽嵎甯樼數鏈虹被浼�"
+ android:textSize="@dimen/ts_20" />
<LinearLayout
android:layout_width="wrap_content"
@@ -55,29 +54,59 @@
android:orientation="horizontal">
<Button
- android:id="@+id/curtainbtn2"
+ android:id="@+id/curtain_openbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="绐楀笜寮�" />
<Button
- android:id="@+id/curtainbtn3"
+ android:id="@+id/curtain_closebtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="绐楀笜鍏�" />
<Button
- android:id="@+id/curtainbtn4"
+ android:id="@+id/curtain_stopbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="绐楀笜鍋�" />
+ </LinearLayout>
- <Button
- android:id="@+id/curtainbtn5"
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <EditText
+ android:id="@+id/et_curtain_precent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="绐楀笜寮�鍒�50%" />
+ android:hint="璇疯緭鍏ラ渶瑕佹帶鍒剁殑绐楀笜鐧惧垎姣�"
+ android:text="50" />
+ <Button
+ android:id="@+id/curtain_precentbtn"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="绐楀笜鐧惧垎姣旀帶鍒�" />
+ </LinearLayout>
+
+ <LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="horizontal">
+
+ <Button
+ android:id="@+id/curtain_upbtn"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="涓婄偣鍔�" />
+
+ <Button
+ android:id="@+id/curtain_downbtn"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="涓嬬偣鍔�" />
</LinearLayout>
</LinearLayout>
diff --git a/app/src/main/res/layout/activity_ctrl_knxtechnology_system.xml b/app/src/main/res/layout/activity_ctrl_knxtechnology_system.xml
new file mode 100644
index 0000000..9714497
--- /dev/null
+++ b/app/src/main/res/layout/activity_ctrl_knxtechnology_system.xml
@@ -0,0 +1,81 @@
+<?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="杩欎釜鎸夐挳鍋氱鎶�绯荤粺鐨勬紨绀�" />
+
+ <TextView
+ android:id="@+id/airText_humidity"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="瀹ゅ唴婀垮害锛�" />
+
+ <Button
+ android:id="@+id/airbtn_switch"
+ 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_ctrl_scene.xml b/app/src/main/res/layout/activity_ctrl_scene.xml
new file mode 100644
index 0000000..d49ce96
--- /dev/null
+++ b/app/src/main/res/layout/activity_ctrl_scene.xml
@@ -0,0 +1,45 @@
+<?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.CtrlSceneActivity">
+
+ <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">
+
+ <Button
+ android:id="@+id/btn_search"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鎼滅储鍦烘櫙" />
+
+ <TextView
+ android:id="@+id/tv_scene"
+ android:layout_width="match_parent"
+ android:layout_height="40dp"
+ android:gravity="center|left"
+ android:text="鍦烘櫙鎺у埗"
+ android:textColor="@color/black"
+ android:textSize="@dimen/ts_24" />
+
+ <androidx.recyclerview.widget.RecyclerView
+ android:id="@+id/listView_scenes"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:layout_marginTop="20dp">
+
+ </androidx.recyclerview.widget.RecyclerView>
+ </LinearLayout>
+
+</RelativeLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 370ad7f..f60cd05 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -8,19 +8,34 @@
<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="wrap_content"
android:layout_below="@+id/hdl_top_bar_layout"
android:orientation="vertical">
+
<TextView
android:id="@+id/tv_version"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:text="@string/app_code"
- />
+ android:text="@string/app_code" />
+
+ <EditText
+ android:id="@+id/et_gateway_subID"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="100"
+ android:hint="璇疯緭鍏ョ綉鍏冲瓙缃戝彿" />
+
+ <EditText
+ android:id="@+id/et_gateway_deviceID"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="0"
+ android:hint="璇疯緭鍏ョ綉鍏宠澶囧彿" />
+
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -31,6 +46,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="閲嶆柊鎼滅储璁惧" />
+
+ <Button
+ android:id="@+id/btn_searchScene"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鍦烘櫙鍔熻兘" />
+
<Button
android:id="@+id/btn_getlocal"
android:layout_width="wrap_content"
@@ -42,6 +64,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="寮�鍚覆鍙�" />
+
<Button
android:id="@+id/btn_close"
android:layout_width="wrap_content"
@@ -49,43 +72,45 @@
android:text="鍏抽棴涓插彛" />
-
</LinearLayout>
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="10dp">
- <Button
- android:id="@+id/btn_setting"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="淇敼瀛愮綉鍙疯澶囧彿" />
- <Button
- android:id="@+id/btn_add_device"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="鎵嬪姩娣诲姞璁惧" />
- <Button
- android:id="@+id/btn_sendtest"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="鍙戦�佹祴璇�" />
- <Button
- android:id="@+id/btn_mcu"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="MCU"
- android:visibility="gone"
- />
- <Button
- android:id="@+id/btn_ZigBee"
+ <LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:text="ZigBee"
- android:visibility="gone"
- />
- </LinearLayout>
+ android:layout_marginTop="10dp">
+
+ <Button
+ android:id="@+id/btn_setting"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="淇敼瀛愮綉鍙疯澶囧彿" />
+
+ <Button
+ android:id="@+id/btn_add_device"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鎵嬪姩娣诲姞璁惧" />
+
+ <Button
+ android:id="@+id/btn_sendtest"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="鍙戦�佹祴璇�" />
+
+ <Button
+ android:id="@+id/btn_mcu"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="MCU"
+ android:visibility="gone" />
+
+ <Button
+ android:id="@+id/btn_ZigBee"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="ZigBee"
+ android:visibility="gone" />
+ </LinearLayout>
<TextView
@@ -93,13 +118,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
- <android.support.v7.widget.RecyclerView
+ <androidx.recyclerview.widget.RecyclerView
android:id="@+id/listView_devices"
- android:layout_marginTop="20dp"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ android:layout_marginTop="20dp">
- </android.support.v7.widget.RecyclerView>
+ </androidx.recyclerview.widget.RecyclerView>
</LinearLayout>
diff --git a/app/src/main/res/layout/activity_sensor.xml b/app/src/main/res/layout/activity_sensor.xml
index 7e7470e..6956622 100644
--- a/app/src/main/res/layout/activity_sensor.xml
+++ b/app/src/main/res/layout/activity_sensor.xml
@@ -27,6 +27,13 @@
android:layout_height="wrap_content"
android:text="杩欎釜鎸夐挳鍋氫紶鎰熷櫒婕旂ず锛岃Е鍙戜簨浠朵笂鎶ョ姸鎬�" />
+ <TextView
+ android:id="@+id/sensorStatusText"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginTop="10dp"
+ android:text="杩欎釜鎸夐挳鍋氫紶鎰熷櫒婕旂ず锛岃幏鍙栫幆澧冧紶鎰熷櫒鐘舵��" />
+
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
diff --git a/app/src/main/res/layout/hdl_toolbar_top_view_b.xml b/app/src/main/res/layout/hdl_toolbar_top_view_b.xml
index 5241726..369f424 100644
--- a/app/src/main/res/layout/hdl_toolbar_top_view_b.xml
+++ b/app/src/main/res/layout/hdl_toolbar_top_view_b.xml
@@ -5,7 +5,7 @@
android:orientation="vertical">
- <android.support.v7.widget.Toolbar
+ <androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar_view_b"
android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height"
@@ -77,6 +77,6 @@
</RelativeLayout>
- </android.support.v7.widget.Toolbar>
+ </androidx.appcompat.widget.Toolbar>
</LinearLayout>
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 01fe704..55a2c6b 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,6 +1,6 @@
<resources>
<string name="app_name">HDL TTL SDK</string>
- <string name="app_code">HDL_TTLSDK-V1.0.1-2020-03-25</string>
+ <string name="app_code">HDL_TTLSDK-V1.2.1-2024-01-22</string>
<string name="btn_save">淇濆瓨</string>
<string name="et_subnetid_hint">瀛愮綉鍙凤紙鑼冨洿0 - 254锛�</string>
diff --git a/build.gradle b/build.gradle
index a6885b9..e5456f1 100644
--- a/build.gradle
+++ b/build.gradle
@@ -7,7 +7,8 @@
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.4.1'
+// classpath 'com.android.tools.build:gradle:3.6.4'
+ classpath "com.android.tools.build:gradle:4.2.2"
// classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0'
// classpath 'com.novoda:bintray-release:+'
diff --git a/bussdk.jks b/bussdk.jks
new file mode 100644
index 0000000..9fa1316
--- /dev/null
+++ b/bussdk.jks
Binary files differ
diff --git a/gradle.properties b/gradle.properties
index 743d692..4c99d8a 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -11,3 +11,9 @@
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
+android.useAndroidX=true
+# Enables namespacing of each library's R class so that its R class includes only the
+# resources declared in the library itself and none from the library's dependencies,
+# thereby reducing the size of the R class for that library
+android.nonTransitiveRClass=false
+android.enableJetifier=true
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index f6b961f..7454180 100644
--- a/gradle/wrapper/gradle-wrapper.jar
+++ b/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 502402a..ffed3a2 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
-#Tue Jul 02 15:30:58 GMT+08:00 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
diff --git a/gradlew b/gradlew
index cccdd3d..3da45c1 100644
--- a/gradlew
+++ b/gradlew
@@ -1,78 +1,129 @@
-#!/usr/bin/env sh
+#!/bin/sh
+
+#
+# Copyright ? 2015-2021 the original authors.
+#
+# 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
+#
+# https://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.
+#
##############################################################################
-##
-## Gradle start up script for UN*X
-##
+#
+# Gradle start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh Gradle
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions ?$var?, ?${var}?, ?${var:-default}?, ?${var+SET}?,
+# ?${var#prefix}?, ?${var%suffix}?, and ?$( cmd )?;
+# * compound commands having a testable exit status, especially ?case?;
+# * various built-in commands including ?command?, ?set?, and ?ulimit?.
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (3) This script is generated from the Groovy template
+# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
##############################################################################
# Attempt to set APP_HOME
+
# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
+
+APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
+APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
+MAX_FD=maximum
warn () {
echo "$*"
-}
+} >&2
die () {
echo
echo "$*"
echo
exit 1
-}
+} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
- NONSTOP* )
- nonstop=true
- ;;
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
+ JAVACMD=$JAVA_HOME/jre/sh/java
else
- JAVACMD="$JAVA_HOME/bin/java"
+ JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
@@ -81,7 +132,7 @@
location of your Java installation."
fi
else
- JAVACMD="java"
+ JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
@@ -89,84 +140,95 @@
fi
# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
- JAVACMD=`cygpath --unix "$JAVACMD"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
-# Escape application args
-save () {
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
- echo " "
-}
-APP_ARGS=$(save "$@")
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
-# Collect all arguments for the java command, following the shell quoting and substitution rules
-eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
-# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
-if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
- cd "$(dirname "$0")"
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
fi
+# Collect all arguments for the java command;
+# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
+# shell script including quotes and variable substitutions, so put them in
+# double quotes to make sure that they get re-expanded; and
+# * put everything else in single quotes, so that it's not re-expanded.
+
+set -- \
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
+ -classpath "$CLASSPATH" \
+ org.gradle.wrapper.GradleWrapperMain \
+ "$@"
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
index f955316..107acd3 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -1,3 +1,19 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -13,15 +29,18 @@
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
+if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -35,7 +54,7 @@
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-if exist "%JAVA_EXE%" goto init
+if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -45,28 +64,14 @@
goto fail
-:init
-@rem Get command-line arguments, handling Windows variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
diff --git a/hdlhome.jks b/hdlhome.jks
new file mode 100644
index 0000000..b504ae1
--- /dev/null
+++ b/hdlhome.jks
Binary files differ
--
Gitblit v1.8.0