| | |
| | | case Command.ReadCurtainStutasACK: |
| | | foreach (var curtain in DB_ResidenceData.residenceData.functionList.curtains) |
| | | { |
| | | if (curtain.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) |
| | | if (curtain.bus_Data.SubnetID == subnetID && curtain.bus_Data.DeviceID == deviceID) |
| | | { |
| | | switch(receiveBytes[1]) |
| | | if (receiveBytes[0] == 17) |
| | | { |
| | | case 0: |
| | | curtain.on_off = "stop"; |
| | | break; |
| | | case 1: |
| | | if (receiveBytes[1] > 1) |
| | | { |
| | | curtain.on_off = "on"; |
| | | curtain.lastState = Language.StringByID(StringId.Open); |
| | | break; |
| | | case 2: |
| | | } |
| | | else |
| | | { |
| | | curtain.on_off = "off"; |
| | | curtain.lastState = Language.StringByID(StringId.Close); |
| | | break; |
| | | default: |
| | | if (receiveBytes[1] > 1) |
| | | { |
| | | } |
| | | curtain.openLevel = receiveBytes[1]; |
| | | curtain.lastState = Language.StringByID(StringId.Open) + curtain.openLevel + "%"; |
| | | } |
| | | else |
| | | { |
| | | if (curtain.bus_Data.LoopID != receiveBytes[0]) |
| | | continue; |
| | | switch (receiveBytes[1]) |
| | | { |
| | | case 0: |
| | | curtain.on_off = "stop"; |
| | | break; |
| | | case 1: |
| | | curtain.on_off = "on"; |
| | | } |
| | | else |
| | | { |
| | | curtain.lastState = Language.StringByID(StringId.Open); |
| | | break; |
| | | case 2: |
| | | curtain.on_off = "off"; |
| | | } |
| | | curtain.openLevel = receiveBytes[1]; |
| | | curtain.lastState = Language.StringByID(StringId.Open) + curtain.openLevel + "%"; |
| | | break; |
| | | curtain.lastState = Language.StringByID(StringId.Close); |
| | | break; |
| | | } |
| | | } |
| | | RoomPage.UpdataStates(curtain); |
| | | FunctionPage.UpdataStates(curtain); |
| | | HomePage.UpdataFunctionStates(curtain); |
| | | ClassificationPage.UpdataInfo(curtain); |
| | | RollingShutterPage.UpdataState(curtain); |
| | | switch (curtain.functionType) |
| | | { |
| | | case FunctionType.Curtain: |
| | |
| | | sensor.values = Math.Round(BitConverter.ToSingle(tempBytes, 0), 1); |
| | | break; |
| | | } |
| | | switch (receiveBytes[4]) |
| | | { |
| | | case 2: |
| | | if (receiveBytes[1] == 5)//TVOC需求除以100000 |
| | | sensor.values /= 100000; |
| | | break; |
| | | } |
| | | EnvironmentalSciencePage.LoadEvent_UpdataStatus(sensor); |
| | | } |
| | | } |
| | |
| | | string tempFileName = nameValueCollection["Command"].Replace("Get", ""); |
| | | if ("AllFiles" == tempFileName) |
| | | { |
| | | byte[] bytes = Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(FileUtils.ReadFiles())); |
| | | byte[] bytes = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(FileUtils.ReadFiles())); |
| | | outputStream.Write(bytes, 0, bytes.Length); |
| | | outputStream.Flush(); |
| | | } |