aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-02-14 18:50:59 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-02-14 18:50:59 +0200
commit73196dd48da9d16b6949ab9dec0ae0a5d63accfe (patch)
tree04bbaade70fb016423d7cd43161f4cbc8bc04b79
parentb6283ab40fafa8e738e8e3fec260777a4d250597 (diff)
downloadTango-73196dd48da9d16b6949ab9dec0ae0a5d63accfe.tar.gz
Tango-73196dd48da9d16b6949ab9dec0ae0a5d63accfe.zip
Working on DFU firmware upgrade...
-rw-r--r--Software/DB/Tango.mdfbin75497472 -> 75497472 bytes
-rw-r--r--Software/DB/Tango_log.ldfbin22675456 -> 22675456 bytes
-rw-r--r--Software/Graphics/Mobile/cat.icobin0 -> 107094 bytes
-rw-r--r--Software/Graphics/Mobile/cat.pngbin0 -> 5429 bytes
-rw-r--r--Software/Graphics/Mobile/close.pngbin0 -> 651 bytes
-rw-r--r--Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/FirmwareUpgradeManager.cs329
-rw-r--r--Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/FirmwareUpgradeManagerState.cs35
-rw-r--r--Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/FirmwareUpgradeProgressEventArgs.cs15
-rw-r--r--Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/ProgressAnimator.cs93
-rw-r--r--Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/ProgressDispatcher.cs80
-rw-r--r--Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/Properties/AssemblyInfo.cs22
-rw-r--r--Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/Properties/Resources.Designer.cs62
-rw-r--r--Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/Properties/Resources.resx117
-rw-r--r--Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/Properties/Settings.Designer.cs30
-rw-r--r--Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/Properties/Settings.settings7
-rw-r--r--Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/Tango.FirmwareUpdateLib.WPF.csproj93
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/FirmwareUpgradeViewVM.cs13
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/FirmwareUpgradeView.xaml11
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj4
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/WatchDog/WatchDogClient.cs12
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/WatchDog/WatchDogServer.cs55
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.WatchDog/App.config6
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.WatchDog/App.xaml9
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.WatchDog/App.xaml.cs17
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.WatchDog/MainWindow.xaml35
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.WatchDog/MainWindow.xaml.cs29
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.WatchDog/MainWindowVM.cs14
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.WatchDog/Properties/AssemblyInfo.cs11
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.WatchDog/Properties/Resources.Designer.cs71
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.WatchDog/Properties/Resources.resx117
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.WatchDog/Properties/Settings.Designer.cs30
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.WatchDog/Properties/Settings.settings7
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.WatchDog/Tango.PPC.WatchDog.csproj118
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.WatchDog/cat.pngbin0 -> 5429 bytes
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.WatchDog/close.pngbin0 -> 651 bytes
-rw-r--r--Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeUsbClient.cs7
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs5
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs94
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/MachineStatuses.cs2
-rw-r--r--Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj7
-rw-r--r--Software/Visual_Studio/Tango.Integration/Upgrade/FirmwareUpgradeModes.cs18
-rw-r--r--Software/Visual_Studio/Tango.Integration/Upgrade/FirmwareUpgradeStatus.cs2
-rw-r--r--Software/Visual_Studio/Tango.sln99
-rw-r--r--Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml1
-rw-r--r--Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml.cs75
-rw-r--r--Software/Visual_Studio/Utilities/Tango.UITests/Tango.UITests.csproj10
46 files changed, 1695 insertions, 67 deletions
diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf
index 45ae37b64..415dd596f 100644
--- a/Software/DB/Tango.mdf
+++ b/Software/DB/Tango.mdf
Binary files differ
diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf
index c61fb1004..dcaff17f4 100644
--- a/Software/DB/Tango_log.ldf
+++ b/Software/DB/Tango_log.ldf
Binary files differ
diff --git a/Software/Graphics/Mobile/cat.ico b/Software/Graphics/Mobile/cat.ico
new file mode 100644
index 000000000..773d44316
--- /dev/null
+++ b/Software/Graphics/Mobile/cat.ico
Binary files differ
diff --git a/Software/Graphics/Mobile/cat.png b/Software/Graphics/Mobile/cat.png
new file mode 100644
index 000000000..b5020c106
--- /dev/null
+++ b/Software/Graphics/Mobile/cat.png
Binary files differ
diff --git a/Software/Graphics/Mobile/close.png b/Software/Graphics/Mobile/close.png
new file mode 100644
index 000000000..3a040a008
--- /dev/null
+++ b/Software/Graphics/Mobile/close.png
Binary files differ
diff --git a/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/FirmwareUpgradeManager.cs b/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/FirmwareUpgradeManager.cs
new file mode 100644
index 000000000..d79989ecb
--- /dev/null
+++ b/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/FirmwareUpgradeManager.cs
@@ -0,0 +1,329 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Threading;
+using Tango.Core;
+
+namespace Tango.FirmwareUpdateLib.WPF
+{
+ public class FirmwareUpgradeManager : ExtendedObject
+ {
+ private FirmwareUpdateManager _updater;
+ private List<DFUDevice> _current_devices;
+
+ #region Events
+
+ /// <summary>
+ /// Reports about the progress of an on-going firmware upgrade.
+ /// </summary>
+ public event EventHandler<FirmwareUpgradeProgressEventArgs> UpgradeProgress;
+
+ #endregion
+
+ #region Properties
+
+ private FirmwareUpgradeManagerState _state;
+ /// <summary>
+ /// Gets or sets the current manager state.
+ /// </summary>
+ public FirmwareUpgradeManagerState State
+ {
+ get { return _state; }
+ private set { _state = value; RaisePropertyChangedAuto(); }
+ }
+
+ #endregion
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="FirmwareUpgradeManager"/> class.
+ /// </summary>
+ public FirmwareUpgradeManager()
+ {
+ _current_devices = new List<DFUDevice>();
+ }
+
+ /// <summary>
+ /// Performs a full automatic upgrade by getting the first DFU device switching to DFU mode if necessary.
+ /// Uploading, verifying, resetting the device, then checking device existence.
+ /// </summary>
+ /// <param name="mcuFilePath">The MCU bin file path.</param>
+ /// <returns></returns>
+ public Task PerformUpgrade(byte[] mcuData)
+ {
+ EnsureStateIdle();
+
+ State = FirmwareUpgradeManagerState.Busy;
+
+ TaskCompletionSource<object> taskSource = new TaskCompletionSource<object>();
+
+ ProgressDispatcher progressDispatcher = new ProgressDispatcher();
+
+ Task.Factory.StartNew(() =>
+ {
+ try
+ {
+ OnUpgradeProgressChanged(100, 0, FirmwareUpgradeManagerState.Initializing);
+ Initialize();
+ Thread.Sleep(1000);
+
+ LogManager.Log("Initializing progress dispatcher...");
+
+ OnUpgradeProgressChanged(100, 10, State);
+
+ LogManager.Log("Starting automatic full upgrade...");
+
+ OnUpgradeProgressChanged(100, 20, FirmwareUpgradeManagerState.EnumeratingDevices);
+ var device = GetAvailableDevices().FirstOrDefault();
+ Thread.Sleep(1000);
+
+ State = FirmwareUpgradeManagerState.Busy;
+
+ OnUpgradeProgressChanged(100, 30, State);
+
+ Thread.Sleep(1000);
+
+ if (device == null)
+ {
+ throw LogManager.Log(new NullReferenceException("No DFU device found on the system."));
+ }
+
+ LogManager.Log("Found DFU device...");
+ LogManager.Log($"Name: {device.DeviceName}");
+ LogManager.Log($"Mode: {device.Mode}");
+
+ if (device.Mode == DFUMode.RunTime)
+ {
+ State = FirmwareUpgradeManagerState.SwitchingToDFU;
+ LogManager.Log("Switching to DFU mode...");
+ OnUpgradeProgressChanged(100, 40, State);
+ Thread.Sleep(1000);
+
+ device.SwitchToDFUMode();
+ LogManager.Log("Waiting for the device to comeback (3 sec)...");
+
+ State = FirmwareUpgradeManagerState.Waiting;
+ OnUpgradeProgressChanged(100, 50, State);
+ Thread.Sleep(3000);
+
+ LogManager.Log("Looking for the modified DFU device...");
+ OnUpgradeProgressChanged(100, 60, FirmwareUpgradeManagerState.EnumeratingDevices);
+ Thread.Sleep(1000);
+
+ device = GetAvailableDevices().FirstOrDefault();
+
+ State = FirmwareUpgradeManagerState.SwitchingToDFU;
+ OnUpgradeProgressChanged(100, 60, State);
+
+ if (device == null)
+ {
+ throw LogManager.Log(new NullReferenceException("Could not locate the modified DFU device."));
+ }
+
+ if (device.Mode == DFUMode.RunTime)
+ {
+ throw LogManager.Log(new InvalidOperationException("The DFU device was found but has failed to switch into DFU mode."));
+ }
+
+ LogManager.Log("DFU device successfully switched to DFU mode.");
+ LogManager.Log($"Name: {device.DeviceName}");
+ LogManager.Log($"Mode: {device.Mode}");
+ }
+ else
+ {
+ LogManager.Log("Device is in DFU mode. Skipping DFU switching...");
+ }
+
+ State = FirmwareUpgradeManagerState.StartingUpload;
+ OnUpgradeProgressChanged(100, 100, State);
+
+ LogManager.Log("Starting DFU upload...");
+
+ ProgressMode current_mode = ProgressMode.Verifying;
+
+ progressDispatcher.Initialize();
+
+ progressDispatcher.Invoke(() =>
+ {
+ device.Upload(mcuData, (mode, current, total) =>
+ {
+ try
+ {
+ if (current_mode != mode)
+ {
+ current_mode = mode;
+ LogManager.Log($"DFU Upload Status: {current_mode}");
+ }
+
+ if (mode == ProgressMode.Uploading)
+ {
+ OnUpgradeProgressChanged(total, current, FirmwareUpgradeManagerState.Uploading);
+ }
+ else if (mode == ProgressMode.Verifying)
+ {
+ OnUpgradeProgressChanged(total, current, FirmwareUpgradeManagerState.Verifying);
+ }
+
+ if (mode == ProgressMode.Error)
+ {
+ throw LogManager.Log(new ApplicationException("DFU upload got an error notification!"));
+ }
+ else if (mode == ProgressMode.Completed)
+ {
+ LogManager.Log("DFU upload completed successfully.");
+ LogManager.Log("Resetting the device...");
+ State = FirmwareUpgradeManagerState.Resetting;
+ OnUpgradeProgressChanged(100, 0, State);
+ device.Reset();
+ LogManager.Log("Waiting for the device to comeback (3 sec)...");
+
+ State = FirmwareUpgradeManagerState.Waiting;
+ OnUpgradeProgressChanged(100, 30, State);
+ Thread.Sleep(3000);
+
+ LogManager.Log("Looking for the modified DFU device...");
+ OnUpgradeProgressChanged(100, 70, FirmwareUpgradeManagerState.EnumeratingDevices);
+ device = GetAvailableDevices().FirstOrDefault();
+ Thread.Sleep(1000);
+
+ State = FirmwareUpgradeManagerState.Busy;
+ OnUpgradeProgressChanged(100, 90, State);
+ Thread.Sleep(1000);
+
+ if (device == null)
+ {
+ throw LogManager.Log(new NullReferenceException("Could not locate the modified DFU device."));
+ }
+
+ if (device.Mode == DFUMode.DFU)
+ {
+ throw LogManager.Log(new InvalidOperationException("The DFU device was found but has failed to switch back into RunTime mode."));
+ }
+
+ LogManager.Log("DFU device successfully upgraded!");
+ LogManager.Log($"Name: {device.DeviceName}");
+ LogManager.Log($"Mode: {device.Mode}");
+
+ State = FirmwareUpgradeManagerState.Completed;
+ OnUpgradeProgressChanged(100, 100, State);
+
+ taskSource.SetResult(true);
+
+ progressDispatcher.Close();
+ }
+
+
+ DoEvents();
+ }
+ catch (Exception ex)
+ {
+ taskSource.SetException(ex);
+ progressDispatcher.Close();
+ }
+ finally
+ {
+ State = FirmwareUpgradeManagerState.Idle;
+ }
+ });
+ });
+ }
+ catch (Exception ex)
+ {
+ taskSource.SetException(ex);
+ }
+ finally
+ {
+ State = FirmwareUpgradeManagerState.Idle;
+ }
+ });
+
+ return taskSource.Task;
+ }
+
+ /// <summary>
+ /// Ensures the state idle.
+ /// </summary>
+ /// <exception cref="System.InvalidOperationException"></exception>
+ private void EnsureStateIdle()
+ {
+ if (State != FirmwareUpgradeManagerState.Idle) throw new InvalidOperationException($"Operation can be performed only on {FirmwareUpgradeManagerState.Idle} state.");
+ }
+
+ /// <summary>
+ /// Gets the available devices.
+ /// </summary>
+ /// <returns></returns>
+ private List<DFUDevice> GetAvailableDevices()
+ {
+ State = FirmwareUpgradeManagerState.EnumeratingDevices;
+
+ LogManager.Log("Disposing previous devices...");
+ foreach (var device in _current_devices)
+ {
+ try
+ {
+ LogManager.Log($"Disposing previous device {device.DeviceName}...");
+ device.Dispose();
+ }
+ catch { }
+ }
+
+ try
+ {
+ LogManager.Log("Enumerating available DFU devices...");
+ _current_devices = _updater.GetAvailableDevices(false).Where(x => !x.DeviceName.Contains("In-Circuit Debug Interface")).ToList();
+ }
+ catch (Exception ex)
+ {
+ throw LogManager.Log(ex, "Error enumerating available DFU devices.");
+ }
+
+ return _current_devices;
+ }
+
+ /// <summary>
+ /// Initializes this instance.
+ /// </summary>
+ public void Initialize()
+ {
+ State = FirmwareUpgradeManagerState.Initializing;
+ try
+ {
+ LogManager.Log("Initializing firmware upgrade API...");
+ _updater = new FirmwareUpdateManager();
+ _updater.Initialize();
+ }
+ catch (Exception ex)
+ {
+ throw LogManager.Log(ex, "Error initializing firmware upgrade API.");
+ }
+ }
+
+ private void DoEvents()
+ {
+ Application.Current.Dispatcher.Invoke(DispatcherPriority.Background,
+ new Action(delegate { }));
+ }
+
+ /// <summary>
+ /// Raises the <see cref="UpgradeProgress"/> event.
+ /// </summary>
+ /// <param name="total">The total.</param>
+ /// <param name="progress">The progress.</param>
+ /// <param name="state">The state.</param>
+ protected virtual void OnUpgradeProgressChanged(double total, double progress, FirmwareUpgradeManagerState state)
+ {
+ UpgradeProgress?.Invoke(this, new FirmwareUpgradeProgressEventArgs()
+ {
+ Progress = progress,
+ Total = total,
+ State = state,
+ });
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/FirmwareUpgradeManagerState.cs b/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/FirmwareUpgradeManagerState.cs
new file mode 100644
index 000000000..bcd9f69c2
--- /dev/null
+++ b/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/FirmwareUpgradeManagerState.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.FirmwareUpdateLib.WPF
+{
+ public enum FirmwareUpgradeManagerState
+ {
+ [Description("")]
+ Idle,
+ [Description("Working...")]
+ Busy,
+ [Description("Initializing...")]
+ Initializing,
+ [Description("Locating DFU devices...")]
+ EnumeratingDevices,
+ [Description("Switching to DFU mode...")]
+ SwitchingToDFU,
+ [Description("Initializing upload sequence...")]
+ StartingUpload,
+ [Description("Uploading...")]
+ Uploading,
+ [Description("Verifying...")]
+ Verifying,
+ [Description("Resetting the device...")]
+ Resetting,
+ [Description("Waiting for the device...")]
+ Waiting,
+ [Description("Firmware upgrade completed.")]
+ Completed,
+ }
+}
diff --git a/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/FirmwareUpgradeProgressEventArgs.cs b/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/FirmwareUpgradeProgressEventArgs.cs
new file mode 100644
index 000000000..bb7ddfa17
--- /dev/null
+++ b/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/FirmwareUpgradeProgressEventArgs.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.FirmwareUpdateLib.WPF
+{
+ public class FirmwareUpgradeProgressEventArgs : EventArgs
+ {
+ public FirmwareUpgradeManagerState State { get; set; }
+ public double Total { get; set; }
+ public double Progress { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/ProgressAnimator.cs b/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/ProgressAnimator.cs
new file mode 100644
index 000000000..755df4dcb
--- /dev/null
+++ b/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/ProgressAnimator.cs
@@ -0,0 +1,93 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Media.Animation;
+
+namespace Tango.FirmwareUpdateLib.WPF
+{
+ /// <summary>
+ /// Represents a progress animation component capable of exposing a current and total progress with animations.
+ /// </summary>
+ /// <seealso cref="System.Windows.FrameworkElement" />
+ public class ProgressAnimator : FrameworkElement
+ {
+ /// <summary>
+ /// Gets or sets the animation duration between each update (Default 2 seconds).
+ /// </summary>
+ public TimeSpan Duration
+ {
+ get { return (TimeSpan)GetValue(DurationProperty); }
+ set { SetValue(DurationProperty, value); }
+ }
+ public static readonly DependencyProperty DurationProperty =
+ DependencyProperty.Register("Duration", typeof(TimeSpan), typeof(ProgressAnimator), new PropertyMetadata(TimeSpan.FromSeconds(1)));
+
+ /// <summary>
+ /// Gets or sets the current progress. (Use the ApplyProgress method instead of updating this directly).
+ /// </summary>
+ public double Current
+ {
+ get { return (double)GetValue(CurrentProperty); }
+ set { SetValue(CurrentProperty, value); }
+ }
+ public static readonly DependencyProperty CurrentProperty =
+ DependencyProperty.Register("Current", typeof(double), typeof(ProgressAnimator), new PropertyMetadata(0.0));
+
+ /// <summary>
+ /// Gets or sets the total expected progress. (Use the ApplyProgress method instead of updating this directly).
+ /// </summary>
+ public double Total
+ {
+ get { return (double)GetValue(TotalProperty); }
+ set { SetValue(TotalProperty, value); }
+ }
+ public static readonly DependencyProperty TotalProperty =
+ DependencyProperty.Register("Total", typeof(double), typeof(ProgressAnimator), new PropertyMetadata(100.0));
+
+ /// <summary>
+ /// Gets or sets a value indicating whether this instance is intermediate.
+ /// </summary>
+ /// <value>
+ /// <c>true</c> if this instance is intermediate; otherwise, <c>false</c>.
+ /// </value>
+ public bool IsIntermediate
+ {
+ get { return (bool)GetValue(IsIntermediateProperty); }
+ set { SetValue(IsIntermediateProperty, value); }
+ }
+ public static readonly DependencyProperty IsIntermediateProperty =
+ DependencyProperty.Register("IsIntermediate", typeof(bool), typeof(ProgressAnimator), new PropertyMetadata(true));
+
+ /// <summary>
+ /// Applies the progress properties animation.
+ /// </summary>
+ /// <param name="current">The current.</param>
+ /// <param name="total">The total.</param>
+ /// <param name="duration">Will override the default duration for the next progress animation.</param>
+ public void ApplyProgress(double current, double total, TimeSpan? duration = null)
+ {
+ Total = total;
+ IsIntermediate = false;
+
+ DoubleAnimation ani = new DoubleAnimation();
+ ani.To = current;
+
+ ani.Duration = duration != null ? duration.Value : Duration;
+
+ this.BeginAnimation(CurrentProperty, ani, HandoffBehavior.SnapshotAndReplace);
+ }
+
+ /// <summary>
+ /// Resets the progress properties.
+ /// </summary>
+ public void ResetProgress()
+ {
+ this.BeginAnimation(CurrentProperty, null, HandoffBehavior.SnapshotAndReplace);
+ Current = 0;
+ IsIntermediate = true;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/ProgressDispatcher.cs b/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/ProgressDispatcher.cs
new file mode 100644
index 000000000..448e27f55
--- /dev/null
+++ b/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/ProgressDispatcher.cs
@@ -0,0 +1,80 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Threading;
+
+namespace Tango.FirmwareUpdateLib.WPF
+{
+ public class ProgressDispatcher
+ {
+ private Dispatcher _dispatcher;
+ private Window _dummyWindow; //Dummy window for the video dispatcher.
+ private Thread _windowThread; //The video dispatcher thread.
+ private bool _initialized;
+
+ public void Initialize()
+ {
+ if (!_initialized)
+ {
+ _windowThread = new Thread(VideoThreadMethod);
+ _windowThread.Name = "Progress Thread";
+ _windowThread.SetApartmentState(ApartmentState.STA);
+ _windowThread.Start();
+
+ while (!_initialized)
+ {
+ Thread.Sleep(10);
+ }
+ }
+ }
+
+ private void VideoThreadMethod()
+ {
+ _dummyWindow = new Window();
+ _dummyWindow.Width = 0;
+ _dummyWindow.Height = 0;
+ _dummyWindow.WindowStyle = WindowStyle.None;
+ _dummyWindow.ShowInTaskbar = false;
+ _dummyWindow.ShowActivated = false;
+ _dummyWindow.ResizeMode = ResizeMode.NoResize;
+ _dummyWindow.Visibility = Visibility.Hidden;
+ _dummyWindow.Opacity = 0;
+
+ _dummyWindow.Closed += (x, y) => _dummyWindow.Dispatcher.InvokeShutdown();
+ _dummyWindow.Loaded += (x, y) =>
+ {
+ _dummyWindow.Width = 0;
+ _dummyWindow.Height = 0;
+ _dummyWindow.WindowStyle = WindowStyle.None;
+ _dummyWindow.ShowInTaskbar = false;
+ _dummyWindow.ShowActivated = false;
+ _dummyWindow.ResizeMode = ResizeMode.NoResize;
+ _dummyWindow.Visibility = Visibility.Hidden;
+ _dummyWindow.Opacity = 0;
+
+ _dispatcher = _dummyWindow.Dispatcher;
+ _initialized = true;
+ };
+
+ Debug.WriteLine("Progress Dispatcher Initialized!");
+ _dummyWindow.Show();
+ Dispatcher.Run();
+
+ }
+
+ public void Invoke(Action action)
+ {
+ _dispatcher.BeginInvoke(action);
+ }
+
+ public void Close()
+ {
+ _dispatcher.InvokeShutdown();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/Properties/AssemblyInfo.cs b/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..31aea93a0
--- /dev/null
+++ b/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/Properties/AssemblyInfo.cs
@@ -0,0 +1,22 @@
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Tango.FirmwareUpdateLib.WPF")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Tango.FirmwareUpdateLib.WPF")]
+[assembly: AssemblyCopyright("Copyright © 2019")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
diff --git a/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/Properties/Resources.Designer.cs b/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/Properties/Resources.Designer.cs
new file mode 100644
index 000000000..019d81974
--- /dev/null
+++ b/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/Properties/Resources.Designer.cs
@@ -0,0 +1,62 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Tango.FirmwareUpdateLib.WPF.Properties {
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if ((resourceMan == null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.FirmwareUpdateLib.WPF.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/Properties/Resources.resx b/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/Properties/Resources.resx
new file mode 100644
index 000000000..af7dbebba
--- /dev/null
+++ b/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/Properties/Resources.resx
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root> \ No newline at end of file
diff --git a/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/Properties/Settings.Designer.cs b/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/Properties/Settings.Designer.cs
new file mode 100644
index 000000000..37290bd82
--- /dev/null
+++ b/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/Properties/Settings.Designer.cs
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Tango.FirmwareUpdateLib.WPF.Properties
+{
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/Properties/Settings.settings b/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/Properties/Settings.settings
new file mode 100644
index 000000000..033d7a5e9
--- /dev/null
+++ b/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/Properties/Settings.settings
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
+ <Profiles>
+ <Profile Name="(Default)" />
+ </Profiles>
+ <Settings />
+</SettingsFile> \ No newline at end of file
diff --git a/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/Tango.FirmwareUpdateLib.WPF.csproj b/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/Tango.FirmwareUpdateLib.WPF.csproj
new file mode 100644
index 000000000..2b58b0e55
--- /dev/null
+++ b/Software/Visual_Studio/Firmware/Tango.FirmwareUpdateLib.WPF/Tango.FirmwareUpdateLib.WPF.csproj
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{25D7CC4D-A11C-4065-A797-4A1944F636C0}</ProjectGuid>
+ <OutputType>library</OutputType>
+ <RootNamespace>Tango.FirmwareUpdateLib.WPF</RootNamespace>
+ <AssemblyName>Tango.FirmwareUpdateLib.WPF</AssemblyName>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <WarningLevel>4</WarningLevel>
+ <Deterministic>true</Deterministic>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\..\Build\Core\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>..\..\Build\Core\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="System.Net.Http" />
+ <Reference Include="System.Xaml">
+ <RequiredTargetFramework>4.0</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="WindowsBase" />
+ <Reference Include="PresentationCore" />
+ <Reference Include="PresentationFramework" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="FirmwareUpgradeManager.cs" />
+ <Compile Include="FirmwareUpgradeManagerState.cs" />
+ <Compile Include="FirmwareUpgradeProgressEventArgs.cs" />
+ <Compile Include="ProgressAnimator.cs" />
+ <Compile Include="ProgressDispatcher.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Properties\Resources.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Resources.resx</DependentUpon>
+ </Compile>
+ <Compile Include="Properties\Settings.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Settings.settings</DependentUpon>
+ <DesignTimeSharedInput>True</DesignTimeSharedInput>
+ </Compile>
+ <EmbeddedResource Include="Properties\Resources.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+ </EmbeddedResource>
+ <None Include="Properties\Settings.settings">
+ <Generator>SettingsSingleFileGenerator</Generator>
+ <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+ </None>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\Tango.Core\Tango.Core.csproj">
+ <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project>
+ <Name>Tango.Core</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\Tango.Logging\Tango.Logging.csproj">
+ <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project>
+ <Name>Tango.Logging</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Tango.FirmwareUpdateLib\Tango.FirmwareUpdateLib.vcxproj">
+ <Project>{db79fb33-ce7a-49cf-aa89-f697e5cdb0f6}</Project>
+ <Name>Tango.FirmwareUpdateLib</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/FirmwareUpgradeViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/FirmwareUpgradeViewVM.cs
index 09b63cfc9..14b9d0d8e 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/FirmwareUpgradeViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/FirmwareUpgradeViewVM.cs
@@ -5,11 +5,14 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Input;
using Tango.Core.Commands;
using Tango.Integration.Operation;
using Tango.Integration.Upgrade;
using Tango.MachineStudio.Common.Notifications;
using Tango.SharedUI;
+using Tango.SharedUI.Helpers;
namespace Tango.MachineStudio.UI.ViewModels
{
@@ -96,6 +99,10 @@ namespace Tango.MachineStudio.UI.ViewModels
try
{
+ IsFree = false;
+
+ _operator.FirmwareUpgradeMode = FirmwareUpgradeModes.DFU;
+
_stream = new FileStream(SelectedFile, FileMode.Open);
Handler = await _operator.UpgradeFirmware(_stream);
Handler.Progress += (_, e) =>
@@ -104,18 +111,22 @@ namespace Tango.MachineStudio.UI.ViewModels
{
AbortCommand.RaiseCanExecuteChanged();
});
+
+ UIHelper.DoEvents();
};
Handler.Completed += (_, __) =>
{
CanClose = true;
_stream.Dispose();
CurrentPage = 2;
+ IsFree = true;
};
Handler.Canceled += (_, __) =>
{
CanClose = true;
_stream.Dispose();
CurrentPage = 0;
+ IsFree = true;
};
Handler.Failed += (_, ex) =>
{
@@ -123,10 +134,12 @@ namespace Tango.MachineStudio.UI.ViewModels
CanClose = true;
_stream.Dispose();
CurrentPage = 3;
+ IsFree = true;
};
}
catch (Exception ex)
{
+ IsFree = true;
CanClose = true;
UpgradeError = ex.FlattenMessage();
CurrentPage = 3;
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/FirmwareUpgradeView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/FirmwareUpgradeView.xaml
index 84f4b2d92..4de64db12 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/FirmwareUpgradeView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/FirmwareUpgradeView.xaml
@@ -14,6 +14,17 @@
<UserControl.Resources>
<converters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter" />
</UserControl.Resources>
+
+ <UserControl.Style>
+ <Style TargetType="UserControl">
+ <Setter Property="Cursor" Value="Arrow"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding IsFree}" Value="False">
+ <Setter Property="Cursor" Value="Wait"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </UserControl.Style>
<Grid>
<Grid Margin="10">
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 1b51876d7..124e6e276 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
@@ -193,6 +193,8 @@
<Compile Include="Update\PPCUpdateService.cs" />
<Compile Include="UWF\DefaultUnifiedWriteFilterManager.cs" />
<Compile Include="UWF\IUnifiedWriteFilterManager.cs" />
+ <Compile Include="WatchDog\WatchDogClient.cs" />
+ <Compile Include="WatchDog\WatchDogServer.cs" />
<Page Include="Connectivity\AvailableWiFiConnectionsControl.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
@@ -353,7 +355,7 @@
</Target>
<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/PPC/Tango.PPC.Common/WatchDog/WatchDogClient.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/WatchDog/WatchDogClient.cs
new file mode 100644
index 000000000..47a24ea85
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/WatchDog/WatchDogClient.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.PPC.Common.WatchDog
+{
+ public class WatchDogClient
+ {
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/WatchDog/WatchDogServer.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/WatchDog/WatchDogServer.cs
new file mode 100644
index 000000000..77bca2e30
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/WatchDog/WatchDogServer.cs
@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.IO.Pipes;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Tango.PPC.Common.WatchDog
+{
+ public class WatchDogServer
+ {
+ private NamedPipeServerStream _server;
+ private Thread _thread;
+
+ public bool IsStarted { get; private set; }
+
+ public void Start()
+ {
+ _thread = new Thread(ThreadMethod);
+ _thread.IsBackground = true;
+ _thread.Start();
+ }
+
+ private void ThreadMethod()
+ {
+ IsStarted = true;
+
+ try
+ {
+ _server = new NamedPipeServerStream("Tango_Watch_Dog_Pipe");
+ _server.WaitForConnection();
+ StreamReader reader = new StreamReader(_server);
+ StreamWriter writer = new StreamWriter(_server);
+
+ while (IsStarted)
+ {
+ var line = reader.ReadLine();
+ writer.WriteLine(line);
+ writer.Flush();
+ }
+ }
+ catch
+ {
+ IsStarted = false;
+ }
+ }
+
+ public void Stop()
+ {
+ _server.Dispose();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/App.config b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/App.config
new file mode 100644
index 000000000..731f6de6c
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/App.config
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <startup>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
+ </startup>
+</configuration> \ No newline at end of file
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/App.xaml b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/App.xaml
new file mode 100644
index 000000000..a78cd685d
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/App.xaml
@@ -0,0 +1,9 @@
+<Application x:Class="Tango.PPC.WatchDog.App"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:local="clr-namespace:Tango.PPC.WatchDog"
+ StartupUri="MainWindow.xaml">
+ <Application.Resources>
+
+ </Application.Resources>
+</Application>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/App.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/App.xaml.cs
new file mode 100644
index 000000000..3e39963bd
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/App.xaml.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace Tango.PPC.WatchDog
+{
+ /// <summary>
+ /// Interaction logic for App.xaml
+ /// </summary>
+ public partial class App : Application
+ {
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/MainWindow.xaml b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/MainWindow.xaml
new file mode 100644
index 000000000..4e772e774
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/MainWindow.xaml
@@ -0,0 +1,35 @@
+<Window x:Class="Tango.PPC.WatchDog.MainWindow"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:local="clr-namespace:Tango.PPC.WatchDog"
+ mc:Ignorable="d"
+ Title="Tango Watch Dog" Background="Transparent" AllowsTransparency="True" Height="250" Width="500" WindowStartupLocation="CenterScreen" WindowStyle="None" ResizeMode="NoResize" Icon="/cat.png"
+ d:DataContext="{d:DesignInstance Type=local:MainWindowVM, IsDesignTimeCreatable=False}">
+ <Grid>
+ <Border Margin="10" BorderThickness="1" BorderBrush="DimGray">
+ <Border.Effect>
+ <DropShadowEffect ShadowDepth="0" BlurRadius="10" Color="Black" />
+ </Border.Effect>
+ <DockPanel>
+ <Border DockPanel.Dock="Top" BorderThickness="0 0 0 1" BorderBrush="Gainsboro" Background="#202020" Padding="10">
+ <DockPanel>
+ <Image Source="/cat.png" Stretch="Uniform" Height="32" RenderOptions.BitmapScalingMode="Fant" />
+ <TextBlock Margin="10 0 0 0" Foreground="Gainsboro" VerticalAlignment="Center">Tango Watch Dog</TextBlock>
+ <Button DockPanel.Dock="Right" Width="24" Height="24" HorizontalAlignment="Right" Cursor="Hand">
+ <Button.Template>
+ <ControlTemplate TargetType="Button">
+ <Image Source="/close.png" Width="12" Height="12"></Image>
+ </ControlTemplate>
+ </Button.Template>
+ </Button>
+ </DockPanel>
+ </Border>
+ <Grid Background="Gray">
+
+ </Grid>
+ </DockPanel>
+ </Border>
+ </Grid>
+</Window>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/MainWindow.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/MainWindow.xaml.cs
new file mode 100644
index 000000000..585fc3510
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/MainWindow.xaml.cs
@@ -0,0 +1,29 @@
+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.WatchDog
+{
+ /// <summary>
+ /// Interaction logic for MainWindow.xaml
+ /// </summary>
+ public partial class MainWindow : Window
+ {
+ public MainWindow()
+ {
+ InitializeComponent();
+ DataContext = new MainWindowVM();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/MainWindowVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/MainWindowVM.cs
new file mode 100644
index 000000000..a95a9503c
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/MainWindowVM.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.SharedUI;
+
+namespace Tango.PPC.WatchDog
+{
+ public class MainWindowVM : ViewModel
+ {
+
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..254eb3416
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/Properties/AssemblyInfo.cs
@@ -0,0 +1,11 @@
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Tango PPC Watch Dog")]
+[assembly: AssemblyVersion("1.0.2.0")]
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/Properties/Resources.Designer.cs b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/Properties/Resources.Designer.cs
new file mode 100644
index 000000000..44abe9d05
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/Properties/Resources.Designer.cs
@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Tango.PPC.WatchDog.Properties
+{
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources
+ {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources()
+ {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager
+ {
+ get
+ {
+ if ((resourceMan == null))
+ {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.PPC.WatchDog.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture
+ {
+ get
+ {
+ return resourceCulture;
+ }
+ set
+ {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/Properties/Resources.resx b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/Properties/Resources.resx
new file mode 100644
index 000000000..af7dbebba
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/Properties/Resources.resx
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root> \ No newline at end of file
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/Properties/Settings.Designer.cs b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/Properties/Settings.Designer.cs
new file mode 100644
index 000000000..3bf29275f
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/Properties/Settings.Designer.cs
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Tango.PPC.WatchDog.Properties
+{
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
+ {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default
+ {
+ get
+ {
+ return defaultInstance;
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/Properties/Settings.settings b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/Properties/Settings.settings
new file mode 100644
index 000000000..033d7a5e9
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/Properties/Settings.settings
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
+ <Profiles>
+ <Profile Name="(Default)" />
+ </Profiles>
+ <Settings />
+</SettingsFile> \ No newline at end of file
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/Tango.PPC.WatchDog.csproj b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/Tango.PPC.WatchDog.csproj
new file mode 100644
index 000000000..b9429e044
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/Tango.PPC.WatchDog.csproj
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{280267F5-A19E-4B96-999D-C13D293ECA45}</ProjectGuid>
+ <OutputType>WinExe</OutputType>
+ <RootNamespace>Tango.PPC.WatchDog</RootNamespace>
+ <AssemblyName>Tango.PPC.WatchDog</AssemblyName>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <WarningLevel>4</WarningLevel>
+ <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+ <Deterministic>true</Deterministic>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\..\Build\PPC\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>..\..\Build\PPC\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="System.Net.Http" />
+ <Reference Include="System.Xaml">
+ <RequiredTargetFramework>4.0</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="WindowsBase" />
+ <Reference Include="PresentationCore" />
+ <Reference Include="PresentationFramework" />
+ </ItemGroup>
+ <ItemGroup>
+ <ApplicationDefinition Include="App.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </ApplicationDefinition>
+ <Page Include="MainWindow.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
+ <Compile Include="..\..\Versioning\GlobalVersionInfo.cs">
+ <Link>GlobalVersionInfo.cs</Link>
+ </Compile>
+ <Compile Include="App.xaml.cs">
+ <DependentUpon>App.xaml</DependentUpon>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="MainWindow.xaml.cs">
+ <DependentUpon>MainWindow.xaml</DependentUpon>
+ <SubType>Code</SubType>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="MainWindowVM.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Properties\Resources.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Resources.resx</DependentUpon>
+ </Compile>
+ <Compile Include="Properties\Settings.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DependentUpon>Settings.settings</DependentUpon>
+ <DesignTimeSharedInput>True</DesignTimeSharedInput>
+ </Compile>
+ <EmbeddedResource Include="Properties\Resources.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+ </EmbeddedResource>
+ <None Include="Properties\Settings.settings">
+ <Generator>SettingsSingleFileGenerator</Generator>
+ <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+ </None>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="App.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <Resource Include="cat.png" />
+ </ItemGroup>
+ <ItemGroup>
+ <Resource Include="close.png" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\Tango.Core\Tango.Core.csproj">
+ <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project>
+ <Name>Tango.Core</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\Tango.SharedUI\Tango.SharedUI.csproj">
+ <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project>
+ <Name>Tango.SharedUI</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/cat.png b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/cat.png
new file mode 100644
index 000000000..b5020c106
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/cat.png
Binary files differ
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/close.png b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/close.png
new file mode 100644
index 000000000..3a040a008
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.WatchDog/close.png
Binary files differ
diff --git a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeUsbClient.cs b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeUsbClient.cs
index 0496c270e..0767d73d5 100644
--- a/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeUsbClient.cs
+++ b/Software/Visual_Studio/Tango.Integration/ExternalBridge/ExternalBridgeUsbClient.cs
@@ -73,8 +73,11 @@ namespace Tango.Integration.ExternalBridge
/// <returns></returns>
public override async Task Connect()
{
- await Disconnect();
- Adapter = new UsbTransportAdapter(ComPort) { BaudRate = BaudRate };
+ if (Status != MachineStatuses.Upgrading)
+ {
+ await Disconnect();
+ Adapter = new UsbTransportAdapter(ComPort) { BaudRate = BaudRate };
+ }
await base.Connect();
}
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs
index 3da555933..e371708e3 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs
@@ -46,6 +46,11 @@ namespace Tango.Integration.Operation
MachineStatuses Status { get; }
/// <summary>
+ /// Gets or sets the firmware upgrade mode.
+ /// </summary>
+ FirmwareUpgradeModes FirmwareUpgradeMode { get; set; }
+
+ /// <summary>
/// Gets the running job.
/// </summary>
Job RunningJob { get; }
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
index d0e03f873..d421120ea 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
@@ -33,6 +33,7 @@ using Tango.Integration.Upgrade;
using Tango.PMR.FirmwareUpgrade;
using Tango.Integration.Logging;
using Tango.Integration.JobRuns;
+using Tango.FirmwareUpdateLib.WPF;
namespace Tango.Integration.Operation
{
@@ -86,6 +87,7 @@ namespace Tango.Integration.Operation
EnableEventsNotification = true;
EnableJobResume = true;
LogEmbeddedDebuggingToFile = true;
+ FirmwareUpgradeMode = FirmwareUpgradeModes.DFU | FirmwareUpgradeModes.TFP_PACKAGE;
}
/// <summary>
@@ -202,6 +204,11 @@ namespace Tango.Integration.Operation
}
/// <summary>
+ /// Gets or sets the firmware upgrade mode.
+ /// </summary>
+ public FirmwareUpgradeModes FirmwareUpgradeMode { get; set; }
+
+ /// <summary>
/// Gets a value indicating whether this instance is printing.
/// </summary>
public bool IsPrinting
@@ -677,6 +684,8 @@ namespace Tango.Integration.Operation
/// <returns></returns>
public async override Task Disconnect()
{
+ if (Status == MachineStatuses.Upgrading) return;
+
if (State == TransportComponentState.Connected)
{
DisconnectRequest request = new DisconnectRequest();
@@ -711,7 +720,11 @@ namespace Tango.Integration.Operation
{
var keep_alive = UseKeepAlive;
UseKeepAlive = false;
- await base.Connect();
+
+ if (Status != MachineStatuses.Upgrading)
+ {
+ await base.Connect();
+ }
if (State == TransportComponentState.Connected)
{
@@ -723,7 +736,10 @@ namespace Tango.Integration.Operation
var response = await SendRequest<ConnectRequest, ConnectResponse>(request);
LogResponseReceived(response.Message);
- Status = MachineStatuses.ReadyToDye;
+ if (Status != MachineStatuses.Upgrading)
+ {
+ Status = MachineStatuses.ReadyToDye;
+ }
DeviceInformation = response.Message.DeviceInformation;
@@ -1280,7 +1296,7 @@ namespace Tango.Integration.Operation
request.JobTicket.UploadStrategy = JobUploadStrategy;
- ThreadFactory.StartNew(async () =>
+ ThreadFactory.StartNew(async () =>
{
if (JobUploadStrategy == JobUploadStrategy.JobDescriptionFile)
{
@@ -2023,9 +2039,17 @@ namespace Tango.Integration.Operation
try
{
- zip = ZipFile.Read(tfpStream);
+ if (Status != MachineStatuses.ReadyToDye)
+ {
+ throw LogManager.Log(new InvalidOperationException($"Could not perform firmware upgrade while operator status is '{Status}'."));
+ }
+
+ Status = MachineStatuses.Upgrading;
- upgradeHandler.Total = zip.Entries.Sum(x => x.UncompressedSize);
+ var package_info = await GetFirmwarePackageInfo(tfpStream);
+ tfpStream.Position = 0;
+
+ zip = ZipFile.Read(tfpStream);
var storage = CreateStorageManager();
var drive = await storage.GetStorageDrive();
@@ -2044,11 +2068,67 @@ namespace Tango.Integration.Operation
List<ZipEntry> entries = zip.Entries.ToList();
List<Stream> streams = new List<Stream>();
+ var keepAlive = UseKeepAlive;
+ UseKeepAlive = false;
+
+ Action upgradeDFU = null;
Action uploadNext = null;
Action validate = null;
Action activate = null;
Action postActivation = null;
+ upgradeDFU = new Action(() =>
+ {
+ try
+ {
+ if (FirmwareUpgradeMode.HasFlag(FirmwareUpgradeModes.DFU))
+ {
+ var mcuEntry = zip.Entries.Single(x => x.FileName == package_info.FileDescriptors.Single(y => y.Destination == VersionFileDestination.Mcu).FileName);
+ MemoryStream ms = new MemoryStream();
+ mcuEntry.Extract(ms);
+ ms.Position = 0;
+ byte[] data = ms.ToArray();
+ ms.Dispose();
+
+ FirmwareUpgradeManager upgradeManager = new FirmwareUpgradeManager();
+ upgradeManager.UpgradeProgress += (sender, e) =>
+ {
+ upgradeHandler.Total = 100;
+ upgradeHandler.RaiseProgress((long)e.Progress, FirmwareUpgradeStatus.Upgrading, e.State.ToDescription());
+ };
+
+ Adapter.Disconnect().Wait();
+
+ if (MachineEventsStateProvider != null)
+ {
+ MachineEventsStateProvider.Reset();
+ }
+
+ upgradeManager.PerformUpgrade(data).Wait();
+ upgradeHandler.Total = zip.Entries.Sum(x => x.UncompressedSize);
+
+ Thread.Sleep(2000);
+ Adapter.Connect().Wait();
+ Connect().Wait();
+ Status = MachineStatuses.Upgrading;
+ }
+
+ if (FirmwareUpgradeMode.HasFlag(FirmwareUpgradeModes.TFP_PACKAGE))
+ {
+ uploadNext();
+ }
+ else
+ {
+ postActivation();
+ }
+ }
+ catch (Exception ex)
+ {
+ upgradeHandler.RaiseFailed(ex);
+ return;
+ }
+ });
+
uploadNext = new Action(() =>
{
if (entries.Count > 0)
@@ -2124,11 +2204,13 @@ namespace Tango.Integration.Operation
postActivation = new Action(() =>
{
upgradeHandler.RaiseCompleted();
+ Status = MachineStatuses.ReadyToDye;
+ UseKeepAlive = keepAlive;
});
ThreadFactory.StartNew(() =>
{
- uploadNext();
+ upgradeDFU();
});
return upgradeHandler;
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineStatuses.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineStatuses.cs
index 6e5b51891..3a09256b1 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/MachineStatuses.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineStatuses.cs
@@ -19,6 +19,8 @@ namespace Tango.Integration.Operation
Printing,
[Description("Service")]
Service,
+ [Description("Upgrading")]
+ Upgrading,
[Description("Error")]
Error,
}
diff --git a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj
index 45930a222..9a7e783ed 100644
--- a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj
+++ b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj
@@ -95,6 +95,7 @@
<Compile Include="Operation\JobDescriptionFile.cs" />
<Compile Include="Operation\SpoolChangeRequiredEventArgs.cs" />
<Compile Include="Upgrade\FirmwareUpgradeHandler.cs" />
+ <Compile Include="Upgrade\FirmwareUpgradeModes.cs" />
<Compile Include="Upgrade\FirmwareUpgradeProgressEventArgs.cs" />
<Compile Include="Upgrade\FirmwareUpgradeStatus.cs" />
<Compile Include="Operation\IMachineEventsStateProvider.cs" />
@@ -126,6 +127,10 @@
<Compile Include="ExternalBridge\IExternalBridgeService.cs" />
</ItemGroup>
<ItemGroup>
+ <ProjectReference Include="..\Firmware\Tango.FirmwareUpdateLib.WPF\Tango.FirmwareUpdateLib.WPF.csproj">
+ <Project>{25d7cc4d-a11c-4065-a797-4a1944f636c0}</Project>
+ <Name>Tango.FirmwareUpdateLib.WPF</Name>
+ </ProjectReference>
<ProjectReference Include="..\SideChains\ColorMine\ColorMine.csproj">
<Project>{37e4ceab-b54b-451f-b535-04cf7da9c459}</Project>
<Name>ColorMine</Name>
@@ -171,7 +176,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.Integration/Upgrade/FirmwareUpgradeModes.cs b/Software/Visual_Studio/Tango.Integration/Upgrade/FirmwareUpgradeModes.cs
new file mode 100644
index 000000000..e96b55278
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Integration/Upgrade/FirmwareUpgradeModes.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.Integration.Upgrade
+{
+ /// <summary>
+ /// Represents a bitwise enumeration for setting the firmware upgrade mode of the machine operator.
+ /// </summary>
+ public enum FirmwareUpgradeModes
+ {
+ DFU = 1,
+ TFP_PACKAGE = 2,
+ BOOT_LOADER = 4,
+ }
+}
diff --git a/Software/Visual_Studio/Tango.Integration/Upgrade/FirmwareUpgradeStatus.cs b/Software/Visual_Studio/Tango.Integration/Upgrade/FirmwareUpgradeStatus.cs
index 0d8449ee9..cf9cb2364 100644
--- a/Software/Visual_Studio/Tango.Integration/Upgrade/FirmwareUpgradeStatus.cs
+++ b/Software/Visual_Studio/Tango.Integration/Upgrade/FirmwareUpgradeStatus.cs
@@ -11,6 +11,8 @@ namespace Tango.Integration.Upgrade
{
[Description("Initializing...")]
Initializing,
+ [Description("Upgrading Firmware...")]
+ Upgrading,
[Description("Uploading files...")]
Uploading,
[Description("Validating version...")]
diff --git a/Software/Visual_Studio/Tango.sln b/Software/Visual_Studio/Tango.sln
index f607d7564..6c771fbcc 100644
--- a/Software/Visual_Studio/Tango.sln
+++ b/Software/Visual_Studio/Tango.sln
@@ -254,6 +254,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Tango.FirmwareUpdateLib", "
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.PPC.Power", "PPC\Modules\Tango.PPC.Power\Tango.PPC.Power.csproj", "{1D0F15B7-C1F3-4B9E-B0BC-A5B9E50C91D0}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.PPC.WatchDog", "PPC\Tango.PPC.WatchDog\Tango.PPC.WatchDog.csproj", "{280267F5-A19E-4B96-999D-C13D293ECA45}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.FirmwareUpdateLib.WPF", "Firmware\Tango.FirmwareUpdateLib.WPF\Tango.FirmwareUpdateLib.WPF.csproj", "{25D7CC4D-A11C-4065-A797-4A1944F636C0}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
AppVeyor|Any CPU = AppVeyor|Any CPU
@@ -2022,6 +2026,7 @@ Global
{5B954D98-4020-4AC6-939F-C52B5646E8E6}.AppVeyor|x86.ActiveCfg = Release|Any CPU
{5B954D98-4020-4AC6-939F-C52B5646E8E6}.AppVeyor|x86.Build.0 = Release|Any CPU
{5B954D98-4020-4AC6-939F-C52B5646E8E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5B954D98-4020-4AC6-939F-C52B5646E8E6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5B954D98-4020-4AC6-939F-C52B5646E8E6}.Debug|ARM.ActiveCfg = Debug|Any CPU
{5B954D98-4020-4AC6-939F-C52B5646E8E6}.Debug|ARM.Build.0 = Debug|Any CPU
{5B954D98-4020-4AC6-939F-C52B5646E8E6}.Debug|ARM64.ActiveCfg = Debug|Any CPU
@@ -4509,6 +4514,86 @@ Global
{1D0F15B7-C1F3-4B9E-B0BC-A5B9E50C91D0}.Release|x64.Build.0 = Release|Any CPU
{1D0F15B7-C1F3-4B9E-B0BC-A5B9E50C91D0}.Release|x86.ActiveCfg = Release|Any CPU
{1D0F15B7-C1F3-4B9E-B0BC-A5B9E50C91D0}.Release|x86.Build.0 = Release|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.AppVeyor|Any CPU.ActiveCfg = Release|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.AppVeyor|Any CPU.Build.0 = Release|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.AppVeyor|ARM.ActiveCfg = Release|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.AppVeyor|ARM.Build.0 = Release|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.AppVeyor|ARM64.ActiveCfg = Release|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.AppVeyor|ARM64.Build.0 = Release|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.AppVeyor|x64.ActiveCfg = Release|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.AppVeyor|x64.Build.0 = Release|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.AppVeyor|x86.ActiveCfg = Release|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.AppVeyor|x86.Build.0 = Release|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.Debug|ARM.Build.0 = Debug|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.Debug|x64.Build.0 = Debug|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.Debug|x86.Build.0 = Debug|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.DefaultBuild|Any CPU.ActiveCfg = Debug|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.DefaultBuild|Any CPU.Build.0 = Debug|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.DefaultBuild|ARM.ActiveCfg = Debug|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.DefaultBuild|ARM.Build.0 = Debug|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.DefaultBuild|ARM64.ActiveCfg = Debug|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.DefaultBuild|ARM64.Build.0 = Debug|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.DefaultBuild|x64.ActiveCfg = Debug|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.DefaultBuild|x64.Build.0 = Debug|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.DefaultBuild|x86.ActiveCfg = Debug|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.DefaultBuild|x86.Build.0 = Debug|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.Release|Any CPU.Build.0 = Release|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.Release|ARM.ActiveCfg = Release|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.Release|ARM.Build.0 = Release|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.Release|ARM64.Build.0 = Release|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.Release|x64.ActiveCfg = Release|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.Release|x64.Build.0 = Release|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.Release|x86.ActiveCfg = Release|Any CPU
+ {280267F5-A19E-4B96-999D-C13D293ECA45}.Release|x86.Build.0 = Release|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.AppVeyor|Any CPU.ActiveCfg = Release|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.AppVeyor|Any CPU.Build.0 = Release|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.AppVeyor|ARM.ActiveCfg = Release|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.AppVeyor|ARM.Build.0 = Release|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.AppVeyor|ARM64.ActiveCfg = Release|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.AppVeyor|ARM64.Build.0 = Release|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.AppVeyor|x64.ActiveCfg = Release|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.AppVeyor|x64.Build.0 = Release|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.AppVeyor|x86.ActiveCfg = Release|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.AppVeyor|x86.Build.0 = Release|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.Debug|ARM.Build.0 = Debug|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.Debug|x64.Build.0 = Debug|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.Debug|x86.Build.0 = Debug|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.DefaultBuild|Any CPU.ActiveCfg = Debug|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.DefaultBuild|Any CPU.Build.0 = Debug|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.DefaultBuild|ARM.ActiveCfg = Debug|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.DefaultBuild|ARM.Build.0 = Debug|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.DefaultBuild|ARM64.ActiveCfg = Debug|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.DefaultBuild|ARM64.Build.0 = Debug|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.DefaultBuild|x64.ActiveCfg = Debug|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.DefaultBuild|x64.Build.0 = Debug|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.DefaultBuild|x86.ActiveCfg = Debug|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.DefaultBuild|x86.Build.0 = Debug|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.Release|ARM.ActiveCfg = Release|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.Release|ARM.Build.0 = Release|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.Release|ARM64.Build.0 = Release|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.Release|x64.ActiveCfg = Release|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.Release|x64.Build.0 = Release|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.Release|x86.ActiveCfg = Release|Any CPU
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -4588,14 +4673,16 @@ Global
{F69DA3A8-F823-461E-87CF-A9275ABC0B15} = {B2AF4F3F-2828-47C3-8F3E-A0EA0BD66FF8}
{DB79FB33-CE7A-49CF-AA89-F697E5CDB0F6} = {AD8721D6-D728-4D58-A0D8-BE2E3FF7A9BC}
{1D0F15B7-C1F3-4B9E-B0BC-A5B9E50C91D0} = {0048447D-1D94-4E60-9DAD-7349C777CB4E}
+ {280267F5-A19E-4B96-999D-C13D293ECA45} = {C81ED1A3-D18C-4D80-A8F5-061994A14A60}
+ {25D7CC4D-A11C-4065-A797-4A1944F636C0} = {AD8721D6-D728-4D58-A0D8-BE2E3FF7A9BC}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {7986F7F4-A86A-4994-B1B6-0988D7F057B6}
- BuildVersion_BuildVersioningStyle = None.None.Increment.DeltaBaseYearDayOfYear
- BuildVersion_UpdateAssemblyVersion = True
- BuildVersion_UpdateFileVersion = False
- BuildVersion_StartDate = 2000/1/1
- BuildVersion_AssemblyInfoFilename = Properties\AssemblyInfo.cs
BuildVersion_UseGlobalSettings = False
+ BuildVersion_AssemblyInfoFilename = Properties\AssemblyInfo.cs
+ BuildVersion_StartDate = 2000/1/1
+ BuildVersion_UpdateFileVersion = False
+ BuildVersion_UpdateAssemblyVersion = True
+ BuildVersion_BuildVersioningStyle = None.None.Increment.DeltaBaseYearDayOfYear
+ SolutionGuid = {7986F7F4-A86A-4994-B1B6-0988D7F057B6}
EndGlobalSection
EndGlobal
diff --git a/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml b/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml
index 8714e65c3..d9180c4dd 100644
--- a/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml
+++ b/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml
@@ -21,7 +21,6 @@
<TextBlock HorizontalAlignment="Center" Margin="0 0 0 10" x:Name="txtStatus"></TextBlock>
<ProgressBar x:Name="prog" VerticalAlignment="Center" Height="15" Width="700"></ProgressBar>
<Button x:Name="btnStart" Click="btnStart_Click" HorizontalAlignment="Center" Padding="30 10" Margin="0 10 0 0">START</Button>
- <Button x:Name="btnSwitch" Click="btnSwitch_Click" HorizontalAlignment="Center" Padding="30 10" Margin="0 10 0 0">SWITCH</Button>
</StackPanel>
</Grid>
</Window>
diff --git a/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml.cs b/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml.cs
index e7db48435..e2b4586db 100644
--- a/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml.cs
+++ b/Software/Visual_Studio/Utilities/Tango.UITests/MainWindow.xaml.cs
@@ -16,6 +16,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
+using System.Windows.Threading;
using Tango.BL;
using Tango.BL.Builders;
using Tango.BL.Catalogs;
@@ -24,6 +25,8 @@ using Tango.Core;
using Tango.Core.Commands;
using Tango.DragAndDrop;
using Tango.FirmwareUpdateLib;
+using Tango.FirmwareUpdateLib.WPF;
+using Tango.Logging;
using Tango.SharedUI;
namespace Tango.UITests
@@ -33,71 +36,45 @@ namespace Tango.UITests
/// </summary>
public partial class MainWindow : Window
{
- private FirmwareUpdateManager _manager;
- private DFUDevice _device;
+ private FirmwareUpgradeManager manager;
public MainWindow()
{
-
- Start();
InitializeComponent();
- //this.ContentRendered += MainWindow_ContentRendered;
- }
- private async void Start()
- {
- using (var db = ObservablesContext.CreateDefault())
- {
- MachineVersion version = db.MachineVersions.FirstOrDefault();
- var machine = db.Machines.SingleOrDefault(x => x.SerialNumber == "1111");
- await version.ApplyPrototypeMachine(machine, db);
- }
+ LogManager.Default.RegisterLogger(new VSOutputLogger());
+
+ manager = new FirmwareUpgradeManager();
+ manager.UpgradeProgress += Manager_UpgradeProgress;
}
- private void MainWindow_ContentRendered(object sender, EventArgs e)
+ private void Manager_UpgradeProgress(object sender, FirmwareUpgradeProgressEventArgs e)
{
- Task.Factory.StartNew(() =>
+ Dispatcher.Invoke(new Action(() =>
{
- _manager = new FirmwareUpdateManager();
- _manager.Initialize();
-
- _device = _manager.GetAvailableDevices(false).FirstOrDefault();
+ txtStatus.Text = e.State.ToDescription();
+ prog.Maximum = e.Total;
+ prog.Value = e.Progress;
+ }));
- if (_device != null)
- {
- MessageBox.Show($"Detected device: '{_device.DeviceName}'.");
- }
- });
+ Application.Current.Dispatcher.Invoke(DispatcherPriority.Background,
+ new Action(delegate { }));
}
- private void btnStart_Click(object sender, RoutedEventArgs e)
+ private async void btnStart_Click(object sender, RoutedEventArgs e)
{
- OpenFileDialog dlg = new OpenFileDialog();
- if (dlg.ShowDialog().Value)
+ try
{
- byte[] data = File.ReadAllBytes(dlg.FileName);
- _device.Upload(data, OnProgress);
+ OpenFileDialog dlg = new OpenFileDialog();
+ if (dlg.ShowDialog().Value)
+ {
+ //await manager.PerformUpgrade(dlg.FileName);
+ MessageBox.Show("Completed !");
+ }
}
- }
-
- private void OnProgress(ProgressMode progressMode, int current, int total)
- {
- this.BeginInvoke(() =>
- {
- txtStatus.Text = progressMode.ToString();
- prog.Maximum = total;
- prog.Value = current;
- });
- }
-
- private void btnSwitch_Click(object sender, RoutedEventArgs e)
- {
- _device.SwitchToDFUMode();
- _device = _manager.GetAvailableDevices(false).FirstOrDefault();
-
- if (_device.Mode == DFUMode.DFU)
+ catch (Exception ex)
{
- MessageBox.Show($"Switched to DFU mode: '{_device.DeviceName}'.");
+ MessageBox.Show(ex.ToString());
}
}
}
diff --git a/Software/Visual_Studio/Utilities/Tango.UITests/Tango.UITests.csproj b/Software/Visual_Studio/Utilities/Tango.UITests/Tango.UITests.csproj
index 64ab69afe..dd160e480 100644
--- a/Software/Visual_Studio/Utilities/Tango.UITests/Tango.UITests.csproj
+++ b/Software/Visual_Studio/Utilities/Tango.UITests/Tango.UITests.csproj
@@ -111,6 +111,10 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
+ <ProjectReference Include="..\..\Firmware\Tango.FirmwareUpdateLib.WPF\Tango.FirmwareUpdateLib.WPF.csproj">
+ <Project>{25d7cc4d-a11c-4065-a797-4a1944f636c0}</Project>
+ <Name>Tango.FirmwareUpdateLib.WPF</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\Firmware\Tango.FirmwareUpdateLib\Tango.FirmwareUpdateLib.vcxproj">
<Project>{db79fb33-ce7a-49cf-aa89-f697e5cdb0f6}</Project>
<Name>Tango.FirmwareUpdateLib</Name>
@@ -135,6 +139,10 @@
<Project>{4399af76-db52-4cfb-8020-6f85bdb29fd5}</Project>
<Name>Tango.Explorer</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\Tango.Logging\Tango.Logging.csproj">
+ <Project>{bc932dbd-7cdb-488c-99e4-f02cf441f55e}</Project>
+ <Name>Tango.Logging</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\Tango.SharedUI\Tango.SharedUI.csproj">
<Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project>
<Name>Tango.SharedUI</Name>
@@ -151,7 +159,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