Update hidl-gen support for vts.
* Support the new Enum type (based on scalar_data)
* Support sub_struct/sub_union defined within compound type.
* Code cleanup: use getVtsType() instead of hard code ones.
Test: make hidl-gen, locally run make hidl_gen_test.
Bug: 30762234
Change-Id: I9a21b5757e0a9fc6cd1bf829ab123565a7990ad5
diff --git a/VectorType.cpp b/VectorType.cpp
index 2e7d932..f656281 100644
--- a/VectorType.cpp
+++ b/VectorType.cpp
@@ -65,6 +65,10 @@
return mElementType->getJavaType(&elementExtra) + elementExtra;
}
+std::string VectorType::getVtsType() const {
+ return "TYPE_VECTOR";
+}
+
void VectorType::emitReaderWriter(
Formatter &out,
const std::string &name,
@@ -540,7 +544,8 @@
}
status_t VectorType::emitVtsTypeDeclarations(Formatter &out) const {
- out << "type: TYPE_VECTOR\n" << "vector_value: {\n";
+ out << "type: " << getVtsType() << "\n";
+ out << "vector_value: {\n";
out.indent();
status_t err = mElementType->emitVtsTypeDeclarations(out);
if (err != OK) {