msWaitEvent (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

NX-200, LX2

Firmware version:

1.50.00


Wait until an event has occurred and return the given type of event or return from a timeout.

 

The event types possible:

 

Define

Value

Description

_MS_EVENT_TIMEOUT

1

Timeout reached.

_MS_EVENT_LOGGER_LEVEL

2

Logger reached watermark level.

_MS_EVENT_LOGGER_FULL

3

Logger is full.

_MS_EVENT_LOGGER_STOPPED

4

Logger was stopped.

_MS_EVENT_LOGGER_STARTED

5

Logger was started.

_MS_EVENT_LOGGER_SWITCHED

6

A switch of loggers occurred.

_MS_EVENT_SHOCK

7

A shock event occurred.

_MS_EVENT_ACCELERATION

8

An acceleration event occurred.

 

Input:

Timeout : DINT (default -1)

The timeout in seconds before returning if no event was detected in the given time. -1 to disable the timeout.

 

Returns: INT

>0

- Event type that occurred. If there is already events on the event queue, the oldest event type is returned.

0

- This function is not supported.

-1

- Interface is not open. Call msOpen first.

-2

- Generic error.

-3

- Invalid configuration.

-19

- Event handling error.

-21

- Event queue overflow.

 

 

Declaration

FUNCTION msWaitEvent : INT;
VAR_INPUT
  Timeout : DINT := -1;
END_VAR;
 

Example:

// For a more complete example, see example under msReadEvent

  ...
  rc := msWaitEvent();
  IF rc < 0 THEN
    DebugFmt(message:="msWaitEvent error (rc=\1)", v1:=rc);
  END_IF;
  ...