package com.hdl.sdk.ttl.HDLDeviceManger.Parser;
|
|
import static com.hdl.sdk.ttl.HDLDeviceManger.Core.HDLDeviceManager.devicesDataList;
|
|
import android.util.Log;
|
|
import com.hdl.sdk.ttl.Config.Configuration;
|
import com.hdl.sdk.ttl.HDLAppliances.Config.HDLApConfig;
|
import com.hdl.sdk.ttl.HDLDeviceManger.Bean.AppliancesInfo;
|
import com.hdl.sdk.ttl.HDLDeviceManger.Bean.DevicesData;
|
import com.hdl.sdk.ttl.HDLDeviceManger.Core.HandleSearch;
|
import com.hdl.sdk.ttl.Utils.LogUtils.HDLLog;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
|
/**
|
* Created by djl on 2017/3/29.
|
*/
|
|
public class DeviceParser {
|
|
/**
|
* 处理解析、设置某一回路的所有信息
|
*
|
* @param addBytes
|
* @param devicesData
|
* @param parentRemarks
|
* @return 172.168.52.51 固件版本号2018/08/29
|
*/
|
public static boolean parse(byte[] addBytes, DevicesData devicesData, String parentRemarks) {
|
boolean isExitData = false;
|
int residue = addBytes.length - 8;
|
int sumCount = residue / 3;//记录总共有多少种设备
|
List<AppliancesInfo> appliancesInfoList = new ArrayList<>();
|
if (sumCount == 0) {
|
AppliancesInfo appliancesInfo = new AppliancesInfo();
|
appliancesInfo.setDeviceName(Configuration.UNKNOW_TYPE);
|
appliancesInfoList.add(appliancesInfo);
|
}
|
// 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 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;
|
int index = 0;
|
while (curChannelNum < channelNum) {
|
curChannelNum++;//有可能不是从1开始的,所以增加index判断
|
index++;
|
if (isWantData(bigType, littleType)) {
|
AppliancesInfo appliancesInfo = new AppliancesInfo();
|
appliancesInfo.setDeviceSubnetID(subnetID);
|
appliancesInfo.setDeviceDeviceID(deviceID);
|
|
/**根据类别,赋值操作码等一些重要信息*/
|
switch (bigType) {
|
case Configuration.LIGTH_BIG_TYPE:
|
parseLightData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, index, "");
|
break;
|
case Configuration.CURTAIN_BIG_TYPE:
|
parseCurtainData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, index, "");
|
break;
|
case Configuration.AIR_BIG_TYPE:
|
parseAirData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, index, "");
|
break;
|
case Configuration.AUDIO_BIG_TYPE:
|
parseAudioData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, index, "");
|
break;
|
case Configuration.LOGIC_BIG_TYPE:
|
parseLogicData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, index, "");
|
break;
|
case Configuration.GLOBAL_LOGIC_BIG_TYPE:
|
parseGlobalLogicData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, index, "");
|
break;
|
case Configuration.SECURITY_BIG_TYPE://2019-7-29 新增
|
parseSecurityData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, index, "");
|
break;
|
case Configuration.SENSOR_BIG_TYPE:
|
parseSensorData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, index, "");
|
break;
|
case Configuration.COMMON_SWITCH_BIG_TYPE://2020-04-01 通用开关
|
parseCommonSwitchData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, index, "");
|
break;
|
case Configuration.FRESH_AIR_BIG_TYPE://2020-07-20 新增新风
|
parseFreshAirData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, index, "");
|
break;
|
case Configuration.GEOTHERMAL_BIG_TYPE://地热
|
parseGeothermalData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, index, "");
|
break;
|
case Configuration.DOOR_MACHINE_BIG_TYPE://门锁
|
parseDoorMachineData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, index, "");
|
break;
|
default:
|
// appliancesInfo.setDeviceName(Configuration.UNKNOW_TYPE);
|
break;
|
}
|
|
isExitData = true;
|
String key = "K" + appliancesInfo.getBigType()
|
+ "-" + appliancesInfo.getLittleType()
|
+ "-" + appliancesInfo.getDeviceSubnetID()
|
+ "-" + appliancesInfo.getDeviceDeviceID()
|
+ "-" + appliancesInfo.getChannelNum();
|
|
appliancesInfo.setDeviceKey(key);//2019-8-2 添加唯一标识key
|
appliancesInfoList.add(appliancesInfo);
|
HDLLog.I("向模块添加回路:" + "大类:" + bigType + " 小类:" + littleType + " 模块备注" + devicesData.getRemark());
|
} else {
|
HDLLog.I("不是要添加的设备:大类:" + bigType + " 小类:" + littleType + " 模块备注" + devicesData.getRemark());
|
}
|
}
|
}
|
if (isExitData && devicesData != null) {
|
devicesData.setAppliancesInfoList(appliancesInfoList);
|
}
|
return isExitData;
|
}
|
|
|
/**
|
* 判断是否支持的设备,若不是支持设备则过滤掉。
|
* 通过判断大类小类,选择是否过滤设备
|
*
|
* @param bigType
|
* @param littleType
|
* @return SDK目前支持的大类:小类
|
* 灯光类1:0 ,1,9,10
|
* 窗帘类2:0,1,2,6
|
* 传感器5:0~24
|
* 空调类7:0,3
|
* 背景音乐功能9:0
|
* 逻辑功能12:0
|
* 全局场景17:0
|
* 安防10:0
|
*/
|
public static boolean isWantData(int bigType, int littleType) {
|
boolean isWant;
|
switch (bigType) {
|
case Configuration.LIGTH_BIG_TYPE:
|
switch (littleType) {
|
case 0:
|
case 1:
|
case 2:
|
case 3:
|
case 7:
|
case 8:
|
case 9:
|
case 10:
|
isWant = true;
|
break;
|
default:
|
isWant = false;
|
break;
|
}
|
break;
|
case Configuration.CURTAIN_BIG_TYPE:
|
switch (littleType) {
|
case 0:
|
case 1:
|
case 2:
|
case 6:
|
isWant = true;
|
break;
|
default:
|
isWant = false;
|
break;
|
}
|
break;
|
case Configuration.AIR_BIG_TYPE:
|
switch (littleType) {
|
case 0:
|
case 3:
|
case 100:
|
case 101:
|
isWant = true;
|
break;
|
default:
|
isWant = false;
|
break;
|
}
|
break;
|
case Configuration.AUDIO_BIG_TYPE:
|
switch (littleType) {
|
case 0:
|
isWant = true;
|
break;
|
// case 1:
|
// isWant = true;
|
// break;
|
case 3://2019-7-29
|
isWant = true;
|
break;
|
default:
|
isWant = false;
|
break;
|
}
|
break;
|
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;
|
}
|
break;
|
case Configuration.LOGIC_BIG_TYPE:
|
switch (littleType) {
|
case 0:
|
isWant = true;
|
break;
|
default:
|
isWant = false;
|
break;
|
}
|
break;
|
case Configuration.SECURITY_BIG_TYPE:
|
switch (littleType) {
|
case 0:
|
isWant = true;
|
break;
|
// case 2:
|
// isWant = true;
|
// break;
|
default:
|
isWant = false;
|
break;
|
}
|
break;
|
case Configuration.GLOBAL_LOGIC_BIG_TYPE://屏蔽全局场景 2019-9-27
|
switch (littleType) {
|
case 0:
|
isWant = true;
|
break;
|
default:
|
isWant = false;
|
break;
|
}
|
break;
|
case Configuration.COMMON_SWITCH_BIG_TYPE://通用开关设备
|
switch (littleType) {
|
case 0:
|
isWant = true;
|
break;
|
default:
|
isWant = false;
|
break;
|
}
|
break;
|
case Configuration.FRESH_AIR_BIG_TYPE://新风设备 2020-07-20
|
switch (littleType) {
|
case 0:
|
case 1:
|
isWant = true;
|
break;
|
default:
|
isWant = false;
|
break;
|
}
|
break;
|
case Configuration.GEOTHERMAL_BIG_TYPE://地热设备 2020-07-20
|
switch (littleType) {
|
case 0:
|
case 3:
|
isWant = true;
|
break;
|
default:
|
isWant = false;
|
break;
|
}
|
break;
|
case Configuration.DOOR_MACHINE_BIG_TYPE://门锁设备 2023-08-22
|
switch (littleType) {
|
case 4:
|
isWant = true;
|
break;
|
default:
|
isWant = false;
|
break;
|
}
|
break;
|
default:
|
isWant = false;
|
break;
|
}
|
return isWant;
|
}
|
|
|
private static void parseLightData(int littleType, AppliancesInfo appliancesInfo, DevicesData devicesData, String parentRemarks, int channelNum, int index, String ipAddress) {
|
switch (littleType) {
|
case 0:
|
appliancesInfo.setDeviceName("调光回路");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_LIGHT_DIMMER);
|
break;
|
case 1:
|
appliancesInfo.setDeviceName("开关回路");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_LIGHT_RELAY);
|
break;
|
case 2:
|
appliancesInfo.setDeviceName("逻辑灯控制CCT");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_LIGHT_CCT);
|
break;
|
case 3:
|
appliancesInfo.setDeviceName("逻辑灯RGB");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_LIGHT_RGB);
|
break;
|
case 4:
|
appliancesInfo.setDeviceName("逻辑灯RGBW");
|
break;
|
case 5:
|
appliancesInfo.setDeviceName("逻辑灯RGB+CCT");
|
break;
|
case 6:
|
appliancesInfo.setDeviceName("混合类 Dimmer+Relay");
|
break;
|
case 7:
|
appliancesInfo.setDeviceName("DALI");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_LIGHT_DALI);
|
break;
|
case 8:
|
appliancesInfo.setDeviceName("自定义逻辑灯");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_LIGHT_DMX);
|
break;
|
case 9:
|
appliancesInfo.setDeviceName("混合调光类");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_LIGHT_MIX_DIMMER);
|
break;
|
case 10:
|
appliancesInfo.setDeviceName("混合开关类");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_LIGHT_MIX_RELAY);
|
break;
|
default:
|
appliancesInfo.setDeviceName(Configuration.UNKNOW_TYPE);
|
break;
|
}
|
if (devicesData != null) {
|
appliancesInfo.setChannelNum(channelNum);
|
appliancesInfo.setDeviceIndex(index);
|
appliancesInfo.setBigType(Configuration.LIGTH_BIG_TYPE);
|
appliancesInfo.setLittleType(littleType);
|
|
if (appliancesInfo.getDeviceType() == HDLApConfig.TYPE_LIGHT_CCT || appliancesInfo.getDeviceType() == HDLApConfig.TYPE_LIGHT_RGB || appliancesInfo.getDeviceType() == HDLApConfig.TYPE_LIGHT_DALI || appliancesInfo.getDeviceType() == HDLApConfig.TYPE_LIGHT_DMX) {
|
appliancesInfo.setCtrlCommand(Configuration.LIGHT_RGB_CTRL_COMMAND);
|
appliancesInfo.setCtrlBackCommand(Configuration.LIGHT_RGB_CTRL_BACK_COMMAND);
|
appliancesInfo.setStateCommand(Configuration.LIGHT_RGB_STATE_COMMAND);
|
appliancesInfo.setStateBackCommand(Configuration.LIGHT_RGB_STATE_BACK_COMMAND);
|
} else {
|
appliancesInfo.setCtrlCommand(Configuration.LIGHT_CTRL_COMMAND);
|
appliancesInfo.setCtrlBackCommand(Configuration.LIGHT_CTRL_BACK_COMMAND);
|
appliancesInfo.setStateCommand(Configuration.LIGHT_STATE_COMMAND);
|
appliancesInfo.setStateBackCommand(Configuration.LIGHT_STATE_BACK_COMMAND);
|
}
|
appliancesInfo.setSourceSubnetID(devicesData.getSourceSubnetID());
|
appliancesInfo.setSourceDeviceID(devicesData.getSourceDeviceID());
|
appliancesInfo.setParentRemarks(parentRemarks);
|
// appliancesInfo.setPort(port);
|
// appliancesInfo.setIpAddress(ipAddress);
|
}
|
}
|
|
private static void parseCurtainData(int littleType, AppliancesInfo appliancesInfo, DevicesData devicesData, String parentRemarks, int channelNum, int index, String ipAddress) {
|
switch (littleType) {
|
case 0:
|
appliancesInfo.setDeviceName("开合帘电机");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_CURTAIN_GLYSTRO);
|
break;
|
case 1:
|
appliancesInfo.setDeviceName("卷帘电机");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_CURTAIN_ROLLER);
|
break;
|
case 2:
|
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;
|
|
}
|
if (devicesData != null) {
|
appliancesInfo.setChannelNum(channelNum);
|
appliancesInfo.setDeviceIndex(index);
|
appliancesInfo.setBigType(Configuration.CURTAIN_BIG_TYPE);
|
appliancesInfo.setLittleType(littleType);
|
appliancesInfo.setCtrlCommand(Configuration.CURTAIN_CTRL_COMMAND);
|
appliancesInfo.setCtrlBackCommand(Configuration.CURTAIN_CTRL_BACK_COMMAND);
|
appliancesInfo.setStateCommand(Configuration.CURTAIN_STATE_COMMAND);
|
appliancesInfo.setStateBackCommand(Configuration.CURTAIN_STATE_BACK_COMMAND);
|
appliancesInfo.setSourceSubnetID(devicesData.getSourceSubnetID());
|
appliancesInfo.setSourceDeviceID(devicesData.getSourceDeviceID());
|
appliancesInfo.setParentRemarks(parentRemarks);
|
}
|
}
|
|
private static void parseAirData(int littleType, AppliancesInfo appliancesInfo, DevicesData devicesData, String parentRemarks, int channelNum, int index, String ipAddress) {
|
switch (littleType) {
|
case 0:
|
appliancesInfo.setDeviceName("HVAC 模块");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_AC_HVAC);
|
break;
|
case 1:
|
appliancesInfo.setDeviceName("Coolmaster 控制模块");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_AC_COOLMASTER);
|
break;
|
case 2:
|
appliancesInfo.setDeviceName("红外空调模块");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_AC_INFRARED);
|
break;
|
case 3:
|
appliancesInfo.setDeviceName("通用空调面板");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_AC_PANEL);
|
break;
|
case 100:
|
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;
|
|
}
|
if (devicesData != null) {
|
appliancesInfo.setChannelNum(channelNum);
|
appliancesInfo.setDeviceIndex(index);
|
appliancesInfo.setBigType(Configuration.AIR_BIG_TYPE);
|
appliancesInfo.setLittleType(littleType);
|
appliancesInfo.setSourceSubnetID(devicesData.getSourceSubnetID());
|
appliancesInfo.setSourceDeviceID(devicesData.getSourceDeviceID());
|
appliancesInfo.setParentRemarks(parentRemarks);
|
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);
|
appliancesInfo.setStateBackCommand(Configuration.AIR_HVAC_STATE_BACK_COMMAND);
|
} else {
|
appliancesInfo.setCtrlCommand(Configuration.AIR_CTRL_COMMAND);
|
appliancesInfo.setCtrlBackCommand(Configuration.AIR_CTRL_BACK_COMMAND);
|
appliancesInfo.setStateCommand(Configuration.AIR_STATE_COMMAND);
|
appliancesInfo.setStateBackCommand(Configuration.AIR_STATE_BACK_COMMAND);
|
|
}
|
|
|
}
|
}
|
|
private static void parseAudioData(int littleType, AppliancesInfo appliancesInfo, DevicesData devicesData, String parentRemarks, int channelNum, int index, String ipAddress) {
|
switch (littleType) {
|
case 0:
|
appliancesInfo.setDeviceName("背景音乐模块");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_MUSIC_MODULE);
|
break;
|
// case 1:
|
// appliancesInfo.setDeviceName("第三方背景音乐模块");
|
// appliancesInfo.setDeviceType(HDLApConfig.TYPE_MUSIC_THIRD_PARTY_MODULE);
|
// break;
|
// case 3:
|
// appliancesInfo.setDeviceName("2018新背景音乐模块");
|
// appliancesInfo.setDeviceType(HDLApConfig.TYPE_MUSIC_NEW_MODULE);
|
// break;
|
default:
|
break;
|
}
|
|
if (devicesData != null) {
|
appliancesInfo.setChannelNum(channelNum);
|
appliancesInfo.setDeviceIndex(index);
|
appliancesInfo.setBigType(Configuration.AUDIO_BIG_TYPE);
|
appliancesInfo.setLittleType(littleType);
|
appliancesInfo.setCtrlCommand(Configuration.AUDIO_CTRL_READ_COMMAND);
|
appliancesInfo.setCtrlBackCommand(Configuration.AUDIO_CTRL_READ_BACK_COMMAND);
|
appliancesInfo.setStateCommand(Configuration.AUDIO_MenuPlay_INSTRUCTION_COMMAND);
|
appliancesInfo.setStateBackCommand(Configuration.AUDIO_MenuPlay_INSTRUCTION_BACK_COMMAND);
|
appliancesInfo.setSourceSubnetID(devicesData.getSourceSubnetID());
|
appliancesInfo.setSourceDeviceID(devicesData.getSourceDeviceID());
|
appliancesInfo.setParentRemarks(parentRemarks);
|
}
|
HDLLog.I("音乐模块:" + parentRemarks);
|
}
|
|
private static void parseLogicData(int littleType, AppliancesInfo appliancesInfo, DevicesData devicesData, String parentRemarks, int channelNum, int index, String ipAddress) {
|
switch (littleType) {
|
case 0:
|
appliancesInfo.setDeviceName("逻辑模块");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_LOGIC_MODULE);
|
break;
|
default:
|
appliancesInfo.setDeviceName(Configuration.UNKNOW_TYPE);
|
break;
|
}
|
|
if (devicesData != null) {
|
appliancesInfo.setChannelNum(channelNum);
|
appliancesInfo.setDeviceIndex(index);
|
appliancesInfo.setBigType(Configuration.LOGIC_BIG_TYPE);
|
appliancesInfo.setLittleType(littleType);
|
appliancesInfo.setCtrlCommand(Configuration.LOGIC_CTRL_COMMAND);
|
appliancesInfo.setCtrlBackCommand(Configuration.LOGIC_CTRL_BACK_COMMAND);
|
appliancesInfo.setStateCommand(Configuration.LOGIC_STATE_COMMAND);
|
appliancesInfo.setStateBackCommand(Configuration.LOGIC_STATE_BACK_COMMAND);
|
appliancesInfo.setSourceSubnetID(devicesData.getSourceSubnetID());
|
appliancesInfo.setSourceDeviceID(devicesData.getSourceDeviceID());
|
appliancesInfo.setParentRemarks(parentRemarks);
|
|
}
|
}
|
|
private static void parseGlobalLogicData(int littleType, AppliancesInfo appliancesInfo, DevicesData devicesData, String parentRemarks, int channelNum, int index, String ipAddress) {
|
switch (littleType) {
|
case 0:
|
appliancesInfo.setDeviceName("全局逻辑模块");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_GLOBAL_LOGIC_MODULE);
|
break;
|
default:
|
appliancesInfo.setDeviceName(Configuration.UNKNOW_TYPE);
|
break;
|
}
|
|
if (devicesData != null) {
|
appliancesInfo.setChannelNum(channelNum);
|
appliancesInfo.setDeviceIndex(index);
|
appliancesInfo.setBigType(Configuration.GLOBAL_LOGIC_BIG_TYPE);
|
appliancesInfo.setLittleType(littleType);
|
appliancesInfo.setCtrlCommand(Configuration.LOGIC_CTRL_COMMAND);
|
appliancesInfo.setCtrlBackCommand(Configuration.LOGIC_CTRL_BACK_COMMAND);
|
appliancesInfo.setStateCommand(Configuration.LOGIC_STATE_COMMAND);
|
appliancesInfo.setStateBackCommand(Configuration.LOGIC_STATE_BACK_COMMAND);
|
appliancesInfo.setSourceSubnetID(devicesData.getSourceSubnetID());
|
appliancesInfo.setSourceDeviceID(devicesData.getSourceDeviceID());
|
appliancesInfo.setParentRemarks(parentRemarks);
|
|
}
|
}
|
|
/**
|
* 2019-7-29 新增
|
*
|
* @param littleType
|
* @param appliancesInfo
|
* @param devicesData
|
* @param parentRemarks
|
* @param channelNum
|
* @param port
|
* @param ipAddress
|
*/
|
private static void parseSecurityData(int littleType, AppliancesInfo appliancesInfo, DevicesData devicesData, String parentRemarks, int channelNum, int index, String ipAddress) {
|
switch (littleType) {
|
case 0:
|
appliancesInfo.setDeviceName("安防模块");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SECURITY_MODULE);
|
break;
|
// case 2:
|
// appliancesInfo.setDeviceName("安防控制面板");
|
// appliancesInfo.setDeviceType(HDLApConfig.SECURITY_CONTROL_PANEL);
|
// break;
|
default:
|
appliancesInfo.setDeviceName(Configuration.UNKNOW_TYPE);
|
break;
|
|
}
|
if (devicesData != null) {
|
appliancesInfo.setChannelNum(channelNum);
|
appliancesInfo.setDeviceIndex(index);
|
appliancesInfo.setBigType(Configuration.SECURITY_BIG_TYPE);
|
appliancesInfo.setLittleType(littleType);
|
appliancesInfo.setSourceSubnetID(devicesData.getSourceSubnetID());
|
appliancesInfo.setSourceDeviceID(devicesData.getSourceDeviceID());
|
appliancesInfo.setParentRemarks(parentRemarks);
|
appliancesInfo.setCtrlCommand(Configuration.SECURITY_ARMING_CTRL_COMMAND);//布防
|
appliancesInfo.setCtrlBackCommand(Configuration.SECURITY_ARMING_CTRL_BACK_COMMAND);//布防设置反馈
|
appliancesInfo.setStateCommand(Configuration.SECURITY_STATE_COMMAND);//读取安防设置
|
appliancesInfo.setStateBackCommand(Configuration.SECURITY_STATE_BACK_COMMAND);//读取安防设置反馈
|
|
|
// if (littleType == 0) {
|
// appliancesInfo.setCtrlCommand(Configuration.SECURITY_ARMING_CTRL_COMMAND);//布防
|
// appliancesInfo.setCtrlBackCommand(Configuration.SECURITY_ARMING_CTRL_BACK_COMMAND);
|
// appliancesInfo.setStateCommand(Configuration.SECURITY_STATE_COMMAND);
|
// appliancesInfo.setStateBackCommand(Configuration.SECURITY_STATE_BACK_COMMAND);
|
// } else {
|
// appliancesInfo.setCtrlCommand(Configuration.SECURITY_ARMING_CTRL_COMMAND);//布防
|
// appliancesInfo.setCtrlBackCommand(Configuration.SECURITY_ARMING_CTRL_BACK_COMMAND);
|
// appliancesInfo.setStateCommand(Configuration.SECURITY_STATE_COMMAND);
|
// appliancesInfo.setStateBackCommand(Configuration.SECURITY_STATE_BACK_COMMAND);
|
//
|
// }
|
|
|
}
|
}
|
|
|
// 2019-07-03 屏蔽 2019-11-5 传感器都改为干接点实现
|
private static void parseSensorData(int littleType, AppliancesInfo appliancesInfo, DevicesData devicesData, String parentRemarks, int channelNum, int index, String ipAddress) {
|
switch (littleType) {
|
case 0:
|
appliancesInfo.setDeviceName("传感器 干结点");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_DRY_CONTACT);
|
break;
|
case 1:
|
appliancesInfo.setDeviceName("传感器 移动探测");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_MOVEMENT_DETECTOR);
|
break;
|
case 2:
|
appliancesInfo.setDeviceName("传感器 温度");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_TEMP);
|
break;
|
case 3:
|
appliancesInfo.setDeviceName("传感器 湿度");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_HUMIDITY);
|
break;
|
case 4:
|
appliancesInfo.setDeviceName("传感器 照度");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_ILLUMINACE);
|
break;
|
case 5:
|
appliancesInfo.setDeviceName("传感器 VOC");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_VOC);
|
break;
|
case 6:
|
appliancesInfo.setDeviceName("传感器 PM2.5");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_PM_2_POINT_5);
|
break;
|
case 7:
|
appliancesInfo.setDeviceName("传感器 CO2");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_C02);
|
break;
|
case 8:
|
appliancesInfo.setDeviceName("传感器 液化石油气");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_LPG);
|
break;
|
case 9:
|
appliancesInfo.setDeviceName("传感器 人工煤气(CO,H2");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_CO_H2);
|
break;
|
case 10:
|
appliancesInfo.setDeviceName("传感器 天然气(CH4)");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_CH4);
|
break;
|
case 11:
|
appliancesInfo.setDeviceName("传感器 烟雾");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_SMOG);
|
break;
|
case 12:
|
appliancesInfo.setDeviceName("传感器 风速");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_WIND_SPEED);
|
break;
|
case 13:
|
appliancesInfo.setDeviceName("传感器 风压");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_WIND_PRESSURE);
|
break;
|
case 14:
|
appliancesInfo.setDeviceName("传感器 液体流量");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_LIQUID_FLOW);
|
break;
|
case 15:
|
appliancesInfo.setDeviceName("传感器 液体压力");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_LIQUID_PRESSURE);
|
break;
|
case 16:
|
appliancesInfo.setDeviceName("传感器 液体深度 ");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_LIQUID_DEPTH);
|
break;
|
case 17:
|
appliancesInfo.setDeviceName("传感器 雨量");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_RAIN_FALL);
|
break;
|
case 18:
|
appliancesInfo.setDeviceName("传感器 重量");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_WEIGHT);
|
break;
|
case 19:
|
appliancesInfo.setDeviceName("传感器 高度/长度");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_HEIGHT_LENGTH);
|
break;
|
case 20:
|
appliancesInfo.setDeviceName("传感器 物体速度");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_OBJECT_SPEED);
|
break;
|
case 21:
|
appliancesInfo.setDeviceName("传感器 震动");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_SHAKE);
|
break;
|
case 22:
|
appliancesInfo.setDeviceName("传感器 电压");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_VOLTAGE);
|
break;
|
case 23:
|
appliancesInfo.setDeviceName("传感器 电流");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_ELECTRICITY);
|
break;
|
case 24:
|
appliancesInfo.setDeviceName("传感器 功率");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_POWER);
|
break;
|
case 25:
|
appliancesInfo.setDeviceName("传感器 水浸");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_FLOODING);
|
break;
|
case 26:
|
appliancesInfo.setDeviceName("传感器 门磁窗磁");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_SENSOR_DOOR_MAGNET);
|
break;
|
case 27:
|
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);
|
break;
|
}
|
|
|
if (devicesData != null) {
|
appliancesInfo.setChannelNum(channelNum);
|
appliancesInfo.setDeviceIndex(index);
|
appliancesInfo.setBigType(Configuration.SENSOR_BIG_TYPE);
|
appliancesInfo.setLittleType(littleType);
|
|
appliancesInfo.setSourceSubnetID(devicesData.getSourceSubnetID());
|
appliancesInfo.setSourceDeviceID(devicesData.getSourceDeviceID());
|
appliancesInfo.setParentRemarks(parentRemarks);
|
|
appliancesInfo.setStateCommand(Configuration.SENSOR_STATE_COMMAND);
|
appliancesInfo.setStateBackCommand(Configuration.SENSOR_STATE_BACK_COMMAND);
|
}
|
|
}
|
|
|
/**
|
* 2020-07-20
|
* 新风系统
|
*/
|
private static void parseFreshAirData(int littleType, AppliancesInfo appliancesInfo, DevicesData devicesData, String parentRemarks, int channelNum, int index, String ipAddress) {
|
switch (littleType) {
|
case 0:
|
appliancesInfo.setDeviceName("新风系统模块");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_FRESH_AIR);
|
appliancesInfo.setCtrlCommand(Configuration.FRESH_AIR_CTRL_COMMAND);
|
appliancesInfo.setCtrlBackCommand(Configuration.FRESH_AIR_CTRL_BACK_COMMAND);
|
appliancesInfo.setStateCommand(Configuration.FRESH_AIR_STATE_COMMAND);
|
appliancesInfo.setStateBackCommand(Configuration.FRESH_AIR_STATE_BACK_COMMAND);
|
break;
|
case 1:
|
appliancesInfo.setDeviceName("金茂新风");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_FRESH_AIR_JINMAO);
|
appliancesInfo.setCtrlCommand(Configuration.FRESH_AIR_JINMAO_CTRL_COMMAND);
|
appliancesInfo.setCtrlBackCommand(Configuration.FRESH_AIR_JINMAO_CTRL_BACK_COMMAND);
|
appliancesInfo.setStateCommand(Configuration.FRESH_AIR_JINMAO_STATE_COMMAND);
|
appliancesInfo.setStateBackCommand(Configuration.FRESH_AIR_JINMAO_STATE_BACK_COMMAND);
|
break;
|
default:
|
appliancesInfo.setDeviceName(Configuration.UNKNOW_TYPE);
|
break;
|
}
|
|
if (devicesData != null) {
|
appliancesInfo.setChannelNum(channelNum);
|
appliancesInfo.setDeviceIndex(index);
|
appliancesInfo.setBigType(Configuration.FRESH_AIR_BIG_TYPE);
|
appliancesInfo.setLittleType(littleType);
|
appliancesInfo.setSourceSubnetID(devicesData.getSourceSubnetID());
|
appliancesInfo.setSourceDeviceID(devicesData.getSourceDeviceID());
|
appliancesInfo.setParentRemarks(parentRemarks);
|
}
|
}
|
|
|
/**
|
* 地热
|
*/
|
private static void parseGeothermalData(int littleType, AppliancesInfo appliancesInfo, DevicesData devicesData, String parentRemarks, int channelNum, int index, String ipAddress) {
|
switch (littleType) {
|
case 0:
|
appliancesInfo.setDeviceName("地热模块");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_GEOTHERMAL_MODULE);
|
break;
|
// case 1:
|
// appliancesInfo.setDeviceName("常规地热面板");
|
// appliancesInfo.setDeviceType(HDLApConfig.TYPE_GEOTHERMAL_MODULE_PANEL);
|
// break;
|
// case 2:
|
// appliancesInfo.setDeviceName("带PI运算的地热面板");
|
// appliancesInfo.setDeviceType(HDLApConfig.TYPE_GEOTHERMAL_MODULE_PI);
|
// break;
|
case 3:
|
appliancesInfo.setDeviceName("特殊地热模块");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_GEOTHERMAL_JINMAO);
|
break;
|
default:
|
appliancesInfo.setDeviceName(Configuration.UNKNOW_TYPE);
|
break;
|
|
}
|
if (devicesData != null) {
|
appliancesInfo.setChannelNum(channelNum);
|
appliancesInfo.setDeviceIndex(index);
|
appliancesInfo.setBigType(Configuration.GEOTHERMAL_BIG_TYPE);
|
appliancesInfo.setLittleType(littleType);
|
appliancesInfo.setSourceSubnetID(devicesData.getSourceSubnetID());
|
appliancesInfo.setSourceDeviceID(devicesData.getSourceDeviceID());
|
appliancesInfo.setParentRemarks(parentRemarks);
|
|
appliancesInfo.setCtrlCommand(Configuration.GEOTHERMAL_MODULE_CTRL_COMMAND);
|
appliancesInfo.setCtrlBackCommand(Configuration.GEOTHERMAL_MODULE_CTRL_BACK_COMMAND);
|
appliancesInfo.setStateCommand(Configuration.GEOTHERMAL_MODULE_STATE_COMMAND);
|
appliancesInfo.setStateBackCommand(Configuration.GEOTHERMAL_MODULE_STATE_BACK_COMMAND);
|
|
|
}
|
}
|
|
|
/**
|
* 门锁
|
*/
|
private static void parseDoorMachineData(int littleType, AppliancesInfo appliancesInfo, DevicesData devicesData, String parentRemarks, int channelNum, int index, String ipAddress) {
|
switch (littleType) {
|
case 4:
|
appliancesInfo.setDeviceName("门锁模块");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_DOOR_MACHINE);
|
break;
|
default:
|
appliancesInfo.setDeviceName(Configuration.UNKNOW_TYPE);
|
break;
|
}
|
if (devicesData != null) {
|
appliancesInfo.setChannelNum(channelNum);
|
appliancesInfo.setDeviceIndex(index);
|
appliancesInfo.setBigType(Configuration.DOOR_MACHINE_BIG_TYPE);
|
appliancesInfo.setLittleType(littleType);
|
appliancesInfo.setSourceSubnetID(devicesData.getSourceSubnetID());
|
appliancesInfo.setSourceDeviceID(devicesData.getSourceDeviceID());
|
appliancesInfo.setParentRemarks(parentRemarks);
|
|
appliancesInfo.setCtrlCommand(Configuration.DOOR_MACHINE_MODULE_CTRL_COMMAND);
|
appliancesInfo.setCtrlBackCommand(Configuration.DOOR_MACHINE_MODULE_CTRL_BACK_COMMAND);
|
appliancesInfo.setStateCommand(Configuration.DOOR_MACHINE_MODULE_STATE_COMMAND);
|
appliancesInfo.setStateBackCommand(Configuration.DOOR_MACHINE_MODULE_STATE_BACK_COMMAND);
|
|
}
|
}
|
|
|
/**
|
* 2020-04-01
|
* 新增通用开关
|
*
|
* @param littleType
|
* @param appliancesInfo
|
* @param devicesData
|
* @param parentRemarks
|
* @param channelNum
|
* @param port
|
* @param ipAddress
|
*/
|
private static void parseCommonSwitchData(int littleType, AppliancesInfo appliancesInfo, DevicesData devicesData, String parentRemarks, int channelNum, int index, String ipAddress) {
|
switch (littleType) {
|
case 0:
|
appliancesInfo.setDeviceName("通用开关");
|
appliancesInfo.setDeviceType(HDLApConfig.TYPE_COMMON_SWITCH);
|
break;
|
default:
|
appliancesInfo.setDeviceName(Configuration.UNKNOW_TYPE);
|
break;
|
|
}
|
if (devicesData != null) {
|
appliancesInfo.setChannelNum(channelNum);
|
appliancesInfo.setDeviceIndex(index);
|
appliancesInfo.setBigType(Configuration.COMMON_SWITCH_BIG_TYPE);
|
appliancesInfo.setLittleType(littleType);
|
appliancesInfo.setSourceSubnetID(devicesData.getSourceSubnetID());
|
appliancesInfo.setSourceDeviceID(devicesData.getSourceDeviceID());
|
appliancesInfo.setParentRemarks(parentRemarks);
|
|
appliancesInfo.setCtrlCommand(Configuration.COMMON_SWITCH_CTRL_COMMAND);//布防
|
appliancesInfo.setCtrlBackCommand(Configuration.COMMON_SWITCH_CTRL_BACK_COMMAND);//布防设置反馈
|
appliancesInfo.setStateCommand(Configuration.COMMON_SWITCH_STATE_COMMAND);//读取安防设置
|
appliancesInfo.setStateBackCommand(Configuration.COMMON_SWITCH_STATE_BACK_COMMAND);//读取安防设置反馈
|
|
}
|
}
|
|
|
/**
|
* @param mBigType
|
* @param mLittleType
|
* @param mSubnetID
|
* @param mDeviceID
|
* @param mChannelNum
|
* @param mRemarks
|
* @return
|
*/
|
public static DevicesData addDevicesManuallyWithoutSearching(int mBigType, int mLittleType, int mSubnetID, int mDeviceID, int mChannelNum, int mIndex, String mRemarks) {
|
boolean bWantData = false;
|
DevicesData mDevicesData = new DevicesData();
|
mDevicesData.setSourceSubnetID(mSubnetID);
|
mDevicesData.setSourceDeviceID(mDeviceID);
|
mDevicesData.setRemark(mRemarks);
|
|
List<AppliancesInfo> appliancesInfoList = new ArrayList<>();
|
if (isWantData(mBigType, mLittleType)) {
|
bWantData = true;
|
AppliancesInfo appliancesInfo = getDevicesInfo(mDevicesData, mBigType, mLittleType, mChannelNum, mIndex, mRemarks, mRemarks);
|
|
appliancesInfoList.add(appliancesInfo);
|
// HDLLog.I( "向模块添加回路:"+"大类:" + mBigType + " 小类:" + mLittleType +" 模块备注" + mRemarks );
|
} else {
|
// HDLLog.I( "不是要添加的设备:大类:" + mBigType + " 小类:" + mLittleType +" 模块备注" + mRemarks );
|
}
|
|
if (bWantData) {
|
mDevicesData.setAppliancesInfoList(appliancesInfoList);
|
} else {
|
mDevicesData = null;
|
}
|
|
return mDevicesData;
|
}
|
|
// public static AppliancesInfo GetAppliancesInfo(DevicesData mDevicesData, int mBigType, int mLittleType, int mSubnetID, int mDeviceID, int mChannelNum, String mRemarks) {
|
|
|
// public static AppliancesInfo GetAppliancesInfo(DevicesData mDevicesData, int mBigType, int mLittleType, int mSubnetID, int mDeviceID, int mChannelNum, String mRemarks) {
|
// AppliancesInfo appliancesInfo = new AppliancesInfo();
|
// /**根据类别,赋值操作码等一些重要信息*/
|
// switch (mBigType) {
|
// case Configuration.LIGTH_BIG_TYPE:
|
// parseLightData(mLittleType, appliancesInfo, mDevicesData, mRemarks, mChannelNum, 0, "");
|
// break;
|
// case Configuration.CURTAIN_BIG_TYPE:
|
// parseCurtainData(mLittleType, appliancesInfo, mDevicesData, mRemarks, mChannelNum, 0, "");
|
// break;
|
// case Configuration.AIR_BIG_TYPE:
|
// parseAirData(mLittleType, appliancesInfo, mDevicesData, mRemarks, mChannelNum, 0, "");
|
// break;
|
// case Configuration.AUDIO_BIG_TYPE:
|
// parseAudioData(mLittleType, appliancesInfo, mDevicesData, mRemarks, mChannelNum, 0, "");
|
// break;
|
// case Configuration.LOGIC_BIG_TYPE:
|
// parseLogicData(mLittleType, appliancesInfo, mDevicesData, mRemarks, mChannelNum, 0, "");
|
// break;
|
// case Configuration.GLOBAL_LOGIC_BIG_TYPE:
|
// parseGlobalLogicData(mLittleType, appliancesInfo, mDevicesData, mRemarks, mChannelNum, 0, "");
|
// break;
|
// case Configuration.SECURITY_BIG_TYPE://2019-7-29 新增
|
// parseSecurityData(mLittleType, appliancesInfo, mDevicesData, mRemarks, mChannelNum, 0, "");
|
// break;
|
// case Configuration.SENSOR_BIG_TYPE://2019-07-03 屏蔽
|
// parseSensorData(mLittleType, appliancesInfo, mDevicesData, mRemarks, mChannelNum, 0, "");
|
// break;
|
// default:
|
//// appliancesInfo.setDeviceName(Configuration.UNKNOW_TYPE);
|
// break;
|
// }
|
//
|
//
|
//
|
//
|
// String key = "K" + appliancesInfo.getBigType()
|
// + "-" + appliancesInfo.getLittleType()
|
// + "-" + appliancesInfo.getDeviceSubnetID()
|
// + "-" + appliancesInfo.getDeviceDeviceID()
|
// + "-" + appliancesInfo.getChannelNum();
|
// appliancesInfo.setRemarks(mRemarks);
|
// appliancesInfo.setDeviceKey(key);//2019-8-2 添加唯一标识key
|
// return appliancesInfo;
|
// }
|
|
|
/**
|
* @param bigType
|
* @param littleType
|
* @param mSubnetID
|
* @param mDeviceID
|
* @param parentRemarks
|
* @return
|
*/
|
public static DevicesData addDevicesManuallyWithoutSearchingAll(int bigType, int littleType, int mSubnetID, int mDeviceID, String parentRemarks, ArrayList<String> parentRemarksList) {
|
boolean bWantData = false;
|
DevicesData devicesData = new DevicesData();
|
devicesData.setSourceSubnetID(mSubnetID);
|
devicesData.setSourceDeviceID(mDeviceID);
|
devicesData.setRemark(parentRemarks);
|
|
List<AppliancesInfo> appliancesInfoList = new ArrayList<>();
|
if (isWantData(bigType, littleType)) {
|
for (int i = 0; i < parentRemarksList.size(); i++) {
|
appliancesInfoList.add(getDevicesInfo(devicesData, bigType, littleType, i + 1, i+1, parentRemarks, parentRemarksList.get(i)));
|
}
|
bWantData = true;
|
|
// HDLLog.I( "向模块添加回路:"+"大类:" + mBigType + " 小类:" + mLittleType +" 模块备注" + mRemarks );
|
} else {
|
// HDLLog.I( "不是要添加的设备:大类:" + mBigType + " 小类:" + mLittleType +" 模块备注" + mRemarks );
|
}
|
|
if (bWantData) {
|
devicesData.setAppliancesInfoList(appliancesInfoList);
|
devicesDataList.add(devicesData);
|
|
HandleSearch.OnDeviceListGetSuccessCallBack();
|
} else {
|
devicesData = null;
|
}
|
|
return devicesData;
|
}
|
|
public static AppliancesInfo getDevicesInfo(DevicesData devicesData, int bigType, int littleType, int curChannelNum, int index, String parentRemarks, String mRemarks) {
|
AppliancesInfo appliancesInfo = new AppliancesInfo();
|
/**根据类别,赋值操作码等一些重要信息*/
|
switch (bigType) {
|
case Configuration.LIGTH_BIG_TYPE:
|
parseLightData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, index, "");
|
break;
|
case Configuration.CURTAIN_BIG_TYPE:
|
parseCurtainData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, index, "");
|
break;
|
case Configuration.AIR_BIG_TYPE:
|
parseAirData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, index, "");
|
break;
|
case Configuration.AUDIO_BIG_TYPE:
|
parseAudioData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, index, "");
|
break;
|
case Configuration.LOGIC_BIG_TYPE:
|
parseLogicData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, index, "");
|
break;
|
case Configuration.GLOBAL_LOGIC_BIG_TYPE:
|
parseGlobalLogicData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, index, "");
|
break;
|
case Configuration.SECURITY_BIG_TYPE://2019-7-29 新增
|
parseSecurityData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, index, "");
|
break;
|
case Configuration.SENSOR_BIG_TYPE:
|
parseSensorData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, index, "");
|
break;
|
case Configuration.COMMON_SWITCH_BIG_TYPE://2020-04-01 通用开关
|
parseCommonSwitchData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, index, "");
|
break;
|
case Configuration.FRESH_AIR_BIG_TYPE://2020-07-20 新增新风
|
parseFreshAirData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, index, "");
|
break;
|
case Configuration.GEOTHERMAL_BIG_TYPE://2020-07-20 地热
|
parseGeothermalData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, index, "");
|
break;
|
case Configuration.DOOR_MACHINE_BIG_TYPE://2023-08-22 门锁
|
parseDoorMachineData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, index, "");
|
break;
|
default:
|
// appliancesInfo.setDeviceName(Configuration.UNKNOW_TYPE);
|
break;
|
}
|
|
String key = "K" + appliancesInfo.getBigType()
|
+ "-" + appliancesInfo.getLittleType()
|
+ "-" + appliancesInfo.getDeviceSubnetID()
|
+ "-" + appliancesInfo.getDeviceDeviceID()
|
+ "-" + appliancesInfo.getChannelNum();
|
// appliancesInfo.setRemarks(mRemarks);
|
HDLLog.I("---getDevicesInfo getRemarks():" + appliancesInfo.getRemarks());
|
appliancesInfo.setDeviceKey(key);//2019-8-2 添加唯一标识key
|
return appliancesInfo;
|
|
}
|
|
|
/**
|
* 添加设备回路
|
* 如果存在相同子网号 设备号,则当成混合模块添加到该回路下,不存在则新添加模块
|
*
|
* @param bigType
|
* @param littleType
|
* @param mSubnetID
|
* @param mDeviceID
|
* @param parentRemarks
|
* @return
|
*/
|
public static DevicesData addDevicesListWithoutSearching(int bigType, int littleType, int mSubnetID, int mDeviceID, int mChannelNum, int mIndex, String mChannelRemark, String parentRemarks) {
|
// boolean bWantData = false;
|
if (isWantData(bigType, littleType)) {
|
DevicesData devicesData = new DevicesData();
|
devicesData.setSourceSubnetID(mSubnetID);
|
devicesData.setSourceDeviceID(mDeviceID);
|
devicesData.setRemark(parentRemarks);
|
|
Boolean isFindDevicesData = false;
|
int index = 0;
|
for (int i = 0; i < devicesDataList.size(); i++) {
|
if (devicesDataList.get(i).getSourceSubnetID() == mSubnetID && devicesDataList.get(i).getSourceDeviceID() == mDeviceID) {
|
index = i;
|
isFindDevicesData = true;
|
break;
|
}
|
}
|
|
|
if (isFindDevicesData) {
|
AppliancesInfo mAppliancesInfo = getDevicesInfo(devicesData, bigType, littleType, mChannelNum, mIndex, parentRemarks, mChannelRemark);
|
devicesDataList.get(index).getAppliancesInfoList().add(mAppliancesInfo);
|
devicesData = devicesDataList.get(index);
|
HandleSearch.OnDeviceListGetSuccessCallBack();
|
} else {
|
List<AppliancesInfo> appliancesInfoList = new ArrayList<>();
|
appliancesInfoList.add(getDevicesInfo(devicesData, bigType, littleType, mChannelNum, mIndex, parentRemarks, mChannelRemark));
|
devicesData.setAppliancesInfoList(appliancesInfoList);
|
devicesDataList.add(devicesData);
|
HandleSearch.OnDeviceListGetSuccessCallBack();
|
|
}
|
|
|
return devicesData;
|
|
} else {
|
return null;
|
|
}
|
|
|
}
|
|
|
}
|