summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoHyun Pyun <dh79.pyun@samsung.com>2017-09-06 11:20:40 +0900
committerDoHyun Pyun <dh79.pyun@samsung.com>2017-09-06 11:33:11 +0900
commita2e634e1087567e59ab8591341ed167138b47479 (patch)
treec32f62f9bfd19cf0bef14732f3b33d1536d4ba80
parent01e0e1f6b812ceb95f653c676c82daa6e769034c (diff)
downloadbluez-a2e634e1087567e59ab8591341ed167138b47479.tar.gz
bluez-a2e634e1087567e59ab8591341ed167138b47479.tar.bz2
bluez-a2e634e1087567e59ab8591341ed167138b47479.zip
------------------------------------------------------- commit c396c5b362f3c376c1afb390c23476ae9f482697 Author: Biman Paul <biman.paul@samsung.com> Date: Fri Aug 4 19:59:40 2017 +0530 Use Trusted Profiles instead of Restricted Profiles ------------------------------------------------------- Change-Id: I5b38f1a17762d17391cda458fa9ae2204dd25b03 Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
-rw-r--r--[-rwxr-xr-x]gobex/gobex.c9
-rw-r--r--[-rwxr-xr-x]gobex/gobex.h3
-rw-r--r--[-rwxr-xr-x]obexd/plugins/bluetooth.c12
-rw-r--r--[-rwxr-xr-x]obexd/src/obex.c85
-rw-r--r--[-rwxr-xr-x]profiles/audio/a2dp.c2
-rw-r--r--src/device.c208
-rw-r--r--[-rwxr-xr-x]src/device.h5
-rw-r--r--src/profile.c27
8 files changed, 210 insertions, 141 deletions
diff --git a/gobex/gobex.c b/gobex/gobex.c
index 61ddc66d..d0b1e01b 100755..100644
--- a/gobex/gobex.c
+++ b/gobex/gobex.c
@@ -1552,7 +1552,14 @@ void g_obex_unref(GObex *obex)
}
/* Higher level functions */
-
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+void g_obex_io_shutdown(GObex *obex)
+{
+ GError *err = NULL;
+ if (obex->io != NULL)
+ g_io_channel_shutdown(obex->io, FALSE, &err);
+}
+#endif
guint g_obex_connect(GObex *obex, GObexResponseFunc func, gpointer user_data,
GError **err, guint8 first_hdr_id, ...)
{
diff --git a/gobex/gobex.h b/gobex/gobex.h
index 5bc91031..827dc3b4 100755..100644
--- a/gobex/gobex.h
+++ b/gobex/gobex.h
@@ -134,5 +134,8 @@ gboolean g_obex_cancel_transfer(guint id, GObexFunc complete_func,
const char *g_obex_strerror(guint8 err_code);
guint8 g_obex_errno_to_rsp(int err);
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+void g_obex_io_shutdown(GObex *obex);
+#endif
#endif /* __GOBEX_H */
diff --git a/obexd/plugins/bluetooth.c b/obexd/plugins/bluetooth.c
index 3ee54325..dd33ee77 100755..100644
--- a/obexd/plugins/bluetooth.c
+++ b/obexd/plugins/bluetooth.c
@@ -162,6 +162,18 @@ static DBusMessage *profile_new_connection(DBusConnection *conn,
static DBusMessage *profile_request_disconnection(DBusConnection *conn,
DBusMessage *msg, void *data)
{
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+ const char *device;
+ const char *path;
+ path = dbus_message_get_path(msg);
+ DBG("Path %s", path);
+
+ dbus_message_get_args(msg, NULL, DBUS_TYPE_OBJECT_PATH, &device,
+ DBUS_TYPE_INVALID);
+ DBG("Device %s", device);
+
+ obex_session_disconnect(path, device);
+#endif
return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
}
diff --git a/obexd/src/obex.c b/obexd/src/obex.c
index fee2461b..b81dfd95 100755..100644
--- a/obexd/src/obex.c
+++ b/obexd/src/obex.c
@@ -41,6 +41,10 @@
#include <glib.h>
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+#include "lib/uuid.h"
+#endif
+
#include "gobex/gobex.h"
#include "btio/btio.h"
@@ -1026,6 +1030,87 @@ static void disconn_func(GObex *obex, GError *err, gpointer user_data)
obex_session_destroy(os);
}
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+#define BLUETOOTH_MAC_ADDRESS_LEN 18
+void obex_convert_device_path_to_address(const char *device_path,
+ char *device_address)
+{
+ char address[BLUETOOTH_MAC_ADDRESS_LEN] = { 0 };
+ char *dev_addr;
+
+ if (device_path == NULL || device_address == NULL)
+ return;
+
+ dev_addr = strstr(device_path, "dev_");
+ if (dev_addr != NULL) {
+ char *pos = NULL;
+ dev_addr += 4;
+ g_strlcpy(address, dev_addr, sizeof(address));
+
+ while ((pos = strchr(address, '_')) != NULL)
+ *pos = ':';
+
+ g_strlcpy(device_address, address, BLUETOOTH_MAC_ADDRESS_LEN);
+ }
+}
+
+int obex_object_path_to_uuid(const char *path)
+{
+ char uuid[MAX_LEN_UUID_STR] = { 0 };
+ const char *uuidptr;
+
+ if (path == NULL)
+ return -1;
+ /* /org/bluez/obex/0000112f_0000_1000_8000_00805f9b34fb */
+ uuidptr = path;
+
+ char *pos = NULL;
+ uuidptr += 16;
+ g_strlcpy(uuid, uuidptr, sizeof(uuid));
+
+ while ((pos = strchr(uuid, '_')) != NULL)
+ *pos = '-';
+
+ if (g_strcmp0(uuid, OBEX_PSE_UUID) == 0)
+ return OBEX_PBAP;
+ else if (g_strcmp0(uuid, OBEX_FTP_UUID) == 0)
+ return OBEX_FTP;
+ else if (g_strcmp0(uuid, OBEX_OPP_UUID) == 0)
+ return OBEX_OPP;
+ else if (g_strcmp0(uuid, OBEX_MAS_UUID) == 0)
+ return OBEX_MAS;
+ else if (g_strcmp0(uuid, OBEX_MNS_UUID) == 0)
+ return OBEX_MNS;
+ else
+ return -1;
+}
+
+void obex_session_disconnect(const char *uuid_path, const char *device_path)
+{
+ GSList *l = sessions;
+ char device_address[BLUETOOTH_MAC_ADDRESS_LEN];
+ int service;
+
+ obex_convert_device_path_to_address(device_path, device_address);
+ service = obex_object_path_to_uuid(uuid_path);
+
+ if (service == -1)
+ return;
+
+ while (l) {
+ struct obex_session *os = l->data;
+ if (g_strcmp0(os->dst, device_address) == 0 &&
+ os->service->service == service) {
+ /* Need to check for address? */
+ g_obex_io_shutdown(os->obex);
+ obex_session_destroy(os);
+ break;
+ }
+ l = l->next;
+ }
+}
+#endif
+
int obex_session_start(GIOChannel *io, uint16_t tx_mtu, uint16_t rx_mtu,
gboolean stream, struct obex_server *server)
{
diff --git a/profiles/audio/a2dp.c b/profiles/audio/a2dp.c
index c09ddf93..c308754a 100755..100644
--- a/profiles/audio/a2dp.c
+++ b/profiles/audio/a2dp.c
@@ -1628,7 +1628,7 @@ static void confirm_cb(GIOChannel *io, gpointer data)
{
gboolean restricted = FALSE;
- restricted = device_is_profile_restricted(device, A2DP_SINK_UUID);
+ restricted = device_is_profile_blocked(device, A2DP_SINK_UUID);
if (restricted) {
DBG("A2DP is restricted");
goto drop;
diff --git a/src/device.c b/src/device.c
index 30ec1b2b..bc5d7494 100644
--- a/src/device.c
+++ b/src/device.c
@@ -210,12 +210,9 @@ struct trusted_profile_t {
uint32_t pbap:2;
uint32_t map:2;
uint32_t sap:2;
+ uint32_t hfp_hs:2;
+ uint32_t a2dp:2;
} __packed;
-
-struct restricted_profile_t {
- uint32_t hfp_hs;
- uint32_t a2dp;
-};
#endif
struct btd_device {
@@ -287,7 +284,6 @@ struct btd_device {
gboolean trusted;
#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
struct trusted_profile_t trusted_profiles;
- struct restricted_profile_t restricted_profiles;
#endif
gboolean blocked;
gboolean auto_connect;
@@ -343,17 +339,11 @@ typedef enum {
#define PBAP_SHIFT_OFFSET 0
#define MAP_SHIFT_OFFSET 2
#define SAP_SHIFT_OFFSET 4
+#define HFP_HS_SHIFT_OFFSET 6
+#define A2DP_SHIFT_OFFSET 8
#define PROFILE_SUPPORTED 0x3 /* This corresponds to binary 0b11*/
-typedef enum {
- CONNECTION_PERMITTED = 0x0, /* 0b00 */
- CONNECTION_RESTRICTED = 0x1, /* 0b01 */
-} bt_profile_restricted_states;
-
-#define HFP_HS_SHIFT_OFFSET 0
-#define A2DP_SHIFT_OFFSET 2
-
#endif
#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
@@ -583,18 +573,12 @@ static gboolean store_device_info_cb(gpointer user_data)
struct trusted_profile_t trust_profile = device->trusted_profiles;
int trusted_profiles = (trust_profile.pbap << PBAP_SHIFT_OFFSET) |
(trust_profile.map << MAP_SHIFT_OFFSET) |
- (trust_profile.sap << SAP_SHIFT_OFFSET);
+ (trust_profile.sap << SAP_SHIFT_OFFSET) |
+ (trust_profile.hfp_hs << HFP_HS_SHIFT_OFFSET) |
+ (trust_profile.a2dp << A2DP_SHIFT_OFFSET);
DBG("Storing TrustedProfiles %d", trusted_profiles);
g_key_file_set_integer(key_file, "General", "TrustedProfiles",
trusted_profiles);
-
- struct restricted_profile_t restrict_profile = device->restricted_profiles;
- int restricted_profiles = (restrict_profile.hfp_hs << HFP_HS_SHIFT_OFFSET) |
- (restrict_profile.a2dp << A2DP_SHIFT_OFFSET);
- DBG("Storing RestrictedProfiles %d", restricted_profiles);
- g_key_file_set_integer(key_file, "General", "RestrictedProfiles",
- restricted_profiles);
-
#endif
g_key_file_set_boolean(key_file, "General", "Blocked",
device->blocked);
@@ -945,18 +929,11 @@ gboolean device_is_profile_trusted(struct btd_device *device,
} else if (g_strcmp0(uuid, SAP_UUID) == 0) {
if (device->trusted_profiles.sap == SUPPORTED_TRUSTED)
return TRUE;
- }
- return FALSE;
-}
-
-gboolean device_is_profile_restricted(struct btd_device *device,
- const char *uuid)
-{
- if (g_strcmp0(uuid, HFP_HS_UUID) == 0) {
- if (device->restricted_profiles.hfp_hs == CONNECTION_RESTRICTED)
+ } else if (g_strcmp0(uuid, HFP_HS_UUID) == 0) {
+ if (device->trusted_profiles.hfp_hs == SUPPORTED_TRUSTED)
return TRUE;
} else if (g_strcmp0(uuid, A2DP_SINK_UUID) == 0) {
- if (device->restricted_profiles.a2dp == CONNECTION_RESTRICTED)
+ if (device->trusted_profiles.a2dp == SUPPORTED_TRUSTED)
return TRUE;
}
return FALSE;
@@ -974,6 +951,12 @@ gboolean device_is_profile_blocked(struct btd_device *device,
} else if (g_strcmp0(uuid, SAP_UUID) == 0) {
if (device->trusted_profiles.sap == SUPPORTED_BLOCKED)
return TRUE;
+ } else if (g_strcmp0(uuid, HFP_HS_UUID) == 0) {
+ if (device->trusted_profiles.hfp_hs == SUPPORTED_BLOCKED)
+ return TRUE;
+ } else if (g_strcmp0(uuid, A2DP_SINK_UUID) == 0) {
+ if (device->trusted_profiles.a2dp == SUPPORTED_BLOCKED)
+ return TRUE;
}
return FALSE;
}
@@ -1346,26 +1329,15 @@ static gboolean dev_property_get_trusted_profiles(const GDBusPropertyTable *prop
uint32_t pbap = device->trusted_profiles.pbap;
uint32_t map = device->trusted_profiles.map;
uint32_t sap = device->trusted_profiles.sap;
+ uint32_t hfp_hs = device->trusted_profiles.hfp_hs;
+ uint32_t a2dp = device->trusted_profiles.a2dp;
unsigned int val = (pbap << PBAP_SHIFT_OFFSET) |
(map << MAP_SHIFT_OFFSET) |
- (sap << SAP_SHIFT_OFFSET);
-
- dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32, &val);
-
- return TRUE;
-}
-
-static gboolean dev_property_get_restricted_profiles(const GDBusPropertyTable *property,
- DBusMessageIter *iter, void *data)
-{
- struct btd_device *device = data;
- uint32_t hfp_hs = device->restricted_profiles.hfp_hs;
- uint32_t a2dp = device->restricted_profiles.a2dp;
-
- unsigned int val = (hfp_hs << HFP_HS_SHIFT_OFFSET) |
+ (sap << SAP_SHIFT_OFFSET) |
+ (hfp_hs << HFP_HS_SHIFT_OFFSET) |
(a2dp << A2DP_SHIFT_OFFSET);
-
+ DBG("TRUST :%x", val);
dbus_message_iter_append_basic(iter, DBUS_TYPE_UINT32, &val);
return TRUE;
@@ -3861,6 +3833,8 @@ static DBusMessage *set_trusted_profile(DBusConnection *conn,
uint32_t pbap = dev->trusted_profiles.pbap;
uint32_t map = dev->trusted_profiles.map;
uint32_t sap = dev->trusted_profiles.sap;
+ uint32_t hfp_hs = dev->trusted_profiles.hfp_hs;
+ uint32_t a2dp = dev->trusted_profiles.a2dp;
if (!dbus_message_get_args(msg, NULL,
DBUS_TYPE_STRING, &pattern,
@@ -3873,6 +3847,8 @@ static DBusMessage *set_trusted_profile(DBusConnection *conn,
DBG("UUID : %s", uuid);
DBG("profile Trusted : %d %d %d", dev->trusted_profiles.pbap,
dev->trusted_profiles.map, dev->trusted_profiles.sap);
+ DBG("profile Restricted : %d %d", dev->trusted_profiles.hfp_hs,
+ dev->trusted_profiles.a2dp);
if (g_strcmp0(uuid, OBEX_PBAP_UUID) == 0) {
if (profile_trusted)
pbap = SUPPORTED_TRUSTED;
@@ -3888,50 +3864,21 @@ static DBusMessage *set_trusted_profile(DBusConnection *conn,
sap = SUPPORTED_TRUSTED;
else
sap = SUPPORTED_BLOCKED;
- } else {
- return btd_error_invalid_args(msg);
- }
-
- btd_device_set_trusted_profiles(dev, pbap, map, sap);
- return dbus_message_new_method_return(msg);
-}
-
-static DBusMessage *set_restricted_profile(DBusConnection *conn,
- DBusMessage *msg, void *data)
-{
- struct btd_device *dev = data;
- dbus_bool_t profile_restricted;
- const char *pattern;
- char *uuid;
- uint32_t hfp_hs = dev->restricted_profiles.hfp_hs;
- uint32_t a2dp = dev->restricted_profiles.a2dp;
-
- if (!dbus_message_get_args(msg, NULL,
- DBUS_TYPE_STRING, &pattern,
- DBUS_TYPE_BOOLEAN, &profile_restricted,
- DBUS_TYPE_INVALID))
- return btd_error_invalid_args(msg);
-
- DBG("Pattern : %s", pattern);
- uuid = bt_name2string(pattern);
- DBG("UUID : %s", uuid);
- DBG("profile Restricted : %d %d", dev->restricted_profiles.hfp_hs,
- dev->restricted_profiles.a2dp);
- if (g_strcmp0(uuid, HFP_HS_UUID) == 0) {
- if (profile_restricted)
- hfp_hs = CONNECTION_RESTRICTED;
+ } else if (g_strcmp0(uuid, HFP_HS_UUID) == 0) {
+ if (profile_trusted)
+ hfp_hs = SUPPORTED_TRUSTED;
else
- hfp_hs = CONNECTION_PERMITTED;
+ hfp_hs = SUPPORTED_BLOCKED;
} else if (g_strcmp0(uuid, A2DP_SINK_UUID) == 0) {
- if (profile_restricted)
- a2dp = CONNECTION_RESTRICTED;
+ if (profile_trusted)
+ a2dp = SUPPORTED_TRUSTED;
else
- a2dp = CONNECTION_PERMITTED;
+ a2dp = SUPPORTED_BLOCKED;
} else {
return btd_error_invalid_args(msg);
}
- btd_device_set_restricted_profiles(dev, hfp_hs, a2dp);
+ btd_device_set_trusted_profiles(dev, pbap, map, sap, hfp_hs, a2dp);
return dbus_message_new_method_return(msg);
}
@@ -4215,9 +4162,6 @@ static const GDBusMethodTable device_methods[] = {
{ GDBUS_METHOD("SetTrustedProfile",
GDBUS_ARGS({ "uuid", "s"}, { "trusted", "b"}), NULL,
set_trusted_profile) },
- { GDBUS_METHOD("SetRestrictedProfile",
- GDBUS_ARGS({ "uuid", "s"}, { "restricted", "b"}), NULL,
- set_restricted_profile) },
#endif
{ }
};
@@ -4259,7 +4203,6 @@ static const GDBusPropertyTable device_properties[] = {
{ "IpspBtInterfaceInfo", "s", dev_property_get_ipsp_conn_bt_iface_name },
{ "AttMtu", "q", dev_property_get_att_mtu },
{ "TrustedProfiles", "u", dev_property_get_trusted_profiles},
- { "RestrictedProfiles", "u", dev_property_get_restricted_profiles},
#endif
{ "ManufacturerData", "a{qv}", dev_property_get_manufacturer_data,
NULL, dev_property_manufacturer_data_exist },
@@ -4705,13 +4648,10 @@ next:
(PROFILE_SUPPORTED << MAP_SHIFT_OFFSET)) >> MAP_SHIFT_OFFSET);
device->trusted_profiles.sap = ((trusted_profiles &
(PROFILE_SUPPORTED << SAP_SHIFT_OFFSET)) >> SAP_SHIFT_OFFSET);
-
- /* Load Restricted Profiles*/
- int restricted_profiles = g_key_file_get_integer(key_file, "General",
- "RestrictedProfiles", NULL);
- DBG("Loading RestrictedProfiles %d", restricted_profiles);
- device->restricted_profiles.hfp_hs = (restricted_profiles >> HFP_HS_SHIFT_OFFSET) & 0x01;
- device->restricted_profiles.a2dp = (restricted_profiles >> A2DP_SHIFT_OFFSET) & 0x01;
+ device->trusted_profiles.hfp_hs = ((trusted_profiles &
+ (PROFILE_SUPPORTED << HFP_HS_SHIFT_OFFSET)) >> HFP_HS_SHIFT_OFFSET);
+ device->trusted_profiles.a2dp = ((trusted_profiles &
+ (PROFILE_SUPPORTED << A2DP_SHIFT_OFFSET)) >> A2DP_SHIFT_OFFSET);
#endif
@@ -5943,6 +5883,8 @@ void device_unpair(struct btd_device *device, gboolean remove_stored)
device->trusted_profiles.pbap = SHOW_AUTHORIZATION;
device->trusted_profiles.map = SHOW_AUTHORIZATION;
device->trusted_profiles.sap = SHOW_AUTHORIZATION;
+ device->trusted_profiles.hfp_hs = SUPPORTED_TRUSTED;
+ device->trusted_profiles.a2dp = SUPPORTED_TRUSTED;
if (device->alias != NULL) {
/* Remove alias name because
* In UG if we rename and then unpair device and
@@ -7607,46 +7549,68 @@ void btd_device_set_trusted(struct btd_device *device, gboolean trusted)
}
#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
-void btd_device_set_trusted_profiles(struct btd_device *device,
- uint32_t pbap, uint32_t map, uint32_t sap)
+void device_disconnect_blocked(struct btd_device *device,
+ const char *uuid)
{
- if (!device)
- return;
- DBG("TrustedProfiles Parameters: [PBAP %d] [MAP %d] [SAP %d]", pbap, map, sap);
+ struct btd_service *service;
+ GSList *l;
- if (device->trusted_profiles.pbap == pbap &&
- device->trusted_profiles.map == map &&
- device->trusted_profiles.sap == sap)
+ if (!device || !uuid)
return;
- device->trusted_profiles.pbap = pbap;
- device->trusted_profiles.map = map;
- device->trusted_profiles.sap = sap;
-
- store_device_info(device);
+ l = find_service_with_uuid(device->services, uuid);
+ if (l == NULL)
+ return;
- g_dbus_emit_property_changed(dbus_conn, device->path,
- DEVICE_INTERFACE, "TrustedProfiles");
+ service = l->data;
+ if (btd_service_get_state(service) ==
+ BTD_SERVICE_STATE_CONNECTED) {
+ int err;
+ err = btd_service_disconnect(service);
+ if (err)
+ error("error: %s", strerror(-err));
+ }
}
-void btd_device_set_restricted_profiles(struct btd_device *device,
+void btd_device_set_trusted_profiles(struct btd_device *device,
+ uint32_t pbap, uint32_t map, uint32_t sap,
uint32_t hfp_hs, uint32_t a2dp)
{
+ char *uuid = NULL;
if (!device)
return;
- DBG("RestrictedProfiles Parameters: [HFP %d] [A2DP %d]", hfp_hs, a2dp);
+ DBG("TrustedProfiles Parameters: [PBAP %d] [MAP %d] [SAP %d] [HFP %d] [A2DP %d]",
+ pbap, map, sap, hfp_hs, a2dp);
- if (device->restricted_profiles.hfp_hs == hfp_hs &&
- device->restricted_profiles.a2dp == a2dp)
- return;
-
- device->restricted_profiles.hfp_hs = hfp_hs;
- device->restricted_profiles.a2dp = a2dp;
+ if (device->trusted_profiles.pbap == pbap &&
+ device->trusted_profiles.map == map &&
+ device->trusted_profiles.sap == sap &&
+ device->trusted_profiles.hfp_hs == hfp_hs &&
+ device->trusted_profiles.a2dp == a2dp)
+ return;
+
+ /* Disconnect OBEX based profiles if connected */
+ if (device->trusted_profiles.pbap != pbap) {
+ device->trusted_profiles.pbap = pbap;
+ if (pbap == SUPPORTED_BLOCKED)
+ device_disconnect_blocked(device, OBEX_PSE_UUID);
+ } else if (device->trusted_profiles.map != map) {
+ device->trusted_profiles.map = map;
+ if (map == SUPPORTED_BLOCKED)
+ device_disconnect_blocked(device, OBEX_MAP_UUID);
+ } else if (device->trusted_profiles.sap != sap) {
+ device->trusted_profiles.sap = sap;
+ if (sap == SUPPORTED_BLOCKED)
+ device_disconnect_blocked(device, SAP_UUID);
+ } else if (device->trusted_profiles.hfp_hs != hfp_hs) {
+ device->trusted_profiles.hfp_hs = hfp_hs;
+ } else if (device->trusted_profiles.a2dp != a2dp) {
+ device->trusted_profiles.a2dp = a2dp;
+ }
store_device_info(device);
-
g_dbus_emit_property_changed(dbus_conn, device->path,
- DEVICE_INTERFACE, "RestrictedProfiles");
+ DEVICE_INTERFACE, "TrustedProfiles");
}
#endif
diff --git a/src/device.h b/src/device.h
index ff39856e..55aea7c5 100755..100644
--- a/src/device.h
+++ b/src/device.h
@@ -111,7 +111,8 @@ void device_set_irk_value(struct btd_device *device, const uint8_t *val);
void device_set_conn_update_state(struct btd_device *device, bool state);
bool device_get_conn_update_state(struct btd_device *device);
void btd_device_set_trusted_profiles(struct btd_device *device,
- uint32_t pbap, uint32_t map, uint32_t sap);
+ uint32_t pbap, uint32_t map, uint32_t sap,
+ uint32_t hfp_hs, uint32_t a2dp);
#endif
gboolean device_is_temporary(struct btd_device *device);
bool device_is_paired(struct btd_device *device, uint8_t bdaddr_type);
@@ -219,8 +220,6 @@ gboolean device_is_profile_trusted(struct btd_device *device,
const char *uuid);
gboolean device_is_profile_blocked(struct btd_device *device,
const char *uuid);
-gboolean device_is_profile_restricted(struct btd_device *device,
- const char *uuid);
void btd_device_disconnect(struct btd_device *dev);
void btd_device_set_legacy_pairing(struct btd_device *dev, bool legacy_pairing);
void btd_device_set_svc_changed_indication(struct btd_device *dev, bool value);
diff --git a/src/profile.c b/src/profile.c
index 0ee3ce76..3ecfa101 100644
--- a/src/profile.c
+++ b/src/profile.c
@@ -647,7 +647,7 @@
<uint8 value=\"0x00\"/> \
</attribute> \
<attribute id=\"0x0316\"> \
- <uint8 value=\"0x0F\"/> \
+ <uint8 value=\""SUPPORTED_MESSAGE_TYPES"\"/> \
</attribute> \
<attribute id=\"0x0317\"> \
<uint32 value=\"0x0000007f\"/> \
@@ -857,7 +857,7 @@
<sequence> \
<sequence> \
<uint8 value=\"0x22\" /> \
- <text encoding=\"hex\" value=\"05010902a10185010901a100050919012903150025017501950381027505950181010501093009311581257f750895028106a10285010938950175081581257f8106c0c0c005010906a1018502a100050719e029e71500250175019508810295087508150025650507190029658100c0c005010905A10185030901A1000930093109330934150026FF00350046FF0075089504810209397504950115002507463B016614008142750195048103050919012910750195108102C0C0\" /> \
+ <text encoding=\"hex\" value=\"05010902A10185010901A100050919012903150025017501950381027505950181010501093009311581257F750895028106A10285010938950175081581257F8106C0C0C005010906A1018502A100050719E029E71500250175019508810295087508150025650507190029658100C0C005010905A10185030901A1000930093109330934150026FF00350046FF0075089504810209397504950115002507463B016614008142750195048103050919012910750195108102C0C005010906A1018504A100050C150025017501950D09300931093209B009B109B309B409B509B609B709E209E909EA8102750295018103750195050508190129059102750395019103C0C0\" /> \
</sequence> \
</sequence> \
</attribute> \
@@ -1471,20 +1471,19 @@ static void ext_confirm(GIOChannel *io, gpointer user_data)
DBG("incoming connect from %s", addr);
#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
-{
- struct btd_device *device;
- gboolean restricted = FALSE;
-
- device = btd_adapter_find_device(adapter_find(&src), &dst,
- BDADDR_BREDR);
- if (device) {
- restricted = device_is_profile_restricted(device, HFP_HS_UUID);
- if (restricted) {
- DBG("HFP_HS is restricted");
- return;
+ if (g_strcmp0(uuid, HFP_AG_UUID) == 0) {
+ struct btd_device *device;
+ gboolean restricted = FALSE;
+ device = btd_adapter_find_device(adapter_find(&src), &dst,
+ BDADDR_BREDR);
+ if (device) {
+ restricted = device_is_profile_blocked(device, HFP_HS_UUID);
+ if (restricted) {
+ DBG("HFP_HS is restricted");
+ return;
+ }
}
}
-}
#endif
conn = create_conn(server, io, &src, &dst);