public TheSensorMeta GetSensorMeta() { var sensorMetaProp = this.GetProperty(strSensor); var rangeMinProp = sensorMetaProp?.GetProperty(nameof(TheSensorMeta.RangeMin)); var rangeMaxProp = sensorMetaProp?.GetProperty(nameof(TheSensorMeta.RangeMax)); var sensorMeta = new TheSensorMeta { SourceType = TheCommonUtils.CStrNullable(sensorMetaProp?.GetProperty(nameof(TheSensorMeta.SourceType))), Units = TheCommonUtils.CStrNullable(sensorMetaProp?.GetProperty(nameof(TheSensorMeta.Units))), SourceUnits = TheCommonUtils.CStrNullable(sensorMetaProp?.GetProperty(nameof(TheSensorMeta.SourceUnits))), RangeMin = rangeMinProp != null ? (double?)TheCommonUtils.CDbl(rangeMinProp) : null, RangeMax = rangeMaxProp != null ? (double?)TheCommonUtils.CDbl(rangeMaxProp) : null, Description = TheCommonUtils.CStrNullable(sensorMetaProp?.GetProperty(nameof(TheSensorMeta.Description))), FriendlyName = TheCommonUtils.CStrNullable(sensorMetaProp?.GetProperty(nameof(TheSensorMeta.FriendlyName))), SemanticTypes = TheCommonUtils.CStrNullable(sensorMetaProp?.GetProperty(nameof(TheSensorMeta.SemanticTypes))), ExtensionData = ReadDictionaryFromProperties(sensorMetaProp, TheSensorMeta.KnownProperties), }; return(sensorMeta); }
public TheProviderInfo GetSensorProviderInfo() { var providerInfoProp = this.GetProperty(strSource); var subscriptionId = TheCommonUtils.CGuid(providerInfoProp?.GetProperty(nameof(TheThing.TheSensorSubscription.SubscriptionId), false)); var providerInfo = new TheProviderInfo { ProviderMid = TheCommonUtils.CGuidNullable(providerInfoProp?.GetProperty(nameof(TheProviderInfo.ProviderMid), false)), Subscription = new TheThing.TheSensorSubscription { SensorId = TheCommonUtils.CStrNullable(providerInfoProp?.GetProperty(nameof(TheThing.TheSensorSubscription.SensorId), false)), SampleRate = TheCommonUtils.CIntNullable(providerInfoProp?.GetProperty(nameof(TheThing.TheSensorSubscription.SampleRate), false)), SubscriptionId = subscriptionId != Guid.Empty ? subscriptionId : this.cdeMID, TargetThing = new TheThingReference(this.OwnerThing), TargetProperty = cdeP.GetPropertyPath(this), ExtensionData = ReadDictionaryFromProperties(providerInfoProp, TheProviderInfo.KnownProperties), } }; return(providerInfo); }