Greetings,

I'm attempting to implement a notification handler in a non-application code
resource (a Satellite Forms extension, similar to a shared library).  The
notification I'm wanting to handle is the Zire71 kCamSliderNotifyEvent that
is broadcast when the camera slider is opened.  I want to handle control of
the camera when the application using my SF extension is active (the
extension is loaded and active when the app starts).

The problem I'm running into is that regardless of the priority used to
register for the notification, the Zire71 photo capture app is being
launched, because it has already received the notification by the time my
code gets a chance to handle it.

I'm registering for the notification using a callback pointer when the
extension loads, like this (modified from the Z71 CameraSample supplied by
PalmSG to get the right dbID):

Err RegisterCameraSlider(Int8 priority, SysNotifyProcPtr procP, void
*userDataP)
{
 UInt16  cardNo = 0;
 LocalID dbID;
 Err  err = errNone;

// err = SysCurAppDatabase(&cardNo, &dbID);
 dbID = DmFindDatabase( cardNo, Z71ExtPRCName );    // not an app

// if(err)
 if(!dbID)
  goto Done;

 // Registering for camera slider notification
 err = SysNotifyRegister(cardNo, dbID, kCamSliderCreator, procP, priority,
userDataP);

Done:
 return err;
}


The procP I am passing to this function is my extension's SliderNotifyProc,
done like this (from the PalmSG CameraSample again):

  #define kSliderNotificationPriority  (sysNotifyNormalPriority - 32)
  // Register for slider notification
  err = RegisterCameraSlider(kSliderNotificationPriority, SliderNotifyProc,
NULL);



Now, when I cause the kCamSliderNotifyEvent to "fire" in the Zire71
Simulator by pressing the key to open the slider, my SliderNotifyProc does
in fact get called like it is supposed to.

HOWEVER, the notification has already been marked as being handled by the
default Zire71 photo capture app, as this test proves:

 // Is it handled? We are in a cooperative mode
 if(notifyParamsP->handled)
  goto Done;

So, no matter what I do in my SliderNotifyProc at this point, the system has
already started the process of launching the default photo capture app, and
as a result I can't take control of the camera from within my app.


I created a new standard PalmOS app from scratch to register for and handle
the kCamSliderNotifyEvent at the same priority, and it works just fine.
When my test app is running and the slider is opened, I get the first crack
at the notification and can handle it appropriately (just as the Zire71
CameraSample app does).  I've tested both the launch code and callback
pointer methods of registering for the notification, and both work fine.

The problem seems to be that because my SatForms extension is a non-app code
resource, it doesn't get a chance to handle the notification until after
applications registered for the same notification have already seen it,
regardless of the priority.  Can anyone suggest a way to work around this
problem, or spot some error in my logic?

Thanks,

David Thacker


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to