I am working on a head unit project using a Raspberry Pi. The goal is to have a graphical user interface on the head unit that can control the phone when playing music.
I cant seem to get the phone to enable "Shuffle" or "Repeat".
I am using Bluez 5.45, and GLIB. I have basic control over play, stop, next.
Is there a similar function to g_dbus_proxy_set_cached_property()?
I have tried the function g_dbus_proxy_set_cached_property() but it only updates the cached value, the phone never receives the value set.
I found out how to set/get properties. I used the g_dbus_proxy_call_sync method.
g_dbus_proxy_call_sync (GDBusProxy *proxy,
const gchar *method_name,
GVariant *parameters,
GDBusCallFlags flags,
gint timeout_msec,
GCancellable *cancellable,
GError **error);
I needed to access the "org.freedesktop.DBUS.Properties" interface. I needed to use the "Set" method. It takes three paramaters.
Set(String interface_name, String property_name, A value)
value - The new value of the property (May be any valid DBUS type).
g_dbus_proxy_call_sync( myProxy,
"org.freedesktop.DBus.Properties.Set",
g_variant_new ("(ssv)",
"org.bluez.MediaPlayer1",
"Repeat",
g_variant_new_string ("alltracks")),
G_DBUS_CALL_FLAGS_NONE, // Flags
-1, // timeout
NULL, // cancellable
&error // error
);