6 #include <Poco/Mutex.h>
7 #include <Poco/SharedPtr.h>
8 #include <Poco/Timespan.h>
9 #include <Poco/Dynamic/Var.h>
10 #include <Poco/Net/HTTPRequest.h>
11 #include <Poco/Net/SocketAddress.h>
13 #include "credentials/PasswordCredentials.h"
14 #include "net/HTTPEntireResponse.h"
15 #include "net/MACAddress.h"
16 #include "philips/PhilipsHueBridgeInfo.h"
17 #include "util/CryptoConfig.h"
18 #include "util/Loggable.h"
31 typedef Poco::SharedPtr<PhilipsHueBridge> Ptr;
32 typedef uint64_t BulbID;
34 static const Poco::Timespan SLEEP_BETWEEN_ATTEMPTS;
43 const Poco::Net::SocketAddress& address,
44 const Poco::Timespan& timeout);
52 std::string
authorize(
const std::string& deviceType =
"BeeeOn#gateway");
68 std::list<std::pair<std::string, std::pair<uint32_t, PhilipsHueBridge::BulbID>>>
requestDeviceList();
78 const uint32_t ordinalNumber,
79 const std::string& capability,
80 const Poco::Dynamic::Var value);
90 Poco::Net::SocketAddress address()
const;
91 void setAddress(
const Poco::Net::SocketAddress& address);
93 std::string username()
const;
94 void setCredentials(
const Poco::SharedPtr<PasswordCredentials> credential,
95 const Poco::SharedPtr<CryptoConfig> config);
97 uint32_t countOfBulbs();
98 Poco::FastMutex& lock();
103 void requestDeviceInfo();
109 PhilipsHueBridge::BulbID decodeBulbID(
const std::string& strBulbID)
const;
114 void incrementCountOfBulbs();
119 void decrementCountOfBulbs();
122 Poco::Net::HTTPRequest& request,
123 const std::string& message,
124 const Poco::Net::SocketAddress& address,
125 const Poco::Timespan& timeout);
128 Poco::Net::SocketAddress m_address;
130 Poco::SharedPtr<PasswordCredentials> m_credential;
131 Poco::SharedPtr<CryptoConfig> m_cryptoConfig;
133 Poco::FastMutex m_lockCountOfBulbs;
136 Poco::FastMutex m_lock;
137 Poco::Timespan m_httpTimeout;
void requestSearchNewDevices()
Prepares POST HTTP request containing request to search new devices command and sends it to device vi...
Definition: PhilipsHueBridge.cpp:120
The class represents Philips Hue Bridge. Provides functions to control the bulbs. It means turn on...
Definition: PhilipsHueBridge.h:27
std::string requestDeviceState(const uint32_t ordinalNumber)
Prepares GET HTTP request containing request state of proper device command and sends it to device vi...
Definition: PhilipsHueBridge.cpp:274
Definition: HTTPEntireResponse.h:13
std::list< std::pair< std::string, std::pair< uint32_t, PhilipsHueBridge::BulbID > > > requestDeviceList()
Prepares GET HTTP request containing request device list command and sends it to device via HTTP...
Definition: PhilipsHueBridge.cpp:161
Definition: MACAddress.h:8
bool requestModifyState(const uint32_t ordinalNumber, const std::string &capability, const Poco::Dynamic::Var value)
Prepares JSON message containing request modify state command of proper device and sends it to device...
Definition: PhilipsHueBridge.cpp:215
PhilipsHueBridge(const Poco::Net::SocketAddress &address, const Poco::Timespan &timeout)
Creates Philips Hue Bridge. If the device do not respond in specified timeout, Poco::TimeoutException...
Definition: PhilipsHueBridge.cpp:31
Definition: Loggable.h:19
Abstract class representing generic Philips Hue bulb.
Definition: PhilipsHueBulb.h:23
Definition: PhilipsHueBridgeInfo.h:12
std::string authorize(const std::string &deviceType="BeeeOn#gateway")
Authorization of the gateway to Philips Hue Bridge. It starts by sending an HTTP authorization reques...
Definition: PhilipsHueBridge.cpp:67