2 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
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.
17 #ifndef __CONTEXT_TIMER_MANAGER_H__
18 #define __CONTEXT_TIMER_MANAGER_H__
21 /* Forward Declaration */
22 class timer_listener_iface;
24 namespace timer_manager {
34 WEEKDAY = MON | TUE | WED | THU | FRI,
36 EVERYDAY = SUN | MON | TUE | WED | THU | FRI | SAT,
40 * @brief Sets a repeated timer for a given interval of time (s).
41 * @details It is recommended to minize the number of timers initiated, to reduce battery consumptions.
42 * If it is possible to share a timer for multiple purposes, please do that.
43 * @param[in] interval Timer interval. The first timer will be expired after @c interval minutes,
44 * and will be repeated until the listener returns @c false.
45 * @param[in] listener A listner object to be notified.
46 * @return Timer ID. A negative integer if failed to set a timer.
48 int set_for(int interval, timer_listener_iface* listener, void* user_data = NULL);
51 * @brief Sets a timer that will be expired at a specific time, at designated days of week.
52 * @details It is recommended to minize the number of timers initiated, to reduce battery consumptions.
53 * If it is possible to share a timer for multiple purposes, please do that.
54 * @param[in] hour Hour
55 * @param[in] min Minute
56 * @param[in] day_of_week The timer will expire at hour:min:00, at every day(s) of week designated here.
57 * @param[in] listener Listener object.
58 * @return Timer ID. A negative integer if failed to set a timer.
60 int set_at(int hour, int min, int day_of_week, timer_listener_iface* listener, void* user_data = NULL);
63 * @brief Removes the timer specified by @c timer_id.
65 void remove(int timer_id);
69 #endif /* __CONTEXT_TIMER_MANAGER_H__ */