2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.1 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include "ring_fwk_vconf.h"
19 #include "ring_fwk_util.h"
20 #include "ring_fwk_sound.h"
22 /**********************************************************************
23 ******************define, struct ,typedef, union, enum, global val *************************************
24 ***********************************************************************/
27 typedef struct _noti_callback {
29 void (*noti_func) (keynode_t *, void *);
31 /**********************************************************************
32 ******************Local function declear, extern function declear*************************************
33 ***********************************************************************/
34 static void alarm_vconfkey_call_state_cb(keynode_t *key, void *data);
36 /**********************************************************************
37 ******************Global val , static global val*************************************
38 ***********************************************************************/
39 #define ALARM_NOTI_MAX 1
40 static noti_callback s_notis[ALARM_NOTI_MAX] = {
41 {VCONFKEY_CALL_STATE, alarm_vconfkey_call_state_cb},
44 /**********************************************************************
45 ******************Local function ref*************************************
46 ***********************************************************************/
50 * This function is used to handle vconf key: VCONFKEY_ALARM_UPDATE
51 * @param data[in] pointer to data
55 static void alarm_vconfkey_call_state_cb(keynode_t *key, void *data)
57 retm_if(!data, "data is NULL");
58 int call_state = vconf_keynode_get_int(key);
59 struct appdata *ad = (struct appdata *)data;
60 retm_if(!ad->data_s, "ad->data_s is NULL");
61 if (IS_CALL_STATE(call_state)) {
62 //call coming,exit alarmring
63 evas_object_hide(ad->win_main);
66 evas_object_show(ad->win_main);
67 ring_volume_play_sound(ad);
71 /**********************************************************************
72 ******************Global function ref*************************************
73 ***********************************************************************/
77 * This function is used to init noti of vconf
78 * @param data[in] pointer to data
79 * @return when success, return SUCCESS or FAILED if error
82 int ring_noti_init(void *data)
85 struct appdata *ad = (struct appdata *)data;
87 for (i = 0; i < ALARM_NOTI_MAX; i++) {
89 vconf_notify_key_changed(s_notis[i].setting_key,
90 s_notis[i].noti_func, ad)) {
99 * This function is used to fini noti of vconf
104 void ring_noti_fini()
107 for (i = 0; i < ALARM_NOTI_MAX; i++) {
108 vconf_ignore_key_changed(s_notis[i].setting_key,
109 s_notis[i].noti_func);