// Map service model to API model public static DeviceModelTelemetryOverride FromServiceModel(Simulation.DeviceModelTelemetryOverride value) { if (value == null) { return(null); } return(new DeviceModelTelemetryOverride { Interval = value.Interval?.ToString("c"), MessageTemplate = !string.IsNullOrEmpty(value.MessageTemplate) ? value.MessageTemplate : null, MessageSchema = DeviceModelTelemetryMessageSchemaOverride.FromServiceModel(value.MessageSchema) }); }
// Map API model to service model public Simulation.DeviceModelTelemetryOverride ToServiceModel() { if (this.IsEmpty()) { return(null); } var result = new Simulation.DeviceModelTelemetryOverride { MessageTemplate = !string.IsNullOrEmpty(this.MessageTemplate) ? this.MessageTemplate : null, MessageSchema = this.MessageSchema?.ToServiceModel() }; if (!string.IsNullOrEmpty(this.Interval)) { result.Interval = TimeSpan.Parse(this.Interval); } return(result); }
private Simulation.DeviceModelTelemetryOverride GetDeviceModelTelemetryOverride() { var telemetryOverride = new Simulation.DeviceModelTelemetryOverride(); return(telemetryOverride); }