6 #include <Poco/AtomicCounter.h>
7 #include <Poco/SharedPtr.h>
8 #include <Poco/Util/Timer.h>
10 #include "core/DongleDeviceManager.h"
11 #include "core/PollingKeeper.h"
12 #include "commands/DeviceAcceptCommand.h"
13 #include "commands/DeviceUnpairCommand.h"
14 #include "commands/GatewayListenCommand.h"
15 #include "iqrf/DPAMessage.h"
16 #include "iqrf/DPAProtocol.h"
17 #include "iqrf/IQRFDevice.h"
18 #include "iqrf/IQRFEventFirer.h"
19 #include "iqrf/IQRFListener.h"
20 #include "iqrf/IQRFMqttConnector.h"
21 #include "model/RefreshTime.h"
70 void setMqttConnector(IQRFMqttConnector::Ptr connector);
71 void setDevicePoller(DevicePoller::Ptr poller);
73 void setEventsExecutor(AsyncExecutor::Ptr executor);
74 void registerListener(IQRFListener::Ptr listener);
85 void handleAccept(
const DeviceAcceptCommand::Ptr cmd)
override;
89 const Poco::Timespan &timeout)
override;
98 void eraseAllDevices();
105 std::set<uint8_t> obtainBondedNodes(
const Poco::Timespan &methodTimeout);
106 std::set<uint8_t> obtainNonSynchronizedNodes(
107 const std::set<uint8_t> &bondedNodes);
114 void syncBondedNodes(
const Poco::Timespan &methodTimeout);
120 std::string supportedProtocolsToString()
const;
125 void newDevice(IQRFDevice::Ptr dev);
134 DPAProtocol::Ptr detectNodeProtocol(
135 DPAMessage::NetworkAddress node,
136 const Poco::Timespan &maxMethodTimeout);
152 std::map<DeviceID, IQRFDevice::Ptr> obtainDeviceInfo(
153 const Poco::Timespan &methodTimeout,
154 const std::set<uint8_t> &nodes);
162 IQRFDevice::Ptr tryObtainDeviceInfo(
163 DPAMessage::NetworkAddress node,
164 const Poco::Timespan &methodTimeout);
173 IQRFDevice::Ptr bondNewDevice(
174 const Poco::Timespan &timeout);
180 void coordinatorResetProcess();
183 Poco::FastMutex m_lock;
184 std::vector<DPAProtocol::Ptr> m_dpaProtocols;
185 std::map<DeviceID, IQRFDevice::Ptr> m_devices;
188 IQRFMqttConnector::Ptr m_connector;
191 bool m_coordinatorReset;
192 Poco::Timespan m_receiveTimeout;
193 Poco::Timespan m_devicesRetryTimeout;
194 Poco::AtomicCounter m_bondingMode;
void registerDPAProtocol(DPAProtocol::Ptr protocol)
Registration of supported protocols.
Definition: IQRFDeviceManager.cpp:71
Definition: FailDetector.h:8
RefreshTime represents time of refreshing values from sensors. E.g. sensors are polled periodically o...
Definition: RefreshTime.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...
Definition: IQRFDeviceManager.cpp:467
void dongleFailed(const FailDetector &dongleStatus)
Definition: IQRFDeviceManager.cpp:649
Definition: IQRFEventFirer.h:19
void handleAccept(const DeviceAcceptCommand::Ptr cmd) override
Generic handler of the DeviceAcceptCommand. It might be helpful to override this method in case we ne...
Definition: IQRFDeviceManager.cpp:419
void setRefreshTimePeripheralInfo(const Poco::Timespan &refresh)
Refresh time between obtaining peripheral info (battery, RSSI) from IQRF devices. ...
Definition: IQRFDeviceManager.cpp:98
PollingKeeper takes care of devices that are being polled. It cancels all polled devices it manages u...
Definition: PollingKeeper.h:17
std::string dongleMatch(const HotplugEvent &e) override
Recognizes compatible dongle by testing HotplugEvent property as iqrf.BEEEON_DONGLE = iqrf...
Definition: IQRFDeviceManager.cpp:150
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
void setRefreshTime(const Poco::Timespan &refresh)
Refresh time between obtaining of measured values from IQRF devices.
Definition: IQRFDeviceManager.cpp:87
IQRFDeviceManager implements work with IQRF devices. IQRF Daemon (third party application) is used fo...
Definition: IQRFDeviceManager.h:32
void stop() override
Definition: IQRFDeviceManager.cpp:144
AsyncWork< std::set< DeviceID > >::Ptr startUnpair(const DeviceID &id, const Poco::Timespan &timeout) override
Starts device unpair process in a technology-specific way. This method is always called inside a crit...
Definition: IQRFDeviceManager.cpp:501
Definition: HotplugEvent.h:10
void setCoordinatorReset(const std::string &reset)
If this parameter is set to true (bool value in decimal or string notation), coordinator is reset...
Definition: IQRFDeviceManager.cpp:119
void notifyDongleRemoved() override
List of tasks is cleared for each device, that is in m_devices and each device is removed from the li...
Definition: IQRFDeviceManager.cpp:644
void dongleAvailable() override
Definition: IQRFDeviceManager.cpp:167
Definition: DongleDeviceManager.h:14
void setReceiveTimeout(const Poco::Timespan &timeout)
The time during which response should be received.
Definition: IQRFDeviceManager.cpp:76
void setIQRFDevicesRetryTimeout(const Poco::Timespan &timeout)
Sets the timeout of waiting for next attempt to communicate with IQRF devices. Timeout must be at lea...
Definition: IQRFDeviceManager.cpp:109
Definition: DeviceID.h:17