I can't seem to access certain (most) of the properties of the BlueZ MediaPlayer1 interface using Python:
#!/usr/bin/python
import dbus
bus = dbus.SystemBus()
player = bus.get_object('org.bluez','/org/bluez/hci0/dev_78_6A_89_FA_1C_95/player0')
BT_Media_iface = dbus.Interface(player, dbus_interface='org.bluez.MediaPlayer1')
BT_Media_props = dbus.Interface(player, "org.freedesktop.DBus.Properties")
props = BT_Media_props.GetAll("org.bluez.MediaPlayer1")
print props
Returns only a few properties:
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'))
According to the API (https://kernel.googlesource.com/pub/scm/bluetooth/bluez/+/5.43/doc/media-api.txt) and the Introspective there should me many more properties available.
Querying the introspective:
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
Returns:
<!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>
The methods work fine, but I was hoping to also access stuff like the shuffle setting and track dictionary object. The host (Raspberry Pi Zero W) is connected to my Android phone, which is playing music from there.
Bluez only shows up application settings supported by the target in DBus Properties. In other words, properties that you see on DBus introspection are possible settings and properties that GetAll method returns are supported settings of the target device. Bluez which plays the controller role of AVRCP Bluetooth profile sends "List Player Application Settings (11)" command to the target device after connection establishment; Response to this command tells all the application settings that are supported by the target. So, controller (i.e., Raspberry Pi in your case) can only alter these settings on the target. See code in profile/avtcp.c in the bluez source for better understanding.
To validate, you can connect any other know AVRCP profile supported headset which has an option to change settings like "repeat" and see whether it works with your phone or not.