openthread-br  0.3.0-72c0388
Functions
otbr::rest::Json Namespace Reference

Functions

std::string String2JsonString (const std::string &aString)
 
std::string Json2String (const cJSON *aJson)
 
std::string IpAddr2JsonString (const otIp6Address &aAddress)
 
std::string Node2JsonString (const NodeInfo &aNode)
 
std::string Diag2JsonString (const std::vector< std::vector< otNetworkDiagTlv >> &aDiagSet)
 
std::string Bytes2HexJsonString (const uint8_t *aBytes, uint8_t aLength)
 
std::string Number2JsonString (const uint32_t &aNumber)
 
std::string Mode2JsonString (const otLinkModeConfig &aMode)
 
std::string Connectivity2JsonString (const otNetworkDiagConnectivity &aConnectivity)
 
std::string RouteData2JsonString (const otNetworkDiagRouteData &aRouteData)
 
std::string Route2JsonString (const otNetworkDiagRoute &aRoute)
 
std::string LeaderData2JsonString (const otLeaderData &aLeaderData)
 
std::string MacCounters2JsonString (const otNetworkDiagMacCounters &aMacCounters)
 
std::string ChildTableEntry2JsonString (const otNetworkDiagChildEntry &aChildEntry)
 
std::string CString2JsonString (const char *aCString)
 
std::string Error2JsonString (HttpStatusCode aErrorCode, std::string aErrorMessage)
 

Detailed Description

The functions within this namespace provides a tranformation from an object/string/number to a serialized Json string.

Function Documentation

◆ Bytes2HexJsonString()

std::string otbr::rest::Json::Bytes2HexJsonString ( const uint8_t *  aBytes,
uint8_t  aLength 
)

This method formats a Bytes array to a Json string and serialize it to a string.

Parameters
[in]aBytesA Bytes array representing a hex number.
Returns
A string of serialized Json string.

◆ ChildTableEntry2JsonString()

std::string otbr::rest::Json::ChildTableEntry2JsonString ( const otNetworkDiagChildEntry &  aChildEntry)

This method formats a ChildEntry object to a Json object and serialize it to a string.

Parameters
[in]aChildEntryA ChildEntry object.
Returns
A string of serialized Json object.

◆ Connectivity2JsonString()

std::string otbr::rest::Json::Connectivity2JsonString ( const otNetworkDiagConnectivity &  aConnectivity)

This method formats a Connectivity object to a Json object and serialize it to a string.

Parameters
[in]aConnectivityA Connectivity object.
Returns
A string of serialized Json object.

◆ CString2JsonString()

std::string otbr::rest::Json::CString2JsonString ( const char *  aCString)

This method formats a C string to a Json string and serialize it to a string.

Parameters
[in]aCStringA char pointer pointing to a C string.
Returns
A string of serialized Json string.

◆ Diag2JsonString()

std::string otbr::rest::Json::Diag2JsonString ( const std::vector< std::vector< otNetworkDiagTlv >> &  aDiagSet)

This method formats a vector of diagnostic objects to a Json array and serialize it to a string.

Parameters
[in]aDiagSetA vector of diagnostic objects.
Returns
A string of serialized Json array.

◆ Error2JsonString()

std::string otbr::rest::Json::Error2JsonString ( HttpStatusCode  aErrorCode,
std::string  aErrorMessage 
)

This method formats an error code and an error message to a Json object and serialize it to a string.

Parameters
[in]aErrorCodeAn enum HttpStatusCode such as '404'.
[in]aErrorMessageError message such as '404 Not Found'.
Returns
A string of serialized Json object.

◆ IpAddr2JsonString()

std::string otbr::rest::Json::IpAddr2JsonString ( const otIp6Address &  aAddress)

This method formats an Ipv6Address to a Json string and serialize it to a string.

Parameters
[in]aAddressAn Ip6Address object.
Returns
A string of serialized Json string.

◆ LeaderData2JsonString()

std::string otbr::rest::Json::LeaderData2JsonString ( const otLeaderData &  aLeaderData)

This method formats a LeaderData object to a Json object and serialize it to a string.

Parameters
[in]aLeaderDataA LeaderData object.
Returns
A string of serialized Json object.

◆ MacCounters2JsonString()

std::string otbr::rest::Json::MacCounters2JsonString ( const otNetworkDiagMacCounters &  aMacCounters)

This method formats a MacCounters object to a Json object and serialize it to a string.

Parameters
[in]aMacCountersA MacCounters object.
Returns
A string of serialized Json object.

◆ Mode2JsonString()

std::string otbr::rest::Json::Mode2JsonString ( const otLinkModeConfig &  aMode)

This method formats a LinkModeConfig object to a Json object and serialize it to a string.

Parameters
[in]aModeA LinkModeConfig object.
Returns
A string of serialized Json object.

◆ Node2JsonString()

std::string otbr::rest::Json::Node2JsonString ( const NodeInfo aNode)

This method formats a Node object to a Json object and serialize it to a string.

Parameters
[in]aNodeA Node object.
Returns
A string of serialized Json object.

◆ Number2JsonString()

std::string otbr::rest::Json::Number2JsonString ( const uint32_t &  aNumber)

This method formats an integer to a Json number and serialize it to a string.

Parameters
[in]aNumberAn integer need to be format.
Returns
A string of serialized Json number.

◆ Route2JsonString()

std::string otbr::rest::Json::Route2JsonString ( const otNetworkDiagRoute &  aRoute)

This method formats a Route object to a Json object and serialize it to a string.

Parameters
[in]aRouteA Route object.
Returns
A string of serialized Json object.

◆ RouteData2JsonString()

std::string otbr::rest::Json::RouteData2JsonString ( const otNetworkDiagRouteData &  aRouteData)

This method formats a RouteData object to a Json object and serialize it to a string.

Parameters
[in]aRouteDataA RouteData object.
Returns
A string of serialized Json object.

◆ String2JsonString()

std::string otbr::rest::Json::String2JsonString ( const std::string &  aString)

This method formats a string to a Json string and serialize it to a string.

Parameters
[in]aStringA string.
Returns
A string of serialized Json string.