summaryrefslogtreecommitdiff
path: root/audio/common/all-versions/default/UuidUtils.cpp
diff options
context:
space:
mode:
authorMikhail Naganov <mnaganov@google.com>2021-01-15 19:05:04 +0000
committerMikhail Naganov <mnaganov@google.com>2021-02-03 01:28:38 +0000
commita9ac889b9626f14e1a6310f4ca04a87cedf87d18 (patch)
tree5ccbbcfd29cbf4306f394f6180eae55b3e35aa31 /audio/common/all-versions/default/UuidUtils.cpp
parent39059ed17f8fef43fee286cc0eacbb910ee2b772 (diff)
audio: Create libraries for data types in core and effect
Add 'CoreUtils' library similar to 'HidlUtils' for the types specific to the core HAL. Add 'EffectUtils' library similar to 'HidlUtils' for the types specific to the effects HAL. Move into them and de-duplicate code previously scattered across the default HAL implementation and libaudiohal. Add unit tests. Removed 'AUDIO_{INPUT|OUTPUT}_FLAG_NONE' from the list of values in the XSD file to avoid additional complexity due to equivalence of this value to an empty list of flags. Bug: 142480271 Test: m android.hardware.audio@X.0-impl Test: m android.hardware.audio.effect@X.0-impl Test: atest android.hardware.audio@7.0-util_tests Test: atest android.hardware.audio.common@7.0-util_tests Test: atest android.hardware.audio.effect@7.0-util_tests Change-Id: I71a95cbe07fcc162dc6d74ff9665747a17ce5a80 Merged-In: I71a95cbe07fcc162dc6d74ff9665747a17ce5a80
Diffstat (limited to 'audio/common/all-versions/default/UuidUtils.cpp')
-rw-r--r--audio/common/all-versions/default/UuidUtils.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/audio/common/all-versions/default/UuidUtils.cpp b/audio/common/all-versions/default/UuidUtils.cpp
index 85edc7b2f4..6c4c94d415 100644
--- a/audio/common/all-versions/default/UuidUtils.cpp
+++ b/audio/common/all-versions/default/UuidUtils.cpp
@@ -42,6 +42,14 @@ void UuidUtils::uuidToHal(const Uuid& uuid, audio_uuid_t* halUuid) {
memcpy(halUuid->node, uuid.node.data(), uuid.node.size());
}
+std::string UuidUtils::uuidToString(const audio_uuid_t& halUuid) {
+ char str[64];
+ snprintf(str, sizeof(str), "%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x", halUuid.timeLow,
+ halUuid.timeMid, halUuid.timeHiAndVersion, halUuid.clockSeq, halUuid.node[0],
+ halUuid.node[1], halUuid.node[2], halUuid.node[3], halUuid.node[4], halUuid.node[5]);
+ return str;
+}
+
} // namespace implementation
} // namespace CPP_VERSION
} // namespace common