20190716
1.提供声必可SDK,部分数据处理调整;
2.演示DemoAPP,地热和新风页面调整;
2个文件已添加
1个文件已删除
18个文件已修改
718 ■■■■■ 已修改文件
README.md 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/build.gradle 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/sdk/hdl_sdk/activity/CtrlActivity.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/sdk/hdl_sdk/activity/FreshAirActivity.java 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/sdk/hdl_sdk/activity/GeothermalActivity.java 71 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/sdk/hdl_sdk/activity/MainActivity.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/com/hdl/sdk/hdl_sdk/utlis/HDLUtlis.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/res/layout/activity_geothermal.xml 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/build.gradle 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/src/main/java/com/hdl/sdk/hdl_core/Config/Configuration.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLFreshAir/FreshAirBackInfo.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLFreshAir/Parser/FreshAirParser.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLGeothermal/Parser/GeothermalParser.java 103 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLCommand.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLDeviceManager.java 116 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLUdpCore.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/EventBusEvent/EventCode.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/EventBusEvent/GeothermalFeedBackEvent.java 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Parser/DeviceParser.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/src/main/java/com/hdl/sdk/hdl_core/Util/TransformUtil/HDLUtlis.java 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hdl_core/src/main/java/com/hdl/sdk/hdl_core/Util/TransformUtil/StringUtil.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
README.md
@@ -4,3 +4,7 @@
提供向往SDK项目
##Version 1.0.2
1.新增地热模块和新风系统控制和读取状态接口;
2.新增地热模块和新风系统控制演示页面;
3.targetSdkVersion 28;
app/build.gradle
@@ -1,13 +1,14 @@
apply plugin: 'com.android.application'
android {
    compileSdkVersion 27
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    defaultConfig {
        applicationId "com.hdl.sdk.hdl_sdk"
        minSdkVersion 17
        targetSdkVersion 27
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        versionName "1.0.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
@@ -16,12 +17,12 @@
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
//    buildToolsVersion '28.0.3'
}
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:appcompat-v7:28+'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
app/src/main/java/com/hdl/sdk/hdl_sdk/activity/CtrlActivity.java
@@ -62,7 +62,7 @@
        initView();
        initClickOnEvent();
        HDLCommand.getDeviceState(appliancesInfo);
    }
