linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] AVRCP: Refactor the code using constants
@ 2012-05-10  6:26 joohi.rastogi
  2012-05-10 15:40 ` Lucas De Marchi
  0 siblings, 1 reply; 5+ messages in thread
From: joohi.rastogi @ 2012-05-10  6:26 UTC (permalink / raw)
  To: User Name; +Cc: User Name2

From: Joohi Rastogi <joohi.rastogi@stericsson.com>

Adds macros for category features
---
 audio/avrcp.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/audio/avrcp.c b/audio/avrcp.c
index df39d04..1b35c3f 100644
--- a/audio/avrcp.c
+++ b/audio/avrcp.c
@@ -89,6 +89,11 @@
 #define CAP_COMPANY_ID		0x02
 #define CAP_EVENTS_SUPPORTED	0x03
 
+#define AVRCP_FEATURE_CATEGORY_1	0x0001
+#define AVRCP_FEATURE_CATEGORY_2	0x0002
+#define AVRCP_FEATURE_CATEGORY_3	0x0004
+#define AVRCP_FEATURE_CATEGORY_4	0x0008
+
 enum battery_status {
 	BATTERY_STATUS_NORMAL =		0,
 	BATTERY_STATUS_WARNING =	1,
@@ -174,7 +179,9 @@ static sdp_record_t *avrcp_ct_record(void)
 	sdp_record_t *record;
 	sdp_data_t *psm, *version, *features;
 	uint16_t lp = AVCTP_PSM;
-	uint16_t avrcp_ver = 0x0100, avctp_ver = 0x0103, feat = 0x000f;
+	uint16_t avrcp_ver = 0x0100, avctp_ver = 0x0103;
+	uint16_t feat = (AVRCP_FEATURE_CATEGORY_1 | AVRCP_FEATURE_CATEGORY_2
+		| AVRCP_FEATURE_CATEGORY_3 | AVRCP_FEATURE_CATEGORY_4);
 
 	record = sdp_record_alloc();
 	if (!record)
@@ -238,7 +245,9 @@ static sdp_record_t *avrcp_tg_record(void)
 	sdp_record_t *record;
 	sdp_data_t *psm, *version, *features;
 	uint16_t lp = AVCTP_PSM;
-	uint16_t avrcp_ver = 0x0103, avctp_ver = 0x0103, feat = 0x000f;
+	uint16_t avrcp_ver = 0x0103, avctp_ver = 0x0103;
+	uint16_t feat = (AVRCP_FEATURE_CATEGORY_1 | AVRCP_FEATURE_CATEGORY_2
+		| AVRCP_FEATURE_CATEGORY_3 | AVRCP_FEATURE_CATEGORY_4);
 
 	record = sdp_record_alloc();
 	if (!record)
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] AVRCP: Refactor the code using constants
  2012-05-10  6:26 [PATCH 1/2] AVRCP: Refactor the code using constants joohi.rastogi
@ 2012-05-10 15:40 ` Lucas De Marchi
  0 siblings, 0 replies; 5+ messages in thread
From: Lucas De Marchi @ 2012-05-10 15:40 UTC (permalink / raw)
  To: joohi.rastogi; +Cc: User Name

