GenericEvent.Set method doesn't work
Posted: 04 Jul 2017, 13:44
Hello,
I'm running .NET SDK 2.5.3, UADemoServer, and I'm trying to understand how to set the specific fields of an event. In the DemoServer the procedure is the following one:
I have subscribed to the object that generates the events with UaExpert but when I look at the details of the event no one of the fields set with the GenericEvent.Set method is in the list, there are only the generic fields (EventID, EventType, SourceNode, SourceName, Severity, Message).
I also tried to do: immediately after the Set instruction and it returned me a null.
I'm running .NET SDK 2.5.3, UADemoServer, and I'm trying to understand how to set the specific fields of an event. In the DemoServer the procedure is the following one:
Code: Select all
GenericEvent e = new GenericEvent(Server.FilterManager);
sourceId = new NodeId(Demo.Model.Variables.Demo_Events_Trigger_SampleEvent, DefaultNamespaceIndex);
e.Initialize(
null,
new NodeId(1005, DefaultNamespaceIndex),
sourceId,
"SampleEventNotifier",
EventSeverity.Medium,
new LocalizedText("A sample event event."));
e.Set("2:Boolean", m_generator.GetRandom<bool>(false));
e.Set("2:SByte", m_generator.GetRandom<sbyte>(false));
e.Set("2:Byte", m_generator.GetRandom<byte>(false));
e.Set("2:Int16", m_generator.GetRandom<short>(false));
e.Set("2:UInt16", m_generator.GetRandom<ushort>(false));
e.Set("2:Int32", m_generator.GetRandom<int>(false));
e.Set("2:UInt32", m_generator.GetRandom<uint>(false));
e.Set("2:Int64", m_generator.GetRandom<long>(false));
e.Set("2:UInt64", m_generator.GetRandom<ulong>(false));
e.Set("2:Float", m_generator.GetRandom<float>(false));
e.Set("2:Double", m_generator.GetRandom<double>(false));
e.Set("2:String", m_generator.GetRandom<string>(false));
e.Set("2:ByteString", m_generator.GetRandom<byte[]>(false));
e.Set("2:DateTime", m_generator.GetRandom<DateTime>(false));
e.Set("2:Guid", m_generator.GetRandom<Uuid>(false));
e.Set("2:NodeId", m_generator.GetRandom<NodeId>(false));
e.Set("2:ExpandedNodeId", m_generator.GetRandom<ExpandedNodeId>(false));
e.Set("2:QualifiedName", m_generator.GetRandom<QualifiedName>(false));
e.Set("2:LocalizedText", m_generator.GetRandom<LocalizedText>(false));
e.Set("2:ServiceResult", m_generator.GetRandom<StatusCode>(false));
e.Set("2:XmlElement", m_generator.GetRandom<XmlElement>(false));
I also tried to do:
Code: Select all
var test = e.Get("2:Boolean");