hueplusplus  1.0.0
Public Member Functions | List of all members
hueplusplus::WinHttpHandler Class Reference

Class to handle http requests and multicast requests on windows systems. More...

#include <hueplusplus/WinHttpHandler.h>

+ Inheritance diagram for hueplusplus::WinHttpHandler:
+ Collaboration diagram for hueplusplus::WinHttpHandler:

Public Member Functions

 WinHttpHandler ()
 Ctor needed for initializing wsaData. More...
 
 ~WinHttpHandler ()
 Dtor needed for wsaData cleanup. More...
 
std::string send (const std::string &msg, const std::string &adr, int port=80) const override
 Function that sends a given message to the specified host and returns the response. More...
 
std::vector< std::string > sendMulticast (const std::string &msg, const std::string &adr="239.255.255.250", int port=1900, std::chrono::steady_clock::duration timeout=std::chrono::seconds(5)) const override
 Function that sends a multicast request with the specified message. More...
 
- Public Member Functions inherited from hueplusplus::BaseHttpHandler
virtual ~BaseHttpHandler ()=default
 Virtual dtor. More...
 
std::string sendGetHTTPBody (const std::string &msg, const std::string &adr, int port=80) const override
 Send a message to a specified host and return the body of the response. More...
 
std::string sendHTTPRequest (const std::string &method, const std::string &uri, const std::string &contentType, const std::string &body, const std::string &adr, int port=80) const override
 Send a HTTP request with the given method to the specified host and return the body of the response. More...
 
std::string GETString (const std::string &uri, const std::string &contentType, const std::string &body, const std::string &adr, int port=80) const override
 Send a HTTP GET request to the specified host and return the body of the response. More...
 
std::string POSTString (const std::string &uri, const std::string &contentType, const std::string &body, const std::string &adr, int port=80) const override
 Send a HTTP POST request to the specified host and return the body of the response. More...
 
std::string PUTString (const std::string &uri, const std::string &contentType, const std::string &body, const std::string &adr, int port=80) const override
 Send a HTTP PUT request to the specified host and return the body of the response. More...
 
std::string DELETEString (const std::string &uri, const std::string &contentType, const std::string &body, const std::string &adr, int port=80) const override
 Send a HTTP DELETE request to the specified host and return the body of the response. More...
 
nlohmann::json GETJson (const std::string &uri, const nlohmann::json &body, const std::string &adr, int port=80) const override
 Send a HTTP GET request to the specified host and return the body of the response parsed as JSON. More...
 
nlohmann::json POSTJson (const std::string &uri, const nlohmann::json &body, const std::string &adr, int port=80) const override
 Send a HTTP POST request to the specified host and return the body of the response parsed as JSON. More...
 
nlohmann::json PUTJson (const std::string &uri, const nlohmann::json &body, const std::string &adr, int port=80) const override
 Send a HTTP PUT request to the specified host and return the body of the response parsed as JSON. More...
 
nlohmann::json DELETEJson (const std::string &uri, const nlohmann::json &body, const std::string &adr, int port=80) const override
 Send a HTTP DELETE request to the specified host and return the body of the response parsed as JSON. More...
 
- Public Member Functions inherited from hueplusplus::IHttpHandler
virtual ~IHttpHandler ()=default
 Virtual dtor. More...
 

Detailed Description

Class to handle http requests and multicast requests on windows systems.

Constructor & Destructor Documentation

◆ WinHttpHandler()

hueplusplus::WinHttpHandler::WinHttpHandler ( )

Ctor needed for initializing wsaData.

◆ ~WinHttpHandler()

hueplusplus::WinHttpHandler::~WinHttpHandler ( )

Dtor needed for wsaData cleanup.

Member Function Documentation

◆ send()

std::string hueplusplus::WinHttpHandler::send ( const std::string &  msg,
const std::string &  adr,
int  port = 80 
) const
overridevirtual

Function that sends a given message to the specified host and returns the response.

Parameters
msgString that contains the message that is sent to the specified address
adrString that contains an ip or hostname in dotted decimal notation like "192.168.2.1"
portOptional integer that specifies the port to which the request is sent to. Default is 80
Returns
String containing the response of the host

Implements hueplusplus::IHttpHandler.

◆ sendMulticast()

std::vector< std::string > hueplusplus::WinHttpHandler::sendMulticast ( const std::string &  msg,
const std::string &  adr = "239.255.255.250",
int  port = 1900,
std::chrono::steady_clock::duration  timeout = std::chrono::seconds(5) 
) const
overridevirtual

Function that sends a multicast request with the specified message.

Parameters
msgString that contains the request that is sent to the specified address
adrOptional String that contains an ip or hostname in dotted decimal notation, default is "239.255.255.250"
portOptional integer that specifies the port to which the request is sent. Default is 1900
timeoutOptional The timeout of the request. Default is 5 seconds
Returns
Vector containing strings of each answer received

Implements hueplusplus::IHttpHandler.


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