* [PATCH 1/3] bluez5: Add bt_register_profile_full()
@ 2013-04-22 17:54 Vinicius Costa Gomes
2013-04-22 17:54 ` [PATCH 2/3] hfp: Add defines for HFP SDP feature bits Vinicius Costa Gomes
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Vinicius Costa Gomes @ 2013-04-22 17:54 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3334 bytes --]
This function makes it easy to set up optional information in the profile
service record.
---
plugins/bluez5.c | 40 +++++++++++++++++++++++++++++++++-------
plugins/bluez5.h | 10 ++++++++++
2 files changed, 43 insertions(+), 7 deletions(-)
diff --git a/plugins/bluez5.c b/plugins/bluez5.c
index 0f997da..48d8bf2 100644
--- a/plugins/bluez5.c
+++ b/plugins/bluez5.c
@@ -90,9 +90,10 @@ done:
dbus_message_unref(reply);
}
-int bt_register_profile_with_role(DBusConnection *conn, const char *uuid,
- uint16_t version, const char *name,
- const char *object, const char *role)
+int bt_register_profile_full(DBusConnection *conn,
+ const char *uuid, uint16_t version,
+ const char *name, const char *object,
+ struct bt_profile_info *optional)
{
DBusMessageIter iter, dict;
DBusPendingCall *c;
@@ -111,9 +112,19 @@ int bt_register_profile_with_role(DBusConnection *conn, const char *uuid,
ofono_dbus_dict_append(&dict, "Name", DBUS_TYPE_STRING, &name);
ofono_dbus_dict_append(&dict, "Version", DBUS_TYPE_UINT16, &version);
- if (role)
- ofono_dbus_dict_append(&dict, "Role", DBUS_TYPE_STRING, &role);
+ if (optional == NULL)
+ goto done;
+
+ if (optional->role)
+ ofono_dbus_dict_append(&dict, "Role", DBUS_TYPE_STRING,
+ &optional->role);
+
+ if (optional->features)
+ ofono_dbus_dict_append(&dict, "Features", DBUS_TYPE_UINT16,
+ &optional->features);
+
+done:
dbus_message_iter_close_container(&iter, &dict);
if (!dbus_connection_send_with_reply(conn, msg, &c, -1)) {
@@ -130,12 +141,27 @@ int bt_register_profile_with_role(DBusConnection *conn, const char *uuid,
return 0;
}
+int bt_register_profile_with_role(DBusConnection *conn, const char *uuid,
+ uint16_t version, const char *name,
+ const char *object, const char *role)
+{
+ struct bt_profile_info optional;
+
+ memset(&optional, 0, sizeof(optional));
+
+ optional.role = role;
+
+ return bt_register_profile_full(conn, uuid, version, name,
+ object, &optional);
+}
+
+
int bt_register_profile(DBusConnection *conn, const char *uuid,
uint16_t version, const char *name,
const char *object)
{
- return bt_register_profile_with_role(conn, uuid, version, name, object,
- NULL);
+ return bt_register_profile_full(conn, uuid, version, name,
+ object, NULL);
}
void bt_unregister_profile(DBusConnection *conn, const char *object)
diff --git a/plugins/bluez5.h b/plugins/bluez5.h
index 5b8c1f5..8118f1f 100644
--- a/plugins/bluez5.h
+++ b/plugins/bluez5.h
@@ -29,10 +29,20 @@
#define HFP_HS_UUID "0000111e-0000-1000-8000-00805f9b34fb"
#define HFP_AG_UUID "0000111f-0000-1000-8000-00805f9b34fb"
+struct bt_profile_info {
+ const char *role;
+ uint16_t features;
+};
+
int bt_register_profile_with_role(DBusConnection *conn, const char *uuid,
uint16_t version, const char *name,
const char *object, const char *role);
+int bt_register_profile_full(DBusConnection *conn,
+ const char *uuid, uint16_t version,
+ const char *name, const char *object,
+ struct bt_profile_info *optional);
+
int bt_register_profile(DBusConnection *conn, const char *uuid,
uint16_t version, const char *name,
const char *object);
--
1.8.2.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] hfp: Add defines for HFP SDP feature bits
2013-04-22 17:54 [PATCH 1/3] bluez5: Add bt_register_profile_full() Vinicius Costa Gomes
@ 2013-04-22 17:54 ` Vinicius Costa Gomes
2013-04-22 17:54 ` [PATCH 3/3] hfp_hf_bluez5: Register the SDP record with correct features Vinicius Costa Gomes
2013-04-23 8:46 ` [PATCH 1/3] bluez5: Add bt_register_profile_full() Denis Kenzior
2 siblings, 0 replies; 5+ messages in thread
From: Vinicius Costa Gomes @ 2013-04-22 17:54 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 951 bytes --]
---
src/hfp.h | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/hfp.h b/src/hfp.h
index b54de56..0d36ae5 100644
--- a/src/hfp.h
+++ b/src/hfp.h
@@ -45,6 +45,24 @@ enum hfp_hf_feature {
HFP_HF_FEATURE_CODEC_NEGOTIATION = 0x80,
};
+enum hfp_sdp_hf_features {
+ HFP_SDP_HF_FEATURE_ECNR = 0x1,
+ HFP_SDP_HF_FEATURE_3WAY = 0x2,
+ HFP_SDP_HF_FEATURE_CLIP = 0x4,
+ HFP_SDP_HF_FEATURE_VOICE_RECOGNITION = 0x8,
+ HFP_SDP_HF_FEATURE_REMOTE_VOLUME_CONTROL = 0x10,
+ HFP_SDP_HF_FEATURE_WIDEBAND_SPEECH = 0x20,
+};
+
+enum hfp_sdp_ag_features {
+ HFP_SDP_AG_FEATURE_3WAY = 0x1,
+ HFP_SDP_AG_FEATURE_ECNR = 0x2,
+ HFP_SDP_AG_FEATURE_VOICE_RECOG = 0x4,
+ HFP_SDP_AG_FEATURE_IN_BAND_RING_TONE = 0x8,
+ HFP_SDP_AG_FEATURE_ATTACH_VOICE_TAG = 0x10,
+ HFP_SDP_AG_FEATURE_WIDEBAND_SPEECH = 0x20,
+};
+
/* Supported agent codecs */
enum hfp_codec {
HFP_CODEC_CVSD = 0x01,
--
1.8.2.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] hfp_hf_bluez5: Register the SDP record with correct features
2013-04-22 17:54 [PATCH 1/3] bluez5: Add bt_register_profile_full() Vinicius Costa Gomes
2013-04-22 17:54 ` [PATCH 2/3] hfp: Add defines for HFP SDP feature bits Vinicius Costa Gomes
@ 2013-04-22 17:54 ` Vinicius Costa Gomes
2013-04-23 8:46 ` [PATCH 1/3] bluez5: Add bt_register_profile_full() Denis Kenzior
2 siblings, 0 replies; 5+ messages in thread
From: Vinicius Costa Gomes @ 2013-04-22 17:54 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1022 bytes --]
---
plugins/hfp_hf_bluez5.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index 2b9275b..d975a42 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -636,10 +636,19 @@ static const GDBusMethodTable profile_methods[] = {
static void connect_handler(DBusConnection *conn, void *user_data)
{
+ struct bt_profile_info optional;
+
+ memset(&optional, 0, sizeof(optional));
+
+ optional.features = HFP_SDP_HF_FEATURE_3WAY |
+ HFP_SDP_HF_FEATURE_CLIP |
+ HFP_SDP_HF_FEATURE_REMOTE_VOLUME_CONTROL |
+ HFP_SDP_HF_FEATURE_WIDEBAND_SPEECH;
+
DBG("Registering External Profile handler ...");
- bt_register_profile(conn, HFP_HS_UUID, HFP_VERSION_1_6, "hfp_hf",
- HFP_EXT_PROFILE_PATH);
+ bt_register_profile_full(conn, HFP_HS_UUID, HFP_VERSION_1_6, "hfp_hf",
+ HFP_EXT_PROFILE_PATH, &optional);
}
static gboolean has_hfp_ag_uuid(DBusMessageIter *array)
--
1.8.2.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] bluez5: Add bt_register_profile_full()
2013-04-22 17:54 [PATCH 1/3] bluez5: Add bt_register_profile_full() Vinicius Costa Gomes
2013-04-22 17:54 ` [PATCH 2/3] hfp: Add defines for HFP SDP feature bits Vinicius Costa Gomes
2013-04-22 17:54 ` [PATCH 3/3] hfp_hf_bluez5: Register the SDP record with correct features Vinicius Costa Gomes
@ 2013-04-23 8:46 ` Denis Kenzior
2013-04-23 14:29 ` Vinicius Costa Gomes
2 siblings, 1 reply; 5+ messages in thread
From: Denis Kenzior @ 2013-04-23 8:46 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 4053 bytes --]
Hi Vinicius,
On 04/22/2013 12:54 PM, Vinicius Costa Gomes wrote:
> This function makes it easy to set up optional information in the profile
> service record.
> ---
> plugins/bluez5.c | 40 +++++++++++++++++++++++++++++++++-------
> plugins/bluez5.h | 10 ++++++++++
> 2 files changed, 43 insertions(+), 7 deletions(-)
>
> diff --git a/plugins/bluez5.c b/plugins/bluez5.c
> index 0f997da..48d8bf2 100644
> --- a/plugins/bluez5.c
> +++ b/plugins/bluez5.c
> @@ -90,9 +90,10 @@ done:
> dbus_message_unref(reply);
> }
>
> -int bt_register_profile_with_role(DBusConnection *conn, const char *uuid,
> - uint16_t version, const char *name,
> - const char *object, const char *role)
> +int bt_register_profile_full(DBusConnection *conn,
> + const char *uuid, uint16_t version,
> + const char *name, const char *object,
> + struct bt_profile_info *optional)
We are now getting too many variations. We currently have 4 callers of
bt_register_profile (3 the simple function, 1 of _role). Now we have 4
callers and 3 variations. This is too much. Lets just make
bt_register_profile accept the full set of arguments and change everyone
over.
Also, I don't like introducing a struct bt_profile_info for this. Just
add the extra arguments you need and accept NULL where needed.
> {
> DBusMessageIter iter, dict;
> DBusPendingCall *c;
> @@ -111,9 +112,19 @@ int bt_register_profile_with_role(DBusConnection *conn, const char *uuid,
> ofono_dbus_dict_append(&dict, "Name", DBUS_TYPE_STRING,&name);
> ofono_dbus_dict_append(&dict, "Version", DBUS_TYPE_UINT16,&version);
>
> - if (role)
> - ofono_dbus_dict_append(&dict, "Role", DBUS_TYPE_STRING,&role);
>
> + if (optional == NULL)
> + goto done;
> +
> + if (optional->role)
> + ofono_dbus_dict_append(&dict, "Role", DBUS_TYPE_STRING,
> + &optional->role);
> +
> + if (optional->features)
> + ofono_dbus_dict_append(&dict, "Features", DBUS_TYPE_UINT16,
> + &optional->features);
> +
> +done:
> dbus_message_iter_close_container(&iter,&dict);
>
> if (!dbus_connection_send_with_reply(conn, msg,&c, -1)) {
> @@ -130,12 +141,27 @@ int bt_register_profile_with_role(DBusConnection *conn, const char *uuid,
> return 0;
> }
>
> +int bt_register_profile_with_role(DBusConnection *conn, const char *uuid,
> + uint16_t version, const char *name,
> + const char *object, const char *role)
> +{
> + struct bt_profile_info optional;
> +
> + memset(&optional, 0, sizeof(optional));
> +
> + optional.role = role;
> +
> + return bt_register_profile_full(conn, uuid, version, name,
> + object,&optional);
> +}
> +
> +
> int bt_register_profile(DBusConnection *conn, const char *uuid,
> uint16_t version, const char *name,
> const char *object)
> {
> - return bt_register_profile_with_role(conn, uuid, version, name, object,
> - NULL);
> + return bt_register_profile_full(conn, uuid, version, name,
> + object, NULL);
> }
>
> void bt_unregister_profile(DBusConnection *conn, const char *object)
> diff --git a/plugins/bluez5.h b/plugins/bluez5.h
> index 5b8c1f5..8118f1f 100644
> --- a/plugins/bluez5.h
> +++ b/plugins/bluez5.h
> @@ -29,10 +29,20 @@
> #define HFP_HS_UUID "0000111e-0000-1000-8000-00805f9b34fb"
> #define HFP_AG_UUID "0000111f-0000-1000-8000-00805f9b34fb"
>
> +struct bt_profile_info {
> + const char *role;
> + uint16_t features;
> +};
> +
> int bt_register_profile_with_role(DBusConnection *conn, const char *uuid,
> uint16_t version, const char *name,
> const char *object, const char *role);
>
> +int bt_register_profile_full(DBusConnection *conn,
> + const char *uuid, uint16_t version,
> + const char *name, const char *object,
> + struct bt_profile_info *optional);
> +
> int bt_register_profile(DBusConnection *conn, const char *uuid,
> uint16_t version, const char *name,
> const char *object);
Regards,
-Denis
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] bluez5: Add bt_register_profile_full()
2013-04-23 8:46 ` [PATCH 1/3] bluez5: Add bt_register_profile_full() Denis Kenzior
@ 2013-04-23 14:29 ` Vinicius Costa Gomes
0 siblings, 0 replies; 5+ messages in thread
From: Vinicius Costa Gomes @ 2013-04-23 14:29 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1486 bytes --]
Hi Denis,
On 03:46 Tue 23 Apr, Denis Kenzior wrote:
> Hi Vinicius,
>
> On 04/22/2013 12:54 PM, Vinicius Costa Gomes wrote:
> >This function makes it easy to set up optional information in the profile
> >service record.
> >---
> > plugins/bluez5.c | 40 +++++++++++++++++++++++++++++++++-------
> > plugins/bluez5.h | 10 ++++++++++
> > 2 files changed, 43 insertions(+), 7 deletions(-)
> >
> >diff --git a/plugins/bluez5.c b/plugins/bluez5.c
> >index 0f997da..48d8bf2 100644
> >--- a/plugins/bluez5.c
> >+++ b/plugins/bluez5.c
> >@@ -90,9 +90,10 @@ done:
> > dbus_message_unref(reply);
> > }
> >
> >-int bt_register_profile_with_role(DBusConnection *conn, const char *uuid,
> >- uint16_t version, const char *name,
> >- const char *object, const char *role)
> >+int bt_register_profile_full(DBusConnection *conn,
> >+ const char *uuid, uint16_t version,
> >+ const char *name, const char *object,
> >+ struct bt_profile_info *optional)
>
> We are now getting too many variations. We currently have 4 callers
> of bt_register_profile (3 the simple function, 1 of _role). Now we
> have 4 callers and 3 variations. This is too much. Lets just make
> bt_register_profile accept the full set of arguments and change
> everyone over.
>
> Also, I don't like introducing a struct bt_profile_info for this.
> Just add the extra arguments you need and accept NULL where needed.
Fair enough. Sure.
Sure.
--
Vinicius
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-04-23 14:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-22 17:54 [PATCH 1/3] bluez5: Add bt_register_profile_full() Vinicius Costa Gomes
2013-04-22 17:54 ` [PATCH 2/3] hfp: Add defines for HFP SDP feature bits Vinicius Costa Gomes
2013-04-22 17:54 ` [PATCH 3/3] hfp_hf_bluez5: Register the SDP record with correct features Vinicius Costa Gomes
2013-04-23 8:46 ` [PATCH 1/3] bluez5: Add bt_register_profile_full() Denis Kenzior
2013-04-23 14:29 ` Vinicius Costa Gomes
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.