| | |
| | | import java.util.ArrayList; |
| | | |
| | | |
| | | /** SDK目前支持的大类:小类 |
| | | * 灯光类:调光回路、开关回路、混合调光类、混合开关类 |
| | | * 窗帘类:开合帘电机、卷帘电机、窗帘模块 |
| | | * 空调功能:HVAC 模块、通用空调面板 |
| | | * 背景音乐功能:背景音乐模块 2018新背景音乐模块小类3 |
| | | * 传感器:干结点0 到 功率24 |
| | | * 逻辑功能:逻辑模块 |
| | | * 全局场景: |
| | | * 地热功能:地热模块 |
| | | * 新风:新风系统 |
| | | /** SDK目前支持手动添加的大类:小类 |
| | | * 灯光类(大类1):调光回路(0)、开关回路(1)、混合调光类(9)、混合开关类(10) |
| | | * 窗帘类(大类2):开合帘电机(0)、卷帘电机(1)、窗帘模块(2) |
| | | * 空调功能(大类7):HVAC 模块(0)、通用空调面板(3) |
| | | * 背景音乐功能(大类9):背景音乐模块 2018新背景音乐模块小类3 |
| | | * 传感器(大类5):干结点0 到 功率24 |
| | | * 逻辑功能(大类12):逻辑模块(0) |
| | | * 全局场景(大类17):全局场景(0) |
| | | * 地热功能:地热模块(0) |
| | | * 新风(大类19):新风系统(0) |
| | | * 通用开关(大类100):通用开关(0) |
| | | |
| | | * 灯光类1:0 ,1,9,10 |
| | | * 窗帘类2:0,1,2 |
| | | * 传感器5:0~24 |
| | | * 空调类7:0,3 |
| | | * 地热模块8:0 |
| | | * 背景音乐功能9:0 |
| | | * 逻辑功能12:0 |
| | | * 全局场景17:0 |
| | | * 新风模块19:0 |
| | | * 通用开关100:0 |
| | | * 格式 支持的模块名字 大类ID:小类ID |
| | | * |
| | | * 灯光类 1:0 ,1,9,10 |
| | | * 窗帘类 2:0,1,2 |
| | | * 传感器 5:0~24 |
| | | * 空调类 7:0,3 |
| | | * 地热模块 8:0 |
| | | * 背景音乐功能 9:0 |
| | | * 逻辑功能 12:0 |
| | | * 全局场景 17:0 |
| | | * 新风模块 19:0 |
| | | * 通用开关 100:0 |
| | | * |
| | | * 该方法应用于提供项目交付前的提取批量数据生成好数据。 |
| | | * 模拟生成设备回路数据,在项目不支持简易编程搜索情况下,可以通过该方法,先快捷生成目标数据 得到 List<DevicesData> 格式的设备列表数据 |
| | |
| | | private String parentRemarks; |
| | | private ArrayList<String> parentRemarksList = new ArrayList(); |
| | | |
| | | private EditText et_subnetID, et_deviceID, et_bitType, et_littleType, et_remarks, et_remarks_mk, et_mChannelNum,et_scene,et_mPort; |
| | | private EditText et_subnetID, et_deviceID, et_bitType, et_littleType, et_remarks, et_remarks_mk, et_mChannelNum,et_scene,et_mPort,et_scene2; |
| | | private Button btn_add,btn_scene,btn_addAll; |
| | | |
| | | @Override |
| | |
| | | et_mPort = findViewById(R.id.et_mPort); |
| | | |
| | | et_scene = findViewById(R.id.et_scene); |
| | | et_scene2 = findViewById(R.id.et_scene2); |
| | | |
| | | btn_add = findViewById(R.id.btn_add); |
| | | btn_scene = findViewById(R.id.btn_scene); |
| | |
| | | return; |
| | | } |
| | | String mChannelNumStr = et_mChannelNum.getText().toString(); |
| | | if (TextUtils.isEmpty(littleTypeStr)) { |
| | | if (TextUtils.isEmpty(mChannelNumStr)) { |
| | | showToast("回路号不能为空"); |
| | | return; |
| | | } |
| | |
| | | * |
| | | * @param mSubnetID |
| | | * @param mDeviceID |
| | | * @param mChannelNum 回路号 这里的回路号需要注意,相同子网号和设备号下的场景需要累加不重复,逻辑模块为例:1区有3个表,2区有2个表 总共5个场景,所以(2区表1 回路号为4、2区表2 回路号为5) |
| | | * @param mAreaNum //场景 区域号 |
| | | * @param mAreaSceneNum //场景 当前区域场景号 |
| | | * @param mChannelRemark 读取场景的备注名称 例如: 入住、起床模式、阅读模式 |
| | |
| | | * @param bSaveAndCallBack 是否马上保存本地并且推送DevicesInfoEvent 事件 |
| | | * @return |
| | | */ |
| | | private void AddScenesDevices(int mSubnetID, int mDeviceID, int mAreaNum, int mAreaSceneNum, String mChannelRemark, String parentRemarks, boolean bSaveAndCallBack) { |
| | | private void AddScenesDevices(int mSubnetID, int mDeviceID, int mChannelNum, int mAreaNum, int mAreaSceneNum, String mChannelRemark, String parentRemarks, boolean bSaveAndCallBack) { |
| | | //添加场景 |
| | | DevicesData mScenesData = DeviceParser.addScenesDevicesListWithoutSearching(port, mSubnetID, mDeviceID, mAreaNum, mAreaSceneNum, mChannelRemark, parentRemarks,true); |
| | | DevicesData mScenesData = DeviceParser.addScenesDevicesListWithoutSearching(port, mSubnetID, mDeviceID, mChannelNum, mAreaNum, mAreaSceneNum, mChannelRemark, parentRemarks,true); |
| | | } |
| | | |
| | | |
| | |
| | | showToast("端口号不能为空"); |
| | | return; |
| | | } |
| | | |
| | | String mChannelNumStr = et_mChannelNum.getText().toString(); |
| | | if (TextUtils.isEmpty(mChannelNumStr)) { |
| | | showToast("回路号不能为空"); |
| | | return; |
| | | } |
| | | |
| | | |
| | | // String bitTypeStr = et_bitType.getText().toString(); |
| | | // if (TextUtils.isEmpty(bitTypeStr)) { |
| | |
| | | return; |
| | | } |
| | | |
| | | String et_sceneString = et_scene.getText().toString(); |
| | | if (TextUtils.isEmpty(et_sceneString)) { |
| | | showToast("场景ID不能为空"); |
| | | String et_AreaNumString = et_scene.getText().toString(); |
| | | if (TextUtils.isEmpty(et_AreaNumString)) { |
| | | showToast("场景:区号不能为空"); |
| | | return; |
| | | } |
| | | |
| | | String et_scene2String = et_scene2.getText().toString(); |
| | | if (TextUtils.isEmpty(et_scene2String)) { |
| | | showToast("场景:场景号不能为空"); |
| | | return; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | mSubnetID = Integer.parseInt(subnetIDStr); |
| | |
| | | port = Integer.parseInt(mPortStr); |
| | | // bigType = Integer.parseInt(bitTypeStr); |
| | | // littleType = Integer.parseInt(littleTypeStr); |
| | | // mChannelNum = Integer.parseInt(mChannelNumStr); |
| | | mChannelNum = Integer.parseInt(mChannelNumStr); |
| | | parentRemarks = remarksMkString; |
| | | int sceneID = Integer.parseInt(et_sceneString); |
| | | int areaID = Integer.parseInt(et_AreaNumString); |
| | | int sceneID = Integer.parseInt(et_scene2String); |
| | | |
| | | DevicesData mScenesData = DeviceParser.addScenesDevicesListWithoutSearching(port, mSubnetID, mDeviceID, sceneID, sceneID, remarksString, parentRemarks,true); |
| | | DevicesData mScenesData = DeviceParser.addScenesDevicesListWithoutSearching(port, mSubnetID, mDeviceID, mChannelNum, areaID, sceneID, remarksString, parentRemarks,true); |
| | | if (mScenesData != null) { |
| | | showToast("添加成功"); |
| | | } else { |
| | |
| | | // DeviceParser.addScenesDevicesListWithoutSearching(port, mSubnetID, mDeviceID, 5, 5, "会客模式", parentRemarks,true); |
| | | |
| | | |
| | | //添加一个4路继电器 |
| | | DeviceParser.addDevicesListWithoutSearching(port, Configuration.LIGTH_BIG_TYPE, 0, 111, 3, 1, "吧台灯", "4路继电器",false); |
| | | DeviceParser.addDevicesListWithoutSearching(port, Configuration.LIGTH_BIG_TYPE, 0, 111, 3, 2, "休闲灯", "4路继电器",false); |
| | | DeviceParser.addDevicesListWithoutSearching(port, Configuration.LIGTH_BIG_TYPE, 0, 111, 3, 3, "电视灯", "4路继电器",false); |
| | | DeviceParser.addDevicesListWithoutSearching(port, Configuration.LIGTH_BIG_TYPE, 0, 111, 3, 4, "廊灯", "4路继电器",false); |
| | | // //添加一个4路继电器 |
| | | // DeviceParser.addDevicesListWithoutSearching(port, Configuration.LIGTH_BIG_TYPE, 0, 111, 3, 1, "吧台灯", "4路继电器",false); |
| | | // DeviceParser.addDevicesListWithoutSearching(port, Configuration.LIGTH_BIG_TYPE, 0, 111, 3, 2, "休闲灯", "4路继电器",false); |
| | | // DeviceParser.addDevicesListWithoutSearching(port, Configuration.LIGTH_BIG_TYPE, 0, 111, 3, 3, "电视灯", "4路继电器",false); |
| | | // DeviceParser.addDevicesListWithoutSearching(port, Configuration.LIGTH_BIG_TYPE, 0, 111, 3, 4, "廊灯", "4路继电器",false); |
| | | // |
| | | // //添加一个干节点传感器 |
| | | // DeviceParser.addDevicesListWithoutSearching(port, Configuration.SENSOR_BIG_TYPE, 0, 111, 99, 1, "干节点", "干节点",false); |
| | | // |
| | | // |
| | | // //添加一个2路窗帘 |
| | | // DeviceParser.addDevicesListWithoutSearching(port, Configuration.CURTAIN_BIG_TYPE, 2, 111, 8, 1, "窗帘", "2路窗帘",false); |
| | | // DeviceParser.addDevicesListWithoutSearching(port, Configuration.CURTAIN_BIG_TYPE, 2, 111, 8, 2, "纱窗", "2路窗帘",false); |
| | | // //添加一个开合帘 |
| | | // DeviceParser.addDevicesListWithoutSearching(port, Configuration.CURTAIN_BIG_TYPE, 1, 111, 92, 1, "开合帘", "开合帘",false); |
| | | // |
| | | // //添加一个空调 |
| | | // DeviceParser.addDevicesListWithoutSearching(port, Configuration.AIR_BIG_TYPE, 0, 111, 9, 1, "房间空调", "HVAC空调模块",false); |
| | | |
| | | /** |
| | | * 场景这里的回路号需要注意: 相同子网号和设备号下的场景需要累加不重复,逻辑模块为例:1区有3个表,2区有2个表 总共5个场景,所以(2区表1 回路号为4、2区表2 回路号为5) |
| | | * 不然如果回路号不对简易编程搜索备注的话会出错 |
| | | */ |
| | | //添加一个场景 |
| | | DeviceParser.addLogicScenesDevicesListWithoutSearching(port, 1, 16, 4, 2, 1, "卧室开灯", "逻辑模块",false); |
| | | |
| | | |
| | | //添加一个4路继电器 |
| | | DeviceParser.addDevicesListWithoutSearching(port, Configuration.LIGTH_BIG_TYPE, 0, 111, 3, 1, "吧台灯", "4路继电器",false); |
| | | DeviceParser.addDevicesListWithoutSearching(port, Configuration.LIGTH_BIG_TYPE, 0, 111, 3, 2, "休闲灯", "4路继电器",false); |
| | | DeviceParser.addDevicesListWithoutSearching(port, Configuration.LIGTH_BIG_TYPE, 0, 111, 3, 3, "电视灯", "4路继电器",false); |
| | | DeviceParser.addDevicesListWithoutSearching(port, Configuration.LIGTH_BIG_TYPE, 0, 111, 3, 4, "廊灯", "4路继电器",false); |
| | | |
| | | |
| | | //添加一个2路窗帘 |
| | | DeviceParser.addDevicesListWithoutSearching(port, Configuration.CURTAIN_BIG_TYPE, 2, 111, 8, 1, "窗帘", "2路窗帘",false); |
| | | DeviceParser.addDevicesListWithoutSearching(port, Configuration.CURTAIN_BIG_TYPE, 2, 111, 8, 2, "纱窗", "2路窗帘",false); |
| | | //添加一个开合帘 |
| | | DeviceParser.addDevicesListWithoutSearching(port, Configuration.CURTAIN_BIG_TYPE, 1, 111, 92, 1, "开合帘", "开合帘",false); |
| | | |
| | | //添加一个空调 |
| | | DeviceParser.addDevicesListWithoutSearching(port, Configuration.AIR_BIG_TYPE, 0, 111, 9, 1, "房间空调", "HVAC空调模块",false); |
| | | //添加一个场景 最后一个bSaveAndCallBack 设置为true |
| | | DeviceParser.addScenesDevicesListWithoutSearching(port, mSubnetID, mDeviceID, 5, 5, "会客模式", parentRemarks,true); |
| | | DeviceParser.addLogicScenesDevicesListWithoutSearching(port, 1, 16, 5,2, 2, "卧室关灯", "逻辑模块",true); |
| | | |
| | | |
| | | |