ClearExternalEvents Method Implementation Notes

ClearExternalEvents Action (optional)

  • Action Name: ClearExternalEvents
  • Action Parameters: A JSON encoded string containing an array of SafetyEvent.Id string event ID values.
  • Returns: string.Empty
Examples of serialised SafetyEvent.Id string arrays
// Example 1 - Clear one event
[
    "F9D431A2-3FE6-46BE-B7C0-53EA34948934"
]

// Example 2 - Clear two events
[
    "F9D431A2-3FE6-46BE-B7C0-53EA34948934",
    "8C528476-658E-49D3-9CD0-D772F3451DA2"
]

The response has been whitespace formatted for readability, but the actual response should be a single line of JSON text without unnecessary whitespace.

Alpaca Clients and Devices

Alpaca clients must send an HTTP PUT request to the safety monitor's action endpoint as described here: Alpaca Action Endpoint with application/x-www-form-urlencoded body parameters:

  • ActionName = "ClearExternalEvents"
  • ActionParameters = A string containing a JSON encoded array of string SafetyEvent.Id event ID values.

Alpaca devices must return a standard Alpaca response object with:

  • Value = "" and ErrorNumber = 0 if the request was successful
  • Value = "" and ErrorNumber ≠ 0 and a descriptive ErrorMessage if they cannot complete the request.
Example of an Alpaca ClearExternalEvents Action JSON response
{
    "Value":"",
    "ClientTransactionID":66,
    "ServerTransactionID":428,
    "ErrorNumber":0,
    "ErrorMessage":""
}

The response has been whitespace formatted for readability, but the actual response should be a single line of JSON text without unnecessary whitespace.

On receipt, the client should check the ErrorNumber field:

  • = 0 - The events in the supplied list of event ID values have been cleared.
    • The state of IsSafe is determined by whether any events remain in the external events queue and the state of the safety monitor's own monitored conditions.
  • ≠ 0 - An error occurred and the ErrorMessage field should be examined to determine the cause of the error.

COM Clients and Drivers

COM clients should call the safety monitor instance's Action method with ActionName = "ClearExternalEvents" and ActionParameters = A string containing a JSON encoded array of string SafetyEvent.Id event ID values as shown above.

COM devices should return an empty string. If the device cannot complete the request, it should throw an exception with a message describing the cause of the error.

On return from the call, COM clients should:

  • No exception - The values were accepted and IsSafe will return false.
  • Exception - Catch and handle any exception thrown by the safety monitor.