7 #include <Poco/SharedPtr.h>
8 #include <Poco/SynchronizedObject.h>
9 #include <Poco/Timespan.h>
11 #include "bluetooth/HciInterface.h"
12 #include "core/PollableDevice.h"
13 #include "model/DeviceID.h"
14 #include "model/ModuleID.h"
15 #include "model/ModuleType.h"
16 #include "model/RefreshTime.h"
17 #include "model/SensorData.h"
18 #include "net/MACAddress.h"
19 #include "util/Loggable.h"
28 protected Poco::SynchronizedObject,
31 typedef Poco::SharedPtr<BLESmartDevice> Ptr;
40 const Poco::Timespan& timeout,
42 const HciInterface::Ptr hci);
49 virtual std::list<ModuleType> moduleTypes()
const = 0;
50 virtual std::string productName()
const = 0;
51 virtual std::string vendor()
const = 0;
60 Poco::SharedPtr<HciInterface::WatchCallback> callback);
67 void poll(Distributor::Ptr distributor)
override;
87 const std::vector<unsigned char>& data)
const;
92 Poco::Timespan m_timeout;
95 HciInterface::Ptr m_hci;
virtual SensorData parseAdvertisingData(const std::vector< unsigned char > &data) const
Transforms advertising data to SensorData.
Definition: BLESmartDevice.cpp:62
virtual bool pollable() const
Returns true if the device is pollable, otherwise false.
Definition: BLESmartDevice.cpp:41
RefreshTime represents time of refreshing values from sensors. E.g. sensors are polled periodically o...
Definition: RefreshTime.h:24
virtual void requestModifyState(const ModuleID &moduleID, const double value)
Modifies the device module given by moduleID to a given value.
Definition: BLESmartDevice.cpp:55
Definition: SensorData.h:20
Definition: MACAddress.h:8
RefreshTime refresh() const override
Regular period telling how often to call the method PollableDevice::poll(). The refresh must contain ...
Definition: BLESmartDevice.cpp:31
Definition: ModuleID.h:12
Definition: Loggable.h:19
BLESmartDevice(const MACAddress &address, const Poco::Timespan &timeout, const RefreshTime &refresh, const HciInterface::Ptr hci)
Definition: BLESmartDevice.cpp:9
void poll(Distributor::Ptr distributor) override
Perform polling for data and ship them via the given distributor.
Definition: BLESmartDevice.cpp:51
DeviceID id() const override
Definition: BLESmartDevice.cpp:26
Abstract class representing generic Bluetooth Low Energy smart device.
Definition: BLESmartDevice.h:26
Definition: DeviceID.h:17
PollableDevice is a device that is necessary to poll regularly for data. The polling can take some ti...
Definition: PollableDevice.h:18
virtual void pair(Poco::SharedPtr< HciInterface::WatchCallback > callback)
When the device supports processing of advertising data, it should call a watch() on the given HciInt...
Definition: BLESmartDevice.cpp:46