示例#1
0
        /// <summary>
        /// Converts a ONEVENTSTRUCT struct to a EventNotification object.
        /// </summary>
        internal static EventNotification GetEventNotification(OpcRcw.Ae.ONEVENTSTRUCT input)
        {
            EventNotification output = new EventNotification();

            output.SourceID         = input.szSource;
            output.Time             = OpcCom.Interop.GetFILETIME(Convert(input.ftTime));
            output.Severity         = input.dwSeverity;
            output.Message          = input.szMessage;
            output.EventType        = (EventType)input.dwEventType;
            output.EventCategory    = input.dwEventCategory;
            output.ChangeMask       = input.wChangeMask;
            output.NewState         = input.wNewState;
            output.Quality          = new Opc.Da.Quality(input.wQuality);
            output.ConditionName    = input.szConditionName;
            output.SubConditionName = input.szSubconditionName;
            output.AckRequired      = input.bAckRequired != 0;
            output.ActiveTime       = OpcCom.Interop.GetFILETIME(Convert(input.ftActiveTime));
            output.Cookie           = input.dwCookie;
            output.ActorID          = input.szActorID;

            object[] attributes = OpcCom.Interop.GetVARIANTs(ref input.pEventAttributes, input.dwNumEventAttrs, false);

            output.SetAttributes(attributes);

            return(output);
        }
示例#2
0
        internal static EventNotification GetEventNotification(ONEVENTSTRUCT input)
        {
            EventNotification eventNotification = new EventNotification();

            eventNotification.SourceID         = input.szSource;
            eventNotification.Time             = OpcCom.Interop.GetFILETIME(Convert(input.ftTime));
            eventNotification.Severity         = input.dwSeverity;
            eventNotification.Message          = input.szMessage;
            eventNotification.EventType        = (EventType)input.dwEventType;
            eventNotification.EventCategory    = input.dwEventCategory;
            eventNotification.ChangeMask       = input.wChangeMask;
            eventNotification.NewState         = input.wNewState;
            eventNotification.Quality          = new Quality(input.wQuality);
            eventNotification.ConditionName    = input.szConditionName;
            eventNotification.SubConditionName = input.szSubconditionName;
            eventNotification.AckRequired      = (input.bAckRequired != 0);
            eventNotification.ActiveTime       = OpcCom.Interop.GetFILETIME(Convert(input.ftActiveTime));
            eventNotification.Cookie           = input.dwCookie;
            eventNotification.ActorID          = input.szActorID;
            object[] vARIANTs = OpcCom.Interop.GetVARIANTs(ref input.pEventAttributes, input.dwNumEventAttrs, deallocate: false);
            eventNotification.SetAttributes(vARIANTs);
            return(eventNotification);
        }
示例#3
0
        internal static EventNotification GetEventNotification(ONEVENTSTRUCT input)
        {
            EventNotification notification = new EventNotification {
                SourceID         = input.szSource,
                Time             = OpcCom.Interop.GetFILETIME(Convert(input.ftTime)),
                Severity         = input.dwSeverity,
                Message          = input.szMessage,
                EventType        = (EventType)input.dwEventType,
                EventCategory    = input.dwEventCategory,
                ChangeMask       = input.wChangeMask,
                NewState         = input.wNewState,
                Quality          = new Quality(input.wQuality),
                ConditionName    = input.szConditionName,
                SubConditionName = input.szSubconditionName,
                AckRequired      = input.bAckRequired != 0,
                ActiveTime       = OpcCom.Interop.GetFILETIME(Convert(input.ftActiveTime)),
                Cookie           = input.dwCookie,
                ActorID          = input.szActorID
            };

            object[] attributes = OpcCom.Interop.GetVARIANTs(ref input.pEventAttributes, input.dwNumEventAttrs, false);
            notification.SetAttributes(attributes);
            return(notification);
        }