commit | 40d474a15ea87fb80b7344fba7602fbb2da2a449 | [log] [tgz] |
---|---|---|
author | Iliyan Malchev <malchev@google.com> | Tue Aug 16 06:20:17 2016 -0700 |
committer | Iliyan Malchev <malchev@google.com> | Thu Aug 18 13:44:16 2016 -0700 |
tree | 64c82e410afca44eafc54ea2653d7512daef27dd | |
parent | f505447dc3b3aa0ab6bedc3a9d67e1b34bd22f23 [diff] |
hidl-gen: callback elision for scalar returns Suppose a HIDL method has a generates clause with a single scalar (including an enum), for example as follows: add(uint32_t a, uint32_t b) generates(uint32_t sum); In this case, hidl-gen will emit the following method signature: SimpleReturn<uint32_t> add(uint32_t a, uint32_t b); SimpleReturn is a standard HIDL struct implementing a tuple of the return value (in this case, uint32_t) and a HWBinder Status object. The tuple can be used as a uint32_t, ignoring the Status value inside it, or the status value can be extracted from it: uint32_t tmol = ifc->add(41, 1); or: if (ifc->add(41, 1)) { ... or auto ret = ifc->add(41, 1); if (ret.status.isOk()) { ... With this, these methods that return a single scalar value do not have to use the awkward synchronous-callback syntax. b/30518487 Optimize out lamdas from HIDL C++ auto-generated code in common cases Change-Id: I83312e0b49d084c641c007df4a09e04a326b5245 Signed-off-by: Iliyan Malchev <malchev@google.com>
croot make hidl-gen
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: hidl-gen -o output -L c++ android.hardware.nfc@1.0::INfc.hal hidl-gen -o output -L vts android.hardware.nfc@1.0 hild-gen -o test -L c++ -r android.hardware:/home/android/master/hardware/interfaces android.hardware.nfc@1.0