diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-30 12:35:00 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-08-30 12:35:00 +0300 |
| commit | 7171e1a3b7579420f2060798c649088d70565401 (patch) | |
| tree | 5033e86d5ad91234194a1e0b2306a690d133cd11 /Software | |
| parent | c7c4975fd0010fc666c467105a39b1cd93cb818d (diff) | |
| download | Tango-7171e1a3b7579420f2060798c649088d70565401.tar.gz Tango-7171e1a3b7579420f2060798c649088d70565401.zip | |
Implemented In-Memory Transport Adapter.
Implemented Embedded In-Memory Emulator.
Diffstat (limited to 'Software')
33 files changed, 452 insertions, 68 deletions
diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf Binary files differindex ff50e2333..0774ec401 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 72cba010e..79cfb7a85 100644 --- a/Software/DB/Tango_log.ldf +++ b/Software/DB/Tango_log.ldf diff --git a/Software/Graphics/external-bridge-emulator.png b/Software/Graphics/external-bridge-emulator.png Binary files differnew file mode 100644 index 000000000..cb159d4a6 --- /dev/null +++ b/Software/Graphics/external-bridge-emulator.png diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk Binary files differindex afc922b97..35d97ffcc 100644 --- a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk +++ b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk 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 55dd370d1..0a9bba69e 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 @@ -461,7 +461,6 @@ namespace Tango.MachineStudio.Developer.ViewModels set { _segmentsCollectionView = value; - BindingOperations.EnableCollectionSynchronization(_segmentsCollectionView, _syncLock); RaisePropertyChangedAuto(); } } @@ -1230,7 +1229,8 @@ namespace Tango.MachineStudio.Developer.ViewModels if (status.Message != null) { - _eventLogger.Log(BL.Enumerations.EventTypes.JobStatus, status.Message); + // TODO: Write to db when shlomo is not sending test messages anymore. + _eventLogger.Log(BL.Enumerations.EventTypes.JobStatus, status.Message, false); } } }; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EventsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EventsViewVM.cs index 68094d91f..1f93a96dc 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EventsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Logging/ViewModels/EventsViewVM.cs @@ -145,7 +145,7 @@ namespace Tango.MachineStudio.Logging.ViewModels DateTime now = DateTime.UtcNow.AddMonths(-1); - _history_events = _db.MachinesEvents.Where(x => x.MachineGuid == SelectedMachine.Guid && x.DateTime > now).ToList(); + _history_events = _db.MachinesEvents.Where(x => x.MachineGuid == SelectedMachine.Guid && x.DateTime > now).Include(x => x.User).Include(x => x.User.Contact).Include(x => x.Machine).ToList(); Dates = new ObservableCollection<DateTime>(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs index a186d3039..9dd6c4b79 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs @@ -1571,13 +1571,13 @@ namespace Tango.MachineStudio.Technician.ViewModels public override void OnNavigatedTo() { base.OnNavigatedTo(); - _singleControllers.ToList().ForEach(x => x.Value.ChangeRenderMode(true)); + //_singleControllers.ToList().ForEach(x => x.Value.ChangeRenderMode(true)); } public override void OnNavigatedFrom() { base.OnNavigatedFrom(); - _singleControllers.ToList().ForEach(x => x.Value.ChangeRenderMode(false)); + //_singleControllers.ToList().ForEach(x => x.Value.ChangeRenderMode(false)); } public override void OnShuttingDown() @@ -1698,8 +1698,8 @@ namespace Tango.MachineStudio.Technician.ViewModels { using (ObservablesContext db = ObservablesContext.CreateDefault()) { - config = db.Adapter.GetConfiguration(x => x.Guid == ApplicationManager.ConnectedMachine.Machine.ConfigurationGuid).Clone(); - hw = db.Adapter.GetHardwareVersionByMachine(ApplicationManager.ConnectedMachine.Machine.Guid).Clone(); + config = db.Adapter.GetConfiguration(x => x.Guid == ApplicationManager.Machine.ConfigurationGuid).Clone(); + hw = db.Adapter.GetHardwareVersionByMachine(ApplicationManager.Machine.Guid).Clone(); } }); @@ -1795,7 +1795,7 @@ namespace Tango.MachineStudio.Technician.ViewModels await Task.Factory.StartNew(() => { - hw = adapter.GetHardwareVersionByMachine(ApplicationManager.ConnectedMachine.Machine.Guid); + hw = adapter.GetHardwareVersionByMachine(ApplicationManager.Machine.Guid); }); foreach (var motorConfig in hw.HardwareMotors) diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs index cb4611cad..3663eb093 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/EventLogging/DefaultEventLogger.cs @@ -220,7 +220,7 @@ namespace Tango.MachineStudio.Common.EventLogging } LogManager.Log("Logging event " + machineEvent.EventType.Name + " - " + machineEvent.Description); - machineEvent.MachineGuid = _application.ConnectedMachine.Machine.Guid; + machineEvent.MachineGuid = _application.Machine.Guid; machineEvent.UserGuid = _authentication.CurrentUser.Guid; machineEvent.User = _authentication.CurrentUser; _events.Enqueue(machineEvent); diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs index 706f82774..f54611d9c 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs @@ -46,13 +46,27 @@ namespace Tango.MachineStudio.Common /// </summary> public Rect LastBounds { get; set; } + /// <summary> + /// Gets or sets the default issue report assign to. + /// </summary> public String DefaultIssueReportAssignTo { get; set; } + /// <summary> + /// Gets or sets the default issue report area. + /// </summary> public String DefaultIssueReportArea { get; set; } + /// <summary> + /// Gets or sets the default issue report tags. + /// </summary> public List<String> DefaultIssueReportTags { get; set; } /// <summary> + /// Gets or sets a value indicating whether add external bridge client emulator when scanning for connected machines. + /// </summary> + public bool UseExternalBridgeEmulator { get; set; } + + /// <summary> /// Initializes a new instance of the <see cref="MachineStudio"/> class. /// </summary> public MachineStudioSettings() diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs index 96de3eea0..1a0499f2c 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/StudioApplication/IStudioApplicationManager.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; +using Tango.BL.Entities; using Tango.Integration.ExternalBridge; namespace Tango.MachineStudio.Common.StudioApplication @@ -32,7 +33,12 @@ namespace Tango.MachineStudio.Common.StudioApplication /// <summary> /// Gets or sets the currently connected machine if any. /// </summary> - IExternalBridgeClient ConnectedMachine { get; set; } + IExternalBridgeClient ConnectedMachine { get; } + + /// <summary> + /// Gets or sets the machine. + /// </summary> + Machine Machine { get; } /// <summary> /// Gets a value indicating whether the <see cref="ConnectedMachine"/> is valid. @@ -75,5 +81,11 @@ namespace Tango.MachineStudio.Common.StudioApplication /// Raises the application ready event. /// </summary> void NotifyApplicationReady(); + + /// <summary> + /// Sets the connected machine. + /// </summary> + /// <param name="connectedMachine">The connected machine.</param> + void SetConnectedMachine(IExternalBridgeClient connectedMachine); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/external-bridge-emulator.png b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/external-bridge-emulator.png Binary files differnew file mode 100644 index 000000000..cb159d4a6 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Images/external-bridge-emulator.png diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs index 224cd3199..1865bfb2f 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ using System.Runtime.InteropServices; [assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyTitle("Tango - Machine Studio")] -[assembly: AssemblyVersion("3.3.39.18238")] +[assembly: AssemblyVersion("3.3.40.18238")] [assembly: ComVisible(false)]
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs index 17bf57f56..29bb459ee 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs @@ -19,6 +19,8 @@ using Tango.Integration.ExternalBridge; using Tango.MachineStudio.Common.EventLogging; using Tango.BL.Enumerations; using Tango.Core.DI; +using Tango.BL.Entities; +using Tango.BL; namespace Tango.MachineStudio.UI.StudioApplication { @@ -55,22 +57,23 @@ namespace Tango.MachineStudio.UI.StudioApplication public bool IsShuttingDown { get; private set; } /// <summary> - /// The connected machine + /// Occurs when the connected machine property has changed. /// </summary> - private IExternalBridgeClient _connectedMachine; + public event EventHandler<IExternalBridgeClient> ConnectedMachineChanged; /// <summary> - /// Occurs when the connected machine property has changed. + /// Gets or sets the machine. /// </summary> - public event EventHandler<IExternalBridgeClient> ConnectedMachineChanged; + public Machine Machine { get; private set; } + private IExternalBridgeClient _connectedMachine; /// <summary> /// Gets or sets the currently connected machine if any. /// </summary> public IExternalBridgeClient ConnectedMachine { get { return _connectedMachine; } - set + private set { _connectedMachine = value; RaisePropertyChangedAuto(); @@ -270,9 +273,31 @@ namespace Tango.MachineStudio.UI.StudioApplication } } + /// <summary> + /// Raises the application ready event. + /// </summary> public void NotifyApplicationReady() { TangoIOC.Default.GetAllInstancesByBase<IStudioViewModel>().ToList().ForEach(x => x.OnApplicationReady()); } + + /// <summary> + /// Sets the connected machine. + /// </summary> + /// <param name="connectedMachine">The connected machine.</param> + public void SetConnectedMachine(IExternalBridgeClient connectedMachine) + { + if (connectedMachine != null) + { + Machine = ObservablesStaticCollections.Instance.Machines.SingleOrDefault(x => x.SerialNumber == connectedMachine.SerialNumber); + ConnectedMachine = connectedMachine; + ConnectedMachine.SetMachine(Machine); + } + else + { + Machine = null; + ConnectedMachine = null; + } + } } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs index 6225e1480..8f67a21c2 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs @@ -196,7 +196,7 @@ namespace Tango.MachineStudio.UI.TFS if (app.ConnectedMachine != null) { - Machine machine = app.ConnectedMachine.Machine; + Machine machine = app.Machine; sysModel.Machine = machine; sysModel.EmbeddedVersion = app.ConnectedMachine.DeviceInformation.Version; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj index ed3d0e5fc..3cab71602 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Tango.MachineStudio.UI.csproj @@ -369,6 +369,10 @@ <Project>{38197109-8610-4d3f-92b9-16d48df94d7c}</Project> <Name>Tango.DAL.Remote</Name> </ProjectReference> + <ProjectReference Include="..\..\Tango.Emulations\Tango.Emulations.csproj"> + <Project>{63561e19-ff5a-414b-a5ef-e30711543e1d}</Project> + <Name>Tango.Emulations</Name> + </ProjectReference> <ProjectReference Include="..\..\Tango.Integration\Tango.Integration.csproj"> <Project>{4206ac58-3b57-4699-8835-90bf6db01a61}</Project> <Name>Tango.Integration</Name> @@ -481,6 +485,7 @@ <Resource Include="Images\settings.png" /> </ItemGroup> <ItemGroup> + <Resource Include="Images\external-bridge-emulator.png" /> <EmbeddedResource Include="..\..\Versioning\ChangeLog.txt"> <Link>ChangeLog.txt</Link> </EmbeddedResource> @@ -571,7 +576,7 @@ copy /Y "$(SolutionDir)Referenced Assemblies\Microsoft.WITDataStore32.dll" "$(Ta </Target> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_BuildVersioningStyle="None.None.Increment.DeltaBaseYearDayOfYear" BuildVersion_UpdateFileVersion="True" BuildVersion_DetectChanges="True" BuildVersion_UseGlobalSettings="False" /> + <UserProperties BuildVersion_UseGlobalSettings="False" BuildVersion_DetectChanges="True" BuildVersion_UpdateFileVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.DeltaBaseYearDayOfYear" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs index 60447f37a..51b7168ed 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs @@ -4,8 +4,11 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.Core.Commands; +using Tango.Emulations.ExternalBridge; using Tango.Integration.ExternalBridge; +using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Notifications; +using Tango.Settings; using Tango.SharedUI; namespace Tango.MachineStudio.UI.ViewModels @@ -16,6 +19,8 @@ namespace Tango.MachineStudio.UI.ViewModels /// <seealso cref="Tango.MachineStudio.Common.Notifications.DialogViewVM" /> public class MachineConnectionViewVM : DialogViewVM { + private EmulatorExternalBridge _emulator; + private ExternalBridgeScanner _scanner; /// <summary> /// Gets or sets the machine scanner. @@ -63,6 +68,9 @@ namespace Tango.MachineStudio.UI.ViewModels } } + /// <summary> + /// Invokes the <see cref="E:Tango.SharedUI.DialogViewVM.Canceled" /> event. + /// </summary> protected override void Cancel() { Scanner.Stop(); @@ -76,6 +84,17 @@ namespace Tango.MachineStudio.UI.ViewModels { base.OnShow(); Scanner.AvailableMachines.Clear(); + + if (SettingsManager.Default.GetOrCreate<MachineStudioSettings>().UseExternalBridgeEmulator) + { + if (_emulator != null) + { + _emulator.Disconnect(); + } + _emulator = new EmulatorExternalBridge(); + } + + Scanner.AvailableMachines.Add(_emulator); Scanner.Start(); } } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs index ee4435832..31b2181ea 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs @@ -388,7 +388,7 @@ namespace Tango.MachineStudio.UI.ViewModels InvalidateRelayCommands(); String serial = ApplicationManager.ConnectedMachine.SerialNumber; await ApplicationManager.ConnectedMachine.Disconnect(); - ApplicationManager.ConnectedMachine = null; + ApplicationManager.SetConnectedMachine(null); _eventLogger.Log("Disconnected from machine " + serial); PostMessage(new MachineConnectionChangedMessage() { Machine = null }); @@ -459,13 +459,13 @@ namespace Tango.MachineStudio.UI.ViewModels Intent = PMR.Integration.ExternalBridgeLoginIntent.Override, }); - ApplicationManager.ConnectedMachine = x.SelectedMachine; + ApplicationManager.SetConnectedMachine(x.SelectedMachine); (x.SelectedMachine as IExternalBridgeSecureClient).SessionClosed += (_, __) => { InvokeUI(() => { _notificationProvider.ShowError("The remote machine has closed the current session. Machine disconnected."); - ApplicationManager.ConnectedMachine = null; + ApplicationManager.SetConnectedMachine(null); }); }; PostMessage(new MachineConnectionChangedMessage() { Machine = x.SelectedMachine }); @@ -506,7 +506,7 @@ namespace Tango.MachineStudio.UI.ViewModels await x.SelectedMachine.Connect(); x.SelectedMachine.SerialNumber = vm.SelectedMachine.SerialNumber; - ApplicationManager.ConnectedMachine = x.SelectedMachine; + ApplicationManager.SetConnectedMachine(x.SelectedMachine); PostMessage(new MachineConnectionChangedMessage() { Machine = x.SelectedMachine }); _eventLogger.Log(String.Format("Successfully connected to machine {0} via USB", x.SelectedMachine.SerialNumber)); @@ -556,8 +556,8 @@ namespace Tango.MachineStudio.UI.ViewModels { using (ObservablesContext db = ObservablesContext.CreateDefault()) { - var config = db.Adapter.GetConfiguration(s => s.Guid == ApplicationManager.ConnectedMachine.Machine.ConfigurationGuid); - var hw = db.Adapter.GetHardwareVersionByMachine(ApplicationManager.ConnectedMachine.Machine.Guid); + var config = db.Adapter.GetConfiguration(s => s.Guid == ApplicationManager.Machine.ConfigurationGuid); + var hw = db.Adapter.GetHardwareVersionByMachine(ApplicationManager.Machine.Guid); await ApplicationManager.ConnectedMachine.UploadHardwareConfiguration(hw, config); } diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml index 319fa3596..26790c67d 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ConnectedMachineView.xaml @@ -6,6 +6,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:integration="clr-namespace:Tango.Integration.ExternalBridge;assembly=Tango.Integration" xmlns:integ="clr-namespace:Tango.Integration.Operation;assembly=Tango.Integration" + xmlns:emulations="clr-namespace:Tango.Emulations.ExternalBridge;assembly=Tango.Emulations" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" @@ -38,6 +39,10 @@ <DataTemplate DataType="{x:Type integration:ExternalBridgeUsbClient}"> <Image Source="/Images/external-bridge-usb.png" Width="48" Height="48" RenderOptions.BitmapScalingMode="Fant"></Image> </DataTemplate> + + <DataTemplate DataType="{x:Type emulations:EmulatorExternalBridge}"> + <Image Source="/Images/external-bridge-emulator.png" Width="48" Height="48" RenderOptions.BitmapScalingMode="Fant"></Image> + </DataTemplate> </ContentControl.Resources> </ContentControl> @@ -131,6 +136,39 @@ <ToggleButton IsChecked="{Binding EnableEventsNotification}" HorizontalAlignment="Left"></ToggleButton> </controls:TableGrid> </DataTemplate> + + <DataTemplate DataType="{x:Type emulations:EmulatorExternalBridge}"> + <controls:TableGrid RowHeight="22"> + <TextBlock FontWeight="SemiBold" Text="Address:" /> + <TextBlock Text="{Binding Adapter.Address}" /> + <TextBlock FontWeight="SemiBold" Text="Serial Number:" /> + <TextBlock Text="{Binding SerialNumber}" /> + <TextBlock FontWeight="SemiBold" Text="Name:" /> + <TextBlock Text="{Binding Machine.Name}" /> + <TextBlock FontWeight="SemiBold" Text="Organization:" /> + <TextBlock Text="{Binding Machine.Organization.Name}" /> + <TextBlock FontWeight="SemiBold" Text="Total Bytes Sent:" /> + <TextBlock Text="{Binding Adapter.TotalBytesSent,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}" /> + <TextBlock FontWeight="SemiBold" Text="Total Bytes Received:" /> + <TextBlock Text="{Binding Adapter.TotalBytesReceived,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}" /> + <TextBlock FontWeight="SemiBold" Text="Transfer Rate:" /> + <TextBlock> + <Run Text="{Binding Adapter.TransferRate,Converter={StaticResource ByteArrayToFileSizeConverter},Mode=OneWay}"></Run> + <Run Text="/ sec"></Run> + </TextBlock> + <TextBlock FontWeight="SemiBold" Text="Diagnostics Frame Rate:" /> + <TextBlock> + <Run Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.DiagnosticsFrameProvider.FrameRate,Mode=OneWay,IsAsync=True}"></Run> + <Run Text="/ sec"></Run> + </TextBlock> + <TextBlock FontWeight="SemiBold" Text="Enable Diagnostics:" /> + <ToggleButton IsChecked="{Binding EnableDiagnostics}" HorizontalAlignment="Left"></ToggleButton> + <TextBlock FontWeight="SemiBold" Text="Enable Embedded Debug Logs:" /> + <ToggleButton IsChecked="{Binding EnableEmbeddedDebugging}" HorizontalAlignment="Left"></ToggleButton> + <TextBlock FontWeight="SemiBold" Text="Enable Events:" /> + <ToggleButton IsChecked="{Binding EnableEventsNotification}" HorizontalAlignment="Left"></ToggleButton> + </controls:TableGrid> + </DataTemplate> </ContentControl.Resources> </ContentControl> </Grid> 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 5f8cca8fe..180a2a8e0 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineConnectionView.xaml @@ -7,6 +7,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:integration="clr-namespace:Tango.Integration.ExternalBridge;assembly=Tango.Integration" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" + xmlns:emulations="clr-namespace:Tango.Emulations.ExternalBridge;assembly=Tango.Emulations" xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300" Width="600" Height="400" Background="White" DataContext="{Binding MachineConnectionViewVM, Source={StaticResource Locator}}"> @@ -95,6 +96,25 @@ </StackPanel> </DockPanel> </DataTemplate> + <DataTemplate DataType="{x:Type emulations:EmulatorExternalBridge}"> + <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-emulator.png" Width="38" Height="38" RenderOptions.BitmapScalingMode="Fant"></Image> + <StackPanel Margin="10 0 0 0"> + <TextBlock FontSize="11"> + <Run Text="External Bridge Emulator"></Run> + </TextBlock> + <TextBlock FontSize="11"> + <Run FontWeight="Bold">Address:</Run> <Run Text="{Binding Adapter.Address,Mode=OneWay}"></Run> + </TextBlock> + </StackPanel> + </StackPanel> + </DockPanel> + </DataTemplate> </ListBox.Resources> </ListBox> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml index 9a494f862..67bdf81ed 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MainView.xaml @@ -15,7 +15,7 @@ xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views" xmlns:commonConverters="clr-namespace:Tango.MachineStudio.Common.Converters;assembly=Tango.MachineStudio.Common" mc:Ignorable="d" - d:DesignHeight="720" d:DesignWidth="1270" Background="Transparent" DataContext="{Binding MainViewVM, Source={StaticResource Locator}}"> + d:DesignHeight="720" d:DesignWidth="1270" Background="Transparent" DataContext="{Binding MainViewVM, Source={StaticResource Locator}}" x:Name="control"> <UserControl.Resources> <converters:StringEllipsisConverter x:Key="StringEllipsisConverter" /> @@ -161,7 +161,7 @@ </StackPanel> </Button> <Separator/> - <Button IsEnabled="{Binding IsModuleLoaded}" Command="{Binding OpenModuleInWindowCommand}" CommandParameter="{Binding CurrentModule}"> + <Button IsEnabled="{Binding IsModuleLoaded}" Command="{Binding OpenModuleInWindowCommand,Mode=TwoWay}" CommandParameter="{Binding CurrentModule}"> <StackPanel Orientation="Horizontal"> <materialDesign:PackIcon Kind="ArrowTopRight" Width="24" Height="24" /> <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">Open Module In New Window</TextBlock> @@ -440,7 +440,7 @@ <StackPanel Grid.Row="2" Margin="8" HorizontalAlignment="Right" Orientation="Horizontal"> <materialDesign:PopupBox Padding="2,0,2,0" Style="{StaticResource MaterialDesignToolPopupBox}"> <StackPanel> - <Button Command="{Binding RelativeSource={RelativeSource AncestorType=local:MainView},Path=DataContext.OpenModuleInWindowCommand}" CommandParameter="{Binding}"> + <Button Command="{Binding Source={x:Reference control},Path=DataContext.OpenModuleInWindowCommand}" CommandParameter="{Binding}"> <StackPanel Orientation="Horizontal"> <materialDesign:PackIcon Kind="ArrowTopRight" Width="24" Height="24" /> <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">Start in new window</TextBlock> diff --git a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs index 8d6e5ff51..8be454c63 100644 --- a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs +++ b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/BrushStop.cs @@ -290,6 +290,11 @@ namespace Tango.BL.Entities liquidVolume.VolumeChanged += LiquidVolume_VolumeChanged; LiquidVolumes.Add(liquidVolume); } + + foreach (var volume in LiquidVolumes.ToList()) + { + volume.Invalidate(); + } } private void LiquidVolume_VolumeChanged() diff --git a/Software/Visual_Studio/Tango.Core/SynchronizedObservableCollection.cs b/Software/Visual_Studio/Tango.Core/SynchronizedObservableCollection.cs index b12c48ded..317d0e249 100644 --- a/Software/Visual_Studio/Tango.Core/SynchronizedObservableCollection.cs +++ b/Software/Visual_Studio/Tango.Core/SynchronizedObservableCollection.cs @@ -13,28 +13,31 @@ namespace Tango.Core { public class SynchronizedObservableCollection<T> : ObservableCollection<T> { - private static object _sync_lock = new object(); - private static object _modify_lock = new object(); + private object _sync_lock = new object(); + private object _modify_lock = new object(); + private SynchronizedObservableCollectionDispatcher _dispatcher; public SynchronizedObservableCollection() : base() { - BindingOperations.EnableCollectionSynchronization(this, _sync_lock); + _dispatcher = new SynchronizedObservableCollectionDispatcher(); + BindingOperations.EnableCollectionSynchronization(this, _modify_lock); } public SynchronizedObservableCollection(IEnumerable<T> collection) : base(collection) { - BindingOperations.EnableCollectionSynchronization(this, _sync_lock); + _dispatcher = new SynchronizedObservableCollectionDispatcher(); + BindingOperations.EnableCollectionSynchronization(this, _modify_lock); } protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e) { - SynchronizedObservableCollectionDispatcher.Invoke(() => + lock (_modify_lock) { - lock (_modify_lock) + _dispatcher.Invoke(() => { base.OnCollectionChanged(e); - } - }); + }); + } } protected override void InsertItem(int index, T item) @@ -62,11 +65,11 @@ namespace Tango.Core } } - internal static class SynchronizedObservableCollectionDispatcher + internal class SynchronizedObservableCollectionDispatcher { - internal static Dispatcher Dispatcher { get; set; } + internal Dispatcher Dispatcher { get; set; } - static SynchronizedObservableCollectionDispatcher() + internal SynchronizedObservableCollectionDispatcher() { if (Application.Current != null) { @@ -74,11 +77,11 @@ namespace Tango.Core } } - internal static void Invoke(Action action) + internal void Invoke(Action action) { if (Dispatcher != null) { - Dispatcher.BeginInvoke(action); + Dispatcher.Invoke(action); } else { diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index bf4061b0a..7b9a1e7a6 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -116,7 +116,7 @@ namespace Tango.Emulations.Emulators _digitalOutputPinsStates = new List<DigitalPin>(); _componentsStates = new List<ValueComponentState>(); - var adapter = ObservablesEntitiesAdapter.Instance; + ObservablesStaticCollections adapter = ObservablesStaticCollections.Instance; adapter.Initialize(); _digitalOutputPinsStates = adapter.TechIos.Where(x => x.Type == IOType.DigitalOutput.ToInt32()).Select(x => new DigitalPin() diff --git a/Software/Visual_Studio/Tango.Emulations/ExternalBridge/EmulatorExternalBridge.cs b/Software/Visual_Studio/Tango.Emulations/ExternalBridge/EmulatorExternalBridge.cs new file mode 100644 index 000000000..764e0d719 --- /dev/null +++ b/Software/Visual_Studio/Tango.Emulations/ExternalBridge/EmulatorExternalBridge.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Entities; +using Tango.Emulations.Emulators; +using Tango.Integration.ExternalBridge; +using Tango.Integration.Operation; +using Tango.Transport.Adapters; +using Tango.Transport.Transporters; + +namespace Tango.Emulations.ExternalBridge +{ + /// <summary> + /// Represents an in-memory external bridge client emulator. + /// </summary> + /// <seealso cref="Tango.Integration.Operation.MachineOperator" /> + /// <seealso cref="Tango.Integration.ExternalBridge.IExternalBridgeClient" /> + public class EmulatorExternalBridge : MachineOperator, IExternalBridgeClient + { + /// <summary> + /// Gets a value indicating whether this client requires authentication. + /// </summary> + public bool RequiresAuthentication { get; } + + /// <summary> + /// Gets or sets the machine serial number. + /// </summary> + public string SerialNumber { get; set; } + + /// <summary> + /// Gets the emulator. + /// </summary> + public MachineEmulator Emulator { get; private set; } + + /// <summary> + /// Initializes a new instance of the <see cref="EmulatorExternalBridge"/> class. + /// </summary> + public EmulatorExternalBridge() + { + EnableDiagnostics = true; + EnableEmbeddedDebugging = true; + EnableEventsNotification = true; + + String address = new string(Guid.NewGuid().ToString().Replace("-", "").TakeLast(4).ToArray()); + + Adapter = new MemoryTransportAdapter(address); + Emulator = new MachineEmulator(new BasicTransporter(new MemoryTransportAdapter(address))); + } + + /// <summary> + /// Connects the transport component. + /// </summary> + /// <returns></returns> + public override Task Connect() + { + return Task.WhenAll( + Emulator.Start(), + base.Connect()); + } + + /// <summary> + /// Disconnects the machine operator and the underlying transporter. + /// </summary> + /// <returns></returns> + public override Task Disconnect() + { + return Task.WhenAll( + base.Disconnect(), + Emulator.Stop()); + } + + /// <summary> + /// Gets the database machine associated with this client. + /// </summary> + public Machine Machine { get; private set; } + + /// <summary> + /// Sets the database machine. + /// </summary> + /// <param name="machine">The machine.</param> + public void SetMachine(Machine machine) + { + Machine = machine; + } + } +} diff --git a/Software/Visual_Studio/Tango.Emulations/Tango.Emulations.csproj b/Software/Visual_Studio/Tango.Emulations/Tango.Emulations.csproj index 05be1077a..d4f3b929e 100644 --- a/Software/Visual_Studio/Tango.Emulations/Tango.Emulations.csproj +++ b/Software/Visual_Studio/Tango.Emulations/Tango.Emulations.csproj @@ -53,6 +53,7 @@ <Compile Include="Emulators\MachineEmulator.cs" /> <Compile Include="Emulators\MachineEventState.cs" /> <Compile Include="Emulators\MobileEmulator.cs" /> + <Compile Include="ExternalBridge\EmulatorExternalBridge.cs" /> <Compile Include="IEmulator.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> @@ -89,7 +90,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs index c2ab97c2f..6a2c097fd 100644 --- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeTcpClient.cs @@ -37,8 +37,6 @@ namespace Tango.Integration.ExternalBridge { _serialNumber = value; RaisePropertyChangedAuto(); - - Machine = ObservablesStaticCollections.Instance.Machines.SingleOrDefault(x => x.SerialNumber == _serialNumber); } } @@ -196,5 +194,19 @@ namespace Tango.Integration.ExternalBridge /// Occurs when the remote host has closed the session. /// </summary> public event EventHandler SessionClosed; + + /// <summary> + /// Gets the database machine associated with this client. + /// </summary> + public Machine Machine { get; private set; } + + /// <summary> + /// Sets the database machine. + /// </summary> + /// <param name="machine">The machine.</param> + public void SetMachine(Machine machine) + { + Machine = machine; + } } } diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeUsbClient.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeUsbClient.cs index f610de206..0496c270e 100644 --- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeUsbClient.cs +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeUsbClient.cs @@ -34,9 +34,6 @@ namespace Tango.Integration.ExternalBridge { _serialNumber = value; RaisePropertyChangedAuto(); - - Machine = ObservablesStaticCollections.Instance.Machines.SingleOrDefault(x => x.SerialNumber == _serialNumber); - RaisePropertyChanged(nameof(Machine)); } } @@ -110,5 +107,19 @@ namespace Tango.Integration.ExternalBridge { return Device; } + + /// <summary> + /// Gets the database machine associated with this client. + /// </summary> + public Machine Machine { get; private set; } + + /// <summary> + /// Sets the database machine. + /// </summary> + /// <param name="machine">The machine.</param> + public void SetMachine(Machine machine) + { + Machine = machine; + } } } diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeClient.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeClient.cs index b1d084cfa..d336b6b70 100644 --- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeClient.cs +++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/IExternalBridgeClient.cs @@ -26,5 +26,16 @@ namespace Tango.Integration.ExternalBridge /// Gets or sets the machine serial number. /// </summary> String SerialNumber { get; set; } + + /// <summary> + /// Gets the database machine associated with this client. + /// </summary> + Machine Machine { get; } + + /// <summary> + /// Sets the database machine. + /// </summary> + /// <param name="machine">The machine.</param> + void SetMachine(Machine machine); } } diff --git a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs index ce48ffa31..11b57fcc8 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs @@ -25,11 +25,6 @@ namespace Tango.Integration.Operation public interface IMachineOperator : ITransporter { /// <summary> - /// Gets the machine database entity. - /// </summary> - Machine Machine { get; } - - /// <summary> /// Gets or sets the job handling mode. /// </summary> JobHandlerModes JobHandlingMode { get; set; } diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index 5e942fe36..332a2696c 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -317,20 +317,6 @@ namespace Tango.Integration.Operation set { _deviceInformation = value; RaisePropertyChangedAuto(); } } - private Machine _machine; - /// <summary> - /// Gets the machine database entity. - /// </summary> - public Machine Machine - { - get { return _machine; } - protected set - { - _machine = value; - RaisePropertyChangedAuto(); - } - } - #endregion #region Virtual Methods diff --git a/Software/Visual_Studio/Tango.Transport/Adapters/MemoryTransportAdapter.cs b/Software/Visual_Studio/Tango.Transport/Adapters/MemoryTransportAdapter.cs new file mode 100644 index 000000000..09b98527a --- /dev/null +++ b/Software/Visual_Studio/Tango.Transport/Adapters/MemoryTransportAdapter.cs @@ -0,0 +1,138 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Transport.Adapters +{ + /// <summary> + /// Represents an in-memory transport adapter. + /// </summary> + /// <seealso cref="Tango.Transport.TransportAdapterBase" /> + public class MemoryTransportAdapter : TransportAdapterBase + { + #region Memory Transport Manager + + internal static class MemoryTransportManager + { + private static List<MemoryTransportAdapter> _adapters; + + static MemoryTransportManager() + { + _adapters = new List<MemoryTransportAdapter>(); + } + + internal static void Connect(MemoryTransportAdapter adapter) + { + if (adapter == null) + { + throw new NullReferenceException("Cannot connect null adapter."); + } + + if (String.IsNullOrWhiteSpace(adapter.Address)) + { + throw new InvalidOperationException("Cannot register a memory adapter with null address."); + } + + if (_adapters.Where(x => x.Address == adapter.Address).Count() > 1) + { + throw new InvalidOperationException("Cannot register more than two memory adapters with the same address."); + } + + if (_adapters.Contains(adapter)) + { + throw new InvalidOperationException("The specified memory adapter is already registered."); + } + + _adapters.Add(adapter); + } + + internal static void Disconnect(MemoryTransportAdapter adapter) + { + if (adapter == null) + { + throw new NullReferenceException("Cannot disconnect null adapter."); + } + + _adapters.Remove(adapter); + } + + internal static void Write(MemoryTransportAdapter adapter, byte[] data) + { + Task.Factory.StartNew(() => + { + var other_adapter = _adapters.ToList().SingleOrDefault(x => x.Address == adapter.Address && x != adapter); + + if (other_adapter != null) + { + other_adapter.EmulateDataAvailable(data); + } + }); + } + } + + #endregion + + /// <summary> + /// Initializes a new instance of the <see cref="MemoryTransportAdapter"/> class. + /// </summary> + /// <param name="address">The address.</param> + public MemoryTransportAdapter(String address) + { + Address = address; + } + + /// <summary> + /// Emulates in coming data. + /// </summary> + /// <param name="data">The data.</param> + internal void EmulateDataAvailable(byte[] data) + { + OnDataAvailable(data); + } + + /// <summary> + /// Writes the specified data to the stream. + /// </summary> + /// <param name="data">The data.</param> + public override void Write(byte[] data) + { + ThrowIfDisposed(); + + try + { + TotalBytesSent += data.Length; + _totalBytes += data.Length; + MemoryTransportManager.Write(this, data); + } + catch (Exception ex) + { + OnFailed(LogManager.Log(ex)); + } + } + + /// <summary> + /// Connects the transport component. + /// </summary> + /// <returns></returns> + public override Task Connect() + { + MemoryTransportManager.Connect(this); + State = TransportComponentState.Connected; + return Task.FromResult(new object()); + } + + /// <summary> + /// Disconnects the transport component. + /// </summary> + /// <returns></returns> + public override Task Disconnect() + { + MemoryTransportManager.Disconnect(this); + State = TransportComponentState.Disconnected; + return Task.FromResult(new object()); + } + } +} diff --git a/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj b/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj index c0d37b76c..837fd6549 100644 --- a/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj +++ b/Software/Visual_Studio/Tango.Transport/Tango.Transport.csproj @@ -66,6 +66,7 @@ <Compile Include="..\Versioning\GlobalVersionInfo.cs"> <Link>GlobalVersionInfo.cs</Link> </Compile> + <Compile Include="Adapters\MemoryTransportAdapter.cs" /> <Compile Include="Adapters\UsbSerialBaudRates.cs" /> <Compile Include="Adapters\UsbTransportAdapter.cs" /> <Compile Include="Components\ComPortEnumerator.cs" /> @@ -129,7 +130,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </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 8a5ebda55..bcaf3aee8 100644 --- a/Software/Visual_Studio/Tango.Transport/TransportAdapterBase.cs +++ b/Software/Visual_Studio/Tango.Transport/TransportAdapterBase.cs @@ -16,7 +16,7 @@ namespace Tango.Transport /// <seealso cref="Tango.Transport.ITransportAdapter" /> public abstract class TransportAdapterBase : ExtendedObject, ITransportAdapter { - private long _totalBytes; + protected long _totalBytes; private long _transferRateTotalBytes; private Timer _transferRateTimer; |
