bluetooth: Consistently use BlueZ defines for strings

These errors and interface names shoudld all reuse predefined constants.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/477>
This commit is contained in:
Marijn Suijten 2021-01-19 20:27:35 +01:00 committed by PulseAudio Marge Bot
parent 99ac831fef
commit 670f585530
3 changed files with 8 additions and 6 deletions

View file

@ -560,7 +560,7 @@ static DBusMessage *profile_new_connection(DBusConnection *conn, DBusMessage *m,
return r; return r;
fail: fail:
pa_assert_se(r = dbus_message_new_error(m, "org.bluez.Error.InvalidArguments", "Unable to handle new connection")); pa_assert_se(r = dbus_message_new_error(m, BLUEZ_ERROR_INVALID_ARGUMENTS, "Unable to handle new connection"));
return r; return r;
} }

View file

@ -504,7 +504,7 @@ static int bluez5_transport_acquire_cb(pa_bluetooth_transport *t, bool optional,
dbus_message_unref(m); dbus_message_unref(m);
m = NULL; m = NULL;
if (!r) { if (!r) {
if (optional && pa_streq(err.name, "org.bluez.Error.NotAvailable")) if (optional && pa_streq(err.name, BLUEZ_ERROR_NOT_AVAILABLE))
pa_log_info("Failed optional acquire of unavailable transport %s", t->path); pa_log_info("Failed optional acquire of unavailable transport %s", t->path);
else else
pa_log_error("Transport %s() failed for transport %s (%s)", method, t->path, err.message); pa_log_error("Transport %s() failed for transport %s (%s)", method, t->path, err.message);
@ -1449,7 +1449,7 @@ void pa_bluetooth_discovery_set_ofono_running(pa_bluetooth_discovery *y, bool is
if (device_supports_profile(d, PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY)) { if (device_supports_profile(d, PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY)) {
DBusMessage *m; DBusMessage *m;
pa_assert_se(m = dbus_message_new_method_call(BLUEZ_SERVICE, d->path, "org.bluez.Device1", "Disconnect")); pa_assert_se(m = dbus_message_new_method_call(BLUEZ_SERVICE, d->path, BLUEZ_DEVICE_INTERFACE, "Disconnect"));
dbus_message_set_no_reply(m, true); dbus_message_set_no_reply(m, true);
pa_assert_se(dbus_connection_send(pa_dbus_connection_get(y->connection), m, NULL)); pa_assert_se(dbus_connection_send(pa_dbus_connection_get(y->connection), m, NULL));
dbus_message_unref(m); dbus_message_unref(m);
@ -1858,7 +1858,7 @@ fail:
pa_log_error("Endpoint SetConfiguration(): invalid arguments"); pa_log_error("Endpoint SetConfiguration(): invalid arguments");
fail2: fail2:
pa_assert_se(r = dbus_message_new_error(m, "org.bluez.Error.InvalidArguments", "Unable to set configuration")); pa_assert_se(r = dbus_message_new_error(m, BLUEZ_ERROR_INVALID_ARGUMENTS, "Unable to set configuration"));
return r; return r;
} }
@ -1897,7 +1897,7 @@ static DBusMessage *endpoint_select_configuration(DBusConnection *conn, DBusMess
return r; return r;
fail: fail:
pa_assert_se(r = dbus_message_new_error(m, "org.bluez.Error.InvalidArguments", "Unable to select configuration")); pa_assert_se(r = dbus_message_new_error(m, BLUEZ_ERROR_INVALID_ARGUMENTS, "Unable to select configuration"));
return r; return r;
} }
@ -1928,7 +1928,7 @@ static DBusMessage *endpoint_clear_configuration(DBusConnection *conn, DBusMessa
fail: fail:
if (!dbus_message_get_no_reply(m)) if (!dbus_message_get_no_reply(m))
pa_assert_se(r = dbus_message_new_error(m, "org.bluez.Error.InvalidArguments", "Unable to clear configuration")); pa_assert_se(r = dbus_message_new_error(m, BLUEZ_ERROR_INVALID_ARGUMENTS, "Unable to clear configuration"));
return r; return r;
} }

View file

@ -34,6 +34,8 @@
#define BLUEZ_PROFILE_INTERFACE BLUEZ_SERVICE ".Profile1" #define BLUEZ_PROFILE_INTERFACE BLUEZ_SERVICE ".Profile1"
#define BLUEZ_PROFILE_MANAGER_INTERFACE BLUEZ_SERVICE ".ProfileManager1" #define BLUEZ_PROFILE_MANAGER_INTERFACE BLUEZ_SERVICE ".ProfileManager1"
#define BLUEZ_ERROR_INVALID_ARGUMENTS BLUEZ_SERVICE ".Error.InvalidArguments"
#define BLUEZ_ERROR_NOT_AVAILABLE BLUEZ_SERVICE ".Error.NotAvailable"
#define BLUEZ_ERROR_NOT_SUPPORTED BLUEZ_SERVICE ".Error.NotSupported" #define BLUEZ_ERROR_NOT_SUPPORTED BLUEZ_SERVICE ".Error.NotSupported"
#define PA_BLUETOOTH_UUID_A2DP_SOURCE "0000110a-0000-1000-8000-00805f9b34fb" #define PA_BLUETOOTH_UUID_A2DP_SOURCE "0000110a-0000-1000-8000-00805f9b34fb"