2

過去 2 日間、Raspiberry pi ヘッドレス スピーカーを介して iPhone からメディアの再生を制御する方法を探していました。

次のチュートリアルを使用して pi を正常にセットアップしました: Raspbian Stretch でのヘッドレス A2DP オーディオ ストリーミング。 現在、raspberry pi からのオーディオ ストリームの再生を制御する方法を探しています。

MediaTransport1、MediaPlayer1、MediaControl1 を調べましたが、残念ながら成功しませんでした。

私が行った試行錯誤の例をいくつか挙げます。

為に:

dbus-send --system --print-reply --dest=org.bluez /org/bluez/hci0/dev_C8_85_50_B1_C8_6B org.bluez.MediaPlayer1.Pause

私は受け取った:

Error org.freedesktop.DBus.Error.UnknownMethod: Method "Pause" with signature "" on interface "org.bluez.MediaPlayer1" doesn't exist

為に

qdbus --system org.bluez /org/bluez/hci0/dev_C8_85_50_B1_C8_6B/fd0 org.freedesktop.DBus.Properties.Set org.bluez.MediaTransport1 Volume 127

受け取りました

Error: org.freedesktop.DBus.Error.InvalidSignature
Invalid signature for 'Volume'

さらに、ここで例として独自のスクリプトを作成するために使用できると思ったプレーヤーを見つけました が、エラーが発生しました:

pi@raspberrypi:~/blueutils $ python simpleplayer.py


Available commands:
        PropertiesChanged(interface, properties)
        help(cmd)

Use python syntax to pass arguments to available methods.
E.g.: PropertiesChanged({'Metadata' : {'Title': 'My title',             'Album': 'my album' }})

>>> <Interface <ProxyObject wrapping <dbus._dbus.SystemBus (system) at 0xb61968d0> :1.13 /org/bluez/hci0 at 0xb619db70> implementing 'org.bluez.Media1' at 0xb619dc50>
Traceback (most recent call last):
  File "simpleplayer.py", line 197, in <module>
    media.RegisterPlayer(dbus.ObjectPath(path), player.properties)
  File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 70, in __call__
    return self._proxy_method(*args, **keywords)
  File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 145, in __call__
    **keywords)
  File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.bluez.Error.NotSupported: Operation is not supported

内省するとき

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

私は彼を手に入れます:

<node>
    <interface name="org.freedesktop.DBus.Introspectable">
        <method name="Introspect">
            <arg name="xml" type="s" direction="out"/>
        </method>
    </interface>
    <interface name="org.bluez.Adapter1">
        <method name="StartDiscovery"></method>
        <method name="SetDiscoveryFilter">
            <arg name="properties" type="a{sv}" direction="in"/>
        </method>
        <method name="StopDiscovery"></method>
        <method name="RemoveDevice">
            <arg name="device" type="o" direction="in"/>
        </method>
        <property name="Address" type="s" access="read"></property>
        <property name="Name" type="s" access="read"></property>
        <property name="Alias" type="s" access="readwrite"></property>
        <property name="Class" type="u" access="read"></property>
        <property name="Powered" type="b" access="readwrite"></property>
        <property name="Discoverable" type="b" access="readwrite"></property>
        <property name="DiscoverableTimeout" type="u" access="readwrite"></property>]

        <property name="Pairable" type="b" access="readwrite"></property>
        <property name="PairableTimeout" type="u" access="readwrite"></property>
        <property name="Discovering" type="b" access="read"></property>
        <property name="UUIDs" type="as" access="read"></property>
        <property name="Modalias" type="s" 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>
    <interface name="org.bluez.GattManager1">
        <method name="RegisterApplication">
            <arg name="application" type="o" direction="in"/>
            <arg name="options" type="a{sv}" direction="in"/>
        </method>
        <method name="UnregisterApplication">
            <arg name="application" type="o" direction="in"/>
        </method>
    </interface>
    <interface name="org.bluez.Media1">
        <method name="RegisterEndpoint">
            <arg name="endpoint" type="o" direction="in"/>
            <arg name="properties" type="a{sv}" direction="in"/>
        </method>
        <method name="UnregisterEndpoint">
            <arg name="endpoint" type="o" direction="in"/>
        </method>
        <method name="RegisterPlayer">
            <arg name="player" type="o" direction="in"/>
            <arg name="properties" type="a{sv}" direction="in"/>
        </method>
        <method name="UnregisterPlayer">
            <arg name="player" type="o" direction="in"/>
        </method>
    </interface>
    <node name="dev_40_9C_28_07_63_DD"/>
    <node name="dev_C8_85_50_B1_C8_6B"/>
</node>

誰かがこの問題を解決するのを手伝ってくれますか、またはラズベリーパイを使用して電話で音楽の再生を制御する手順を知っている人はいますか?

よろしく。

更新 1: 完全に機能する @Parthiban に感謝します。

さらに、ここのチュートリアルに従って、bluez バージョンを 5.50 に再インストールしたと言わざるをません。ソースをコンパイルする前に、少し余分なことをしました(関連性があるかどうかはわかりませんが、害はありません)、追加しました.auto_connect = true

示されている avrcp プロファイル:

ここ

これが私の問題に直面する可能性のあるすべての人に役立つことを願っています

4

1 に答える 1