app/src/main/java/com/hdl/sdk/hdl_sdk/activity/FreshAirActivity.java
@@ -1,6 +1,7 @@
package com.hdl.sdk.hdl_sdk.activity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
@@ -34,6 +35,8 @@
    private int airSpeedState;
    private int ctrlId;
    private ProgressDialog proDialog;
    /**
     * 要注册使用EventBus,这里要设置返回true
     *
@@ -61,6 +64,8 @@
    @Override
    protected void onDestroy() {
        super.onDestroy();
        proDialog.dismiss();
        HDLLog.I("onDestroy: FreshAirActivity");
    }
    private void initcurState() {
@@ -73,7 +78,10 @@
        btn_speed = findViewById(com.hdl.sdk.hdl_sdk.R.id.btn_speed);
        btn_mode = findViewById(com.hdl.sdk.hdl_sdk.R.id.btn_mode);
        proDialog = new ProgressDialog(this);
        proDialog.setTitle("正在发送控制命令...");
        proDialog.setMessage("请耐心等待");
        proDialog.onStart();
    }
    private void initClickOnEvent() {
@@ -81,6 +89,7 @@
        btn_switch.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                proDialog.show();
                ctrlId = FreshAirParser.freshAirSwich;
                //演示当前状态为关,设置为开。开,设置为关。
                if (airSwitchState == 0) {
@@ -97,6 +106,7 @@
        btn_speed.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                proDialog.show();
                ctrlId = FreshAirParser.freshAirSpeed;
                switch (airSpeedState) {
                    case 0:
@@ -130,6 +140,7 @@
        btn_mode.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                proDialog.show();
                ctrlId = FreshAirParser.freshAirMode;
                switch (airModeState) {
                    case 0:
@@ -142,7 +153,7 @@
                        break;
                    case 2:
                        //若当前模式智能,则点击按钮设置为定时
                        HDLCommand.freshAirCtrl(appliancesInfo, FreshAirParser.freshAirMode, FreshAirParser.freshAirModeAuto);
                        HDLCommand.freshAirCtrl(appliancesInfo, FreshAirParser.freshAirMode, FreshAirParser.freshAirModeTiming);
                        break;
                    case 3:
                        //若当前模式定时,则点击按钮设置为手动
@@ -218,13 +229,14 @@
    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onFreshAirFeedBackEventMain(FreshAirFeedBackEvent event) {
        proDialog.dismiss();
        if (event.getFreshAirBackInfo().getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
                && event.getFreshAirBackInfo().getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
                && event.getFreshAirBackInfo().getAppliancesInfo().getChannelNum() == appliancesInfo.getChannelNum()
        ) {
            //先判断是否超时
            if (!event.isSuccess()) {
                showToast("空调控制超时,请重新再试");
                showToast("新风控制超时,请重新再试");
                return;
            }
@@ -245,12 +257,14 @@
            }
            //*********根据需求显示*********
            message += "\n" + "室内温度:" + mFreshAirBackInfo.getInTemp();
            message += "\n" + "室外温度:" + mFreshAirBackInfo.getOutTemp();
            message += "\n" + "室内湿度:" + mFreshAirBackInfo.getHumidty();
            message += "\n" + "PM2.5:" + mFreshAirBackInfo.getInTemp();
            message += "\n" + "TVOC:" + mFreshAirBackInfo.getInTemp();
            message += "\n" + "CO2:" + mFreshAirBackInfo.getInTemp();
            //*********根据需求显示*********
            mTextView.setText(message);
            showToast(message);
@@ -260,6 +274,7 @@
    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onDeviceStateEventMain(DeviceStateEvent event) {
        proDialog.dismiss();
        if (event.getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
                && event.getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
        ) {
@@ -278,15 +293,20 @@
                            return;
                        }
                        message += "\n" + getSwichStateString(mFreshAirBackInfo.getIsOn());
                        message += "\n" + getSpeedStateString(mFreshAirBackInfo.getFreshAirSpeed());
                        message += "\n" + getModeStateString(mFreshAirBackInfo.getFreshAirMode());
                        message += "\n" + "室内温度:" + mFreshAirBackInfo.getInTemp();
                        message += "\n" + "室外温度:" + mFreshAirBackInfo.getOutTemp();
                        message += "\n" + "室内湿度:" + mFreshAirBackInfo.getHumidty();
                        message += "\n" + "PM2.5:" + mFreshAirBackInfo.getInTemp();
                        message += "\n" + "TVOC:" + mFreshAirBackInfo.getInTemp();
                        message += "\n" + "CO2:" + mFreshAirBackInfo.getInTemp();
                        if(mFreshAirBackInfo.getIsOn() == FreshAirParser.freshAirOn) {
                            message = getSwichStateString(mFreshAirBackInfo.getIsOn());
                            message += "\n" + getSpeedStateString(mFreshAirBackInfo.getFreshAirSpeed());
                            message += "\n" + getModeStateString(mFreshAirBackInfo.getFreshAirMode());
                            message += "\n" + "室内温度:" + mFreshAirBackInfo.getInTemp();
                            message += "\n" + "室外温度:" + mFreshAirBackInfo.getOutTemp();
                            message += "\n" + "室内湿度:" + mFreshAirBackInfo.getHumidty();
                            message += "\n" + "PM2.5:" + mFreshAirBackInfo.getInTemp();
                            message += "\n" + "TVOC:" + mFreshAirBackInfo.getInTemp();
                            message += "\n" + "CO2:" + mFreshAirBackInfo.getInTemp();
                        }else {
                            message = getSwichStateString(mFreshAirBackInfo.getIsOn());
                        }
                        mTextView.setText(message);
                        showToast(message);
@@ -335,16 +355,16 @@
        airSpeedState = mState; //更新当前风速状态
        switch (mState) {
            case FreshAirParser.freshAirSpeedOff:
                mStrState = " 风速:关";
                mStrState = "风速:关";
                break;
            case FreshAirParser.freshAirSpeedLow:
                mStrState = " 风速:低";
                mStrState = "风速:低";
                break;
            case FreshAirParser.freshAirSpeedMid:
                mStrState = " 风速:中";
                mStrState = "风速:中";
                break;
            case FreshAirParser.freshAirSpeedHigh:
                mStrState = " 风速:高";
                mStrState = "风速:高";
                break;
            default:
@@ -365,16 +385,16 @@
        airModeState = mState;  //更新模式状态
        switch (mState) {
            case FreshAirParser.freshAirModeManual:
                mStrState = " 模式:手动";
                mStrState = "模式:手动";
                break;
            case FreshAirParser.freshAirModeAuto:
                mStrState = " 模式:自动";
                mStrState = "模式:自动";
                break;
            case FreshAirParser.freshAirModeIntelligent:
                mStrState = " 模式:智能";
                mStrState = "模式:智能";
                break;
            case FreshAirParser.freshAirModeTiming:
                mStrState = " 模式:定时";
                mStrState = "模式:定时";
                break;
            default:
app/src/main/java/com/hdl/sdk/hdl_sdk/activity/GeothermalActivity.java
@@ -1,6 +1,7 @@
package com.hdl.sdk.hdl_sdk.activity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
@@ -9,12 +10,12 @@
import android.widget.TextView;
import com.hdl.sdk.hdl_core.HDLAppliances.Config.HDLApConfig;
import com.hdl.sdk.hdl_core.HDLAppliances.HDLFreshAir.Parser.FreshAirParser;
import com.hdl.sdk.hdl_core.HDLAppliances.HDLGeothermal.GeothermalBackInfo;
import com.hdl.sdk.hdl_core.HDLAppliances.HDLGeothermal.Parser.GeothermalParser;
import com.hdl.sdk.hdl_core.HDLDeviceManger.Bean.AppliancesInfo;
import com.hdl.sdk.hdl_core.HDLDeviceManger.Core.HDLCommand;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.DeviceStateEvent;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.EventCode;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.GeothermalFeedBackEvent;
import com.hdl.sdk.hdl_sdk.R;
import com.hdl.sdk.hdl_sdk.base.BaseActivity;
@@ -37,7 +38,7 @@
    private int gModeState;
    private int gTempState;
    private int ctrlId;
    private ProgressDialog proDialog;
    /**
     * 要注册使用EventBus,这里要设置返回true
     *
@@ -63,6 +64,13 @@
        HDLCommand.getDeviceState(appliancesInfo);
    }
    @Override
    protected void onDestroy() {
        super.onDestroy();
        proDialog.dismiss();
        HDLLog.I("onDestroy: GeothermalActivity");
    }
    private void initcurState() {
        appliancesInfo = (AppliancesInfo) getIntent().getSerializableExtra("hdl");
    }
@@ -74,12 +82,17 @@
        btn_temp = findViewById(R.id.btn_temp);
        tempEditText = findViewById(R.id.et_temp);
        proDialog = new ProgressDialog(this);
        proDialog.setTitle("正在发送控制命令...");
        proDialog.setMessage("请耐心等待");
        proDialog.onStart();
    }
    private void initClickOnEvent() {
        btn_switch.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                proDialog.show();
                ctrlId = GeothermalParser.gSwich;
                //演示当前状态为关,设置为开。开,设置为关。
                if (gSwitchState == 0) {
@@ -97,6 +110,7 @@
        btn_mode.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                proDialog.show();
                ctrlId = GeothermalParser.gMode;
                switch (gModeState) {
                    case 1:
@@ -146,11 +160,10 @@
                    showToast("温度设置范围为:16~35摄氏度(℃)");
                    return;
                }
                proDialog.show();
                switch (gModeState) {
                    case 1:
                        //当前地热模式为普通
                        HDLCommand.geothermalCtrl(appliancesInfo, GeothermalParser.gNormalTemp, tempInt);//普通温度
                        ctrlId = GeothermalParser.gNormalTemp;
@@ -171,10 +184,14 @@
                        ctrlId = GeothermalParser.gLeaveTemp;
                        break;
                    case 5:
                        proDialog.dismiss();
                        //当前地热模式为自动
                        showToast("自动模式不能控制温度");
                        showToast("自动模式,不能控制温度");
                        break;
                    default:
                        proDialog.dismiss();
                        //当前地热模式为自动
                        showToast("未知模式,不能控制温度");
                        break;
                }
@@ -191,9 +208,9 @@
            GeothermalBackInfo mGeothermalBackInfo = new GeothermalBackInfo(appliancesInfo, false);
            String stringState = "";
            if (mGeothermalBackInfo.getIsOn() == 0) {
            if (mGeothermalBackInfo.getIsOn() == GeothermalParser.gSwichOff) {
                stringState = "地热模块:关闭";
            } else if (mGeothermalBackInfo.getIsOn() == 1) {
            } else if (mGeothermalBackInfo.getIsOn() == GeothermalParser.gSwichOn) {
                stringState = "地热模块:打开";
                stringState += "\n" + getModeStateString(mGeothermalBackInfo.getgMode());
@@ -227,10 +244,10 @@
        String mStrState = "未知";
        gSwitchState = mState; //更新开关状态
        switch (mState) {
            case FreshAirParser.freshAirOn:
            case GeothermalParser.gSwichOn:
                mStrState = "地热模块:打开";
                break;
            case FreshAirParser.freshAirOff:
            case GeothermalParser.gSwichOff:
                mStrState = "地热模块:关闭";
                break;
@@ -253,19 +270,19 @@
        gModeState = mState;  //更新模式状态
        switch (mState) {
            case GeothermalParser.gModeNormal:
                mStrState = " 模式:普通";
                mStrState = "模式:普通";
                break;
            case GeothermalParser.gModeDay:
                mStrState = " 模式:白天";
                mStrState = "模式:白天";
                break;
            case GeothermalParser.gModeNight:
                mStrState = " 模式:夜间";
                mStrState = "模式:夜间";
                break;
            case GeothermalParser.gModeLeave:
                mStrState = " 模式:离开";
                mStrState = "模式:离开";
                break;
            case GeothermalParser.gModeAuto:
                mStrState = " 模式:自动";
                mStrState = "模式:自动";
                break;
            default:
@@ -277,13 +294,19 @@
    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onGeothermalFeedBackEventMain(GeothermalFeedBackEvent event) {
        proDialog.dismiss();
        if (event.getGeothermalBackInfo().getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
                && event.getGeothermalBackInfo().getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
                && event.getGeothermalBackInfo().getAppliancesInfo().getChannelNum() == appliancesInfo.getChannelNum()
        ) {
            //先判断是否超时
            if (!event.isSuccess()) {
            if (event.getStatusID() == EventCode.FAILURE) {
                showToast("地热模块控制超时,请重新再试");
                return;
            }
            if (event.getStatusID() == EventCode.DATAEMPTY) {
                showToast("地热模块,返回数据为空");
                return;
            }
@@ -326,6 +349,7 @@
    @Subscribe(threadMode = ThreadMode.MAIN)
    public void onDeviceStateEventMain(DeviceStateEvent event) {
        proDialog.dismiss();
        if (event.getAppliancesInfo().getDeviceSubnetID() == appliancesInfo.getDeviceSubnetID()
                && event.getAppliancesInfo().getDeviceDeviceID() == appliancesInfo.getDeviceDeviceID()
        ) {
@@ -345,12 +369,17 @@
                            return;
                        }
                        message += "\n" + getSwichStateString(mGeothermalBackInfo.getIsOn());
                        message += "\n" + getModeStateString(mGeothermalBackInfo.getgMode());
                        message += "\n" + "普通模式温度:" + mGeothermalBackInfo.getgNormalTemp();
                        message += "\n" + "白天模式温度:" + mGeothermalBackInfo.getgDayTemp();
                        message += "\n" + "夜间模式温度:" + mGeothermalBackInfo.getgNightTemp();
                        message += "\n" + "离开模式温度:" + mGeothermalBackInfo.getgLeaveTemp();
                        if(mGeothermalBackInfo.getIsOn() == GeothermalParser.gSwichOn) {
                            message = getSwichStateString(mGeothermalBackInfo.getIsOn());
                            message += "\n" + getModeStateString(mGeothermalBackInfo.getgMode());
                            message += "\n" + "普通模式温度:" + mGeothermalBackInfo.getgNormalTemp();
                            message += "\n" + "白天模式温度:" + mGeothermalBackInfo.getgDayTemp();
                            message += "\n" + "夜间模式温度:" + mGeothermalBackInfo.getgNightTemp();
                            message += "\n" + "离开模式温度:" + mGeothermalBackInfo.getgLeaveTemp();
                        }else {
                            message = getSwichStateString(mGeothermalBackInfo.getIsOn());
                        }
                        mTextView.setText(message);
app/src/main/java/com/hdl/sdk/hdl_sdk/activity/MainActivity.java
@@ -95,7 +95,6 @@
                HDLCommand.getHomeDevices(MainActivity.this);
                proDia.show();
            }
        });
app/src/main/java/com/hdl/sdk/hdl_sdk/utlis/HDLUtlis.java
File was deleted
app/src/main/res/layout/activity_geothermal.xml
@@ -26,7 +26,9 @@
        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="50dp">
            android:layout_height="50dp"
            android:focusable="true"
            android:focusableInTouchMode="true">
            <Button
                android:id="@+id/btn_temp"
                android:layout_width="wrap_content"
hdl_core/build.gradle
@@ -2,10 +2,10 @@
//apply plugin: 'com.novoda.bintray-release'
android {
    compileSdkVersion 27
    compileSdkVersion 28
    defaultConfig {
        minSdkVersion 17
        targetSdkVersion 27
        targetSdkVersion 28
        versionCode 1
        versionName "1.0.2"
@@ -28,7 +28,7 @@
dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:appcompat-v7:28+'
    api 'org.greenrobot:eventbus:3.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
hdl_core/src/main/java/com/hdl/sdk/hdl_core/Config/Configuration.java
@@ -22,6 +22,11 @@
     */
    public static final int FRESH_AIR_BIG_TYPE = 19;
    //支持的小类
    public static final int FRESH_AIR_LITTLE_TYPE_0 = 0;
    public static final int GEOTHERMAL_LITTLE_TYPE_0 = 0;
    //小类 先不做分类
