System Monitor C API

The features of the System Monitor in the C++ API are not provided through a SystemMonitor abstraction in the C API but directly provided through the SilKit_Participant.

SilKit_ReturnCode SilKit_SystemMonitor_Create(SilKit_SystemMonitor **outSystemMonitor, SilKit_Participant *participant)

Create a system monitor at this SIL Kit simulation participant.

The object returned must not be deallocated using free()!

Parameters
  • outSystemMonitor – Pointer that refers to the resulting sytem monitor (out parameter).

  • participant – The simulation participant at which the system monitor should be created.

SilKit_ReturnCode SilKit_SystemMonitor_AddSystemStateHandler(SilKit_SystemMonitor *systemMonitor, void *context, SilKit_SystemStateHandler_t handler, SilKit_HandlerId *outHandlerId)

Register a callback for system state changes.

If the current SystemState is not SilKit_SystemState_Invalid, the handler will be called immediately.

Parameters
  • systemMonitor – The system monitor obtained via SilKit_SystemMonitor_Create.

  • context – The user context pointer made available to the handler.

  • handler – The handler to be called to be called when the SilKit_SystemState changes.

  • outHandlerId – The handler identifier that can be used to remove the callback.

SilKit_ReturnCode SilKit_SystemMonitor_AddParticipantStatusHandler(SilKit_SystemMonitor *systemMonitor, void *context, SilKit_ParticipantStatusHandler_t handler, SilKit_HandlerId *outHandlerId)

Register a callback for status changes of participants.

The handler will be called immediately for any participant that is not in SilKit_ParticipantState_Invalid.

Parameters
  • systemMonitor – The system monitor obtained via SilKit_SystemMonitor_Create.

  • context – The user context pointer made available to the handler.

  • handler – The handler to be called to be called when the participant status changes.

  • outHandlerId – The handler identifier that can be used to remove the callback.

SilKit_ReturnCode SilKit_SystemMonitor_RemoveSystemStateHandler(SilKit_SystemMonitor *systemMonitor, SilKit_HandlerId handlerId)

Remove a SilKit_SystemStateHandler_t by SilKit_HandlerId on this participant.

Parameters
  • systemMonitor – The system monitor obtained via SilKit_SystemMonitor_Create.

  • handlerId – Identifier of the callback to be removed. Obtained upon adding to respective handler.

SilKit_ReturnCode SilKit_SystemMonitor_RemoveParticipantStatusHandler(SilKit_SystemMonitor *systemMonitor, SilKit_HandlerId handlerId)

Remove a SilKit_ParticipantStatusHandler_t by SilKit_HandlerId on this participant.

Parameters
  • systemMonitor – The system monitor obtained via SilKit_SystemMonitor_Create.

  • handlerId – Identifier of the callback to be removed. Obtained upon adding to respective handler.

SilKit_ReturnCode SilKit_SystemMonitor_GetParticipantStatus(SilKit_ParticipantStatus *outParticipantState, SilKit_SystemMonitor *systemMonitor, const char *participantName)

Get the current participant state of the participant given by participantName (UTF-8)

SilKit_ReturnCode SilKit_SystemMonitor_GetSystemState(SilKit_SystemState *outSystemState, SilKit_SystemMonitor *systemMonitor)

Get the current SilKit_SystemState.