| | |
| | | /// <returns>The bytes send has return.</returns> |
| | | public static byte [] ControlBytesSendHasReturn (Command command, byte subnetID, byte deviceID, byte [] gatewayBytes, bool isShow = true) |
| | | { |
| | | if (command == Command.ReadDeviceLoopInfo || command == Command.ReadDeviceModul) |
| | | CommonPage.LocalPhoneFindDevice = true; |
| | | if (command == Command.ReadGateway || command == Command.ReadGatewayProgrammingMode || command == Command.SetGateway) { |
| | | CommonPage.FindGateway = true; |
| | | CommonPage.LocalPhoneFindDevice = true; |
| | | } |
| | | |
| | | Control control = new Control () { IsCanShowTip = isShow }; |
| | | control.Send (new Target () { |
| | | IPEndPoint = CommonPage.EndPoint, |
| | |
| | | DeviceID = deviceID, |
| | | AddData = gatewayBytes, |
| | | }, SendCount.Three, true); |
| | | CommonPage.FindGateway = false; |
| | | |
| | | return control.UsefulBytes; |
| | | } |
| | |
| | | /// </summary> |
| | | public static void ControlBytesSend (Command command, byte subnetID, byte deviceID, byte [] gatewayBytes, SendCount sendCount = SendCount.Three, System.Net.IPEndPoint ipEndpoint = null, bool isShowTip = true) |
| | | { |
| | | if (command == Command.ReadDeviceLoopInfo || command == Command.ReadDeviceModul) |
| | | CommonPage.LocalPhoneFindDevice = true; |
| | | if (command == Command.ReadGateway || command == Command.ReadGatewayProgrammingMode |
| | | || command == Command.SetGateway) { |
| | | CommonPage.FindGateway = true; |
| | | CommonPage.LocalPhoneFindDevice = true; |
| | | } |
| | | |
| | | Control control = new Control () { IsCanShowTip = isShowTip }; |
| | | control.Send (new Target () { |
| | | IPEndPoint = ipEndpoint == null ? CommonPage.EndPoint : ipEndpoint,//new System.Net.IPEndPoint (System.Net.IPAddress.Parse (new Net.NetWiFi ().BroadcastIpAddress.ToString ()), 6000), |
| | |
| | | DeviceID = deviceID, |
| | | AddData = gatewayBytes, |
| | | }, sendCount, false); |
| | | CommonPage.FindGateway = false; |
| | | System.Console.WriteLine (command.ToString () + "::" + CommonPage.EndPoint.ToString ()); |
| | | } |
| | | |