return result;
}
+BT_EXPORT_API int bluetooth_media_transport_set_property(
+ media_transport_property_type type,
+ unsigned int value)
+{
+ int result;
+
+ BT_CHECK_ENABLED(return);
+
+#ifdef TIZEN_FEATURE_BT_DPM
+ if (_bt_check_dpm(BT_DPM_AVRCP, NULL) == BT_DPM_RESTRICTED) {
+ BT_ERR("Not allow to use AVRCP profile");
+ return BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION;
+ }
+#endif
+
+ BT_INIT_PARAMS();
+ BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ g_array_append_vals(in_param1, &type, sizeof(int));
+ g_array_append_vals(in_param2, &value, sizeof(unsigned int));
+
+ result = _bt_send_request(BT_BLUEZ_SERVICE,
+ BT_AVRCP_TRANSPORT_SET_PROPERTY,
+ in_param1, in_param2, in_param3,
+ in_param4, &out_param);
+
+ BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ return result;
+}
+
BT_EXPORT_API int bluetooth_media_control_get_track_info(
media_metadata_attributes_t *metadata)
{
};
static char *avrcp_control_path = NULL;
+static char *avrcp_transport_path = NULL;
void _bt_set_control_device_path(const char *path)
{
return control_path;
}
+static char *__bt_get_transport_device_path(void)
+{
+ char *adapter_path;
+ char *transport_path;
+ char connected_address[BT_ADDRESS_STRING_SIZE + 1];
+
+ BT_DBG("+");
+
+ if (avrcp_transport_path != NULL)
+ return avrcp_transport_path;
+
+ retv_if(!_bt_is_headset_type_connected(BT_AVRCP,
+ connected_address), NULL);
+
+ BT_DBG("device address = %s", connected_address);
+
+ adapter_path = _bt_get_device_object_path(connected_address);
+ retv_if(adapter_path == NULL, NULL);
+
+ transport_path = g_strdup_printf(BT_MEDIA_TRANSPORT_PATH, adapter_path);
+ g_free(adapter_path);
+
+ avrcp_transport_path = transport_path;
+ BT_DBG("transport_path = %s", transport_path);
+ return transport_path;
+}
+
static int __bt_media_send_control_msg(const char *name)
{
GVariant *reply = NULL;
return proxy;
}
+GDBusProxy *__bt_get_transport_properties_proxy(void)
+{
+ GDBusProxy *proxy = NULL;
+ GError *error = NULL;
+ char *transport_path = NULL;
+ GDBusConnection *conn = NULL;
+
+ transport_path = __bt_get_transport_device_path();
+ retv_if(transport_path == NULL, NULL);
+ BT_DBG("transport_path = %s", transport_path);
+
+ conn = _bt_gdbus_get_system_gconn();
+ retv_if(conn == NULL, NULL);
+
+ proxy = g_dbus_proxy_new_sync(conn,
+ G_DBUS_PROXY_FLAGS_NONE, NULL,
+ BT_BLUEZ_NAME, transport_path,
+ BT_PROPERTIES_INTERFACE, NULL, &error);
+ if (proxy == NULL) {
+ BT_ERR("Unable to allocate new proxy");
+ if (error) {
+ BT_ERR("%s", error->message);
+ g_clear_error(&error);
+ }
+ return NULL;
+ }
+
+ return proxy;
+}
+
static int __bt_media_attr_to_event(const char *str)
{
if (!strcasecmp(str, "Equalizer"))
return NULL;
}
+static const char *__bt_transport_type_to_str(int type)
+{
+ switch (type) {
+ case DELAY:
+ return "Delay";
+ case VOLUME:
+ return "Volume";
+ }
+ return NULL;
+}
+
static int __bt_media_attrval_to_val(int type, const char *value)
{
int ret = 0;
return BLUETOOTH_ERROR_NONE;
}
+int _bt_avrcp_transport_set_property(int type, unsigned int value)
+{
+ GValue *attr_value = NULL;
+ GDBusProxy *proxy = NULL;
+ GError *error = NULL;
+ GVariant *reply, *param;
+ uint16_t property_level = (uint16_t)value;
+
+ g_value_init(attr_value, G_TYPE_STRING);
+
+ switch (type) {
+ case DELAY:
+ param = g_variant_new("q", property_level);
+ BT_INFO("delay level %d", property_level);
+ break;
+ case VOLUME:
+ param = g_variant_new("q", property_level);
+ BT_INFO("volume level %d", property_level);
+ break;
+ default:
+ BT_ERR("Invalid property type: %d", type);
+ g_value_unset(attr_value);
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+
+ proxy = __bt_get_transport_properties_proxy();
+ retv_if(proxy == NULL, BLUETOOTH_ERROR_NOT_CONNECTED);
+
+ reply = g_dbus_proxy_call_sync(proxy,
+ "Set", g_variant_new("(ssv)", BT_MEDIATRANSPORT_INTERFACE, __bt_transport_type_to_str(type), param),
+ G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
+
+ g_object_unref(proxy);
+ g_variant_unref(param);
+
+ if (!reply) {
+ BT_ERR("Can't get managed objects");
+ if (error) {
+ BT_ERR("SetProperty Fail: %s", error->message);
+ g_clear_error(&error);
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
+ }
+
+ g_variant_unref(reply);
+ g_value_unset(attr_value);
+
+ return BLUETOOTH_ERROR_NONE;
+}
+
static int __bt_avrcp_control_parse_properties(
media_metadata_attributes_t *metadata,
GVariant *item)
} media_player_property_type;
typedef enum {
+ DELAY = 0x01,
+ VOLUME
+} media_transport_property_type;
+
+typedef enum {
EQUALIZER_OFF = 0x01,
EQUALIZER_ON,
EQUALIZER_INVALID,
int bluetooth_media_control_get_property(media_player_property_type type, unsigned int *value);
/**
+ * @fn int bluetooth_media_transport_set_property(media_transport_property_type type, unsigned int value)
+ * @brief Notifies the remote bluetooth target with change in audio transport settings
+ *
+ * This function is a asynchronous call.
+ * No event for this api.
+ *
+ * @return BT_MEDIA_TRANSPORT_SUCCESS - Success \n
+ * BT_MEDIA_TRANSPORT_ERROR - Error \n
+ *
+ * @exception None
+ * @param[in] setting - The audio transport properties
+ *
+ * @remark None
+ * @see None
+ */
+int bluetooth_media_transport_set_property(media_transport_property_type type, unsigned int value);
+
+/**
* @fn int bluetooth_media_control_get_track_info(media_metadata_attributes_t *metadata)
* @brief reads the track metadata from the remote target player.
*