7 #include <Poco/Logger.h>
8 #include <Poco/Mutex.h>
9 #include <Poco/RunnableAdapter.h>
10 #include <Poco/Thread.h>
11 #include <Poco/Timespan.h>
13 #include "bluetooth/BluetoothDevice.h"
14 #include "bluetooth/HciInterface.h"
15 #include "commands/DeviceAcceptCommand.h"
16 #include "core/DongleDeviceManager.h"
17 #include "model/DeviceID.h"
18 #include "model/SensorData.h"
51 void setModes(
const std::list<std::string> &modes);
65 const std::set<DeviceID> &devices,
66 const DeviceStatusHandler::DeviceValues &values)
override;
69 void handleAccept(
const DeviceAcceptCommand::Ptr cmd)
override;
73 const Poco::Timespan &timeout)
override;
83 std::list<DeviceID> detectClassic(
const HciInterface &hci);
93 bool haveTimeForInactive(Poco::Timespan elapsedTime);
99 void loadPairedDevices();
101 bool enoughTimeForScan(
const Poco::Timestamp &startTime);
103 void reportFoundDevices(
const int mode,
const std::map<MACAddress, std::string> &devices);
107 void removeDevice(
const DeviceID &
id);
114 const std::string &name);
116 std::list<ModuleType> moduleTypes()
const;
122 Poco::RunnableAdapter<BluetoothAvailabilityManager> m_listenThread;
123 Poco::Timespan m_wakeUpTime;
124 Poco::Timespan m_leScanTime;
125 Poco::Thread m_thread;
126 std::map<DeviceID, BluetoothDevice> m_deviceList;
127 Poco::FastMutex m_lock;
128 Poco::FastMutex m_scanLock;
129 HciInterfaceManager::Ptr m_hciManager;
130 Poco::Timespan m_listenTime;
132 std::map<MACAddress, std::string> m_leScanCache;
Definition: FailDetector.h:8
void handleRemoteStatus(const DevicePrefix &prefix, const std::set< DeviceID > &devices, const DeviceStatusHandler::DeviceValues &values) override
Handle device status as understood by a remote server. All devices of a certain prefix are notified i...
Definition: BluetoothAvailabilityManager.cpp:318
Definition: BluetoothAvailabilityManager.h:22
void stop() override
Definition: BluetoothAvailabilityManager.cpp:167
std::string dongleMatch(const HotplugEvent &e) override
Recognizes compatible dongle by testing HotplugEvent property as bluetooth.BEEEON_DONGLE == bluetooth...
Definition: BluetoothAvailabilityManager.cpp:162
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: BluetoothAvailabilityManager.cpp:277
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: MACAddress.h:8
bool dongleMissing() override
Definition: BluetoothAvailabilityManager.cpp:121
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: BluetoothAvailabilityManager.cpp:294
void dongleAvailable() override
Definition: BluetoothAvailabilityManager.cpp:94
void setLEScanTime(const Poco::Timespan &time)
Definition: BluetoothAvailabilityManager.cpp:76
void dongleFailed(const FailDetector &dongleStatus) override
Definition: BluetoothAvailabilityManager.cpp:136
Definition: HotplugEvent.h:10
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: BluetoothAvailabilityManager.cpp:286
Definition: DongleDeviceManager.h:14
void setHciManager(HciInterfaceManager::Ptr manager)
Definition: BluetoothAvailabilityManager.cpp:463
void notifyDongleRemoved() override
The default implementation does nothing.
Definition: BluetoothAvailabilityManager.cpp:151
Definition: BluetoothDevice.h:16
Definition: DeviceID.h:17
Definition: HciInterface.h:16
void setWakeUpTime(const Poco::Timespan &time)
Definition: BluetoothAvailabilityManager.cpp:66
DevicePrefix prefix() const override
Definition: DeviceManager.cpp:33