protected override TamperingDetectorAlarmSnapshot Parse(TopicExpressionType topic, Message message) { if (message.source == null || message.source.simpleItem == null) { throw new InvalidOperationException(); } string topicText = topic.Any[0].InnerText; TamperingDetectorAlarms type = topics[topicText]; bool state = false; var data = message.data; if (data.simpleItem != null) { foreach (var si in data.simpleItem) { if (si.name == "State") { si.value.TryParseInvariant(out state); } } } var snapshot = new TamperingDetectorAlarmSnapshot { Type = type, State = state }; return(snapshot); }
public TamperingDetectorAlarm(TamperingDetectorAlarms type) { this.Type = type; }