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 pid, int handle_id, const char* stream_type)
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));
39 param.handle_id = handle_id;
40 MMSOUND_STRNCPY(param.stream_type, stream_type, MAX_STREAM_TYPE_LEN);
42 ret = mm_sound_mgr_focus_create_node(¶m);
47 // method + remove callback
48 int __mm_sound_mgr_focus_ipc_unregister_focus(int pid, int handle_id)
50 _mm_sound_mgr_focus_param_t param;
51 int ret = MM_ERROR_NONE;
53 memset(¶m, 0x00, sizeof(_mm_sound_mgr_focus_param_t));
55 param.handle_id = handle_id;
57 ret = mm_sound_mgr_focus_destroy_node(¶m);
62 int __mm_sound_mgr_focus_ipc_add_watch_node(int pid, int handle_id, int focus_type)
64 _mm_sound_mgr_focus_param_t param;
65 int ret = MM_ERROR_NONE;
67 memset(¶m, 0x00, sizeof(_mm_sound_mgr_focus_param_t));
69 param.handle_id = handle_id;
70 param.request_type = focus_type;
72 ret = mm_sound_mgr_focus_add_watch_node(¶m);
77 int __mm_sound_mgr_focus_ipc_remove_watch_node(int pid, int handle_id)
79 _mm_sound_mgr_focus_param_t param;
80 int ret = MM_ERROR_NONE;
82 memset(¶m, 0x00, sizeof(_mm_sound_mgr_focus_param_t));
84 param.handle_id = handle_id;
86 ret = mm_sound_mgr_focus_remove_watch_node(¶m);
92 int __mm_sound_mgr_focus_ipc_set_focus_reacquisition(int pid, int handle_id, bool reacquisition)
94 _mm_sound_mgr_focus_param_t param;
95 int ret = MM_ERROR_NONE;
97 memset(¶m, 0x00, sizeof(_mm_sound_mgr_focus_param_t));
99 param.handle_id = handle_id;
100 param.reacquisition = reacquisition;
102 ret = mm_sound_mgr_focus_set_reacquisition(¶m);
108 int __mm_sound_mgr_focus_ipc_get_acquired_focus_stream_type(int focus_type, char **stream_type, int *option, char **ext_info)
110 int ret = MM_ERROR_NONE;
111 char *stream_type_str = NULL;
112 char *ext_info_str = NULL;
114 if (!stream_type || !option)
115 return MM_ERROR_INVALID_ARGUMENT;
117 ret = mm_sound_mgr_focus_get_stream_type_of_acquired_focus(focus_type, &stream_type_str, option, &ext_info_str);
118 if (ret == MM_ERROR_NONE) {
119 *stream_type = stream_type_str;
121 *ext_info = ext_info_str;
127 // method -> callback
128 int __mm_sound_mgr_focus_ipc_acquire_focus(int pid, int handle_id, int focus_type, int option, const char *ext_info, bool is_in_thread)
130 _mm_sound_mgr_focus_param_t param;
131 int ret = MM_ERROR_NONE;
133 memset(¶m, 0x00, sizeof(_mm_sound_mgr_focus_param_t));
135 param.handle_id = handle_id;
136 param.request_type = focus_type;
137 param.option = option;
138 param.is_in_thread = is_in_thread;
139 MMSOUND_STRNCPY(param.ext_info, ext_info, MM_SOUND_NAME_NUM);
141 ret = mm_sound_mgr_focus_request_acquire(¶m);
146 // method -> callback
147 int __mm_sound_mgr_focus_ipc_release_focus(int pid, int handle_id, int focus_type, int option, const char *ext_info, bool is_in_thread)
149 _mm_sound_mgr_focus_param_t param;
150 int ret = MM_ERROR_NONE;
152 memset(¶m, 0x00, sizeof(_mm_sound_mgr_focus_param_t));
154 param.handle_id = handle_id;
155 param.request_type = focus_type;
156 param.option = option;
157 param.is_in_thread = is_in_thread;
158 MMSOUND_STRNCPY(param.ext_info, ext_info, MM_SOUND_NAME_NUM);
160 ret = mm_sound_mgr_focus_request_release(¶m);
165 int __mm_sound_mgr_focus_ipc_deliver_focus(int pid, int src_handle_id, int dst_handle_id, int focus_type)
167 _mm_sound_mgr_focus_param_t param;
168 int ret = MM_ERROR_NONE;
170 memset(¶m, 0x00, sizeof(_mm_sound_mgr_focus_param_t));
172 param.handle_id = src_handle_id;
173 param.handle_id_dst = dst_handle_id;
174 param.request_type = focus_type;
176 ret = mm_sound_mgr_focus_deliver(¶m);