On Thu, May 10, 2012 at 3:26 AM,  <joohi.rastogi@stericsson.com> wrote:
> From: Joohi Rastogi <joohi.rastogi@stericsson.com>
>
> Adds macros for category features
> ---
>  audio/avrcp.c |   13 +++++++++++--
>  1 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/audio/avrcp.c b/audio/avrcp.c
> index df39d04..1b35c3f 100644
> --- a/audio/avrcp.c
> +++ b/audio/avrcp.c
> @@ -89,6 +89,11 @@
>  #define CAP_COMPANY_ID         0x02
>  #define CAP_EVENTS_SUPPORTED   0x03
>
> +#define AVRCP_FEATURE_CATEGORY_1       0x0001
> +#define AVRCP_FEATURE_CATEGORY_2       0x0002
> +#define AVRCP_FEATURE_CATEGORY_3       0x0004
> +#define AVRCP_FEATURE_CATEGORY_4       0x0008
> +
>  enum battery_status {
>        BATTERY_STATUS_NORMAL =         0,
>        BATTERY_STATUS_WARNING =        1,
> @@ -174,7 +179,9 @@ static sdp_record_t *avrcp_ct_record(void)
>        sdp_record_t *record;
>        sdp_data_t *psm, *version, *features;
>        uint16_t lp = AVCTP_PSM;
> -       uint16_t avrcp_ver = 0x0100, avctp_ver = 0x0103, feat = 0x000f;
> +       uint16_t avrcp_ver = 0x0100, avctp_ver = 0x0103;
> +       uint16_t feat = (AVRCP_FEATURE_CATEGORY_1 | AVRCP_FEATURE_CATEGORY_2
> +               | AVRCP_FEATURE_CATEGORY_3 | AVRCP_FEATURE_CATEGORY_4);
>
>        record = sdp_record_alloc();
>        if (!record)
> @@ -238,7 +245,9 @@ static sdp_record_t *avrcp_tg_record(void)
>        sdp_record_t *record;
>        sdp_data_t *psm, *version, *features;
>        uint16_t lp = AVCTP_PSM;
> -       uint16_t avrcp_ver = 0x0103, avctp_ver = 0x0103, feat = 0x000f;
> +       uint16_t avrcp_ver = 0x0103, avctp_ver = 0x0103;
> +       uint16_t feat = (AVRCP_FEATURE_CATEGORY_1 | AVRCP_FEATURE_CATEGORY_2
> +               | AVRCP_FEATURE_CATEGORY_3 | AVRCP_FEATURE_CATEGORY_4);

Humn... just a matter of taste, I'm ok with it


Ack

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] AVRCP: Refactor the code using constants
@ 2012-05-18  5:13 joohi.rastogi
  0 siblings, 0 replies; 5+ messages in thread
From: joohi.rastogi @ 2012-05-18  5:13 UTC (permalink / raw)
  To: User Name; +Cc: User Name2

From: Joohi Rastogi <joohi.rastogi@stericsson.com>

---
 audio/avrcp.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/audio/avrcp.c b/audio/avrcp.c
index df39d04..eb10c01 100644
--- a/audio/avrcp.c
+++ b/audio/avrcp.c
@@ -89,6 +89,11 @@
 #define CAP_COMPANY_ID		0x02
 #define CAP_EVENTS_SUPPORTED	0x03
 
