Hello,

My app runs on Symbol's SPT 174x, which has wireless WAN connectivity (802.11). The 
app communicates with a web server using HTTP over TCP/IP on the wireless link.

I'm trying to download a Palm DB that I create on the fly on the server to the Palm, 
and then use DmCreateDatabaseFromImage. I'm creating the pdb file using the Java code 
in Mann's & Ripschpater's excellent book "Advanced Palm Programming." Creating pdb 
files this way and using HotSync to install them works fine. But when I try to 
transfer the pdb file to the Palm using HTTP and try to "install" it using 
DmCreateDatabaseFromImage, it returns error 0x201 (dmErrMemError).

I also tried using ExgDbRead(), but got the same error after it read about 90 bytes or 
so. I checked the archives, but references to dmErrMemError all seemed to do with 
installing a .prc that wasn't segmented. The pdb I'm trying to install is small - just 
over 2KB.

Here's the relevant code. "weber" is my HTTP client class.

        char httpRequest[80];
        Err error;
        int numRecs = 0;
        //Boolean needReset;
        LocalID dbId = 0;
        //void* userData = 0;
        MemPtr dbMemP = 0;
        int dbSize = 0, totalBytes = 0;

        // Find and delete any previous database
        eventHistDb.RemoveDb();

        // Send request to HTTP server
        StrPrintF(httpRequest, historyPath, gSerialNum);
        error = weber->send(httpRequest, 0, 0);
        if (!error  &&  weber->getResponseCode() == PalmHTTP::HTTP_OK) {

                dbSize = weber->getContentLength();             // slightly larger 
than db
                dbMemP = MemPtrNew(dbSize);
                char* dataP = (char*) dbMemP;
                MemSet(dataP, dbSize, 0);
                while (totalBytes < dbSize) {
                        int reqBytes = min(1024, dbSize - totalBytes);
                        int bytes = weber->getDecryptedChunk(dataP, reqBytes, &error);
                        if (bytes <= 0)
                                break;
                        dataP += bytes;
                        totalBytes += bytes;
                }
/* *** this didn't work  :-(
                error = ExgDBRead(&eventHistDb.ExgReadProc,
                        &eventHistDb.ExgDeleteProc,
                        userData,
                        &dbId, 
                        0,                                                      // 
card number
                        &needReset,
                        true);                                          // keep 
creation/mod/backup dates of db
*/
        }
        error = weber->close();
        if (weber->getResponseCode() != PalmHTTP::HTTP_OK) {
                weber->doResponseAlert();
                MemPtrFree(dbMemP);
                return;
        }

        error = DmCreateDatabaseFromImage(dbMemP);
        MemPtrFree(dbMemP);
        dbId = DmFindDatabase(cardNo, dbName);

        // Open new temp db
        eventHistDb.OpenDb(dbId);


Thanks for any help,

Michael
-- 



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

Reply via email to