diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-02-15 15:04:39 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-02-15 15:04:39 +0200 |
| commit | 9879f87a345bec10a3ee26e9ec669add2b5bfcd3 (patch) | |
| tree | d2e70aac5e15edff8f58f76a2c450132dc562db3 /Software/Visual_Studio | |
| parent | 63cb3aa2350a10e6db68e4dc181b2ee7e500061a (diff) | |
| download | Tango-9879f87a345bec10a3ee26e9ec669add2b5bfcd3.tar.gz Tango-9879f87a345bec10a3ee26e9ec669add2b5bfcd3.zip | |
Enable Diagnostics on connection.
Diffstat (limited to 'Software/Visual_Studio')
7 files changed, 66 insertions, 313 deletions
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 10c35b3b9..b2f6c3579 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 @@ -30,6 +30,8 @@ using Tango.Integration.Diagnostics; using Microsoft.Win32; using Tango.MachineStudio.Technician.ViewModels; using Tango.MachineStudio.Common.Diagnostics; +using Tango.MachineStudio.Common.Video; +using Tango.Integration.Services; namespace Tango.MachineStudio.Developer.ViewModels { @@ -45,32 +47,18 @@ namespace Tango.MachineStudio.Developer.ViewModels private int _fullScreenGraphIndex; private JobHandler _jobHandler; - #region Properties - private DiagnosticsFileRecorder _recorder; - /// <summary> - /// Gets or sets the diagnostics file recorder. - /// </summary> - public DiagnosticsFileRecorder Recorder - { - get { return _recorder; } - set { _recorder = value; RaisePropertyChangedAuto(); } - } + #region Properties - private DiagnosticsFilePlayer _player; /// <summary> - /// Gets or sets the diagnostics file player. + /// Gets or sets the application manager. /// </summary> - public DiagnosticsFilePlayer Player - { - get { return _player; } - set { _player = value; RaisePropertyChangedAuto(); } - } + public IStudioApplicationManager ApplicationManager { get; set; } /// <summary> - /// Gets or sets the application manager. + /// Gets or sets the video capture provider. /// </summary> - public IStudioApplicationManager ApplicationManager { get; set; } + public IVideoCaptureProvider VideoCaptureProvider { get; set; } /// <summary> /// Gets or sets observable entites database the adapter. @@ -321,11 +309,6 @@ namespace Tango.MachineStudio.Developer.ViewModels set { _isJobCanceled = value; RaisePropertyChangedAuto(); } } - /// <summary> - /// Gets or sets the capture devices. - /// </summary> - public ObservableCollection<CaptureDevice> CaptureDevices { get; set; } - private IMachineOperator _machineOperator; /// <summary> /// Gets or sets the machine operator. @@ -346,16 +329,6 @@ namespace Tango.MachineStudio.Developer.ViewModels set { _fullScreenGraph = value; RaisePropertyChangedAuto(); } } - private MachineTechViewVM _machineTechViewVM; - /// <summary> - /// Gets or sets the machine tech view models. - /// </summary> - public MachineTechViewVM MachineTechViewVM - { - get { return _machineTechViewVM; } - set { _machineTechViewVM = value; RaisePropertyChangedAuto(); } - } - #endregion #region Commands @@ -445,31 +418,6 @@ namespace Tango.MachineStudio.Developer.ViewModels /// </summary> public RelayCommand ExitFullScreenCommand { get; set; } - /// <summary> - /// Gets or sets the media recording command. - /// </summary> - public RelayCommand MediaRecordingCommand { get; set; } - - /// <summary> - /// Gets or sets the media stop command. - /// </summary> - public RelayCommand MediaStopCommand { get; set; } - - /// <summary> - /// Gets or sets the media toggle play pause command. - /// </summary> - public RelayCommand MediaTogglePlayPauseCommand { get; set; } - - /// <summary> - /// Gets or sets the media play pause command. - /// </summary> - public RelayCommand MediaPlayPauseCommand { get; set; } - - /// <summary> - /// Gets or sets the media load command. - /// </summary> - public RelayCommand MediaLoadCommand { get; set; } - #endregion #region Constructors @@ -487,8 +435,6 @@ namespace Tango.MachineStudio.Developer.ViewModels Graphs = new ObservableCollection<IRealTimeGraph>(); _controllers = new Dictionary<String, GraphControllerBase>(); - Recorder = new DiagnosticsFileRecorder(); - Player = new DiagnosticsFilePlayer(); } /// <summary> @@ -497,10 +443,11 @@ namespace Tango.MachineStudio.Developer.ViewModels /// <param name="applicationManager">The application manager.</param> /// <param name="notificationProvider">The notification provider.</param> [PreferredConstructor] - public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IMainView view, IDiagnosticsFrameProvider diagnosticsFrameProvider) : this(view) + public MainViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IMainView view, IDiagnosticsFrameProvider diagnosticsFrameProvider, IVideoCaptureProvider videoCaptureProvider) : this(view) { _notification = notificationProvider; ApplicationManager = applicationManager; + VideoCaptureProvider = videoCaptureProvider; diagnosticsFrameProvider.FrameReceived += DiagnosticsFrameProvider_FrameReceived; //Initialize Commands... @@ -520,31 +467,10 @@ namespace Tango.MachineStudio.Developer.ViewModels StopJobCommand = new RelayCommand(StopJob, () => IsJobRunning); CloseJobCompletionStatusCommand = new RelayCommand(CloseJobCompletionStatusBar); ExitFullScreenCommand = new RelayCommand(ExitFullScreen); - MediaRecordingCommand = new RelayCommand(StartDiagnosticsRecording, () => !Recorder.IsRecording && MachineOperator != null && !Player.IsPlaying); - MediaStopCommand = new RelayCommand(StopRecorderOrPlayer, () => Recorder.IsRecording || Player.IsPlaying); - MediaLoadCommand = new RelayCommand(LoadDiagnosticsRecordingFile, () => !Recorder.IsRecording && !Player.IsPlaying); - MediaPlayPauseCommand = new RelayCommand(DiagnosticsTogglePlayPause, () => !Recorder.IsRecording && Player.IsLoaded); - - CaptureDevices = new ObservableCollection<CaptureDevice>(); - var availableDevices = CaptureDevice.GetAvailableCaptureDevices(); - - for (int i = 0; i < 3; i++) - { - if (i > availableDevices.Count - 1) - { - CaptureDevices.Add(new CaptureDevice() { Device = null }); - } - else - { - CaptureDevices.Add(new CaptureDevice() { Device = availableDevices[i] }); - } - } ToggleCameraCommand = new RelayCommand<CaptureDevice>(ToggleCamera); ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; - - MachineTechViewVM = new MachineTechViewVM(applicationManager, notificationProvider, false); } #endregion @@ -556,33 +482,9 @@ namespace Tango.MachineStudio.Developer.ViewModels PopulateDiagnosticsData(response); } - private void Player_FrameReceived(object sender, DataFileFrame frame) - { - PopulateDiagnosticsData(frame.PushDiagnosticsResponse); - } - - private void ApplicationManager_ConnectedMachineChanged(object sender, Integration.Services.IExternalBridgeClient machine) + private void ApplicationManager_ConnectedMachineChanged(object sender, IExternalBridgeClient machine) { MachineOperator = machine; - - if (MachineOperator != null) - { - MachineOperator.EnableDiagnostics = true; - MachineOperator.DiagnosticsDataAvailable += MachineOperator_DiagnosticsDataAvailable; - } - } - - private void MachineOperator_DiagnosticsDataAvailable(object sender, PushDiagnosticsResponse response) - { - //if (Recorder.IsRecording) - //{ - // Recorder.Write(response); - //} - - //if (!Player.IsPlaying) - //{ - // PopulateDiagnosticsData(response); - //} } /// <summary> @@ -631,7 +533,6 @@ namespace Tango.MachineStudio.Developer.ViewModels /// <summary> /// Called when the process parameters table group has been changed /// </summary> - /// <exception cref="NotImplementedException"></exception> private void OnProcessParametersTableGroupChanged() { if (RmlProcessParametersTableGroup != null && RmlProcessParametersTableGroup.ProcessParametersTables.Count > 0) @@ -720,89 +621,6 @@ namespace Tango.MachineStudio.Developer.ViewModels } } - private void DiagnosticsTogglePlayPause() - { - if (!Player.IsPlaying || Player.IsPaused) - { - if (!Player.IsPlaying) - { - ClearGraphs(); - } - Player.Play(); - } - else - { - Player.Pause(); - } - - InvalidateRelayCommands(); - } - - private async void LoadDiagnosticsRecordingFile() - { - OpenFileDialog dlg = new OpenFileDialog(); - dlg.Title = "Select Tango Diagnostics Recording File"; - dlg.Filter = "Tango Diagnostics Recording|*.tdr"; - if (dlg.ShowDialog().Value) - { - using (_notification.PushTaskItem("Loading Recording...")) - { - if (Player != null) - { - Player.Dispose(); - } - - Player = new DiagnosticsFilePlayer(); - Player.FrameReceived += Player_FrameReceived; - await Player.Load(dlg.FileName); - } - } - - InvalidateRelayCommands(); - } - - private void StartDiagnosticsRecording() - { - using (_notification.PushTaskItem("Starting Recording...")) - { - Recorder.Start(); - } - - InvalidateRelayCommands(); - } - - private async void StopRecorderOrPlayer() - { - if (Recorder.IsRecording) - { - using (_notification.PushTaskItem("Stopping Recording...")) - { - await Recorder.Stop(); - } - - SaveFileDialog dlg = new SaveFileDialog(); - dlg.Title = "Select diagnostics file location"; - dlg.Filter = "Tango Diagnostics Recording|*.tdr"; - if (dlg.ShowDialog().Value) - { - using (_notification.PushTaskItem("Saving Recording...")) - { - await Recorder.Save(dlg.FileName); - } - } - - Recorder.Dispose(); - Recorder = new DiagnosticsFileRecorder(); - } - else if (Player.IsPlaying) - { - await Player.Stop(); - ClearGraphs(); - } - - InvalidateRelayCommands(); - } - private void ExitFullScreen() { if (FullScreenGraph != null) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml index 844a38917..b6d859cd4 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml @@ -1651,102 +1651,9 @@ <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" Foreground="DimGray" FontSize="16" FontWeight="SemiBold">USB CAMERAS</TextBlock> </StackPanel> - <Grid DockPanel.Dock="Bottom" Height="120" Width="300"> - <Border Background="#5DFFFFFF" CornerRadius="10" Padding="5" Margin="0 0 0 10" BorderThickness="1" BorderBrush="Gainsboro"> - <DockPanel> - <StackPanel Orientation="Horizontal" DockPanel.Dock="Top"> - <Image Source="../Images/tape.png" Width="25"></Image> - <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" Foreground="DimGray" FontSize="16" FontWeight="SemiBold">DATA RECORDER / PLAYER</TextBlock> - </StackPanel> - <Grid> - <DockPanel> - <DockPanel DockPanel.Dock="Top"> - <StackPanel Orientation="Horizontal" DockPanel.Dock="Left" Height="50" VerticalAlignment="Bottom" Margin="0 0 0 5"> - <Button Command="{Binding MediaLoadCommand}" Style="{StaticResource MaterialDesignFloatingActionButton}" Padding="0" Width="28" Height="28" Background="Transparent" ToolTip="Load Data File"> - <materialDesign:PackIcon Width="20" Height="20" Kind="Eject" Foreground="{StaticResource AccentColorBrush}" /> - </Button> - <Button Command="{Binding MediaPlayPauseCommand}" Margin="5 0 0 0" Style="{StaticResource MaterialDesignFloatingActionButton}" Padding="0" Width="35" Height="35" Background="Transparent"> - <materialDesign:PackIcon Width="20" Height="20" Foreground="{StaticResource AccentColorBrush}"> - <materialDesign:PackIcon.Style> - <Style TargetType="materialDesign:PackIcon"> - <Setter Property="Kind" Value="Play"></Setter> - <Style.Triggers> - <MultiDataTrigger> - <MultiDataTrigger.Conditions> - <Condition Binding="{Binding Player.IsPlaying}" Value="True" /> - <Condition Binding="{Binding Player.IsPaused}" Value="False" /> - </MultiDataTrigger.Conditions> - <Setter Property="Kind" Value="Pause"></Setter> - </MultiDataTrigger> - </Style.Triggers> - </Style> - </materialDesign:PackIcon.Style> - </materialDesign:PackIcon> - </Button> - <Button Command="{Binding MediaStopCommand}" Margin="5 0 0 0" Style="{StaticResource MaterialDesignFloatingActionButton}" Padding="0" Width="28" Height="28" Background="Transparent"> - <materialDesign:PackIcon Width="20" Height="20" Kind="Stop" Foreground="{StaticResource AccentColorBrush}" /> - </Button> - <Button Command="{Binding MediaRecordingCommand}" Margin="5 0 0 0" Style="{StaticResource MaterialDesignFloatingActionButton}" Foreground="#FF7A7A" BorderBrush="#FF8585" Padding="0" Width="20" Height="20" Background="Transparent" ToolTip="Start Recording"> - <materialDesign:PackIcon Width="10" Height="10" Kind="Record" /> - </Button> - </StackPanel> - <Grid> - <TextBlock Margin="0 -5 0 0" VerticalAlignment="Center" HorizontalAlignment="Right" Foreground="#FF8585" FontSize="20" FontFamily="{StaticResource digital-7}"> - <TextBlock.Style> - <Style TargetType="TextBlock"> - <Setter Property="Opacity" Value="1"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding Recorder.IsRecording}" Value="True"> - <DataTrigger.EnterActions> - <BeginStoryboard> - <Storyboard> - <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Duration="00:00:01" RepeatBehavior="Forever"> - <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="1" /> - <DiscreteDoubleKeyFrame KeyTime="00:00:0.5" Value="0" /> - </DoubleAnimationUsingKeyFrames> - </Storyboard> - </BeginStoryboard> - </DataTrigger.EnterActions> - <DataTrigger.ExitActions> - <BeginStoryboard> - <Storyboard> - <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Duration="00:00:01"> - <DiscreteDoubleKeyFrame KeyTime="00:00:00" Value="1" /> - </DoubleAnimationUsingKeyFrames> - </Storyboard> - </BeginStoryboard> - </DataTrigger.ExitActions> - </DataTrigger> - </Style.Triggers> - </Style> - </TextBlock.Style> - <Run Text="{Binding Player.CurrentTime,Mode=OneWay,StringFormat=hh\\:mm\\:ss,FallbackValue='00:00:00'}"/> - <Run>/</Run> - <Run Text="{Binding Player.TotalTime,Mode=OneWay,StringFormat=hh\\:mm\\:ss,FallbackValue='00:00:00'}"/> - </TextBlock> - </Grid> - </DockPanel> - <Grid> - <Slider Visibility="{Binding Recorder.IsRecording,Converter={StaticResource BooleanToVisibilityInverseConverter}}" Maximum="{Binding Player.TotalFrames}" Value="{Binding Player.CurrentFrame}"></Slider> - <DockPanel Visibility="{Binding Recorder.IsRecording,Converter={StaticResource BooleanToVisibilityConverter}}"> - <TextBlock DockPanel.Dock="Left"> - <Run FontWeight="SemiBold" FontStyle="Italic">Total Frames:</Run> - <Run FontStyle="Italic" Foreground="#545454" Text="{Binding Recorder.TotalFramesRecorded,StringFormat={}{0:N0},Mode=OneWay,TargetNullValue=0,FallbackValue=0}"></Run> - </TextBlock> - <TextBlock HorizontalAlignment="Right" Width="140"> - <Run FontWeight="SemiBold" FontStyle="Italic">File Size:</Run> - <Run FontStyle="Italic" Foreground="#545454" Text="{Binding Recorder.TotalBytesRecorded,Mode=OneWay,Converter={StaticResource NumberToFileSizeConverter},TargetNullValue=0,FallbackValue=0}"></Run> - </TextBlock> - </DockPanel> - </Grid> - </DockPanel> - </Grid> - </DockPanel> - </Border> - </Grid> - <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Margin="0 0 0 10"> - <ItemsControl x:Name="listCameras" ItemsSource="{Binding CaptureDevices}" Height="790" Width="320"> + <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalAlignment="Top" VerticalScrollBarVisibility="Auto" Margin="0 0 0 10"> + <ItemsControl x:Name="listCameras" ItemsSource="{Binding VideoCaptureProvider.AvailableCaptureDevices}" Height="790" Width="320"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <UniformGrid Rows="3" /> @@ -2051,7 +1958,7 @@ <Grid Background="{StaticResource SideBarBackground}" IsEnabled="{Binding IsJobRunning,Converter={StaticResource BooleanInverseConverter}}"> <Grid.Style> <Style TargetType="Grid"> - <Setter Property="Width" Value="550"></Setter> + <Setter Property="Width" Value="500"></Setter> <Setter Property="LayoutTransform"> <Setter.Value> <ScaleTransform ScaleY="1" ScaleX="0"></ScaleTransform> @@ -2093,7 +2000,7 @@ </DataTemplate> </ComboBox.ItemTemplate> </ComboBox> - <designer:MachineView Width="540" IsHitTestVisible="False" Margin="0 40 0 0" DataContext="{Binding SelectedMachine}" /> + <designer:MachineView Width="500" IsHitTestVisible="False" Margin="0 40 0 0" DataContext="{Binding SelectedMachine}" /> <Button Command="{Binding EditMachineCommand}" HorizontalAlignment="Right" Margin="0 10 20 20" Style="{StaticResource MaterialDesignFlatButton}"> <StackPanel Orientation="Horizontal"> <materialDesign:PackIcon VerticalAlignment="Center" Kind="Pencil"></materialDesign:PackIcon> @@ -2148,7 +2055,7 @@ <DataTemplate DataType="{x:Type observables:LiquidTypesRml}"> <StackPanel Margin="0 0 10 20"> <TextBlock HorizontalAlignment="Center" FontSize="10" Foreground="DimGray" Text="{Binding LiquidType.Name}"></TextBlock> - <Grid Width="60" Height="50" Margin="0 5 0 0"> + <Grid Width="58" Height="48" Margin="0 5 0 0"> <shapes:Hexagon StrokeThickness="1" Stroke="Gray"> <shapes:Hexagon.Fill> <LinearGradientBrush Opacity="0.7" > diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml index 153ab6ffe..1626e67ef 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml @@ -52,36 +52,48 @@ </Grid> <Grid Grid.Row="1"> - <ListBox ItemsSource="{Binding Scanner.AvailableMachines}" SelectedItem="{Binding SelectedMachine}" Margin="0 0 0 7" BorderThickness="1" BorderBrush="Gainsboro"> + <ListBox ItemsSource="{Binding Scanner.AvailableMachines}" SelectedItem="{Binding SelectedMachine}" Margin="0 0 0 7" BorderThickness="1" BorderBrush="Gainsboro" HorizontalContentAlignment="Stretch"> <ListBox.Resources> <DataTemplate DataType="{x:Type integration:ExternalBridgeTcpClient}"> - <StackPanel Orientation="Horizontal"> - <Image Source="/Images/external-bridge-tcp.png" Width="38" Height="38" RenderOptions.BitmapScalingMode="Fant"></Image> - <StackPanel Margin="10 0 0 0"> - <TextBlock FontSize="11"> + <DockPanel> + <StackPanel Orientation="Vertical" VerticalAlignment="Center" DockPanel.Dock="Right" ToolTip="Allow incoming diagnostics data"> + <ToggleButton IsChecked="{Binding EnableDiagnostics}" VerticalAlignment="Center"></ToggleButton> + <TextBlock VerticalAlignment="Center" FontSize="10">Diagnostics</TextBlock> + </StackPanel> + <StackPanel Orientation="Horizontal"> + <Image Source="/Images/external-bridge-tcp.png" Width="38" Height="38" RenderOptions.BitmapScalingMode="Fant"></Image> + <StackPanel Margin="10 0 0 0"> + <TextBlock FontSize="11"> <Run FontWeight="Bold">S/N:</Run> <Run Text="{Binding SerialNumber,Mode=OneWay}"></Run> - </TextBlock> - <TextBlock FontSize="11"> + </TextBlock> + <TextBlock FontSize="11"> <Run FontWeight="Bold">IP Address:</Run> <Run Text="{Binding IPAddress,Mode=OneWay}"></Run> - </TextBlock> - <TextBlock FontSize="11"> + </TextBlock> + <TextBlock FontSize="11"> <Run FontWeight="Bold">Organization:</Run> <Run Text="{Binding Organization,Mode=OneWay}"></Run> - </TextBlock> + </TextBlock> + </StackPanel> </StackPanel> - </StackPanel> + </DockPanel> </DataTemplate> <DataTemplate DataType="{x:Type integration:ExternalBridgeUsbClient}"> - <StackPanel Orientation="Horizontal"> - <Image Source="/Images/external-bridge-usb.png" Width="38" Height="38" RenderOptions.BitmapScalingMode="Fant"></Image> - <StackPanel Margin="10 0 0 0"> - <TextBlock FontSize="11"> + <DockPanel> + <StackPanel Orientation="Vertical" VerticalAlignment="Center" DockPanel.Dock="Right" ToolTip="Allow incoming diagnostics data"> + <ToggleButton IsChecked="{Binding EnableDiagnostics}" VerticalAlignment="Center"></ToggleButton> + <TextBlock VerticalAlignment="Center" FontSize="10">Diagnostics</TextBlock> + </StackPanel> + <StackPanel Orientation="Horizontal"> + <Image Source="/Images/external-bridge-usb.png" Width="38" Height="38" RenderOptions.BitmapScalingMode="Fant"></Image> + <StackPanel Margin="10 0 0 0"> + <TextBlock FontSize="11"> <Run FontWeight="Bold">Port:</Run> <Run Text="{Binding ComPort,Mode=OneWay}"></Run> - </TextBlock> - <TextBlock FontSize="11"> + </TextBlock> + <TextBlock FontSize="11"> <Run FontWeight="Bold">Device:</Run> <Run Text="{Binding Device,Mode=OneWay}"></Run> - </TextBlock> + </TextBlock> + </StackPanel> </StackPanel> - </StackPanel> + </DockPanel> </DataTemplate> </ListBox.Resources> </ListBox> diff --git a/Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs index 4bbd7aa64..eaa72541c 100644 --- a/Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operators/MachineOperator.cs @@ -25,6 +25,8 @@ namespace Tango.Integration.Operators /// <seealso cref="Tango.Integration.Operators.IMachineOperator" /> public class MachineOperator : BasicTransporter, IMachineOperator { + private bool _diagnosticsSent; + #region Events /// <summary> @@ -59,7 +61,7 @@ namespace Tango.Integration.Operators #region Virtual Methods /// <summary> - /// Called when the enable sensors update property has been changed + /// Called when the enable diagnostics property has been changed /// </summary> /// <param name="value">if set to <c>true</c> [value].</param> protected virtual void OnEnableDiagnosticsChanged(bool value) @@ -74,17 +76,24 @@ namespace Tango.Integration.Operators }, MessageType.PushDiagnosticsRequest)).ObserveOn(new NewThreadScheduler()).Subscribe( (response) => { + _diagnosticsSent = true; OnDiagnosticsDataAvailable(response); }, (ex) => { + _diagnosticsSent = false; //Do I need separate event for each one ?? }, () => { + _diagnosticsSent = false; //What to do now ?? }); } + else + { + _diagnosticsSent = false; + } } /// <summary> diff --git a/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeTcpClient.cs b/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeTcpClient.cs index e54bf1bd5..a9ccd6836 100644 --- a/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeTcpClient.cs +++ b/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeTcpClient.cs @@ -96,6 +96,7 @@ namespace Tango.Integration.Services SerialNumber = serialNumber; IPAddress = ipAddress; UseKeepAlive = true; + EnableDiagnostics = true; } /// <summary> diff --git a/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeUsbClient.cs b/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeUsbClient.cs index e6124d0a8..766df7cb8 100644 --- a/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeUsbClient.cs +++ b/Software/Visual_Studio/Tango.Integration/Services/ExternalBridgeUsbClient.cs @@ -68,6 +68,7 @@ namespace Tango.Integration.Services ComPort = comPort; Device = device; UseKeepAlive = false; + EnableDiagnostics = true; } /// <summary> diff --git a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs index 236cc3976..0ce75fcc6 100644 --- a/Software/Visual_Studio/Tango.Transport/TransporterBase.cs +++ b/Software/Visual_Studio/Tango.Transport/TransporterBase.cs @@ -226,13 +226,14 @@ namespace Tango.Transport /// <returns></returns> public virtual async Task Connect() { - State = TransportComponentState.Connected; - StartThreads(); - if (Adapter != null) { await Adapter.Connect(); } + + State = TransportComponentState.Connected; + StartThreads(); + LogManager.Log("Transporter Connected..."); } @@ -424,6 +425,10 @@ namespace Tango.Transport Adapter.Write(message.Serialize()); LogManager.Log("Message sent on adapter: " + Adapter.Address + "...", LogCategory.Debug); } + else + { + LogManager.Log("Could not send message " + message.Message.GetType().Name + ". Adapter is disconnected.", LogCategory.Warning); + } if (message.Direction == TransportMessageDirection.Request) { |