//    public static final int AIR_LITTLE_TYPE = 0;
@@ -147,8 +152,6 @@
    /**
     * RCU 配置数据
     */
    //固定RCU发送端口
    public static final int RCU_SEND_PORT = 6006;
    //固定RCU接收端口
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLFreshAir/FreshAirBackInfo.java
@@ -1,7 +1,7 @@
package com.hdl.sdk.hdl_core.HDLAppliances.HDLFreshAir;
import com.hdl.sdk.hdl_core.HDLDeviceManger.Bean.AppliancesInfo;
import com.hdl.sdk.hdl_core.Util.TransformUtil.StringUtil;
import com.hdl.sdk.hdl_core.Util.TransformUtil.HDLUtlis;
import java.io.Serializable;
@@ -47,12 +47,12 @@
            this.freshAirMode = this.curState[3] & 0xFF;
            this.enableValue1 = this.curState[4] & 0xFF;
            this.enableValue2 = this.curState[5] & 0xFF;
            this.mInTemp = StringUtil.byteToFloat(this.curState[6], this.curState[7], this.curState[8], this.curState[9]);
            this.mOutTemp = StringUtil.byteToFloat(this.curState[10], this.curState[11], this.curState[12], this.curState[13]);
            this.mHumidty = StringUtil.byteToFloat(this.curState[14], this.curState[15], this.curState[16], this.curState[17]);
            this.mPM25 = StringUtil.byteToFloat(this.curState[18], this.curState[19], this.curState[20], this.curState[21]);
            this.mTVOC = StringUtil.byteToFloat(this.curState[22], this.curState[23], this.curState[24], this.curState[25]);
            this.mCO2 = StringUtil.byteToFloat(this.curState[26], this.curState[27], this.curState[28], this.curState[29]);
            this.mInTemp = HDLUtlis.byteToFloat(this.curState[6], this.curState[7], this.curState[8], this.curState[9]);
            this.mOutTemp = HDLUtlis.byteToFloat(this.curState[10], this.curState[11], this.curState[12], this.curState[13]);
            this.mHumidty = HDLUtlis.byteToFloat(this.curState[14], this.curState[15], this.curState[16], this.curState[17]);
            this.mPM25 = HDLUtlis.byteToFloat(this.curState[18], this.curState[19], this.curState[20], this.curState[21]);
            this.mTVOC = HDLUtlis.byteToFloat(this.curState[22], this.curState[23], this.curState[24], this.curState[25]);
            this.mCO2 = HDLUtlis.byteToFloat(this.curState[26], this.curState[27], this.curState[28], this.curState[29]);
        }
    }
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLFreshAir/Parser/FreshAirParser.java
@@ -33,37 +33,43 @@
            return new byte[]{fail};
        }
        AppliancesInfo newInfo = null;
        byte[] freshAirBytes = null;
        try {
            AppliancesInfo newInfo = null;
            byte[] freshAirBytes = null;
        outter:
        for (int i = 0; i < HDLDeviceManager.devicesDataList.size(); i++) {
            if (appliancesInfo.getDeviceSubnetID() == HDLDeviceManager.devicesDataList.get(i).getSourceSubnetID()
                    && appliancesInfo.getDeviceDeviceID() == HDLDeviceManager.devicesDataList.get(i).getSourceDeviceID()) {
                for (int j = 0; j < HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().size(); j++) {
                    if (HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getBigType() == Configuration.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.getFeedbackState() == null) {
                            newInfo.setFeedbackState(new byte[30]);
            outter:
            for (int i = 0; i < HDLDeviceManager.devicesDataList.size(); i++) {
                if (appliancesInfo.getDeviceSubnetID() == HDLDeviceManager.devicesDataList.get(i).getSourceSubnetID()
                        && appliancesInfo.getDeviceDeviceID() == HDLDeviceManager.devicesDataList.get(i).getSourceDeviceID()) {
                    for (int j = 0; j < HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().size(); j++) {
                        if (HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getBigType() == Configuration.FRESH_AIR_BIG_TYPE
                                && HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getDeviceType() == HDLApConfig.TYPE_FRESH_AIR
                                && appliancesInfo.getChannelNum() == HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getChannelNum()) {
                            newInfo = HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j);
                            if (newInfo.getFeedbackState() == null) {
                                newInfo.setFeedbackState(new byte[30]);
                            }
                            freshAirBytes = newInfo.getFeedbackState();
                            break outter;
                        }
                        break outter;
                    }
                    }
                }
            }
        }
        freshAirBytes = newInfo.getFeedbackState();
        if (freshAirBytes != null && freshAirBytes.length >= 4) {
            byte[] addBytes = new byte[4];
            addBytes[0] = (byte) appliancesInfo.getChannelNum();
            addBytes[1] = freshAirBytes[1];
            addBytes[2] = freshAirBytes[2];
            addBytes[3] = freshAirBytes[3];
            if (freshAirBytes != null && freshAirBytes.length >= 4) {
                addBytes[0] = (byte) appliancesInfo.getChannelNum();
                addBytes[1] = freshAirBytes[1];
                addBytes[2] = freshAirBytes[2];
                addBytes[3] = freshAirBytes[3];
            } else {
                addBytes[0] = (byte) appliancesInfo.getChannelNum();
                addBytes[1] = 0;//发送默认参数
                addBytes[2] = 0;
                addBytes[3] = 0;
            }
            switch (type) {
                case freshAirSwich:
@@ -74,16 +80,18 @@
                    }
                    break;
                case freshAirSpeed:
                    addBytes[1] = 1;//打开操作
                    addBytes[2] = (byte) state;
                    break;
                case freshAirMode:
                    addBytes[1] = 1;//打开操作
                    addBytes[3] = (byte) state;
                    break;
            }
            return addBytes;
        } else {
            return null;
        } catch (Exception e) {
            e.printStackTrace();
            return new byte[]{fail};
        }
    }
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLAppliances/HDLGeothermal/Parser/GeothermalParser.java
@@ -18,56 +18,66 @@
    public static final int gMode = 4;      //模式
    public static final int gModeNormal = 0;//普通模式
    public static final int gModeDay = 1;//白天模式
    public static final int gModeNight = 2;//夜间模式
    public static final int gModeLeave = 3;//离开模式
    public static final int gModeAuto = 4;//自动模式
    public static final int gModeNormal = 1;//普通模式
    public static final int gModeDay = 2;//白天模式
    public static final int gModeNight = 3;//夜间模式
    public static final int gModeLeave = 4;//离开模式
    public static final int gModeAuto = 5;//自动模式
    public static final int gNormalTemp = 5;//普通模式温度
    public static final int gDayTemp = 6;//白天模式温度
    public static final int gNightTemp = 7;//夜间模式温度
    public static final int gLeaveTemp = 8;//离开模式温度
