static DBusMessage *volume_down(DBusConnection *conn, DBusMessage *msg, void *data) { struct audio_device *device = data; struct control *control = device->control; DBusMessage *reply; int err; reply = dbus_message_new_method_return(msg); if (!reply) return NULL; if (control->state != AVCTP_STATE_CONNECTED) return g_dbus_create_error(msg, ERROR_INTERFACE ".NotConnected", "Device not Connected"); if (!control->target) return g_dbus_create_error(msg, ERROR_INTERFACE ".NotSupported", "AVRCP Target role not supported"); err = avctp_send_passthrough(control, VOL_DOWN_OP); if (err < 0) return g_dbus_create_error(msg, ERROR_INTERFACE ".Failed", strerror(-err)); return dbus_message_new_method_return(msg); }
static DBusMessage *key_pressed(DBusConnection *conn, DBusMessage *msg, uint8_t op, void *data) { struct control *control = data; int err; if (!control->session) return btd_error_not_connected(msg); if (!control->target) return btd_error_not_supported(msg); err = avctp_send_passthrough(control->session, op); if (err < 0) return btd_error_failed(msg, strerror(-err)); return dbus_message_new_method_return(msg); }
static DBusMessage *volume_down(DBusConnection *conn, DBusMessage *msg, void *data) { struct audio_device *device = data; struct control *control = device->control; int err; if (!control->session) return btd_error_not_connected(msg); if (!control->target) return btd_error_not_supported(msg); err = avctp_send_passthrough(control->session, VOL_DOWN_OP); if (err < 0) return btd_error_failed(msg, strerror(-err)); return dbus_message_new_method_return(msg); }