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. --- .../Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs | 2 +- .../MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels') diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs index 3cd3fb5f9..60447f37a 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.Core.Commands; -using Tango.Integration.Services; +using Tango.Integration.ExternalBridge; using Tango.MachineStudio.Common.Notifications; using Tango.SharedUI; 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 d62b12aab4f521ff287da135b6e66e92629a50dd Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 29 Jul 2018 10:56:41 +0300 Subject: Added data source in about dialog in machine studio. Added last monitor in machine studio settings. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 1835008 -> 1835008 bytes .../MachineStudioSettings.cs | 8 + .../Tango.MachineStudio.UI/MainWindow.xaml | 2 +- .../Tango.MachineStudio.UI/MainWindow.xaml.cs | 20 ++- .../DefaultStudioApplicationManager.cs | 114 ++++++++------- .../ViewModels/AboutViewVM.cs | 5 + .../Tango.MachineStudio.UI/Views/AboutView.xaml | 4 +- .../PPC/Modules/Tango.PPC.MachineSettings/App.xaml | 11 ++ .../Images/ppc-module.png | Bin 0 -> 1748 bytes .../MachineSettingsModule.cs | 84 +++++++++++ .../Properties/AssemblyInfo.cs | 20 +++ .../Properties/Resources.Designer.cs | 71 +++++++++ .../Properties/Resources.resx | 117 +++++++++++++++ .../Properties/Settings.Designer.cs | 30 ++++ .../Properties/Settings.settings | 7 + .../Tango.PPC.MachineSettings.csproj | 161 +++++++++++++++++++++ .../Tango.PPC.MachineSettings/ViewModelLocator.cs | 32 ++++ .../ViewModels/MainViewVM.cs | 24 +++ .../Tango.PPC.MachineSettings/Views/MainView.xaml | 14 ++ .../Views/MainView.xaml.cs | 28 ++++ .../Modules/Tango.PPC.MachineSettings/app.config | 61 ++++++++ .../Tango.PPC.MachineSettings/packages.config | 7 + Software/Visual_Studio/Tango.sln | 55 ++++++- 24 files changed, 817 insertions(+), 58 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/App.xaml create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Images/ppc-module.png create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/MachineSettingsModule.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/AssemblyInfo.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Resources.Designer.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Resources.resx create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Settings.Designer.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Settings.settings create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModelLocator.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/app.config create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/packages.config (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index c88505833..163460bb9 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 665a0d93e..44c77937d 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs index b12d9a580..d63e07594 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows; using Tango.Logging; using Tango.Settings; @@ -40,13 +41,20 @@ namespace Tango.MachineStudio.Common /// public List LoggingCategories { get; set; } + /// + /// Gets or sets the last bounds. + /// + public Rect LastBounds { get; set; } + /// /// Initializes a new instance of the class. /// public MachineStudioSettings() { + LastBounds = new Rect(); LoggingCategories = new List(); UpdateServiceAddress = "http://twine01/MachineStudioUpdateService/MachineStudioUpdateService.svc"; + } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml index 1dfe4c18f..b8a6cd1c0 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml @@ -8,7 +8,7 @@ xmlns:views="clr-namespace:Tango.MachineStudio.UI.Views" xmlns:sharedControls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" mc:Ignorable="d" - Title="Tango" Height="800" Width="1280" WindowStartupLocation="CenterOwner" WindowState="Maximized" Foreground="#494949" BorderThickness="1" BorderBrush="{StaticResource AccentColorBrush}"> + Title="Tango" Height="800" Width="1280" Foreground="#494949" BorderThickness="1" BorderBrush="{StaticResource AccentColorBrush}"> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs index 9901d3b80..f0f93a867 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/MainWindow.xaml.cs @@ -18,7 +18,9 @@ using System.Windows.Shapes; using Tango.Core.DI; using Tango.Core.Helpers; using Tango.Logging; +using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.StudioApplication; +using Tango.Settings; namespace Tango.MachineStudio.UI { @@ -37,10 +39,20 @@ namespace Tango.MachineStudio.UI try { InitializeComponent(); + + WindowStartupLocation = WindowStartupLocation.Manual; + + var r = SettingsManager.Default.GetOrCreate().LastBounds; + + if (r.Width > 0 && r.Height > 0) + { + Left = r.Left; + } + Instance = this; ThreadsHelper.SetDisptacher(Dispatcher); - this.Closing += MainWindow_Closing; + Closing += MainWindow_Closing; } catch (Exception ex) { @@ -49,6 +61,12 @@ namespace Tango.MachineStudio.UI this.Loaded += MainWindow_Loaded; this.SizeChanged += MainWindow_SizeChanged; + ContentRendered += MainWindow_ContentRendered; + } + + private void MainWindow_ContentRendered(object sender, EventArgs e) + { + WindowState = WindowState.Maximized; } private void MainWindow_SizeChanged(object sender, SizeChangedEventArgs e) diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs index d6a832c8a..c7ac60ace 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -148,76 +148,92 @@ namespace Tango.MachineStudio.UI.StudioApplication IsShuttingDown = true; - await Task.Factory.StartNew(async () => + try { + Rect r = new Rect( + MainWindow.Instance.Left, + MainWindow.Instance.Top, + MainWindow.Instance.Width, + MainWindow.Instance.Height); + + await Task.Factory.StartNew(async () => + { //Do Shutdown Procedures... foreach (var vm in TangoIOC.Default.GetAllInstancesByBase()) - { - try { - var result = await vm.OnShutdownRequest(); - if (!result) + try + { + var result = await vm.OnShutdownRequest(); + if (!result) + { + IsShuttingDown = false; + return; + } + } + catch (Exception ex) { - IsShuttingDown = false; - return; + LogManager.Log(ex, "Error on shutdown request with " + vm.GetType().Name); } } - catch (Exception ex) + + foreach (var vm in TangoIOC.Default.GetAllInstancesByBase()) { - LogManager.Log(ex, "Error on shutdown request with " + vm.GetType().Name); + vm.OnShuttingDown(); } - } - foreach (var vm in TangoIOC.Default.GetAllInstancesByBase()) - { - vm.OnShuttingDown(); - } + SettingsManager.Default.GetOrCreate().LastBounds = r; - try - { - SettingsManager.Default.Save(); - } - catch (Exception ex) - { - LogManager.Log(ex, "Error saving settings."); - } + try + { + SettingsManager.Default.Save(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error saving settings."); + } - _navigationManager.NavigateTo(NavigationView.ShutdownView); + _navigationManager.NavigateTo(NavigationView.ShutdownView); - Thread.Sleep(1500); + Thread.Sleep(1500); - foreach (var window in _openedWindows) - { - ThreadsHelper.InvokeUI(() => + foreach (var window in _openedWindows) { - window.Close(); - }); - } + ThreadsHelper.InvokeUI(() => + { + window.Close(); + }); + } - try - { - if (ConnectedMachine != null) + try { - ConnectedMachine.Disconnect().Wait(); + if (ConnectedMachine != null) + { + ConnectedMachine.Disconnect().Wait(); + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error disconnecting from machine."); } - } - catch (Exception ex) - { - LogManager.Log(ex, "Error disconnecting from machine."); - } - var eventLogger = TangoIOC.Default.GetInstance(); - if (eventLogger != null) - { - eventLogger.Log(EventTypes.ApplicationTerminated, "Application Terminated!"); - eventLogger.FlushAll(); - } + var eventLogger = TangoIOC.Default.GetInstance(); + if (eventLogger != null) + { + eventLogger.Log(EventTypes.ApplicationTerminated, "Application Terminated!"); + eventLogger.FlushAll(); + } - Thread.Sleep(1500); + Thread.Sleep(1500); - Environment.Exit(0); + Environment.Exit(0); - }); + }); + } + catch (Exception ex) + { + IsShuttingDown = false; + LogManager.Log(ex,"An error occurred while shutting down machine studio."); + } } /// @@ -264,7 +280,7 @@ namespace Tango.MachineStudio.UI.StudioApplication { get { - return typeof(ExtendedObject).Assembly.GetName().Version.ToString(3); + return typeof(ExtendedObject).Assembly.GetName().Version.ToString(3); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/AboutViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/AboutViewVM.cs index 5fe3b06b8..0b8a205f7 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/AboutViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/AboutViewVM.cs @@ -3,7 +3,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.Core; using Tango.MachineStudio.Common.StudioApplication; +using Tango.Settings; using Tango.SharedUI; namespace Tango.MachineStudio.UI.ViewModels @@ -12,9 +14,12 @@ namespace Tango.MachineStudio.UI.ViewModels { public IStudioApplicationManager ApplicationManager { get; set; } + public CoreSettings Settings { get; set; } + public AboutViewVM(IStudioApplicationManager applicationManager) { ApplicationManager = applicationManager; + Settings = SettingsManager.Default.GetOrCreate(); } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml index 2ac0df9de..0f8bceac7 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml @@ -36,13 +36,15 @@ - + Machine Studio: v Core Libraries: v Build Date: + Data Source: + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/App.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/App.xaml new file mode 100644 index 000000000..e3b2c28f8 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/App.xaml @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Images/ppc-module.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Images/ppc-module.png new file mode 100644 index 000000000..6f27f49be Binary files /dev/null and b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Images/ppc-module.png differ diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/MachineSettingsModule.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/MachineSettingsModule.cs new file mode 100644 index 000000000..0d6f7c75f --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/MachineSettingsModule.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media.Imaging; +using Tango.BL.Enumerations; +using Tango.PPC.Common; +using Tango.PPC.MachineSettings.Views; +using Tango.SharedUI.Helpers; + +namespace Tango.PPC.MachineSettings +{ + /// + /// Represents a PPC . + /// + /// + [PPCModule(2)] + public class MachineSettingsModule : PPCModuleBase + { + /// + /// Gets the module name. + /// + public override string Name + { + get + { + return "Settings"; + } + } + + /// + /// Gets the module description. + /// + public override string Description + { + get + { + return "Local Machine Settings"; + } + } + + /// + /// Gets the module cover image. + /// + public override BitmapSource Image + { + get + { + return ResourceHelper.GetImageFromResources("Images/ppc-module.png"); + } + } + + /// + /// Gets the module entry point view type. + /// + public override Type MainViewType + { + get + { + return typeof(MainView); + } + } + + /// + /// Gets the permission required to see and load this module. + /// + public override Permissions Permission + { + get + { + return Permissions.RunMachineStudio; + } + } + + /// + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// + public override void Dispose() + { + //Dispose module here... + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..52774bee8 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tango Module")] +[assembly: AssemblyVersion("2.0.1.1407")] + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Resources.Designer.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Resources.Designer.cs new file mode 100644 index 000000000..05abad8e0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.PPC.MachineSettings.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.PPC.MachineSettings.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Resources.resx b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Settings.Designer.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Settings.Designer.cs new file mode 100644 index 000000000..b16d01807 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tango.PPC.MachineSettings.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Settings.settings b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file 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 new file mode 100644 index 000000000..d0fccad96 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Tango.PPC.MachineSettings.csproj @@ -0,0 +1,161 @@ + + + + + Debug + AnyCPU + {91B70E9B-66A7-4873-AE10-400E71CF404F} + library + Tango.PPC.MachineSettings + Tango.PPC.MachineSettings + v4.6 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + + + true + full + false + ..\..\..\Build\Debug\PPC\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + ..\..\..\Build\Release\PPC\ + TRACE + prompt + 4 + + + + ..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.dll + True + + + ..\..\..\packages\EntityFramework.6.0.0\lib\net45\EntityFramework.SqlServer.dll + + + ..\..\..\packages\FontAwesome.WPF.4.7.0.9\lib\net40\FontAwesome.WPF.dll + + + ..\..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll + + + + + + ..\..\..\packages\Expression.Blend.Sdk.1.0.2\lib\net45\System.Windows.Interactivity.dll + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + Designer + MSBuild:Compile + + + + + GlobalVersionInfo.cs + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + + + MainView.xaml + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + {f441feee-322a-4943-b566-110e12fd3b72} + Tango.BL + + + {a34ee0f0-649d-41c8-8489-b6f1cc6924ee} + Tango.Core + + + {b112d89a-a106-41ae-a0c1-4abc84c477f5} + Tango.DragAndDrop + + + {bc932dbd-7cdb-488c-99e4-f02cf441f55e} + Tango.Logging + + + {e4927038-348d-4295-aaf4-861c58cb3943} + Tango.PMR + + + {d8f1ad85-526a-4f50-b6dc-d437af63d8d8} + Tango.Settings + + + {8491d07b-c1f6-4b62-a412-41b9fd2d6538} + Tango.SharedUI + + + {fd86424c-6e84-491b-8df9-3d0f5c236a2a} + Tango.Touch + + + {74e700b0-1156-4126-be40-ee450d3c3026} + Tango.Transport + + + {0be74eee-22cb-4dba-b896-793b9e1a3ac0} + Tango.PPC.Common + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModelLocator.cs new file mode 100644 index 000000000..5d3e101cd --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModelLocator.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.DI; +using Tango.PPC.MachineSettings.ViewModels; + +namespace Tango.PPC.MachineSettings +{ + public static class ViewModelLocator + { + /// + /// Initializes a new instance of the ViewModelLocator class. + /// + static ViewModelLocator() + { + TangoIOC.Default.Register(); + } + + /// + /// Gets the main view VM. + /// + public static MainViewVM MainViewVM + { + get + { + return TangoIOC.Default.GetInstance(); + } + } + } +} 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 new file mode 100644 index 000000000..877374a40 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common; + +namespace Tango.PPC.MachineSettings.ViewModels +{ + /// + /// Represents the main view VM and entry point for . + /// + /// + public class MainViewVM : PPCViewModel + { + /// + /// Called when the application has been started + /// + public override void OnApplicationStarted() + { + //Start initializing here rather then in the constructor. + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml new file mode 100644 index 000000000..ff27b26f3 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml @@ -0,0 +1,14 @@ + + + + + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml.cs new file mode 100644 index 000000000..4a9e38e05 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.PPC.MachineSettings.Views +{ + /// + /// Interaction logic for MainView.xaml + /// + public partial class MainView : UserControl + { + public MainView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/app.config b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/app.config new file mode 100644 index 000000000..77b7003e2 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/app.config @@ -0,0 +1,61 @@ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/packages.config b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/packages.config new file mode 100644 index 000000000..80367fdd2 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/packages.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.sln b/Software/Visual_Studio/Tango.sln index 9fed570ea..ed2b5f28e 100644 --- a/Software/Visual_Studio/Tango.sln +++ b/Software/Visual_Studio/Tango.sln @@ -208,6 +208,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.CatalogGenerator", "U EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.AnimatedGif", "Tango.AnimatedGif\Tango.AnimatedGif.csproj", "{D129789C-3096-4D0B-8DD7-FE24A4DF4B21}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.PPC.MachineSettings", "PPC\Modules\Tango.PPC.MachineSettings\Tango.PPC.MachineSettings.csproj", "{91B70E9B-66A7-4873-AE10-400E71CF404F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution AppVeyor|Any CPU = AppVeyor|Any CPU @@ -3607,6 +3609,46 @@ Global {D129789C-3096-4D0B-8DD7-FE24A4DF4B21}.Release|x64.Build.0 = Release|Any CPU {D129789C-3096-4D0B-8DD7-FE24A4DF4B21}.Release|x86.ActiveCfg = Release|Any CPU {D129789C-3096-4D0B-8DD7-FE24A4DF4B21}.Release|x86.Build.0 = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.AppVeyor|Any CPU.ActiveCfg = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.AppVeyor|Any CPU.Build.0 = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.AppVeyor|ARM.ActiveCfg = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.AppVeyor|ARM.Build.0 = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.AppVeyor|ARM64.ActiveCfg = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.AppVeyor|ARM64.Build.0 = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.AppVeyor|x64.ActiveCfg = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.AppVeyor|x64.Build.0 = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.AppVeyor|x86.ActiveCfg = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.AppVeyor|x86.Build.0 = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Debug|ARM.ActiveCfg = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Debug|ARM.Build.0 = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Debug|ARM64.Build.0 = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Debug|x64.ActiveCfg = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Debug|x64.Build.0 = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Debug|x86.ActiveCfg = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Debug|x86.Build.0 = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.DefaultBuild|Any CPU.ActiveCfg = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.DefaultBuild|Any CPU.Build.0 = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.DefaultBuild|ARM.ActiveCfg = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.DefaultBuild|ARM.Build.0 = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.DefaultBuild|ARM64.ActiveCfg = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.DefaultBuild|ARM64.Build.0 = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.DefaultBuild|x64.ActiveCfg = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.DefaultBuild|x64.Build.0 = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.DefaultBuild|x86.ActiveCfg = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.DefaultBuild|x86.Build.0 = Debug|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Release|Any CPU.Build.0 = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Release|ARM.ActiveCfg = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Release|ARM.Build.0 = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Release|ARM64.ActiveCfg = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Release|ARM64.Build.0 = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Release|x64.ActiveCfg = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Release|x64.Build.0 = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Release|x86.ActiveCfg = Release|Any CPU + {91B70E9B-66A7-4873-AE10-400E71CF404F}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -3670,14 +3712,15 @@ Global {729455D4-C384-4497-AF5D-0A598F86DAC6} = {0048447D-1D94-4E60-9DAD-7349C777CB4E} {0440A135-0DF0-4232-AB3C-98B9283123B3} = {5F6BBAA8-EAD0-4B18-97E5-55B4F56DD760} {808E47B6-BAA7-4D23-83CB-40C53DC4B38A} = {5F6BBAA8-EAD0-4B18-97E5-55B4F56DD760} + {91B70E9B-66A7-4873-AE10-400E71CF404F} = {0048447D-1D94-4E60-9DAD-7349C777CB4E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {7986F7F4-A86A-4994-B1B6-0988D7F057B6} - BuildVersion_BuildVersioningStyle = None.None.Increment.DeltaBaseYearDayOfYear - BuildVersion_UpdateAssemblyVersion = True - BuildVersion_UpdateFileVersion = False - BuildVersion_StartDate = 2000/1/1 - BuildVersion_AssemblyInfoFilename = Properties\AssemblyInfo.cs BuildVersion_UseGlobalSettings = False + BuildVersion_AssemblyInfoFilename = Properties\AssemblyInfo.cs + BuildVersion_StartDate = 2000/1/1 + BuildVersion_UpdateFileVersion = False + BuildVersion_UpdateAssemblyVersion = True + BuildVersion_BuildVersioningStyle = None.None.Increment.DeltaBaseYearDayOfYear + SolutionGuid = {7986F7F4-A86A-4994-B1B6-0988D7F057B6} EndGlobalSection EndGlobal -- cgit v1.3.1 From 86919dc24020229cbd1d8c59f29a4a36895f5b7a Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 29 Jul 2018 13:03:22 +0300 Subject: Implemented diagnostics frame rate monitor on IDiagnosticsFrameProvider. Added diagnostics frame rate to connected machine dialog. Implemented dynamic graphs max points using frame rate on tech board!. Implemented speed control on DIagnosticsFilePlayer & Data Capture module. Implemented graphs duration control on tech board. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 1835008 -> 1835008 bytes .../Tango.MachineStudio.DataCapture.csproj | 6 +- .../Views/MainView.xaml | 201 +++++++++++---------- .../Views/TimelineView.xaml.cs | 6 +- .../Helpers/GraphsHelper.cs | 2 +- .../TechnicianModuleSettings.cs | 4 +- .../ViewModels/MachineTechViewVM.cs | 98 +++++++++- .../Views/MachineTechView.xaml | 17 ++ .../Diagnostics/DefaultDiagnosticsFrameProvider.cs | 47 ++++- .../Diagnostics/IDiagnosticsFrameProvider.cs | 5 + .../ViewModels/ConnectedMachineViewVM.cs | 13 +- .../Views/ConnectedMachineView.xaml | 16 +- .../Diagnostics/DiagnosticsFilePlayer.cs | 27 ++- 14 files changed, 325 insertions(+), 117 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 163460bb9..4c31e0729 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 44c77937d..104f4ed58 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj index 24241bd14..7c7c8c272 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Tango.MachineStudio.DataCapture.csproj @@ -154,6 +154,10 @@ {9652f972-2bd1-4283-99cb-fc6240434c17} Tango.Video + + {cf7c0ff4-9440-42cf-83b8-c060772792d4} + Tango.Visuals + {cb0b0aa2-bb24-4bca-a720-45e397684e12} Tango.MachineStudio.Common @@ -184,7 +188,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml index 37f92dea7..1ef3c1769 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DataCapture/Views/MainView.xaml @@ -6,6 +6,7 @@ xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:visuals="clr-namespace:Tango.Visuals;assembly=Tango.Visuals" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:vm="clr-namespace:Tango.MachineStudio.DataCapture.ViewModels" xmlns:logging="clr-namespace:Tango.MachineStudio.Logging.Views;assembly=Tango.MachineStudio.Logging" @@ -182,110 +183,118 @@ - - - - - - - - - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Speed + + x + + - - + + Total Frames: - - + + File Size: - - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -316,7 +325,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml.cs index 8004ef154..92d176671 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/Views/TimelineView.xaml.cs @@ -44,7 +44,11 @@ namespace Tango.MachineStudio.Logging.Views private void ItemsControl_SizeChanged(object sender, SizeChangedEventArgs e) { TimelineEventGroup group = (sender as FrameworkElement).DataContext as TimelineEventGroup; - group.Height = e.NewSize.Height; + + if (group != null) + { + group.Height = e.NewSize.Height; + } } private void scrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsHelper.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsHelper.cs index 0cd14f917..fa80f90dd 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsHelper.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsHelper.cs @@ -23,7 +23,7 @@ namespace Tango.MachineStudio.Technician.Helpers try { var settings = SettingsManager.Default.GetOrCreate(); - double seconds = settings.GraphsViewDurationSeconds; + double seconds = settings.GraphsDuration; double pullRate = settings.DiagnosticsResponseIntervalMilli; return (int)(((pullRate * pointsPerFrame * 10 * seconds) * (10 / pullRate)) * 0.65); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModuleSettings.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModuleSettings.cs index 12acaf3ee..65ff8d537 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModuleSettings.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModuleSettings.cs @@ -12,7 +12,7 @@ namespace Tango.MachineStudio.Technician /// /// Gets or sets the graphs view duration in seconds. /// - public int GraphsViewDurationSeconds { get; set; } + public int GraphsDuration { get; set; } /// /// Gets or sets the diagnostics response interval in milliseconds. @@ -29,7 +29,7 @@ namespace Tango.MachineStudio.Technician /// public TechnicianModuleSettings() { - GraphsViewDurationSeconds = 10; + GraphsDuration = 10; DiagnosticsResponseIntervalMilli = 30; } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs index d403223ec..3dff65fbc 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs @@ -43,6 +43,7 @@ namespace Tango.MachineStudio.Technician.ViewModels public class MachineTechViewVM : StudioViewModel { private List _diagnoticsMonitorsDataProperties; + private IDiagnosticsFrameProvider _diagnosticsFrameProvider; private Dictionary _singleControllers; private Dictionary _multiControllers; private static object _elementsLock = new object(); @@ -149,6 +150,28 @@ namespace Tango.MachineStudio.Technician.ViewModels set { _currentDiagnosticsResponseSize = value; RaisePropertyChanged(nameof(CurrentDiagnosticsResponseSize)); } } + private int _graphsDurationSeconds; + /// + /// Gets or sets the graphs duration seconds. + /// + public int GraphsDurationSeconds + { + get { return _graphsDurationSeconds; } + set { _graphsDurationSeconds = value; RaisePropertyChangedAuto(); } + } + + private int _tempGraphsDurationSeconds; + /// + /// Gets or sets the temporary graphs duration seconds. + /// + public int TempGraphsDurationSeconds + { + get { return _tempGraphsDurationSeconds; } + set { _tempGraphsDurationSeconds = value; RaisePropertyChangedAuto(); } + } + + + #endregion #region Commands @@ -183,6 +206,8 @@ namespace Tango.MachineStudio.Technician.ViewModels ///
public RelayCommand ResetHardwareConfigurationCommand { get; set; } + public RelayCommand UpdateGraphsDurationCommand { get; set; } + #endregion #region Constructors @@ -192,10 +217,13 @@ namespace Tango.MachineStudio.Technician.ViewModels /// /// The application manager. /// The notification provider. - public MachineTechViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider _diagnosticsFrameProvider, IEventLogger eventLogger) + public MachineTechViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider diagnosticsFrameProvider, IEventLogger eventLogger) { _settings = SettingsManager.Default.GetOrCreate(); + GraphsDurationSeconds = _settings.GraphsDuration; + TempGraphsDurationSeconds = GraphsDurationSeconds; + _notification = notificationProvider; _eventLogger = eventLogger; _singleControllers = new Dictionary(); @@ -217,14 +245,28 @@ namespace Tango.MachineStudio.Technician.ViewModels if (File.Exists(_lastTechProjectFile)) { - OpenProjectFile(_lastTechProjectFile); + try + { + OpenProjectFile(_lastTechProjectFile); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error loading last project file."); + } } + _diagnosticsFrameProvider = diagnosticsFrameProvider; _diagnosticsFrameProvider.FrameReceived += DiagnosticsFrameProvider_FrameReceived; UploadHardwareConfigurationCommand = new RelayCommand(UploadHardwareConfiguration); SyncHardwareConfigurationCommand = new RelayCommand(SyncHardwareConfiguration); ResetHardwareConfigurationCommand = new RelayCommand(() => ResetHardwareConfiguration()); + UpdateGraphsDurationCommand = new RelayCommand(() => + { + GraphsDurationSeconds = TempGraphsDurationSeconds; + _settings.GraphsDuration = GraphsDurationSeconds; + ClearAllGraphs(); + }); } #endregion @@ -320,7 +362,16 @@ namespace Tango.MachineStudio.Technician.ViewModels if (_singleControllers.TryGetValue(graphItem, out controller)) { - controller.PushData(GetDataArray(graphItem.TechMonitor, prop.GetValue(data.Monitors))); + var points = GetDataArray(graphItem.TechMonitor, prop.GetValue(data.Monitors)); + + int maxPoints = (int)(_diagnosticsFrameProvider.FrameRate * GraphsDurationSeconds * points.Count); + + InvokeUI(() => + { + graphItem.Editor.InnerGraph.InnerGraph.MaxPoints = maxPoints; + }); + + controller.PushData(points); } } } @@ -336,7 +387,19 @@ namespace Tango.MachineStudio.Technician.ViewModels if (_multiControllers.TryGetValue(graphItem, out controller)) { - controller.PushData(GetDataMatrix(graphItem.TechMonitor, prop.GetValue(data.Monitors))); + var points = GetDataMatrix(graphItem.TechMonitor, prop.GetValue(data.Monitors)); + + if (points.Count > 0) + { + int maxPoints = (int)(_diagnosticsFrameProvider.FrameRate * GraphsDurationSeconds * points[0].Count); + + InvokeUI(() => + { + graphItem.Editor.InnerGraph.InnerGraph.MaxPoints = maxPoints; + }); + } + + controller.PushData(points); } } } @@ -1179,7 +1242,7 @@ namespace Tango.MachineStudio.Technician.ViewModels catch (Exception ex) { String msg = "Error uploading process parameters:" + Environment.NewLine + parameters.ToJsonString(); - _eventLogger.Log(ex,msg); + _eventLogger.Log(ex, msg); LogManager.Log(ex, msg); _notification.ShowError("Could not upload process parameters." + Environment.NewLine + ex.Message); } @@ -1199,7 +1262,7 @@ namespace Tango.MachineStudio.Technician.ViewModels /// private void InitJobRunnerItem(JobRunnerItem item) { - item.StartJob += () => + item.StartJob += () => { try { @@ -1209,12 +1272,12 @@ namespace Tango.MachineStudio.Technician.ViewModels item.JobHandler = handler; - handler.StatusChanged += (x, status) => + handler.StatusChanged += (x, status) => { item.RunningJobStatus = status; }; - handler.Stopped += (x,e) => + handler.Stopped += (x, e) => { item.IsJobStarted = false; }; @@ -1226,7 +1289,7 @@ namespace Tango.MachineStudio.Technician.ViewModels } }; - item.StopJob += () => + item.StopJob += () => { if (item.JobHandler != null) { @@ -1597,5 +1660,22 @@ namespace Tango.MachineStudio.Technician.ViewModels } #endregion + + #region Graphs + + public void ClearAllGraphs() + { + foreach (var controller in _singleControllers) + { + controller.Value.Clear(); + } + + foreach (var controller in _multiControllers) + { + controller.Value.Clear(); + } + } + + #endregion } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml index 29ba98cd3..c11dbc525 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml @@ -4,6 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:vm="clr-namespace:Tango.MachineStudio.Technician.ViewModels" xmlns:global="clr-namespace:Tango.MachineStudio.Technician" + xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:fa="http://schemas.fontawesome.io/icons/" xmlns:editors="clr-namespace:Tango.Editors;assembly=Tango.Editors" @@ -176,6 +177,22 @@ + + + + GRAPHS DURATION: + + sec + + + + + + + + + + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs index 957648536..477332ad9 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/DefaultDiagnosticsFrameProvider.cs @@ -8,6 +8,7 @@ using Tango.Integration.Operation; using Tango.Integration.ExternalBridge; using Tango.MachineStudio.Common.StudioApplication; using Tango.PMR.Diagnostics; +using System.Diagnostics; namespace Tango.MachineStudio.Common.Diagnostics { @@ -18,6 +19,10 @@ namespace Tango.MachineStudio.Common.Diagnostics public class DefaultDiagnosticsFrameProvider : ExtendedObject, IDiagnosticsFrameProvider { private IStudioApplicationManager _application; + private Stopwatch _watch; + private List _rates; + private DateTime _last_measure; + private const int _min_rate_change = 4; private bool _disable; /// @@ -32,10 +37,27 @@ namespace Tango.MachineStudio.Common.Diagnostics } } + private double _frameRate; + /// + /// Gets the current diagnostics frame rate. + /// + public double FrameRate + { + get + { + return _frameRate; + } + private set + { + _frameRate = value; + RaisePropertyChangedAuto(); + } + } + /// /// Occurs when a new data frame is available. /// - public event EventHandler FrameReceived; + public event EventHandler FrameReceived; /// /// Initializes a new instance of the class. @@ -43,6 +65,8 @@ namespace Tango.MachineStudio.Common.Diagnostics /// The application manager. public DefaultDiagnosticsFrameProvider(IStudioApplicationManager applicationManager) { + _rates = new List(); + _watch = new Stopwatch(); _application = applicationManager; applicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; } @@ -56,6 +80,9 @@ namespace Tango.MachineStudio.Common.Diagnostics { if (machine != null) { + _last_measure = DateTime.Now; + _rates = new List(); + _watch = new Stopwatch(); machine.DiagnosticsDataAvailable += DefaultDiagnosticsFrameProvider_DiagnosticsDataAvailable; } } @@ -91,6 +118,24 @@ namespace Tango.MachineStudio.Common.Diagnostics /// The frame. protected virtual void OnFrameReceived(StartDiagnosticsResponse frame) { + if (DateTime.Now > _last_measure.AddSeconds(1) && _rates.Count > 0) + { + _last_measure = DateTime.Now; + + var rate = Math.Round(1000d / _rates.Average(), 2); + + if (rate > FrameRate + _min_rate_change || rate < FrameRate - _min_rate_change) + { + FrameRate = rate; + } + + _rates.Clear(); + } + + _rates.Add(_watch.ElapsedMilliseconds); + + _watch.Restart(); + FrameReceived?.Invoke(this, frame); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/IDiagnosticsFrameProvider.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/IDiagnosticsFrameProvider.cs index 3944fe8cb..eb1033c29 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/IDiagnosticsFrameProvider.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Diagnostics/IDiagnosticsFrameProvider.cs @@ -18,6 +18,11 @@ namespace Tango.MachineStudio.Common.Diagnostics /// event EventHandler FrameReceived; + /// + /// Gets the current diagnostics frame rate. + /// + double FrameRate { get; } + /// /// Disables the frame delivery from the current connected machine and enables the manual push frame method. /// diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs index 8034ceb69..35a4b0e9d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ConnectedMachineViewVM.cs @@ -5,6 +5,7 @@ using System.Text; using System.Threading.Tasks; using Tango.BL.Entities; using Tango.Core.Commands; +using Tango.MachineStudio.Common.Diagnostics; using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.Common.StudioApplication; using Tango.SharedUI; @@ -30,18 +31,28 @@ namespace Tango.MachineStudio.UI.ViewModels public ConnectedMachineVMResult Result { get; set; } + private IDiagnosticsFrameProvider _diagnosticsFrameProvider; + public IDiagnosticsFrameProvider DiagnosticsFrameProvider + { + get { return _diagnosticsFrameProvider; } + set { _diagnosticsFrameProvider = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand DisconnectCommand { get; set; } public RelayCommand UploadHardwareConfigurationCommand { get; set; } public RelayCommand ResetCommand { get; set; } - public ConnectedMachineViewVM(IStudioApplicationManager application) + public ConnectedMachineViewVM(IStudioApplicationManager application, IDiagnosticsFrameProvider frameProvider) { ApplicationManager = application; DisconnectCommand = new RelayCommand(Disconnect); UploadHardwareConfigurationCommand = new RelayCommand(UploadHardwareConfiguration); ResetCommand = new RelayCommand(Reset); + + DiagnosticsFrameProvider = frameProvider; } private void Reset() diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml index bb8b65f6a..aa2b014fe 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml @@ -11,7 +11,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300" Width="600" Height="400" Background="White" DataContext="{Binding ConnectedMachineViewVM, Source={StaticResource Locator}}"> + d:DesignHeight="300" d:DesignWidth="300" Width="600" Height="420" Background="White" DataContext="{Binding ConnectedMachineViewVM, Source={StaticResource Locator}}"> @@ -73,7 +73,12 @@ - + + + + + + @@ -103,7 +108,12 @@ - + + + + + + diff --git a/Software/Visual_Studio/Tango.Integration/Diagnostics/DiagnosticsFilePlayer.cs b/Software/Visual_Studio/Tango.Integration/Diagnostics/DiagnosticsFilePlayer.cs index 7b3cf9859..80a19c296 100644 --- a/Software/Visual_Studio/Tango.Integration/Diagnostics/DiagnosticsFilePlayer.cs +++ b/Software/Visual_Studio/Tango.Integration/Diagnostics/DiagnosticsFilePlayer.cs @@ -124,6 +124,28 @@ namespace Tango.Integration.Diagnostics set { _machineEvents = value; RaisePropertyChangedAuto(); } } + private double _speed; + /// + /// Gets or sets the player speed (default 1.0). + /// + public double Speed + { + get { return _speed; } + set { _speed = value; RaisePropertyChangedAuto(); } + } + + #endregion + + #region Constructors + + /// + /// Initializes a new instance of the class. + /// + public DiagnosticsFilePlayer() + { + Speed = 1.0; + } + #endregion #region Public Methods @@ -321,11 +343,12 @@ namespace Tango.Integration.Diagnostics if (CurrentFrame > 0) { - Thread.Sleep(_timeCodeChannel.Frames[CurrentFrame].Milliseconds - _timeCodeChannel.Frames[CurrentFrame - 1].Milliseconds); + double sleep = _timeCodeChannel.Frames[CurrentFrame].Milliseconds - _timeCodeChannel.Frames[CurrentFrame - 1].Milliseconds; + Thread.Sleep((int)(sleep / Speed)); } else { - Thread.Sleep(10); + Thread.Sleep((int)(10d / Speed)); } } -- cgit v1.3.1 From 019bc4dca9a0655e5adf1e26d8e3f513563113db Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 30 Jul 2018 11:47:03 +0300 Subject: Improved and optimized transport layer transporter and adapter. --- Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 1835008 -> 1835008 bytes .../ViewModels/LoadingViewVM.cs | 19 ++- .../Tango.MachineStudio.UI/Views/LoadingView.xaml | 2 +- .../PPC/Modules/Tango.PPC.Jobs/JobsModule.cs | 2 +- .../Tango.PPC.Jobs/Properties/AssemblyInfo.cs | 2 +- .../MachineSettingsModule.cs | 2 +- .../ViewModels/MainViewVM.cs | 8 ++ .../Tango.PPC.MachineSettings/Views/MainView.xaml | 28 ++++- .../Application/IPPCApplicationManager.cs | 5 + .../Connection/DefaultMachineProvider.cs | 3 - .../Connection/IMachineProvider.cs | 1 + .../ExternalBridge/IPPCExternalBridgeService.cs | 14 +++ .../ExternalBridge/PPCExternalBridgeService.cs | 27 +++++ .../Tango.PPC.Common/Navigation/NavigationView.cs | 1 + .../PPC/Tango.PPC.Common/PPCSettings.cs | 5 + .../Tango.PPC.Common/Properties/AssemblyInfo.cs | 2 +- .../PPC/Tango.PPC.Common/Tango.PPC.Common.csproj | 4 +- .../PPCApplication/DefaultPPCApplicationManager.cs | 3 + .../PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs | 2 +- .../PPC/Tango.PPC.UI/Tango.PPC.UI.csproj | 14 ++- .../PPC/Tango.PPC.UI/ViewModelLocator.cs | 12 ++ .../ViewModels/ExternalBridgeViewVM.cs | 25 ++++ .../PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs | 26 +++- .../PPC/Tango.PPC.UI/Views/ExternalBridgeView.xaml | 14 +++ .../Tango.PPC.UI/Views/ExternalBridgeView.xaml.cs | 28 +++++ .../Properties/AssemblyInfo.cs | 2 +- .../Tango.AnimatedGif/Properties/AssemblyInfo.cs | 2 +- .../Tango.BL/Enumerations/Permissions.cs | 12 ++ .../Visual_Studio/Tango.BL/Enumerations/Roles.cs | 8 +- .../Tango.BL/Properties/AssemblyInfo.cs | 2 +- .../Tango.Core/Properties/AssemblyInfo.cs | 2 +- .../Tango.DAL.Remote/Properties/AssemblyInfo.cs | 2 +- .../Tango.DragAndDrop/Properties/AssemblyInfo.cs | 2 +- .../Tango.Hive/Properties/AssemblyInfo.cs | 2 +- .../ExternalBridge/ExternalBridgeService.cs | 135 ++++++++++++++++++--- .../ExternalBridge/ExternalBridgeTcpClient.cs | 2 +- .../ExternalBridge/IExternalBridgeService.cs | 7 +- .../Tango.Integration/Properties/AssemblyInfo.cs | 2 +- .../Tango.Logging/Properties/AssemblyInfo.cs | 2 +- .../Tango.PMR/Properties/AssemblyInfo.cs | 2 +- .../Tango.Protobuf/Properties/AssemblyInfo.cs | 2 +- .../Tango.Scripting/Properties/AssemblyInfo.cs | 2 +- .../Tango.Serialization/Properties/AssemblyInfo.cs | 2 +- .../Tango.Settings/Properties/AssemblyInfo.cs | 2 +- .../Tango.SharedUI/Properties/AssemblyInfo.cs | 2 +- .../Tango.TFS/Properties/AssemblyInfo.cs | 2 +- .../Tango.Touch/Properties/AssemblyInfo.cs | 2 +- .../Adapters/TcpTransportAdapter.cs | 83 +++++-------- .../Adapters/UsbTransportAdapter.cs | 41 +++---- .../Tango.Transport/ITransportAdapter.cs | 5 - .../Tango.Transport/Properties/AssemblyInfo.cs | 2 +- .../Tango.Transport/Tango.Transport.csproj | 3 +- .../Tango.Transport/TransportAdapterBase.cs | 16 +-- .../Tango.Transport/TransportAdapterMode.cs | 23 ---- .../Tango.Transport/TransporterBase.cs | 52 +++++--- .../Tango.Protobuf.CLI/Properties/AssemblyInfo.cs | 2 +- 57 files changed, 476 insertions(+), 198 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/IPPCExternalBridgeService.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/PPCExternalBridgeService.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Views/ExternalBridgeView.xaml create mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/Views/ExternalBridgeView.xaml.cs delete mode 100644 Software/Visual_Studio/Tango.Transport/TransportAdapterMode.cs (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels') diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 4c31e0729..fb9191f16 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 104f4ed58..a924d13e2 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs index 26be2d16b..a7750b39c 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/LoadingViewVM.cs @@ -19,6 +19,8 @@ using Tango.MachineStudio.UI.TFS; using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Update; using Tango.Core.DI; +using Tango.Settings; +using Tango.Core; namespace Tango.MachineStudio.UI.ViewModels { @@ -37,13 +39,19 @@ namespace Tango.MachineStudio.UI.ViewModels public IStudioApplicationManager ApplicationManager { get; set; } private bool _isLoading; - public bool IsLoading { get { return _isLoading; } set { _isLoading = value; RaisePropertyChangedAuto(); } } + private String _status; + public String Status + { + get { return _status; } + set { _status = value; RaisePropertyChangedAuto(); } + } + /// /// Initializes a new instance of the class. /// @@ -52,6 +60,7 @@ namespace Tango.MachineStudio.UI.ViewModels /// The notification provider. public LoadingViewVM(IStudioApplicationManager applicationManager, INavigationManager navigationManager, IStudioModuleLoader studioModuleLoader, INotificationProvider notificationProvider, IEventLogger eventLogger, TeamFoundationServiceExtendedClient teamFoundationClient) { + Status = "Loading, please wait..."; _tfs = teamFoundationClient; _eventLogger = eventLogger; ApplicationManager = applicationManager; @@ -79,6 +88,8 @@ namespace Tango.MachineStudio.UI.ViewModels { try { + Status = "Checking for critical updates..."; + LogManager.Log("Checking for forced update..."); var service = UpdateServiceHelper.GetUpdateServiceChannel(); var client = service.CreateChannel(); @@ -119,17 +130,23 @@ namespace Tango.MachineStudio.UI.ViewModels try { + Status = "Connecting to Team Foundation Services..."; _tfs.Initialize(); + Thread.Sleep(500); } catch (Exception ex) { LogManager.Log(ex, "Could not initialize Team Foundation Service client."); } + Status = "Loading, please wait..."; + ObservablesEntitiesAdapter.Instance.Initialize(); _eventLogger.Log(EventTypes.ApplicationStarted, "Application Started!"); + Status = "Starting application..."; + InvokeUI(() => { _studioModuleLoader.LoadModules(); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml index 91fc11a22..2a63ae00f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/LoadingView.xaml @@ -16,7 +16,7 @@ Twine Solutions - Loading, please wait... + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/JobsModule.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/JobsModule.cs index ad0eb6f45..0a1dfb7e1 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/JobsModule.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/JobsModule.cs @@ -50,7 +50,7 @@ namespace Tango.PPC.Jobs { get { - return Permissions.RunTechnicianModule; + return Permissions.RunPPCJobsModule; } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Properties/AssemblyInfo.cs index 523281b9e..0e34bae6c 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Properties/AssemblyInfo.cs @@ -8,7 +8,7 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango Panel PC Jobs Module")] -[assembly: AssemblyVersion("2.0.4.1407")] +[assembly: AssemblyVersion("2.0.5.1355")] [assembly:ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/MachineSettingsModule.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/MachineSettingsModule.cs index 0d6f7c75f..a3087ab5a 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/MachineSettingsModule.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/MachineSettingsModule.cs @@ -69,7 +69,7 @@ namespace Tango.PPC.MachineSettings { get { - return Permissions.RunMachineStudio; + return Permissions.RunPPCSettingsModule; } } 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 877374a40..61ce69e4e 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 @@ -3,7 +3,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.Core.DI; using Tango.PPC.Common; +using Tango.PPC.Common.ExternalBridge; namespace Tango.PPC.MachineSettings.ViewModels { @@ -13,6 +15,12 @@ namespace Tango.PPC.MachineSettings.ViewModels /// public class MainViewVM : PPCViewModel { + /// + /// Gets or sets the external bridge service. + /// + [TangoInject] + public IPPCExternalBridgeService ExternalBridgeService { get; set; } + /// /// Called when the application has been started /// diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml index ff27b26f3..23d5a08a6 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml @@ -2,13 +2,35 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:vm="clr-namespace:Tango.PPC.MachineSettings.ViewModels" xmlns:global="clr-namespace:Tango.PPC.MachineSettings" xmlns:local="clr-namespace:Tango.PPC.MachineSettings.Views" mc:Ignorable="d" d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> - - + + + + + + + + + + + + Settings + + + + + + Enable External Bridge Service + + + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs index 50bceb3e1..16e31b5a3 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Application/IPPCApplicationManager.cs @@ -20,6 +20,11 @@ namespace Tango.PPC.Common.Application /// event EventHandler ApplicationStarted; + /// + /// Occurs when the all components are ready. + /// + event EventHandler Ready; + /// /// Occurs when all PPC modules are ready and initialized. /// diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs index 8b0098eb8..d97265ed6 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs @@ -81,9 +81,6 @@ namespace Tango.PPC.Common.Connection MachineOperator.Adapter = response.Adapter; MachineOperator.JobHandlingMode = JobHandlerModes.SettingUp; await MachineOperator.Connect(); - - ExternalBridgeService service = new ExternalBridgeService(MachineOperator, Machine); - service.Start(); } catch { } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/IMachineProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/IMachineProvider.cs index a041b1a2f..5b5f1e588 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/IMachineProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/IMachineProvider.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.BL.Entities; +using Tango.Integration.ExternalBridge; using Tango.Integration.Operation; namespace Tango.PPC.Common.Connection diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/IPPCExternalBridgeService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/IPPCExternalBridgeService.cs new file mode 100644 index 000000000..9154fa09c --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/IPPCExternalBridgeService.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Integration.ExternalBridge; + +namespace Tango.PPC.Common.ExternalBridge +{ + public interface IPPCExternalBridgeService : IExternalBridgeService + { + + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/PPCExternalBridgeService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/PPCExternalBridgeService.cs new file mode 100644 index 000000000..338015b8b --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/ExternalBridge/PPCExternalBridgeService.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.Integration.ExternalBridge; +using Tango.Integration.Operation; +using Tango.PPC.Common.Application; +using Tango.PPC.Common.Connection; +using Tango.Settings; + +namespace Tango.PPC.Common.ExternalBridge +{ + public class PPCExternalBridgeService : ExternalBridgeService, IPPCExternalBridgeService + { + public PPCExternalBridgeService(IPPCApplicationManager applicationManager, IMachineProvider machineProvider) + { + applicationManager.Ready += (_, __) => + { + MachineOperator = machineProvider.MachineOperator; + Machine = machineProvider.Machine; + Enabled = SettingsManager.Default.GetOrCreate().EnableExternalBridgeService; + }; + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs index f5744fd21..6f9efc4cc 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Navigation/NavigationView.cs @@ -14,6 +14,7 @@ namespace Tango.PPC.Common.Navigation LoadingView, LayoutView, LoginView, + ExternalBridgeView, HomeModule, ShutdownView, } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs index 5ed4c35d9..d6effad38 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/PPCSettings.cs @@ -19,6 +19,11 @@ namespace Tango.PPC.Common /// public String MachineSerialNumber { get; set; } + /// + /// Gets or sets a value indicating whether to enable external bridge service. + /// + public bool EnableExternalBridgeService { get; set; } + /// /// Gets or sets the logging categories. /// diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/AssemblyInfo.cs index f8ec20184..947ab83eb 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Properties/AssemblyInfo.cs @@ -8,7 +8,7 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango Panel PC Common Library")] -[assembly: AssemblyVersion("2.0.7.1304")] +[assembly: AssemblyVersion("2.0.8.1355")] [assembly:ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 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 141e41872..63d28c545 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 @@ -103,6 +103,8 @@ + + @@ -254,7 +256,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs index 0fbef92a7..2f81475cd 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs @@ -149,6 +149,7 @@ namespace Tango.PPC.UI.PPCApplication ModulesInitialized?.Invoke(this, new EventArgs()); _machineProvider.Init(); + Ready?.Invoke(this, new EventArgs()); } /// @@ -163,5 +164,7 @@ namespace Tango.PPC.UI.PPCApplication vm.OnApplicationShuttingDown(); } } + + public event EventHandler Ready; } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs index 71dca288e..62a77b113 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs @@ -8,4 +8,4 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango Panel PC Application")] -[assembly: AssemblyVersion("2.0.4.1304")] +[assembly: AssemblyVersion("2.0.5.1355")] 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 850896f0d..5b65495b0 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 @@ -125,11 +125,15 @@ + + + ExternalBridgeView.xaml + LayoutView.xaml @@ -170,6 +174,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -274,6 +282,10 @@ {096f16c8-6d06-4b5f-9496-b9d2df2d94a3} Tango.PPC.Jobs + + {91b70e9b-66a7-4873-ae10-400e71cf404f} + Tango.PPC.MachineSettings + {0be74eee-22cb-4dba-b896-793b9e1a3ac0} Tango.PPC.Common @@ -392,7 +404,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/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs index a56b9bd4c..83be2ee65 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs @@ -8,6 +8,7 @@ using Tango.PPC.Common.Authentication; using Tango.PPC.Common.Connection; using Tango.PPC.Common.Diagnostics; using Tango.PPC.Common.EventLogging; +using Tango.PPC.Common.ExternalBridge; using Tango.PPC.Common.Modules; using Tango.PPC.Common.Navigation; using Tango.PPC.Common.Notifications; @@ -47,6 +48,7 @@ namespace Tango.PPC.UI TangoIOC.Default.Unregister(); TangoIOC.Default.Unregister(); TangoIOC.Default.Unregister(); + TangoIOC.Default.Unregister(); TangoIOC.Default.Register(new DefaultDispetcherProvider(Application.Current.Dispatcher)); TangoIOC.Default.Register(); @@ -58,12 +60,14 @@ namespace Tango.PPC.UI TangoIOC.Default.Register(); TangoIOC.Default.Register(); TangoIOC.Default.Register(); + TangoIOC.Default.Register(); //TangoIOC.Default.Register(new TeamFoundationServiceExtendedClient("https://twinetfs.visualstudio.com", String.Empty, "szzfokrceo4rhd4eqi5qpmxn3pa5iwl3q7tlqd36l2m7smz2ynoa")); TangoIOC.Default.Register(); TangoIOC.Default.Register(); TangoIOC.Default.Register(); TangoIOC.Default.Register(); + TangoIOC.Default.Register(); TangoIOC.Default.GetInstance().ApplicationStarted += (_, __) => @@ -111,5 +115,13 @@ namespace Tango.PPC.UI return TangoIOC.Default.GetInstance(); } } + + public static ExternalBridgeViewVM ExternalBridgeViewVM + { + get + { + return TangoIOC.Default.GetInstance(); + } + } } } \ 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 new file mode 100644 index 000000000..f0b6bbfdf --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/ExternalBridgeViewVM.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.DI; +using Tango.PPC.Common; +using Tango.PPC.Common.ExternalBridge; + +namespace Tango.PPC.UI.ViewModels +{ + public class ExternalBridgeViewVM : PPCViewModel + { + /// + /// Gets or sets the external bridge service. + /// + [TangoInject] + public IPPCExternalBridgeService ExternalBridgeService { get; set; } + + public override void OnApplicationStarted() + { + //throw new NotImplementedException(); + } + } +} 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 faac9ad16..cf85246f8 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs @@ -7,6 +7,7 @@ using Tango.Core.DI; using Tango.PPC.Common; using Tango.PPC.Common.Application; using Tango.PPC.Common.Authentication; +using Tango.PPC.Common.ExternalBridge; using Tango.PPC.Common.Modules; using Tango.PPC.Common.Navigation; using Tango.PPC.Common.Notifications; @@ -20,12 +21,29 @@ namespace Tango.PPC.UI.ViewModels /// public class MainViewVM : PPCViewModel { - /// - /// Called when the application has been started. - /// + [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 new file mode 100644 index 000000000..c2dad0a5e --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/ExternalBridgeView.xaml @@ -0,0 +1,14 @@ + + + This machine is currently being controlled + + diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/ExternalBridgeView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/ExternalBridgeView.xaml.cs new file mode 100644 index 000000000..f1cfe95de --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/ExternalBridgeView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.PPC.UI.Views +{ + /// + /// Interaction logic for ExternalBridgeView.xaml + /// + public partial class ExternalBridgeView : UserControl + { + public ExternalBridgeView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/SideChains/ICSharpCode.AvalonEdit/Properties/AssemblyInfo.cs b/Software/Visual_Studio/SideChains/ICSharpCode.AvalonEdit/Properties/AssemblyInfo.cs index 9d9b7d061..9b7f2135e 100644 --- a/Software/Visual_Studio/SideChains/ICSharpCode.AvalonEdit/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/SideChains/ICSharpCode.AvalonEdit/Properties/AssemblyInfo.cs @@ -20,7 +20,7 @@ using System.Windows.Markup; [assembly: AssemblyCompany("ic#code")] [assembly: AssemblyProduct("SharpDevelop")] [assembly: AssemblyCopyright("2000-2013 AlphaSierraPapa for the SharpDevelop Team")] -[assembly: AssemblyVersion("1.0.12.1411")] +[assembly: AssemblyVersion("1.0.13.1355")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2243:AttributeStringLiteralsShouldParseCorrectly", diff --git a/Software/Visual_Studio/Tango.AnimatedGif/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.AnimatedGif/Properties/AssemblyInfo.cs index ae9836ae2..da470e4cf 100644 --- a/Software/Visual_Studio/Tango.AnimatedGif/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.AnimatedGif/Properties/AssemblyInfo.cs @@ -6,6 +6,6 @@ using System.Windows.Markup; [assembly: AssemblyTitle("Tango - GIF Animation Library")] [assembly: ComVisible(false)] -[assembly: AssemblyVersion("2.0.5.1407")] +[assembly: AssemblyVersion("2.0.6.1355")] [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/Permissions.cs b/Software/Visual_Studio/Tango.BL/Enumerations/Permissions.cs index 5b2bc90d0..0aff2a59d 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/Permissions.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/Permissions.cs @@ -91,5 +91,17 @@ namespace Tango.BL.Enumerations [Description("Allows openning the machine studio developer console")] RunDeveloperConsole = 11, + /// + /// (Allows the loading of the PPC jobs module) + /// + [Description("Allows the loading of the PPC jobs module")] + RunPPCJobsModule = 12, + + /// + /// (Allows loading the PPC settings module) + /// + [Description("Allows loading the PPC settings module")] + RunPPCSettingsModule = 13, + } } diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/Roles.cs b/Software/Visual_Studio/Tango.BL/Enumerations/Roles.cs index 886bd7c9b..39864eeb8 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/Roles.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/Roles.cs @@ -41,7 +41,7 @@ namespace Tango.BL.Enumerations /// (Twine Research and development) /// [Description("Twine Research and development")] - MachineDeveloper = 3, + Researcher = 3, /// /// (Publish new Machine Studio Versions) @@ -73,5 +73,11 @@ namespace Tango.BL.Enumerations [Description("Color adjustment & calibration algorithms developer ")] ColorScientist = 8, + /// + /// (Standard PPC User) + /// + [Description("Standard PPC User")] + PPCUser = 9, + } } diff --git a/Software/Visual_Studio/Tango.BL/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.BL/Properties/AssemblyInfo.cs index db222c791..1e121152e 100644 --- a/Software/Visual_Studio/Tango.BL/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.BL/Properties/AssemblyInfo.cs @@ -4,4 +4,4 @@ using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - Business logic components")] [assembly: ComVisible(false)] -[assembly: AssemblyVersion("2.0.16.1608")] \ No newline at end of file +[assembly: AssemblyVersion("2.0.17.1355")] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Core/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.Core/Properties/AssemblyInfo.cs index 186628b13..407229686 100644 --- a/Software/Visual_Studio/Tango.Core/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.Core/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - Core Components")] -[assembly: AssemblyVersion("2.0.16.1411")] +[assembly: AssemblyVersion("2.0.17.1355")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.DAL.Remote/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.DAL.Remote/Properties/AssemblyInfo.cs index 90c6d8ff1..5b7163f7d 100644 --- a/Software/Visual_Studio/Tango.DAL.Remote/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.DAL.Remote/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - Remote Data Access Layer")] -[assembly: AssemblyVersion("2.0.15.1411")] +[assembly: AssemblyVersion("2.0.16.1355")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.DragAndDrop/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.DragAndDrop/Properties/AssemblyInfo.cs index a490d0fb3..03bc5d817 100644 --- a/Software/Visual_Studio/Tango.DragAndDrop/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.DragAndDrop/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - Drag & Drop Components")] -[assembly: AssemblyVersion("2.0.13.1411")] +[assembly: AssemblyVersion("2.0.14.1355")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Hive/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.Hive/Properties/AssemblyInfo.cs index 17431f6d7..412aa9136 100644 --- a/Software/Visual_Studio/Tango.Hive/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.Hive/Properties/AssemblyInfo.cs @@ -5,7 +5,7 @@ using System.Runtime.InteropServices; using System.Windows; [assembly: AssemblyTitle("Tango - Hive UI Components")] -[assembly: AssemblyVersion("2.0.9.1407")] +[assembly: AssemblyVersion("2.0.10.1355")] [assembly:ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs index 8408d33af..ff8a72bc3 100644 --- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeService.cs @@ -14,6 +14,7 @@ using Tango.PMR.Integration; using Tango.Transport.Discovery; using Tango.Transport.Servers; using Tango.Transport.Adapters; +using Tango.PMR.Connection; namespace Tango.Integration.ExternalBridge { @@ -22,19 +23,51 @@ namespace Tango.Integration.ExternalBridge private UdpDiscoveryService _discoverySevice; private TcpServer _tcpServer; - public IMachineOperator MachineOperator { get; private set; } + private IMachineOperator _machineOperator; + public IMachineOperator MachineOperator + { + get { return _machineOperator; } + set { _machineOperator = value; OnMachineOperatorChanged(); } + } - public Machine Machine { get; private set; } + private Machine _machine; + + public Machine Machine + { + get { return _machine; } + set { _machine = value; OnMachineChanged(); } + } public bool IsStarted { get; private set; } - public ExternalBridgeService(IMachineOperator machineOperator, Machine machine) + private bool _enabled; + + public bool Enabled { - Machine = machine; - MachineOperator = machineOperator; + get { return _enabled; } + set + { + _enabled = value; - _tcpServer = new TcpServer(1984); - _tcpServer.ClientConnected += _tcpServer_ClientConnected; + if (_enabled) + { + Start(); + } + else + { + Stop(); + } + + RaisePropertyChangedAuto(); + } + } + + private void OnMachineChanged() + { + if (_discoverySevice != null && _discoverySevice.IsStarted) + { + _discoverySevice.Stop(); + } _discoverySevice = new UdpDiscoveryService(8888, new ExternalBridgeUdpDiscoveryPacket() { @@ -42,6 +75,18 @@ namespace Tango.Integration.ExternalBridge }); } + public ExternalBridgeService() + { + _tcpServer = new TcpServer(1984); + _tcpServer.ClientConnected += _tcpServer_ClientConnected; + } + + public ExternalBridgeService(IMachineOperator machineOperator, Machine machine) : this() + { + Machine = machine; + MachineOperator = machineOperator; + } + private async void _tcpServer_ClientConnected(object sender, ClientConnectedEventArgs e) { Adapter = new TcpTransportAdapter(e.Socket); @@ -56,10 +101,12 @@ namespace Tango.Integration.ExternalBridge _discoverySevice.Start(); IsStarted = true; + _enabled = true; + RaisePropertyChanged(nameof(Enabled)); } } - public void Stop() + public async void Stop() { if (IsStarted) { @@ -67,6 +114,33 @@ namespace Tango.Integration.ExternalBridge _discoverySevice.Stop(); IsStarted = false; + _enabled = false; + RaisePropertyChanged(nameof(Enabled)); + + try + { + await Disconnect(); + } + catch { } + + ClientDisconnected?.Invoke(this, new EventArgs()); + } + } + + private void OnMachineOperatorChanged() + { + if (MachineOperator != null) + { + MachineOperator.StateChanged -= MachineOperator_StateChanged; + MachineOperator.StateChanged += MachineOperator_StateChanged; + } + } + + private void MachineOperator_StateChanged(object sender, TransportComponentState e) + { + if (e != TransportComponentState.Connected) + { + Stop(); } } @@ -74,7 +148,16 @@ namespace Tango.Integration.ExternalBridge { base.OnRequestReceived(container); - if (container.Type == MessageType.ExternalClientLoginRequest) + if (!Enabled) return; + + if (container.Type == MessageType.ConnectRequest) + { + await SendResponse(new ConnectResponse() + { + DeviceInformation = MachineOperator.DeviceInformation, + }, container.Token); + } + else if (container.Type == MessageType.ExternalClientLoginRequest) { var request = MessageFactory.ParseTangoMessageFromContainer(container); @@ -85,14 +168,18 @@ namespace Tango.Integration.ExternalBridge { response.Authenticated = true; response.SerialNumber = Machine.SerialNumber; + ClientConnected?.Invoke(this, new EventArgs()); } await SendResponse(response, container.Token); } + else if (container.Type == MessageType.DisconnectRequest) + { + await SendResponse(new DisconnectResponse(), container.Token); + Stop(); + } else { - MachineOperator.RequestTimeout = TimeSpan.FromSeconds(60); - if (!container.Continuous) { var response = await MachineOperator.SendRequest(container); @@ -100,20 +187,28 @@ namespace Tango.Integration.ExternalBridge } else { - MachineOperator.SendContinuousRequest(container).Subscribe((response) => + MachineOperator.SendContinuousRequest(container).Subscribe((response) => { - - SendResponse(response); - - },(ex) => - { - if (ex is ResponseErrorException) + if (Enabled) { - SendResponse((ex as ResponseErrorException).Container); + SendResponse(response); } - }); + + }, (ex) => + { + if (Enabled) + { + if (ex is ResponseErrorException) + { + SendResponse((ex as ResponseErrorException).Container); + } + } + }); } } } + + public event EventHandler ClientConnected; + public event EventHandler ClientDisconnected; } } diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs index a81e64c02..c90fb2264 100644 --- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs @@ -85,7 +85,7 @@ namespace Tango.Integration.ExternalBridge { SerialNumber = serialNumber; IPAddress = ipAddress; - UseKeepAlive = true; + UseKeepAlive = false; EnableDiagnostics = true; } diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeService.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeService.cs index d8e106ac4..d69cefc09 100644 --- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeService.cs +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeService.cs @@ -12,10 +12,13 @@ namespace Tango.Integration.ExternalBridge { public interface IExternalBridgeService : ITransporter { - IMachineOperator MachineOperator { get; } - Machine Machine { get; } + event EventHandler ClientConnected; + event EventHandler ClientDisconnected; + IMachineOperator MachineOperator { get; set; } + Machine Machine { get; set; } bool IsStarted { get; } void Start(); void Stop(); + bool Enabled { get; set; } } } diff --git a/Software/Visual_Studio/Tango.Integration/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.Integration/Properties/AssemblyInfo.cs index fa528d630..8f425aaaf 100644 --- a/Software/Visual_Studio/Tango.Integration/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.Integration/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - Logging Library")] -[assembly: AssemblyVersion("2.0.14.1304")] +[assembly: AssemblyVersion("2.0.15.1355")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Logging/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.Logging/Properties/AssemblyInfo.cs index a34091bb5..de818c079 100644 --- a/Software/Visual_Studio/Tango.Logging/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.Logging/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - Logging Library")] -[assembly: AssemblyVersion("2.0.20.1304")] +[assembly: AssemblyVersion("2.0.21.1355")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.PMR/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.PMR/Properties/AssemblyInfo.cs index ddf3cb254..0db026c21 100644 --- a/Software/Visual_Studio/Tango.PMR/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.PMR/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - Protobuf Message Repository")] -[assembly: AssemblyVersion("2.0.18.1304")] +[assembly: AssemblyVersion("2.0.19.1355")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Protobuf/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.Protobuf/Properties/AssemblyInfo.cs index b34d8addd..2790afbf3 100644 --- a/Software/Visual_Studio/Tango.Protobuf/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.Protobuf/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - Protobuf Components")] -[assembly: AssemblyVersion("2.0.16.1608")] +[assembly: AssemblyVersion("2.0.17.1355")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Scripting/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.Scripting/Properties/AssemblyInfo.cs index d28d9ccf5..63541df84 100644 --- a/Software/Visual_Studio/Tango.Scripting/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.Scripting/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - Roslyn Scripting Components")] -[assembly: AssemblyVersion("2.0.13.1411")] +[assembly: AssemblyVersion("2.0.14.1355")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Serialization/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.Serialization/Properties/AssemblyInfo.cs index cc507873f..32ed84090 100644 --- a/Software/Visual_Studio/Tango.Serialization/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.Serialization/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - Serialization Components")] -[assembly: AssemblyVersion("2.0.15.1411")] +[assembly: AssemblyVersion("2.0.16.1355")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Settings/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.Settings/Properties/AssemblyInfo.cs index fe1eb27cc..0555f98d1 100644 --- a/Software/Visual_Studio/Tango.Settings/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.Settings/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - Global Settings")] -[assembly: AssemblyVersion("2.0.15.1411")] +[assembly: AssemblyVersion("2.0.16.1355")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.SharedUI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.SharedUI/Properties/AssemblyInfo.cs index 27ee43517..eeb037af0 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.SharedUI/Properties/AssemblyInfo.cs @@ -5,7 +5,7 @@ using System.Runtime.InteropServices; using System.Windows; [assembly: AssemblyTitle("Tango - Shared UI Components")] -[assembly: AssemblyVersion("2.0.13.1411")] +[assembly: AssemblyVersion("2.0.14.1355")] [assembly: ComVisible(false)] diff --git a/Software/Visual_Studio/Tango.TFS/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.TFS/Properties/AssemblyInfo.cs index 009d62401..d7c187140 100644 --- a/Software/Visual_Studio/Tango.TFS/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.TFS/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - VSTS API Library")] -[assembly: AssemblyVersion("2.0.6.1407")] +[assembly: AssemblyVersion("2.0.7.1355")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Touch/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.Touch/Properties/AssemblyInfo.cs index ff906391d..7bde38929 100644 --- a/Software/Visual_Studio/Tango.Touch/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.Touch/Properties/AssemblyInfo.cs @@ -5,7 +5,7 @@ using System.Runtime.InteropServices; using System.Windows; [assembly: AssemblyTitle("Tango - Touch Components")] -[assembly: AssemblyVersion("2.0.5.1407")] +[assembly: AssemblyVersion("2.0.6.1355")] [assembly: ComVisible(false)] [assembly:ThemeInfo( diff --git a/Software/Visual_Studio/Tango.Transport/Adapters/TcpTransportAdapter.cs b/Software/Visual_Studio/Tango.Transport/Adapters/TcpTransportAdapter.cs index 38ba29e5c..8069efcf3 100644 --- a/Software/Visual_Studio/Tango.Transport/Adapters/TcpTransportAdapter.cs +++ b/Software/Visual_Studio/Tango.Transport/Adapters/TcpTransportAdapter.cs @@ -23,6 +23,7 @@ namespace Tango.Transport.Adapters private TcpClient _socket; private Thread _pullThread; private bool _initializedFromConstructor; + private byte[] _size_buffer; #region Properties @@ -40,7 +41,6 @@ namespace Tango.Transport.Adapters /// public TcpTransportAdapter() { - AdapterMode = TransportAdapterMode.PREPEND_HEADER; Address = "127.0.0.1"; Port = 9999; } @@ -155,69 +155,46 @@ namespace Tango.Transport.Adapters private void PullThreadMethod() { - int counter = 0; - try { - while (State == TransportComponentState.Connected) + if (State == TransportComponentState.Connected) { - if (AdapterMode == TransportAdapterMode.NO_HEADER) - { - if (_socket.Available > 0) - { - byte[] data = new byte[_socket.Available]; - _socket.GetStream().Read(data, 0, data.Length); - OnDataAvailable(data); - } - } - else - { - if (_socket.Available > 4) - { - byte[] size = new byte[4]; - _socket.GetStream().Read(size, 0, size.Length); - int expectedSize = BitConverter.ToInt32(size, 0); + _size_buffer = new byte[4]; + _socket.GetStream().BeginRead(_size_buffer, 0, _size_buffer.Length, EndReading, _socket.GetStream()); + } + } + catch (Exception ex) + { + OnFailed(ex); + } + } - byte[] data = new byte[expectedSize]; - int read = 0; + private void EndReading(IAsyncResult ar) + { + try + { + if (State == TransportComponentState.Connected) + { + _socket.GetStream().EndRead(ar); - while (read < expectedSize) - { - read += _socket.GetStream().Read(data, read, Math.Min(_socket.Available, expectedSize - read)); + int expectedSize = BitConverter.ToInt32(_size_buffer, 0); - //Thread.Sleep(2); + byte[] data = new byte[expectedSize]; + int read = 0; - if (State != TransportComponentState.Connected) - { - break; - } - } + while (read < expectedSize) + { + read += _socket.GetStream().Read(data, read, Math.Min(_socket.Available, expectedSize - read)); - OnDataAvailable(data); + if (State != TransportComponentState.Connected) + { + break; } } - Thread.Sleep(10); - counter++; - - //if (counter >= 200) - //{ - // try - // { - // if (_socket.Client.Poll(1, SelectMode.SelectRead) && _socket.Client.Available == 0) - // { - // OnFailed(LogManager.Log(new TimeoutException("Client disconnected."))); - // return; - // } - // } - // catch (SocketException ex) - // { - // OnFailed(LogManager.Log(ex)); - // return; - // } - - // counter = 0; - //} + OnDataAvailable(data); + + PullThreadMethod(); } } catch (Exception ex) diff --git a/Software/Visual_Studio/Tango.Transport/Adapters/UsbTransportAdapter.cs b/Software/Visual_Studio/Tango.Transport/Adapters/UsbTransportAdapter.cs index 4bd6d2679..d914ac98a 100644 --- a/Software/Visual_Studio/Tango.Transport/Adapters/UsbTransportAdapter.cs +++ b/Software/Visual_Studio/Tango.Transport/Adapters/UsbTransportAdapter.cs @@ -29,7 +29,6 @@ namespace Tango.Transport.Adapters public UsbTransportAdapter() : base() { BaudRate = UsbSerialBaudRates.BR_9600; - AdapterMode = TransportAdapterMode.PREPEND_HEADER; Address = "COM1"; } @@ -159,38 +158,30 @@ namespace Tango.Transport.Adapters { if (e.EventType == SerialData.Eof) return; - if (AdapterMode == TransportAdapterMode.NO_HEADER) + if (_serialPort.BytesToRead > 4) { - byte[] data = new byte[_serialPort.BytesToRead]; - _serialPort.Read(data, 0, data.Length); - OnDataAvailable(data); - } - else - { - if (_serialPort.BytesToRead > 4) - { - byte[] size = new byte[4]; - _serialPort.Read(size, 0, size.Length); - int expectedSize = BitConverter.ToInt32(size, 0); + byte[] size = new byte[4]; + _serialPort.Read(size, 0, size.Length); + int expectedSize = BitConverter.ToInt32(size, 0); - byte[] data = new byte[expectedSize]; - int read = 0; + byte[] data = new byte[expectedSize]; + int read = 0; - while (read < expectedSize) - { - read += _serialPort.Read(data, read, Math.Min(_serialPort.BytesToRead, expectedSize - read)); + while (read < expectedSize) + { + read += _serialPort.Read(data, read, Math.Min(_serialPort.BytesToRead, expectedSize - read)); - //Thread.Sleep(2); + //Thread.Sleep(2); - if (State != TransportComponentState.Connected) - { - break; - } + if (State != TransportComponentState.Connected) + { + break; } - - OnDataAvailable(data); } + + OnDataAvailable(data); } + } catch (Exception ex) { diff --git a/Software/Visual_Studio/Tango.Transport/ITransportAdapter.cs b/Software/Visual_Studio/Tango.Transport/ITransportAdapter.cs index 8260f926d..5e6b528c2 100644 --- a/Software/Visual_Studio/Tango.Transport/ITransportAdapter.cs +++ b/Software/Visual_Studio/Tango.Transport/ITransportAdapter.cs @@ -44,10 +44,5 @@ namespace Tango.Transport /// Gets or sets the adapter address. /// String Address { get; set; } - - /// - /// Gets or sets the adapter reading/writing mode. - /// - TransportAdapterMode AdapterMode { get; set; } } } diff --git a/Software/Visual_Studio/Tango.Transport/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Tango.Transport/Properties/AssemblyInfo.cs index fc6a0e393..317e3adad 100644 --- a/Software/Visual_Studio/Tango.Transport/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Tango.Transport/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - Transport Components")] -[assembly: AssemblyVersion("2.0.14.1304")] +[assembly: AssemblyVersion("2.0.15.1355")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj b/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj index 18245d5cf..ebd34b210 100644 --- a/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj +++ b/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj @@ -94,7 +94,6 @@ - @@ -128,7 +127,7 @@ - + \ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Transport/TransportAdapterBase.cs b/Software/Visual_Studio/Tango.Transport/TransportAdapterBase.cs index 981ab0882..8a5ebda55 100644 --- a/Software/Visual_Studio/Tango.Transport/TransportAdapterBase.cs +++ b/Software/Visual_Studio/Tango.Transport/TransportAdapterBase.cs @@ -90,11 +90,6 @@ namespace Tango.Transport } } - /// - /// Gets or sets the adapter reading/writing mode. - /// - public TransportAdapterMode AdapterMode { get; set; } - #endregion #region Virtual Methods @@ -166,14 +161,7 @@ namespace Tango.Transport { byte[] postData = data; - if (AdapterMode == TransportAdapterMode.NO_HEADER) - { - return postData; - } - else - { - postData = BitConverter.GetBytes(data.Length).Concat(data).ToArray(); - } + postData = BitConverter.GetBytes(data.Length).Concat(data).ToArray(); TotalBytesSent += postData.Length; _totalBytes += postData.Length; @@ -239,7 +227,7 @@ namespace Tango.Transport /// public override string ToString() { - return this.GetType().Name + " [" + AdapterMode + "]"; + return this.GetType().Name; } #endregion diff --git a/Software/Visual_Studio/Tango.Transport/TransportAdapterMode.cs b/Software/Visual_Studio/Tango.Transport/TransportAdapterMode.cs deleted file mode 100644 index e89eba38d..000000000 --- a/Software/Visual_Studio/Tango.Transport/TransportAdapterMode.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tango.Transport -{ - /// - /// Represents an read/write mode. - /// - public enum TransportAdapterMode - { - /// - /// Pure protobuf message with no message size. - /// - NO_HEADER, - /// - /// Prepends and truncates the message size before writing and reading. - /// - PREPEND_HEADER - } -} diff --git a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs index d2c33d504..0d975973b 100644 --- a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs +++ b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs @@ -34,6 +34,8 @@ namespace Tango.Transport private Thread _keepAliveThread; private ITransportAdapter _adapter; private Dictionary _pendingResponses; + private AutoResetEvent _pull_wait_handle; + private AutoResetEvent _push_wait_handle; #region Events @@ -180,7 +182,7 @@ namespace Tango.Transport /// The data. protected virtual void OnAdapterDataAvailable(object sender, byte[] data) { - _arrivedResponses.Enqueue(data); + EnqueueMessageIn(data); } /// @@ -221,6 +223,9 @@ namespace Tango.Transport /// public TransporterBase() { + _pull_wait_handle = new AutoResetEvent(false); + _push_wait_handle = new AutoResetEvent(false); + Encoder = new ProtoEncoder(); _pendingResponses = new Dictionary(); _sendingQueue = new ConcurrentQueue(); @@ -295,7 +300,7 @@ namespace Tango.Transport TaskCompletionSource source = new TaskCompletionSource(); TransportMessage message = new TransportMessage(container.Token, request, TransportMessageDirection.Request, () => container.ToByteArray(), source); - _sendingQueue.Enqueue(message); + EnqueueMessageOut(message); Task.Delay(timeout != null ? timeout.Value : RequestTimeout).ContinueWith((x) => { if (!source.Task.IsCompleted) @@ -361,7 +366,7 @@ namespace Tango.Transport TaskCompletionSource source = new TaskCompletionSource(); TransportMessage message = new TransportMessage(container.Token, container, TransportMessageDirection.Request, () => container.ToByteArray(), source); - _sendingQueue.Enqueue(message); + EnqueueMessageOut(message); Task.Delay(timeout != null ? timeout.Value : RequestTimeout).ContinueWith((x) => { if (!source.Task.IsCompleted) @@ -414,7 +419,7 @@ namespace Tango.Transport TaskCompletionSource source = new TaskCompletionSource(); TransportMessage message = new TransportMessage(token, container, TransportMessageDirection.Response, () => container.ToByteArray(), source); - _sendingQueue.Enqueue(message); + EnqueueMessageOut(message); return source.Task; } @@ -447,7 +452,7 @@ namespace Tango.Transport IsContinuous = true, ContinuesResponseSubject = subject, }; - _sendingQueue.Enqueue(message); + EnqueueMessageOut(message); Task.Delay(timeout != null ? timeout.Value : RequestTimeout).ContinueWith((x) => { @@ -480,7 +485,7 @@ namespace Tango.Transport TaskCompletionSource> source = new TaskCompletionSource>(); TransportMessage> message = new TransportMessage>(request.Container.Token, request, TransportMessageDirection.Request, () => Encoder.Encode(request), source); - _sendingQueue.Enqueue(message); + EnqueueMessageOut(message); Task.Delay(timeout != null ? timeout.Value : RequestTimeout).ContinueWith((x) => { if (!source.Task.IsCompleted) @@ -521,7 +526,7 @@ namespace Tango.Transport IsContinuous = true, ContinuesResponseSubject = subject, }; - _sendingQueue.Enqueue(message); + EnqueueMessageOut(message); Task.Delay(firstTimeout != null ? firstTimeout.Value : RequestTimeout).ContinueWith((x) => { @@ -585,7 +590,7 @@ namespace Tango.Transport IsContinuous = true, ContinuesResponseSubject = subject, }; - _sendingQueue.Enqueue(message); + EnqueueMessageOut(message); Task.Delay(timeout != null ? timeout.Value : RequestTimeout).ContinueWith((x) => { @@ -695,7 +700,7 @@ namespace Tango.Transport TaskCompletionSource source = new TaskCompletionSource(); TransportMessage message = new TransportMessage(token, response, TransportMessageDirection.Response, () => Encoder.Encode(response), source); - _sendingQueue.Enqueue(message); + EnqueueMessageOut(message); return source.Task; } @@ -745,6 +750,26 @@ namespace Tango.Transport return container.Timeout > 0 ? TimeSpan.FromMilliseconds(container.Timeout) : default(TimeSpan?); } + /// + /// Enqueues the message and releases the push wait handle. + /// + /// The message. + private void EnqueueMessageOut(TransportMessageBase message) + { + _sendingQueue.Enqueue(message); + _push_wait_handle.Set(); + } + + /// + /// Enqueues the message and releases the pull wait handle. + /// + /// The data. + private void EnqueueMessageIn(byte[] data) + { + _arrivedResponses.Enqueue(data); + _pull_wait_handle.Set(); + } + #endregion #region Push Thread @@ -758,7 +783,7 @@ namespace Tango.Transport { while (State == TransportComponentState.Connected) { - while (Adapter != null && _sendingQueue.Count > 0) + if (Adapter != null && _sendingQueue.Count > 0) { TransportMessageBase message; if (_sendingQueue.TryDequeue(out message)) @@ -797,8 +822,7 @@ namespace Tango.Transport } } - Thread.Sleep(10); - + _push_wait_handle.WaitOne(); } } catch (Exception ex) @@ -822,7 +846,7 @@ namespace Tango.Transport { byte[] data; - while (Adapter != null && _arrivedResponses.Count > 0) + if (Adapter != null && _arrivedResponses.Count > 0) { if (_arrivedResponses.TryDequeue(out data)) { @@ -951,7 +975,7 @@ namespace Tango.Transport } } - Thread.Sleep(10); + _pull_wait_handle.WaitOne(); } } catch (Exception ex) diff --git a/Software/Visual_Studio/Utilities/Tango.Protobuf.CLI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Utilities/Tango.Protobuf.CLI/Properties/AssemblyInfo.cs index 353778c4d..4cd5bafb7 100644 --- a/Software/Visual_Studio/Utilities/Tango.Protobuf.CLI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/Utilities/Tango.Protobuf.CLI/Properties/AssemblyInfo.cs @@ -3,5 +3,5 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Tango - Protobuf Compilation CLI")] -[assembly: AssemblyVersion("2.0.14.1411")] +[assembly: AssemblyVersion("2.0.15.1355")] [assembly: ComVisible(false)] \ No newline at end of file -- 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') 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 { "EiIKHlN0dWJFeHRGbGFzaFdyaXRlV29yZHNSZXNwb25zZRBgEiAKHFN0dWJF", "eHRGbGFzaFJlYWRXb3Jkc1JlcXVlc3QQYRIhCh1TdHViRXh0Rmxhc2hSZWFk", "V29yZHNSZXNwb25zZRBiEiUKIEV4dGVybmFsQnJpZGdlVWRwRGlzY292ZXJ5", - "UGFja2V0EOgHEh8KGkV4dGVybmFsQ2xpZW50TG9naW5SZXF1ZXN0EOkHEiAK", - "G0V4dGVybmFsQ2xpZW50TG9naW5SZXNwb25zZRDqBxIhChxEaXJlY3RTeW5j", - "aHJvbml6YXRpb25SZXF1ZXN0EOsHEiIKHURpcmVjdFN5bmNocm9uaXphdGlv", - "blJlc3BvbnNlEOwHEhwKF092ZXJyaWRlRGF0YUJhc2VSZXF1ZXN0EO0HEh0K", - "GE92ZXJyaWRlRGF0YUJhc2VSZXNwb25zZRDuBxIcChdTdGFydERpYWdub3N0", - "aWNzUmVxdWVzdBDQDxIdChhTdGFydERpYWdub3N0aWNzUmVzcG9uc2UQ0Q8S", - "HAoXTW90b3JBYm9ydEhvbWluZ1JlcXVlc3QQ0g8SHQoYTW90b3JBYm9ydEhv", - "bWluZ1Jlc3BvbnNlENMPEhcKEk1vdG9ySG9taW5nUmVxdWVzdBDUDxIYChNN", - "b3RvckhvbWluZ1Jlc3BvbnNlENUPEhgKE01vdG9ySm9nZ2luZ1JlcXVlc3QQ", - "1g8SGQoUTW90b3JKb2dnaW5nUmVzcG9uc2UQ1w8SHQoYTW90b3JBYm9ydEpv", - "Z2dpbmdSZXF1ZXN0ENgPEh4KGU1vdG9yQWJvcnRKb2dnaW5nUmVzcG9uc2UQ", - "2Q8SIAobRGlzcGVuc2VyQWJvcnRIb21pbmdSZXF1ZXN0ENoPEiEKHERpc3Bl", - "bnNlckFib3J0SG9taW5nUmVzcG9uc2UQ2w8SGwoWRGlzcGVuc2VySG9taW5n", - "UmVxdWVzdBDcDxIcChdEaXNwZW5zZXJIb21pbmdSZXNwb25zZRDdDxIcChdE", - "aXNwZW5zZXJKb2dnaW5nUmVxdWVzdBDeDxIdChhEaXNwZW5zZXJKb2dnaW5n", - "UmVzcG9uc2UQ3w8SIQocRGlzcGVuc2VyQWJvcnRKb2dnaW5nUmVxdWVzdBDg", - "DxIiCh1EaXNwZW5zZXJBYm9ydEpvZ2dpbmdSZXNwb25zZRDhDxIZChRTZXRE", - "aWdpdGFsT3V0UmVxdWVzdBDiDxIaChVTZXREaWdpdGFsT3V0UmVzcG9uc2UQ", - "4w8SGQoUVGhyZWFkSm9nZ2luZ1JlcXVlc3QQ5A8SGgoVVGhyZWFkSm9nZ2lu", - "Z1Jlc3BvbnNlEOUPEh4KGVRocmVhZEFib3J0Sm9nZ2luZ1JlcXVlc3QQ5g8S", - "HwoaVGhyZWFkQWJvcnRKb2dnaW5nUmVzcG9uc2UQ5w8SHQoYU2V0Q29tcG9u", - "ZW50VmFsdWVSZXF1ZXN0EOgPEh4KGVNldENvbXBvbmVudFZhbHVlUmVzcG9u", - "c2UQ6Q8SGAoTUmVzb2x2ZUV2ZW50UmVxdWVzdBDqDxIZChRSZXNvbHZlRXZl", - "bnRSZXNwb25zZRDrDxIbChZTdG9wRGlhZ25vc3RpY3NSZXF1ZXN0EOwPEhwK", - "F1N0b3BEaWFnbm9zdGljc1Jlc3BvbnNlEO0PEg8KCkpvYlJlcXVlc3QQuBcS", - "EAoLSm9iUmVzcG9uc2UQuRcSFAoPQWJvcnRKb2JSZXF1ZXN0ELoXEhUKEEFi", - "b3J0Sm9iUmVzcG9uc2UQuxcSIwoeVXBsb2FkUHJvY2Vzc1BhcmFtZXRlcnNS", - "ZXF1ZXN0ELwXEiQKH1VwbG9hZFByb2Nlc3NQYXJhbWV0ZXJzUmVzcG9uc2UQ", - "vRcSGQoUU3RhcnREZWJ1Z0xvZ1JlcXVlc3QQoB8SGgoVU3RhcnREZWJ1Z0xv", - "Z1Jlc3BvbnNlEKEfEhgKE1N0b3BEZWJ1Z0xvZ1JlcXVlc3QQoh8SGQoUU3Rv", - "cERlYnVnTG9nUmVzcG9uc2UQox8SJwoiVXBsb2FkSGFyZHdhcmVDb25maWd1", - "cmF0aW9uUmVxdWVzdBCIJxIoCiNVcGxvYWRIYXJkd2FyZUNvbmZpZ3VyYXRp", - "b25SZXNwb25zZRCJJxIXChJTeXN0ZW1SZXNldFJlcXVlc3QQiicSGAoTU3lz", - "dGVtUmVzZXRSZXNwb25zZRCLJxIVChBLZWVwQWxpdmVSZXF1ZXN0EPAuEhYK", - "EUtlZXBBbGl2ZVJlc3BvbnNlEPEuEhMKDkNvbm5lY3RSZXF1ZXN0EPIuEhQK", - "D0Nvbm5lY3RSZXNwb25zZRDzLhIWChFEaXNjb25uZWN0UmVxdWVzdBD0LhIX", - "ChJEaXNjb25uZWN0UmVzcG9uc2UQ9S4SFgoRRmlsZVVwbG9hZFJlcXVlc3QQ", - "2DYSFwoSRmlsZVVwbG9hZFJlc3BvbnNlENk2EhsKFkZpbGVDaHVua1VwbG9h", - "ZFJlcXVlc3QQ2jYSHAoXRmlsZUNodW5rVXBsb2FkUmVzcG9uc2UQ2zYSGgoV", - "RXhlY3V0ZVByb2Nlc3NSZXF1ZXN0ENw2EhsKFkV4ZWN1dGVQcm9jZXNzUmVz", - "cG9uc2UQ3TYSFwoSS2lsbFByb2Nlc3NSZXF1ZXN0EN42EhgKE0tpbGxQcm9j", - "ZXNzUmVzcG9uc2UQ3zZCHAoaY29tLnR3aW5lLnRhbmdvLnBtci5jb21tb25i", - "BnByb3RvMw==")); + "UGFja2V0EOgHEh8KGkV4dGVybmFsQnJpZGdlTG9naW5SZXF1ZXN0EOkHEiAK", + "G0V4dGVybmFsQnJpZGdlTG9naW5SZXNwb25zZRDqBxIgChtFeHRlcm5hbEJy", + "aWRnZUxvZ291dFJlcXVlc3QQ6wcSIQocRXh0ZXJuYWxCcmlkZ2VMb2dvdXRS", + "ZXNwb25zZRDsBxIhChxEaXJlY3RTeW5jaHJvbml6YXRpb25SZXF1ZXN0EO0H", + "EiIKHURpcmVjdFN5bmNocm9uaXphdGlvblJlc3BvbnNlEO4HEhwKF092ZXJy", + "aWRlRGF0YUJhc2VSZXF1ZXN0EO8HEh0KGE92ZXJyaWRlRGF0YUJhc2VSZXNw", + "b25zZRDwBxIcChdTdGFydERpYWdub3N0aWNzUmVxdWVzdBDQDxIdChhTdGFy", + "dERpYWdub3N0aWNzUmVzcG9uc2UQ0Q8SHAoXTW90b3JBYm9ydEhvbWluZ1Jl", + "cXVlc3QQ0g8SHQoYTW90b3JBYm9ydEhvbWluZ1Jlc3BvbnNlENMPEhcKEk1v", + "dG9ySG9taW5nUmVxdWVzdBDUDxIYChNNb3RvckhvbWluZ1Jlc3BvbnNlENUP", + "EhgKE01vdG9ySm9nZ2luZ1JlcXVlc3QQ1g8SGQoUTW90b3JKb2dnaW5nUmVz", + "cG9uc2UQ1w8SHQoYTW90b3JBYm9ydEpvZ2dpbmdSZXF1ZXN0ENgPEh4KGU1v", + "dG9yQWJvcnRKb2dnaW5nUmVzcG9uc2UQ2Q8SIAobRGlzcGVuc2VyQWJvcnRI", + "b21pbmdSZXF1ZXN0ENoPEiEKHERpc3BlbnNlckFib3J0SG9taW5nUmVzcG9u", + "c2UQ2w8SGwoWRGlzcGVuc2VySG9taW5nUmVxdWVzdBDcDxIcChdEaXNwZW5z", + "ZXJIb21pbmdSZXNwb25zZRDdDxIcChdEaXNwZW5zZXJKb2dnaW5nUmVxdWVz", + "dBDeDxIdChhEaXNwZW5zZXJKb2dnaW5nUmVzcG9uc2UQ3w8SIQocRGlzcGVu", + "c2VyQWJvcnRKb2dnaW5nUmVxdWVzdBDgDxIiCh1EaXNwZW5zZXJBYm9ydEpv", + "Z2dpbmdSZXNwb25zZRDhDxIZChRTZXREaWdpdGFsT3V0UmVxdWVzdBDiDxIa", + "ChVTZXREaWdpdGFsT3V0UmVzcG9uc2UQ4w8SGQoUVGhyZWFkSm9nZ2luZ1Jl", + "cXVlc3QQ5A8SGgoVVGhyZWFkSm9nZ2luZ1Jlc3BvbnNlEOUPEh4KGVRocmVh", + "ZEFib3J0Sm9nZ2luZ1JlcXVlc3QQ5g8SHwoaVGhyZWFkQWJvcnRKb2dnaW5n", + "UmVzcG9uc2UQ5w8SHQoYU2V0Q29tcG9uZW50VmFsdWVSZXF1ZXN0EOgPEh4K", + "GVNldENvbXBvbmVudFZhbHVlUmVzcG9uc2UQ6Q8SGAoTUmVzb2x2ZUV2ZW50", + "UmVxdWVzdBDqDxIZChRSZXNvbHZlRXZlbnRSZXNwb25zZRDrDxIbChZTdG9w", + "RGlhZ25vc3RpY3NSZXF1ZXN0EOwPEhwKF1N0b3BEaWFnbm9zdGljc1Jlc3Bv", + "bnNlEO0PEg8KCkpvYlJlcXVlc3QQuBcSEAoLSm9iUmVzcG9uc2UQuRcSFAoP", + "QWJvcnRKb2JSZXF1ZXN0ELoXEhUKEEFib3J0Sm9iUmVzcG9uc2UQuxcSIwoe", + "VXBsb2FkUHJvY2Vzc1BhcmFtZXRlcnNSZXF1ZXN0ELwXEiQKH1VwbG9hZFBy", + "b2Nlc3NQYXJhbWV0ZXJzUmVzcG9uc2UQvRcSGQoUU3RhcnREZWJ1Z0xvZ1Jl", + "cXVlc3QQoB8SGgoVU3RhcnREZWJ1Z0xvZ1Jlc3BvbnNlEKEfEhgKE1N0b3BE", + "ZWJ1Z0xvZ1JlcXVlc3QQoh8SGQoUU3RvcERlYnVnTG9nUmVzcG9uc2UQox8S", + "JwoiVXBsb2FkSGFyZHdhcmVDb25maWd1cmF0aW9uUmVxdWVzdBCIJxIoCiNV", + "cGxvYWRIYXJkd2FyZUNvbmZpZ3VyYXRpb25SZXNwb25zZRCJJxIXChJTeXN0", + "ZW1SZXNldFJlcXVlc3QQiicSGAoTU3lzdGVtUmVzZXRSZXNwb25zZRCLJxIV", + "ChBLZWVwQWxpdmVSZXF1ZXN0EPAuEhYKEUtlZXBBbGl2ZVJlc3BvbnNlEPEu", + "EhMKDkNvbm5lY3RSZXF1ZXN0EPIuEhQKD0Nvbm5lY3RSZXNwb25zZRDzLhIW", + "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