4 * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Sangchul Lee <sc11.lee@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.
22 #ifndef __MM_SOUND_FOCUS_SOCKET_H__
23 #define __MM_SOUND_FOCUS_SOCKET_H__
29 #include "include/mm_sound_common.h"
30 #include "include/mm_sound_focus.h"
32 #define FOCUS_SERVER_SOCK "/run/focus_server.socket"
33 #define MAX_ERROR_LEN 64
36 char func_name[MM_SOUND_NAME_NUM];
37 char stream_type[MM_SOUND_NAME_NUM];
41 mm_sound_focus_type_e focus_type;
43 char ext_info[MM_SOUND_NAME_NUM];
45 bool is_in_thread; /* Called within focus callback thread */
46 } _mm_sound_focus_socket_param_t;
52 char stream_type[MM_SOUND_NAME_NUM];
53 char ext_info[MM_SOUND_NAME_NUM];
54 } _mm_sound_focus_socket_result_t;
57 #define FOCUS_FUNC_NAME_REGISTER "RegisterFocus"
58 #define FOCUS_FUNC_NAME_UNREGISTER "UnregisterFocus"
59 #define FOCUS_FUNC_NAME_ADD_WATCH "AddWatchFocus"
60 #define FOCUS_FUNC_NAME_REMOVE_WATCH "RemoveWatchFocus"
61 #define FOCUS_FUNC_NAME_ACQUIRE "AcquireFocus"
62 #define FOCUS_FUNC_NAME_RELEASE "ReleaseFocus"
63 #define FOCUS_FUNC_NAME_SET_REACQUISITION "SetFocusReacquisition"
64 #define FOCUS_FUNC_NAME_DELIVER "DeliverFocus"
65 #define FOCUS_FUNC_NAME_GET_ACQUIRED_INFO "GetAcquiredFocusInfo"
68 #define FOCUS_ERROR_NONE "error_none"
69 #define FOCUS_ERROR_INVALID_PARAMETER "error_invalid_parameter"
70 #define FOCUS_ERROR_POLICY "error_policy"
71 #define FOCUS_ERROR_INTERNAL "error_internal"
72 #define FOCUS_ERROR_INVALID_STATE "error_invalid_state"
74 int mm_sound_focus_socket_register(int pid, const char *stream_type, int *client_fd, int *server_fd);
75 int mm_sound_focus_socket_unregister(int pid, int client_fd, int server_fd);
76 int mm_sound_focus_socket_add_watch_cb(int pid, mm_sound_focus_type_e focus_type, int *client_fd, int *server_fd);
77 int mm_sound_focus_socket_remove_watch_cb(int pid, int client_fd, int server_fd);
78 int mm_sound_focus_socket_acquire(int pid, int client_fd, int server_fd, mm_sound_focus_type_e focus_type, int option, const char *ext_info, bool is_in_thread);
79 int mm_sound_focus_socket_release(int pid, int client_fd, int server_fd, mm_sound_focus_type_e focus_type, int option, const char *ext_info, bool is_in_thread);
80 int mm_sound_focus_socket_set_reacquisition(int pid, int client_fd, int server_fd, bool reacquisition);
81 int mm_sound_focus_socket_deliver(int pid, int src_client_fd, int src_server_fd, int dst_client_fd, int dst_server_fd, mm_sound_focus_type_e focus_type);
82 int mm_sound_focus_socket_get_acquired_focus_stream_type(mm_sound_focus_type_e focus_type, char **stream_type, int *option, char **ext_info);
88 #endif /* __MM_SOUND_FOCUS_SOCKET_H__ */