问题
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