| | |
| | | private static List<Control> controlList = new List<Control>(50); |
| | | |
| | | /// <summary> |
| | | /// 发送数据,等待有反馈 |
| | | /// </summary> |
| | | /// <returns>The bytes send has return.</returns> |
| | | static byte[] ControlBytesSendHasReturn(Command command, byte subnetID, byte deviceID, byte[] gatewayBytes, int sendCount = 3) |
| | | { |
| | | Control control = new Control(); |
| | | control.Send(new Target() |
| | | { |
| | | IPEndPoint = CommonPage.EndPoint, |
| | | Command = command, |
| | | SubnetID = subnetID, |
| | | DeviceID = deviceID, |
| | | AddData = gatewayBytes, |
| | | }, sendCount, true); |
| | | |
| | | return control.UsefulBytes; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 发送数据,不需要等待回复 |
| | | /// </summary> |
| | | static void ControlBytesSend(Command command, byte subnetID, byte deviceID, byte[] gatewayBytes, int sendCount = 3, System.Net.IPEndPoint ipEndpoint = null) |
| | |
| | | case Command.SetLogicLoopColorACK: |
| | | receiveFlag += string.Format("{0},{1},{2}", usefulBytes[0], usefulBytes[1], usefulBytes[2]); |
| | | break; |
| | | |
| | | case Command.ReadLogicLoopColorACK: |
| | | case Command.ReadACModeACK: |
| | | case Command.SetACModeACK: |
| | | receiveFlag += string.Format("{0}", usefulBytes[0]); |
| | | break; |
| | | //case Command.YIPanelDeviceInofACK: |
| | | // for (int i = 0; i < 4; i++) |
| | | // { |
| | |
| | | // break; |
| | | //case Command.SetCommonACK: |
| | | //case Command.InfraredChannelControlACK: |
| | | //case Command.ReadACModeACK: |
| | | //case Command.SetACModeACK: |
| | | //case Command.Serverx_FH_CMD_ACK: |
| | | //case Command.ReadSensorHistoryACK: |
| | | //case Command.SetSensorAutomationTargetLevelEnableACK: |
| | |
| | | //case Command.AssignedAddressACK: |
| | | //case Command.UpdataCurtainModelRunTimeACK: |
| | | //case Command.ReadCurtainStutasACK: |
| | | //case Command.ReadLogicLoopColorACK: |
| | | //case Command.ReadPanleTempACK: |
| | | //case Command.FreshAirReadACK: |
| | | //case Command.FreshAirControlACK: |
| | |
| | | switch (target.Command) |
| | | { |
| | | case Command.SetSingleLight: |
| | | case Command.ReadLogicLoopColor: |
| | | case Command.ReadACMode: |
| | | case Command.SetACMode: |
| | | this.sendFlag += string.Format("{0}", target.AddData[0]); |
| | | break; |
| | | case Command.SetLogicLoopColor: |
| | |
| | | // break; |
| | | //case Command.SetCommonSwitch: |
| | | //case Command.InfraredChannelControl: |
| | | //case Command.ReadACMode: |
| | | //case Command.SetACMode: |
| | | //case Command.ReadFoolHeat: |
| | | //case Command.SetFoolHeat: |
| | | //case Command.Serverx_FH_CMD: |
| | |
| | | //case Command.AssignedAddress: |
| | | //case Command.UpdataCurtainModelRunTime: |
| | | //case Command.ReadCurtainStatus: |
| | | //case Command.ReadLogicLoopColor: |
| | | //case Command.ReadPanleTemp: |
| | | //case Command.FreshAirRead: |
| | | //case Command.FreshAirControl: |
| | |
| | | /// <param name="sendCount">重发次数</param> |
| | | public void Send(Target target, int sendCount, bool isWait) |
| | | { |
| | | try |
| | | { |
| | | Packet = new Packet(target.SendBytes, target.IPEndPoint); |
| | | Packet.HaveSendCount = 3 - sendCount; |
| | | |
| | |
| | | this.wait(); |
| | | } |
| | | } |
| | | catch(Exception ex) |
| | | { |
| | | MainPage.Log($"Send bus data error {ex.Message}"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |