is there any ble api in Ndk

荒凉一梦 提交于 2020-01-11 13:13:31

问题


Can we use Ble hardware(Bluetooth low energy) direct from Ndk without any java interface.

I am new to NDk. So I don't know about jni, or Ndk.

I want to control the bluetooth hardware directly from native code ,


回答1:


NO and YES.

NO: There is no BLE API in ndk.

YES: You can talk to BT hardware from C code.

In AOSP, look under <>/hardware/libhardware/include/hardware/ there are a bunch of headers.

bluetooth.h defines the interface for Android's bluetooth module. Bluedroid implements it.

You could load bluedroid module in your process, and call the interface methods directly from your code.

You'd need to ensure no other process is loading this module to ensure that your process gets full access to BT hardware.



来源:https://stackoverflow.com/questions/40036107/is-there-any-ble-api-in-ndk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!