在Linux中,我曾经使用“hidd --connect mmac”来连接BT设备,但自Bluez5以来已经不存在了。 我可以使用bluetoothctl手动建立连接,但是我需要从我的应用程序使用这些命令,并且使用bluetoothctl会很困难。bluetoothctl to hcitool等价命令
什么是hcitool等效命令来做什么bluetoothctl呢?
例如,我会输入bluetoothctl:
select <cmac>
scan on
trust <mmac>
pairable on
pair <mmac>
connect <mmac>
我可以用“hcitool扫描”的扫描,但我还没有想出连接。 我试过使用“hcitool cc mmac”,后面跟着“hcitool auth mmac”,但没有任何作品。
或者hcitool可以做bluetoothctl做什么?
我从来没有弄清楚hcitool,所以我只是最终使用bluetoothctl发送stdin并处理它的stdout。不优雅,但它的作品。 –
这个问题似乎是脱离主题,因为它是关于一般的Linux使用,而不是任何类型的编程。请在unix.stackexchange.com或askubuntu.com询问。 –
这与编程有关。我从一个Java应用程序发出这些命令(使用java.lang.Runtime.exec),这是一个前端应用程序连接到蓝牙设备。在我的其他评论中,我解释说我找到了一个使用bluetoothctl的解决方法,使用stdin/stdout,它涉及使用java.lang.ProcessBuilder。 –