//    [回路,开关状态,温度类型,模式,普通温度,白天温度,夜间温度,离开温度,自动温度,当前温度]
    //    feedbackState [回路,开关状态,温度类型,模式,普通温度,白天温度,夜间温度,离开温度,自动温度,当前温度]
    public static byte[] getGeothermalAddByte(AppliancesInfo appliancesInfo, int type, int state) {
        AppliancesInfo newInfo = null;
        byte[] airBytes = null;
        outter:
        for (int i = 0; i < HDLDeviceManager.devicesDataList.size(); i++) {
            if (appliancesInfo.getDeviceSubnetID() == HDLDeviceManager.devicesDataList.get(i).getSourceSubnetID()
                    && appliancesInfo.getDeviceDeviceID() == HDLDeviceManager.devicesDataList.get(i).getSourceDeviceID()) {
                for (int j = 0; j < HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().size(); j++) {
                    if (HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getBigType() == Configuration.AIR_BIG_TYPE
                            && HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getDeviceType() != HDLApConfig.TYPE_AC_PANEL
                            && appliancesInfo.getChannelNum() == HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getChannelNum()) {
                        newInfo = HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j);
                        if (newInfo.getFeedbackState() == null) {
                            newInfo.setFeedbackState(new byte[10]);
        try {
            AppliancesInfo newInfo = null;
            byte[] airBytes = null;
            outter:
            for (int i = 0; i < HDLDeviceManager.devicesDataList.size(); i++) {
                if (appliancesInfo.getDeviceSubnetID() == HDLDeviceManager.devicesDataList.get(i).getSourceSubnetID()
                        && appliancesInfo.getDeviceDeviceID() == HDLDeviceManager.devicesDataList.get(i).getSourceDeviceID()) {
                    for (int j = 0; j < HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().size(); j++) {
                        if (HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getBigType() == Configuration.GEOTHERMAL_BIG_TYPE
                                && HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getDeviceType() == HDLApConfig.TYPE_GEOTHERMAL_MODULE
                                && appliancesInfo.getChannelNum() == HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j).getChannelNum()) {
                            newInfo = HDLDeviceManager.devicesDataList.get(i).getAppliancesInfoList().get(j);
                            if (newInfo.getFeedbackState() == null) {
                                newInfo.setFeedbackState(new byte[10]);
                            }
                            airBytes = newInfo.getFeedbackState();
                            break outter;
                        }
                        break outter;
                    }
                    }
                }
            }
        }
        airBytes =  newInfo.getFeedbackState();
        if (airBytes != null && airBytes.length >= 10) {
            byte[] addBytes = new byte[10];
            addBytes[0] = (byte) newInfo.getChannelNum();
            addBytes[1] = airBytes[1];
            addBytes[2] = 0;
            addBytes[3] = airBytes[3];
            addBytes[4] = airBytes[4];
            addBytes[5] = airBytes[5];
            addBytes[6] = airBytes[6];
            addBytes[7] = airBytes[7];
            addBytes[8] = airBytes[8];
            addBytes[9] = 0;
            addBytes[10] = 0;
            if (airBytes != null && airBytes.length >= 10) {
                addBytes[0] = (byte) newInfo.getChannelNum();
                addBytes[1] = airBytes[1];
                addBytes[2] = 0;
                addBytes[3] = airBytes[3];
                addBytes[4] = airBytes[4];
                addBytes[5] = airBytes[5];
                addBytes[6] = airBytes[6];
                addBytes[7] = airBytes[7];
                addBytes[8] = 0;
                addBytes[9] = 0;
            } else {
                addBytes[0] = (byte) newInfo.getChannelNum();
                addBytes[1] = 0;
                addBytes[2] = 0;
                addBytes[3] = 1;
                addBytes[4] = 30;
                addBytes[5] = 30;
                addBytes[6] = 30;
                addBytes[7] = 30;
                addBytes[8] = 0;
                addBytes[9] = 0;
            }
            switch (type) {
                case gSwich:
@@ -79,7 +89,7 @@
                    break;
                case gMode:
                    addBytes[1] = 1;
                    addBytes[3] =  (byte) state;
                    addBytes[3] = (byte) state;
                    break;
                case gNormalTemp:
                    addBytes[1] = 1;//打开
@@ -99,21 +109,14 @@
                    break;
            }
            return addBytes;
        } else {
            return null;
        } catch (Exception e) {
            e.printStackTrace();
            return new byte[]{fail};
        }
    }
}
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLCommand.java
@@ -21,12 +21,14 @@
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.AirFeedBackEvent;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.CurtainFeedBackEvent;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.DeviceStateEvent;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.EventCode;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.FreshAirFeedBackEvent;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.GeothermalFeedBackEvent;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.LightFeedBackEvent;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.LogicFeedBackEvent;
import com.hdl.sdk.hdl_core.Util.LogUtil.HDLLog;
import com.hdl.sdk.hdl_core.Util.SPUtil.SPUtils;
import com.hdl.sdk.hdl_core.Util.TransformUtil.HDLUtlis;
import org.greenrobot.eventbus.EventBus;
@@ -399,7 +401,7 @@
                    if (!HDLDeviceManager.isGeothermalCtrlSuccess) {
                        GeothermalBackInfo mGeothermalBackInfo = new GeothermalBackInfo();
                        mGeothermalBackInfo.setAppliancesInfo(info);
                        EventBus.getDefault().post(new GeothermalFeedBackEvent(mGeothermalBackInfo, false));
                        EventBus.getDefault().post(new GeothermalFeedBackEvent(mGeothermalBackInfo, EventCode.FAILURE));
                    }
                }
            }, 5000);
