Function rmw_client_set_on_new_response_callback

Function Documentation

rmw_ret_t rmw_client_set_on_new_response_callback(rmw_client_t *client, rmw_event_callback_t callback, const void *user_data)

Set the on new response callback function for the client.

This API sets the callback function to be called whenever the client is notified about a new response.

This callback is called for each new response received by the client. If responses arrive before the callback is registered, the number_of_events argument given to the callback may be > 1.

The callback may be called from a thread that the rmw implementation created, rather than a thread owned by the user, i.e. some thread other than user owned threads calling rmw functions such as rmw_wait() or rmw_take_response().

This function is thread-safe. This is required of the rmw implementation because the callback may be called from any middleware thread, and this function could be called by the user at any time.

Parameters:
  • client[in] The client on which to set the callback

  • callback[in] The callback to be called when new responses arrive, can be NULL to clear the registered callback

  • user_data[in] Given to the callback when called later, may be NULL

Returns:

RMW_RET_OK if callback was set to the listener, or

Returns:

RMW_RET_INVALID_ARGUMENT if client is NULL, or

Returns:

RMW_RET_UNSUPPORTED if the API is not implemented in the dds implementation