如何发送蓝牙 AVRCP 供应商相关信息并通过应用程序传递命令?
我想使用 AVRCP 供应商相关的命令或传递命令与另一个蓝牙设备进行通信。从可用的 API 来看,似乎没有任何方法可以从 Android 应用程序进行此类调用。任何人都可以建议这是否可能以及如果可能的话如何做到这一点?
I would like to communicate with another Bluetooth device using the AVRCP vendor dependent or pass through command. From the API available, there does not seem to be any way to make such calls from an android application. Can anyone advise on whether this is possible and how this can be done if it is possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您应该做的是直接与 BlueZ 蓝牙堆栈的 HCI 层进行对话。您可以通过 D-Buss 守护程序来执行此操作,您可以从用户空间执行此操作。接下来,您以 ARVCP 规范为例 1.0,但您可以在蓝牙上找到SIG AVRCP 1.3 或 1.4 规范,并开始解析命令。此演示文稿应该会有所帮助:Android 蓝牙简介 和此 stackoverflow问题。
What you should do is to go directly and speak with the HCI layer of the BlueZ Bluetooth stack. You could do this through D-Buss daemon which you can do it from Userspace. Next you take the ARVCP specs for example 1.0, but you can find on Bluetooth SIG AVRCP 1.3 or 1.4 specs too, and start parsing the commands. This presentation should be helpful: Android Bluetooth Introduction and this stackoverflow question.
请参阅以下链接:
添加Android GB 中的 AVRCP 插件
Refer the below link:
Adding AVRCP Plugin in Android GB
您似乎遇到了蓝牙设备之间最常见的问题,即蓝牙兼容问题。由于蓝牙配置文件没有严格定义音频相关行为,不同制造商实施的不同行为会导致此问题。这就是为什么每个蓝牙设备都应该通过蓝牙组织的蓝牙兼容测试,但是,它并不能消除所有问题。
作为蓝牙协议栈的开源实现,Blue Z 在我看来并不是最好的,而且蓝牙设备的异常行为也带来了麻烦。如果您有一些测试工具,例如 PTS(配置文件调整套件),请尝试使用它来找出哪一方导致了问题。如果配置文件方面一切正常,这对您来说是个好消息,问题可能是由相关应用程序的一些错误引起的。如果配置文件通信出现问题,则意味着您无法在 API 级别进行修改,您可能需要在配置文件堆栈中进行一些肮脏的工作,如果您是手机制造商,它可以解决您的问题,如果您不是,则无法解决问题两者都不。
It seems like you confront the most common problem between Bluetooth devices, the Bluetooth compatible problem. Because the Bluetooth profiles do not strictly defined the audio related behaviors, the different behaviors implemented by different manufacturer would lead this problem. That's why every Bluetooth device should pass the Bluetooth Compatible Test of Bluetooth organization, however, it can not eliminate all problems.
As an open source implementation of Bluetooth Protocol Stack, Blue Z is not the best one in my mind and abnormal behavior of Bluetooth device also making trouble. If you have some test tool like PTS (profile tuning suite), try to use it to find out which side lead the problem. If everything is ok in profile side, that's good news for you, the problem may lead by some bugs of the related application. And if something wrong in the profile communication, it means you can not modified in API level, you may need some dirty work in profile stack and if you are phone manufacturer it can solve you problem, if you are not you can not slove the problem neither.