Control requests

system_ctrl_set_result - Control requests

Completes the processing of a request. The result argument specifies a result code as defined by the system_error_t enum. The function also takes an optional callback that will be invoked once the sender of the request has received the reply successfully, or an error has occurred while sending the reply.

// PROTOTYPE
void system_ctrl_set_result(ctrl_request* req, int result, ctrl_completion_handler_fn handler, void* data, void* reserved);

// EXAMPLE
void ctrl_request_custom_handler(ctrl_request *req) {
  int result = SYSTEM_ERROR_NOT_SUPPORTED;
  system_ctrl_set_result(req, result, nullptr, nullptr, nullptr);
}
  • req is the request passed to ctrl_request_custom_handler
  • result the system error code to return (0 = success)
  • handler the callback function or nullptr if not used
  • data optional data pointer that is passed to the handler
  • reserved must be set to nullptr (0)