BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
HciInterface.h
1 #pragma once
2 
3 #include <functional>
4 #include <map>
5 #include <string>
6 
7 #include <Poco/SharedPtr.h>
8 #include <Poco/Timespan.h>
9 
10 #include "bluetooth/HciConnection.h"
11 #include "bluetooth/HciInfo.h"
12 #include "net/MACAddress.h"
13 
14 namespace BeeeOn {
15 
16 class HciInterface {
17 public:
18  typedef Poco::SharedPtr<HciInterface> Ptr;
19  typedef std::function<void(const MACAddress&, std::vector<unsigned char>&)> WatchCallback;
20 
21  virtual ~HciInterface();
22 
28  virtual void up() const = 0;
29 
34  virtual void reset() const = 0;
35 
41  virtual bool detect(const MACAddress &address) const = 0;
42 
48  virtual std::map<MACAddress, std::string> scan() const = 0;
49 
56  virtual std::map<MACAddress, std::string> lescan(
57  const Poco::Timespan &seconds) const = 0;
58 
62  virtual HciInfo info() const = 0;
63 
68  virtual HciConnection::Ptr connect(
69  const MACAddress& address,
70  const Poco::Timespan& timeout) const = 0;
71 
77  virtual void watch(
78  const MACAddress& address,
79  Poco::SharedPtr<WatchCallback> callBack) = 0;
80 
84  virtual void unwatch(const MACAddress& address) = 0;
85 };
86 
88 public:
89  typedef Poco::SharedPtr<HciInterfaceManager> Ptr;
90 
91  virtual ~HciInterfaceManager();
92 
93  virtual HciInterface::Ptr lookup(const std::string &name) = 0;
94 };
95 
96 }
virtual HciConnection::Ptr connect(const MACAddress &address, const Poco::Timespan &timeout) const =0
Definition: HciInterface.h:87
virtual HciInfo info() const =0
virtual std::map< MACAddress, std::string > lescan(const Poco::Timespan &seconds) const =0
virtual std::map< MACAddress, std::string > scan() const =0
virtual void up() const =0
virtual void watch(const MACAddress &address, Poco::SharedPtr< WatchCallback > callBack)=0
Definition: MACAddress.h:8
Definition: HciInfo.h:15
virtual bool detect(const MACAddress &address) const =0
virtual void reset() const =0
virtual void unwatch(const MACAddress &address)=0
Definition: HciInterface.h:16