On 2008-08-17, Tam Hanna <[EMAIL PROTECTED]> wrote:
> Hello folks,
> I have just run into a really really weird thing on my Sim and wanted to
> share this.
>
> I have an app that turns itself on every 15 seconds while the device is
> running(a status reader) via an alarm and then resets the next alarm, until
> a poweroff notification comes by. When the Power off notification comes by,
> the alarms are disabled as to allow the device to sleep:
>
> void notificationReceived(MemPtr cmdPBP)
> {
> SysNotifyParamType *pNotifyParams = (SysNotifyParamType *)cmdPBP;
> UInt16 cardNo;
> LocalID dbID;
>
> SysCurAppDatabase(&cardNo,&dbID);
>
> switch (pNotifyParams->notifyType)
> {
> case sysNotifyLateWakeupEvent:
> AlmSetAlarm(cardNo,dbID,0,TimGetSeconds()+15,false);
> break;
> case sysNotifySleepNotifyEvent:
> AlmSetAlarm(cardNo,dbID,0,0 ,false);
> break;
> }
> }
>
> However, the device still wakes up at the once specified time - apparently,
> the OS clears the alarm from its alarm manager, but does not update the RTC.
>
.... <snip> ....
>
> Anyone have any ideas re this?
>
Are you sure you are setting/canceling the alarm for the right application?
The cardNo & dbID returned by SysCurAppDatabase are from the last opened
resource database, which is not necessarily your app since you are
sublaunched (no globals) to receive the notification.
Store your dbID in a feature, then you do not have to call
SysCurAppDatabase.
Ton van Overbeek
--
For information on using the ACCESS Developer Forums, or to unsubscribe, please
see http://www.access-company.com/developers/forums/