| | |
| | | /// </summary> |
| | | public virtual void Manager() |
| | | { |
| | | #if DEBUG |
| | | #else |
| | | try |
| | | { |
| | | { |
| | | #endif |
| | | //对于操作数据库的时间比较长的,可以创建另一个线程处理 |
| | | if (!"HDLMIRACLE".Equals(Encoding.ASCII.GetString(Bytes, 4, 10))) |
| | | { |
| | |
| | | #endif |
| | | //处理是否要重发数据 |
| | | ManagerReceive(subnetID, deviceID, command, usefulBytes); |
| | | } |
| | | |
| | | #if DEBUG |
| | | #else |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"packet {ex.Message} "); |
| | | } |
| | | #endif |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="receiveBytes"></param> |
| | | void UdpPacket_DataProcessing(byte subnetID, byte deviceID, Command command, byte[] receiveBytes) |
| | | { |
| | | #if DEBUG |
| | | #else |
| | | try |
| | | { |
| | | #endif |
| | | switch (command) |
| | | { |
| | | case Command.SetSingleLightACK: |
| | |
| | | break; |
| | | case Command.SetACModeACK: |
| | | case Command.ReadACModeACK: |
| | | foreach (var function in FunctionList.List.GetAcList()) |
| | | foreach (var function in FunctionList.List.Functions) |
| | | { |
| | | if (function.bus == null || function.spk != SPK.AcStandard) |
| | | { |
| | | continue; |
| | | } |
| | | var acFunction = new AC(); |
| | | if (function.GetBusId() == subnetID + "_" + deviceID + "_" + receiveBytes[0]) |
| | | if (function.bus.SubnetID == subnetID && |
| | | function.bus.DeviceID == deviceID && |
| | | function.bus.LoopId == receiveBytes[0]) |
| | | { |
| | | Console.WriteLine(function.GetBusId()); |
| | | function.SetAttrState(FunctionAttributeKey.TempType, receiveBytes[1].ToString()); |
| | | function.SetAttrState(FunctionAttributeKey.RoomTemp, receiveBytes[2].ToString()); |
| | | function.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[8] == 1 ? "on" : "off"); |
| | |
| | | FunctionPage.UpdataStates(function); |
| | | HomePage.UpdataFunctionStates(function); |
| | | ClassificationPage.UpdataInfo(function); |
| | | Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(function.sid, function.status); |
| | | Stan.HdlDeviceStatuPushLogic.Current.UpdateDeviceStatu(function); |
| | | |
| | | } |
| | | } |
| | |
| | | |
| | | } |
| | | function.lastState = ""; |
| | | function.lastState += " " + function.GetAttrState(FunctionAttributeKey.SetTemp) + acFunction.GetTempUnitString(function); |
| | | function.lastState += acFunction.GetModeAttrText(function.GetAttrState(FunctionAttributeKey.Mode)) + |
| | | acFunction.GetModeAttrText(function.GetAttrState(FunctionAttributeKey.FanSpeed)) + |
| | | " " + function.GetAttrState(FunctionAttributeKey.SetTemp) + acFunction.GetTempUnitString(function); |
| | | RoomPage.UpdataStates(function); |
| | | FunctionPage.UpdataStates(function); |
| | | HomePage.UpdataFunctionStates(function); |
| | |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | |
| | | #if DEBUG |
| | | #else |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"Bus Rev Erorr : {ex.Message}"); |
| | | } |
| | | #endif |
| | | |
| | | } |
| | | /// <summary> |
| | | /// byte转16进制字符串 |