5G-MAG Reference Tools - MBMS Middleware
Public Member Functions | Private Attributes | List of all members
MBMS_RT::RpRestClient Class Reference

#include <RpRestClient.h>

Collaboration diagram for MBMS_RT::RpRestClient:
Collaboration graph

Public Member Functions

 RpRestClient (const libconfig::Config &cfg)
 
virtual ~RpRestClient ()
 
web::json::value getMchInfo ()
 
web::json::value getStatus ()
 

Private Attributes

std::unique_ptr< web::http::client::http_client > _client
 

Detailed Description

Definition at line 24 of file RpRestClient.h.

Constructor & Destructor Documentation

◆ RpRestClient()

MBMS_RT::RpRestClient::RpRestClient ( const libconfig::Config &  cfg)

Definition at line 27 of file RpRestClient.cpp.

28 {
29  std::string url = "http://localhost:3010/modem-api/";
30  cfg.lookupValue("modem.restful_api.uri", url);
31  _client = std::make_unique<http_client>(url);
32 }
std::unique_ptr< web::http::client::http_client > _client
Definition: RpRestClient.h:34
static Config cfg
Global configuration object.
Definition: main.cpp:111

◆ ~RpRestClient()

virtual MBMS_RT::RpRestClient::~RpRestClient ( )
inlinevirtual

Definition at line 28 of file RpRestClient.h.

28 {};

Member Function Documentation

◆ getMchInfo()

auto MBMS_RT::RpRestClient::getMchInfo ( )

Definition at line 34 of file RpRestClient.cpp.

35 {
36  auto res = web::json::value::array();
37  try {
38  _client->request(methods::GET, "mch_info")
39  .then([&res](http_response response) { // NOLINT
40  if (response.status_code() == status_codes::OK) {
41  res = response.extract_json().get();
42  }
43  }).wait();
44  } catch (web::http::http_exception ex) { }
45  return res;
46 }

◆ getStatus()

auto MBMS_RT::RpRestClient::getStatus ( )

Definition at line 48 of file RpRestClient.cpp.

49 {
50  auto res = web::json::value::array();
51  try {
52  _client->request(methods::GET, "status")
53  .then([&res](http_response response) { // NOLINT
54  if (response.status_code() == status_codes::OK) {
55  res = response.extract_json().get();
56  }
57  }).wait();
58  } catch (web::http::http_exception ex) { }
59  return res;
60 }

Member Data Documentation

◆ _client

std::unique_ptr<web::http::client::http_client> MBMS_RT::RpRestClient::_client
private

Definition at line 34 of file RpRestClient.h.


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