"Dr. Vesselin Bontchev" wrote:
>
> Hello folks,
>
> I've asked this question before and didn't get any answers. Now I have some
> specific code that doesn't work, so I thought I'd ask again.
>
> Basically, I want my application to receive the applications beamed to the
> device on which it is installed, so that it can inspect them first. So far
> I've tried the following:
>
> UInt32 PilotMain (UInt16 cmd, MemPtr cmdPBP, UInt16 launchFlags)
> {
> switch (cmd)
> {
> case sysAppLaunchCmdSystemReset:
> case sysAppLaunchCmdSyncNotify:
> RegisterForNotifications ();
> break;
> case sysAppLaunchCmdExgReceiveData:
> ReceiveDatabase ((ExgSocketPtr) cmdPBP);
> break;
> default:
> break;
> }
> return 0;
> }
>
> That is, on application installation and on reset, I register my application
> to receive the applications beamed to the device and when data has been
> received by the application, it tries to receive the beamed application.
>
> RegisterForNotifications works does just
>
> void RegisterForNotifications (void)
> {
> ExgRegisterData (appCreatorID, exgRegExtensionID, "PRC");
> ExgRegisterData (appCreatorID, exgRegTypeID,
> "application/vnd.palm\tapplication/x-pilot");
> ExgSetDefaultApplication (appCreatorID, exgRegExtensionID, "PRC");
> ExgSetDefaultApplication (appCreatorID, exgRegTypeID,
> "application/vnd.palm\tapplication/x-pilot");
> ExgSetDefaultApplication (appCreatorID, exgRegCreatorID, "lnch");
> }
>
> where appCreatorID is #defined as the creator ID of my application.
>
> Receiving the beamed application is done like this:
>
> Err ReadDBData (void *dataP, UInt32 *sizeP, void *userDataP)
> {
> Err err;
>
> *sizeP = ExgReceive ((ExgSocketPtr) userDataP, dataP, *sizeP, &err);
> return err;
> }
>
> Boolean DeleteProc (const Char *nameP, UInt16 version, UInt16 cardNo, LocalID
> dbID, void *userData)
> {
> return false;
> }
>
> Err ReceiveDatabase (ExgSocketPtr exgSocket)
> {
> LocalID dbID;
> Boolean doReset;
> Err err;
>
> err = ExgAccept (exgSocket);
> if (err == errNone)
> {
> err = ExgDisconnect (exgSocket, ExgDBRead (ReadDBData, DeleteProc,
> exgSocket, &dbID, 0, &doReset, true));
> SndPlaySystemSound (sndWarning); // Show that we're alive
> // Do something with the received database (referred to by dbID)
> }
> return err;
> }
>
> Yet the above code doesn't work. That is, I don't get any beeps and it is
> apparently still the Launcher that is receiving the beamed applications. What
> am I missing?
>
> Regards,
> Vesselin
Hi Vesselin,
Is the extension specified in
ExgRegisterData (appCreatorID, exgRegExtensionID, "PRC");
case sensitive? (I've seen only lower case used and I've never tried
upper case.)
As an intermediate test point, does the receiver application ever get
sysAppLaunchCmdExgAskUser? (By the way, to receive multiple files I
think you'll eventually have to handle sysAppLaunchCmdExgAskUser and set
ExgAskParamType's result to exgAskOk so the transmitter won't time out
during the receiver's dialog ... at least that is what I ended up
doing.)
I hope that helps,
Greg
--
For information on using the Palm Developer Forums, or to unsubscribe, please
see http://www.palmos.com/dev/support/forums/