Upgrade bluez5_37 :Merge the code from private
[platform/upstream/bluez.git] / profiles / audio / avrcp.h
1 /*
2  *
3  *  BlueZ - Bluetooth protocol stack for Linux
4  *
5  *  Copyright (C) 2006-2010  Nokia Corporation
6  *  Copyright (C) 2004-2010  Marcel Holtmann <marcel@holtmann.org>
7  *
8  *
9  *  This program is free software; you can redistribute it and/or modify
10  *  it under the terms of the GNU General Public License as published by
11  *  the Free Software Foundation; either version 2 of the License, or
12  *  (at your option) any later version.
13  *
14  *  This program is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *  GNU General Public License for more details.
18  *
19  *  You should have received a copy of the GNU General Public License
20  *  along with this program; if not, write to the Free Software
21  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
22  *
23  */
24
25 /* player attributes */
26 #define AVRCP_ATTRIBUTE_ILEGAL          0x00
27 #define AVRCP_ATTRIBUTE_EQUALIZER       0x01
28 #define AVRCP_ATTRIBUTE_REPEAT_MODE     0x02
29 #define AVRCP_ATTRIBUTE_SHUFFLE         0x03
30 #define AVRCP_ATTRIBUTE_SCAN            0x04
31 #define AVRCP_ATTRIBUTE_LAST            AVRCP_ATTRIBUTE_SCAN
32
33 /* equalizer values */
34 #define AVRCP_EQUALIZER_OFF             0x01
35 #define AVRCP_EQUALIZER_ON              0x02
36
37 /* repeat mode values */
38 #define AVRCP_REPEAT_MODE_OFF           0x01
39 #define AVRCP_REPEAT_MODE_SINGLE        0x02
40 #define AVRCP_REPEAT_MODE_ALL           0x03
41 #define AVRCP_REPEAT_MODE_GROUP         0x04
42
43 /* shuffle values */
44 #define AVRCP_SHUFFLE_OFF               0x01
45 #define AVRCP_SHUFFLE_ALL               0x02
46 #define AVRCP_SHUFFLE_GROUP             0x03
47
48 /* scan values */
49 #define AVRCP_SCAN_OFF                  0x01
50 #define AVRCP_SCAN_ALL                  0x02
51 #define AVRCP_SCAN_GROUP                0x03
52
53 /* media attributes */
54 #define AVRCP_MEDIA_ATTRIBUTE_ILLEGAL   0x00
55 #define AVRCP_MEDIA_ATTRIBUTE_TITLE     0x01
56 #define AVRCP_MEDIA_ATTRIBUTE_ARTIST    0x02
57 #define AVRCP_MEDIA_ATTRIBUTE_ALBUM     0x03
58 #define AVRCP_MEDIA_ATTRIBUTE_TRACK     0x04
59 #define AVRCP_MEDIA_ATTRIBUTE_N_TRACKS  0x05
60 #define AVRCP_MEDIA_ATTRIBUTE_GENRE     0x06
61 #define AVRCP_MEDIA_ATTRIBUTE_DURATION  0x07
62 #define AVRCP_MEDIA_ATTRIBUTE_LAST      AVRCP_MEDIA_ATTRIBUTE_DURATION
63
64 /* play status */
65 #define AVRCP_PLAY_STATUS_STOPPED       0x00
66 #define AVRCP_PLAY_STATUS_PLAYING       0x01
67 #define AVRCP_PLAY_STATUS_PAUSED        0x02
68 #define AVRCP_PLAY_STATUS_FWD_SEEK      0x03
69 #define AVRCP_PLAY_STATUS_REV_SEEK      0x04
70 #define AVRCP_PLAY_STATUS_ERROR         0xFF
71
72 /* Notification events */
73 #define AVRCP_EVENT_STATUS_CHANGED              0x01
74 #define AVRCP_EVENT_TRACK_CHANGED               0x02
75 #define AVRCP_EVENT_TRACK_REACHED_END           0x03
76 #define AVRCP_EVENT_TRACK_REACHED_START         0x04
77 #define AVRCP_EVENT_PLAYBACK_POS_CHANGED        0x05
78 #define AVRCP_EVENT_SETTINGS_CHANGED            0x08
79 #define AVRCP_EVENT_AVAILABLE_PLAYERS_CHANGED   0x0a
80 #define AVRCP_EVENT_ADDRESSED_PLAYER_CHANGED    0x0b
81 #define AVRCP_EVENT_UIDS_CHANGED                0x0c
82 #define AVRCP_EVENT_VOLUME_CHANGED              0x0d
83 #define AVRCP_EVENT_LAST                        AVRCP_EVENT_VOLUME_CHANGED
84
85 struct avrcp_player_cb {
86         GList *(*list_settings) (void *user_data);
87         const char *(*get_setting) (const char *key, void *user_data);
88         int (*set_setting) (const char *key, const char *value,
89                                                         void *user_data);
90         uint64_t (*get_uid) (void *user_data);
91         const char *(*get_metadata) (const char *key, void *user_data);
92         GList *(*list_metadata) (void *user_data);
93         const char *(*get_status) (void *user_data);
94         uint32_t (*get_position) (void *user_data);
95         uint32_t (*get_duration) (void *user_data);
96         const char *(*get_name) (void *user_data);
97         void (*set_volume) (uint8_t volume, struct btd_device *dev,
98                                                         void *user_data);
99         bool (*play) (void *user_data);
100         bool (*stop) (void *user_data);
101         bool (*pause) (void *user_data);
102         bool (*next) (void *user_data);
103         bool (*previous) (void *user_data);
104 };
105
106 int avrcp_set_volume(struct btd_device *dev, uint8_t volume, bool notify);
107
108 struct avrcp_player *avrcp_register_player(struct btd_adapter *adapter,
109                                                 struct avrcp_player_cb *cb,
110                                                 void *user_data,
111                                                 GDestroyNotify destroy);
112 void avrcp_unregister_player(struct avrcp_player *player);
113
114 void avrcp_player_event(struct avrcp_player *player, uint8_t id,
115                                                         const void *data);
116
117
118 size_t avrcp_handle_vendor_reject(uint8_t *code, uint8_t *operands);
119 size_t avrcp_browsing_general_reject(uint8_t *operands);