Table 7- 264 Registeronoperatingstatechangedcallback() - Native C - Siemens Simatic S7-1500 Function Manual

Hide thumbs Also See for Simatic S7-1500:
Table of Contents

Advertisement

User interfaces (API)
7.6 API IInstances
RegisterOnOperatingStateChangedCallback()
When the event occurs, the registered callback function is called. Only one callback function
can be registered for the event. Registering a new callback function causes the previous
callback function to be deleted.

Table 7- 264 RegisterOnOperatingStateChangedCallback() - Native C++

Syntax
Parameters
Return values
Note
RegisterOnOperatingStateChangedEvent()
When the event occurs, the registered event object is set to the signaled state. Only one
event object can be registered for the event. Registering a new event object causes the
previous event object to be deleted.
Table 7- 265 RegisterOnOperatingStateChangedEvent() - Native C++
Syntax
Parameters
Return values
Example C++
244
void RegisterOnOperatingStateChangedCallback(
EventCallback_II_SREC_ST_SROS_SROS in_CallbackFunction
);
EventCallback_II_SREC_ST_SROS_SROS in_CallbackFunction:
A callback function that subscribes to the event.
See EventCallback_II_SREC_ST_SROS_SROS (Page 282).
None
The callback function runs in a separate thread.
void RegisterOnOperatingStateChangedEvent();
void RegisterOnOperatingStateChangedEvent(
HANDLE* in_Event
);
None:
An internal event object is registered.
HANDLE* in_Event:
A handle for a user-specific event object. The event object is registered.
None
// Thread 1 --------------------------------------------------
ISimulationRuntimeManager * api = NULL;
ERuntimeErrorCode result = Initialize(&api);
IInstance* psa = NULL;
if (result == SREC_OK)
{
result = api->RegisterInstance(&psa);
}
// Register the internal event object
RegisterOnOperatingStateChangedEvent
psa->
// Thread 2 --------------------------------------------------
while (condition)
{
// Wait for the event to be set (timeout after 10s)
bool isEventSet = psa-
>WaitForOnOperatingStateChangedEvent(10000);
if (isEventSet)
{
// Do Something
...
}
}
();
S7-PLCSIM Advanced
Function Manual, 12/2017, A5E37039512-AB

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents