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); }
public TheOPCSensorSubscription(TheThing.TheSensorSubscription baseSubscription) : base(baseSubscription) { if (baseSubscription.ExtensionData != null) { if (baseSubscription.ExtensionData.TryGetValue(nameof(QueueSize), out var queueSize)) { QueueSize = TheCommonUtils.CIntNullable(queueSize); ExtensionData.Remove(nameof(QueueSize)); } if (baseSubscription.ExtensionData.TryGetValue(nameof(ChangeTrigger), out var changeTrigger)) { ChangeTrigger = TheCommonUtils.CIntNullable(changeTrigger); ExtensionData.Remove(nameof(ChangeTrigger)); } if (baseSubscription.ExtensionData.TryGetValue(nameof(DeadbandValue), out var deadbandValue)) { DeadbandValue = TheCommonUtils.CIntNullable(deadbandValue); ExtensionData.Remove(nameof(DeadbandValue)); } if (baseSubscription.ExtensionData.TryGetValue(nameof(HistoryStartTime), out var historyStartTime)) { HistoryStartTime = TheCommonUtils.CDateNullable(historyStartTime); ExtensionData.Remove(nameof(HistoryStartTime)); } if (baseSubscription.ExtensionData.TryGetValue(nameof(EventInfo), out var eventInfo)) { if (eventInfo is TheEventSubscription) { EventInfo = eventInfo as TheEventSubscription; } else { EventInfo = TheCommonUtils.DeserializeJSONStringToObject <TheEventSubscription>(eventInfo?.ToString()); } ExtensionData.Remove(nameof(EventInfo)); } } }