26#ifndef DBT_DEV_ACCOUNTING_HPP_
27#define DBT_DEV_ACCOUNTING_HPP_
45 namespace BTDeviceRegistry {
115 return "["+addressAndType.
toString()+
", '"+name+
"']";
129 return lhs.addressAndType == rhs.addressAndType;
132 {
return !(lhs == rhs); }
192 return q.isEUI48Sub() ? a.
contains(q.addressSub) : n.find(q.nameSub) != std::string::npos;
237 template<>
struct hash<
direct_bt::BTDeviceRegistry::DeviceID> {
239 return a.hash_code();
Unique Bluetooth EUI48 address and BDAddressType tuple.
std::size_t hash_code() const noexcept
Implementation uses a lock-free volatile cache.
std::string toString() const noexcept
void clearProcessedDevices() noexcept
Clears internal list.
std::string getProcessedDevicesString() noexcept
void addToWaitForDevices(const std::string &addrOrNameSub) noexcept
size_t getProcessedDeviceCount() noexcept
bool operator==(const DeviceID &lhs, const DeviceID &rhs) noexcept
void clearWaitForDevices() noexcept
Clears internal list.
std::string getWaitForDevicesString() noexcept
jau::darray< DeviceID > getProcessedDevices() noexcept
Returns a copy of the current collection of processed DeviceID.
bool isDeviceProcessed(const BDAddressAndType &a) noexcept
bool areAllDevicesProcessed(DeviceQueryMatchFunc m) noexcept
Returns true if all addToWaitForDevices() awaited devices have been addToProcessedDevices() processed...
bool isWaitingForAnyDevice() noexcept
size_t getWaitForDevicesCount() noexcept
jau::darray< DeviceQuery > & getWaitForDevices() noexcept
Returns the reference of the current list of DeviceQuery, not a copy.
void addToProcessedDevices(const BDAddressAndType &a, const std::string &n) noexcept
bool operator!=(const DeviceID &lhs, const DeviceID &rhs) noexcept
bool(* DeviceQueryMatchFunc)(const EUI48 &address, const std::string &name, const DeviceQuery &q)
Function for user defined BTDeviceRegistry::DeviceQuery matching criteria and algorithm.
bool isWaitingForDevice(const EUI48 &address, const std::string &name, DeviceQueryMatchFunc m) noexcept
Returns true if the given address and/or name matches any of the BTDeviceRegistry::addToWaitForDevice...
__pack(...): Produces MSVC, clang and gcc compatible lead-in and -out macros.
Specifies unique device identities, using BDAddressAndType as key.
DeviceID(BDAddressAndType a, std::string n)
BDAddressAndType addressAndType
std::string toString() const
std::size_t hash_code() const noexcept
Specifies devices queries to act upon.
DeviceQuery(const EUI48Sub &as)
std::string toString() const
Type
DeviceQuery type, i.e.
@ EUI48SUB
DeviceQuery type, using a sensor device EUI48Sub.
DeviceQuery(std::string ns)
bool isEUI48Sub() const noexcept
A 48 bit EUI-48 sub-identifier, see EUI48.
std::string toString() const noexcept
Returns the EUI48 sub-string representation with MSB first (lb_endian::big), less or equal 17 charact...
A packed 48 bit EUI-48 identifier, formerly known as MAC-48 or simply network device MAC address (Med...
bool contains(const EUI48Sub &needle) const noexcept
std::size_t operator()(direct_bt::BTDeviceRegistry::DeviceID const &a) const noexcept