return result;
}
+BT_EXPORT_API int bluetooth_media_control_command_to_dest(
+ media_player_control_cmd type,
+ bluetooth_device_address_t *remote_address)
+{
+ 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, remote_address,
+ sizeof(bluetooth_device_address_t));
+
+ result = _bt_send_request(BT_BLUEZ_SERVICE, BT_AVRCP_HANDLE_CONTROL_TO_DEST,
+ 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_set_property(
media_player_property_type type,
unsigned int value)
{BT_AVRCP_TARGET_CONNECT, "BT_AVRCP_TARGET_CONNECT"},
{BT_AVRCP_TARGET_DISCONNECT, "BT_AVRCP_TARGET_DISCONNECT"},
{BT_AVRCP_HANDLE_CONTROL, "BT_AVRCP_HANDLE_CONTROL"},
+ {BT_AVRCP_HANDLE_CONTROL_TO_DEST, "BT_AVRCP_HANDLE_CONTROL_TO_DEST"},
{BT_AVRCP_CONTROL_SET_PROPERTY, "BT_AVRCP_CONTROL_SET_PROPERTY"},
{BT_AVRCP_CONTROL_GET_PROPERTY, "BT_AVRCP_CONTROL_GET_PROPERTY"},
{BT_AVRCP_GET_TRACK_INFO, "BT_AVRCP_GET_TRACK_INFO"},
return result;
}
+int _bt_avrcp_control_cmd_to_dest(int type, bluetooth_device_address_t *device_address)
+{
+ char connected_address[BT_ADDRESS_STRING_SIZE + 1];
+ gboolean connected;
+ oal_status_t status = OAL_STATUS_SUCCESS;
+ int result = BLUETOOTH_ERROR_NONE;
+ BT_INFO("+");
+
+ _bt_convert_addr_type_to_string(connected_address, device_address->addr);
+
+ connected = _bt_is_headset_address_type_connected(BT_AVRCP,
+ (const char *)connected_address);
+
+ if (connected) {
+ switch (type) {
+ case RC_PASS_CMD_PLAY:
+ status = avrcp_ct_play((bt_address_t*)device_address);
+ break;
+ case RC_PASS_CMD_PAUSE:
+ status = avrcp_ct_pause((bt_address_t*)device_address);
+ break;
+ case RC_PASS_CMD_STOP:
+ status = avrcp_ct_stop((bt_address_t*)device_address);
+ break;
+ case RC_PASS_CMD_NEXT:
+ status = avrcp_ct_next_track((bt_address_t*)device_address);
+ break;
+ case RC_PASS_CMD_PREVIOUS:
+ status = avrcp_ct_prev_track((bt_address_t*)device_address);
+ break;
+ case RC_PASS_CMD_PRESS_FAST_FORWARD:
+ status = avrcp_ct_fforward((bt_address_t*)device_address, PRESS_STATE);
+ break;
+ case RC_PASS_CMD_RELEASE_FAST_FORWARD:
+ status = avrcp_ct_fforward((bt_address_t*)device_address, RELEASE_STATE);
+ break;
+ case RC_PASS_CMD_PRESS_REWIND:
+ status = avrcp_ct_rewind((bt_address_t*)device_address, PRESS_STATE);
+ break;
+ case RC_PASS_CMD_RELEASE_REWIND:
+ status = avrcp_ct_rewind((bt_address_t*)device_address, RELEASE_STATE);
+ break;
+ case RC_PASS_CMD_VOLUME_UP:
+ status = avrcp_ct_volume_up((bt_address_t*)device_address);
+ break;
+ case RC_PASS_CMD_VOLUME_DOWN:
+ status = avrcp_ct_volume_down((bt_address_t*)device_address);
+ break;
+ default:
+ break;
+ }
+
+ if (status != OAL_STATUS_SUCCESS) {
+ BT_ERR("Send pass through command err: [%d]", status);
+ result = BLUETOOTH_ERROR_INTERNAL;
+ }
+ } else {
+ BT_ERR("Device is not connected:");
+ return BLUETOOTH_ERROR_NOT_CONNECTED;
+ }
+
+ return result;
+}
+
int _bt_avrcp_control_set_property(int type, unsigned int value)
{
char connected_address[BT_ADDRESS_STRING_SIZE + 1];
return FALSE;
}
+
+gboolean _bt_is_headset_address_type_connected(int type, const char *address)
+{
+ GList *node;
+
+ node = g_list_first(g_connected_list);
+ while (node != NULL) {
+ bt_connected_headset_data_t *connected_device = node->data;
+
+ if (connected_device && (connected_device->type & type)) {
+ if (memcmp(connected_device->device_address, address, 19) == 0)
+ return TRUE;
+ }
+
+ node = g_list_next(node);
+ }
+ return FALSE;
+}
+
static void __bt_set_headset_disconnection_type(const char *address)
{
bt_connected_headset_data_t *connected_device;
result = _bt_avrcp_control_cmd(key_code);
break;
}
+ case BT_AVRCP_HANDLE_CONTROL_TO_DEST: {
+ int key_code;
+ bluetooth_device_address_t address = { { 0 } };
+
+ __bt_service_get_parameters(in_param1, &key_code, sizeof(int));
+ __bt_service_get_parameters(in_param2,
+ &address, sizeof(bluetooth_device_address_t));
+
+ result = _bt_avrcp_control_cmd_to_dest(key_code, &address);
+ break;
+ }
case BT_AVRCP_CONTROL_SET_PROPERTY: {
int type;
unsigned int value;
case BT_AVRCP_CONTROL_GET_PROPERTY:
case BT_AVRCP_GET_TRACK_INFO:
case BT_AVRCP_TRANSPORT_SET_PROPERTY:
-
+ case BT_AVRCP_HANDLE_CONTROL_TO_DEST:
case BT_SET_CONTENT_PROTECT:
case BT_BOND_DEVICE_BY_TYPE:
gboolean _bt_is_headset_type_connected(int type, char *address);
+gboolean _bt_is_headset_address_type_connected(int type, const char *address);
+
void _bt_add_headset_to_list(int type, int status, const char *address);
void _bt_remove_service_search_request(char *address);
int _bt_avrcp_control_cmd(int type);
+int _bt_avrcp_control_cmd_to_dest(int type, bluetooth_device_address_t *address);
+
int _bt_avrcp_control_set_property(int type, unsigned int value);
int _bt_avrcp_transport_set_property(int type, unsigned int value);
*/
int bluetooth_media_control_command(media_player_control_cmd type);
+/**
+ * @brief The function bluetooth_media_control_command_to_dest is called to send
+ * the AVRCP Control command like Play, Pause, FF, Rewind to the specific target device.
+ *
+ * @param[in] type media_player_control_cmd.
+ * @param[in] remote_address Bluetooth device address.
+ * @return int Zero on Success or reason for error if any.
+ *
+ */
+int bluetooth_media_control_command_to_dest(media_player_control_cmd type,
+ bluetooth_device_address_t *remote_address);
+
/**
* @fn int bluetooth_media_control_set_property(media_player_property_type type, unsigned int value)
* @brief Notifies the remote bluetooth target with change in music control settings
BT_AVRCP_TARGET_CONNECT,
BT_AVRCP_TARGET_DISCONNECT,
BT_AVRCP_HANDLE_CONTROL,
+ BT_AVRCP_HANDLE_CONTROL_TO_DEST,
BT_AVRCP_CONTROL_SET_PROPERTY,
BT_AVRCP_CONTROL_GET_PROPERTY,
BT_AVRCP_GET_TRACK_INFO,