7b0556538ad487cbc9c88f554621903daebf4dc2
[platform/core/system/libsvi.git] / src / common.h
1 /*
2  * libfeedback
3  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4  *
5  * Licensed under the Apache License, Version 2.0 (the License);
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18
19 #ifndef __COMMON_H__
20 #define __COMMON_H__
21
22 #include <stdbool.h>
23 #include <errno.h>
24 #include <mm_sound_private.h>
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 /**
31  * @file common.h
32  * @brief This file contains the common information
33  */
34
35 #ifndef __CONSTRUCTOR__
36 #define __CONSTRUCTOR__ __attribute__ ((constructor))
37 #endif
38
39 #ifndef __DESTRUCTOR__
40 #define __DESTRUCTOR__ __attribute__ ((destructor))
41 #endif
42
43 #ifndef __DD_LIST__
44 #define __DD_LIST__
45 #include <glib.h>
46 typedef GList dd_list;
47 #define DD_LIST_PREPEND(a, b)       \
48         a = g_list_prepend(a, b)
49 #define DD_LIST_APPEND(a, b)        \
50         a = g_list_append(a, b)
51 #define DD_LIST_REMOVE(a, b)        \
52         a = g_list_remove(a, b)
53 #define DD_LIST_FOREACH(head, elem, node)   \
54         for (elem = head; elem && ((node = elem->data) != NULL); elem = elem->next, node = NULL)
55 #endif
56
57 #define FEEDBACK_DATA_DIR                       FEEDBACK_SYS_SHARE"/feedback"
58 #define FEEDBACK_ORIGIN_DATA_DIR        FEEDBACK_SYS_RO_SHARE"/feedback"
59
60 #define FEEDBACK_RETRY_CNT       1
61
62 #define DEFAULT_VIB_LEVEL       3
63 #define HAPTIC_FEEDBACK_STEP    20 /**< feedback max / slider step */
64
65 #define ARR_SIZE(arr) (sizeof(arr)/sizeof((arr)[0]))
66
67 int is_sound_mode(void);
68 int is_touch_sndstatus(void);
69 int is_keytone_sndstatus(void);
70 int is_vibration_mode(void);
71
72 #ifdef __cplusplus
73 }
74 #endif
75
76 #endif