You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
实现java调用hidl service的例子
2.1 添加库:
将以下内容添加到 Android.mk 中:
LOCAL_JAVA_LIBRARIES += android.hardware.foo-V1.0-java
或
将以下内容添加到 Android.bp 中:
shared_libs: [
/* … /
"android.hardware.foo-V1.0-java",
],
该库还存在静态版:android.hardware.foo-V1.0-java-static。
2.2 将以下内容添加到您的 Java 文件中:
import android.hardware.foo.V1_0.IFoo;
...
// retry to wait until the service starts up if it is in the manifest
IFoo server = IFoo.getService(true / retry /); // throws NoSuchElementException if not available
IFoo anotherServer = IFoo.getService("second_impl", true / retry */);
server.doSomething(…);
实现C++ 调用hidl service的例子
首先将 HAL 库添加到 makefile 中:
Make:LOCAL_SHARED_LIBRARIES += android.hardware.nfc@1.0
Soong:shared_libs: [ …, android.hardware.nfc@1.0 ]
接下来,添加 HAL 头文件:
#include <android/hardware/nfc/1.0/IFoo.h>
…
// in code:
sp client = IFoo::getService();
client->doThing();
The text was updated successfully, but these errors were encountered:
绑定式HAL,java客户端调用Service和C++调用能传对象吗?
实现java调用hidl service的例子
2.1 添加库:
将以下内容添加到 Android.mk 中:
LOCAL_JAVA_LIBRARIES += android.hardware.foo-V1.0-java
或
将以下内容添加到 Android.bp 中:
shared_libs: [
/* … /
"android.hardware.foo-V1.0-java",
],
该库还存在静态版:android.hardware.foo-V1.0-java-static。
2.2 将以下内容添加到您的 Java 文件中:
import android.hardware.foo.V1_0.IFoo;
...
// retry to wait until the service starts up if it is in the manifest
IFoo server = IFoo.getService(true / retry /); // throws NoSuchElementException if not available
IFoo anotherServer = IFoo.getService("second_impl", true / retry */);
server.doSomething(…);
实现C++ 调用hidl service的例子
首先将 HAL 库添加到 makefile 中:
Make:LOCAL_SHARED_LIBRARIES += android.hardware.nfc@1.0
Soong:shared_libs: [ …, android.hardware.nfc@1.0 ]
接下来,添加 HAL 头文件:
#include <android/hardware/nfc/1.0/IFoo.h>
…
// in code:
sp client = IFoo::getService();
client->doThing();
The text was updated successfully, but these errors were encountered: