Merge "Removed unused result variable from sound_codec_asm_callback" into tizen
[platform/core/multimedia/libmm-sound.git] / server / mm_sound_mgr_wfd.c
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 #include <stdlib.h>
23 #include <string.h>
24
25 #include <pthread.h>
26 #include <sys/shm.h>
27 #include <sys/msg.h>
28 #include <sys/mman.h>
29 #include <sys/stat.h>
30 #include <fcntl.h>
31 #include <stdbool.h>
32
33 #include <errno.h>
34
35 #include "include/mm_sound_mgr_common.h"
36 #include "../include/mm_sound_common.h"
37
38 #include <mm_error.h>
39 #include <mm_debug.h>
40
41 #include "include/mm_sound_mgr_wfd.h"
42 #include "include/mm_sound_mgr_session.h"
43
44 /******************************* WFD Code **********************************/
45
46 #include "mm_sound.h"
47
48 #include <vconf.h>
49 #include <vconf-keys.h>
50
51
52 /* WFD status value */
53 static void _miracast_wfd_status_changed_cb(keynode_t* node, void* data)
54 {
55         int miracast_wfd_status = 0;
56
57         /* Get actual vconf value */
58         vconf_get_bool(VCONFKEY_MIRACAST_WFD_SOURCE_STATUS, &miracast_wfd_status);
59         debug_msg ("[%s] changed callback called, status=[%d]\n", vconf_keynode_get_name(node), miracast_wfd_status);
60
61         MMSoundMgrSessionSetDeviceAvailable (DEVICE_WFD, miracast_wfd_status, 0, NULL);
62 }
63
64 static int _register_wfd_status(void)
65 {
66         /* set callback for vconf key change */
67         int ret = vconf_notify_key_changed(VCONFKEY_MIRACAST_WFD_SOURCE_STATUS, _miracast_wfd_status_changed_cb, NULL);
68         debug_msg ("vconf [%s] set ret = [%d]\n", VCONFKEY_MIRACAST_WFD_SOURCE_STATUS, ret);
69         return ret;
70 }
71
72 int MMSoundMgrWfdInit(void)
73 {
74         debug_enter("\n");
75
76         if (_register_wfd_status() != 0) {
77                 debug_error ("Registering WFD status failed\n");
78                 return MM_ERROR_SOUND_INTERNAL;
79         }
80
81         debug_leave("\n");
82         return MM_ERROR_NONE;
83 }
84
85 int MMSoundMgrWfdFini(void)
86 {
87         debug_enter("\n");
88
89         debug_leave("\n");
90         return MM_ERROR_NONE;
91 }
92