SMACC2
|
#include <cl_http_client.hpp>
Classes | |
class | Server |
Public Types | |
enum class | kHttpRequestMethod { GET = static_cast<int>(boost::beast::http::verb::get) , POST = static_cast<int>(boost::beast::http::verb::post) , PUT = static_cast<int>(boost::beast::http::verb::put) } |
using | TResponse = http_session_base::TResponse |
Public Member Functions | |
template<typename T > | |
boost::signals2::connection | onResponseReceived (void(T::*callback)(const TResponse &), T *object) |
ClHttp (const std::string &server, const int &timeout=1500) | |
virtual | ~ClHttp () |
void | onInitialize () override |
void | makeRequest (const kHttpRequestMethod http_method, const std::string &path="/", const std::string &body="", const std::unordered_map< std::string, std::string > &headers={}) |
Public Member Functions inherited from smacc2::ISmaccClient | |
ISmaccClient () | |
virtual | ~ISmaccClient () |
virtual std::string | getName () const |
template<typename TComponent > | |
TComponent * | getComponent () |
template<typename TComponent > | |
TComponent * | getComponent (std::string name) |
template<typename TComponent > | |
TComponent * | getComponent (int index) |
virtual smacc2::introspection::TypeInfo::Ptr | getType () |
ISmaccStateMachine * | getStateMachine () |
template<typename TSmaccSignal , typename T > | |
void | connectSignal (TSmaccSignal &signal, void(T::*callback)(), T *object) |
template<typename SmaccClientType > | |
void | requiresClient (SmaccClientType *&storage) |
void | getComponents (std::vector< std::shared_ptr< ISmaccComponent > > &components) |
const std::vector< std::shared_ptr< ISmaccComponent > > & | iterateComponents () const |
template<typename EventType > | |
void | postEvent (const EventType &ev) |
template<typename EventType > | |
void | postEvent () |
Private Attributes | |
const int | HTTP_VERSION = 11 |
bool | initialized_ |
bool | is_ssl_ |
int | timeout_ |
Server | server_ |
boost::asio::io_context | io_context_ |
boost::asio::executor_work_guard< decltype(io_context_)::executor_type > | worker_guard_ |
std::thread | tcp_connection_runner_ |
boost::asio::ssl::context | ssl_context_ |
smacc2::SmaccSignal< void(const TResponse &)> | onResponseReceived_ |
std::function< void(TResponse)> | callbackHandler |
Additional Inherited Members | |
Protected Member Functions inherited from smacc2::ISmaccClient | |
template<typename TOrthogonal , typename TSourceObject > | |
void | onOrthogonalAllocation () |
template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs> | |
SmaccComponentType * | createComponent (TArgs... targs) |
template<typename SmaccComponentType , typename TOrthogonal , typename TClient , typename... TArgs> | |
SmaccComponentType * | createNamedComponent (std::string name, TArgs... targs) |
rclcpp::Node::SharedPtr | getNode () |
rclcpp::Logger | getLogger () |
Protected Attributes inherited from smacc2::ISmaccClient | |
std::map< ComponentKey, std::shared_ptr< smacc2::ISmaccComponent > > | components_ |
Definition at line 38 of file cl_http_client.hpp.
Definition at line 76 of file cl_http_client.hpp.
|
strong |
|
explicit |
Definition at line 25 of file cl_http_client.cpp.
References ssl_context_.
|
virtual |
Definition at line 36 of file cl_http_client.cpp.
References tcp_connection_runner_, and worker_guard_.
void cl_http::ClHttp::makeRequest | ( | const kHttpRequestMethod | http_method, |
const std::string & | path = "/" , |
||
const std::string & | body = "" , |
||
const std::unordered_map< std::string, std::string > & | headers = {} |
||
) |
Definition at line 51 of file cl_http_client.cpp.
References callbackHandler, smacc2::ISmaccClient::getLogger(), cl_http::ClHttp::Server::getPort(), cl_http::ClHttp::Server::getServerName(), HTTP_VERSION, io_context_, cl_http::ClHttp::Server::isSSL(), server_, and ssl_context_.
Referenced by cl_http::CbHttpRequestBase::onEntry().
|
overridevirtual |
Reimplemented from smacc2::ISmaccClient.
Definition at line 42 of file cl_http_client.cpp.
References initialized_, io_context_, and tcp_connection_runner_.
|
inline |
Definition at line 79 of file cl_http_client.hpp.
References smacc2::ISmaccStateMachine::createSignalConnection(), smacc2::ISmaccClient::getStateMachine(), and onResponseReceived_.
Referenced by cl_http::CbHttpRequestBase::runtimeConfigure().
|
private |
Definition at line 112 of file cl_http_client.hpp.
Referenced by makeRequest().
|
private |
Definition at line 96 of file cl_http_client.hpp.
Referenced by makeRequest().
|
private |
Definition at line 98 of file cl_http_client.hpp.
Referenced by onInitialize().
|
private |
Definition at line 104 of file cl_http_client.hpp.
Referenced by makeRequest(), and onInitialize().
|
private |
Definition at line 99 of file cl_http_client.hpp.
|
private |
Definition at line 110 of file cl_http_client.hpp.
Referenced by onResponseReceived().
|
private |
Definition at line 102 of file cl_http_client.hpp.
Referenced by makeRequest().
|
private |
Definition at line 108 of file cl_http_client.hpp.
Referenced by ClHttp(), and makeRequest().
|
private |
Definition at line 106 of file cl_http_client.hpp.
Referenced by onInitialize(), and ~ClHttp().
|
private |
Definition at line 100 of file cl_http_client.hpp.
|
private |
Definition at line 105 of file cl_http_client.hpp.
Referenced by ~ClHttp().