發表文章

目前顯示的是 5月, 2012的文章

如何以指令方式啟用你的藍芽音樂裝置(A2DP)

圖片
How to bluetooth with Ubuntu Desktop Environment ? Are you looking for a way to manipulate your Bluetooth device in console in Ubuntu ? Stop, searching. This is it. Using D-Bus interface to communicate with your Bluetooth. The following example demonstrates how to connect to your Bluetooth Audio Sink device by using D-Bus. 如何在Ubuntu的指令模式下,操作與控制你的藍芽裝置。假設你所使用的環境是Ubuntu 桌面操作環境,你想編寫或是透過指令的方式,快速操作你的藍芽裝置,這裡提供一個不錯的方式給你參考,可以使用 D-Bus 的方式結合shell script的方式來達成。   操作實例說明: 利用dbus的方式啟用你的藍芽ASDP裝置,假設你的藍芽裝置已經配對成功過了,只需要重新連線。那麼操作指令如下。 操作步驟: 1. 掃描藍芽裝置 $hcitool scan 2. 取得藍芽裝置在D-Bus的位置 $ dbus-send --system --type=method_call --print-reply --dest=org.bluez "/" org.bluez.Manager.ListAdapters 3. 主機跟藍芽裝置連線 $dbus-send --system --type=method_call --print-reply --dest=org.bluez "/org/bluez/XXXX /hci0/dev_XX_XX_XX_XX_XX_XX" org.bluez.AudioSink.Connect 如果打算斷線就把後面改成org.bluez.AudioSink.Disconnet 資料參考: http://www.spinics.net/lists/linux-bluetooth/msg13332.html http://