From 40990f3c352117fc536fdf004956d120bc63ee09 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 1 Feb 2018 18:22:44 +0200 Subject: Added sensors data support for developer module. --- .../Tango.MachineStudio.Developer.csproj | 11 +++++ .../ViewModels/MainViewVM.cs | 48 ++++++++++++++++++++++ .../Tango.MachineStudio.Developer/packages.config | 1 + 3 files changed, 60 insertions(+) (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer') diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj index 622e4f51c..43c5707ef 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj @@ -40,6 +40,9 @@ ..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Platform.dll + + ..\..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll + ..\..\..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll @@ -159,6 +162,10 @@ {4206ac58-3b57-4699-8835-90bf6db01a61} Tango.Integration + + {e4927038-348d-4295-aaf4-861c58cb3943} + Tango.PMR + {D8F1AD85-526A-4F50-B6DC-D437AF63D8D8} Tango.Settings @@ -167,6 +174,10 @@ {8491d07b-c1f6-4b62-a412-41b9fd2d6538} Tango.SharedUI + + {74e700b0-1156-4126-be40-ee450d3c3026} + Tango.Transport + {9652f972-2bd1-4283-99cb-fc6240434c17} Tango.Video diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index 52d67a141..4f045627d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -19,6 +19,9 @@ using System.Windows.Threading; using Tango.Settings; using Tango.MachineStudio.Developer.Views; using Tango.Video.DirectCapture; +using Tango.Integration.Operators; +using Tango.PMR.Diagnostics; +using System.Reflection; namespace Tango.MachineStudio.Developer.ViewModels { @@ -292,6 +295,17 @@ namespace Tango.MachineStudio.Developer.ViewModels /// Gets or sets the capture devices. /// public ObservableCollection CaptureDevices { get; set; } + + private IMachineOperator _machineOperator; + /// + /// Gets or sets the machine operator. + /// + public IMachineOperator MachineOperator + { + get { return _machineOperator; } + set { _machineOperator = value; RaisePropertyChangedAuto(); } + } + #endregion #region Commands @@ -441,6 +455,40 @@ namespace Tango.MachineStudio.Developer.ViewModels } ToggleCameraCommand = new RelayCommand(ToggleCamera); + + ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; + } + + private void ApplicationManager_ConnectedMachineChanged(object sender, Integration.Services.IExternalBridgeClient machine) + { + MachineOperator = machine; + + if (MachineOperator != null) + { + MachineOperator.EnableSensorsUpdate = true; + MachineOperator.DiagnosticsDataAvailable += MachineOperator_DiagnosticsDataAvailable; + } + } + + private void MachineOperator_DiagnosticsDataAvailable(object sender, StartDiagnosticsResponse response) + { + foreach (var prop in response.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance)) + { + GraphControllerBase controller = null; + + if (_controllers.TryGetValue(prop.Name, out controller)) + { + if (controller is GraphController) + { + double[] arr = Enumerable.ToArray(prop.GetValue(response) as IEnumerable); + (controller as GraphController).PushData(arr); + } + else + { + //Multi Graph... + } + } + } } #endregion diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/packages.config b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/packages.config index 4fd672b32..9f69ed86f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/packages.config +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/packages.config @@ -1,6 +1,7 @@  + -- cgit v1.3.1