2 * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
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.
19 #include <system_settings.h>
21 #include "configuration.h"
23 static struct _s_configuration_info {
24 int longpress_threshold;
25 } s_configuration_info = {
27 .longpress_threshold = SYSTEM_SETTINGS_TAP_AND_HOLD_DELAY_SHORT,
29 .longpress_threshold = 0,
33 static void _conf_longpress_threshold_cb(system_settings_key_e key, void *user_data)
36 int delay = SYSTEM_SETTINGS_TAP_AND_HOLD_DELAY_SHORT; /* default 0.5 sec */
42 if (SYSTEM_SETTINGS_KEY_TAP_AND_HOLD_DELAY == key)
46 if (system_settings_get_value_int(SYSTEM_SETTINGS_KEY_TAP_AND_HOLD_DELAY, &delay) != 0) {
47 ERR("Failed to get tap and hold delay");
51 if (s_configuration_info.longpress_threshold != delay) {
52 s_configuration_info.longpress_threshold = delay;
55 DBG("Current tap and hold delay : [%d] msec", delay);
59 HAPI void quickpanel_conf_init(void *data)
62 if (system_settings_get_value_int(SYSTEM_SETTINGS_KEY_TAP_AND_HOLD_DELAY,
63 &s_configuration_info.longpress_threshold) != 0) {
64 ERR("Failed to get tap and hold delay");
67 if (system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_TAP_AND_HOLD_DELAY,
68 _conf_longpress_threshold_cb, NULL) != 0) {
69 ERR("Failed to set tap and hold delay changed callback");
74 HAPI void quickpanel_conf_fini(void *data)
77 if (system_settings_unset_changed_cb(SYSTEM_SETTINGS_KEY_TAP_AND_HOLD_DELAY) != 0) {
78 ERR("Failed to unset tab and hold delay changed callback");
83 HAPI double quickpanel_conf_longpress_time_get(void)
85 return (double)(s_configuration_info.longpress_threshold)/(double)1000.0;