目录
HIDL 代码样式类似于 Android 框架中的 C++ 代码,缩进 4 个空格,并且采用混用大小写的文件名。软件包声明、导入和文档字符串与 Java 中的类似,只有些微差别。
下面针对 IFoo.hal
和 types.hal
的示例展示了 HIDL 代码样式,并提供了指向每种样式(IFooClientCallback.hal
、IBar.hal
和 IBaz.hal
已省略)详细信息的快速链接。
hardware/interfaces/foo/1.0/IFoo.hal
/*
* (License Notice)
*/
package android.hardware.foo@1.0;
import android.hardware.bar@1.0::IBar;
import IBaz;
import IFooClientCallback;
/**
* IFoo is an interface that…
*/
interface IFoo {
/**
* This is a multiline docstring.
* @return result 0 if successful, nonzero otherwise.
*/
foo() generates (FooStatus result);
/**
* Restart controller by power cycle.
* @param bar callback interface that…
* @retu