Ndk中是否有任何ble API [英] is there any ble api in Ndk

查看:185
本文介绍了Ndk中是否有任何ble API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们可以直接使用来自Ndk的Ble硬件(低功耗蓝牙),而无需任何Java接口吗?

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

我是NDk的新手.所以我不知道jni或Ndk.

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 ,

推荐答案

是和否.

否:ndk中没有BLE API .

NO: There is no BLE API in ndk.

是的:您可以通过C代码与BT硬件对话.

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

在AOSP中,在<>/hardware/libhardware/include/hardware/下查看 有很多标题.

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

bluetooth.h定义了Android蓝牙模块的接口. Bluedroid实现了它.

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

您可以在进程中加载​​bluedroid模块,然后直接从代码中调用接口方法.

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

您需要确保没有其他进程正在加载此模块,以确保您的进程可以完全访问BT硬件.

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

这篇关于Ndk中是否有任何ble API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