Remove useless macros in configure.ac regarding libmm-log
[platform/core/multimedia/libmm-session.git] / mm_session.h
1 /*
2  * libmm-session
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
23 /**
24  * This file declares common data structure of multimedia framework.
25  *
26  * @file                mm_session.h
27  * @author
28  * @version             1.0
29  * @brief               This file declares multimedia framework session type.
30  */
31 #ifndef _MM_SESSION_H_
32 #define _MM_SESSION_H_
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 /**
38         @addtogroup MMSESSION
39         @{
40         @par
41         This part is describes multimedia framework session type and function
42  */
43
44 /**
45   * This enumeration defines application's session types.
46   */
47 enum MMSessionType {
48         MM_SESSION_TYPE_MEDIA = 0,
49         MM_SESSION_TYPE_MEDIA_RECORD,
50         MM_SESSION_TYPE_ALARM,
51         MM_SESSION_TYPE_NOTIFY,
52         MM_SESSION_TYPE_EMERGENCY,
53         MM_SESSION_TYPE_CALL,
54         MM_SESSION_TYPE_VIDEOCALL,
55         MM_SESSION_TYPE_VOIP,
56         MM_SESSION_TYPE_VOICE_RECOGNITION,
57         MM_SESSION_TYPE_RECORD_AUDIO,
58         MM_SESSION_TYPE_RECORD_VIDEO,
59         MM_SESSION_TYPE_NUM
60 };
61
62 /**
63   * This enumeration defines behavior of update.
64   */
65 typedef enum {
66         MM_SESSION_UPDATE_TYPE_ADD,
67         MM_SESSION_UPDATE_TYPE_REMOVE,
68         MM_SESSION_UPDATE_TYPE_NUM
69 } session_update_type_t;
70
71 /**
72   * This define is for session options
73   */
74 #define MM_SESSION_OPTION_PAUSE_OTHERS                      0x0001
75 #define MM_SESSION_OPTION_UNINTERRUPTIBLE                   0x0002
76 #define MM_SESSION_OPTION_RESUME_BY_SYSTEM_OR_MEDIA_PAUSED  0x0010
77
78 /**
79  * This function defines application's Multimedia Session policy
80  *
81  * @param       sessiontype     [in] Multimedia Session type
82  *
83  * @return      This function returns MM_ERROR_NONE on success, or negative value
84  *                      with error code.
85  * @remark      Session type is unique for each application (each PID actually).
86  *                      if application want to change session type, Finish session first and Init again
87  * @see         MMSessionType mm_session_finish
88  * @since
89  * @pre         There should be pre-initialized session type for caller application.
90  * @post        A session type of caller application will be defined process widely.
91  * @par Example
92  * @code
93 #include <mm_session.h>
94
95 static int _create(void *data)
96 {
97         int ret = 0;
98
99         // Initialize Multimedia Session Type
100         ret = mm_session_init(MM_SESSION_TYPE_MEDIA);
101         if(ret < 0)
102         {
103                 printf("Can not initialize session \n");
104         }
105         ...
106 }
107
108 static int _terminate(void* data)
109 {
110         int ret = 0;
111
112         // Deinitialize Multimedia Session Type
113         ret = mm_session_finish();
114         if(ret < 0)
115         {
116                 printf("Can not finish session\n");
117         }
118         ...
119 }
120
121 int main()
122 {
123         ...
124         struct appcore_ops ops = {
125                 .create = _create,
126                 .terminate = _terminate,
127                 .pause = _pause,
128                 .resume = _resume,
129                 .reset = _reset,
130         };
131         ...
132         return appcore_efl_main(PACKAGE, ..., &ops);
133 }
134
135  * @endcode
136  */
137 int mm_session_init(int sessiontype);
138
139 /**
140  * This function finish application's Multimedia Session.
141  *
142  *
143  * @return      This function returns MM_ERROR_NONE on success, or negative value
144  *                      with error code.
145  * @remark      Session type is unique for each application (each PID actually).
146  *                      if application want to change session type, Finish session first and Init again
147  * @see         mm_session_init
148  * @pre         A session type should be initialized for caller application.
149  * @post        A session type for caller application will be cleared.
150  * @since
151  * @par Example
152  * @code
153 #include <mm_session.h>
154
155 static int _create(void *data)
156 {
157         int ret = 0;
158
159         // Initialize Multimedia Session Type
160         ret = mm_session_init(MM_SESSION_TYPE_MEDIA);
161         if(ret < 0)
162         {
163                 printf("Can not initialize session \n");
164         }
165         ...
166 }
167
168 static int _terminate(void* data)
169 {
170         int ret = 0;
171
172         // Deinitialize Multimedia Session Type
173         ret = mm_session_finish();
174         if(ret < 0)
175         {
176                 printf("Can not finish session\n");
177         }
178         ...
179 }
180
181 int main()
182 {
183         ...
184         struct appcore_ops ops = {
185                 .create = _create,
186                 .terminate = _terminate,
187                 .pause = _pause,
188                 .resume = _resume,
189                 .reset = _reset,
190         };
191         ...
192         return appcore_efl_main(PACKAGE, ..., &ops);
193 }
194  * @endcode
195  */
196 int mm_session_finish(void);
197
198 /**
199  * This function get current application's Multimedia Session type
200  *
201  * @param       sessiontype     [out] Current Multimedia Session type
202  * @return      This function returns MM_ERROR_NONE on success, or negative value
203  *                      with error code.
204  * @see         mm_session_init
205  * @since
206  */
207 int mm_session_get_current_type(int *sessiontype);
208
209 /**
210  * This function get current application's Multimedia Session information
211  *
212  * @param       session_type    [out] Current Multimedia Session type
213  * @param       session_options [out] Current Multimedia Session options
214  * @return      This function returns MM_ERROR_NONE on success, or negative value
215  *                      with error code.
216  * @see
217  * @since
218  */
219 int mm_session_get_current_information(int *session_type, int *session_options);
220
221 /**
222  * This function update application's Multimedia Session options
223  *
224  * @param       update_type     [in] add or remove options
225  * @param       session_options [in] Multimedia Session options to be updated
226  * @return      This function returns MM_ERROR_NONE on success, or negative value
227  *                      with error code.
228  * @see
229  * @since
230  */
231 int mm_session_update_option(session_update_type_t update_type, int options);
232
233 /**
234         @}
235  */
236
237 #ifdef __cplusplus
238 }
239 #endif
240
241 #endif