AlarmMgr.h
.
UInt32 AlmGetAlarm (UInt16 cardNo, LocalID dbID, UInt32* refP)
  |
-> |
Number of the storage card on which the application resides. |
  |
-> |
Local ID of the application. |
  |
<- |
The alarm's reference value is returned here. This value is passed to the application when the alarm is triggered. |
AlmSetAlarm
AlmGetProcAlarm (procP, refP)
  |
-> |
Pointer to a function that will be called when alarm is triggered. See AlmAlarmProcPtr . |
  |
<- |
A UInt32 pointer to a location where the alarm's reference value is returned. This value is passed to the procedure when the alarm is triggered. |
AlmSetProcAlarm
Err AlmSetAlarm (UInt16 cardNo, LocalID dbID, UInt32 ref, UInt32 alarmSeconds, Boolean quiet)
  |
-> |
Number of the storage card on which the application resides. |
  |
-> |
Local ID of the application. |
  |
-> |
Caller-defined value. This value is passed with the launch code that notifies the application that the alarm has been triggered. |
  |
-> |
Alarm date/time in seconds since 1/1/1904, or 0 to cancel the current alarm (if any). |
  |
-> |
Reserved for future upgrade. This value is not currently used. |
  |
|
No error. |
  |
|
Insufficient memory. |
  |
|
Alarm table is full. |
alarmSeconds
parameter specifies the time at which the alarm will be triggered. As soon as possible after this time, the alarm manager sends the
sysAppLaunchCmdAlarmTriggered
launch code to the specified application. If there is another alarm that should be set for this application, you can set it in response to this launch code. Following the sysAppLaunchCmdAlarmTriggered
launch code, the alarm manager sends a
sysAppLaunchCmdDisplayAlarm
launch code. This is where your application should do things such as display a modal dialog indicating that the event has occurred. Read more about these launch codes in Chapter 1, "Application Launch Codes."
ref
parameter. The system will pass this pointer back to the application in the launch codes' parameter blocks.
AlmGetAlarm
AlmSetProcAlarm (procP, ref, alarmSeconds)
  |
-> |
Pointer to a function that should be called when alarm is triggered. See AlmAlarmProcPtr . |
  |
-> |
A caller-defined UInt32 value. This value is passed with the launch code that notifies the application that the alarm has been triggered. |
  |
-> |
A UInt32 indicating the alarm date/time in seconds since 1/1/1904, or 0 to cancel the current alarm (if any). |
AlmSetAlarm
function, but it specifies a procedure to be called at the specified date and time rather than an application to be launched. With this macro, you can set alarms that are independent of any application. For example, a shared library can set procedure alarms that call a procedure implemented in the library.
IMPORTANT: Because theprocP
pointer is used to directly call the procedure, the pointer must remain valid from the timeAlmSetProcAlarm
is called to the time the alarm is triggered. If the procedure is in a shared library, you must keep the library open. If the procedure is in a separately loaded code resource, the resource must remain locked until the alarm is triggered. When you close a library or unlock a resource, you must remove any pending alarms. If you don't, the system will crash when the alarm is triggered.
AlmGetProcAlarm
void (*AlmAlarmProcPtr) (UInt16 almProcCmd, SysAlarmTriggeredParamType *paramP)
  |
|
One of the AlmProcCmdEnum constants. These are commands that your function must handle. Possible values are: |
  |
|
The alarm's date and time has passed and the alarm has been triggered. The function should perform its main task in response to this command. |
  |
almProcCmdReschedule |
A system time change occurred, so the function must reschedule the alarm. |
  |
|
Pointer to a SysAlarmTriggeredParamType structure. See below. |
AlmAlarmProcPtr
procedures are called when an alarm set by
AlmSetProcAlarm
is triggered. Your implementation should check the value of almProcCmd
and respond accordingly.
paramP
parameter is a pointer to a SysAlarmTriggeredParamType
structure. This structure is defined as:
typedef struct SysAlarmTriggeredParamType {
    UInt32 ref;
    UInt32 alarmSeconds;
    Boolean purgeAlarm;
} SysAlarmTriggeredParamType;
ref
and alarmSeconds
are both values specified in
AlmSetProcAlarm
when the alarm is set. The purgeAlarm
field specifies if the alarm will be removed from the alarm table when the function returns so that the
sysAppLaunchCmdDisplayAlarm
launch code is not triggered. This should be true
for all procedure alarms; the alarm manager set it to true
for you after your function returns.
almProcCmd
parameter to call the procedure for something other than a triggered alarm or a system time change. The value you use must be greater than the constant almProcCmdCustom
as defined in AlarmMgr.h
.
  |   |