5 #include <Poco/Timespan.h>
6 #include <Poco/JSON/Object.h>
8 #include "core/DeviceManager.h"
9 #include "conrad/ConradDevice.h"
10 #include "conrad/ConradListener.h"
11 #include "conrad/FHEMClient.h"
12 #include "model/DeviceID.h"
13 #include "util/AsyncExecutor.h"
14 #include "util/BlockingAsyncWork.h"
15 #include "util/EventSource.h"
16 #include "util/JsonUtil.h"
34 void setFHEMClient(FHEMClient::Ptr fhemClient);
35 void setEventsExecutor(AsyncExecutor::Ptr executor);
37 void registerListener(ConradListener::Ptr listener);
45 const Poco::Timespan &timeout);
48 const Poco::Timespan &)
override;
49 void handleAccept(
const DeviceAcceptCommand::Ptr cmd)
override;
63 const Poco::JSON::Object::Ptr event);
76 Poco::FastMutex m_devicesMutex;
77 std::map<DeviceID, ConradDevice::Ptr> m_devices;
79 FHEMClient::Ptr m_fhemClient;
void fireMessage(DeviceID const &deviceID, const Poco::JSON::Object::Ptr message)
Transforms received/sent message into ConradEvent and fires it.
AsyncWork< double >::Ptr startSetValue(const DeviceID &id, const ModuleID &module, const double value, const Poco::Timespan &timeout)
Starts set-value operation in a technology specific way. The method is always called inside a critica...
EventSource implements common logic for firing events to listeners.
Definition: EventSource.h:24
AsyncWork::Ptr startDiscovery(const Poco::Timespan &timeout) override
Starts device discovery process in a technology-specific way. This method is always called inside a c...
void processEvent(const Poco::JSON::Object::Ptr event)
Processes the incoming event, which means creating a new device or sending the gathered data to the s...
AsyncWork is an interface allowing to wait until an asynchronous operation finishes. It is also possible to force-stop it by calling cancel().
Definition: AsyncWork.h:21
Definition: ModuleID.h:12
The class implements the work with Conrad devices. Allows us to process and execute the commands from...
Definition: ConradDeviceManager.h:27
Definition: DeviceManager.h:48
void createNewDeviceUnlocked(const DeviceID &deviceID, const std::string &type)
Creates instance of Conrad device appends it into m_devices.
AsyncWork< std::set< DeviceID > >::Ptr startUnpair(const DeviceID &id, const Poco::Timespan &) override
Starts device unpair process in a technology-specific way. This method is always called inside a crit...
void processMessageEvent(const DeviceID &deviceID, const Poco::JSON::Object::Ptr event)
Processes the message event. If the event's device is paired then the data from the event are sent to...
Definition: DeviceID.h:17
void handleAccept(const DeviceAcceptCommand::Ptr cmd) override
Generic handler of the DeviceAcceptCommand. It might be helpful to override this method in case we ne...