openthread-br  0.3.0-72c0388
Public Member Functions | List of all members
otbr::rest::Resource Class Reference

#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
 

Detailed Description

This class implements the Resource handler for OTBR-REST.

Constructor & Destructor Documentation

◆ Resource()

otbr::rest::Resource::Resource ( ControllerOpenThread aNcp)

The constructor initializes the resource handler instance.

Parameters
[in]aNcpA pointer to the NCP controller.

Member Function Documentation

◆ ErrorHandler()

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.

Parameters
[in]aRequestA request instance referred by the Resource handler.
[in,out]aErrorCodeAn enum class represents the status code.

◆ Handle()

void otbr::rest::Resource::Handle ( Request aRequest,
Response aResponse 
) const

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.

Parameters
[in]aRequestA request instance referred by the Resource handler.
[in,out]aResponseA response instance will be set by the Resource handler.

◆ HandleCallback()

void otbr::rest::Resource::HandleCallback ( Request aRequest,
Response aResponse 
)

This method distributes a callback handler for each connection needs a callback.

Parameters
[in]aRequestA request instance referred by the Resource handler.
[in,out]aResponseA response instance will be set by the Resource handler.

◆ Init()

void otbr::rest::Resource::Init ( void  )

This method initialize the Resource handler.


The documentation for this class was generated from the following files: