summaryrefslogtreecommitdiff
path: root/src/profile.c
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2020-04-13 18:25:13 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2020-04-13 17:07:12 -0700
commite3b8a6484b23650f2e55047240dac25fece697cf (patch)
tree038748c9067081ba1e5fb91b9965c428a59be2d5 /src/profile.c
parent040bd56a948f4d1ecd6987cdf0ba51779dc0c02a (diff)
downloadbluez-e3b8a6484b23650f2e55047240dac25fece697cf.tar.gz
profile: Add default SDP record for Headset role of HSP 1.2
This would allow D-Bus agents to implement HS role of HSP profile.
Diffstat (limited to 'src/profile.c')
-rw-r--r--src/profile.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/profile.c b/src/profile.c
index e94f28675..7e27adb56 100644
--- a/src/profile.c
+++ b/src/profile.c
@@ -56,6 +56,7 @@
#define DUN_DEFAULT_CHANNEL 1
#define SPP_DEFAULT_CHANNEL 3
+#define HSP_HS_DEFAULT_CHANNEL 6
#define HFP_HF_DEFAULT_CHANNEL 7
#define OPP_DEFAULT_CHANNEL 9
#define FTP_DEFAULT_CHANNEL 10
@@ -155,6 +156,49 @@
</attribute> \
</record>"
+/* SDP record for Headset role of HSP 1.2 profile with Erratum 3507 */
+#define HSP_HS_RECORD \
+ "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> \
+ <record> \
+ <attribute id=\"0x0001\"> \
+ <sequence> \
+ <uuid value=\"0x1108\" /> \
+ <uuid value=\"0x1131\" /> \
+ <uuid value=\"0x1203\" /> \
+ </sequence> \
+ </attribute> \
+ <attribute id=\"0x0004\"> \
+ <sequence> \
+ <sequence> \
+ <uuid value=\"0x0100\" /> \
+ </sequence> \
+ <sequence> \
+ <uuid value=\"0x0003\" /> \
+ <uint8 value=\"0x%02x\" /> \
+ </sequence> \
+ </sequence> \
+ </attribute> \
+ <attribute id=\"0x0005\"> \
+ <sequence> \
+ <uuid value=\"0x1002\" /> \
+ </sequence> \
+ </attribute> \
+ <attribute id=\"0x0009\"> \
+ <sequence> \
+ <sequence> \
+ <uuid value=\"0x1108\" /> \
+ <uint16 value=\"0x%04x\" /> \
+ </sequence> \
+ </sequence> \
+ </attribute> \
+ <attribute id=\"0x0100\"> \
+ <text value=\"%s\" /> \
+ </attribute> \
+ <attribute id=\"0x0302\"> \
+ <boolean value=\"%s\" /> \
+ </attribute> \
+ </record>"
+
#define HSP_AG_RECORD \
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?> \
<record> \
@@ -1776,6 +1820,15 @@ static char *get_hfp_ag_record(struct ext_profile *ext, struct ext_io *l2cap,
ext->name, ext->features);
}
+static char *get_hsp_hs_record(struct ext_profile *ext, struct ext_io *l2cap,
+ struct ext_io *rfcomm)
+{
+ /* HSP 1.2: By default Remote Audio Volume Control is off */
+ return g_strdup_printf(HSP_HS_RECORD, rfcomm->chan, ext->version,
+ ext->name, (ext->features & 0x1) ? "true" :
+ "false");
+}
+
static char *get_hsp_ag_record(struct ext_profile *ext, struct ext_io *l2cap,
struct ext_io *rfcomm)
{
@@ -1989,6 +2042,16 @@ static struct default_settings {
.get_record = get_hfp_hf_record,
.version = 0x0107,
}, {
+ .uuid = HSP_HS_UUID,
+ .name = "Headset unit",
+ .priority = BTD_PROFILE_PRIORITY_HIGH,
+ .remote_uuid = HSP_AG_UUID,
+ .channel = HSP_HS_DEFAULT_CHANNEL,
+ .authorize = true,
+ .auto_connect = true,
+ .get_record = get_hsp_hs_record,
+ .version = 0x0102,
+ }, {
.uuid = HFP_AG_UUID,
.name = "Hands-Free Voice gateway",
.priority = BTD_PROFILE_PRIORITY_HIGH,