openthread-br
0.3.0-72c0388
|
#include <src/rest/resource.hpp>
Public Member Functions | |
Resource (ControllerOpenThread *aNcp) | |
void | Init (void) |
void | Handle (Request &aRequest, Response &aResponse) const |
void | HandleCallback (Request &aRequest, Response &aResponse) |
void | ErrorHandler (Response &aResponse, HttpStatusCode aErrorCode) const |
This class implements the Resource handler for OTBR-REST.
otbr::rest::Resource::Resource | ( | ControllerOpenThread * | aNcp | ) |
The constructor initializes the resource handler instance.
[in] | aNcp | A pointer to the NCP controller. |
void otbr::rest::Resource::ErrorHandler | ( | Response & | aResponse, |
HttpStatusCode | aErrorCode | ||
) | const |
This method provides a quick handler, which could directly set response code of a response and set error code and error message to the request body.
[in] | aRequest | A request instance referred by the Resource handler. |
[in,out] | aErrorCode | An enum class represents the status code. |
This method is the main entry of resource handler, which find corresponding handler according to request url find the resource and set the content of response.
void otbr::rest::Resource::Init | ( | void | ) |
This method initialize the Resource handler.