diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-02-01 18:22:44 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-02-01 18:22:44 +0200 |
| commit | 40990f3c352117fc536fdf004956d120bc63ee09 (patch) | |
| tree | edb82f81e9f16fac3d7e409ec279eae50fa1642f /Software/Visual_Studio/MachineStudio/Modules | |
| parent | c43439d0c4b7f4434eaf277c0f60c5e3c0494ac2 (diff) | |
| download | Tango-40990f3c352117fc536fdf004956d120bc63ee09.tar.gz Tango-40990f3c352117fc536fdf004956d120bc63ee09.zip | |
Added sensors data support for developer module.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
4 files changed, 70 insertions, 10 deletions
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 @@ <Reference Include="GalaSoft.MvvmLight.Platform, Version=5.3.0.19032, Culture=neutral, PublicKeyToken=5f873c45e98af8a1, processorArchitecture=MSIL"> <HintPath>..\..\..\packages\MvvmLightLibs.5.3.0.0\lib\net45\GalaSoft.MvvmLight.Platform.dll</HintPath> </Reference> + <Reference Include="Google.Protobuf, Version=3.4.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL"> + <HintPath>..\..\..\packages\Google.Protobuf.3.4.1\lib\net45\Google.Protobuf.dll</HintPath> + </Reference> <Reference Include="MahApps.Metro, Version=1.5.0.23, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL"> <HintPath>..\..\..\packages\MahApps.Metro.1.5.0\lib\net45\MahApps.Metro.dll</HintPath> </Reference> @@ -159,6 +162,10 @@ <Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project> <Name>Tango.Integration</Name> </ProjectReference> + <ProjectReference Include="..\..\..\Tango.PMR\Tango.PMR.csproj"> + <Project>{e4927038-348d-4295-aaf4-861c58cb3943}</Project> + <Name>Tango.PMR</Name> + </ProjectReference> <ProjectReference Include="..\..\..\Tango.Settings\Tango.Settings.csproj"> <Project>{D8F1AD85-526A-4F50-B6DC-D437AF63D8D8}</Project> <Name>Tango.Settings</Name> @@ -167,6 +174,10 @@ <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project> <Name>Tango.SharedUI</Name> </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Transport\Tango.Transport.csproj"> + <Project>{74e700b0-1156-4126-be40-ee450d3c3026}</Project> + <Name>Tango.Transport</Name> + </ProjectReference> <ProjectReference Include="..\..\..\Tango.Video\Tango.Video.csproj"> <Project>{9652f972-2bd1-4283-99cb-fc6240434c17}</Project> <Name>Tango.Video</Name> 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. /// </summary> public ObservableCollection<CaptureDevice> CaptureDevices { get; set; } + + private IMachineOperator _machineOperator; + /// <summary> + /// Gets or sets the machine operator. + /// </summary> + 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<CaptureDevice>(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<double>); + (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 @@ <?xml version="1.0" encoding="utf-8"?> <packages> <package id="CommonServiceLocator" version="1.3" targetFramework="net46" /> + <package id="Google.Protobuf" version="3.4.1" targetFramework="net46" /> <package id="MahApps.Metro" version="1.5.0" targetFramework="net46" /> <package id="MaterialDesignColors" version="1.1.2" targetFramework="net46" /> <package id="MaterialDesignThemes" version="2.3.1.953" targetFramework="net46" /> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs index de2f200c8..1a87ad4f3 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs @@ -128,9 +128,9 @@ namespace Tango.MachineStudio.Technician.ViewModels /// <param name="data">The data.</param> private void MachineOperator_DiagnosticsDataAvailable(object sender, StartDiagnosticsResponse data) { - TemperatureController.PushData(data.Temperature.ToArray()); - PressureController.PushData(data.Temperature.ToArray()); - VelocityController.PushData(data.Velocity.ToArray()); + //TemperatureController.PushData(data.Temperature.ToArray()); + //PressureController.PushData(data.Temperature.ToArray()); + //VelocityController.PushData(data.Velocity.ToArray()); } #endregion @@ -143,14 +143,14 @@ namespace Tango.MachineStudio.Technician.ViewModels /// <param name="machineOperator">The machine operator.</param> private void InitializeConnectedMachine(IMachineOperator machineOperator) { - MachineOperator = machineOperator; + //MachineOperator = machineOperator; - if (MachineOperator != null) - { - MachineOperator.EnableSensorsUpdate = true; - MachineOperator.DiagnosticsDataAvailable -= MachineOperator_DiagnosticsDataAvailable; - MachineOperator.DiagnosticsDataAvailable += MachineOperator_DiagnosticsDataAvailable; - } + //if (MachineOperator != null) + //{ + // MachineOperator.EnableSensorsUpdate = true; + // MachineOperator.DiagnosticsDataAvailable -= MachineOperator_DiagnosticsDataAvailable; + // MachineOperator.DiagnosticsDataAvailable += MachineOperator_DiagnosticsDataAvailable; + //} } #endregion |
