alarm.h
Go to the documentation of this file.
/*
* Copyright © 2014 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authored by: Thomas Voß <thomas.voss@canonical.com>
*/
#ifndef UBUNTU_HARDWARE_ALARM_H_
#define UBUNTU_HARDWARE_ALARM_H_
#include <ubuntu/status.h>
#include <ubuntu/visibility.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum
{
U_HARDWARE_ALARM_TIME_REFERENCE_BOOT,
U_HARDWARE_ALARM_TIME_REFERENCE_RTC
} UbuntuHardwareAlarmTimeReference;
typedef UbuntuHardwareAlarmTimeReference UHardwareAlarmTimeReference;
typedef enum
{
U_HARDWARE_ALARM_SLEEP_BEHAVIOR_WAKEUP_DEVICE,
U_HARDWARE_ALARM_SLEEP_BEHAVIOR_KEEP_DEVICE_ASLEEP
} UbuntuHardwareAlarmSleepBehavior;
typedef UbuntuHardwareAlarmSleepBehavior UHardwareAlarmSleepBehavior;
typedef struct
{
UHardwareAlarmTimeReference reference;
UHardwareAlarmSleepBehavior sleep_behavior;
} UbuntuHardwareAlarmWaitResult;
typedef UbuntuHardwareAlarmWaitResult UHardwareAlarmWaitResult;
typedef struct UbuntuHardwareAlarm* UHardwareAlarm;
UBUNTU_DLL_PUBLIC UHardwareAlarm
u_hardware_alarm_create();
UBUNTU_DLL_PUBLIC void
u_hardware_alarm_ref(
UHardwareAlarm alarm);
UBUNTU_DLL_PUBLIC void
u_hardware_alarm_unref(
UHardwareAlarm alarm);
UBUNTU_DLL_PUBLIC UStatus
u_hardware_alarm_get_elapsed_real_time(
UHardwareAlarm alarm,
struct timespec *tz);
UBUNTU_DLL_PUBLIC UStatus
u_hardware_alarm_set_timezone(
UHardwareAlarm alarm,
const struct timezone *tz);
UBUNTU_DLL_PUBLIC UStatus
u_hardware_alarm_set_relative_to_with_behavior(
UHardwareAlarm alarm,
UHardwareAlarmTimeReference time_reference,
UHardwareAlarmSleepBehavior behavior,
const struct timespec *ts);
UBUNTU_DLL_PUBLIC UStatus
u_hardware_alarm_wait_for_next_alarm(
UHardwareAlarm alarm,
UHardwareAlarmWaitResult *result);
#ifdef __cplusplus
}
#endif
#endif
UbuntuHardwareAlarmSleepBehavior
UbuntuHardwareAlarmSleepBehavior
Definition: alarm.h:38
u_hardware_alarm_set_relative_to_with_behavior
UBUNTU_DLL_PUBLIC UStatus u_hardware_alarm_set_relative_to_with_behavior(UHardwareAlarm alarm, UHardwareAlarmTimeReference time_reference, UHardwareAlarmSleepBehavior behavior, const struct timespec *ts)
UHardwareAlarmTimeReference
UbuntuHardwareAlarmTimeReference UHardwareAlarmTimeReference
Definition: alarm.h:35
UbuntuStatus
UbuntuStatus
Indicates the status of an operation.
Definition: status.h:26
UHardwareAlarmSleepBehavior
UbuntuHardwareAlarmSleepBehavior UHardwareAlarmSleepBehavior
Definition: alarm.h:46
u_hardware_alarm_unref
UBUNTU_DLL_PUBLIC void u_hardware_alarm_unref(UHardwareAlarm alarm)
u_hardware_alarm_wait_for_next_alarm
UBUNTU_DLL_PUBLIC UStatus u_hardware_alarm_wait_for_next_alarm(UHardwareAlarm alarm, UHardwareAlarmWaitResult *result)
U_HARDWARE_ALARM_SLEEP_BEHAVIOR_KEEP_DEVICE_ASLEEP
Definition: alarm.h:43
u_hardware_alarm_get_elapsed_real_time
UBUNTU_DLL_PUBLIC UStatus u_hardware_alarm_get_elapsed_real_time(UHardwareAlarm alarm, struct timespec *tz)
UbuntuHardwareAlarmWaitResult::reference
UHardwareAlarmTimeReference reference
Definition: alarm.h:51
U_HARDWARE_ALARM_SLEEP_BEHAVIOR_WAKEUP_DEVICE
Definition: alarm.h:41
visibility.h
u_hardware_alarm_create
UBUNTU_DLL_PUBLIC UHardwareAlarm u_hardware_alarm_create()
u_hardware_alarm_set_timezone
UBUNTU_DLL_PUBLIC UStatus u_hardware_alarm_set_timezone(UHardwareAlarm alarm, const struct timezone *tz)
UbuntuHardwareAlarmWaitResult
Definition: alarm.h:49
status.h
UHardwareAlarmWaitResult
UbuntuHardwareAlarmWaitResult UHardwareAlarmWaitResult
Definition: alarm.h:55
UBUNTU_DLL_PUBLIC
#define UBUNTU_DLL_PUBLIC
Definition: visibility.h:26
UbuntuHardwareAlarmWaitResult::sleep_behavior
UHardwareAlarmSleepBehavior sleep_behavior
Definition: alarm.h:52
UHardwareAlarm
struct UbuntuHardwareAlarm * UHardwareAlarm
Definition: alarm.h:58
UbuntuHardwareAlarmTimeReference
UbuntuHardwareAlarmTimeReference
Definition: alarm.h:29
u_hardware_alarm_ref
UBUNTU_DLL_PUBLIC void u_hardware_alarm_ref(UHardwareAlarm alarm)
U_HARDWARE_ALARM_TIME_REFERENCE_BOOT
Definition: alarm.h:31
U_HARDWARE_ALARM_TIME_REFERENCE_RTC
Definition: alarm.h:32