Resources | developer.brewmp.com Resources | developer.brewmp.com

Developer

resources

Alarms

Alarms are persistent, which means they work across device reboots. Unlike timers, which can be active only while the application is running, an application can receive notification that an alarm expired while the application was not running. If the application is not running, it is started and receives an EVT_ALARM event.

There are two Brew MP interfaces that provide alarm functionality:

  • IAlarmMgr

    The alarm functions provided by IAlarmMgr enable an application to be notified when the current time reaches a specified value.

    When setting an alarm, an application specifies the time as the number of seconds from the current time. The time can also be specified as an absolute time, which is the number of seconds from the epoch.

  • IShell

    The ISHELL_SetAlarm() and ISHELL_CancelAlarm() functions are similar to IAlarmMgr_SetAlarm() and IAlarmMgr_CancelAlarm(). The difference is that the ISHELL functions accept a time in minutes instead of seconds.

    The ISHELL interface also provides functions that are not available from the IAlarmMgr interface:

    • ISHELL_SuspendAlarms() allows the caller to suspend alarm notifications. Notifications are postponed until ISHELL_ResumeAlarms() is called or the device is reset. Applications can schedule alarms while alarms are suspended.
    • ISHELL_ResumeAlarms() allows the caller to resume alarm notifications. Any alarms that have already become past due will be scheduled for notification.

If an application implements alarms using IAlarmMgr, it can use ISHELL_SuspendAlarms() and ISHELL_ResumeAlarms() to suspend and resume alarms.

The IAlarmMgr interface is the recommended way to implement alarms.