| | |
| | | import com.hdl.sdk.hdl_core.HDLAppliances.Config.HDLApConfig; |
| | | import com.hdl.sdk.hdl_core.HDLDeviceManger.Bean.AppliancesInfo; |
| | | import com.hdl.sdk.hdl_core.HDLDeviceManger.Bean.DevicesData; |
| | | import com.hdl.sdk.hdl_core.HDLDeviceManger.Core.HDLDeviceManager; |
| | | import com.hdl.sdk.hdl_core.HDLDeviceManger.Core.HandleSearch; |
| | | import com.hdl.sdk.hdl_core.Util.LogUtil.HDLLog; |
| | | |
| | | import java.util.ArrayList; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * |
| | | * @param bigType |
| | | * @param littleType |
| | | * @param mSubnetID |
| | | * @param mDeviceID |
| | | * @param parentRemarks |
| | | * @return |
| | | */ |
| | | public static DevicesData addDevicesManuallyWithoutSearchingAll(int bigType, int littleType, int mSubnetID, int mDeviceID, int port, 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, port, parentRemarks, parentRemarksList.get(i))); |
| | | } |
| | | bWantData = true; |
| | | |
| | | // HDLLog.I( "向模块添加回路:"+"大类:" + mBigType + " 小类:" + mLittleType +" 模块备注" + mRemarks ); |
| | | } else { |
| | | // HDLLog.I( "不是要添加的设备:大类:" + mBigType + " 小类:" + mLittleType +" 模块备注" + mRemarks ); |
| | | } |
| | | |
| | | if (bWantData) { |
| | | devicesData.setAppliancesInfoList(appliancesInfoList); |
| | | HDLDeviceManager.devicesDataList.add(devicesData); |
| | | |
| | | HandleSearch.OnDeviceListGetSuccessCallBack(); |
| | | }else { |
| | | devicesData = null; |
| | | } |
| | | |
| | | return devicesData; |
| | | } |
| | | |
| | | private static AppliancesInfo getDevicesInfo(DevicesData devicesData, int bigType, int littleType, int curChannelNum, int port, String parentRemarks, String mRemarks){ |
| | | AppliancesInfo appliancesInfo = new AppliancesInfo(); |
| | | /**根据类别,赋值操作码等一些重要信息*/ |
| | | switch (bigType) { |
| | | case Configuration.LIGTH_BIG_TYPE: |
| | | parseLightData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, port, ""); |
| | | break; |
| | | case Configuration.CURTAIN_BIG_TYPE: |
| | | parseCurtainData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, port, ""); |
| | | break; |
| | | case Configuration.AIR_BIG_TYPE: |
| | | parseAirData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, port, ""); |
| | | break; |
| | | case Configuration.AUDIO_BIG_TYPE: |
| | | parseAudioData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, port, ""); |
| | | break; |
| | | case Configuration.LOGIC_BIG_TYPE: |
| | | parseLogicData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, port, ""); |
| | | break; |
| | | case Configuration.GLOBAL_LOGIC_BIG_TYPE: |
| | | parseGlobalLogicData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, port, ""); |
| | | break; |
| | | case Configuration.SENSOR_BIG_TYPE: |
| | | parseSensorData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, port, ""); |
| | | break; |
| | | //2019-07-08 新增地热和新风类 |
| | | case Configuration.GEOTHERMAL_BIG_TYPE://地热 |
| | | parseGeothermalData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, port, ""); |
| | | break; |
| | | case Configuration.FRESH_AIR_BIG_TYPE: |
| | | parseFreshAirData(littleType, appliancesInfo, devicesData, parentRemarks, curChannelNum, port, ""); |
| | | 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; |
| | | |
| | | } |
| | | |
| | | } |