Initialize Tizen 2.3
[framework/multimedia/audio-session-manager.git] / wearable / include / audio-session-manager.h
1 /*
2  * audio-session-manager
3  *
4  * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Seungbae Shin <seungbae.shin at samsung.com>, Sangchul Lee <sc11.lee at samsung.com>
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  */
21
22 #ifndef _ASM_LIB_H_
23 #define _ASM_LIB_H_
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 #include <audio-session-manager-types.h>
30 /**
31  * @ingroup     AUDIO_SESSION_MANAGER
32  * @defgroup    AUDIO_SESSION_MANAGER Audio Session Manager
33  * @{
34  */
35
36 /**
37  * This function register session to ASM server.
38  *
39  * @return                                                      This function returns @c true on success; @c false otherwise.
40  * @param[in] application_pid                   set (-1) if this library attached to application process.
41  *                                                                              or set pid of actual application if this library attached to separated working process
42  *                                                                              (e.g. client server style framework)
43  * @param[out] asm_handle                               handle of asm.
44  * @param[in] sound_event                               sound event of instance to requested register
45  * @param[in] sound_state                               set sound state ( 0 : None , 1 : Playing )
46  * @param[in] callback                                  This callback function is called when sound status of other sound event is changed
47  * @param[in] cb_data                                   This is data of callback function
48  * @param[in] mm_resource                               System resources will be used.
49  * @param[out] error_code                               specifies the error code
50  * @exception                                           
51  */
52 bool 
53 ASM_register_sound(const int application_pid, int *asm_handle, ASM_sound_events_t sound_event,
54                 ASM_sound_states_t sound_state, ASM_sound_cb_t callback, void* cb_data, ASM_resource_t mm_resource, int *error_code);
55
56 bool
57 ASM_register_sound_ex (const int application_pid, int *asm_handle, ASM_sound_events_t sound_event,
58                 ASM_sound_states_t sound_state, ASM_sound_cb_t callback, void* cb_data, ASM_resource_t mm_resource, int *error_code, int (*func)(void*,void*));
59
60 /**
61  * This function unregister sound event to ASM server. If unregistered, sound event is not playing.
62  *
63  * @return                                                      This function returns @c true on success; @c false otherwise.
64  * @param[in] sound_event                               sound event of instance to requested unregister
65  * @param[out] error_code                               specifies the error code
66  * @exception                                           
67  */
68 bool 
69 ASM_unregister_sound(const int asm_handle, ASM_sound_events_t sound_event, int *error_code);
70
71 bool
72 ASM_unregister_sound_ex(const int asm_handle, ASM_sound_events_t sound_event, int *error_code, int (*func)(void*,void*));
73
74
75 /**
76  * This function gets sound status from ASM server
77  *
78  * @return                                                      This function returns @c true on success; @c false otherwise.
79  * @param[out] all_sound_status                 Current Sound status of All sound events defined in sound conflict manager
80  *                                                                      return value defined in ASM_sound_status_t
81  *                                                                      Each bit is Sound Status Type( 0 : None , 1 : Playing )
82  * @param[out] error_code                               specifies the error code
83  * @exception                                           
84  */
85 bool 
86 ASM_get_sound_status(unsigned int *all_sound_status, int *error_code);
87
88
89 /**
90  * This function gets sound state of sound event from ASM server
91  *
92  * @return                                                      This method returns @c true on success; @c false otherwise.
93  * @param[in] sound_event                               sound event for want to know sound state
94  * @param[out] sound_state                      result of sound state
95  * @param[out] error_code                               specifies the error code
96  * @exception
97  */
98 bool
99 ASM_get_sound_state(const int asm_handle, ASM_sound_events_t sound_event, ASM_sound_states_t *sound_state, int *error_code);
100
101 /**
102  * This function gets sound state of given process from ASM server
103  *
104  * @return                                                      This method returns @c true on success; @c false otherwise.
105  * @param[in] asm_handle                                        asm_handle.
106  * @param[out] sound_state                      result of sound state
107  * @param[out] error_code                               specifies the error code
108  * @exception
109  */
110 bool
111 ASM_get_process_session_state(const int asm_handle, ASM_sound_states_t *sound_state, int *error_code);
112
113 bool
114 ASM_attach_callback(ASM_sound_events_t sound_event, ASM_sound_cb_t callback, void *user_data, int *error_code);
115
116 /**
117  * This function set sound state to ASM server.
118  *
119  * @return                                                      This function returns @c true on success; @c false otherwise.
120  * @param[in] sound_event                               sound event of instance to requested setting
121  * @param[in] sound_state                               set sound state ( 0(ASM_SND_STATE_NONE) : None , 1(ASM_SND_STATE_PLAYING) : Playing )
122  * @param[in] mm_resource                               system resources will be used.
123  * @param[out] error_code                               specifies the error code
124  * @exception #ERR_asm_MSG_QUEUE_SND_ERROR   - Is is failed to send to message queue.
125  */
126 bool 
127 ASM_set_sound_state(const int asm_handle, ASM_sound_events_t sound_event, ASM_sound_states_t sound_state, ASM_resource_t mm_resource, int *error_code);
128
129 bool
130 ASM_set_sound_state_ex (const int asm_handle, ASM_sound_events_t sound_event, ASM_sound_states_t sound_state, ASM_resource_t mm_resource, int *error_code, int (*func)(void*,void*));
131
132 bool
133 ASM_change_callback(const int asm_handle, ASM_sound_events_t sound_event, ASM_sound_cb_t callback, void* cb_data, int *error_code);
134
135 bool
136 ASM_set_watch_session (const int application_pid, ASM_sound_events_t interest_sound_event, ASM_sound_states_t interest_sound_state, ASM_watch_cb_t callback, void *user_data, int *error_code);
137
138 bool
139 ASM_unset_watch_session (ASM_sound_events_t interest_sound_event, ASM_sound_states_t interest_sound_state, int *error_code);
140
141 bool
142 ASM_reset_resumption_info(const int asm_handle, int *error_code);
143
144 bool
145 ASM_set_subevent (const int asm_handle, ASM_sound_sub_events_t subevent, int *error_code);
146
147 bool
148 ASM_get_subevent (const int asm_handle, ASM_sound_sub_events_t *subevent, int *error_code);
149
150 bool
151 ASM_set_subsession (const int asm_handle, ASM_sound_sub_sessions_t subsession, int resource, int *error_code);
152
153 bool
154 ASM_get_subsession (const int asm_handle, ASM_sound_sub_sessions_t *subsession, int *error_code);
155
156
157
158
159 #ifdef __cplusplus
160 }
161 #endif
162
163 #endif