Fix coverity issue 1149129
[apps/native/volume-app.git] / inc / timer.h
1 /*
2  * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef __VOLUME_TIMER_H__
18 #define __VOLUME_TIMER_H__
19
20 #define DEL_TIMER(x) \
21         if (x) {\
22                 _D("DELTIMER x : %p\n", x);\
23                 ecore_timer_del(x);\
24                 x = NULL;\
25         }
26 #define ADD_TIMER(x, time, _timer_cb, data) \
27         if (x != NULL) DEL_TIMER(x); \
28         x = ecore_timer_add(time, _timer_cb, data);\
29         _D("ADDTIMER x : %p\n", x);\
30
31 typedef enum {
32         TYPE_TIMER_POPUP = 0,
33         TYPE_TIMER_SLIDER,
34         TYPE_TIMER_SD,
35         TYPE_TIMER_SU,
36         TYPE_TIMER_BT,
37         TYPE_TIMER_WARNING_POPUP,
38 } volume_timer_type;
39
40 extern Ecore_Timer *volume_timer_popup_timer_get(void);
41 extern Ecore_Timer *volume_timer_slider_timer_get(void);
42 extern Ecore_Timer *volume_timer_su_timer_get(void);
43 extern Ecore_Timer *volume_timer_sd_timer_get(void);
44
45 extern Eina_Bool volume_timer_popup_cb(void *data);
46 extern Eina_Bool volume_timer_slider_timer_cb(void *data);
47
48 extern void volume_timer_add(double time, volume_timer_type type);
49 extern void volume_timer_del(volume_timer_type);
50
51 #endif /* __VOLUME_TIMER_H__ */