4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Seungbae Shin <seungbae.shin@samsung.com>
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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.
25 #include "include/mm_sound_mgr_focus_ipc.h"
26 #include "include/mm_sound_mgr_focus_dbus.h"
28 #include "../include/mm_sound_common.h"
29 #include "include/mm_sound_mgr_focus.h"
32 int __mm_sound_mgr_focus_ipc_register_focus(int client_pid, int handle_id, const char* stream_type, bool is_for_session)
34 _mm_sound_mgr_focus_param_t param;
35 int ret = MM_ERROR_NONE;
37 memset(¶m, 0x00, sizeof(_mm_sound_mgr_focus_param_t));
38 param.pid = client_pid;
39 param.handle_id = handle_id;
40 param.is_for_session = is_for_session;
41 MMSOUND_STRNCPY(param.stream_type, stream_type, MAX_STREAM_TYPE_LEN);
43 ret = mm_sound_mgr_focus_create_node(¶m);
48 // method + remove callback
49 int __mm_sound_mgr_focus_ipc_unregister_focus(int pid, int handle_id, bool is_for_session)
51 _mm_sound_mgr_focus_param_t param;
52 int ret = MM_ERROR_NONE;
54 memset(¶m, 0x00, sizeof(_mm_sound_mgr_focus_param_t));
56 param.handle_id = handle_id;
57 param.is_for_session = is_for_session;
59 ret = mm_sound_mgr_focus_destroy_node(¶m);
65 int __mm_sound_mgr_focus_ipc_set_focus_reacquisition(int pid, int handle_id, bool reacquisition, bool is_for_session)
67 _mm_sound_mgr_focus_param_t param;
68 int ret = MM_ERROR_NONE;
70 memset(¶m, 0x00, sizeof(_mm_sound_mgr_focus_param_t));
72 param.handle_id = handle_id;
73 param.reacquisition = reacquisition;
74 param.is_for_session = is_for_session;
76 ret = mm_sound_mgr_focus_set_reacquisition(¶m);
82 int __mm_sound_mgr_focus_ipc_get_acquired_focus_stream_type(int focus_type, char **stream_type, int *option, char **ext_info)
84 int ret = MM_ERROR_NONE;
85 char *stream_type_str = NULL;
86 char *ext_info_str = NULL;
89 return MM_ERROR_INVALID_ARGUMENT;
91 ret = mm_sound_mgr_focus_get_stream_type_of_acquired_focus(focus_type, &stream_type_str, option, &ext_info_str);
92 if (ret == MM_ERROR_NONE) {
93 *stream_type = stream_type_str;
95 *ext_info = ext_info_str;
101 // method -> callback
102 int __mm_sound_mgr_focus_ipc_acquire_focus(int pid, int handle_id, int focus_type, int option, const char *ext_info, bool is_for_session)
104 _mm_sound_mgr_focus_param_t param;
105 int ret = MM_ERROR_NONE;
107 memset(¶m, 0x00, sizeof(_mm_sound_mgr_focus_param_t));
109 param.handle_id = handle_id;
110 param.request_type = focus_type;
111 param.option = option;
112 param.is_for_session = is_for_session;
113 MMSOUND_STRNCPY(param.ext_info, ext_info, MM_SOUND_NAME_NUM);
115 ret = mm_sound_mgr_focus_request_acquire(¶m);
120 // method -> callback
121 int __mm_sound_mgr_focus_ipc_release_focus(int pid, int handle_id, int focus_type, int option, const char *ext_info, bool is_for_session)
123 _mm_sound_mgr_focus_param_t param;
124 int ret = MM_ERROR_NONE;
126 memset(¶m, 0x00, sizeof(_mm_sound_mgr_focus_param_t));
128 param.handle_id = handle_id;
129 param.request_type = focus_type;
130 param.option = option;
131 param.is_for_session = is_for_session;
132 MMSOUND_STRNCPY(param.ext_info, ext_info, MM_SOUND_NAME_NUM);
134 ret = mm_sound_mgr_focus_request_release(¶m);
139 int __mm_sound_mgr_focus_ipc_watch_focus(int pid, int handle_id, int focus_type, bool is_for_session)
141 _mm_sound_mgr_focus_param_t param;
142 int ret = MM_ERROR_NONE;
144 memset(¶m, 0x00, sizeof(_mm_sound_mgr_focus_param_t));
146 param.handle_id = handle_id;
147 param.request_type = focus_type;
148 param.is_for_session = is_for_session;
150 ret = mm_sound_mgr_focus_set_watch_cb(¶m);
155 // method + remove callback
156 int __mm_sound_mgr_focus_ipc_unwatch_focus(int pid, int handle_id)
158 _mm_sound_mgr_focus_param_t param;
159 int ret = MM_ERROR_NONE;
161 memset(¶m, 0x00, sizeof(_mm_sound_mgr_focus_param_t));
163 param.handle_id = handle_id;
165 ret = mm_sound_mgr_focus_unset_watch_cb(¶m);
170 int __mm_sound_mgr_focus_ipc_emergent_exit(int pid)
172 _mm_sound_mgr_focus_param_t param;
173 int ret = MM_ERROR_NONE;
175 memset(¶m, 0x00, sizeof(_mm_sound_mgr_focus_param_t));
178 ret = mm_sound_mgr_focus_emergent_exit(¶m);