API This method is used to issue an event from a COM client like the HMI program to the TcEventLogger. HRESULT ReportEvent([in] SAFEARRAY(VARIANT)* eventHead, [in] SAFEARRAY(VARIANT)* eventData) ); Parameters eventHead [in] Pointer to a safearray with the bounds 0 to 9 that represents the event header. The array represents the same information as TcEventHeader. The items of the array are explained in the following table eventData [in] A pointer to a safe array that represents the event arguments. In the configuration of the event formatter, it's defined how to place the event arguments into the displayed event message. The following data types are supported by the standard formatter.
int (16bit), long (32bit), float(32bit), double(64bit), string(BSTR) Return Values S_OK Function was successfully called TCEVENTERR_ISSIGNALED The event with this source id and event id was already signaled. Visual Basic sample code ' get the one and only event logger Dim evtLogger As TCEVENTLOGGERLib.TcEventLog Set evtLogger = New TCEVENTLOGGERLib.TcEventLog ' create event header Dim arrHeader(0 To 9) As Variant arrHeader(0) = TcEventClass.TCEVENTCLASS_ALARM ' event class arrHeader(1) = TcEventPriority.TCEVENTPRIO_IMPLICIT ' event priority arrHeader(2) = TcEventFlags.TCEVENTFLAG_LOG ' event flags arrHeader(3) = 0 'user data arrHeader(4) = 1 ' event id TcEventLogger 130 Version:
1.1 index TcEventHeader [} 181] item DataType Description 0 nClass TcEventClass [} 179] The class of the event, like alarm, warning, hint 1 nPriority TcEventPriority [} 180] (long) The event priority. Since now the priority is always: TcEventPriority.TCEVENTPRIO IMPLICIT=0 _ 2 dwFlags TcEventFlags [} 180] (long) The flags control the behavior of the alarm. That could be combined by an OR junction. 3 dwUserData long A spare variable that can be used by the user. 4 nId long The event id, that unique represents this type of event for this one Event Source.
5 nInvokeId long 6 fDate VARIANT-DATE The date and time when this event occur 7 nMs long The millisecond part of the event date 8 varSource variant The source id source name. The event source is used to distinguish different device. Like I/O Event, or different parts of the PLC program. 9 szFmtProgId BSTR string The PrgId of the formatter. If we want to use the standard XML formatter the string should be set to "TcEventFormatter.TcXmlFormatter"