Merge "Apply actd for edutm mode" into tizen
[platform/core/connectivity/bluetooth-frwk.git] / bt-oal / include / oal-avrcp-tg.h
1 /*
2  * Open Adaptation Layer (OAL)
3  *
4  * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *              http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef _OAL_AVRCP_HOST_H_
21 #define _OAL_AVRCP_HOST_H_
22
23 #include <glib.h>
24 #include <sys/types.h>
25 #include <oal-manager.h>
26 #include "oal-event.h"
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 #define OAL_MAX_ATTR_STR_LEN 255
33
34 /* Maximum service name length */
35 #define BT_AVRCP_NAME_LENGTH_MAX    35
36
37 /**
38  * @brief AVRCP CMD send to remote BT device
39  *
40  * @see  avrcp_send_cmd
41  */
42 typedef enum {
43         AVRCP_DEVICE_OFF,
44         AVRCP_VOLUME_UP,
45         AVRCP_VOLUME_DOWN,
46         AVRCP_MUTE
47 } avrcp_cmd;
48
49 /**
50  * @brief Media's different properties type set to remote BT device
51  *
52  * @see  avrcp_set_property
53  */
54 typedef enum {
55         AVRCP_EQUALIZER = 0x01,
56         AVRCP_REPEAT,
57         AVRCP_SHUFFLE,
58         AVRCP_SCAN,
59         AVRCP_STATUS,
60         AVRCP_POSITION
61 } oal_media_prop_type;
62
63 /**
64  * @brief Player repeat status
65  *
66  * @see  avrcp_set_property
67  */
68 typedef enum {
69         OAL_PLAYER_VAL_OFF_REPEAT = 0x01,
70         OAL_PLAYER_VAL_SINGLE_REPEAT = 0x02,
71         OAL_PLAYER_VAL_ALL_REPEAT = 0x03,
72         OAL_PLAYER_VAL_GROUP_REPEAT = 0x04
73 } oal_player_repeat_status;
74
75 /**
76  * @brief Player shuffel mode
77  *
78  * @see  avrcp_set_property
79  */
80 typedef enum {
81         OAL_PLAYER_VAL_OFF_SHUFFLE = 0x01,
82         OAL_PLAYER_VAL_ALL_SHUFFLE = 0x02,
83         OAL_PLAYER_VAL_GROUP_SHUFFLE = 0x03
84 } oal_player_shuffle_status;
85
86 /**
87  * @brief Player play state
88  *
89  * @see  avrcp_set_property
90  */
91 typedef enum {
92         OAL_PLAYSTATE_STOPPED = 0x00,    /* Stopped */
93         OAL_PLAYSTATE_PLAYING = 0x01,    /* Playing */
94         OAL_PLAYSTATE_PAUSED = 0x02,    /* Paused  */
95         OAL_PLAYSTATE_FWD_SEEK = 0x03,    /* Fwd Seek*/
96         OAL_PLAYSTATE_REV_SEEK = 0x04,    /* Rev Seek*/
97         OAL_PLAYSTATE_ERROR = 0xFF,    /* Error   */
98 } oal_play_status;
99
100 /**
101  * @brief Media Track's attibutes set to remote BT device
102  *
103  * @see  avrcp_set_track_info
104  */
105 typedef struct {
106         char title[OAL_MAX_ATTR_STR_LEN];
107         char artist[OAL_MAX_ATTR_STR_LEN];
108         char album[OAL_MAX_ATTR_STR_LEN];
109         char genre[OAL_MAX_ATTR_STR_LEN];
110         unsigned int total_tracks;
111         unsigned int number;
112         unsigned int duration;
113 } oal_media_metadata_attributes_t;
114
115 /**
116  * @brief AVRCP Volume and mute
117  *
118  * @see  OAL_EVENT_AVRCP_VOLUME_MUTE_CHANGED
119  */
120 typedef struct {
121         gboolean mute_status ;
122         unsigned int volume;
123 } oal_avrcp_volume_mute_t;
124
125 /**
126  * @brief AVRCP stream Delay
127  *
128  * @see  OAL_EVENT_AVRCP_DELAY_CHANGED
129  */
130 typedef struct {
131         unsigned int delay;
132 } oal_avrcp_delay_t;
133
134 typedef struct {
135         int avrcp_feature;
136         bt_address_t address;
137         char avrcp_serv_name[BT_AVRCP_NAME_LENGTH_MAX+1];
138         char avrcp_prov_name[BT_AVRCP_NAME_LENGTH_MAX+1];
139 } remote_feature;
140
141 /**
142  * @brief Enable AVRCP Feature
143  *
144  * @remarks  AVRCP Feature (like play/pause, media information etc)  will be enabled.
145  * @remarks  Used in conjunction with a2dp_enable
146  *
147  * @return OAL_STATUS_SUCCESS on success, otherwise non-zero error value.
148  * @retval #OAL_STATUS_SUCCESS  Successful
149  *
150  * @pre OAL API must be initialized with oal_bt_init().
151  *
152  * @see  avrcp_disable()
153  * @see  a2dp_enable()
154  */
155 oal_status_t avrcp_enable(void);
156
157 /**
158  * @brief Disable AVRCP Feature
159  *
160  * @remarks  AVRCP Feature (like play/pause, media information etc) will be disabled.
161  * @remarks  Used in conjunction with a2dp_disable.
162  *
163  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
164  * @retval #OAL_STATUS_SUCCESS  Successful
165  *
166  * @pre AVRCP should be enabled with avrcp_enable().
167  *
168  * @see  avrcp_enable()
169  * @see  a2dp_disable()
170  */
171 oal_status_t avrcp_disable(void);
172
173 /**
174  * @brief Initiate a connection with AVRCP controller device
175  *
176  * @details  Result will be notified through an OAL event
177  *
178  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
179  * @retval #OAL_STATUS_SUCCESS  Successful
180  *
181  * @pre BT Audio should be enabled with avrcp_tg_enable().
182  *
183  * @see  OAL_EVENT_AVRCP_CONNECTED
184  */
185 oal_status_t avrcp_tg_connect(bt_address_t *rem_addr);
186
187
188 /**
189  * @brief Remove a connection with AVRCP controller device
190  *
191  * @details  Result will be notified through an OAL event
192  *
193  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
194  * @retval #OAL_STATUS_SUCCESS  Successful
195  *
196  * @pre BT Audio should be connected with a BT Sound device.
197  *
198  * @see  OAL_EVENT_AVRCP_DISCONNECTED
199  */
200 oal_status_t avrcp_tg_disconnect(bt_address_t *rem_addr);
201
202 /**
203  * @brief Set the AVRCP property to BT audio remote device
204  *
205  * @details  Used to set the different type of AVRCP property.
206  *
207  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
208  * @retval #OAL_STATUS_SUCCESS  Successful
209  *
210  * @pre AVRCP should be enabled with avrcp_enable().
211  *
212  * @see  avrcp_enable()
213  */
214 oal_status_t avrcp_set_property(int type, unsigned int value);
215
216 /**
217  * @brief Set the media track info to BT audio remote device
218  *
219  * @details  Used to set the different parameters(title, album, genre etc) of media track.
220  *
221  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
222  * @retval #OAL_STATUS_SUCCESS  Successful
223  *
224  * @pre AVRCP should be enabled with avrcp_enable().
225  *
226  * @see  avrcp_enable()
227  */
228 oal_status_t avrcp_set_track_info(oal_media_metadata_attributes_t *meta_data);
229
230 #ifdef __cplusplus
231 }
232 #endif /* __cplusplus */
233 #endif /*_OAL_AVRCP_HOST_H_*/