@@ -640,7 +642,9 @@
                            && info.getLittleType() == infos.get(j).getLittleType()
                            && info.getChannelNum() == infos.get(j).getChannelNum()
                    ) {
                        curState = (int) infos.get(j).getCurState();
//                        curState = (int) infos.get(j).getCurState();//旧
                        //20190712解决强制转换int类型闪退
                        curState = HDLUtlis.getIntegerByObject(infos.get(j).getCurState());
                        break outter;
                    }
@@ -670,7 +674,9 @@
                            && info.getChannelNum() == infos.get(j).getChannelNum()
                    ) {
                        //这里应该是要修复的,暂时未找到。
                        switch ((int) infos.get(j).getCurState()) {
                         //20190712解决强制转换int类型闪退
                        int  state = HDLUtlis.getIntegerByObject(infos.get(j).getCurState());
                        switch (state) {
                            case -1:
                                curState = 0;
                                break;
@@ -681,7 +687,8 @@
                                curState = 2;
                                break;
                            default:
                                curState = (int) infos.get(j).getCurState();
//                                curState = (int) infos.get(j).getCurState();
                                curState = state;
                                break;
                        }
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLDeviceManager.java
@@ -27,6 +27,7 @@
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.AirFeedBackEvent;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.CurtainFeedBackEvent;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.DeviceStateEvent;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.EventCode;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.FreshAirFeedBackEvent;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.GeothermalFeedBackEvent;
import com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent.LightFeedBackEvent;
@@ -169,8 +170,11 @@
            case Configuration.CURTAIN_STATE_BACK_COMMAND:
            case Configuration.AIR_STATE_BACK_COMMAND:
            case Configuration.SENSOR_STATE_BACK_COMMAND:
            case Configuration.FRESH_AIR_STATE_BACK_COMMAND://20190709新增
                handleStateData(getDatas);
                break;
            //获取新风设备状态 20190709新增
            case Configuration.FRESH_AIR_STATE_BACK_COMMAND:
                handleFreshAirStateData(getDatas);
                break;
            //获取地热设备状态
            case Configuration.GEOTHERMAL_MODULE_STATE_BACK_COMMAND:
@@ -1040,26 +1044,32 @@
                        List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
                        for (int j = 0, len2 = infos.size(); j < len2; j++) {
                            if (infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {
                                if(getDatas.addBytes.length >= 8){
                                    byte[] getBytes =  devicesDataList.get(i).getAppliancesInfoList().get(j).getFeedbackState();
                                    if(getBytes.length < 10){
                                        getBytes = new byte[10];
                            if(getDatas.addBytes.length > 0) {
                                if (infos.get(j).getChannelNum() == (getDatas.addBytes[0] & 0xFF)) {
                                    if (getDatas.addBytes.length >= 8) {
                                        byte[] getBytes = devicesDataList.get(i).getAppliancesInfoList().get(j).getFeedbackState();
                                        if (getBytes == null || getBytes.length < 10) {
                                            getBytes = new byte[10];
                                        }
                                        System.arraycopy(getDatas.addBytes, 0, getBytes, 0, 8);//控制地热状态反馈,只取前8位数据
                                        devicesDataList.get(i).getAppliancesInfoList().get(j).setFeedbackState(getBytes);
                                        AppliancesInfo mInfo = devicesDataList.get(i).getAppliancesInfoList().get(j);
                                        GeothermalBackInfo info = new GeothermalBackInfo(mInfo, true);
                                        isGeothermalCtrlSuccess = true;
                                        EventBus.getDefault().post(new GeothermalFeedBackEvent(info, EventCode.SUCCESS));
                                    } else {
//                                        AppliancesInfo mInfo = devicesDataList.get(i).getAppliancesInfoList().get(j);
//                                        GeothermalBackInfo info = new GeothermalBackInfo(mInfo, true);
//                                        isGeothermalCtrlSuccess = true;
//                                        EventBus.getDefault().post(new GeothermalFeedBackEvent(info, EventCode.DATAEMPTY));
                                        HDLLog.E("控制地热状态反馈数据异常");
                                    }
                                    System.arraycopy(getDatas.addBytes, 0, getBytes, 0, 8);//控制地热状态反馈,只取前8位数据
                                    devicesDataList.get(i).getAppliancesInfoList().get(j).setFeedbackState(getBytes);
                                    AppliancesInfo mInfo = devicesDataList.get(i).getAppliancesInfoList().get(j);
                                    GeothermalBackInfo info = new GeothermalBackInfo(mInfo , true);
                                    isGeothermalCtrlSuccess = true;
                                    EventBus.getDefault().post(new GeothermalFeedBackEvent(info, true));
                                }else{
                                    HDLLog.E("控制地热状态反馈数据异常");
                                    break outter;
                                }
                                break outter;
                            }
                        }
                    }
                }
@@ -1844,6 +1854,28 @@
                                devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setCurState(curState);
                                devicesDataList.get(devPos).getAppliancesInfoList().get(appPos).setIntCurState((int) curState);
                                break;
                            case Configuration.FRESH_AIR_BIG_TYPE://20190711新增
                                switch (infos.get(appPos).getLittleType()) {
                                    case Configuration.FRESH_AIR_LITTLE_TYPE_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).setFeedbackState(hvacBytes);
                                        break;
                                }
                                break;
                            case Configuration.GEOTHERMAL_BIG_TYPE://20190711新增
                                switch (infos.get(appPos).getLittleType()) {
                                    case Configuration.GEOTHERMAL_LITTLE_TYPE_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).setFeedbackState(hvacBytes);
                                        break;
                                }
                                break;
                            default:
                                HDLLog.info("未找到此类型设备:" + infos.get(appPos).getBigType());
                                break;
@@ -1910,6 +1942,7 @@
            ) {
                List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
                for (int j = 0, len2 = infos.size(); j < len2; j++) {
                    HDLLog.info("HDL big::"+devicesDataList.get(i).getAppliancesInfoList().get(j).getBigType());
                    switch (devicesDataList.get(i).getAppliancesInfoList().get(j).getBigType()) {
                        case Configuration.LIGTH_BIG_TYPE:
                            isGetDeviceStateSuccess = true;
@@ -2157,23 +2190,48 @@
                            HDLLog.info("发送传感器通知更新");
                            EventBus.getDefault().post(new SensorStateBackInfo(sensorInfo, true, unite));
                            break;
                        case Configuration.FRESH_AIR_BIG_TYPE://20190709新增
                            isGetDeviceStateSuccess = true;
                            devicesDataList.get(i).getAppliancesInfoList().get(j).setFeedbackState(getDatas.addBytes);
                            EventBus.getDefault().post(new DeviceStateEvent(devicesDataList.get(i).getAppliancesInfoList().get(j), true));
                            break;
                        default:
                            HDLLog.info("handle state 没有找到匹配类型");
                            break;
                    }
                    break outter;
//                    break outter;
                }
                break outter;
            }
        }
    }
    /**
     * 处理新风设备状态数据
     * 20190710新增
     * @param getDatas
     */
    private static void handleFreshAirStateData(UdpDataBean getDatas) {
        outter:
        for (int i = 0, len = devicesDataList.size(); i < len; i++) {
            if (devicesDataList.get(i).getSourceSubnetID() == getDatas.sourceSubnetID
                    && devicesDataList.get(i).getSourceDeviceID() == getDatas.sourceDeviceID
            ) {
                List<AppliancesInfo> infos = devicesDataList.get(i).getAppliancesInfoList();
                for (int j = 0, len2 = infos.size(); j < len2; j++) {
                    switch (devicesDataList.get(i).getAppliancesInfoList().get(j).getDeviceType()) {
                        case HDLApConfig.TYPE_FRESH_AIR:
                            isGetDeviceStateSuccess = true;
                            devicesDataList.get(i).getAppliancesInfoList().get(j).setFeedbackState(getDatas.addBytes);
                            EventBus.getDefault().post(new DeviceStateEvent(devicesDataList.get(i).getAppliancesInfoList().get(j), true));
                            break;
                        default:
                            HDLLog.info("handleFreshAirStateData 没有找到匹配类型");
                            break;
                    }
                }
                break outter;
            }
        }
    }
    /**
     * 处理地热设备状态数据
@@ -2193,7 +2251,7 @@
                            if(getDatas.addBytes.length >= 10) {
                                byte[] getBytes = devicesDataList.get(i).getAppliancesInfoList().get(j).getFeedbackState();
                                if (getBytes.length < 10) {
                                if (getBytes == null || getBytes.length < 10) {
                                    getBytes = new byte[10];
                                }
                                System.arraycopy(getDatas.addBytes, 0, getBytes, 0, 10);//20190710查询地热状态反馈,只取前10位数据
@@ -2206,10 +2264,10 @@
                            break;
                        default:
                            HDLLog.info("handle state 没有找到匹配类型");
                            HDLLog.info("handleGeothermalStateData 没有找到匹配类型");
                            break;
                    }
                    break outter;
                }
                break outter;
            }
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Core/HDLUdpCore.java
@@ -39,6 +39,8 @@
     * @param sendDatas
     */
    public static void sendData(final Crc sendDatas) {
//        HDLLog.info("HDLsendData:  "+ StringUtil.ByteArrToHex(sendDatas.GetSendBytes(),0, sendDatas.GetSendBytes().length));
//        sendTestCMD(sendDatas.GetSendBytes(), HDLTest.SEND_TEST_PORT);
        new Thread(new Runnable() {
@@ -335,6 +337,8 @@
            return;
        }
//        HDLLog.info("HDL ReceiveBytes:  "+ StringUtil.ByteArrToHex(receiveBytes,0, receiveBytes.length));
        //校验是否为HDL 数据
        byte[] hdlDataVerify = new byte[10];
        System.arraycopy(receiveBytes, 4, hdlDataVerify, 0, 10);
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/EventBusEvent/EventCode.java
New file
@@ -0,0 +1,10 @@
package com.hdl.sdk.hdl_core.HDLDeviceManger.EventBusEvent;
/**
 * Created by JLChen on 2019/7/15
 */
public class EventCode {
    public static final int SUCCESS = 0;
    public static final int FAILURE = -1;//失败超时
    public static final int DATAEMPTY = -2;//数据为空
}
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/EventBusEvent/GeothermalFeedBackEvent.java
@@ -7,21 +7,35 @@
 * 地热模块
 */
public class GeothermalFeedBackEvent {
    GeothermalBackInfo mGeothermalBackInfo;
//    boolean isSuccess;
    boolean isSuccess;
    int mStatusID;
    public GeothermalFeedBackEvent( GeothermalBackInfo geothermalBackInfo, boolean isSuccess){
    public GeothermalFeedBackEvent( GeothermalBackInfo geothermalBackInfo, int mStatusID){
        this.mGeothermalBackInfo = geothermalBackInfo;
        this.isSuccess = isSuccess;
        this.mStatusID = mStatusID;
    }
    public GeothermalBackInfo getGeothermalBackInfo() {
        return mGeothermalBackInfo;
    }
    public boolean isSuccess() {
        return isSuccess;
    public int getStatusID() {
        return mStatusID;
    }
//    public GeothermalFeedBackEvent( GeothermalBackInfo geothermalBackInfo, boolean isSuccess){
//        this.mGeothermalBackInfo = geothermalBackInfo;
//        this.isSuccess = isSuccess;
//    }
//
//    public GeothermalBackInfo getGeothermalBackInfo() {
//        return mGeothermalBackInfo;
//    }
//
//    public boolean isSuccess() {
//        return isSuccess;
//    }
}
hdl_core/src/main/java/com/hdl/sdk/hdl_core/HDLDeviceManger/Parser/DeviceParser.java
@@ -104,6 +104,7 @@
     * @return
     */
    private static boolean isWantData(int bigType, int littleType) {
//        HDLLog.info("isWantData:bigType:" + bigType + "littleType:" + littleType);
        boolean isWant;
        switch (bigType) {
            case Configuration.LIGTH_BIG_TYPE:
@@ -190,6 +191,26 @@
            case Configuration.GLOBAL_LOGIC_BIG_TYPE:
                switch (littleType) {
                    case 0:
                        isWant = true;
                        break;
                    default:
                        isWant = false;
                        break;
                }
                break;
            case Configuration.GEOTHERMAL_BIG_TYPE://20190711 新增
                switch (littleType) {
                    case Configuration.GEOTHERMAL_LITTLE_TYPE_0:
                        isWant = true;
                        break;
                    default:
                        isWant = false;
                        break;
                }
                break;
            case Configuration.FRESH_AIR_BIG_TYPE:
                switch (littleType) {
                    case Configuration.FRESH_AIR_LITTLE_TYPE_0:
                        isWant = true;
                        break;
                    default:
@@ -574,7 +595,7 @@
     */
    private static void parseGeothermalData(int littleType, AppliancesInfo appliancesInfo, DevicesData devicesData, String parentRemarks, int channelNum, int port, String ipAddress) {
        switch (littleType) {
            case 0:
            case Configuration.GEOTHERMAL_LITTLE_TYPE_0:
                appliancesInfo.setDeviceName("地热模块");
                appliancesInfo.setDeviceType(HDLApConfig.TYPE_GEOTHERMAL_MODULE);
                break;
hdl_core/src/main/java/com/hdl/sdk/hdl_core/Util/TransformUtil/HDLUtlis.java
New file
@@ -0,0 +1,94 @@
package com.hdl.sdk.hdl_core.Util.TransformUtil;
import java.math.BigDecimal;
/**
 * Created by JLChen on 2019/7/4
 */
public class HDLUtlis {
    /**
     * 将object转为Integer类型
     *
     * @param object
     * @return
     */
    public static Integer getIntegerByObject(Object object) {
        Integer in = 0;
        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;
    }
    /**
     * 4 byte 转换为float类型
     *
     * @param b1
     * @param b2
     * @param b3
     * @param b4
     * @return
     */
    public static float byteToFloat(byte b1, byte b2, byte b3, byte b4) {
        byte[] mByte = new byte[4];
        mByte[0] = b1;
        mByte[1] = b2;
        mByte[2] = b3;
        mByte[3] = b4;
        return byteArrayToFloat(mByte);
    }
    /**
     * byte[4]数组 转换为float类型
     *
     * @param arr 长度为4
     * @return
     */
    public static float byteArrayToFloat(byte[] arr) {
        try {
            return Float.intBitsToFloat(getInt(arr));
        } catch (Exception e) {
            e.printStackTrace();
            return 0;
        }
    }
    /**
     * 连续4个字节获得一个int
     *
     * @param arr
     * @return int
     */
    public static int getInt(byte[] arr) {
        return (0xff000000 & (arr[0] << 24)) |
                (0x00ff0000 & (arr[1] << 16)) |
                (0x0000ff00 & (arr[2] << 8)) |
                (0x000000ff & arr[3]);
    }
    /**
     * float转换为byte[4]数组
     *
     * @param f
     * @return
     */
    public static byte[] getByteArray(float f) {
        int intbits = Float.floatToIntBits(f);//将float里面的二进制串解释为int整数
        return getByteArray(intbits);
    }
}
hdl_core/src/main/java/com/hdl/sdk/hdl_core/Util/TransformUtil/StringUtil.java
@@ -85,38 +85,7 @@
    }
    public static float byteToFloat(byte b1, byte b2, byte b3, byte b4){
        byte[] mByte = new byte[4];
        mByte[0] = b1;
        mByte[1] = b2;
        mByte[2] = b3;
        mByte[3] = b4;
        return byteArrayToFloat(mByte);
    }
    // 从byte数组的index处的连续4个字节获得一个int
    public static int getInt(byte[] arr) {
        return     (0xff000000     & (arr[0] << 24))  |
                (0x00ff0000     & (arr[1] << 16))  |
                (0x0000ff00     & (arr[2] << 8))   |
                (0x000000ff     &  arr[3]);
    }
    // float转换为byte[4]数组
    public static byte[] getByteArray(float f) {
        int intbits = Float.floatToIntBits(f);//将float里面的二进制串解释为int整数
        return getByteArray(intbits);
    }
    // 从byte数组的index处的连续4个字节获得一个float
    public static float byteArrayToFloat(byte[] arr) {
        try {
            return Float.intBitsToFloat(getInt(arr));
        } catch (Exception e) {
            e.printStackTrace();
            return 0;
        }
    }
//    private byte[] formatStyleHDLResponse(String responsePart1, String responsePart2, int maxLen) throws UnsupportedEncodingException {
//        String responsePart3 = HDL_END_STR;
@@ -191,5 +160,20 @@
//        return;
//    }
    //-------------------------------------------------------
    //字节数组转转hex字符串,可选长度
    public static String ByteArrToHex(byte[] inBytArr, int offset, int byteCount) {
        StringBuilder strBuilder = new StringBuilder();
        int j = byteCount;
        for (int i = offset; i < j; i++) {
            strBuilder.append(Byte2Hex(Byte.valueOf(inBytArr[i])));
        }
        return strBuilder.toString();
    }
    //-------------------------------------------------------
    //1字节转2个Hex字符
    public static String Byte2Hex(Byte inByte) {
        return String.format("%02x", new Object[]{inByte}).toUpperCase();
    }
}