的Andr​​oid NDK访问本机蓝牙功能bluedroid [英] Android NDK accessing native bluetooth functions bluedroid

查看:384
本文介绍了的Andr​​oid NDK访问本机蓝牙功能bluedroid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想看到什么样的原生的蓝牙功能,我可以使用JNI和Android NDK进行访问。我试了两种不同的方法:使用prebuilt。所以还是建设自己的。至于使用prebuilt。所以我已经将libbluetooth_jni.so掀起了三星Galaxy S4使用亚行拉。但是,我无法找到源$ C ​​$ C本(bluetooth_jni.c?)网上,不能确定任何访问功能。

I'm trying to see what sort of native bluetooth functions i can access using JNI and Android NDK. I've tried two different approaches: Using a prebuilt .so or building my own. As far as using a prebuilt .so I've pulled libbluetooth_jni.so off a Samsung Galaxy S4 using adb pull. However, I cannot find the source code for this (bluetooth_jni.c??) online and can't identify any accessible functions.

其次,我试图下载源来自
bluedroid https://android.googlesource.com/platform/external/bluetooth/bluedroid/
不过,我有麻烦建设这个。

Secondly, I tried to download the source for bluedroid from
https://android.googlesource.com/platform/external/bluetooth/bluedroid/
However, I am having trouble building this.

目前,当我尝试运行NDK建造,我得到了以下错误:
    未定义的引用__android_log_print
    未定义的引用socket_local_client_connect
    未定义的引用str_parms_destroy

Currently when I try to run ndk-build, I get the following errors:
undefined reference to '__android_log_print'
undefined reference to 'socket_local_client_connect'
undefined reference to 'str_parms_destroy'

我加入到这一行:
    LOCAL_LDLIBS:= -llog
它摆脱了第一个错误。但是,我不知道如何摆脱别人的。

I added to this line:
LOCAL_LDLIBS := -llog
and it got rid of the first error. However, I'm not sure how to get rid of the others.

谁能给我关于如何编译或以其他方式得到的。所以,以访问本地蓝牙功能的一些建议?

Can anyone give me some advice on how to compile or otherwise get an .so in order to access native bluetooth functions??

推荐答案

libbluedroid 是具体的一些硬件;三星S4你会发现不同的蓝牙库。如果你需要超越公众蓝牙API,你可能不会发现一个共同点。

libbluedroid is specific for some hardware; on Samsung S4 you will find different bluetooth libraries. If you need to go beyond the public bluetooth API, you will probably not find a common ground.

这是你面临的另一个问题是,这些库不能在应用环境中工作,作为 @克里斯说明了他评论。它们被设计与媒体服务器的特殊权限的工作。

Another problem that you face is that these libraries cannot work in app context, as @Chris explained in his comment. They were designed to work with the media server with its special permissions.

至于具体提及,他们在 libcutils.so 。关于本次非公开图书馆最近讨论这里

Regarding the specific references, they are in libcutils.so. The recent discussion about this non-public library is here.

这篇关于的Andr​​oid NDK访问本机蓝牙功能bluedroid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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