Implement RadioModem for AIDL-HIDL Telephony HAL translator
Bug: 203699028
Test: Boot and grep logcat against radiocompat
Change-Id: I670f78af2cd7a0ce0b49dfc802fd363f47d9b6a6
diff --git a/radio/aidl/compat/libradiocompat/collections.h b/radio/aidl/compat/libradiocompat/collections.h
index e3439a7..082ef17 100644
--- a/radio/aidl/compat/libradiocompat/collections.h
+++ b/radio/aidl/compat/libradiocompat/collections.h
@@ -55,6 +55,22 @@
}
/**
+ * Converts hidl_array<T> HIDL list to std::vector<T> AIDL list.
+ *
+ * To convert values, the template uses toAidl functions for a given type T, assuming it's defined.
+ *
+ * \param inp array to convert
+ */
+template <typename T, size_t N>
+auto toAidl(const hidl_array<T, N>& inp) {
+ std::vector<decltype(toAidl(T{}))> out(N);
+ for (size_t i = 0; i < N; i++) {
+ out[i] = toAidl(inp[i]);
+ }
+ return out;
+}
+
+/**
* Converts T=OptionalX HIDL value to std::optional<X> AIDL value.
*
* To convert values, the template uses toAidl functions for a given type T.value.