hueplusplus
1.0.0
|
Class to handle http requests and multicast requests on windows systems. More...
#include <hueplusplus/WinHttpHandler.h>
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... | |
Class to handle http requests and multicast requests on windows systems.
hueplusplus::WinHttpHandler::WinHttpHandler | ( | ) |
Ctor needed for initializing wsaData.
hueplusplus::WinHttpHandler::~WinHttpHandler | ( | ) |
Dtor needed for wsaData cleanup.
|
overridevirtual |
Function that sends a given message to the specified host and returns the response.
msg | String that contains the message that is sent to the specified address |
adr | String that contains an ip or hostname in dotted decimal notation like "192.168.2.1" |
port | Optional integer that specifies the port to which the request is sent to. Default is 80 |
Implements hueplusplus::IHttpHandler.
|
overridevirtual |
Function that sends a multicast request with the specified message.
msg | String that contains the request that is sent to the specified address |
adr | Optional String that contains an ip or hostname in dotted decimal notation, default is "239.255.255.250" |
port | Optional integer that specifies the port to which the request is sent. Default is 1900 |
timeout | Optional The timeout of the request. Default is 5 seconds |
Implements hueplusplus::IHttpHandler.