diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-07-30 11:47:03 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-07-30 11:47:03 +0300 |
| commit | 019bc4dca9a0655e5adf1e26d8e3f513563113db (patch) | |
| tree | 34f2d5e9d80d2d12a7e7c41e31dff1fd424a8fe2 /Software | |
| parent | e9c55f4d18b0aac54e1a726ffca0c3c10d2c23ff (diff) | |
| download | Tango-019bc4dca9a0655e5adf1e26d8e3f513563113db.tar.gz Tango-019bc4dca9a0655e5adf1e26d8e3f513563113db.zip | |
Improved and optimized transport layer transporter and adapter.
Diffstat (limited to 'Software')
57 files changed, 475 insertions, 197 deletions
diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf Binary files differindex 4c31e0729..fb9191f16 100644 --- a/Software/DB/Tango.mdf +++ b/Software/DB/Tango.mdf diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf Binary files differindex 104f4ed58..a924d13e2 100644 --- a/Software/DB/Tango_log.ldf +++ b/Software/DB/Tango_log.ldf 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(); } + } + /// <summary> /// Initializes a new instance of the <see cref="LoadingViewVM"/> class. /// </summary> @@ -52,6 +60,7 @@ namespace Tango.MachineStudio.UI.ViewModels /// <param name="notificationProvider">The notification provider.</param> 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 @@ </StackPanel> <TextBlock HorizontalAlignment="Right" FontSize="18" Margin="0 0 -50 0" Foreground="{StaticResource AccentColorBrush}">Twine Solutions</TextBlock> <mahapps:ProgressRing Margin="20 60 20 40" Width="80" Height="80" IsActive="{Binding IsLoading}"></mahapps:ProgressRing> - <TextBlock HorizontalAlignment="Center" FontSize="18" FontStyle="Italic">Loading, please wait...</TextBlock> + <TextBlock HorizontalAlignment="Center" FontSize="18" FontStyle="Italic" Text="{Binding Status,TargetNullValue='Loading, please wait...'}"></TextBlock> </StackPanel> </Grid> 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 { @@ -14,6 +16,12 @@ namespace Tango.PPC.MachineSettings.ViewModels public class MainViewVM : PPCViewModel { /// <summary> + /// Gets or sets the external bridge service. + /// </summary> + [TangoInject] + public IPPCExternalBridgeService ExternalBridgeService { get; set; } + + /// <summary> /// Called when the application has been started /// </summary> public override void OnApplicationStarted() 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}"> - <Grid> - + + <Grid Background="{StaticResource TangoMidBackgroundBrush}"> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <Border Padding="20" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoDividerBrush}"> + <Border.Effect> + <DropShadowEffect Color="Silver" ShadowDepth="0" BlurRadius="20" Opacity="1" /> + </Border.Effect> + <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold">Settings</TextBlock> + </Border> + + <Grid Grid.Row="1"> + <StackPanel Margin="50"> + <controls:TableGrid RowHeight="40" MakeFirstColumnVerticalAlignmentBottom="False"> + <TextBlock VerticalAlignment="Center">Enable External Bridge Service</TextBlock> + <touch:TouchToggleSlider HorizontalAlignment="Right" Width="90" IsChecked="{Binding ExternalBridgeService.Enabled}"></touch:TouchToggleSlider> + </controls:TableGrid> + </StackPanel> + </Grid> </Grid> </UserControl> 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 @@ -21,6 +21,11 @@ namespace Tango.PPC.Common.Application event EventHandler ApplicationStarted; /// <summary> + /// Occurs when the all components are ready. + /// </summary> + event EventHandler Ready; + + /// <summary> /// Occurs when all PPC modules are ready and initialized. /// </summary> event EventHandler ModulesInitialized; 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<PPCSettings>().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 @@ -20,6 +20,11 @@ namespace Tango.PPC.Common public String MachineSerialNumber { get; set; } /// <summary> + /// Gets or sets a value indicating whether to enable external bridge service. + /// </summary> + public bool EnableExternalBridgeService { get; set; } + + /// <summary> /// Gets or sets the logging categories. /// </summary> public List<LogCategory> LoggingCategories { get; set; } 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 @@ </Compile> <Compile Include="ExtensionMethods\IListExtensions.cs" /> <Compile Include="ExtensionMethods\ObservableCollectionExtensions.cs" /> + <Compile Include="ExternalBridge\IPPCExternalBridgeService.cs" /> + <Compile Include="ExternalBridge\PPCExternalBridgeService.cs" /> <Compile Include="IPPCView.cs" /> <Compile Include="Modules\IPPCModuleLoader.cs" /> <Compile Include="Navigation\INavigationBlocker.cs" /> @@ -254,7 +256,7 @@ </Target> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ 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()); } /// <summary> @@ -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 @@ <Compile Include="PPCApplication\DefaultPPCApplicationManager.cs" /> <Compile Include="Threading\DefaultDispetcherProvider.cs" /> <Compile Include="ViewModelLocator.cs" /> + <Compile Include="ViewModels\ExternalBridgeViewVM.cs" /> <Compile Include="ViewModels\LayoutViewVM.cs" /> <Compile Include="ViewModels\LoadingViewVM.cs" /> <Compile Include="ViewModels\LoginViewVM.cs" /> <Compile Include="ViewModels\MainViewVM.cs" /> <Compile Include="ViewsContracts\ILayoutView.cs" /> + <Compile Include="Views\ExternalBridgeView.xaml.cs"> + <DependentUpon>ExternalBridgeView.xaml</DependentUpon> + </Compile> <Compile Include="Views\LayoutView.xaml.cs"> <DependentUpon>LayoutView.xaml</DependentUpon> </Compile> @@ -170,6 +174,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Views\ExternalBridgeView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Views\LayoutView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -274,6 +282,10 @@ <Project>{096f16c8-6d06-4b5f-9496-b9d2df2d94a3}</Project> <Name>Tango.PPC.Jobs</Name> </ProjectReference> + <ProjectReference Include="..\Modules\Tango.PPC.MachineSettings\Tango.PPC.MachineSettings.csproj"> + <Project>{91b70e9b-66a7-4873-ae10-400e71cf404f}</Project> + <Name>Tango.PPC.MachineSettings</Name> + </ProjectReference> <ProjectReference Include="..\Tango.PPC.Common\Tango.PPC.Common.csproj"> <Project>{0be74eee-22cb-4dba-b896-793b9e1a3ac0}</Project> <Name>Tango.PPC.Common</Name> @@ -392,7 +404,7 @@ copy /Y "$(SolutionDir)Referenced Assemblies\vcruntime140d.dll" "$(TargetDir)"</ </PropertyGroup> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ 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<IDiagnosticsFrameProvider>(); TangoIOC.Default.Unregister<IEventLogger>(); TangoIOC.Default.Unregister<ITeamFoundationServiceClient>(); + TangoIOC.Default.Unregister<IPPCExternalBridgeService>(); TangoIOC.Default.Register<IDispatcherProvider, DefaultDispetcherProvider>(new DefaultDispetcherProvider(Application.Current.Dispatcher)); TangoIOC.Default.Register<INotificationProvider, DefaultNotificationProvider>(); @@ -58,12 +60,14 @@ namespace Tango.PPC.UI TangoIOC.Default.Register<ExternalBridgeScanner, ExternalBridgeScanner>(); TangoIOC.Default.Register<IDiagnosticsFrameProvider, DefaultDiagnosticsFrameProvider>(); TangoIOC.Default.Register<IEventLogger, DefaultEventLogger>(); + TangoIOC.Default.Register<IPPCExternalBridgeService, PPCExternalBridgeService>(); //TangoIOC.Default.Register<TeamFoundationServiceExtendedClient>(new TeamFoundationServiceExtendedClient("https://twinetfs.visualstudio.com", String.Empty, "szzfokrceo4rhd4eqi5qpmxn3pa5iwl3q7tlqd36l2m7smz2ynoa")); TangoIOC.Default.Register<LoadingViewVM>(); TangoIOC.Default.Register<MainViewVM>(); TangoIOC.Default.Register<LoginViewVM>(); TangoIOC.Default.Register<LayoutViewVM>(); + TangoIOC.Default.Register<ExternalBridgeViewVM>(); TangoIOC.Default.GetInstance<IPPCApplicationManager>().ApplicationStarted += (_, __) => @@ -111,5 +115,13 @@ namespace Tango.PPC.UI return TangoIOC.Default.GetInstance<LayoutViewVM>(); } } + + public static ExternalBridgeViewVM ExternalBridgeViewVM + { + get + { + return TangoIOC.Default.GetInstance<ExternalBridgeViewVM>(); + } + } } }
\ 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 + { + /// <summary> + /// Gets or sets the external bridge service. + /// </summary> + [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 /// <seealso cref="Tango.PPC.Common.PPCViewModel" /> public class MainViewVM : PPCViewModel { - /// <summary> - /// Called when the application has been started. - /// </summary> + [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 @@ +<UserControl x:Class="Tango.PPC.UI.Views.ExternalBridgeView" + 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: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" + xmlns:local="clr-namespace:Tango.PPC.UI.Views" + 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}"> + <Grid> + <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center">This machine is currently being controlled</TextBlock> + </Grid> +</UserControl> 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 +{ + /// <summary> + /// Interaction logic for ExternalBridgeView.xaml + /// </summary> + 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, + /// <summary> + /// (Allows the loading of the PPC jobs module) + /// </summary> + [Description("Allows the loading of the PPC jobs module")] + RunPPCJobsModule = 12, + + /// <summary> + /// (Allows loading the PPC settings module) + /// </summary> + [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) /// </summary> [Description("Twine Research and development")] - MachineDeveloper = 3, + Researcher = 3, /// <summary> /// (Publish new Machine Studio Versions) @@ -73,5 +73,11 @@ namespace Tango.BL.Enumerations [Description("Color adjustment & calibration algorithms developer ")] ColorScientist = 8, + /// <summary> + /// (Standard PPC User) + /// </summary> + [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<ExternalBridgeUdpDiscoveryPacket> _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<ExternalBridgeUdpDiscoveryPacket>(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<ConnectResponse>(new ConnectResponse() + { + DeviceInformation = MachineOperator.DeviceInformation, + }, container.Token); + } + else if (container.Type == MessageType.ExternalClientLoginRequest) { var request = MessageFactory.ParseTangoMessageFromContainer<ExternalClientLoginRequest>(container); @@ -85,14 +168,18 @@ namespace Tango.Integration.ExternalBridge { response.Authenticated = true; response.SerialNumber = Machine.SerialNumber; + ClientConnected?.Invoke(this, new EventArgs()); } await SendResponse<ExternalClientLoginResponse>(response, container.Token); } + else if (container.Type == MessageType.DisconnectRequest) + { + await SendResponse<DisconnectResponse>(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 /// </summary> 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; - // } + OnDataAvailable(data); - // counter = 0; - //} + 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. /// </summary> String Address { get; set; } - - /// <summary> - /// Gets or sets the adapter reading/writing mode. - /// </summary> - 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 @@ <Compile Include="Servers\ClientConnectedEventArgs.cs" /> <Compile Include="Servers\TcpServer.cs" /> <Compile Include="TransportAdapterBase.cs" /> - <Compile Include="TransportAdapterMode.cs" /> <Compile Include="TransportComponentState.cs" /> <Compile Include="TransporterBase.cs" /> <Compile Include="Transporters\BasicTransporter.cs" /> @@ -128,7 +127,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ 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 } } - /// <summary> - /// Gets or sets the adapter reading/writing mode. - /// </summary> - 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 /// </returns> 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 -{ - /// <summary> - /// Represents an <see cref="ITransportAdapter"/> read/write mode. - /// </summary> - public enum TransportAdapterMode - { - /// <summary> - /// Pure protobuf message with no message size. - /// </summary> - NO_HEADER, - /// <summary> - /// Prepends and truncates the message size before writing and reading. - /// </summary> - 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<String, PendingResponse> _pendingResponses; + private AutoResetEvent _pull_wait_handle; + private AutoResetEvent _push_wait_handle; #region Events @@ -180,7 +182,7 @@ namespace Tango.Transport /// <param name="data">The data.</param> protected virtual void OnAdapterDataAvailable(object sender, byte[] data) { - _arrivedResponses.Enqueue(data); + EnqueueMessageIn(data); } /// <summary> @@ -221,6 +223,9 @@ namespace Tango.Transport /// </summary> public TransporterBase() { + _pull_wait_handle = new AutoResetEvent(false); + _push_wait_handle = new AutoResetEvent(false); + Encoder = new ProtoEncoder(); _pendingResponses = new Dictionary<string, PendingResponse>(); _sendingQueue = new ConcurrentQueue<TransportMessageBase>(); @@ -295,7 +300,7 @@ namespace Tango.Transport TaskCompletionSource<IMessage> source = new TaskCompletionSource<IMessage>(); TransportMessage<IMessage> message = new TransportMessage<IMessage>(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<MessageContainer> source = new TaskCompletionSource<MessageContainer>(); TransportMessage<MessageContainer> message = new TransportMessage<MessageContainer>(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<object> source = new TaskCompletionSource<object>(); TransportMessage<object> message = new TransportMessage<object>(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<TangoMessage<Response>> source = new TaskCompletionSource<TangoMessage<Response>>(); TransportMessage<TangoMessage<Response>> message = new TransportMessage<TangoMessage<Response>>(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<object> source = new TaskCompletionSource<object>(); TransportMessage<object> message = new TransportMessage<object>(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?); } + /// <summary> + /// Enqueues the message and releases the push wait handle. + /// </summary> + /// <param name="message">The message.</param> + private void EnqueueMessageOut(TransportMessageBase message) + { + _sendingQueue.Enqueue(message); + _push_wait_handle.Set(); + } + + /// <summary> + /// Enqueues the message and releases the pull wait handle. + /// </summary> + /// <param name="data">The data.</param> + 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 |
