aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-05-13 13:58:45 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-05-13 13:58:45 +0300
commit4cc4089f36b0a9b9d754e33acb49da930f846699 (patch)
tree314c77ca012d10ff1440a112893072943e479066
parent8d58d0b03648069600f8abf39dbe68b16c90559b (diff)
downloadTango-4cc4089f36b0a9b9d754e33acb49da930f846699.tar.gz
Tango-4cc4089f36b0a9b9d754e33acb49da930f846699.zip
Some fixed to TCC mobile design.
Implemented DFU reset on Machine Operator.
-rw-r--r--Software/Android_Studio/ColorCapture/app/build.gradle4
-rw-r--r--Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/MainActivityVM.java10
-rw-r--r--Software/Android_Studio/ColorCapture/app/src/main/res/layout/side_menu.xml4
-rw-r--r--Software/DB/PPC/Tango.mdfbin75497472 -> 75497472 bytes
-rw-r--r--Software/DB/PPC/Tango_log.ldfbin53673984 -> 53673984 bytes
-rw-r--r--Software/DB/TCC/TCC.mdfbin8388608 -> 8388608 bytes
-rw-r--r--Software/DB/TCC/TCC_log.ldfbin8388608 -> 8388608 bytes
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs2
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs24
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml3
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs46
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest2
-rw-r--r--Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs18
-rw-r--r--Software/Visual_Studio/Tango.Core/ExtensionMethods/FrameworkElementExtensions.cs4
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs6
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs36
-rw-r--r--Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj6
17 files changed, 147 insertions, 18 deletions
diff --git a/Software/Android_Studio/ColorCapture/app/build.gradle b/Software/Android_Studio/ColorCapture/app/build.gradle
index b733330cc..ef4857b1d 100644
--- a/Software/Android_Studio/ColorCapture/app/build.gradle
+++ b/Software/Android_Studio/ColorCapture/app/build.gradle
@@ -6,8 +6,8 @@ android {
applicationId "com.twine.colorcapture"
minSdkVersion 22
targetSdkVersion 27
- versionCode 3
- versionName "1.3"
+ versionCode 4
+ versionName "1.4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
diff --git a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/MainActivityVM.java b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/MainActivityVM.java
index 72a088fa2..673146417 100644
--- a/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/MainActivityVM.java
+++ b/Software/Android_Studio/ColorCapture/app/src/main/java/com/twine/colorcapture/views/main/MainActivityVM.java
@@ -1,5 +1,7 @@
package com.twine.colorcapture.views.main;
+import android.os.Handler;
+
import com.squareup.otto.Bus;
import com.twine.colorcapture.dialogs.welcome.WelcomeDialog;
import com.twine.colorcapture.mvvm.RelayCommand;
@@ -85,9 +87,13 @@ public class MainActivityVM extends ViewModelBase<IMainActivity>
private void handleHowToUseCommand()
{
view.closeMenu();
- notificationProvider.showDialog(new WelcomeDialog(), (vm) ->
+
+ new Handler().postDelayed(() ->
{
- });
+ notificationProvider.showDialog(new WelcomeDialog(), (vm) ->
+ {
+ });
+ },300);
}
private void handleAboutCommand()
diff --git a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/side_menu.xml b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/side_menu.xml
index e5e15f4b7..3369f0a35 100644
--- a/Software/Android_Studio/ColorCapture/app/src/main/res/layout/side_menu.xml
+++ b/Software/Android_Studio/ColorCapture/app/src/main/res/layout/side_menu.xml
@@ -175,8 +175,8 @@
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginBottom="60dp"
- bind:text=" Get a twine TTCâ„¢ card"
- bind:textSize="@dimen/medium_font_size"
+ bind:text="Get a twine TTCâ„¢ card"
+ bind:textSize="@dimen/small_font_size"
bind:src="@drawable/icon_twine_card"
android:clickable="true" />
</RelativeLayout>
diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf
index e85b35642..6751ca940 100644
--- a/Software/DB/PPC/Tango.mdf
+++ b/Software/DB/PPC/Tango.mdf
Binary files differ
diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf
index 014618103..0f6384349 100644
--- a/Software/DB/PPC/Tango_log.ldf
+++ b/Software/DB/PPC/Tango_log.ldf
Binary files differ
diff --git a/Software/DB/TCC/TCC.mdf b/Software/DB/TCC/TCC.mdf
index beb586477..1782a99c7 100644
--- a/Software/DB/TCC/TCC.mdf
+++ b/Software/DB/TCC/TCC.mdf
Binary files differ
diff --git a/Software/DB/TCC/TCC_log.ldf b/Software/DB/TCC/TCC_log.ldf
index 9ebef8596..0044974e0 100644
--- a/Software/DB/TCC/TCC_log.ldf
+++ b/Software/DB/TCC/TCC_log.ldf
Binary files differ
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs
index 3b7c70bf8..e2c29cac5 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs
@@ -522,6 +522,8 @@ namespace Tango.PPC.Jobs.ViewModels
}
}
+ Job.LastUpdated = DateTime.UtcNow;
+ Job.JobStatus = BL.Enumerations.JobStatuses.Draft;
await _db.SaveChangesAsync();
RaiseMessage(new JobSavedMessage() { Job = Job });
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs
index 47d5835f5..b2f93c29d 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs
@@ -17,6 +17,7 @@ namespace Tango.PPC.Technician.ViewModels
{
private IOperationSystemManager _os;
private Timer _statsTimer;
+ private bool _resettingDevice;
private float _cpu;
public float CPU
@@ -39,6 +40,8 @@ namespace Tango.PPC.Technician.ViewModels
set { _temperature = value; RaisePropertyChangedAuto(); }
}
+ public RelayCommand ResetDeviceCommand { get; set; }
+
public RelayCommand RestartCommand { get; set; }
public RelayCommand ShutdownCommand { get; set; }
@@ -58,6 +61,27 @@ namespace Tango.PPC.Technician.ViewModels
ShutdownCommand = new RelayCommand(ShutdownSystem);
FactoryResetCommand = new RelayCommand(FactoryReset);
ExitToExplorerCommand = new RelayCommand(ExitToExplorer);
+ ResetDeviceCommand = new RelayCommand(ResetDevice, () => !_resettingDevice);
+ }
+
+ private async void ResetDevice()
+ {
+ try
+ {
+ _resettingDevice = true;
+ ResetDeviceCommand.RaiseCanExecuteChanged();
+ await MachineProvider.MachineOperator.ResetDFU();
+ await NotificationProvider.ShowInfo("Embedded device has been reset successfully.");
+ }
+ catch (Exception ex)
+ {
+ await NotificationProvider.ShowError(ex.FlattenMessage());
+ }
+ finally
+ {
+ _resettingDevice = false;
+ ResetDeviceCommand.RaiseCanExecuteChanged();
+ }
}
private async void FactoryReset()
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml
index 0b067b09b..d96da4f93 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml
@@ -50,7 +50,8 @@
</UniformGrid>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Width="300" TextElement.FontSize="{StaticResource TangoTitleFontSize}">
- <touch:TouchButton Command="{Binding RestartCommand}" Height="60" Background="{StaticResource TangoErrorBrush}">Restart Device</touch:TouchButton>
+ <touch:TouchButton Command="{Binding ResetDeviceCommand}" Height="60" Background="{StaticResource TangoErrorBrush}">Reset Machine</touch:TouchButton>
+ <touch:TouchButton Command="{Binding RestartCommand}" Height="60" Background="{StaticResource TangoErrorBrush}" Margin="0 20 0 0">Restart Device</touch:TouchButton>
<touch:TouchButton Command="{Binding ShutdownCommand}" Height="60" Background="{StaticResource TangoErrorBrush}" Margin="0 20 0 0">Shutdown Device</touch:TouchButton>
<touch:TouchButton Command="{Binding FactoryResetCommand}" Height="60" Background="{StaticResource TangoErrorBrush}" Margin="0 20 0 0">Factory Reset</touch:TouchButton>
<touch:TouchButton Command="{Binding ExitToExplorerCommand}" Height="60" Background="{StaticResource TangoErrorBrush}" Margin="0 20 0 0">Exit To Shell</touch:TouchButton>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs
index 7d4aa154e..1f09023cb 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs
@@ -45,7 +45,6 @@ namespace Tango.PPC.UI.Printing
/// <returns></returns>
public async Task<JobHandler> Print(Job job, ObservablesContext context)
{
-
JobHandler handler = null;
#if STUBPRINT
@@ -66,9 +65,25 @@ namespace Tango.PPC.UI.Printing
{
try
{
+ job.JobStatus = JobStatuses.Completed;
+
+ if (!context.IsDisposed)
+ {
+ await context.SaveChangesAsync();
+ }
+ else
+ {
+ using (var newContext = ObservablesContext.CreateDefault())
+ {
+ var newJob = newContext.Jobs.SingleOrDefault(y => y.Guid == job.Guid);
+ if (newJob != null)
+ {
+ newJob.JobStatus = JobStatuses.Completed;
+ await newContext.SaveChangesAsync();
+ }
+ }
+ }
- job.JobStatus = BL.Enumerations.JobStatuses.Completed;
- await context.SaveChangesAsync();
RaiseJobSaved(job);
}
catch (Exception ex)
@@ -76,12 +91,12 @@ namespace Tango.PPC.UI.Printing
LogManager.Log(ex, "Error occurred after job printing completed.");
}
};
- handler.Canceled += async (x, e) =>
+ handler.Canceled += (x, e) =>
{
try
{
//No change in status !
- await context.SaveChangesAsync();
+ //await context.SaveChangesAsync();
RaiseJobSaved(job);
}
catch (Exception ex)
@@ -94,8 +109,25 @@ namespace Tango.PPC.UI.Printing
try
{
- job.JobStatus = BL.Enumerations.JobStatuses.Disrupted;
- await context.SaveChangesAsync();
+ job.JobStatus = JobStatuses.Disrupted;
+
+ if (!context.IsDisposed)
+ {
+ await context.SaveChangesAsync();
+ }
+ else
+ {
+ using (var newContext = ObservablesContext.CreateDefault())
+ {
+ var newJob = newContext.Jobs.SingleOrDefault(y => y.Guid == job.Guid);
+ if (newJob != null)
+ {
+ newJob.JobStatus = JobStatuses.Disrupted;
+ await newContext.SaveChangesAsync();
+ }
+ }
+ }
+
RaiseJobSaved(job);
}
catch (Exception ex)
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest
index d72e75011..efc5f8179 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest
@@ -16,7 +16,7 @@
Remove this element if your application requires this virtualization for backwards
compatibility.
-->
- <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
+ <!--<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />-->
</requestedPrivileges>
</security>
</trustInfo>
diff --git a/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs b/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs
index de882c910..be5f5439f 100644
--- a/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs
+++ b/Software/Visual_Studio/Tango.BL/ObservablesContextExtension.cs
@@ -26,6 +26,11 @@ namespace Tango.BL
private DataSource _dataSource;
/// <summary>
+ /// Gets a value indicating whether this instance is disposed.
+ /// </summary>
+ public bool IsDisposed { get; private set; }
+
+ /// <summary>
/// Initializes a new instance of the <see cref="ObservablesContext"/> class.
/// </summary>
public ObservablesContext()
@@ -248,5 +253,18 @@ namespace Tango.BL
EntityFrameworkCache.Initialize(cache);
}
}
+
+ /// <summary>
+ /// Disposes the context. The underlying <see cref="T:System.Data.Entity.Core.Objects.ObjectContext" /> is also disposed if it was created
+ /// is by this context or ownership was passed to this context when this context was created.
+ /// The connection to the database (<see cref="T:System.Data.Common.DbConnection" /> object) is also disposed if it was created
+ /// is by this context or ownership was passed to this context when this context was created.
+ /// </summary>
+ /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
+ protected override void Dispose(bool disposing)
+ {
+ base.Dispose(disposing);
+ IsDisposed = true;
+ }
}
}
diff --git a/Software/Visual_Studio/Tango.Core/ExtensionMethods/FrameworkElementExtensions.cs b/Software/Visual_Studio/Tango.Core/ExtensionMethods/FrameworkElementExtensions.cs
index 6e9c11b03..7539deba2 100644
--- a/Software/Visual_Studio/Tango.Core/ExtensionMethods/FrameworkElementExtensions.cs
+++ b/Software/Visual_Studio/Tango.Core/ExtensionMethods/FrameworkElementExtensions.cs
@@ -454,7 +454,7 @@ public static class FrameworkElementExtensions
{
bool isLoaded = false;
- element.Loaded += (sender, e) =>
+ element.AddHandler(FrameworkElement.LoadedEvent, new RoutedEventHandler((x, y) =>
{
if (!isLoaded)
{
@@ -462,7 +462,7 @@ public static class FrameworkElementExtensions
handler(element, new EventArgs());
}
- };
+ }));
}
}
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs
index a5534a063..e110e6189 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs
@@ -359,6 +359,12 @@ namespace Tango.Integration.Operation
Task<StubFpgaWriteRegResponse> Reset();
/// <summary>
+ /// Resets the device through the DFU channel.
+ /// </summary>
+ /// <returns></returns>
+ Task ResetDFU();
+
+ /// <summary>
/// Upgrades the firmware.
/// </summary>
/// <param name="tfpStream">The TFP stream (Tango Firmware Package File).</param>
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
index 4047ae7a2..1f01c8873 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
@@ -34,6 +34,7 @@ using Tango.PMR.FirmwareUpgrade;
using Tango.Integration.Logging;
using Tango.Integration.JobRuns;
using Tango.FirmwareUpdateLib.WPF;
+using Tango.FirmwareUpdateLib;
namespace Tango.Integration.Operation
{
@@ -2267,6 +2268,41 @@ namespace Tango.Integration.Operation
}
/// <summary>
+ /// Resets the device through the DFU channel.
+ /// </summary>
+ /// <returns></returns>
+ public Task ResetDFU()
+ {
+ return Task.Factory.StartNew(() =>
+ {
+ LogManager.Log("Performing device reset through DFU...");
+
+ FirmwareUpdateManager updateManager = new FirmwareUpdateManager();
+
+ LogManager.Log("Initializing DFU API...");
+ updateManager.Initialize();
+
+ LogManager.Log("Enumerating DFU devices...");
+ var device = updateManager.GetAvailableDevices(false).Where(x => !x.DeviceName.Contains("In-Circuit Debug Interface")).FirstOrDefault();
+ if (device != null)
+ {
+ LogManager.Log($"DFU device found: '{device.DeviceName}'.");
+ LogManager.Log("Switching to DFU mode...");
+ device.SwitchToDFUMode();
+ Thread.Sleep(3000);
+ LogManager.Log("Resetting device...");
+ device.Reset();
+ Thread.Sleep(1000);
+ LogManager.Log("Reset completed.");
+ }
+ else
+ {
+ throw LogManager.Log(new Exception("DFU device not found."));
+ }
+ });
+ }
+
+ /// <summary>
/// Creates a storage manager for managing the machine file system.
/// </summary>
/// <returns></returns>
diff --git a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj
index 377cb04fb..b536b1281 100644
--- a/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj
+++ b/Software/Visual_Studio/Tango.Integration/Tango.Integration.csproj
@@ -73,6 +73,10 @@
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
+ <Reference Include="Tango.FirmwareUpdateLib, Version=1.0.6940.30509, Culture=neutral, processorArchitecture=x86">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\Build\Core\Debug\Tango.FirmwareUpdateLib.dll</HintPath>
+ </Reference>
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
@@ -180,7 +184,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