I'm having this odd problem with ExgConnect while running on an emulated
Palm OS 4.0 m505 device (it happens on a real 4.0 device too, a Sony 610C).
This API always returns the bad status 0x150F, "Operation not supported".
Here's the code:

 MemSet(&exgSocket, sizeof(exgSocket), 0);
 exgSocket.description = dbName;
 exgSocket.name = dbName;
 exgSocket.count = 1;
 exgSocket.target = sysFileCLauncher;

 err = ExgConnect(&exgSocket);
 if (err)
 {
      FrmCustomAlert(DebugAlert, "ExgConnect failed!", NULL, NULL);
      return;
 }

In this code, dbName is set to the name of an existing application database.
I don't see any reason for getting a failure on the ExgConnect call.  I've
also tried leaving the .name field empty, leaving the whole exgSocket
variable cleared to zero, and several other combinations, and all fail the
same way.

If I omit the ExgConnect call, and do an ExgPut followed by an ExgDBWrite
and ExgDisconnect, I get no failures, and the beam succeeds.

If I do that same thing, but before the ExgDisconnect I do multiple
ExgPut/ExgDBWrite calls (one per bundled database, exgSocket.count set
correctly before hand) in a loop controlled by
DmGetNextDatabaseByTypeCreator, that API call returns the first couple
databases just fine, but then begins returning the same database multiple
times, though I'm calling it with newSearch = false after the first call,
and onlyLatestVers set to true every time!  The beam succeeds, but there are
multiple copies of several databases in what was sent, so the receiving
device gets lots of "Database already exists, do you want to replace it?"
dialogs.

If repeat the previous experiment, but #ifdef out the Exchange Manager calls
that are inside the loop, DmGetNextDatabaseByTypeCreator returns every
bundled database once and only once!

Does anybody have an idea what is the problem here?  Is it simply not
allowed to embed Exchange Manager calls inside a
DmGetNextDatabaseByTypeCreator  loop?

Thanks,

Mark Peters

P.S. - Below is the bundled db beam loop code:

 newSearch = true;

 while (errNone == DmGetNextDatabaseByTypeCreator(newSearch, &state, NULL,
                               'MP09', true, &cardNo, &dbID))
 {
       newSearch = false;
       err = DmDatabaseInfo(cardNo, dbID, dbName, &attrs, NULL, NULL,
                                   NULL, NULL, NULL, NULL, NULL, NULL,
NULL);

      // If the following #if 1 is changed to #if 0, one and only one copy
of each database is
      // by DmGetNextDatabaseByTypeCreator, otherwise, multiple copies are
returned.
#if 1
       // Skip the app, as it was beamed previously
       if (!err && StrCompare(dbName, applName) && (attrs & dmHdrAttrBundle)
&&
              !(attrs & dmHdrAttrCopyPrevention))
       {
             err = ExgPut(&exgSocket);
             if (!err)
             {
                   err = ExgDBWrite(WriteDBData, &exgSocket, NULL, dbID,
cardNo);
                   if (err)
                         goto Exit;
             }
             else
                   goto Exit;
       }
#endif
 }







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

Reply via email to