I've been meaning to get this information out ever since the release of
PalmIII. Here at last is the way to to transmit a palm database. It is
really
quite simple. Any app that wants to transmit entire databases, not just
individual
records, should add this to their app. This would be great for things like
Doc and image
viewers where each item is a separate database. The key thing to remember
is that a that beaming
is not just palm to palm, but to and from PCs as well. So you need to send
a PC filename
with a .pdb or .prc file extension on these things. Here is some sample
code showing how
and app can beam itself. You can substitute any database you like. The key
is a system call
called ExgDBWrite that coverts a palm database into the desktop pdb format.
A database sent with the code below can be recieved by the launcher on
another palm device. It can
also be accepted on a PC over IrDA and then installed via the install app
to other Palm devices.
--- Gavin
/***********************************************************************
*
* FUNCTION: WriteDBData
*
* DESCRIPTION: Callback for ExgDBWrite to send data with exchange manager
*
* PARAMETERS: dataP : buffer containing data to send
* sizeP : number of bytes to send
* userDataP: app defined buffer for context
( (holds exgSocket when using ExgManager)
*
* RETURNED: error if non-zero
*
***********************************************************************/
static Err WriteDBData(const void* dataP, ULong* sizeP, void* userDataP)
{
Err err;
// Try to send as many bytes as were requested by the caller
*sizeP = ExgSend((ExgSocketPtr)userDataP, (void*)dataP, *sizeP, &err);
return err;
}
/***********************************************************************
*
* FUNCTION: SendDatabase
*
* DESCRIPTION: Sends data in the input field using the Exg API
*
* PARAMETERS: cardNo: card number of db to send (usually 0)
* dbID: databaseId of database to send
* nameP: public filename for this database
* This is the name as it appears on a PC file
listing
* It should end with a .prc or .pdb extension
* description: Optional text description of db to show to
user
* who receives the database.
*
* RETURNED: error code or zero for no error.
*
***************************************************************************
/
static Err SendDatabase (Word cardNo, LocalID dbID, CharPtr nameP, CharPtr
descriptionP)
{
ExgSocketType exgSocket;
Err err;
// Create exgSocket structure
MemSet(&exgSocket, sizeof(exgSocket), 0);
exgSocket.description = descriptionP;
exgSocket.name = nameP;
// Start and exchange put operation
err = ExgPut(&exgSocket);
if (!err)
{
// This function converts a palm database into its external
(public)
// format. The first parameter is a callback that will be passed
parts of
// the database to send or write.
err = ExgDBWrite(WriteDBData, &exgSocket, NULL, dbID, cardNo);
// Disconnect Exg and pass error
err = ExgDisconnect(&exgSocket, err);
}
return err;
}
/***********************************************************************
*
* FUNCTION: SendMe
*
* DESCRIPTION: Sends this application
*
* PARAMETERS: none
*
* RETURNED: error code or zero for no error.
*
***************************************************************************
/
static Err SendMe(void)
{
Err err;
// Find our app using its internal name
LocalID dbID = DmFindDatabase(0, "Beamer");
if (dbID) // send it giving external name and description
err = SendDatabase(0, dbID, "Beamer.prc", "Beamer application");
else
err = DmGetLastErr();
return err;
}
On Sun, 25 Apr 1999, Richard Bram wrote:
> What's the very simplest way to add the ability to send a database
> by IR between devices? One of my users would like to be able to
> configure the data for a Hack on one device, then upload the
> standard database to others by IR. This may be a RTFM question,
> but I can't seem to use the standard apps (like Z'Catalog) to beam
> my hack's database - the receiving device gets the database, but then
> can't find an app to attach it to (since it goes with a hack, not an
> app) and then deletes it. Is there a way to skip this behavior in
> the receiving PCOD?