Go to the documentation of this file.00001 """
00002 This file contains event types as Python objects.
00003
00004 TODO: This should be auto-generated but is not!!!!!
00005
00006 """
00007
00008 from opcua import ua
00009 from opcua.common.events import Event
00010
00011
00012 class BaseEvent(Event):
00013 """
00014 BaseEvent implements BaseEventType from which inherit all other events and it is used per default.
00015 """
00016 def __init__(self, sourcenode=None, message=None, severity=1):
00017 Event.__init__(self)
00018 self.add_property("EventId", bytes(), ua.VariantType.ByteString)
00019 self.add_property("EventType", ua.NodeId(ua.ObjectIds.BaseEventType), ua.VariantType.NodeId)
00020 self.add_property("SourceNode", sourcenode, ua.VariantType.NodeId)
00021 self.add_property("SourceName", None, ua.VariantType.String)
00022 self.add_property("Time", None, ua.VariantType.DateTime)
00023 self.add_property("ReceiveTime", None, ua.VariantType.DateTime)
00024 self.add_property("LocalTime", None, ua.VariantType.DateTime)
00025 self.add_property("Message", ua.LocalizedText(message), ua.VariantType.LocalizedText)
00026 self.add_property("Severity", severity, ua.VariantType.UInt16)
00027
00028
00029 class AuditEvent(BaseEvent):
00030 """
00031 Audit implements AuditEventType from which inherit all other Audit events.
00032 """
00033 def __init__(self, sourcenode=None, message=None, severity=1):
00034 super(AuditEvent, self).__init__(sourcenode, message, severity)
00035 self.EventType = ua.NodeId(ua.ObjectIds.AuditEventType)
00036 self.add_property("ActionTimeStamp", None, ua.VariantType.DateTime)
00037 self.add_property("Status", False, ua.VariantType.Boolean)
00038 self.add_property("ServerId", None, ua.VariantType.String)
00039 self.add_property("ClientAuditEntryId", None, ua.VariantType.String)
00040 self.add_property("ClientUserId", None, ua.VariantType.String)
00041
00042
00043 IMPLEMENTED_EVENTS = {
00044 ua.ObjectIds.BaseEventType: BaseEvent,
00045 ua.ObjectIds.AuditEventType: AuditEvent,
00046 }