2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (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://www.tizenopensource.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.
17 #include "stopwatch_vconf.h"
18 #include "stopwatch_util.h"
19 /**********************************************************************
20 ******************define, struct ,typedef, union, enum, global val *************************************
21 ***********************************************************************/
24 typedef struct _noti_callback {
26 void (*noti_func) (keynode_t *, void *);
28 /**********************************************************************
29 ******************Local function declear, extern function declear*************************************
30 ***********************************************************************/
31 static void stw_idle_lockstate_change_cb(keynode_t *key, void *data);
33 /**********************************************************************
34 ******************Global val , static global val*************************************
35 ***********************************************************************/
36 #define STW_NOTI_MAX 1
37 static noti_callback s_notis[STW_NOTI_MAX] = {
38 {VCONFKEY_IDLE_LOCK_STATE, *stw_idle_lockstate_change_cb},
41 /**********************************************************************
42 ******************Local function ref*************************************
43 ***********************************************************************/
46 * Debug function: to set LCD power off principle when VCONFKEY_IDLE_LOCK_STATE is changed
47 * This function requires data and key which indicates the key to be listened
49 * stopwatch_idle_lockstate_change_cb()
50 * @param[in] key Pointer to indicate the screen lock state. If it is unlocked, this callback will be called
51 * @param[in] data Pointer to user data, which is not necessary here.
55 static void stw_idle_lockstate_change_cb(keynode_t *key, void *data)
58 int lock_state = vconf_keynode_get_int(key);
59 // to check screen lock state
61 // to set LCD power off effect
62 stw_util_pm_state_set(EINA_TRUE);
66 /**********************************************************************
67 ******************Global function ref*************************************
68 ***********************************************************************/
72 * This function is used to init noti of vconf
73 * @param data[in] pointer to data
74 * @return when success, return SUCCESS or FAILED if error
77 int stw_noti_init(void *data)
80 struct appdata *ad = (struct appdata *)data;
82 for (i = 0; i < STW_NOTI_MAX; i++) {
84 vconf_notify_key_changed(s_notis[i].setting_key,
85 s_notis[i].noti_func, ad)) {
94 * This function is used to fini noti of vconf
102 for (i = 0; i < STW_NOTI_MAX; i++) {
103 vconf_ignore_key_changed(s_notis[i].setting_key,
104 s_notis[i].noti_func);