2017-12-08 9 views
0

私は、Python使用して、特定の(ほとんど)のbluez MediaPlayer1インターフェイスのプロパティへのアクセスに見えることはできません読んのbluez(5.43)がMediaPlayer1プロパティ(パイソン)は

dbus.Dictionary({dbus.String(u'Device'): dbus.ObjectPath('/org/bluez/hci0/dev_78_6A_89_FA_1C_95', variant_level=1), dbus.String(u'Position'): dbus.UInt32(0L, variant_level=1)}, signature=dbus.Signature('sv')) 

API(https://kernel.googlesource.com/pub/scm/bluetooth/bluez/+/5.43/doc/media-api.txt)とイントロスペクティブによれば、さらに多くのプロパティを利用できます。内省の照会

dbus-send --system --type=method_call --print-reply --dest=org.bluez /org/bluez/hci0/dev_78_6A_89_FA_1C_95/player0 org.freedesktop.DBus.Introspectable.Introspect 

戻り値:

<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" 
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> 
<node> 
<interface name="org.freedesktop.DBus.Introspectable"> 
    <method name="Introspect"><arg name="xml" type="s" direction="out"/></method> 
</interface> 
<interface name="org.bluez.MediaPlayer1"> 
    <method name="Play"></method> 
    <method name="Pause"></method> 
    <method name="Stop"></method> 
    <method name="Next"></method> 
    <method name="Previous"></method> 
    <method name="FastForward"></method> 
    <method name="Rewind"></method> 
    <property name="Name" type="s" access="read"></property> 
    <property name="Type" type="s" access="read"></property> 
    <property name="Subtype" type="s" access="read"></property> 
    <property name="Position" type="u" access="read"></property> 
    <property name="Status" type="s" access="read"></property> 
    <property name="Equalizer" type="s" access="readwrite"></property> 
    <property name="Repeat" type="s" access="readwrite"></property> 
    <property name="Shuffle" type="s" access="readwrite"></property> 
    <property name="Scan" type="s" access="readwrite"></property> 
    <property name="Track" type="a{sv}" access="read"></property> 
    <property name="Device" type="o" access="read"></property> 
    <property name="Browsable" type="b" access="read"></property> 
    <property name="Searchable" type="b" access="read"></property> 
    <property name="Playlist" type="o" access="read"></property> 
    </interface> 
    <interface name="org.freedesktop.DBus.Properties"> 
    <method name="Get"><arg name="interface" type="s" direction="in"/><arg name="name" type="s" direction="in"/><arg name="value" type="v" direction="out"/></method> 
    <method name="Set"><arg name="interface" type="s" direction="in"/><arg name="name" type="s" direction="in"/><arg name="value" type="v" direction="in"/></method> 
    <method name="GetAll"><arg name="interface" type="s" direction="in"/><arg name="properties" type="a{sv}" direction="out"/></method> 
    <signal name="PropertiesChanged"><arg name="interface" type="s"/><arg name="changed_properties" type="a{sv}"/><arg name="invalidated_properties" type="as"/></signal> 
</interface> 
</node> 

は、方法が正常に動作しますが、私はまた、シャッフルの設定のようなものをアクセスし、辞書オブジェクトを追跡するために期待していました。ホスト(Raspberry Pi Zero W)はそこから音楽を再生している私のAndroid phoneに接続されています。

答えて

0

Bluezは、DBusのプロパティでターゲットがサポートするアプリケーション設定のみを表示します。つまり、DBusのイントロスペクションで表示されるプロパティは、可能な設定とプロパティです。GetAllメソッドが返すプロパティは、ターゲットデバイスのサポートされている設定です。 AVRCP Bluetoothプロファイルのコントローラ役割を果たすBluezは、接続確立後にターゲットデバイスに「List Player Application Settings(11)」コマンドを送信します。このコマンドへの応答は、ターゲットによってサポートされているすべてのアプリケーション設定を示します。そのため、コントローラ(つまり、あなたのケースのラズベリーパイ)は、ターゲット上のこれらの設定を変更することしかできません。より良い理解のために、bluezソースのprofile/avtcp.cのコードを参照してください。

有効にするには、「リピート」などの設定を変更して携帯電話で動作するかどうかを確認するオプションがある、他のAVRCPプロファイル対応のヘッドセットを接続できます。

+0

はい、Windows 10システムから再生する場合、いくつかの設定が追加されています。どのプレイヤーアプリケーションがターゲット上で使用しているかは重要ではないようです。残念なことに、アプリケーション間の切り替えは使用可能なプロパティを変更しません。 – svenema