在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。 –