DE> That's right. The IrOBEX exchange library doesn't support the ExgConnect
DE> function. You don't need it though.
MP> That's odd - I could swear that the docs said that using ExgConnect is
MP> _required_ when sending multiple objects. I guess you're providing the
MP> additional clarification that the term "object" doesn't include
databases.
Here's a quote from the docs I referenced:
DOC> The ExgConnect call is optional. Some exchange libraries, such as
DOC> the IR Library, support the sending of multiple objects but do not
DOC> support ExgConnect. If ExgConnect returns an error, the first call
DOC> to ExgPut initiates the connection. You should only continue to
DOC> send objects if the first ExgPut call succeeds. See Listing 1.4.
DOC> Libraries that support the ExgConnect call also support sending
DOC> multiple objects without using ExgConnect.
DOC>
DOC> Listing 1.4 Sending multiple objects
DOC>
DOC> Boolean isConnected = false;
DOC> err = ExgConnect(&exgSocket); //optional
DOC> if (!err)
DOC> isConnected = true;
DOC> if (!err || err == exgErrNotSupported) {
DOC> while (/* we have objects to send */) {
DOC> err = ExgPut(&exgSocket);
DOC> if (!isConnected && !err)
DOC> isConnected = true; //auto-connected on first put.
DOC> while (!err && (sizeSent < size))
DOC> sizeSent += ExgSend(&exgSocket,dataP,size,&err);
DOC> if (err)
DOC> break;
DOC> }
DOC> }
DOC> if (isConnected)
DOC> ExgDisconnect(&exgSocket, err);
As I said, it's not pretty. And just to be clear, "object" does include a
database in prc/pdb format, or anything else you send via IrOBEX or any
other exchange library (Bluetooth, SMS, etc).
MP> Can the docs be modified to
MP> make this clear? Without knowledge of OS internals, one would never
think
MP> that the collection was being modified in this case.
I'm not sure how to document this. The Exchange Manager doesn't create
databases itself. The IrOBEX exchange library doesn't have much
documentation - it doesn't need much. Perhaps the existing warning in
DmGetNextDatabaseByTypeCreator could be extended to mention that beaming or
sending may create a temporary database.
DOC> WARNING! Don't create or delete a database while using
DOC> DmGetNextDatabaseByTypeCreator to iterate through the
DOC> existing databases. This could cause databases to be skipped, or
DOC> it could result in a given database being returned more than once.
This may be too much information though. Another alternative would be to add
a note to ExgPut indicating that some exchange libraries may create a
database to buffer the object. This could be useful for other reasons as
well. Actually, this is already documented to some extent in the description
for ExgLibPut:
DOC> Other operations within ExgLibPut depend on the exchange
DOC> library. The exchange library may open communications ports and
DOC> establish remote links at this time. Or it may just open a stream for
DOC> buffering data until a later operation.
MP> how does an application that has told the
MP> system that it is the launcher prevent itself from being stopped upon
MP> receiving a beamed application?
What do you mean by "told the system that it is the launcher"? And what do
you mean by "being stopped"? I think I can guess...
MP> One thing I tried experimentally was to register to receive data with a
prc
MP> extension, but the app never got a beam receive launch code. Does the
MP> built-in launcher explicitly set its creator ID as the target, and hence
my
MP> app never had a shot at the beam?
On Palm OS 3.0 through 3.5, the launcher set the target field to its own
creator ID when beaming. So if the sender is running any of these OS
versions, the beam will go to the built-in launcher, even if you register
for the prc and pdb extensions. If the receiver is running Palm OS 4.0 or
later, you can register your replacement launcher with the creator ID
'lnch', overriding the built-in launcher. To do this, use exgRegCreatorID as
the ID passed to ExgRegisterDatatype.
MP> Does it use prc, pdb, pqa, etc. when
MP> beaming, or does it use MIME types?
The IrOBEX exchange library has never transmitted the MIME type.
Applications register for and specify MIME types, but this has no effect
when beaming.
MP> I don't want my app to be 4.0 only, so registering and then making the
app
MP> the default for data intended for the launcher isn't a complete
solution.
On Palm OS 4.0 and later, your best bet is to register for .prc, .pdb, .pqa,
.oprc, application/x-pilot, application/vnd.palm, and 'lnch', and then set
yourself as the default for all of these. (You should obviously ask the user
before doing this, and if you want to be nice, you should provide a way to
set the default back to the built-in launcher.)
On Palm OS 3.0 through 3.5, you can register for .prc, etc, but the Exchange
Manager doesn't have any API for specifying which application should be used
when several register for the same extension, etc. There is no way to
register for another app's creator ID, so if the sender is running Palm OS
3.0 through 3.5, the situation is even worse. I think your only option is to
patch ExgNotifyReceive - yuck!
--
Danny @ PalmSource
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/