From 312e8ccad554d6d0e7d21444e069731e770db978 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Sun, 27 Oct 2019 12:09:07 +0200 Subject: Added DEVICE_ID, DEVICE_NAME & IS_DEVICE_REGISTERED fields to db. Prevent multiple machine setup from different devices. Moved notification to inner layout on PPC. Improved PPC notification bar. Added more machine status support from embedded. FIxed issue with external bridge and emergency pressed. --- .../Controllers/PPCController.cs | 29 ++++++++++++++++++++-- .../Properties/PublishProfiles/Development.pubxml | 18 +++++++++++++- 2 files changed, 44 insertions(+), 3 deletions(-) (limited to 'Software/Visual_Studio/Web/Tango.MachineService') diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs index 6f5eed749..d8dc4a7b8 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs +++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs @@ -74,11 +74,32 @@ namespace Tango.MachineService.Controllers throw new AuthenticationException("The specified serial number could not be found."); } - if (machine.SetupActivation && machine.OsKey == null) + if (machine.SetupActivation && String.IsNullOrWhiteSpace(machine.OsKey)) { throw new InvalidDataException("The specified machine is configured to perform an OS activation but is not associated with an OS activation key."); } + if (String.IsNullOrWhiteSpace(request.DeviceID)) + { + throw new InvalidDataException("Device id not set."); + } + + if (String.IsNullOrWhiteSpace(request.DeviceName)) + { + throw new InvalidDataException("Device name not set."); + } + + if (machine.IsDeviceRegistered && machine.DeviceId != request.DeviceID) + { + throw new InvalidDataException("The specified machine is already registered and device id is invalid."); + } + + machine.DeviceName = request.DeviceName; + machine.DeviceId = request.DeviceID; + machine.IsDeviceRegistered = true; + + db.SaveChanges(); + var machine_version = db.MachineVersions.SingleOrDefault(x => x.Guid == machine.MachineVersionGuid); var latest_machine_version = db.TangoVersions.Where(x => x.MachineVersionGuid == machine_version.Guid).ToList().OrderByDescending(x => Version.Parse(x.Version)).FirstOrDefault(); @@ -122,7 +143,6 @@ namespace Tango.MachineService.Controllers response.SetupUWF = machine.SetupUwf; response.SetupFirmware = machine.SetupFirmware; response.IsDemo = machine.IsDemo; - } return response; @@ -216,6 +236,11 @@ namespace Tango.MachineService.Controllers } response.Version = latest_machine_version.Version; + + if (machine.ForceVersionUpdate) + { + response.IsUpdateAvailable = true; + } } } diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Properties/PublishProfiles/Development.pubxml b/Software/Visual_Studio/Web/Tango.MachineService/Properties/PublishProfiles/Development.pubxml index 5fb79879e..60d445532 100644 --- a/Software/Visual_Studio/Web/Tango.MachineService/Properties/PublishProfiles/Development.pubxml +++ b/Software/Visual_Studio/Web/Tango.MachineService/Properties/PublishProfiles/Development.pubxml @@ -9,7 +9,7 @@ by editing this MSBuild file. In order to learn more about this please visit htt /subscriptions/10c8aa60-3b15-4e0d-b412-6aeef90e5e91/resourceGroups/Tango/providers/Microsoft.Web/sites/machineservice/slots/MachineService-DEV Tango AzureWebSite - Release + Debug Any CPU http://machineservice-machineservice-dev.azurewebsites.net True @@ -24,5 +24,21 @@ by editing this MSBuild file. In order to learn more about this please visit htt $machineservice__MachineService-DEV <_SavePWD>True <_DestinationType>AzureWebSite + + + + + + + + + + + + + + + <_ConnectionStringsToInsert Include="Tango.BL.ObservablesContext" /> + \ No newline at end of file -- cgit v1.3.1