Emit toString functions for all types.

* toString() is mainly for debugging purposes only.

* For HIDL internal types (hidl_string, hidl_vec, etc.)
  toString() is found in ::android::hardware::details.

* For a user defined type
  android.hardware.foo@1.0::IFoo.Type,
  toString() is found in ::android::hardware::foo::V1_0.

* For bitfield<::anroid::hardware::foo::V1_0::T>
  that gets translated to the underlying
  numeric type of T, it doesn't make sense to override toString().
  A templated toString() function for each user-defined HIDL enum \
  is introduced into the same namespace; call it with
    using namespace ::android::hardware::foo::V1_0;
    toString<IFoo::MyEnumType>(value);

Test: hidl_test and look at the output of logcat

Bug: 33459772

Change-Id: I70eee018e31d700bf1376334276dbd343af5615f
14 files changed
tree: d1921bdd033ebe8bc7e871dd84e937ed98d989f7
  1. c2hal/
  2. test/
  3. utils/
  4. Android.bp
  5. Annotation.cpp
  6. Annotation.h
  7. ArrayType.cpp
  8. ArrayType.h
  9. AST.cpp
  10. AST.h
  11. CompoundType.cpp
  12. CompoundType.h
  13. ConstantExpression.cpp
  14. ConstantExpression.h
  15. Coordinator.cpp
  16. Coordinator.h
  17. DeathRecipientType.cpp
  18. DeathRecipientType.h
  19. EnumType.cpp
  20. EnumType.h
  21. FmqType.cpp
  22. FmqType.h
  23. FQName.cpp
  24. FQName.h
  25. generateCpp.cpp
  26. generateCppImpl.cpp
  27. generateJava.cpp
  28. generateVts.cpp
  29. HandleType.cpp
  30. HandleType.h
  31. hidl-gen_l.ll
  32. hidl-gen_y.yy
  33. Interface.cpp
  34. Interface.h
  35. Location.h
  36. main.cpp
  37. MemoryType.cpp
  38. MemoryType.h
  39. Method.cpp
  40. Method.h
  41. MODULE_LICENSE_APACHE2
  42. NamedType.cpp
  43. NamedType.h
  44. NOTICE
  45. PointerType.cpp
  46. PointerType.h
  47. README.md
  48. RefType.cpp
  49. RefType.h
  50. ScalarType.cpp
  51. ScalarType.h
  52. Scope.cpp
  53. Scope.h
  54. StringType.cpp
  55. StringType.h
  56. Type.cpp
  57. Type.h
  58. TypeDef.cpp
  59. TypeDef.h
  60. VectorType.cpp
  61. VectorType.h
README.md

hidl-gen user guide

1. Build

croot
make hidl-gen

2. Run

hidl-gen -o output-path -L language (-r interface-root) fqname

output-path: directory to store the output files.
language: output file for given language. e.g.c++, vts..

fqname: fully qualified name of the input files.
For singe file input, follow the format: package@version::fileName
For directory input, follow the format: package@version

interface-root(optional): prefix and root path for fqname.
If not set, use the default prefix: android.hardware and default root path
defined in $TOP.

examples:

croot
hidl-gen -o output -L c++ -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport android.hardware.nfc@1.0::INfc.hal
hidl-gen -o output -L vts -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport android.hardware.nfc@1.0
hidl-gen -o test -L c++ -r android.hardware:hardware/interfaces -r android.hidl:system/libhidl/transport android.hardware.nfc@1.0