diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-10-27 12:09:07 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-10-27 12:09:07 +0200 |
| commit | 312e8ccad554d6d0e7d21444e069731e770db978 (patch) | |
| tree | d20a3657dab87de400675f5f8aca77c0f124b2bd /Software/Visual_Studio/Web/Tango.MachineService/Controllers | |
| parent | 4954a924b8a5b8fd7a213a444027e74b936359be (diff) | |
| download | Tango-312e8ccad554d6d0e7d21444e069731e770db978.tar.gz Tango-312e8ccad554d6d0e7d21444e069731e770db978.zip | |
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.
Diffstat (limited to 'Software/Visual_Studio/Web/Tango.MachineService/Controllers')
| -rw-r--r-- | Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs | 29 |
1 files changed, 27 insertions, 2 deletions
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; + } } } |
