aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-02-18 16:58:37 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-02-18 16:58:37 +0200
commit473d878e3ae795201223b160fcbc1147e901b038 (patch)
treefaedd2a3fa181deb297ec2232a171289161738f7 /Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup
parentccc6add5ea66565453283d7df0f6fbf2324b9264 (diff)
downloadTango-473d878e3ae795201223b160fcbc1147e901b038.tar.gz
Tango-473d878e3ae795201223b160fcbc1147e901b038.zip
Working on PPC versioning services...
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs31
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupRequest.cs14
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupResponse.cs28
3 files changed, 28 insertions, 45 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs
index 488206590..b5140e336 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs
@@ -22,6 +22,7 @@ using Tango.PPC.Common.Connection;
using Tango.PPC.Common.OS;
using Tango.PPC.Common.RemoteAssistance;
using Tango.PPC.Common.UWF;
+using Tango.PPC.Common.Web;
using Tango.Settings;
using Tango.SharedUI.Helpers;
using Tango.SQLExaminer;
@@ -39,6 +40,7 @@ namespace Tango.PPC.Common.MachineSetup
private IRemoteAssistanceProvider _remoteAssistance;
private IUnifiedWriteFilterManager _uwf;
private IOperationSystemManager _windows_manager;
+ private String _accessToken;
#region Events
@@ -80,6 +82,27 @@ namespace Tango.PPC.Common.MachineSetup
#endregion
+ #region Private Methods
+
+ private Task Login(String serialNumber)
+ {
+ return Task.Factory.StartNew(() =>
+ {
+ using (var client = new PPCWebService())
+ {
+ var response = client.Login(new LoginRequest()
+ {
+ Mode = LoginMode.Machine,
+ SerialNumber = serialNumber,
+ }).Result;
+
+ _accessToken = response.AccessToken;
+ }
+ });
+ }
+
+ #endregion
+
#region Public Methods
/// <summary>
@@ -105,16 +128,18 @@ namespace Tango.PPC.Common.MachineSetup
LogManager.Log($"Connecting to machine service on {machineServiceAddress}...");
+ await Login(serialNumber);
+
MachineSetupRequest request = new MachineSetupRequest();
- request.SerialNumber = serialNumber;
+ request.AccessToken = _accessToken;
MachineSetupResponse setup_response = null;
try
{
- using (var http = new WebTransportClient())
+ using (var client = new PPCWebService())
{
- setup_response = await http.PostJson<MachineSetupRequest, MachineSetupResponse>(machineServiceAddress + "/api/PPC/MachineSetup", request);
+ setup_response = await client.MachineSetup(request);
}
}
catch (Exception ex)
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupRequest.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupRequest.cs
deleted file mode 100644
index 4c8039544..000000000
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupRequest.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Tango.Transport.Web;
-
-namespace Tango.PPC.Common.MachineSetup
-{
- public class MachineSetupRequest : WebRequestMessage
- {
- public String SerialNumber { get; set; }
- }
-}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupResponse.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupResponse.cs
deleted file mode 100644
index 5e8885af7..000000000
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupResponse.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Tango.Core;
-using Tango.Transport.Web;
-
-namespace Tango.PPC.Common.MachineSetup
-{
- public class MachineSetupResponse : WebResponseMessage
- {
- public String Version { get; set; }
-
- public String BlobAddress { get; set; }
-
- public DataSource DataSource { get; set; }
-
- public String OSKey { get; set; }
-
- public bool SetupActivation { get; set; }
- public bool SetupRemoteAssistance { get; set; }
- public bool SetupUWF { get; set; }
- public bool SetupFirmware { get; set; }
- public bool SetupFPGA { get; set; }
- public bool IsDemo { get; set; }
- }
-}