This function adds an event to the PI2 event queue or the PI3 message log. The event contents/message must be passed. A timeout is available to avoid waiting too long.

C format

int32 piel_addevnt(

int32 PIPTR * time

int32 PIPTR * number,

int32 group,

int32 type,

char PIPTR * msg,

int32 timeout );



System error



Illegal time


Illegal type


Illegal group


Illegal length


Illegal timeout


Input buffer error or unsupported action



-10008 Unsupported call (PI API 2016 or later)


time (passed, returned)

Event time (0 to use system time)

number (returned)

Event number that the event logger assigns to the event message

group (passed)

Event group (valid values are 0-1000)

type (passed)

Event type (valid values are 0-1000)

msg (passed)

Message string, null terminated

timeout (passed)

Timeout period for specified action in seconds

Usage Notes

Use of this routine requires that the size of the Event Logger Archives be increased to 16 MB. This requires an upgrade from OSI.

See the Extended PI-API topic for more information.

PI API 2016 for Windows Integrated Security

piel_addevnt() is not supported and will return -10008 (Unsupported call).



The following sample code shows a typical call to piel_addevnt, which uses the current system time for the event by setting time to 0.


int32 status,

time = 0,  /* default to system time */

number = 0, /* event record number returned */

group = 14, /* event group number */

type = 14,  /* event type */

timeout = 5; /* seconds */


char PIPTR *msg = "Test Message for the Event Logger";


status = piel_addevnt( &time, &number, group, type, msg, timeout );

Enabling Operational Intelligence