+#define AVRCP_FEATURE_CATEGORY_1	0x0001
+#define AVRCP_FEATURE_CATEGORY_2	0x0002
+#define AVRCP_FEATURE_CATEGORY_3	0x0004
+#define AVRCP_FEATURE_CATEGORY_4	0x0008
+
 enum battery_status {
 	BATTERY_STATUS_NORMAL =		0,
 	BATTERY_STATUS_WARNING =	1,
@@ -174,7 +179,11 @@ static sdp_record_t *avrcp_ct_record(void)
 	sdp_record_t *record;
 	sdp_data_t *psm, *version, *features;
 	uint16_t lp = AVCTP_PSM;
-	uint16_t avrcp_ver = 0x0100, avctp_ver = 0x0103, feat = 0x000f;
+	uint16_t avrcp_ver = 0x0100, avctp_ver = 0x0103;
+	uint16_t feat = ( AVRCP_FEATURE_CATEGORY_1 |
+			AVRCP_FEATURE_CATEGORY_2 |
+			AVRCP_FEATURE_CATEGORY_3 |
+			AVRCP_FEATURE_CATEGORY_4 );
 
 	record = sdp_record_alloc();
 	if (!record)
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 1/2] AVRCP: Refactor the code using constants
@ 2012-05-18  5:25 joohi.rastogi
  2012-05-18 17:52 ` Johan Hedberg
  0 siblings, 1 reply; 5+ messages in thread
From: joohi.rastogi @ 2012-05-18  5:25 UTC (permalink / raw)
  To: User Name; +Cc: User Name2

From: Joohi Rastogi <joohi.rastogi@stericsson.com>

---
 audio/avrcp.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/audio/avrcp.c b/audio/avrcp.c
index df39d04..a741873 100644
--- a/audio/avrcp.c
+++ b/audio/avrcp.c
@@ -89,6 +89,11 @@
 #define CAP_COMPANY_ID		0x02
 #define CAP_EVENTS_SUPPORTED	0x03
 
+#define AVRCP_FEATURE_CATEGORY_1	0x0001
+#define AVRCP_FEATURE_CATEGORY_2	0x0002
+#define AVRCP_FEATURE_CATEGORY_3	0x0004
+#define AVRCP_FEATURE_CATEGORY_4	0x0008
+
 enum battery_status {
 	BATTERY_STATUS_NORMAL =		0,
 	BATTERY_STATUS_WARNING =	1,
@@ -174,7 +179,11 @@ static sdp_record_t *avrcp_ct_record(void)
 	sdp_record_t *record;
 	sdp_data_t *psm, *version, *features;
 	uint16_t lp = AVCTP_PSM;
-	uint16_t avrcp_ver = 0x0100, avctp_ver = 0x0103, feat = 0x000f;
+	uint16_t avrcp_ver = 0x0100, avctp_ver = 0x0103;
+	uint16_t feat = ( AVRCP_FEATURE_CATEGORY_1 |
+			AVRCP_FEATURE_CATEGORY_2 |
+			AVRCP_FEATURE_CATEGORY_3 |
+			AVRCP_FEATURE_CATEGORY_4 );
 
 	record = sdp_record_alloc();
 	if (!record)
@@ -238,7 +247,11 @@ static sdp_record_t *avrcp_tg_record(void)
 	sdp_record_t *record;
 	sdp_data_t *psm, *version, *features;
 	uint16_t lp = AVCTP_PSM;
-	uint16_t avrcp_ver = 0x0103, avctp_ver = 0x0103, feat = 0x000f;
+	uint16_t avrcp_ver = 0x0103, avctp_ver = 0x0103;
+	uint16_t feat = ( AVRCP_FEATURE_CATEGORY_1 |
+                        AVRCP_FEATURE_CATEGORY_2 |
+                        AVRCP_FEATURE_CATEGORY_3 |
+                        AVRCP_FEATURE_CATEGORY_4 );
 
 	record = sdp_record_alloc();
 	if (!record)
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] AVRCP: Refactor the code using constants
  2012-05-18  5:25 joohi.rastogi
@ 2012-05-18 17:52 ` Johan Hedberg
  0 siblings, 0 replies; 5+ messages in thread
From: Johan Hedberg @ 2012-05-18 17:52 UTC (permalink / raw)
  To: joohi.rastogi; +Cc: User Name

Hi Joohi,

On Fri, May 18, 2012, joohi.rastogi@stericsson.com wrote:
> ---
>  audio/avrcp.c |   17 +++++++++++++++--
>  1 files changed, 15 insertions(+), 2 deletions(-)

You'll need to rebase this patch latest git since it doesn't apply
anymore. Additionally there were some issues:

> +	uint16_t avrcp_ver = 0x0100, avctp_ver = 0x0103;
> +	uint16_t feat = ( AVRCP_FEATURE_CATEGORY_1 |
> +			AVRCP_FEATURE_CATEGORY_2 |
> +			AVRCP_FEATURE_CATEGORY_3 |
> +			AVRCP_FEATURE_CATEGORY_4 );

This doesn't look like it's correctly indented. Split lines should be
indented as much as possible while staying under 80 characters.

> -	uint16_t avrcp_ver = 0x0103, avctp_ver = 0x0103, feat = 0x000f;
> +	uint16_t avrcp_ver = 0x0103, avctp_ver = 0x0103;
> +	uint16_t feat = ( AVRCP_FEATURE_CATEGORY_1 |
> +                        AVRCP_FEATURE_CATEGORY_2 |
> +                        AVRCP_FEATURE_CATEGORY_3 |
> +                        AVRCP_FEATURE_CATEGORY_4 );

Same here.

Johan

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-05-18 17:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-10  6:26 [PATCH 1/2] AVRCP: Refactor the code using constants joohi.rastogi
2012-05-10 15:40 ` Lucas De Marchi
  -- strict thread matches above, loose matches on Subject: below --
2012-05-18  5:13 joohi.rastogi
2012-05-18  5:25 joohi.rastogi
2012-05-18 17:52 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).