Re: ContactDb implementation

----- Original Message -----
From: David A. Desrosiers
Time: 29-01-07 04:52
> On Sun, 2007-01-28 at 17:07 +0100, Tom Billiet wrote:
>> Does gnome-pilot offer a function like "get_pda_version(pilot_id)" or
>> something similar? I can't find it. 
> The SysInfo struct in libpisock will be able to do that for you.. 
> struct  SysInfo         info;
> /* ... */
> if (info.romVersion > 0x0500) {
> 	/* OS is greater than OS5, etc. ... */
> } 
The tricky part is how to retreive the sysinfo struct, this doesn't work:
GnomePilotConduit *
conduit_get_gpilot_conduit (guint32 pilot_id)
    struct SysInfo sysinfo;
    dlp_ReadSysInfo (pilot_id, &sysinfo);
    if (sysinfo.romVersion > 0x0500) {
        /* OS is greater than OS5, etc. ... */
        LOG (g_message ( "PALMOS >= 5\n" ));
        retval = gnome_pilot_conduit_sync_abs_new ("ContactsDB-PAdd",
    } else {
        LOG (g_message ( "PALMOS < 5\n" ));
        retval = gnome_pilot_conduit_sync_abs_new ("AddressDB", 0x61646472);
it will always print PALMOS >=5, even with my old m100.
Also: this will never work well, as this function can also be called
when no pda is connected (when you go to the configuration applet)
> But you'll need to combine this with a check for the actual database
> presence and the version of the application in use, before you proceed.
> Contacts v1.0 is not the same as Contacts v1.1.. 
I was afraid of this, I'm just hardcoding v1.1 as I have no idea how to
check this, marking as TODO
> On my Treo, "Contacts" is actually part of an application called "Phone
> v3.0" from ACCESS.. so there's quite a few options here to check and
> test for. 
> You'll need to check ALL of them to be absolutely sure, before you
> consider writing data to the user's Palm device, potentially corrupting
> it, swapping records or missing pieces. 
> 1. Check Palm version (if it supports it)
> 2. If it clearly is OS4 and earlier, use AddressDb.pdb
> 3. If not, or is one of the esoteric 4.x-XXxx versions (4.1-T for
> example), then you'll want to try checking the version of Contacts used
> on the device (if it exists) by opening up ContactsDb-PAdd via its
> CreatorID (PAdd). 
> If ContactsDb-PAdd.pdb does not exist, it doesn't mean the user is using
> one that supports "Address Book", they may just have never initialized
> the ContactsDb-PAdd database (new Palms will have a non-existant
> Contacts database until the moment you tap on the Contacts application
> for the very first time, so trying to open crid "PAdd" on a new Palm
> will still fail, *EVEN IF* AddressDB.pdb exists on the device (i.e. a
> user who has restored their "old" Palm data to their "new" Palm
> device... which happens quite often). 
> If this fails, try opening up AddressDB by its CreatorID (addr) and use
> that. 
> There are quite a few traps in here, but with careful planning, you'll
> be able to work out the specifics. Just be very careful about how you
> handle the presence of a non-OS4 device that may or may not report the
> correct information about whether it is running Contacts or not. 
Well, it seems it will be a little tricky. For the moment I'm just going
to ignore this and see if I can get everything syncing. When that's
done, I'll need your help to make a good integration.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]