+BT_EXPORT_API int bluetooth_media_target_connect(
+ bluetooth_device_address_t *remote_address)
+{
+ int result;
+ bt_user_info_t *user_info;
+
+ BT_CHECK_PARAMETER(remote_address, return);
+ BT_CHECK_ENABLED(return);
+
+ if (_bt_check_privilege(BT_CHECK_PRIVILEGE, BT_AVRCP_TARGET_CONNECT)
+ == BLUETOOTH_ERROR_PERMISSION_DEINED) {
+ BT_ERR("Don't have a privilege to use this API");
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ }
+
+#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
+ user_info = _bt_get_user_data(BT_AVRCP);
+ retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+ BT_INIT_PARAMS();
+ BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ g_array_append_vals(in_param1, remote_address,
+ sizeof(bluetooth_device_address_t));
+
+ result = _bt_send_request_async(BT_BLUEZ_SERVICE,
+ BT_AVRCP_TARGET_CONNECT, in_param1,
+ in_param2, in_param3, in_param4,
+ user_info->cb, user_info->user_data);
+
+ BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ return result;
+}
+
+BT_EXPORT_API int bluetooth_media_target_disconnect(
+ bluetooth_device_address_t *remote_address)
+{
+ int result;
+ bt_user_info_t *user_info;
+
+ BT_CHECK_PARAMETER(remote_address, return);
+ BT_CHECK_ENABLED(return);
+
+ if (_bt_check_privilege(BT_CHECK_PRIVILEGE, BT_AVRCP_TARGET_DISCONNECT)
+ == BLUETOOTH_ERROR_PERMISSION_DEINED) {
+ BT_ERR("Don't have a privilege to use this API");
+ return BLUETOOTH_ERROR_PERMISSION_DEINED;
+ }
+
+ user_info = _bt_get_user_data(BT_AVRCP);
+ retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
+
+ BT_INIT_PARAMS();
+ BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ g_array_append_vals(in_param1, remote_address,
+ sizeof(bluetooth_device_address_t));
+
+ result = _bt_send_request_async(BT_BLUEZ_SERVICE,
+ BT_AVRCP_TARGET_DISCONNECT, in_param1,
+ in_param2, in_param3, in_param4,
+ user_info->cb, user_info->user_data);
+
+ BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
+
+ return result;
+}
+