Rollback 'merge with master' commit - Update boilerplate/AUTHORS/LICENSE/NOTICE
[framework/multimedia/audio-session-manager.git] / 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 ASM_unregister_sound_ex(const int asm_handle, ASM_sound_events_t sound_event, int *error_code, int (*func)(void*,void*));
72
73
74 /**
75  * This function gets sound status from ASM server
76  *
77  * @return                                                      This function returns @c true on success; @c false otherwise.
78  * @param[out] all_sound_status                 Current Sound status of All sound events defined in sound conflict manager
79  *                                                                      return value defined in ASM_sound_status_t
80  *                                                                      Each bit is Sound Status Type( 0 : None , 1 : Playing )
81  * @param[out] error_code                               specifies the error code
82  * @exception                                           
83  */
84 bool 
85 ASM_get_sound_status(unsigned int *all_sound_status, int *error_code);
86
87
88 /**
89  * This function gets sound state of sound event from ASM server
90  *
91  * @return                                                      This method returns @c true on success; @c false otherwise.
92  * @param[in] sound_event                               sound event for want to know sound state
93  * @param[out] sound_state                      result of sound state
94  * @param[out] error_code                               specifies the error code
95  * @exception
96  */
97 bool
98 ASM_get_sound_state(const int asm_handle, ASM_sound_events_t sound_event, ASM_sound_states_t *sound_state, int *error_code);
99
100 /**
101  * This function gets sound state of given process from ASM server
102  *
103  * @return                                                      This method returns @c true on success; @c false otherwise.
104  * @param[in] asm_handle                                        asm_handle.
105  * @param[out] sound_state                      result of sound state
106  * @param[out] error_code                               specifies the error code
107  * @exception
108  */
109 bool
110 ASM_get_process_session_state(const int asm_handle, ASM_sound_states_t *sound_state, int *error_code);
111
112 /**
113  * This function set sound state to ASM server.
114  *
115  * @return                                                      This function returns @c true on success; @c false otherwise.
116  * @param[in] sound_event                               sound event of instance to requested setting
117  * @param[in] sound_state                               set sound state ( 0(ASM_SND_STATE_NONE) : None , 1(ASM_SND_STATE_PLAYING) : Playing )
118  * @param[in] mm_resource                               system resources will be used.
119  * @param[out] error_code                               specifies the error code
120  * @exception #ERR_asm_MSG_QUEUE_SND_ERROR   - Is is failed to send to message queue.
121  */
122 bool 
123 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);
124
125 bool 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*));
126
127 /**
128  * This function ask sound policy to ASM server.
129  *
130  * @return                                                      No return value
131  * @param[in] playing_sound                     playing sound event 
132  * @param[in] request_sound                     request sound event
133  * @param[out] sound_policy                     Return sound case between playing sound and request sound
134  */
135 void
136 ASM_ask_sound_policy(ASM_sound_events_t playing_sound, ASM_sound_events_t request_sound, ASM_sound_cases_t *sound_policy) __attribute__((deprecated)) ; 
137
138 bool
139 ASM_change_callback(const int asm_handle, ASM_sound_events_t sound_event, ASM_sound_cb_t callback, void* cb_data, int *error_code);
140
141
142
143 #ifdef __cplusplus
144 }
145 #endif
146
147 #endif