2012-05-21 11:48:09

by Joohi RASTOGI

[permalink] [raw]
Subject: [PATCH BlueZ 1/2 v2] AVRCP: Refactor the code using constants

From: Joohi Rastogi <[email protected]>

---
audio/avrcp.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
mode change 100644 => 100755 audio/avrcp.c

diff --git a/audio/avrcp.c b/audio/avrcp.c
old mode 100644
new mode 100755
index d278d4e..356fd76
--- a/audio/avrcp.c
+++ b/audio/avrcp.c
@@ -94,6 +94,11 @@

#define AVRCP_REGISTER_NOTIFICATION_PARAM_LENGTH 5

+#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,
@@ -179,7 +184,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)
@@ -243,7 +252,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 = 0x0104, avctp_ver = 0x0103, feat = 0x000f;
+ uint16_t avrcp_ver = 0x0104, 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



2012-05-21 14:55:07

by Lucas De Marchi

[permalink] [raw]
Subject: Re: [PATCH BlueZ 1/2 v2] AVRCP: Refactor the code using constants

On Mon, May 21, 2012 at 8:48 AM, <[email protected]> wrote:
> From: Joohi Rastogi <[email protected]>
>
> ---
> ?audio/avrcp.c | ? 17 +++++++++++++++--
> ?1 files changed, 15 insertions(+), 2 deletions(-)
> ?mode change 100644 => 100755 audio/avrcp.c
>
> diff --git a/audio/avrcp.c b/audio/avrcp.c
> old mode 100644
> new mode 100755
> index d278d4e..356fd76
> --- a/audio/avrcp.c
> +++ b/audio/avrcp.c
> @@ -94,6 +94,11 @@
>
> ?#define AVRCP_REGISTER_NOTIFICATION_PARAM_LENGTH 5
>
> +#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,
> @@ -179,7 +184,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)
> @@ -243,7 +252,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 = 0x0104, avctp_ver = 0x0103, feat = 0x000f;
> + ? ? ? uint16_t avrcp_ver = 0x0104, avctp_ver = 0x0103;
> + ? ? ? uint16_t feat = ( AVRCP_FEATURE_CATEGORY_1 |
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? AVRCP_FEATURE_CATEGORY_2 |
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? AVRCP_FEATURE_CATEGORY_3 |
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? AVRCP_FEATURE_CATEGORY_4 );


Ack


Lucas De Marchi