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. ... */ } 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.. 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. -- David A. Desrosiers desrod gnu-designs com Skype username: setuid http://gnu-designs.com ”The palest ink is better than the most retentive memory.”- Old Chinese Proverb
Attachment:
signature.asc
Description: This is a digitally signed message part