FN_START;
int headset_type = BT_AUDIO_PROFILE_TYPE_ALL;
+ int ret;
+ int hfp_restricted = 0x0;
+ int a2dp_restricted = 0x0;
ret_if(ugd == NULL);
ret_if(dev == NULL);
headset_type = BT_AUDIO_PROFILE_TYPE_HSP_HFP;
BT_INFO("Connection type = %d", headset_type);
+ if (headset_type == BT_AUDIO_PROFILE_TYPE_ALL) {
+ /* restriction check */
+ bt_device_get_profile_restricted(dev->addr_str, BT_RESTRICTED_PROFILE_HFP_HS, &hfp_restricted);
+ bt_device_get_profile_restricted(dev->addr_str, BT_RESTRICTED_PROFILE_A2DP, &a2dp_restricted);
+ BT_INFO("Restricted Connection, HFP:%d, A2DP:%d", hfp_restricted, a2dp_restricted);
+
+ if ((hfp_restricted == 0x1) && (a2dp_restricted == 0x1)) {
+ ret = bt_device_set_profile_restricted(dev->addr_str, BT_RESTRICTED_PROFILE_HFP_HS, 0x0);
+ if (ret != BT_ERROR_NONE)
+ BT_ERR("Fail to set profile restriction");
+
+ ret = bt_device_set_profile_restricted(dev->addr_str, BT_RESTRICTED_PROFILE_A2DP, 0x0);
+ if (ret != BT_ERROR_NONE)
+ BT_ERR("Fail to set profile restriction");
+ }
+ }
if (bt_audio_connect(dev->addr_str,
headset_type) == BT_ERROR_NONE) {
if (dev->connected_mask & BT_STEREO_HEADSET_CONNECTED) {
ret = __bt_profile_disconnect_option((bt_ug_data *)dev->ugd,
dev, BT_STEREO_HEADSET_DEVICE);
+
} else {
ret = __bt_profile_connect_option((bt_ug_data *)dev->ugd,
dev, BT_STEREO_HEADSET_DEVICE);
+
}
#endif
FN_START;
int audio_profile;
+ int ret;
retv_if(ugd == NULL, BT_UG_FAIL);
retv_if(dev == NULL, BT_UG_FAIL);
if (type == BT_HEADSET_DEVICE || type == BT_STEREO_HEADSET_DEVICE ||
type == BT_MUSIC_PLAYER_DEVICE) {
- if (type == BT_STEREO_HEADSET_DEVICE)
+ if (type == BT_STEREO_HEADSET_DEVICE) {
audio_profile = BT_AUDIO_PROFILE_TYPE_A2DP;
+ /* set restriction : allowed */
+ ret = bt_device_set_profile_restricted(dev->addr_str, BT_RESTRICTED_PROFILE_A2DP, 0x0);
+ if (ret != BT_ERROR_NONE)
+ BT_ERR("Failed to set restriction");
+ }
#ifdef TIZEN_BT_A2DP_SINK_ENABLE
else if (type == BT_MUSIC_PLAYER_DEVICE)
audio_profile = BT_AUDIO_PROFILE_TYPE_A2DP_SINK;
#endif
- else
+ else {
+ /* set restriction : allowed */
audio_profile = BT_AUDIO_PROFILE_TYPE_HSP_HFP;
+ ret = bt_device_set_profile_restricted(dev->addr_str, BT_RESTRICTED_PROFILE_HFP_HS, 0x0);
+ if (ret != BT_ERROR_NONE)
+ BT_ERR("Failed to set restriction");
+ }
if (bt_audio_connect(dev->addr_str,
audio_profile) != BT_ERROR_NONE) {
FN_START;
int audio_profile;
+ int ret;
bt_ug_ipc_param_t param;
gboolean connected = FALSE;
gboolean connected_nap_profile = FALSE;
if (type == BT_HEADSET_DEVICE || type == BT_STEREO_HEADSET_DEVICE ||
type == BT_MUSIC_PLAYER_DEVICE) {
- if (type == BT_STEREO_HEADSET_DEVICE)
+ if (type == BT_STEREO_HEADSET_DEVICE) {
audio_profile = BT_AUDIO_PROFILE_TYPE_A2DP;
+ ret = bt_device_set_profile_restricted(dev->addr_str, BT_RESTRICTED_PROFILE_A2DP, 0x1);
+ if (ret != BT_ERROR_NONE)
+ BT_ERR("Failed to set restriction");
+ }
#ifdef TIZEN_BT_A2DP_SINK_ENABLE
else if (type == BT_MUSIC_PLAYER_DEVICE)
audio_profile = BT_AUDIO_PROFILE_TYPE_A2DP_SINK;
#endif
- else
+ else {
audio_profile = BT_AUDIO_PROFILE_TYPE_HSP_HFP;
+ ret = bt_device_set_profile_restricted(dev->addr_str, BT_RESTRICTED_PROFILE_HFP_HS, 0x1);
+ if (ret != BT_ERROR_NONE)
+ BT_ERR("Failed to set restriction");
+ }
+
if (bt_audio_disconnect(dev->addr_str,
audio_profile) != BT_ERROR_NONE) {