| | |
| | | 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); |
| | | |
| | | //添加一个干节点传感器 |
| | | DeviceParser.addDevicesListWithoutSearching(port, Configuration.SENSOR_BIG_TYPE, 0, 111, 99, 1, "干节点", "干节点",false); |
| | | /** |
| | | * 场景这里的回路号需要注意: 相同子网号和设备号下的场景需要累加不重复,逻辑模块为例:1区有3个表,2区有2个表 总共5个场景,所以(2区表1 回路号为4、2区表2 回路号为5) |
| | | * 不然如果回路号不对简易编程搜索备注的话会出错 |
| | | */ |
| | | //添加一个场景 |
| | | DeviceParser.addLogicScenesDevicesListWithoutSearching(port, 1, 16, 4, 2, 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); |
| | | //添加一个场景 最后一个bSaveAndCallBack 设置为true |
| | | DeviceParser.addScenesDevicesListWithoutSearching(port, mSubnetID, mDeviceID, 5, 5, "会客模式", parentRemarks,true); |
| | | DeviceParser.addLogicScenesDevicesListWithoutSearching(port, 1, 16, 5,2, 2, "卧室关灯", "逻辑模块",true); |
| | | |
| | | |
| | | |