Loading system/bta/groups/groups.cc +34 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,8 @@ class DeviceGroup { const Uuid& GetUuid(void) const { return group_uuid_; } private: friend std::ostream& operator<<(std::ostream& out, const bluetooth::groups::DeviceGroup& value); int group_id_; Uuid group_uuid_; std::unordered_set<RawAddress> devices_; Loading Loading @@ -261,6 +263,18 @@ class DeviceGroupsImpl : public DeviceGroups { return true; } void Dump(int fd) { std::stringstream stream; stream << " Num. registered clients: " << callbacks_.size() << std::endl; stream << " Groups:\n"; for (const auto& kv_pair : groups_) { stream << kv_pair.second << std::endl; } dprintf(fd, "%s", stream.str().c_str()); } private: DeviceGroup* find_device_group(int group_id) { return groups_.count(group_id) ? &groups_.at(group_id) : nullptr; Loading Loading @@ -350,6 +364,26 @@ void DeviceGroups::CleanUp(DeviceGroupsCallbacks* callbacks) { instance = nullptr; } } std::ostream& operator<<(std::ostream& out, bluetooth::groups::DeviceGroup const& group) { out << " == Group id: " << group.group_id_ << " == \n" << " Uuid: " << group.group_uuid_ << std::endl; out << " Devices:\n"; for (auto const& addr : group.devices_) { out << " " << addr << std::endl; } return out; } void DeviceGroups::DebugDump(int fd) { dprintf(fd, "Device Groups Manager:\n"); if (instance) instance->Dump(fd); else dprintf(fd, " Not initialized \n"); } DeviceGroups* DeviceGroups::Get() { return instance; } } // namespace groups Loading system/bta/include/bta_groups.h +1 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ class DeviceGroups { static bool GetForStorage(const RawAddress& addr, std::vector<uint8_t>& out); static void CleanUp(DeviceGroupsCallbacks* callbacks); static DeviceGroups* Get(); static void DebugDump(int fd); /** To add to the existing group, group_id needs to be provided. * Otherwise a new group for the given context uuid will be created. */ Loading system/bta/le_audio/client.cc +2 −0 Original line number Diff line number Diff line Loading @@ -3030,6 +3030,8 @@ void LeAudioClient::Initialize( } void LeAudioClient::DebugDump(int fd) { DeviceGroups::DebugDump(fd); dprintf(fd, "LeAudio Manager: \n"); if (instance) instance->Dump(fd); Loading system/bta/test/common/mock_device_groups.cc +2 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,8 @@ void bluetooth::groups::DeviceGroups::Initialize( mock_groups->Initialize(callbacks); }; void bluetooth::groups::DeviceGroups::DebugDump(int) {} void bluetooth::groups::DeviceGroups::CleanUp( bluetooth::groups::DeviceGroupsCallbacks* callbacks) { LOG_ASSERT(mock_groups) << "Mock Device Groups not set!"; Loading system/types/bluetooth/uuid.h +2 −1 Original line number Diff line number Diff line Loading @@ -119,13 +119,14 @@ class Uuid final { // Network-byte-ordered ID (Big Endian). UUID128Bit uu; }; } // namespace bluetooth inline std::ostream& operator<<(std::ostream& os, const bluetooth::Uuid& a) { os << a.ToString(); return os; } } // namespace bluetooth // Custom std::hash specialization so that bluetooth::UUID can be used as a key // in std::unordered_map. namespace std { Loading Loading
system/bta/groups/groups.cc +34 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,8 @@ class DeviceGroup { const Uuid& GetUuid(void) const { return group_uuid_; } private: friend std::ostream& operator<<(std::ostream& out, const bluetooth::groups::DeviceGroup& value); int group_id_; Uuid group_uuid_; std::unordered_set<RawAddress> devices_; Loading Loading @@ -261,6 +263,18 @@ class DeviceGroupsImpl : public DeviceGroups { return true; } void Dump(int fd) { std::stringstream stream; stream << " Num. registered clients: " << callbacks_.size() << std::endl; stream << " Groups:\n"; for (const auto& kv_pair : groups_) { stream << kv_pair.second << std::endl; } dprintf(fd, "%s", stream.str().c_str()); } private: DeviceGroup* find_device_group(int group_id) { return groups_.count(group_id) ? &groups_.at(group_id) : nullptr; Loading Loading @@ -350,6 +364,26 @@ void DeviceGroups::CleanUp(DeviceGroupsCallbacks* callbacks) { instance = nullptr; } } std::ostream& operator<<(std::ostream& out, bluetooth::groups::DeviceGroup const& group) { out << " == Group id: " << group.group_id_ << " == \n" << " Uuid: " << group.group_uuid_ << std::endl; out << " Devices:\n"; for (auto const& addr : group.devices_) { out << " " << addr << std::endl; } return out; } void DeviceGroups::DebugDump(int fd) { dprintf(fd, "Device Groups Manager:\n"); if (instance) instance->Dump(fd); else dprintf(fd, " Not initialized \n"); } DeviceGroups* DeviceGroups::Get() { return instance; } } // namespace groups Loading
system/bta/include/bta_groups.h +1 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ class DeviceGroups { static bool GetForStorage(const RawAddress& addr, std::vector<uint8_t>& out); static void CleanUp(DeviceGroupsCallbacks* callbacks); static DeviceGroups* Get(); static void DebugDump(int fd); /** To add to the existing group, group_id needs to be provided. * Otherwise a new group for the given context uuid will be created. */ Loading
system/bta/le_audio/client.cc +2 −0 Original line number Diff line number Diff line Loading @@ -3030,6 +3030,8 @@ void LeAudioClient::Initialize( } void LeAudioClient::DebugDump(int fd) { DeviceGroups::DebugDump(fd); dprintf(fd, "LeAudio Manager: \n"); if (instance) instance->Dump(fd); Loading
system/bta/test/common/mock_device_groups.cc +2 −0 Original line number Diff line number Diff line Loading @@ -35,6 +35,8 @@ void bluetooth::groups::DeviceGroups::Initialize( mock_groups->Initialize(callbacks); }; void bluetooth::groups::DeviceGroups::DebugDump(int) {} void bluetooth::groups::DeviceGroups::CleanUp( bluetooth::groups::DeviceGroupsCallbacks* callbacks) { LOG_ASSERT(mock_groups) << "Mock Device Groups not set!"; Loading
system/types/bluetooth/uuid.h +2 −1 Original line number Diff line number Diff line Loading @@ -119,13 +119,14 @@ class Uuid final { // Network-byte-ordered ID (Big Endian). UUID128Bit uu; }; } // namespace bluetooth inline std::ostream& operator<<(std::ostream& os, const bluetooth::Uuid& a) { os << a.ToString(); return os; } } // namespace bluetooth // Custom std::hash specialization so that bluetooth::UUID can be used as a key // in std::unordered_map. namespace std { Loading