From 1e3777f0813b2ac26ae0b52e89c171955a949563 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 29 Jul 2018 09:54:44 +0300 Subject: Moved external bridge classes to ExternalBridge namespace. --- .../MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs index 278926de9..d209e3f27 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -13,7 +13,7 @@ using System.Windows.Media; using Tango.BL.Entities; using Tango.Core.Commands; using Tango.Core.DI; -using Tango.Integration.Services; +using Tango.Integration.ExternalBridge; using Tango.Logging; using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Authentication; -- cgit v1.3.1 From ead172c9292326266b2c1622f058df5e2039bd05 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 30 Jul 2018 18:16:30 +0300 Subject: Working on PPC Machine Studio External Bridge ! --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 1835008 -> 1835008 bytes Software/PMR/Messages/Common/MessageType.proto | 14 +- .../Integration/ExternalBridgeLoginRequest.proto | 12 + .../Integration/ExternalBridgeLoginResponse.proto | 10 + .../Integration/ExternalBridgeLogoutRequest.proto | 9 + .../Integration/ExternalBridgeLogoutResponse.proto | 9 + .../Integration/ExternalClientLoginRequest.proto | 9 - .../Integration/ExternalClientLoginResponse.proto | 10 - .../ViewModels/MainViewVM.cs | 10 +- .../Tango.PPC.MachineSettings.csproj | 2 +- .../ViewModels/MainViewVM.cs | 3 + .../ExternalBridge/PPCExternalBridgeService.cs | 7 + .../Messages/MachineSettingsSavedMessage.cs | 14 ++ .../PPC/Tango.PPC.Common/Tango.PPC.Common.csproj | 3 +- .../PPC/Tango.PPC.UI/Images/machine-trans.png | Bin 0 -> 45618 bytes .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 3 +- .../ViewModels/ExternalBridgeViewVM.cs | 63 +++++- .../PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs | 22 +- .../PPC/Tango.PPC.UI/Views/ExternalBridgeView.xaml | 50 ++++- .../DI/TangoCreateWhenRegisteredAttribute.cs | 13 ++ Software/Visual_Studio/Tango.Core/DI/TangoIOC.cs | 7 +- .../Visual_Studio/Tango.Core/Tango.Core.csproj | 3 +- .../ExternalBridgeClientConnectedEventArgs.cs | 18 ++ .../ExternalBridge/ExternalBridgeService.cs | 230 ++++++++++++++----- .../ExternalBridge/ExternalBridgeTcpClient.cs | 35 ++- .../ExternalBridge/IExternalBridgeSecureClient.cs | 7 +- .../ExternalBridge/IExternalBridgeService.cs | 45 +++- .../Tango.Integration/Tango.Integration.csproj | 3 +- .../Visual_Studio/Tango.PMR/Common/MessageType.cs | 103 ++++----- .../Integration/ExternalBridgeLoginRequest.cs | 245 +++++++++++++++++++++ .../Integration/ExternalBridgeLoginResponse.cs | 188 ++++++++++++++++ .../Integration/ExternalBridgeLogoutRequest.cs | 131 +++++++++++ .../Integration/ExternalBridgeLogoutResponse.cs | 131 +++++++++++ .../Integration/ExternalClientLoginRequest.cs | 160 -------------- .../Integration/ExternalClientLoginResponse.cs | 188 ---------------- Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj | 8 +- .../Adapters/TcpTransportAdapter.cs | 22 +- 38 files changed, 1261 insertions(+), 526 deletions(-) create mode 100644 Software/PMR/Messages/Integration/ExternalBridgeLoginRequest.proto create mode 100644 Software/PMR/Messages/Integration/ExternalBridgeLoginResponse.proto create mode 100644 Software/PMR/Messages/Integration/ExternalBridgeLogoutRequest.proto create mode 100644 Software/PMR/Messages/Integration/ExternalBridgeLogoutResponse.proto delete mode 100644 Software/PMR/Messages/Integration/ExternalClientLoginRequest.proto delete mode 100644 Software/PMR/Messages/Integration/ExternalClientLoginResponse.proto create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/Messages/MachineSettingsSavedMessage.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Images/machine-trans.png create mode 100644 Software/Visual_Studio/Tango.Core/DI/TangoCreateWhenRegisteredAttribute.cs create mode 100644 Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeClientConnectedEventArgs.cs create mode 100644 Software/Visual_Studio/Tango.PMR/Integration/ExternalBridgeLoginRequest.cs create mode 100644 Software/Visual_Studio/Tango.PMR/Integration/ExternalBridgeLoginResponse.cs create mode 100644 Software/Visual_Studio/Tango.PMR/Integration/ExternalBridgeLogoutRequest.cs create mode 100644 Software/Visual_Studio/Tango.PMR/Integration/ExternalBridgeLogoutResponse.cs delete mode 100644 Software/Visual_Studio/Tango.PMR/Integration/ExternalClientLoginRequest.cs delete mode 100644 Software/Visual_Studio/Tango.PMR/Integration/ExternalClientLoginResponse.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 6bc5f20cb..7be9edf04 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index 5ceacb14a..a55918bd1 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/PMR/Messages/Common/MessageType.proto b/Software/PMR/Messages/Common/MessageType.proto index 8bb5c8877..704478a44 100644 --- a/Software/PMR/Messages/Common/MessageType.proto +++ b/Software/PMR/Messages/Common/MessageType.proto @@ -115,12 +115,14 @@ enum MessageType //Integration ExternalBridgeUdpDiscoveryPacket = 1000; - ExternalClientLoginRequest = 1001; - ExternalClientLoginResponse = 1002; - DirectSynchronizationRequest = 1003; - DirectSynchronizationResponse = 1004; - OverrideDataBaseRequest = 1005; - OverrideDataBaseResponse = 1006; + ExternalBridgeLoginRequest = 1001; + ExternalBridgeLoginResponse = 1002; + ExternalBridgeLogoutRequest = 1003; + ExternalBridgeLogoutResponse = 1004; + DirectSynchronizationRequest = 1005; + DirectSynchronizationResponse = 1006; + OverrideDataBaseRequest = 1007; + OverrideDataBaseResponse = 1008; //Diagnostics diff --git a/Software/PMR/Messages/Integration/ExternalBridgeLoginRequest.proto b/Software/PMR/Messages/Integration/ExternalBridgeLoginRequest.proto new file mode 100644 index 000000000..4672da81f --- /dev/null +++ b/Software/PMR/Messages/Integration/ExternalBridgeLoginRequest.proto @@ -0,0 +1,12 @@ +syntax = "proto3"; + +package Tango.PMR.Integration; +option java_package = "com.twine.tango.pmr.integration"; + +message ExternalBridgeLoginRequest +{ + string AppID = 1; + string UserGuid = 2; + string HostName = 3; + string Password = 4; +} \ No newline at end of file diff --git a/Software/PMR/Messages/Integration/ExternalBridgeLoginResponse.proto b/Software/PMR/Messages/Integration/ExternalBridgeLoginResponse.proto new file mode 100644 index 000000000..f4b780cb9 --- /dev/null +++ b/Software/PMR/Messages/Integration/ExternalBridgeLoginResponse.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; + +package Tango.PMR.Integration; +option java_package = "com.twine.tango.pmr.integration"; + +message ExternalBridgeLoginResponse +{ + bool Authenticated = 1; + string SerialNumber = 2; +} \ No newline at end of file diff --git a/Software/PMR/Messages/Integration/ExternalBridgeLogoutRequest.proto b/Software/PMR/Messages/Integration/ExternalBridgeLogoutRequest.proto new file mode 100644 index 000000000..d8dffbc1c --- /dev/null +++ b/Software/PMR/Messages/Integration/ExternalBridgeLogoutRequest.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.Integration; +option java_package = "com.twine.tango.pmr.integration"; + +message ExternalBridgeLogoutRequest +{ + +} \ No newline at end of file diff --git a/Software/PMR/Messages/Integration/ExternalBridgeLogoutResponse.proto b/Software/PMR/Messages/Integration/ExternalBridgeLogoutResponse.proto new file mode 100644 index 000000000..89e899301 --- /dev/null +++ b/Software/PMR/Messages/Integration/ExternalBridgeLogoutResponse.proto @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package Tango.PMR.Integration; +option java_package = "com.twine.tango.pmr.integration"; + +message ExternalBridgeLogoutResponse +{ + +} \ No newline at end of file diff --git a/Software/PMR/Messages/Integration/ExternalClientLoginRequest.proto b/Software/PMR/Messages/Integration/ExternalClientLoginRequest.proto deleted file mode 100644 index 624532823..000000000 --- a/Software/PMR/Messages/Integration/ExternalClientLoginRequest.proto +++ /dev/null @@ -1,9 +0,0 @@ -syntax = "proto3"; - -package Tango.PMR.Integration; -option java_package = "com.twine.tango.pmr.integration"; - -message ExternalClientLoginRequest -{ - string Password = 1; -} \ No newline at end of file diff --git a/Software/PMR/Messages/Integration/ExternalClientLoginResponse.proto b/Software/PMR/Messages/Integration/ExternalClientLoginResponse.proto deleted file mode 100644 index 7d0ef89b5..000000000 --- a/Software/PMR/Messages/Integration/ExternalClientLoginResponse.proto +++ /dev/null @@ -1,10 +0,0 @@ -syntax = "proto3"; - -package Tango.PMR.Integration; -option java_package = "com.twine.tango.pmr.integration"; - -message ExternalClientLoginResponse -{ - bool Authenticated = 1; - string SerialNumber = 2; -} \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs index d209e3f27..e53ec0b39 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -451,7 +451,7 @@ namespace Tango.MachineStudio.UI.ViewModels await x.SelectedMachine.Connect(); - var authenticated = await x.SelectedMachine.As().Authenticate(login.Password); + var authenticated = await x.SelectedMachine.As().Authenticate(login.Password, Environment.MachineName, AuthenticationProvider.CurrentUser.Guid, "Machine Studio"); if (!authenticated) { _notificationProvider.ShowError("It seems like you are not authorized to access the selected machine."); @@ -459,6 +459,14 @@ namespace Tango.MachineStudio.UI.ViewModels else { ApplicationManager.ConnectedMachine = x.SelectedMachine; + (x.SelectedMachine as IExternalBridgeSecureClient).SessionClosed += (_, __) => + { + InvokeUI(() => + { + _notificationProvider.ShowError("The remote machine has closed the current session. Machine disconnected."); + ApplicationManager.ConnectedMachine = null; + }); + }; PostMessage(new MachineConnectionChangedMessage() { Machine = x.SelectedMachine }); _eventLogger.Log(String.Format("Successfully connected to machine {0} via TCP", x.SelectedMachine.SerialNumber)); } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj index 3bbba737c..ddacc3d9f 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj @@ -155,7 +155,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs index 17ad46245..236c8b272 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs @@ -11,6 +11,7 @@ using Tango.Core.DI; using Tango.PPC.Common; using Tango.PPC.Common.Connection; using Tango.PPC.Common.ExternalBridge; +using Tango.PPC.Common.Messages; using Tango.SharedUI.Components; namespace Tango.PPC.MachineSettings.ViewModels @@ -70,6 +71,8 @@ namespace Tango.PPC.MachineSettings.ViewModels Machine.ShallowCopyTo(MachineProvider.Machine); MachineProvider.Machine.SaveAsync(ObservablesEntitiesAdapter.Instance.Context); NavigationManager.NavigateBack(); + + RaiseMessage(new MachineSettingsSavedMessage() { Machine = MachineProvider.Machine }); } /// diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/PPCExternalBridgeService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/PPCExternalBridgeService.cs index 2459a2278..f478bb0e9 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/PPCExternalBridgeService.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/PPCExternalBridgeService.cs @@ -4,10 +4,12 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.BL.Entities; +using Tango.Core.DI; using Tango.Integration.ExternalBridge; using Tango.Integration.Operation; using Tango.PPC.Common.Application; using Tango.PPC.Common.Connection; +using Tango.PPC.Common.Messages; using Tango.Settings; namespace Tango.PPC.Common.ExternalBridge @@ -22,6 +24,11 @@ namespace Tango.PPC.Common.ExternalBridge Machine = machineProvider.Machine; Enabled = machineProvider.Machine.EnableExternalBridge; }; + + TangoMessenger.Default.Register((msg) => + { + Enabled = msg.Machine.EnableExternalBridge; + }); } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Messages/MachineSettingsSavedMessage.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Messages/MachineSettingsSavedMessage.cs new file mode 100644 index 000000000..20d1bb679 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Messages/MachineSettingsSavedMessage.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; + +namespace Tango.PPC.Common.Messages +{ + public class MachineSettingsSavedMessage + { + public Machine Machine { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj index 63d28c545..d09920b1b 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj @@ -106,6 +106,7 @@ + @@ -256,7 +257,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/machine-trans.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/machine-trans.png new file mode 100644 index 000000000..a7cf65852 Binary files /dev/null and b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/machine-trans.png differ diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index 5b65495b0..768b9b5ba 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -335,6 +335,7 @@ Tango.ColorLib.dll PreserveNewest + @@ -404,7 +405,7 @@ copy /Y "$(SolutionDir)Referenced Assemblies\vcruntime140d.dll" "$(TargetDir)" - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs index f0b6bbfdf..3c348c796 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs @@ -3,23 +3,74 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.Core.Commands; using Tango.Core.DI; +using Tango.Integration.ExternalBridge; using Tango.PPC.Common; using Tango.PPC.Common.ExternalBridge; +using Tango.PPC.Common.Navigation; namespace Tango.PPC.UI.ViewModels { + [TangoCreateWhenRegistered] public class ExternalBridgeViewVM : PPCViewModel { - /// - /// Gets or sets the external bridge service. - /// - [TangoInject] - public IPPCExternalBridgeService ExternalBridgeService { get; set; } + private ExternalBridgeClientConnectedEventArgs _connection; + public ExternalBridgeClientConnectedEventArgs Connection + { + get { return _connection; } + set { _connection = value; RaisePropertyChangedAuto(); } + } + + private User _user; + public User User + { + get { return _user; } + set { _user = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand CloseSessionCommand { get; set; } + + public ExternalBridgeViewVM() + { + CloseSessionCommand = new RelayCommand(CloseSession); + } + + private void CloseSession() + { + ExternalBridgeService.DisconnectSession(); + } public override void OnApplicationStarted() { - //throw new NotImplementedException(); + ExternalBridgeService.ClientConnected += ExternalBridgeService_ClientConnected; + ExternalBridgeService.ClientDisconnected += ExternalBridgeService_ClientDisconnected; + } + + private void ExternalBridgeService_ClientDisconnected(object sender, EventArgs e) + { + InvokeUI(() => + { + NavigationManager.NavigateTo(NavigationView.HomeModule); + }); + } + + private void ExternalBridgeService_ClientConnected(object sender, ExternalBridgeClientConnectedEventArgs e) + { + if (e.Request.Password == MachineProvider.Machine.ExternalBridgePassword) + { + e.Confirmed = true; + + Connection = e; + + User = Adapter.Users.SingleOrDefault(x => x.Guid == e.Request.UserGuid); + + InvokeUI(() => + { + NavigationManager.NavigateTo(NavigationView.ExternalBridgeView, false); + }); + } } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs index cf85246f8..67d885685 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.Core.DI; +using Tango.Integration.ExternalBridge; using Tango.PPC.Common; using Tango.PPC.Common.Application; using Tango.PPC.Common.Authentication; @@ -21,29 +22,8 @@ namespace Tango.PPC.UI.ViewModels /// public class MainViewVM : PPCViewModel { - [TangoInject] - public IPPCExternalBridgeService ExternalBridgeService { get; set; } - public override void OnApplicationStarted() { - ExternalBridgeService.ClientConnected += ExternalBridgeService_ClientConnected; - ExternalBridgeService.ClientDisconnected += ExternalBridgeService_ClientDisconnected; - } - - private void ExternalBridgeService_ClientDisconnected(object sender, EventArgs e) - { - InvokeUI(() => - { - NavigationManager.NavigateTo(Common.Navigation.NavigationView.HomeModule); - }); - } - - private void ExternalBridgeService_ClientConnected(object sender, EventArgs e) - { - InvokeUI(() => - { - NavigationManager.NavigateTo(Common.Navigation.NavigationView.ExternalBridgeView, false); - }); } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/ExternalBridgeView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/ExternalBridgeView.xaml index c2dad0a5e..6e7a9e7f6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/ExternalBridgeView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/ExternalBridgeView.xaml @@ -2,6 +2,8 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:global="clr-namespace:Tango.PPC.UI" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:vm="clr-namespace:Tango.PPC.UI.ViewModels" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" @@ -9,6 +11,52 @@ mc:Ignorable="d" d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:ExternalBridgeViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.ExternalBridgeViewVM}" Background="{StaticResource TangoPrimaryBackgroundBrush}"> - This machine is currently being controlled + + + + + + + + + + + This machine is currently being controlled by a remote host + + + IP Address: + + + Host Name: + + + App ID: + + + User: + + + + CLOSE SESSION + diff --git a/Software/Visual_Studio/Tango.Core/DI/TangoCreateWhenRegisteredAttribute.cs b/Software/Visual_Studio/Tango.Core/DI/TangoCreateWhenRegisteredAttribute.cs new file mode 100644 index 000000000..572c9f413 --- /dev/null +++ b/Software/Visual_Studio/Tango.Core/DI/TangoCreateWhenRegisteredAttribute.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Core.DI +{ + [AttributeUsage(AttributeTargets.Class)] + public class TangoCreateWhenRegisteredAttribute : Attribute + { + } +} diff --git a/Software/Visual_Studio/Tango.Core/DI/TangoIOC.cs b/Software/Visual_Studio/Tango.Core/DI/TangoIOC.cs index 50b892552..de42ac6e7 100644 --- a/Software/Visual_Studio/Tango.Core/DI/TangoIOC.cs +++ b/Software/Visual_Studio/Tango.Core/DI/TangoIOC.cs @@ -280,6 +280,11 @@ namespace Tango.Core.DI var registeredType = new RegisteredType(interfaceType, implementationType, instance); _registeredTypes.Add(interfaceType, registeredType); + if (implementationType.GetCustomAttribute() != null && instance == null) + { + instance = GetInstance(interfaceType); + } + if (registeredType.Instance != null) { NotifyAwaitingRetrievals(registeredType); @@ -363,7 +368,7 @@ namespace Tango.Core.DI } else { - GetInstanceWhenAvailable(prop.PropertyType, (x) => + GetInstanceWhenAvailable(prop.PropertyType, (x) => { prop.SetValue(target, GetInstance(prop.PropertyType)); }); diff --git a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj index 8f9c8a73f..a0c54ef89 100644 --- a/Software/Visual_Studio/Tango.Core/Tango.Core.csproj +++ b/Software/Visual_Studio/Tango.Core/Tango.Core.csproj @@ -74,6 +74,7 @@ + @@ -149,7 +150,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeClientConnectedEventArgs.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeClientConnectedEventArgs.cs new file mode 100644 index 000000000..2bfe60477 --- /dev/null +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeClientConnectedEventArgs.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PMR.Integration; + +namespace Tango.Integration.ExternalBridge +{ + public class ExternalBridgeClientConnectedEventArgs : EventArgs + { + public ExternalBridgeLoginRequest Request { get; set; } + + public String IpAddress { get; set; } + + public bool Confirmed { get; set; } + } +} diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs index ff8a72bc3..7e55306d1 100644 --- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs @@ -23,7 +23,26 @@ namespace Tango.Integration.ExternalBridge private UdpDiscoveryService _discoverySevice; private TcpServer _tcpServer; + #region Events + + /// + /// Occurs when a new client is waiting for authentication. + /// + public event EventHandler ClientConnected; + + /// + /// Occurs when the last client has been disconnected. + /// + public event EventHandler ClientDisconnected; + + #endregion + + #region Properties + private IMachineOperator _machineOperator; + /// + /// Gets or sets the machine operator. + /// public IMachineOperator MachineOperator { get { return _machineOperator; } @@ -31,17 +50,24 @@ namespace Tango.Integration.ExternalBridge } private Machine _machine; - + /// + /// Gets or sets the machine. + /// public Machine Machine { get { return _machine; } set { _machine = value; OnMachineChanged(); } } + /// + /// Gets a value indicating whether this instance is started. + /// public bool IsStarted { get; private set; } private bool _enabled; - + /// + /// Gets or sets a value indicating whether this is enabled. + /// public bool Enabled { get { return _enabled; } @@ -62,7 +88,49 @@ namespace Tango.Integration.ExternalBridge } } - private void OnMachineChanged() + private bool _isInSession; + /// + /// Gets a value indicating whether a remote client is authenticated and in session. + /// + public bool IsInSession + { + get { return _isInSession; } + private set { _isInSession = value; RaisePropertyChangedAuto(); } + } + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + public ExternalBridgeService() + { + _tcpServer = new TcpServer(1984); + _tcpServer.ClientConnected += _tcpServer_ClientConnected; + } + + /// + /// Initializes a new instance of the class. + /// + /// The machine operator. + /// The machine. + public ExternalBridgeService(IMachineOperator machineOperator, Machine machine) : this() + { + Machine = machine; + MachineOperator = machineOperator; + } + + + #endregion + + #region Properties Changes + + /// + /// Called when the machine has been changed + /// + protected virtual void OnMachineChanged() { if (_discoverySevice != null && _discoverySevice.IsStarted) { @@ -75,24 +143,50 @@ namespace Tango.Integration.ExternalBridge }); } - public ExternalBridgeService() + /// + /// Called when the machine operator has been changed + /// + protected virtual void OnMachineOperatorChanged() { - _tcpServer = new TcpServer(1984); - _tcpServer.ClientConnected += _tcpServer_ClientConnected; + if (MachineOperator != null) + { + MachineOperator.StateChanged -= MachineOperator_StateChanged; + MachineOperator.StateChanged += MachineOperator_StateChanged; + } } - public ExternalBridgeService(IMachineOperator machineOperator, Machine machine) : this() - { - Machine = machine; - MachineOperator = machineOperator; - } + #endregion + + #region Event Handlers + /// + /// Handles the ClientConnected event of the _tcpServer control. + /// + /// The source of the event. + /// The instance containing the event data. private async void _tcpServer_ClientConnected(object sender, ClientConnectedEventArgs e) { Adapter = new TcpTransportAdapter(e.Socket); await Connect(); } + /// + /// Machines the operator state changed. + /// + /// The sender. + /// The e. + private void MachineOperator_StateChanged(object sender, TransportComponentState e) + { + //Do nothing right now. + } + + #endregion + + #region Public Methods + + /// + /// Starts this instance. + /// public void Start() { if (!IsStarted) @@ -106,6 +200,9 @@ namespace Tango.Integration.ExternalBridge } } + /// + /// Stops this instance. + /// public async void Stop() { if (IsStarted) @@ -114,6 +211,7 @@ namespace Tango.Integration.ExternalBridge _discoverySevice.Stop(); IsStarted = false; + IsInSession = false; _enabled = false; RaisePropertyChanged(nameof(Enabled)); @@ -122,28 +220,36 @@ namespace Tango.Integration.ExternalBridge await Disconnect(); } catch { } - - ClientDisconnected?.Invoke(this, new EventArgs()); } } - private void OnMachineOperatorChanged() + /// + /// Disconnects the current remote client session. + /// + public async void DisconnectSession() { - if (MachineOperator != null) + try { - MachineOperator.StateChanged -= MachineOperator_StateChanged; - MachineOperator.StateChanged += MachineOperator_StateChanged; - } - } + await SendRequest(new ExternalBridgeLogoutRequest()); - private void MachineOperator_StateChanged(object sender, TransportComponentState e) - { - if (e != TransportComponentState.Connected) + try + { + await Disconnect(); + } + catch { } + + OnClientDisconnected(); + } + catch (Exception ex) { - Stop(); + LogManager.Log(ex, "Error sending an external bridge log out request."); } } + #endregion + + #region Override Methods + protected async override void OnRequestReceived(MessageContainer container) { base.OnRequestReceived(container); @@ -157,26 +263,20 @@ namespace Tango.Integration.ExternalBridge DeviceInformation = MachineOperator.DeviceInformation, }, container.Token); } - else if (container.Type == MessageType.ExternalClientLoginRequest) + else if (container.Type == MessageType.ExternalBridgeLoginRequest) { - var request = MessageFactory.ParseTangoMessageFromContainer(container); - - var response = new ExternalClientLoginResponse(); - response.Authenticated = false; - - if (request.Message.Password == "1234") - { - response.Authenticated = true; - response.SerialNumber = Machine.SerialNumber; - ClientConnected?.Invoke(this, new EventArgs()); - } - - await SendResponse(response, container.Token); + var request = MessageFactory.ParseTangoMessageFromContainer(container); + OnClientConnected(request, container.Token); } else if (container.Type == MessageType.DisconnectRequest) { + OnClientDisconnected(); await SendResponse(new DisconnectResponse(), container.Token); - Stop(); + } + else if (container.Type == MessageType.ExternalBridgeLogoutRequest) + { + OnClientDisconnected(); + await SendResponse(new ExternalBridgeLogoutResponse(), container.Token); } else { @@ -189,26 +289,56 @@ namespace Tango.Integration.ExternalBridge { MachineOperator.SendContinuousRequest(container).Subscribe((response) => { - if (Enabled) + if (Enabled && IsInSession) { SendResponse(response); } }, (ex) => - { - if (Enabled) - { - if (ex is ResponseErrorException) - { - SendResponse((ex as ResponseErrorException).Container); - } - } - }); + { + if (Enabled) + { + if (ex is ResponseErrorException) + { + SendResponse((ex as ResponseErrorException).Container); + } + } + }); } } } - public event EventHandler ClientConnected; - public event EventHandler ClientDisconnected; + #endregion + + #region Virtual Methods + + /// + /// Called when the client has been connected + /// + /// The request. + /// The token. + protected async virtual void OnClientConnected(ExternalBridgeLoginRequest request, string token) + { + ExternalBridgeClientConnectedEventArgs args = new ExternalBridgeClientConnectedEventArgs(); + args.Request = request; + args.IpAddress = Adapter.Address; + ClientConnected?.Invoke(this, args); + + var response = new ExternalBridgeLoginResponse(); + response.Authenticated = args.Confirmed; + response.SerialNumber = Machine.SerialNumber; + + IsInSession = args.Confirmed; + + await SendResponse(response, token); + } + + protected virtual void OnClientDisconnected() + { + IsInSession = false; + ClientDisconnected?.Invoke(this, new EventArgs()); + } + + #endregion } } diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs index c90fb2264..19f1c902a 100644 --- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using Tango.BL; using Tango.BL.Entities; using Tango.Integration.Operation; +using Tango.PMR.Common; using Tango.PMR.Integration; using Tango.Settings; using Tango.Transport.Adapters; @@ -67,11 +68,14 @@ namespace Tango.Integration.ExternalBridge /// /// The password. /// - public async Task Authenticate(String password) + public async Task Authenticate(String password, String hostName, String userGuid, String appID) { - var response = await SendRequest(new ExternalClientLoginRequest() + var response = await SendRequest(new ExternalBridgeLoginRequest() { - Password = password + Password = password, + AppID = appID, + HostName = hostName, + UserGuid = userGuid }); return response.Message.Authenticated; } @@ -99,5 +103,30 @@ namespace Tango.Integration.ExternalBridge { return SerialNumber; } + + /// + /// Called when a new request has been received. + /// + /// The request. + protected async override void OnRequestReceived(MessageContainer request) + { + base.OnRequestReceived(request); + + if (request.Type == MessageType.ExternalBridgeLogoutRequest) + { + await SendResponse(new ExternalBridgeLogoutResponse(), request.Token); + try + { + await Disconnect(); + } + catch { } + SessionClosed?.Invoke(this, new EventArgs()); + } + } + + /// + /// Occurs when the remote host has closed the session. + /// + public event EventHandler SessionClosed; } } diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeSecureClient.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeSecureClient.cs index e109837fb..01506d525 100644 --- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeSecureClient.cs +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeSecureClient.cs @@ -12,11 +12,16 @@ namespace Tango.Integration.ExternalBridge /// public interface IExternalBridgeSecureClient : IExternalBridgeClient { + /// + /// Occurs when the remote host has closed the session. + /// + event EventHandler SessionClosed; + /// /// Authenticates with the service using the specified password. /// /// The password. /// - Task Authenticate(String password); + Task Authenticate(String password, String hostName, String userGuid, String appID); } } diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeService.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeService.cs index d69cefc09..59736193c 100644 --- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeService.cs +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeService.cs @@ -12,13 +12,54 @@ namespace Tango.Integration.ExternalBridge { public interface IExternalBridgeService : ITransporter { - event EventHandler ClientConnected; + /// + /// Occurs when a new client is waiting for authentication. + /// + event EventHandler ClientConnected; + + /// + /// Occurs when the last client has been disconnected. + /// event EventHandler ClientDisconnected; + + /// + /// Gets or sets the machine operator. + /// IMachineOperator MachineOperator { get; set; } + + /// + /// Gets or sets the machine. + /// Machine Machine { get; set; } + + /// + /// Gets a value indicating whether this instance is started. + /// bool IsStarted { get; } + + /// + /// Gets or sets a value indicating whether this is enabled. + /// + bool Enabled { get; set; } + + /// + /// Gets a value indicating whether a remote client is authenticated and in session. + /// + bool IsInSession { get; } + + /// + /// Starts this instance. + /// void Start(); + + /// + /// Stops this instance. + /// void Stop(); - bool Enabled { get; set; } + + /// + /// Disconnects the current remote client session. + /// + void DisconnectSession(); } } diff --git a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj index f5d1c587f..3b97266e4 100644 --- a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj +++ b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj @@ -82,6 +82,7 @@ + @@ -150,7 +151,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs b/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs index 8b7cae444..7969ed2bc 100644 --- a/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs +++ b/Software/Visual_Studio/Tango.PMR/Common/MessageType.cs @@ -22,7 +22,7 @@ namespace Tango.PMR.Common { static MessageTypeReflection() { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( - "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbirbJAoLTWVz", + "ChFNZXNzYWdlVHlwZS5wcm90bxIQVGFuZ28uUE1SLkNvbW1vbiqgJQoLTWVz", "c2FnZVR5cGUSCAoETm9uZRAAEhEKDUVycm9yUmVzcG9uc2UQARIUChBDYWxj", "dWxhdGVSZXF1ZXN0EAMSFQoRQ2FsY3VsYXRlUmVzcG9uc2UQBBITCg9Qcm9n", "cmVzc1JlcXVlc3QQBRIUChBQcm9ncmVzc1Jlc3BvbnNlEAYSHAoYU3R1YkNh", @@ -86,49 +86,50 @@ namespace Tango.PMR.Common { "EiIKHlN0dWJFeHRGbGFz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RDzLhIW", + "ChFEaXNjb25uZWN0UmVxdWVzdBD0LhIXChJEaXNjb25uZWN0UmVzcG9uc2UQ", + "9S4SFgoRRmlsZVVwbG9hZFJlcXVlc3QQ2DYSFwoSRmlsZVVwbG9hZFJlc3Bv", + "bnNlENk2EhsKFkZpbGVDaHVua1VwbG9hZFJlcXVlc3QQ2jYSHAoXRmlsZUNo", + "dW5rVXBsb2FkUmVzcG9uc2UQ2zYSGgoVRXhlY3V0ZVByb2Nlc3NSZXF1ZXN0", + "ENw2EhsKFkV4ZWN1dGVQcm9jZXNzUmVzcG9uc2UQ3TYSFwoSS2lsbFByb2Nl", + "c3NSZXF1ZXN0EN42EhgKE0tpbGxQcm9jZXNzUmVzcG9uc2UQ3zZCHAoaY29t", + "LnR3aW5lLnRhbmdvLnBtci5jb21tb25iBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { }, new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Tango.PMR.Common.MessageType), }, null)); @@ -249,12 +250,14 @@ namespace Tango.PMR.Common { ///Integration /// [pbr::OriginalName("ExternalBridgeUdpDiscoveryPacket")] ExternalBridgeUdpDiscoveryPacket = 1000, - [pbr::OriginalName("ExternalClientLoginRequest")] ExternalClientLoginRequest = 1001, - [pbr::OriginalName("ExternalClientLoginResponse")] ExternalClientLoginResponse = 1002, - [pbr::OriginalName("DirectSynchronizationRequest")] DirectSynchronizationRequest = 1003, - [pbr::OriginalName("DirectSynchronizationResponse")] DirectSynchronizationResponse = 1004, - [pbr::OriginalName("OverrideDataBaseRequest")] OverrideDataBaseRequest = 1005, - [pbr::OriginalName("OverrideDataBaseResponse")] OverrideDataBaseResponse = 1006, + [pbr::OriginalName("ExternalBridgeLoginRequest")] ExternalBridgeLoginRequest = 1001, + [pbr::OriginalName("ExternalBridgeLoginResponse")] ExternalBridgeLoginResponse = 1002, + [pbr::OriginalName("ExternalBridgeLogoutRequest")] ExternalBridgeLogoutRequest = 1003, + [pbr::OriginalName("ExternalBridgeLogoutResponse")] ExternalBridgeLogoutResponse = 1004, + [pbr::OriginalName("DirectSynchronizationRequest")] DirectSynchronizationRequest = 1005, + [pbr::OriginalName("DirectSynchronizationResponse")] DirectSynchronizationResponse = 1006, + [pbr::OriginalName("OverrideDataBaseRequest")] OverrideDataBaseRequest = 1007, + [pbr::OriginalName("OverrideDataBaseResponse")] OverrideDataBaseResponse = 1008, /// ///Diagnostics /// diff --git a/Software/Visual_Studio/Tango.PMR/Integration/ExternalBridgeLoginRequest.cs b/Software/Visual_Studio/Tango.PMR/Integration/ExternalBridgeLoginRequest.cs new file mode 100644 index 000000000..0adfcb13f --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Integration/ExternalBridgeLoginRequest.cs @@ -0,0 +1,245 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: ExternalBridgeLoginRequest.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Integration { + + /// Holder for reflection information generated from ExternalBridgeLoginRequest.proto + public static partial class ExternalBridgeLoginRequestReflection { + + #region Descriptor + /// File descriptor for ExternalBridgeLoginRequest.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static ExternalBridgeLoginRequestReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiBFeHRlcm5hbEJyaWRnZUxvZ2luUmVxdWVzdC5wcm90bxIVVGFuZ28uUE1S", + "LkludGVncmF0aW9uImEKGkV4dGVybmFsQnJpZGdlTG9naW5SZXF1ZXN0Eg0K", + "BUFwcElEGAEgASgJEhAKCFVzZXJHdWlkGAIgASgJEhAKCEhvc3ROYW1lGAMg", + "ASgJEhAKCFBhc3N3b3JkGAQgASgJQiEKH2NvbS50d2luZS50YW5nby5wbXIu", + "aW50ZWdyYXRpb25iBnByb3RvMw==")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Integration.ExternalBridgeLoginRequest), global::Tango.PMR.Integration.ExternalBridgeLoginRequest.Parser, new[]{ "AppID", "UserGuid", "HostName", "Password" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class ExternalBridgeLoginRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ExternalBridgeLoginRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Integration.ExternalBridgeLoginRequestReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ExternalBridgeLoginRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ExternalBridgeLoginRequest(ExternalBridgeLoginRequest other) : this() { + appID_ = other.appID_; + userGuid_ = other.userGuid_; + hostName_ = other.hostName_; + password_ = other.password_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ExternalBridgeLoginRequest Clone() { + return new ExternalBridgeLoginRequest(this); + } + + /// Field number for the "AppID" field. + public const int AppIDFieldNumber = 1; + private string appID_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string AppID { + get { return appID_; } + set { + appID_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "UserGuid" field. + public const int UserGuidFieldNumber = 2; + private string userGuid_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string UserGuid { + get { return userGuid_; } + set { + userGuid_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "HostName" field. + public const int HostNameFieldNumber = 3; + private string hostName_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string HostName { + get { return hostName_; } + set { + hostName_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + /// Field number for the "Password" field. + public const int PasswordFieldNumber = 4; + private string password_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string Password { + get { return password_; } + set { + password_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ExternalBridgeLoginRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ExternalBridgeLoginRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (AppID != other.AppID) return false; + if (UserGuid != other.UserGuid) return false; + if (HostName != other.HostName) return false; + if (Password != other.Password) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (AppID.Length != 0) hash ^= AppID.GetHashCode(); + if (UserGuid.Length != 0) hash ^= UserGuid.GetHashCode(); + if (HostName.Length != 0) hash ^= HostName.GetHashCode(); + if (Password.Length != 0) hash ^= Password.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (AppID.Length != 0) { + output.WriteRawTag(10); + output.WriteString(AppID); + } + if (UserGuid.Length != 0) { + output.WriteRawTag(18); + output.WriteString(UserGuid); + } + if (HostName.Length != 0) { + output.WriteRawTag(26); + output.WriteString(HostName); + } + if (Password.Length != 0) { + output.WriteRawTag(34); + output.WriteString(Password); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (AppID.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(AppID); + } + if (UserGuid.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(UserGuid); + } + if (HostName.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(HostName); + } + if (Password.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(Password); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ExternalBridgeLoginRequest other) { + if (other == null) { + return; + } + if (other.AppID.Length != 0) { + AppID = other.AppID; + } + if (other.UserGuid.Length != 0) { + UserGuid = other.UserGuid; + } + if (other.HostName.Length != 0) { + HostName = other.HostName; + } + if (other.Password.Length != 0) { + Password = other.Password; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 10: { + AppID = input.ReadString(); + break; + } + case 18: { + UserGuid = input.ReadString(); + break; + } + case 26: { + HostName = input.ReadString(); + break; + } + case 34: { + Password = input.ReadString(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Integration/ExternalBridgeLoginResponse.cs b/Software/Visual_Studio/Tango.PMR/Integration/ExternalBridgeLoginResponse.cs new file mode 100644 index 000000000..f0a34899e --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Integration/ExternalBridgeLoginResponse.cs @@ -0,0 +1,188 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: ExternalBridgeLoginResponse.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Integration { + + /// Holder for reflection information generated from ExternalBridgeLoginResponse.proto + public static partial class ExternalBridgeLoginResponseReflection { + + #region Descriptor + /// File descriptor for ExternalBridgeLoginResponse.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static ExternalBridgeLoginResponseReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiFFeHRlcm5hbEJyaWRnZUxvZ2luUmVzcG9uc2UucHJvdG8SFVRhbmdvLlBN", + "Ui5JbnRlZ3JhdGlvbiJKChtFeHRlcm5hbEJyaWRnZUxvZ2luUmVzcG9uc2US", + "FQoNQXV0aGVudGljYXRlZBgBIAEoCBIUCgxTZXJpYWxOdW1iZXIYAiABKAlC", + "IQofY29tLnR3aW5lLnRhbmdvLnBtci5pbnRlZ3JhdGlvbmIGcHJvdG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Integration.ExternalBridgeLoginResponse), global::Tango.PMR.Integration.ExternalBridgeLoginResponse.Parser, new[]{ "Authenticated", "SerialNumber" }, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class ExternalBridgeLoginResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ExternalBridgeLoginResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Integration.ExternalBridgeLoginResponseReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ExternalBridgeLoginResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ExternalBridgeLoginResponse(ExternalBridgeLoginResponse other) : this() { + authenticated_ = other.authenticated_; + serialNumber_ = other.serialNumber_; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ExternalBridgeLoginResponse Clone() { + return new ExternalBridgeLoginResponse(this); + } + + /// Field number for the "Authenticated" field. + public const int AuthenticatedFieldNumber = 1; + private bool authenticated_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Authenticated { + get { return authenticated_; } + set { + authenticated_ = value; + } + } + + /// Field number for the "SerialNumber" field. + public const int SerialNumberFieldNumber = 2; + private string serialNumber_ = ""; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public string SerialNumber { + get { return serialNumber_; } + set { + serialNumber_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ExternalBridgeLoginResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ExternalBridgeLoginResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (Authenticated != other.Authenticated) return false; + if (SerialNumber != other.SerialNumber) return false; + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + if (Authenticated != false) hash ^= Authenticated.GetHashCode(); + if (SerialNumber.Length != 0) hash ^= SerialNumber.GetHashCode(); + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + if (Authenticated != false) { + output.WriteRawTag(8); + output.WriteBool(Authenticated); + } + if (SerialNumber.Length != 0) { + output.WriteRawTag(18); + output.WriteString(SerialNumber); + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + if (Authenticated != false) { + size += 1 + 1; + } + if (SerialNumber.Length != 0) { + size += 1 + pb::CodedOutputStream.ComputeStringSize(SerialNumber); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ExternalBridgeLoginResponse other) { + if (other == null) { + return; + } + if (other.Authenticated != false) { + Authenticated = other.Authenticated; + } + if (other.SerialNumber.Length != 0) { + SerialNumber = other.SerialNumber; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + case 8: { + Authenticated = input.ReadBool(); + break; + } + case 18: { + SerialNumber = input.ReadString(); + break; + } + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Integration/ExternalBridgeLogoutRequest.cs b/Software/Visual_Studio/Tango.PMR/Integration/ExternalBridgeLogoutRequest.cs new file mode 100644 index 000000000..b994e8eb0 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Integration/ExternalBridgeLogoutRequest.cs @@ -0,0 +1,131 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: ExternalBridgeLogoutRequest.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Integration { + + /// Holder for reflection information generated from ExternalBridgeLogoutRequest.proto + public static partial class ExternalBridgeLogoutRequestReflection { + + #region Descriptor + /// File descriptor for ExternalBridgeLogoutRequest.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static ExternalBridgeLogoutRequestReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiFFeHRlcm5hbEJyaWRnZUxvZ291dFJlcXVlc3QucHJvdG8SFVRhbmdvLlBN", + "Ui5JbnRlZ3JhdGlvbiIdChtFeHRlcm5hbEJyaWRnZUxvZ291dFJlcXVlc3RC", + "IQofY29tLnR3aW5lLnRhbmdvLnBtci5pbnRlZ3JhdGlvbmIGcHJvdG8z")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Integration.ExternalBridgeLogoutRequest), global::Tango.PMR.Integration.ExternalBridgeLogoutRequest.Parser, null, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class ExternalBridgeLogoutRequest : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ExternalBridgeLogoutRequest()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Integration.ExternalBridgeLogoutRequestReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ExternalBridgeLogoutRequest() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ExternalBridgeLogoutRequest(ExternalBridgeLogoutRequest other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ExternalBridgeLogoutRequest Clone() { + return new ExternalBridgeLogoutRequest(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ExternalBridgeLogoutRequest); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ExternalBridgeLogoutRequest other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ExternalBridgeLogoutRequest other) { + if (other == null) { + return; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Integration/ExternalBridgeLogoutResponse.cs b/Software/Visual_Studio/Tango.PMR/Integration/ExternalBridgeLogoutResponse.cs new file mode 100644 index 000000000..4cd6d9835 --- /dev/null +++ b/Software/Visual_Studio/Tango.PMR/Integration/ExternalBridgeLogoutResponse.cs @@ -0,0 +1,131 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: ExternalBridgeLogoutResponse.proto +#pragma warning disable 1591, 0612, 3021 +#region Designer generated code + +using pb = global::Google.Protobuf; +using pbc = global::Google.Protobuf.Collections; +using pbr = global::Google.Protobuf.Reflection; +using scg = global::System.Collections.Generic; +namespace Tango.PMR.Integration { + + /// Holder for reflection information generated from ExternalBridgeLogoutResponse.proto + public static partial class ExternalBridgeLogoutResponseReflection { + + #region Descriptor + /// File descriptor for ExternalBridgeLogoutResponse.proto + public static pbr::FileDescriptor Descriptor { + get { return descriptor; } + } + private static pbr::FileDescriptor descriptor; + + static ExternalBridgeLogoutResponseReflection() { + byte[] descriptorData = global::System.Convert.FromBase64String( + string.Concat( + "CiJFeHRlcm5hbEJyaWRnZUxvZ291dFJlc3BvbnNlLnByb3RvEhVUYW5nby5Q", + "TVIuSW50ZWdyYXRpb24iHgocRXh0ZXJuYWxCcmlkZ2VMb2dvdXRSZXNwb25z", + "ZUIhCh9jb20udHdpbmUudGFuZ28ucG1yLmludGVncmF0aW9uYgZwcm90bzM=")); + descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, + new pbr::FileDescriptor[] { }, + new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Integration.ExternalBridgeLogoutResponse), global::Tango.PMR.Integration.ExternalBridgeLogoutResponse.Parser, null, null, null, null) + })); + } + #endregion + + } + #region Messages + public sealed partial class ExternalBridgeLogoutResponse : pb::IMessage { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ExternalBridgeLogoutResponse()); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public static pbr::MessageDescriptor Descriptor { + get { return global::Tango.PMR.Integration.ExternalBridgeLogoutResponseReflection.Descriptor.MessageTypes[0]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ExternalBridgeLogoutResponse() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ExternalBridgeLogoutResponse(ExternalBridgeLogoutResponse other) : this() { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public ExternalBridgeLogoutResponse Clone() { + return new ExternalBridgeLogoutResponse(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override bool Equals(object other) { + return Equals(other as ExternalBridgeLogoutResponse); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public bool Equals(ExternalBridgeLogoutResponse other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + return true; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override int GetHashCode() { + int hash = 1; + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void WriteTo(pb::CodedOutputStream output) { + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int CalculateSize() { + int size = 0; + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(ExternalBridgeLogoutResponse other) { + if (other == null) { + return; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public void MergeFrom(pb::CodedInputStream input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + input.SkipLastField(); + break; + } + } + } + + } + + #endregion + +} + +#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Integration/ExternalClientLoginRequest.cs b/Software/Visual_Studio/Tango.PMR/Integration/ExternalClientLoginRequest.cs deleted file mode 100644 index a3a1295d5..000000000 --- a/Software/Visual_Studio/Tango.PMR/Integration/ExternalClientLoginRequest.cs +++ /dev/null @@ -1,160 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: ExternalClientLoginRequest.proto -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Tango.PMR.Integration { - - /// Holder for reflection information generated from ExternalClientLoginRequest.proto - public static partial class ExternalClientLoginRequestReflection { - - #region Descriptor - /// File descriptor for ExternalClientLoginRequest.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static ExternalClientLoginRequestReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "CiBFeHRlcm5hbENsaWVudExvZ2luUmVxdWVzdC5wcm90bxIVVGFuZ28uUE1S", - "LkludGVncmF0aW9uIi4KGkV4dGVybmFsQ2xpZW50TG9naW5SZXF1ZXN0EhAK", - "CFBhc3N3b3JkGAEgASgJQiEKH2NvbS50d2luZS50YW5nby5wbXIuaW50ZWdy", - "YXRpb25iBnByb3RvMw==")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Integration.ExternalClientLoginRequest), global::Tango.PMR.Integration.ExternalClientLoginRequest.Parser, new[]{ "Password" }, null, null, null) - })); - } - #endregion - - } - #region Messages - public sealed partial class ExternalClientLoginRequest : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ExternalClientLoginRequest()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Tango.PMR.Integration.ExternalClientLoginRequestReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ExternalClientLoginRequest() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ExternalClientLoginRequest(ExternalClientLoginRequest other) : this() { - password_ = other.password_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ExternalClientLoginRequest Clone() { - return new ExternalClientLoginRequest(this); - } - - /// Field number for the "Password" field. - public const int PasswordFieldNumber = 1; - private string password_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string Password { - get { return password_; } - set { - password_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ExternalClientLoginRequest); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ExternalClientLoginRequest other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Password != other.Password) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Password.Length != 0) hash ^= Password.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Password.Length != 0) { - output.WriteRawTag(10); - output.WriteString(Password); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Password.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(Password); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ExternalClientLoginRequest other) { - if (other == null) { - return; - } - if (other.Password.Length != 0) { - Password = other.Password; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 10: { - Password = input.ReadString(); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Integration/ExternalClientLoginResponse.cs b/Software/Visual_Studio/Tango.PMR/Integration/ExternalClientLoginResponse.cs deleted file mode 100644 index 3d374024c..000000000 --- a/Software/Visual_Studio/Tango.PMR/Integration/ExternalClientLoginResponse.cs +++ /dev/null @@ -1,188 +0,0 @@ -// Generated by the protocol buffer compiler. DO NOT EDIT! -// source: ExternalClientLoginResponse.proto -#pragma warning disable 1591, 0612, 3021 -#region Designer generated code - -using pb = global::Google.Protobuf; -using pbc = global::Google.Protobuf.Collections; -using pbr = global::Google.Protobuf.Reflection; -using scg = global::System.Collections.Generic; -namespace Tango.PMR.Integration { - - /// Holder for reflection information generated from ExternalClientLoginResponse.proto - public static partial class ExternalClientLoginResponseReflection { - - #region Descriptor - /// File descriptor for ExternalClientLoginResponse.proto - public static pbr::FileDescriptor Descriptor { - get { return descriptor; } - } - private static pbr::FileDescriptor descriptor; - - static ExternalClientLoginResponseReflection() { - byte[] descriptorData = global::System.Convert.FromBase64String( - string.Concat( - "CiFFeHRlcm5hbENsaWVudExvZ2luUmVzcG9uc2UucHJvdG8SFVRhbmdvLlBN", - "Ui5JbnRlZ3JhdGlvbiJKChtFeHRlcm5hbENsaWVudExvZ2luUmVzcG9uc2US", - "FQoNQXV0aGVudGljYXRlZBgBIAEoCBIUCgxTZXJpYWxOdW1iZXIYAiABKAlC", - "IQofY29tLnR3aW5lLnRhbmdvLnBtci5pbnRlZ3JhdGlvbmIGcHJvdG8z")); - descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, - new pbr::FileDescriptor[] { }, - new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Integration.ExternalClientLoginResponse), global::Tango.PMR.Integration.ExternalClientLoginResponse.Parser, new[]{ "Authenticated", "SerialNumber" }, null, null, null) - })); - } - #endregion - - } - #region Messages - public sealed partial class ExternalClientLoginResponse : pb::IMessage { - private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new ExternalClientLoginResponse()); - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pb::MessageParser Parser { get { return _parser; } } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public static pbr::MessageDescriptor Descriptor { - get { return global::Tango.PMR.Integration.ExternalClientLoginResponseReflection.Descriptor.MessageTypes[0]; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - pbr::MessageDescriptor pb::IMessage.Descriptor { - get { return Descriptor; } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ExternalClientLoginResponse() { - OnConstruction(); - } - - partial void OnConstruction(); - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ExternalClientLoginResponse(ExternalClientLoginResponse other) : this() { - authenticated_ = other.authenticated_; - serialNumber_ = other.serialNumber_; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public ExternalClientLoginResponse Clone() { - return new ExternalClientLoginResponse(this); - } - - /// Field number for the "Authenticated" field. - public const int AuthenticatedFieldNumber = 1; - private bool authenticated_; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Authenticated { - get { return authenticated_; } - set { - authenticated_ = value; - } - } - - /// Field number for the "SerialNumber" field. - public const int SerialNumberFieldNumber = 2; - private string serialNumber_ = ""; - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public string SerialNumber { - get { return serialNumber_; } - set { - serialNumber_ = pb::ProtoPreconditions.CheckNotNull(value, "value"); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override bool Equals(object other) { - return Equals(other as ExternalClientLoginResponse); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public bool Equals(ExternalClientLoginResponse other) { - if (ReferenceEquals(other, null)) { - return false; - } - if (ReferenceEquals(other, this)) { - return true; - } - if (Authenticated != other.Authenticated) return false; - if (SerialNumber != other.SerialNumber) return false; - return true; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override int GetHashCode() { - int hash = 1; - if (Authenticated != false) hash ^= Authenticated.GetHashCode(); - if (SerialNumber.Length != 0) hash ^= SerialNumber.GetHashCode(); - return hash; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public override string ToString() { - return pb::JsonFormatter.ToDiagnosticString(this); - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void WriteTo(pb::CodedOutputStream output) { - if (Authenticated != false) { - output.WriteRawTag(8); - output.WriteBool(Authenticated); - } - if (SerialNumber.Length != 0) { - output.WriteRawTag(18); - output.WriteString(SerialNumber); - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public int CalculateSize() { - int size = 0; - if (Authenticated != false) { - size += 1 + 1; - } - if (SerialNumber.Length != 0) { - size += 1 + pb::CodedOutputStream.ComputeStringSize(SerialNumber); - } - return size; - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(ExternalClientLoginResponse other) { - if (other == null) { - return; - } - if (other.Authenticated != false) { - Authenticated = other.Authenticated; - } - if (other.SerialNumber.Length != 0) { - SerialNumber = other.SerialNumber; - } - } - - [global::System.Diagnostics.DebuggerNonUserCodeAttribute] - public void MergeFrom(pb::CodedInputStream input) { - uint tag; - while ((tag = input.ReadTag()) != 0) { - switch(tag) { - default: - input.SkipLastField(); - break; - case 8: { - Authenticated = input.ReadBool(); - break; - } - case 18: { - SerialNumber = input.ReadString(); - break; - } - } - } - } - - } - - #endregion - -} - -#endregion Designer generated code diff --git a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj index 07b4e9294..79f5cc4f7 100644 --- a/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj +++ b/Software/Visual_Studio/Tango.PMR/Tango.PMR.csproj @@ -140,9 +140,11 @@ + + + + - - @@ -197,7 +199,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Transport/Adapters/TcpTransportAdapter.cs b/Software/Visual_Studio/Tango.Transport/Adapters/TcpTransportAdapter.cs index 8069efcf3..8d7a997f3 100644 --- a/Software/Visual_Studio/Tango.Transport/Adapters/TcpTransportAdapter.cs +++ b/Software/Visual_Studio/Tango.Transport/Adapters/TcpTransportAdapter.cs @@ -64,6 +64,7 @@ namespace Tango.Transport.Adapters { _initializedFromConstructor = true; _socket = socket; + Address = socket.GetIPAddress().ToStringSafe(); SetSocketProperties(); } @@ -179,20 +180,23 @@ namespace Tango.Transport.Adapters int expectedSize = BitConverter.ToInt32(_size_buffer, 0); - byte[] data = new byte[expectedSize]; - int read = 0; - - while (read < expectedSize) + if (expectedSize > 0) { - read += _socket.GetStream().Read(data, read, Math.Min(_socket.Available, expectedSize - read)); + byte[] data = new byte[expectedSize]; + int read = 0; - if (State != TransportComponentState.Connected) + while (read < expectedSize) { - break; + read += _socket.GetStream().Read(data, read, Math.Min(_socket.Available, expectedSize - read)); + + if (State != TransportComponentState.Connected) + { + break; + } } - } - OnDataAvailable(data); + OnDataAvailable(data); + } PullThreadMethod(); } -- cgit v1.3.1