NUGU SDK Linux  1.7.6
nugu_timer.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 SK Telecom 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 __NUGU_TIMER_H__
18 #define __NUGU_TIMER_H__
19 
20 #include <nugu.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
40 typedef struct _nugu_timer NuguTimer;
41 
45 typedef void (*NuguTimeoutCallback)(void *userdata);
46 
52 NUGU_API NuguTimer *nugu_timer_new(long interval);
53 
58 NUGU_API void nugu_timer_delete(NuguTimer *timer);
59 
66 NUGU_API void nugu_timer_set_interval(NuguTimer *timer, long interval);
67 
74 NUGU_API long nugu_timer_get_interval(NuguTimer *timer);
75 
84 NUGU_API void nugu_timer_set_singleshot(NuguTimer *timer, int singleshot);
85 
92 NUGU_API int nugu_timer_get_singleshot(NuguTimer *timer);
93 
99 NUGU_API void nugu_timer_start(NuguTimer *timer);
100 
106 NUGU_API void nugu_timer_stop(NuguTimer *timer);
107 
114 NUGU_API void nugu_timer_set_callback(NuguTimer *timer,
115  NuguTimeoutCallback callback,
116  void *userdata);
117 
122 #ifdef __cplusplus
123 }
124 #endif
125 
126 #endif
NUGU_API NuguTimer * nugu_timer_new(long interval)
Create new timer object.
Definition: nugu_timer_mock.c:75
NUGU_API void nugu_timer_delete(NuguTimer *timer)
Destroy the timer object.
Definition: nugu_timer_mock.c:91
struct _nugu_timer NuguTimer
Timer object.
Definition: nugu_timer.h:40
NUGU_API void nugu_timer_set_singleshot(NuguTimer *timer, int singleshot)
Set timer running single shot.
Definition: nugu_timer_mock.c:108
NUGU_API void nugu_timer_set_interval(NuguTimer *timer, long interval)
Set interval.
Definition: nugu_timer_mock.c:98
NUGU_API void nugu_timer_start(NuguTimer *timer)
Start the timer.
Definition: nugu_timer_mock.c:118
void(* NuguTimeoutCallback)(void *userdata)
Callback prototype for timeout.
Definition: nugu_timer.h:45
NUGU_API void nugu_timer_set_callback(NuguTimer *timer, NuguTimeoutCallback callback, void *userdata)
Set timeout callback.
Definition: nugu_timer_mock.c:133
NUGU_API long nugu_timer_get_interval(NuguTimer *timer)
Get interval.
Definition: nugu_timer_mock.c:103
NUGU_API void nugu_timer_stop(NuguTimer *timer)
Stop the timer.
Definition: nugu_timer_mock.c:126
NUGU_API int nugu_timer_get_singleshot(NuguTimer *timer)
Get timer single shot property.
Definition: nugu_timer_mock.c:113