treewide: Use DBus defines instead of direct string literals

While cleaning up the BlueZ counterpart of strings defined in
preprocessor macros it is only consistent to take care of all DBUS_
macros as a whole.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/477>
This commit is contained in:
Marijn Suijten 2021-01-08 00:36:06 +01:00 committed by PulseAudio Marge Bot
parent 670f585530
commit 537bf3cf8e
11 changed files with 61 additions and 59 deletions

View file

@ -75,7 +75,7 @@ struct transport_data {
" <arg name=\"opts\" direction=\"in\" type=\"a{sv}\"/>" \ " <arg name=\"opts\" direction=\"in\" type=\"a{sv}\"/>" \
" </method>" \ " </method>" \
" </interface>" \ " </interface>" \
" <interface name=\"org.freedesktop.DBus.Introspectable\">" \ " <interface name=\"" DBUS_INTERFACE_INTROSPECTABLE "\">" \
" <method name=\"Introspect\">" \ " <method name=\"Introspect\">" \
" <arg name=\"data\" type=\"s\" direction=\"out\"/>" \ " <arg name=\"data\" type=\"s\" direction=\"out\"/>" \
" </method>" \ " </method>" \
@ -588,7 +588,7 @@ static DBusHandlerResult profile_handler(DBusConnection *c, DBusMessage *m, void
if (!pa_streq(path, HSP_AG_PROFILE) && !pa_streq(path, HSP_HS_PROFILE)) if (!pa_streq(path, HSP_AG_PROFILE) && !pa_streq(path, HSP_HS_PROFILE))
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Introspectable", "Introspect")) { if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect")) {
const char *xml = PROFILE_INTROSPECT_XML; const char *xml = PROFILE_INTROSPECT_XML;
pa_assert_se(r = dbus_message_new_method_return(m)); pa_assert_se(r = dbus_message_new_method_return(m));

View file

@ -43,12 +43,12 @@
#define HF_AUDIO_AGENT_XML \ #define HF_AUDIO_AGENT_XML \
DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \ DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \
"<node>" \ "<node>" \
" <interface name=\"org.freedesktop.DBus.Introspectable\">" \ " <interface name=\"" DBUS_INTERFACE_INTROSPECTABLE "\">" \
" <method name=\"Introspect\">" \ " <method name=\"Introspect\">" \
" <arg direction=\"out\" type=\"s\" />" \ " <arg direction=\"out\" type=\"s\" />" \
" </method>" \ " </method>" \
" </interface>" \ " </interface>" \
" <interface name=\"org.ofono.HandsfreeAudioAgent\">" \ " <interface name=\"" HF_AUDIO_AGENT_INTERFACE "\">" \
" <method name=\"Release\">" \ " <method name=\"Release\">" \
" </method>" \ " </method>" \
" <method name=\"NewConnection\">" \ " <method name=\"NewConnection\">" \
@ -515,12 +515,12 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *da
pa_assert(backend); pa_assert(backend);
sender = dbus_message_get_sender(m); sender = dbus_message_get_sender(m);
if (!pa_safe_streq(backend->ofono_bus_id, sender) && !pa_streq("org.freedesktop.DBus", sender)) if (!pa_safe_streq(backend->ofono_bus_id, sender) && !pa_streq(DBUS_SERVICE_DBUS, sender))
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
dbus_error_init(&err); dbus_error_init(&err);
if (dbus_message_is_signal(m, "org.freedesktop.DBus", "NameOwnerChanged")) { if (dbus_message_is_signal(m, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) {
const char *name, *old_owner, *new_owner; const char *name, *old_owner, *new_owner;
if (!dbus_message_get_args(m, &err, if (!dbus_message_get_args(m, &err,
@ -528,7 +528,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *da
DBUS_TYPE_STRING, &old_owner, DBUS_TYPE_STRING, &old_owner,
DBUS_TYPE_STRING, &new_owner, DBUS_TYPE_STRING, &new_owner,
DBUS_TYPE_INVALID)) { DBUS_TYPE_INVALID)) {
pa_log_error("Failed to parse org.freedesktop.DBus.NameOwnerChanged: %s", err.message); pa_log_error("Failed to parse " DBUS_INTERFACE_DBUS ".NameOwnerChanged: %s", err.message);
goto fail; goto fail;
} }
@ -664,7 +664,7 @@ static DBusHandlerResult hf_audio_agent_handler(DBusConnection *c, DBusMessage *
pa_log_debug("dbus: path=%s, interface=%s, member=%s", path, interface, member); pa_log_debug("dbus: path=%s, interface=%s, member=%s", path, interface, member);
if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Introspectable", "Introspect")) { if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect")) {
const char *xml = HF_AUDIO_AGENT_XML; const char *xml = HF_AUDIO_AGENT_XML;
pa_assert_se(r = dbus_message_new_method_return(m)); pa_assert_se(r = dbus_message_new_method_return(m));
@ -718,7 +718,7 @@ pa_bluetooth_backend *pa_bluetooth_ofono_backend_new(pa_core *c, pa_bluetooth_di
} }
if (pa_dbus_add_matches(pa_dbus_connection_get(backend->connection), &err, if (pa_dbus_add_matches(pa_dbus_connection_get(backend->connection), &err,
"type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged'," "type='signal',sender='" DBUS_SERVICE_DBUS "',interface='" DBUS_INTERFACE_DBUS "',member='NameOwnerChanged',"
"arg0='" OFONO_SERVICE "'", "arg0='" OFONO_SERVICE "'",
"type='signal',sender='" OFONO_SERVICE "',interface='" HF_AUDIO_MANAGER_INTERFACE "',member='CardAdded'", "type='signal',sender='" OFONO_SERVICE "',interface='" HF_AUDIO_MANAGER_INTERFACE "',member='CardAdded'",
"type='signal',sender='" OFONO_SERVICE "',interface='" HF_AUDIO_MANAGER_INTERFACE "',member='CardRemoved'", "type='signal',sender='" OFONO_SERVICE "',interface='" HF_AUDIO_MANAGER_INTERFACE "',member='CardRemoved'",
@ -748,7 +748,7 @@ void pa_bluetooth_ofono_backend_free(pa_bluetooth_backend *backend) {
dbus_connection_unregister_object_path(pa_dbus_connection_get(backend->connection), HF_AUDIO_AGENT_PATH); dbus_connection_unregister_object_path(pa_dbus_connection_get(backend->connection), HF_AUDIO_AGENT_PATH);
pa_dbus_remove_matches(pa_dbus_connection_get(backend->connection), pa_dbus_remove_matches(pa_dbus_connection_get(backend->connection),
"type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged'," "type='signal',sender='" DBUS_SERVICE_DBUS "',interface='" DBUS_INTERFACE_DBUS "',member='NameOwnerChanged',"
"arg0='" OFONO_SERVICE "'", "arg0='" OFONO_SERVICE "'",
"type='signal',sender='" OFONO_SERVICE "',interface='" HF_AUDIO_MANAGER_INTERFACE "',member='CardAdded'", "type='signal',sender='" OFONO_SERVICE "',interface='" HF_AUDIO_MANAGER_INTERFACE "',member='CardAdded'",
"type='signal',sender='" OFONO_SERVICE "',interface='" HF_AUDIO_MANAGER_INTERFACE "',member='CardRemoved'", "type='signal',sender='" OFONO_SERVICE "',interface='" HF_AUDIO_MANAGER_INTERFACE "',member='CardRemoved'",

View file

@ -42,6 +42,8 @@
#define WAIT_FOR_PROFILES_TIMEOUT_USEC (3 * PA_USEC_PER_SEC) #define WAIT_FOR_PROFILES_TIMEOUT_USEC (3 * PA_USEC_PER_SEC)
#define DBUS_INTERFACE_OBJECT_MANAGER DBUS_INTERFACE_DBUS ".ObjectManager"
#define A2DP_OBJECT_MANAGER_PATH "/MediaEndpoint" #define A2DP_OBJECT_MANAGER_PATH "/MediaEndpoint"
#define A2DP_SOURCE_ENDPOINT A2DP_OBJECT_MANAGER_PATH "/A2DPSource" #define A2DP_SOURCE_ENDPOINT A2DP_OBJECT_MANAGER_PATH "/A2DPSource"
#define A2DP_SINK_ENDPOINT A2DP_OBJECT_MANAGER_PATH "/A2DPSink" #define A2DP_SINK_ENDPOINT A2DP_OBJECT_MANAGER_PATH "/A2DPSink"
@ -49,7 +51,7 @@
#define OBJECT_MANAGER_INTROSPECT_XML \ #define OBJECT_MANAGER_INTROSPECT_XML \
DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \ DBUS_INTROSPECT_1_0_XML_DOCTYPE_DECL_NODE \
"<node>\n" \ "<node>\n" \
" <interface name=\"org.freedesktop.DBus.ObjectManager\">\n" \ " <interface name=\"" DBUS_INTERFACE_OBJECT_MANAGER "\">\n" \
" <method name=\"GetManagedObjects\">\n" \ " <method name=\"GetManagedObjects\">\n" \
" <arg name=\"objects\" direction=\"out\" type=\"a{oa{sa{sv}}}\"/>\n" \ " <arg name=\"objects\" direction=\"out\" type=\"a{oa{sa{sv}}}\"/>\n" \
" </method>\n" \ " </method>\n" \
@ -62,7 +64,7 @@
" <arg name=\"interfaces\" type=\"as\"/>\n" \ " <arg name=\"interfaces\" type=\"as\"/>\n" \
" </signal>\n" \ " </signal>\n" \
" </interface>\n" \ " </interface>\n" \
" <interface name=\"org.freedesktop.DBus.Introspectable\">\n" \ " <interface name=\"" DBUS_INTERFACE_INTROSPECTABLE "\">\n" \
" <method name=\"Introspect\">\n" \ " <method name=\"Introspect\">\n" \
" <arg name=\"data\" direction=\"out\" type=\"s\"/>\n" \ " <arg name=\"data\" direction=\"out\" type=\"s\"/>\n" \
" </method>\n" \ " </method>\n" \
@ -89,7 +91,7 @@
" <method name=\"Release\">" \ " <method name=\"Release\">" \
" </method>" \ " </method>" \
" </interface>" \ " </interface>" \
" <interface name=\"org.freedesktop.DBus.Introspectable\">" \ " <interface name=\"" DBUS_INTERFACE_INTROSPECTABLE "\">" \
" <method name=\"Introspect\">" \ " <method name=\"Introspect\">" \
" <arg name=\"data\" type=\"s\" direction=\"out\"/>" \ " <arg name=\"data\" type=\"s\" direction=\"out\"/>" \
" </method>" \ " </method>" \
@ -1515,7 +1517,7 @@ static void get_managed_objects(pa_bluetooth_discovery *y) {
pa_assert(y); pa_assert(y);
pa_assert_se(m = dbus_message_new_method_call(BLUEZ_SERVICE, "/", "org.freedesktop.DBus.ObjectManager", pa_assert_se(m = dbus_message_new_method_call(BLUEZ_SERVICE, "/", DBUS_INTERFACE_OBJECT_MANAGER,
"GetManagedObjects")); "GetManagedObjects"));
send_and_add_to_pending(y, m, get_managed_objects_reply, NULL); send_and_add_to_pending(y, m, get_managed_objects_reply, NULL);
} }
@ -1537,7 +1539,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
dbus_error_init(&err); dbus_error_init(&err);
if (dbus_message_is_signal(m, "org.freedesktop.DBus", "NameOwnerChanged")) { if (dbus_message_is_signal(m, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) {
const char *name, *old_owner, *new_owner; const char *name, *old_owner, *new_owner;
if (!dbus_message_get_args(m, &err, if (!dbus_message_get_args(m, &err,
@ -1545,7 +1547,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
DBUS_TYPE_STRING, &old_owner, DBUS_TYPE_STRING, &old_owner,
DBUS_TYPE_STRING, &new_owner, DBUS_TYPE_STRING, &new_owner,
DBUS_TYPE_INVALID)) { DBUS_TYPE_INVALID)) {
pa_log_error("Failed to parse org.freedesktop.DBus.NameOwnerChanged: %s", err.message); pa_log_error("Failed to parse " DBUS_INTERFACE_DBUS ".NameOwnerChanged: %s", err.message);
goto fail; goto fail;
} }
@ -1572,7 +1574,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
} }
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
} else if (dbus_message_is_signal(m, "org.freedesktop.DBus.ObjectManager", "InterfacesAdded")) { } else if (dbus_message_is_signal(m, DBUS_INTERFACE_OBJECT_MANAGER, "InterfacesAdded")) {
DBusMessageIter arg_i; DBusMessageIter arg_i;
if (!y->objects_listed) if (!y->objects_listed)
@ -1586,7 +1588,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
parse_interfaces_and_properties(y, &arg_i); parse_interfaces_and_properties(y, &arg_i);
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
} else if (dbus_message_is_signal(m, "org.freedesktop.DBus.ObjectManager", "InterfacesRemoved")) { } else if (dbus_message_is_signal(m, DBUS_INTERFACE_OBJECT_MANAGER, "InterfacesRemoved")) {
const char *p; const char *p;
DBusMessageIter arg_i; DBusMessageIter arg_i;
DBusMessageIter element_i; DBusMessageIter element_i;
@ -1623,7 +1625,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
} else if (dbus_message_is_signal(m, "org.freedesktop.DBus.Properties", "PropertiesChanged")) { } else if (dbus_message_is_signal(m, DBUS_INTERFACE_PROPERTIES, "PropertiesChanged")) {
DBusMessageIter arg_i; DBusMessageIter arg_i;
const char *iface; const char *iface;
@ -1972,7 +1974,7 @@ static DBusHandlerResult endpoint_handler(DBusConnection *c, DBusMessage *m, voi
if (!a2dp_endpoint_to_a2dp_codec(path)) if (!a2dp_endpoint_to_a2dp_codec(path))
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Introspectable", "Introspect")) { if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect")) {
const char *xml = ENDPOINT_INTROSPECT_XML; const char *xml = ENDPOINT_INTROSPECT_XML;
pa_assert_se(r = dbus_message_new_method_return(m)); pa_assert_se(r = dbus_message_new_method_return(m));
@ -2068,12 +2070,12 @@ static DBusHandlerResult object_manager_handler(DBusConnection *c, DBusMessage *
pa_log_debug("dbus: path=%s, interface=%s, member=%s", path, interface, member); pa_log_debug("dbus: path=%s, interface=%s, member=%s", path, interface, member);
if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Introspectable", "Introspect")) { if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect")) {
const char *xml = OBJECT_MANAGER_INTROSPECT_XML; const char *xml = OBJECT_MANAGER_INTROSPECT_XML;
pa_assert_se(r = dbus_message_new_method_return(m)); pa_assert_se(r = dbus_message_new_method_return(m));
pa_assert_se(dbus_message_append_args(r, DBUS_TYPE_STRING, &xml, DBUS_TYPE_INVALID)); pa_assert_se(dbus_message_append_args(r, DBUS_TYPE_STRING, &xml, DBUS_TYPE_INVALID));
} else if (dbus_message_is_method_call(m, "org.freedesktop.DBus.ObjectManager", "GetManagedObjects")) { } else if (dbus_message_is_method_call(m, DBUS_INTERFACE_OBJECT_MANAGER, "GetManagedObjects")) {
DBusMessageIter iter, array; DBusMessageIter iter, array;
int i; int i;
@ -2193,18 +2195,18 @@ pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *c, int headset_backe
y->filter_added = true; y->filter_added = true;
if (pa_dbus_add_matches(conn, &err, if (pa_dbus_add_matches(conn, &err,
"type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged'" "type='signal',sender='" DBUS_SERVICE_DBUS "',interface='" DBUS_INTERFACE_DBUS "',member='NameOwnerChanged'"
",arg0='" BLUEZ_SERVICE "'", ",arg0='" BLUEZ_SERVICE "'",
"type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.ObjectManager',member='InterfacesAdded'", "type='signal',sender='" BLUEZ_SERVICE "',interface='" DBUS_INTERFACE_OBJECT_MANAGER "',member='InterfacesAdded'",
"type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.ObjectManager'," "type='signal',sender='" BLUEZ_SERVICE "',interface='" DBUS_INTERFACE_OBJECT_MANAGER "',"
"member='InterfacesRemoved'", "member='InterfacesRemoved'",
"type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged'" "type='signal',sender='" BLUEZ_SERVICE "',interface='" DBUS_INTERFACE_PROPERTIES "',member='PropertiesChanged'"
",arg0='" BLUEZ_ADAPTER_INTERFACE "'", ",arg0='" BLUEZ_ADAPTER_INTERFACE "'",
"type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged'" "type='signal',sender='" BLUEZ_SERVICE "',interface='" DBUS_INTERFACE_PROPERTIES "',member='PropertiesChanged'"
",arg0='" BLUEZ_DEVICE_INTERFACE "'", ",arg0='" BLUEZ_DEVICE_INTERFACE "'",
"type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged'" "type='signal',sender='" BLUEZ_SERVICE "',interface='" DBUS_INTERFACE_PROPERTIES "',member='PropertiesChanged'"
",arg0='" BLUEZ_MEDIA_ENDPOINT_INTERFACE "'", ",arg0='" BLUEZ_MEDIA_ENDPOINT_INTERFACE "'",
"type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged'" "type='signal',sender='" BLUEZ_SERVICE "',interface='" DBUS_INTERFACE_PROPERTIES "',member='PropertiesChanged'"
",arg0='" BLUEZ_MEDIA_TRANSPORT_INTERFACE "'", ",arg0='" BLUEZ_MEDIA_TRANSPORT_INTERFACE "'",
NULL) < 0) { NULL) < 0) {
pa_log_error("Failed to add D-Bus matches: %s", err.message); pa_log_error("Failed to add D-Bus matches: %s", err.message);
@ -2283,19 +2285,19 @@ void pa_bluetooth_discovery_unref(pa_bluetooth_discovery *y) {
if (y->matches_added) if (y->matches_added)
pa_dbus_remove_matches(pa_dbus_connection_get(y->connection), pa_dbus_remove_matches(pa_dbus_connection_get(y->connection),
"type='signal',sender='org.freedesktop.DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged'," "type='signal',sender='" DBUS_SERVICE_DBUS "',interface='" DBUS_INTERFACE_DBUS "',member='NameOwnerChanged',"
"arg0='" BLUEZ_SERVICE "'", "arg0='" BLUEZ_SERVICE "'",
"type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.ObjectManager'," "type='signal',sender='" BLUEZ_SERVICE "',interface='" DBUS_INTERFACE_OBJECT_MANAGER "',"
"member='InterfacesAdded'", "member='InterfacesAdded'",
"type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.ObjectManager'," "type='signal',sender='" BLUEZ_SERVICE "',interface='" DBUS_INTERFACE_OBJECT_MANAGER "',"
"member='InterfacesRemoved'", "member='InterfacesRemoved'",
"type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.Properties'," "type='signal',sender='" BLUEZ_SERVICE "',interface='" DBUS_INTERFACE_PROPERTIES "',"
"member='PropertiesChanged',arg0='" BLUEZ_ADAPTER_INTERFACE "'", "member='PropertiesChanged',arg0='" BLUEZ_ADAPTER_INTERFACE "'",
"type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.Properties'," "type='signal',sender='" BLUEZ_SERVICE "',interface='" DBUS_INTERFACE_PROPERTIES "',"
"member='PropertiesChanged',arg0='" BLUEZ_DEVICE_INTERFACE "'", "member='PropertiesChanged',arg0='" BLUEZ_DEVICE_INTERFACE "'",
"type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.Properties'," "type='signal',sender='" BLUEZ_SERVICE "',interface='" DBUS_INTERFACE_PROPERTIES "',"
"member='PropertiesChanged',arg0='" BLUEZ_MEDIA_ENDPOINT_INTERFACE "'", "member='PropertiesChanged',arg0='" BLUEZ_MEDIA_ENDPOINT_INTERFACE "'",
"type='signal',sender='" BLUEZ_SERVICE "',interface='org.freedesktop.DBus.Properties'," "type='signal',sender='" BLUEZ_SERVICE "',interface='" DBUS_INTERFACE_PROPERTIES "',"
"member='PropertiesChanged',arg0='" BLUEZ_MEDIA_TRANSPORT_INTERFACE "'", "member='PropertiesChanged',arg0='" BLUEZ_MEDIA_TRANSPORT_INTERFACE "'",
NULL); NULL);

View file

@ -158,7 +158,7 @@ static DBusHandlerResult disconnection_filter_cb(DBusConnection *connection, DBu
pa_assert(message); pa_assert(message);
pa_assert(c); pa_assert(c);
if (dbus_message_is_signal(message, "org.freedesktop.DBus.Local", "Disconnected")) { if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected")) {
/* The connection died. Now we want to free the connection object, but /* The connection died. Now we want to free the connection object, but
* let's wait until this message is fully processed, in case someone * let's wait until this message is fully processed, in case someone
* else is interested in this signal too. */ * else is interested in this signal too. */

View file

@ -96,7 +96,7 @@ PA_MODULE_USAGE("display_name=<UPnP Media Server name>");
" <property name=\"Path\" type=\"s\" access=\"read\"/>" \ " <property name=\"Path\" type=\"s\" access=\"read\"/>" \
" <property name=\"DisplayName\" type=\"s\" access=\"read\"/>" \ " <property name=\"DisplayName\" type=\"s\" access=\"read\"/>" \
" </interface>" \ " </interface>" \
" <interface name=\"org.freedesktop.DBus.Properties\">" \ " <interface name=\"" DBUS_INTERFACE_PROPERTIES "\">" \
" <method name=\"Get\">" \ " <method name=\"Get\">" \
" <arg name=\"interface\" direction=\"in\" type=\"s\"/>" \ " <arg name=\"interface\" direction=\"in\" type=\"s\"/>" \
" <arg name=\"property\" direction=\"in\" type=\"s\"/>" \ " <arg name=\"property\" direction=\"in\" type=\"s\"/>" \
@ -107,7 +107,7 @@ PA_MODULE_USAGE("display_name=<UPnP Media Server name>");
" <arg name=\"properties\" direction=\"out\" type=\"a{sv}\"/>" \ " <arg name=\"properties\" direction=\"out\" type=\"a{sv}\"/>" \
" </method>" \ " </method>" \
" </interface>" \ " </interface>" \
" <interface name=\"org.freedesktop.DBus.Introspectable\">" \ " <interface name=\"" DBUS_INTERFACE_INTROSPECTABLE "\">" \
" <method name=\"Introspect\">" \ " <method name=\"Introspect\">" \
" <arg name=\"data\" type=\"s\" direction=\"out\"/>" \ " <arg name=\"data\" type=\"s\" direction=\"out\"/>" \
" </method>" \ " </method>" \
@ -130,7 +130,7 @@ PA_MODULE_USAGE("display_name=<UPnP Media Server name>");
" <interface name=\"org.gnome.UPnP.MediaItem2\">" \ " <interface name=\"org.gnome.UPnP.MediaItem2\">" \
" <property name=\"URLs\" type=\"as\" access=\"read\"/>" \ " <property name=\"URLs\" type=\"as\" access=\"read\"/>" \
" <property name=\"MIMEType\" type=\"s\" access=\"read\"/>" \ " <property name=\"MIMEType\" type=\"s\" access=\"read\"/>" \
" <property name=\"DLNAProfile\" type=\"s\" access=\"read\"/>" \ " <property name=\"DLNAProfile\" type=\"s\" access=\"read\"/>" \
" </interface>" \ " </interface>" \
" <interface name=\"org.gnome.UPnP.MediaObject2\">" \ " <interface name=\"org.gnome.UPnP.MediaObject2\">" \
" <property name=\"Parent\" type=\"s\" access=\"read\"/>" \ " <property name=\"Parent\" type=\"s\" access=\"read\"/>" \
@ -138,7 +138,7 @@ PA_MODULE_USAGE("display_name=<UPnP Media Server name>");
" <property name=\"Path\" type=\"s\" access=\"read\"/>" \ " <property name=\"Path\" type=\"s\" access=\"read\"/>" \
" <property name=\"DisplayName\" type=\"s\" access=\"read\"/>" \ " <property name=\"DisplayName\" type=\"s\" access=\"read\"/>" \
" </interface>" \ " </interface>" \
" <interface name=\"org.freedesktop.DBus.Properties\">" \ " <interface name=\"" DBUS_INTERFACE_PROPERTIES "\">" \
" <method name=\"Get\">" \ " <method name=\"Get\">" \
" <arg name=\"interface\" direction=\"in\" type=\"s\"/>" \ " <arg name=\"interface\" direction=\"in\" type=\"s\"/>" \
" <arg name=\"property\" direction=\"in\" type=\"s\"/>" \ " <arg name=\"property\" direction=\"in\" type=\"s\"/>" \
@ -149,7 +149,7 @@ PA_MODULE_USAGE("display_name=<UPnP Media Server name>");
" <arg name=\"properties\" direction=\"out\" type=\"a{sv}\"/>" \ " <arg name=\"properties\" direction=\"out\" type=\"a{sv}\"/>" \
" </method>" \ " </method>" \
" </interface>" \ " </interface>" \
" <interface name=\"org.freedesktop.DBus.Introspectable\">" \ " <interface name=\"" DBUS_INTERFACE_INTROSPECTABLE "\">" \
" <method name=\"Introspect\">" \ " <method name=\"Introspect\">" \
" <arg name=\"data\" type=\"s\" direction=\"out\"/>" \ " <arg name=\"data\" type=\"s\" direction=\"out\"/>" \
" </method>" \ " </method>" \
@ -215,7 +215,7 @@ static bool message_is_property_get(DBusMessage *m, const char *interface, const
pa_assert(m); pa_assert(m);
if (!dbus_message_is_method_call(m, "org.freedesktop.DBus.Properties", "Get")) if (!dbus_message_is_method_call(m, DBUS_INTERFACE_PROPERTIES, "Get"))
return false; return false;
if (!dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &i, DBUS_TYPE_STRING, &p, DBUS_TYPE_INVALID) || dbus_error_is_set(&error)) { if (!dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &i, DBUS_TYPE_STRING, &p, DBUS_TYPE_INVALID) || dbus_error_is_set(&error)) {
@ -234,7 +234,7 @@ static bool message_is_property_get_all(DBusMessage *m, const char *interface) {
pa_assert(m); pa_assert(m);
if (!dbus_message_is_method_call(m, "org.freedesktop.DBus.Properties", "GetAll")) if (!dbus_message_is_method_call(m, DBUS_INTERFACE_PROPERTIES, "GetAll"))
return false; return false;
if (!dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &i, DBUS_TYPE_INVALID) || dbus_error_is_set(&error)) { if (!dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &i, DBUS_TYPE_INVALID) || dbus_error_is_set(&error)) {
@ -721,7 +721,7 @@ static DBusHandlerResult root_handler(DBusConnection *c, DBusMessage *m, void *u
append_property_dict_entry_string(r, &sub, "DisplayName", u->display_name); append_property_dict_entry_string(r, &sub, "DisplayName", u->display_name);
pa_assert_se(dbus_message_iter_close_container(&iter, &sub)); pa_assert_se(dbus_message_iter_close_container(&iter, &sub));
} else if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Introspectable", "Introspect")) { } else if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect")) {
const char *xml = ROOT_INTROSPECT_XML; const char *xml = ROOT_INTROSPECT_XML;
pa_assert_se(r = dbus_message_new_method_return(m)); pa_assert_se(r = dbus_message_new_method_return(m));
@ -913,7 +913,7 @@ static DBusHandlerResult sinks_and_sources_handler(DBusConnection *c, DBusMessag
append_sink_or_source_container_mediaobject2_properties(r, &sub, path); append_sink_or_source_container_mediaobject2_properties(r, &sub, path);
pa_assert_se(dbus_message_iter_close_container(&iter, &sub)); pa_assert_se(dbus_message_iter_close_container(&iter, &sub));
} else if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Introspectable", "Introspect")) { } else if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect")) {
pa_strbuf *sb; pa_strbuf *sb;
char *xml; char *xml;
uint32_t idx; uint32_t idx;
@ -1010,7 +1010,7 @@ static DBusHandlerResult sinks_and_sources_handler(DBusConnection *c, DBusMessag
pa_assert_se(dbus_message_iter_close_container(&iter, &sub)); pa_assert_se(dbus_message_iter_close_container(&iter, &sub));
} else if (dbus_message_is_method_call(m, "org.freedesktop.DBus.Introspectable", "Introspect")) { } else if (dbus_message_is_method_call(m, DBUS_INTERFACE_INTROSPECTABLE, "Introspect")) {
const char *xml = const char *xml =
ITEM_INTROSPECT_XML; ITEM_INTROSPECT_XML;

View file

@ -689,7 +689,7 @@ static char *get_icon_name(pa_module*m) {
msg = dbus_message_new_method_call(HOSTNAME_DBUS_INTERFACE, msg = dbus_message_new_method_call(HOSTNAME_DBUS_INTERFACE,
HOSTNAME_DBUS_PATH, HOSTNAME_DBUS_PATH,
"org.freedesktop.DBus.Properties", DBUS_INTERFACE_PROPERTIES,
"Get"); "Get");
dbus_message_append_args(msg, DBUS_TYPE_STRING, &interface, DBUS_TYPE_STRING, &property, DBUS_TYPE_INVALID); dbus_message_append_args(msg, DBUS_TYPE_STRING, &interface, DBUS_TYPE_STRING, &property, DBUS_TYPE_INVALID);

View file

@ -90,7 +90,7 @@ static DBusHandlerResult filter_handler(
m = userdata; m = userdata;
assert(m->ref >= 1); assert(m->ref >= 1);
if (dbus_message_is_signal(s, "org.freedesktop.DBus", "NameOwnerChanged")) { if (dbus_message_is_signal(s, DBUS_INTERFACE_DBUS, "NameOwnerChanged")) {
const char *name, *old, *new; const char *name, *old, *new;
if (!dbus_message_get_args( if (!dbus_message_get_args(

View file

@ -71,14 +71,14 @@ static const char introspection[] =
" <property name=\"ApplicationName\" type=\"s\" access=\"read\"/>" " <property name=\"ApplicationName\" type=\"s\" access=\"read\"/>"
" <property name=\"ApplicationDeviceName\" type=\"s\" access=\"read\"/>" " <property name=\"ApplicationDeviceName\" type=\"s\" access=\"read\"/>"
" </interface>" " </interface>"
" <interface name=\"org.freedesktop.DBus.Properties\">" " <interface name=\"" DBUS_INTERFACE_PROPERTIES "\">"
" <method name=\"Get\">" " <method name=\"Get\">"
" <arg name=\"interface\" direction=\"in\" type=\"s\"/>" " <arg name=\"interface\" direction=\"in\" type=\"s\"/>"
" <arg name=\"property\" direction=\"in\" type=\"s\"/>" " <arg name=\"property\" direction=\"in\" type=\"s\"/>"
" <arg name=\"value\" direction=\"out\" type=\"v\"/>" " <arg name=\"value\" direction=\"out\" type=\"v\"/>"
" </method>" " </method>"
" </interface>" " </interface>"
" <interface name=\"org.freedesktop.DBus.Introspectable\">" " <interface name=\"" DBUS_INTERFACE_INTROSPECTABLE "\">"
" <method name=\"Introspect\">" " <method name=\"Introspect\">"
" <arg name=\"data\" type=\"s\" direction=\"out\"/>" " <arg name=\"data\" type=\"s\" direction=\"out\"/>"
" </method>" " </method>"
@ -170,7 +170,7 @@ static DBusHandlerResult object_handler(
} else if (dbus_message_is_method_call( } else if (dbus_message_is_method_call(
m, m,
"org.freedesktop.DBus.Properties", DBUS_INTERFACE_PROPERTIES,
"Get")) { "Get")) {
const char *interface, *property; const char *interface, *property;
@ -234,7 +234,7 @@ static DBusHandlerResult object_handler(
} else if (dbus_message_is_method_call( } else if (dbus_message_is_method_call(
m, m,
"org.freedesktop.DBus.Introspectable", DBUS_INTERFACE_INTROSPECTABLE,
"Introspect")) { "Introspect")) {
const char *i = introspection; const char *i = introspection;
@ -300,7 +300,7 @@ static DBusHandlerResult filter_handler(
d = userdata; d = userdata;
assert(d->ref >= 1); assert(d->ref >= 1);
if (dbus_message_is_signal(m, "org.freedesktop.DBus", "NameLost")) { if (dbus_message_is_signal(m, DBUS_INTERFACE_DBUS, "NameLost")) {
const char *name; const char *name;
if (!dbus_message_get_args( if (!dbus_message_get_args(
@ -670,7 +670,7 @@ int rd_dbus_get_name_owner(
goto fail; goto fail;
} }
} else if (dbus_error_has_name(error, "org.freedesktop.DBus.Error.NameHasNoOwner")) } else if (dbus_error_has_name(error, DBUS_ERROR_NAME_HAS_NO_OWNER))
dbus_error_free(error); dbus_error_free(error);
else { else {
r = -EIO; r = -EIO;

View file

@ -515,7 +515,7 @@ static DBusHandlerResult handle_message_cb(DBusConnection *connection, DBusMessa
pa_assert_se(call_info.method = dbus_message_get_member(message)); pa_assert_se(call_info.method = dbus_message_get_member(message));
pa_assert_se(call_info.method_sig = dbus_message_get_signature(message)); pa_assert_se(call_info.method_sig = dbus_message_get_signature(message));
if (dbus_message_is_method_call(message, "org.freedesktop.DBus.Introspectable", "Introspect") || if (dbus_message_is_method_call(message, DBUS_INTERFACE_INTROSPECTABLE, "Introspect") ||
(!dbus_message_get_interface(message) && dbus_message_has_member(message, "Introspect"))) { (!dbus_message_get_interface(message) && dbus_message_has_member(message, "Introspect"))) {
pa_dbus_send_basic_value_reply(connection, message, DBUS_TYPE_STRING, &call_info.obj_entry->introspection); pa_dbus_send_basic_value_reply(connection, message, DBUS_TYPE_STRING, &call_info.obj_entry->introspection);
goto finish; goto finish;

View file

@ -77,7 +77,7 @@ static long long rtkit_get_int_property(DBusConnection *connection, const char*
if (!(m = dbus_message_new_method_call( if (!(m = dbus_message_new_method_call(
RTKIT_SERVICE_NAME, RTKIT_SERVICE_NAME,
RTKIT_OBJECT_PATH, RTKIT_OBJECT_PATH,
"org.freedesktop.DBus.Properties", DBUS_INTERFACE_PROPERTIES,
"Get"))) { "Get"))) {
ret = -ENOMEM; ret = -ENOMEM;
goto finish; goto finish;

View file

@ -27,7 +27,7 @@ def get_ladspa_property_interface(sinkname):
session = dbus.SessionBus() session = dbus.SessionBus()
# get the private D-Bus socket address from PulseAudio properties # get the private D-Bus socket address from PulseAudio properties
session_property_iface = dbus.Interface(session.get_object("org.PulseAudio1", "/org/pulseaudio/server_lookup1"), "org.freedesktop.DBus.Properties") session_property_iface = dbus.Interface(session.get_object("org.PulseAudio1", "/org/pulseaudio/server_lookup1"), dbus.PROPERTIES_IFACE)
socket = session_property_iface.Get("org.PulseAudio.ServerLookup1", "Address") socket = session_property_iface.Get("org.PulseAudio.ServerLookup1", "Address")
# connect to the private PulseAudio D-Bus socket # connect to the private PulseAudio D-Bus socket
@ -40,7 +40,7 @@ def get_ladspa_property_interface(sinkname):
ladspa_sink_path = core.GetSinkByName(sinkname) ladspa_sink_path = core.GetSinkByName(sinkname)
# property interface proxy for the sink # property interface proxy for the sink
ladspa_sink_property_iface = dbus.Interface(connection.get_object(object_path=ladspa_sink_path), "org.freedesktop.DBus.Properties") ladspa_sink_property_iface = dbus.Interface(connection.get_object(object_path=ladspa_sink_path), dbus.PROPERTIES_IFACE)
return ladspa_sink_property_iface return ladspa_sink_property_iface