Loading...
Searching...
No Matches
hueplusplus::LinHttpHandler Class Reference

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

`#include <hueplusplus/LinHttpHandler.h>`

Inheritance diagram for hueplusplus::LinHttpHandler:
[legend]
Collaboration diagram for hueplusplus::LinHttpHandler:
[legend]

## Public Member Functions

virtual 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.
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.
Public Member Functions inherited from hueplusplus::BaseHttpHandler
virtual | ~BaseHttpHandler ()=default
| Virtual dtor.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Public Member Functions inherited from hueplusplus::IHttpHandler
virtual | ~IHttpHandler ()=default
| Virtual dtor.

## Detailed Description

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

Examples
  BridgeSetup.cpp, LightsOff.cpp, and UsernameConfig.cpp.

## Member Function Documentation

## send()

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

override virtual

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

Parameters

  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

Returns
  String containing the response of the host

Implements hueplusplus::IHttpHandler.

## sendMulticast()

std::vector< std::string > hueplusplus::LinHttpHandler::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 virtual

Function that sends a multicast request with the specified message.

Parameters

  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

Returns
  Vector containing strings of each answer received

Implements hueplusplus::IHttpHandler.

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

- include/hueplusplus/LinHttpHandler.h
- src/LinHttpHandler.cpp