char *uuid;
int value = BLUETOOTH_ERROR_NONE;
bt_audio_function_data_t *func_data;
+ guint hfp_hs_restricted = 0x0; /* set default "allowed" */
+ guint a2dp_restricted = 0x0;
BT_CHECK_PARAMETER(device_address, return);
func_data->pending = BT_PENDING_NONE;
func_data->out_param = out_param1;
+ result = _bt_get_restrict_profile(device_address, RESTRICTED_PROFILE_HFP_HS, &hfp_hs_restricted);
+ if (result != BLUETOOTH_ERROR_NONE)
+ BT_ERR("Can't get hfp_hs restriction info");
+
+ result = _bt_get_restrict_profile(device_address, RESTRICTED_PROFILE_A2DP, &a2dp_restricted);
+ if (result != BLUETOOTH_ERROR_NONE)
+ BT_ERR("Can't get a2dp restriction info");
+
switch (type) {
case BT_AUDIO_HSP:
uuid = HFP_HS_UUID;
uuid = A2DP_SOURCE_UUID;
break;
case BT_AUDIO_ALL:
- if (__bt_device_support_uuid(address, BT_AUDIO_HSP)) {
- uuid = HFP_HS_UUID;
- func_data->pending = BT_PENDING_CONNECT;
- type = BT_AUDIO_HSP;
- } else if (__bt_device_support_uuid(address, BT_AUDIO_A2DP)) {
- uuid = A2DP_SINK_UUID;
- type = BT_AUDIO_A2DP;
- } else {
- BT_ERR("No audio role supported");
- result = BLUETOOTH_ERROR_SERVICE_NOT_FOUND;
+ if ((hfp_hs_restricted == 0x0) && (a2dp_restricted == 0x0)) { /* in case of both profiles are not restricted */
+ if (__bt_device_support_uuid(address, BT_AUDIO_HSP)) {
+ uuid = HFP_HS_UUID;
+ func_data->pending = BT_PENDING_CONNECT;
+ type = BT_AUDIO_HSP;
+ } else if (__bt_device_support_uuid(address, BT_AUDIO_A2DP)) {
+ uuid = A2DP_SINK_UUID;
+ type = BT_AUDIO_A2DP;
+ } else {
+ BT_ERR("No audio role supported");
+ result = BLUETOOTH_ERROR_SERVICE_NOT_FOUND;
+ goto fail;
+ }
+ } else if ((hfp_hs_restricted == 0x1) && (a2dp_restricted == 0x1)) { /* in case of both profiles are restricted */
+ BT_ERR("All profiles are restricted");
+ result = BLUETOOTH_ERROR_INTERNAL;
goto fail;
+ } else if (a2dp_restricted == 0x01) { /* in case of a2dp is restricted, only connection for hfp_hs */
+ if (__bt_device_support_uuid(address, BT_AUDIO_HSP)) {
+ uuid = HFP_HS_UUID;
+ type = BT_AUDIO_HSP;
+ } else {
+ BT_ERR("HFP_HS role is not supported");
+ result = BLUETOOTH_ERROR_SERVICE_NOT_FOUND;
+ goto fail;
+ }
+ } else if (hfp_hs_restricted == 0x01) { /* in case of hfp_hs is restricted, only connection for a2dp */
+ if (__bt_device_support_uuid(address, BT_AUDIO_A2DP)) {
+ uuid = A2DP_SINK_UUID;
+ type = BT_AUDIO_A2DP;
+ } else {
+ BT_ERR("A2DP role is not supported");
+ result = BLUETOOTH_ERROR_SERVICE_NOT_FOUND;
+ goto fail;
+ }
}
break;
case BT_AVRCP_TARGET:
int state = 0;
char *profile_uuid = NULL;
bt_headset_wait_t *wait_list;
+ bluetooth_device_address_t bd_addr;
g_variant_get(msg, "(si)", &profile_uuid, &state);
ret_if(address == NULL);
_bt_convert_device_path_to_address(path, address);
+ _bt_convert_addr_string_to_type(bd_addr.addr, address);
_bt_convert_addr_string_to_secure_string(secure_address, address);
BT_DBG("Address: %s", secure_address);
bluetooth_device_address_t device_address;
gboolean connected;
bt_headset_wait_t *wait_list;
+ guint restricted = 0x0;
__bt_set_device_values(TRUE,
VCONFKEY_BT_DEVICE_A2DP_HEADSET_CONNECTED);
__bt_connection_manager_set_state(address, event);
- if (_bt_headset_get_local_connection() == FALSE)
- _bt_start_timer_for_connection(address, BT_AUDIO_HSP);
- else {
+ _bt_get_restrict_profile(&bd_addr, RESTRICTED_PROFILE_HFP_HS, &restricted);
+
+ if (_bt_headset_get_local_connection() == FALSE) {
+ if (restricted == 0x0) /* not restricted*/
+ _bt_start_timer_for_connection(address, BT_AUDIO_HSP);
+ } else {
/* Connection Started from local device therefore no need to
* intiate connection for pending profile */
_bt_headset_set_local_connection(FALSE);
GVariant *value = NULL;
GVariant *param = NULL;
g_variant_get(msg, "(sv)", &property, &value);
+ bluetooth_device_address_t bd_addr;
ret_if(property == NULL);
int event = BLUETOOTH_EVENT_NONE;
bt_headset_wait_t *wait_list;
char *address;
+ guint restricted = 0x0;
g_variant_get(value, "b", &property_flag);
address = g_malloc0(BT_ADDRESS_STRING_SIZE);
return;
_bt_convert_device_path_to_address(path, address);
+ _bt_convert_addr_string_to_type(bd_addr.addr, address);
if (property_flag == TRUE) {
event = BLUETOOTH_EVENT_AG_CONNECTED;
- if (_bt_headset_get_local_connection() == FALSE)
- _bt_start_timer_for_connection(address, BT_AUDIO_A2DP);
- else
+ _bt_get_restrict_profile(&bd_addr, RESTRICTED_PROFILE_A2DP, &restricted);
+
+ if (_bt_headset_get_local_connection() == FALSE) {
+ if (restricted == 0x0) /* not restricted*/
+ _bt_start_timer_for_connection(address, BT_AUDIO_A2DP);
+ } else
_bt_headset_set_local_connection(FALSE);
} else {
int previous_state;
int _bt_get_trust_profile(bluetooth_device_address_t *bd_addr,
bluetooth_trusted_profile_t profile, guint *trust);
+int _bt_set_restrict_profile(bluetooth_device_address_t *bd_addr,
+ bluetooth_restricted_profile_t profile, gboolean restricted);
+
+int _bt_get_restrict_profile(bluetooth_device_address_t *bd_addr,
+ bluetooth_restricted_profile_t profile, guint *restricted);
+
bluetooth_trusted_profile_t _bt_get_trusted_profile_enum(const char *uuid);
int _bt_connect_le_ipsp_device(const bluetooth_device_address_t *bd_addr);
*
* @param[in] device_address a device address of remote bluetooth device
* @param[in] profile profile which is to be set as restricted[1-HFP_HS, 2-A2DP]
- * @param[in] restricted to set as restricted or not[1-not 0-restricted]
+ * @param[in] restricted to set as restricted or not[1-restricted 0-permitted]
*
* @return BLUETOOTH_ERROR_NONE - Success \n
* BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
*
* @param[in] device_address a device address of remote bluetooth device
* @param[in] profile profile whose restricted status is needed[1-HFP_HS, 2-A2DP]
- * @param[out] restricted profile is set as restricted or not[1-not 0-restricted]
+ * @param[out] restricted profile is set as restricted or not[1-restricted 0-permitted]
*
* @return BLUETOOTH_ERROR_NONE - Success \n
* BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n