Commit 84fcb3d157cef003d65b2925cdee28bf2d93e742

Authored by Jojo-1000
Committed by Jan
1 parent 15c44e96

Reformat files.

hueplusplus/CMakeLists.txt
1 1 file(GLOB hueplusplus_HEADERS include/*.h include/*.hpp)
2 2 set(hueplusplus_SOURCES
3 3 ${CMAKE_CURRENT_SOURCE_DIR}/BaseHttpHandler.cpp
4   - ${CMAKE_CURRENT_SOURCE_DIR}/ExtendedColorHueStrategy.cpp
  4 + ${CMAKE_CURRENT_SOURCE_DIR}/ExtendedColorHueStrategy.cpp
5 5 ${CMAKE_CURRENT_SOURCE_DIR}/ExtendedColorTemperatureStrategy.cpp
6 6 ${CMAKE_CURRENT_SOURCE_DIR}/Hue.cpp
7 7 ${CMAKE_CURRENT_SOURCE_DIR}/HueCommandAPI.cpp
8   - ${CMAKE_CURRENT_SOURCE_DIR}/HueException.cpp
  8 + ${CMAKE_CURRENT_SOURCE_DIR}/HueException.cpp
9 9 ${CMAKE_CURRENT_SOURCE_DIR}/HueLight.cpp
10 10 ${CMAKE_CURRENT_SOURCE_DIR}/SimpleBrightnessStrategy.cpp
11 11 ${CMAKE_CURRENT_SOURCE_DIR}/SimpleColorHueStrategy.cpp
... ...
hueplusplus/HueLight.cpp
... ... @@ -26,9 +26,9 @@
26 26 #include <iostream>
27 27 #include <thread>
28 28  
  29 +#include "include/HueExceptionMacro.h"
29 30 #include "include/Utils.h"
30 31 #include "include/json/json.hpp"
31   -#include "include/HueExceptionMacro.h"
32 32  
33 33 bool HueLight::On(uint8_t transition)
34 34 {
... ... @@ -167,10 +167,10 @@ HueLight::HueLight(int id, const HueCommandAPI&amp; commands, std::shared_ptr&lt;const
167 167 std::shared_ptr<const ColorTemperatureStrategy> colorTempStrategy,
168 168 std::shared_ptr<const ColorHueStrategy> colorHueStrategy)
169 169 : id(id),
170   - brightnessStrategy(std::move(brightnessStrategy)),
171   - colorTemperatureStrategy(std::move(colorTempStrategy)),
172   - colorHueStrategy(std::move(colorHueStrategy)),
173   - commands(commands)
  170 + brightnessStrategy(std::move(brightnessStrategy)),
  171 + colorTemperatureStrategy(std::move(colorTempStrategy)),
  172 + colorHueStrategy(std::move(colorHueStrategy)),
  173 + commands(commands)
174 174  
175 175 {
176 176 refreshState();
... ... @@ -224,10 +224,9 @@ bool HueLight::OffNoRefresh(uint8_t transition)
224 224 return utils::validateReplyForLight(request, reply, id);
225 225 }
226 226  
227   -nlohmann::json HueLight::SendPutRequest(const nlohmann::json &request, const std::string &subPath, FileInfo fileInfo)
  227 +nlohmann::json HueLight::SendPutRequest(const nlohmann::json& request, const std::string& subPath, FileInfo fileInfo)
228 228 {
229   - return commands.PUTRequest("/lights/" + std::to_string(id) + subPath,
230   - request, std::move(fileInfo));
  229 + return commands.PUTRequest("/lights/" + std::to_string(id) + subPath, request, std::move(fileInfo));
231 230 }
232 231  
233 232 void HueLight::refreshState()
... ... @@ -235,7 +234,8 @@ void HueLight::refreshState()
235 234 // std::chrono::steady_clock::time_point start =
236 235 // std::chrono::steady_clock::now(); std::cout << "\tRefreshing lampstate of
237 236 // lamp with id: " << id << ", ip: " << ip << "\n";
238   - nlohmann::json answer = commands.GETRequest("/lights/" + std::to_string(id), nlohmann::json::object(), CURRENT_FILE_INFO);
  237 + nlohmann::json answer
  238 + = commands.GETRequest("/lights/" + std::to_string(id), nlohmann::json::object(), CURRENT_FILE_INFO);
239 239 if (answer.count("state"))
240 240 {
241 241 state = answer;
... ... @@ -243,8 +243,8 @@ void HueLight::refreshState()
243 243 else
244 244 {
245 245 std::cout << "Answer in HueLight::refreshState of "
246   - "http_handler->GETJson(...) is not expected!\nAnswer:\n\t"
247   - << answer.dump() << std::endl;
  246 + "http_handler->GETJson(...) is not expected!\nAnswer:\n\t"
  247 + << answer.dump() << std::endl;
248 248 }
249 249 // std::cout << "\tRefresh state took: " <<
250 250 // std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now()
... ...
hueplusplus/include/BaseHttpHandler.h
... ... @@ -32,7 +32,6 @@
32 32  
33 33 #include "json/json.hpp"
34 34  
35   -
36 35 //! Base class for classes that handle http requests and multicast requests
37 36 class BaseHttpHandler : public IHttpHandler
38 37 {
... ...
hueplusplus/include/HueLight.h
... ... @@ -541,7 +541,7 @@ public:
541 541 //! ranging from 0 to 255. \param r uint8_t that specifies the red color value
542 542 //! \param g uint8_t that specifies the green color value
543 543 //! \param b uint8_t that specifies the blue color value
544   - //! \param transition Optional parameter to set the transition from current state to new, standard is 4 = 400ms
  544 + //! \param transition Optional parameter to set the transition from current state to new, standard is 4 = 400ms
545 545 //! \return Bool that is true on success
546 546 //! \throws std::system_error when system or socket operations fail
547 547 //! \throws HueException when response contained no body
... ... @@ -570,8 +570,8 @@ public:
570 570 //! color temperature.
571 571 //!
572 572 //! \note The breath cylce will only be performed if the light has a reference
573   - //! to a specific \ref ColorTemperatureStrategy.
574   - //! \param mired Color temperature in mired
  573 + //! to a specific \ref ColorTemperatureStrategy.
  574 + //! \param mired Color temperature in mired
575 575 //! \return Bool that is true on success
576 576 //! \throws std::system_error when system or socket operations fail
577 577 //! \throws HueException when response contained no body
... ... @@ -590,9 +590,9 @@ public:
590 590 //! color.
591 591 //!
592 592 //! \note The breath cylce will only be performed if the light has a reference
593   - //! to a specific \ref ColorHueStrategy.
594   - //! \param hue uint16_t that specifies the hue
595   - //! \param sat uint8_t that specifies the saturation
  593 + //! to a specific \ref ColorHueStrategy.
  594 + //! \param hue uint16_t that specifies the hue
  595 + //! \param sat uint8_t that specifies the saturation
596 596 //! \return Bool that is true on success
597 597 //! \throws std::system_error when system or socket operations fail
598 598 //! \throws HueException when response contained no body
... ... @@ -612,9 +612,9 @@ public:
612 612 //!
613 613 //! \note The breath cylce will only be performed if the light has a reference
614 614 //! to a specific \ref ColorHueStrategy. The values of x and y are ranging
615   - //! from 0 to 1.
  615 + //! from 0 to 1.
616 616 //! \param x float that specifies the x coordinate in CIE
617   - //! \param y float that specifies the y coordinate in CIE
  617 + //! \param y float that specifies the y coordinate in CIE
618 618 //! \return Bool that is true on success
619 619 //! \throws std::system_error when system or socket operations fail
620 620 //! \throws HueException when response contained no body
... ... @@ -634,7 +634,7 @@ public:
634 634 //!
635 635 //! \note The breath cylce will only be performed if the light has a reference
636 636 //! to a specific \ref ColorHueStrategy. The values of red, green and blue are
637   - //! ranging from 0 to 255.
  637 + //! ranging from 0 to 255.
638 638 //! \param r uint8_t that specifies the red color value
639 639 //! \param g uint8_t that specifies the green color value
640 640 //! \param b uint8_t that specifies the blue color value
... ... @@ -738,7 +738,7 @@ protected:
738 738  
739 739 //! \brief Function that turns the light on without refreshing its state.
740 740 //!
741   - //! \param transition Optional parameter to set the transition from current state to new standard is 4 = 400ms
  741 + //! \param transition Optional parameter to set the transition from current state to new standard is 4 = 400ms
742 742 //! \return Bool that is true on success
743 743 //! \throws std::system_error when system or socket operations fail
744 744 //! \throws HueException when response contained no body
... ... @@ -748,7 +748,7 @@ protected:
748 748  
749 749 //! \brief Function that turns the light off without refreshing its state.
750 750 //!
751   - //! \param transition Optional parameter to set the transition from current state to new standard is 4 = 400ms
  751 + //! \param transition Optional parameter to set the transition from current state to new standard is 4 = 400ms
752 752 //! \return Bool that is true on success
753 753 //! \throws std::system_error when system or socket operations fail
754 754 //! \throws HueException when response contained no body
... ... @@ -760,7 +760,7 @@ protected:
760 760 //!
761 761 //! \throws nlohmann::json::parse_error if the reply could not be parsed
762 762 //! \param request A nlohmann::json aka the request to send
763   - //! \param subPath A path that is appended to the uri, note it should always start with a slash ("/")
  763 + //! \param subPath A path that is appended to the uri, note it should always start with a slash ("/")
764 764 //! \return The parsed reply
765 765 //! \throws std::system_error when system or socket operations fail
766 766 //! \throws HueException when response contained no body
... ...
hueplusplus/include/UPnP.h
... ... @@ -35,9 +35,9 @@ class UPnP
35 35 public:
36 36 //! \brief Searches for UPnP devices and returns all found ones.
37 37 //!
38   - //! It does it by sending an m-search packet and waits for all responses.
39   - //! Since responses can be received multiple times this function conveniently removes all duplicates.
40   - //! \param handler HttpHandler for communication
  38 + //! It does it by sending an m-search packet and waits for all responses.
  39 + //! Since responses can be received multiple times this function conveniently removes all duplicates.
  40 + //! \param handler HttpHandler for communication
41 41 //! \return A vector containing pairs of address and name of all found devices
42 42 //! \throws std::system_error when system or socket operations fail
43 43 std::vector<std::pair<std::string, std::string>> getDevices(std::shared_ptr<const IHttpHandler> handler);
... ...
hueplusplus/include/Utils.h
... ... @@ -37,7 +37,7 @@ namespace utils
37 37  
38 38 template <typename KeyT, typename... Paths,
39 39 std::enable_if_t<!std::is_integral<std::remove_reference_t<KeyT>>::value>* = nullptr>
40   - nlohmann::json safeGetMemberHelper(const nlohmann::json& json, KeyT&& key, Paths&&... otherPaths)
  40 + nlohmann::json safeGetMemberHelper(const nlohmann::json& json, KeyT&& key, Paths&&... otherPaths)
41 41 {
42 42 auto memberIt = json.find(std::forward<KeyT>(key));
43 43 if (memberIt == json.end())
... ... @@ -57,7 +57,7 @@ namespace utils
57 57 }
58 58 return safeGetMemberHelper(json[index], std::forward<Paths>(otherPaths)...);
59 59 }
60   - }
  60 + } // namespace detail
61 61  
62 62 //! \brief Function for validating that a request was executed correctly
63 63 //!
... ... @@ -68,11 +68,11 @@ namespace utils
68 68 bool validateReplyForLight(const nlohmann::json& request, const nlohmann::json& reply, int lightId);
69 69  
70 70 //! \brief Returns the object/array member or null if it does not exist
71   - //!
  71 + //!
72 72 //! \param json The base json value
73 73 //! \param paths Any number of child accesses (e.g. 0, "key" would access json[0]["key"])
74 74 //! \returns The specified member or null if any intermediate object does not contain the specified child.
75   - template<typename... Paths>
  75 + template <typename... Paths>
76 76 nlohmann::json safeGetMember(const nlohmann::json& json, Paths&&... paths)
77 77 {
78 78 return detail::safeGetMemberHelper(json, std::forward<Paths>(paths)...);
... ...