private DeviceModel GetDeviceModel(string id, Services.Models.Simulation.DeviceModelOverride overrides) { var modelDef = new DeviceModel(); if (id.ToLowerInvariant() != DeviceModels.CUSTOM_DEVICE_MODEL_ID.ToLowerInvariant()) { try { var task = this.deviceModels.GetAsync(id); task.Wait(TimeSpan.FromSeconds(30)); modelDef = task.Result; } catch (AggregateException ae) { throw new ExternalDependencyException("Unable to load device model", ae.InnerException); } } else { modelDef.Id = DeviceModels.CUSTOM_DEVICE_MODEL_ID; modelDef.Name = DeviceModels.CUSTOM_DEVICE_MODEL_ID; modelDef.Description = "Simulated device with custom list of sensors"; } return(this.deviceModelsOverriding.Generate(modelDef, overrides)); }
private DeviceModel GetDeviceModel(string id, Services.Models.Simulation.DeviceModelOverride overrides) { var modelDef = new DeviceModel(); if (id.ToLowerInvariant() != DeviceModels.CUSTOM_DEVICE_MODEL_ID.ToLowerInvariant()) { modelDef = this.deviceModels.Get(id); } else { modelDef.Id = DeviceModels.CUSTOM_DEVICE_MODEL_ID; modelDef.Name = DeviceModels.CUSTOM_DEVICE_MODEL_ID; modelDef.Description = "Simulated device with custom list of sensors"; } return(this.deviceModelsOverriding.Generate(modelDef, overrides)); }