summaryrefslogtreecommitdiff
path: root/include/audio-session-manager.h
blob: a10fa6f4a1578230190d9c4c5f854bad9f386e11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/*
 * audio-session-manager
 *
 * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Contact: Seungbae Shin <seungbae.shin at samsung.com>, Sangchul Lee <sc11.lee at samsung.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

#ifndef	_ASM_LIB_H_
#define	_ASM_LIB_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <audio-session-manager-types.h>
/**
 * @ingroup	AUDIO_SESSION_MANAGER
 * @defgroup	AUDIO_SESSION_MANAGER Audio Session Manager
 * @{
 */

/**
 * This function register session to ASM server.
 *
 * @return							This function returns @c true on success; @c false otherwise.
 * @param[in] application_pid			set (-1) if this library attached to application process.
 * 										or set pid of actual application if this library attached to separated working process
 * 										(e.g. client server style framework)
 * @param[out] asm_handle				handle of asm.
 * @param[in] sound_event				sound event of instance to requested register
 * @param[in] sound_state				set sound state ( 0 : None , 1 : Playing )
 * @param[in] callback					This callback function is called when sound status of other sound event is changed
 * @param[in] cb_data					This is data of callback function
 * @param[in] mm_resource				System resources will be used.
 * @param[out] error_code				specifies the error code
 * @exception 						
 */
bool 
ASM_register_sound(const int application_pid, int *asm_handle, ASM_sound_events_t sound_event,
		ASM_sound_states_t sound_state, ASM_sound_cb_t callback, void* cb_data, ASM_resource_t mm_resource, int *error_code);

bool
ASM_register_sound_ex (const int application_pid, int *asm_handle, ASM_sound_events_t sound_event,
		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*));

/**
 * This function unregister sound event to ASM server. If unregistered, sound event is not playing.
 *
 * @return							This function returns @c true on success; @c false otherwise.
 * @param[in] sound_event				sound event of instance to requested unregister
 * @param[out] error_code				specifies the error code
 * @exception 						
 */
bool 
ASM_unregister_sound(const int asm_handle, ASM_sound_events_t sound_event, int *error_code);

bool ASM_unregister_sound_ex(const int asm_handle, ASM_sound_events_t sound_event, int *error_code, int (*func)(void*,void*));


/**
 * This function gets sound status from ASM server
 *
 * @return							This function returns @c true on success; @c false otherwise.
 * @param[out] all_sound_status			Current Sound status of All sound events defined in sound conflict manager
 * 									return value defined in ASM_sound_status_t
 *									Each bit is Sound Status Type( 0 : None , 1 : Playing )
 * @param[out] error_code				specifies the error code
 * @exception 						
 */
bool 
ASM_get_sound_status(unsigned int *all_sound_status, int *error_code);


/**
 * This function gets sound state of sound event from ASM server
 *
 * @return							This method returns @c true on success; @c false otherwise.
 * @param[in] sound_event				sound event for want to know sound state
 * @param[out] sound_state                      result of sound state
 * @param[out] error_code				specifies the error code
 * @exception
 */
bool
ASM_get_sound_state(const int asm_handle, ASM_sound_events_t sound_event, ASM_sound_states_t *sound_state, int *error_code);

/**
 * This function gets sound state of given process from ASM server
 *
 * @return							This method returns @c true on success; @c false otherwise.
 * @param[in] asm_handle					asm_handle.
 * @param[out] sound_state                      result of sound state
 * @param[out] error_code				specifies the error code
 * @exception
 */
bool
ASM_get_process_session_state(const int asm_handle, ASM_sound_states_t *sound_state, int *error_code);

/**
 * This function set sound state to ASM server.
 *
 * @return							This function returns @c true on success; @c false otherwise.
 * @param[in] sound_event				sound event of instance to requested setting
 * @param[in] sound_state				set sound state ( 0(ASM_SND_STATE_NONE) : None , 1(ASM_SND_STATE_PLAYING) : Playing )
 * @param[in] mm_resource				system resources will be used.
 * @param[out] error_code				specifies the error code
 * @exception #ERR_asm_MSG_QUEUE_SND_ERROR   - Is is failed to send to message queue.
 */
bool 
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);

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*));

/**
 * This function ask sound policy to ASM server.
 *
 * @return							No return value
 * @param[in] playing_sound			playing sound event 
 * @param[in] request_sound			request sound event
 * @param[out] sound_policy			Return sound case between playing sound and request sound
 */
void
ASM_ask_sound_policy(ASM_sound_events_t playing_sound, ASM_sound_events_t request_sound, ASM_sound_cases_t *sound_policy) __attribute__((deprecated)) ; 

bool
ASM_change_callback(const int asm_handle, ASM_sound_events_t sound_event, ASM_sound_cb_t callback, void* cb_data, int *error_code);



#ifdef __cplusplus
}
#endif

#endif