Git init
[framework/multimedia/libmm-sound.git] / include / mm_ipc.h
1 /*
2  * libmm-sound
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact: Seungbae Shin <seungbae.shin@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 __MM_SOUND_IPC_H__
23 #define __MM_SOUND_IPC_H__
24
25 #include <stdio.h>
26 #include <unistd.h>
27
28 #define FILE_PATH 512
29
30 typedef enum {
31     MM_IPC_SUCCESS,
32     MM_IPC_WARNING,
33     MM_IPC_ERROR,
34     MM_IPC_PROCESS,
35 } mm_ipc_async_state;
36
37 typedef struct
38 {
39         /* Recieve data */
40         int msgid;
41         int msgtype;
42         int code;
43         
44         /* Send data */
45         int keytone;
46         int repeat;
47         int dtmf;
48         double volume;
49         int memptr;
50         int memsize;
51         int sharedkey;
52         char filename[FILE_PATH];
53
54         /* Common data */
55         int handle;
56         void *callback;
57         void *cbdata;
58         int samplerate;
59         int channels;
60         int volume_table;
61         int session_type;
62         int priority;
63         int handle_route;
64 } mmsound_ipc_t;
65
66 typedef struct
67 {
68         long msg_type;
69         mmsound_ipc_t sound_msg;
70 } mm_ipc_msg_t;
71
72 typedef void (*mm_ipc_callback_t)(int code, int size);
73
74 int MMSoundGetTime(char *position);
75 int MMIpcCreate(const int key);
76 int MMIpcDestroy(const int key);
77 int MMIpcSendMsg(const int key, mm_ipc_msg_t *msg);
78 int MMIpcRecvMsg(const int key, mm_ipc_msg_t *msg);
79
80 int MMIpcSendMsgAsync(const char *ipcname, mm_ipc_msg_t *msg, mm_ipc_callback_t callback);
81 int MMIpcRecvMsgAsync(const char *ipcname, mm_ipc_msg_t **msg, mm_ipc_callback_t callback);
82 int MMIpcRecvData(const char *ipcname, void *data, int *size);
83 int MMIpcSendDataAsync(const char *ipcname, void *data, int size, mm_ipc_callback_t callback);
84 int __mm_sound_lock(void);
85 int __mm_sound_unlock(void);
86
87 #endif  /* __MM_SOUND_IPC_H__ */
88