A packed address book record on the palm consists of the following
structure:
typedef struct {
AddrOptionsType options; // see below
AddrDBRecordFlags flags;
unsigned char companyFieldOffset; // Offset from firstField
char firstField;
} AddrPackedDBRecord;
where
typedef union {
struct {
unsigned reserved:8;
unsigned displayPhoneForList:4; // The phone displayed for the
list view 0 - 4
unsigned phone5:4; // Which phone (home, work, car,
...)
unsigned phone4:4;
unsigned phone3:4;
unsigned phone2:4;
unsigned phone1:4;
} phones;
UInt32 phoneBits;
} AddrOptionsType;
and
typedef union {
struct {
unsigned reserved :13;
unsigned note :1; // 0x40000 set if record contains a note
handle
unsigned custom4 :1; // 0x20000 set if record contains a
custom4
unsigned custom3 :1; // 0x10000 set if record contains a
custom3
unsigned custom2 :1; // 0x4000 set if record contains a
custom2
unsigned custom1 :1; // 0x4000 set if record contains a
custom1
unsigned title :1; // 0x2000 set if record contains a title
unsigned country :1; // 0x1000 set if record contains a
birthday
unsigned zipCode :1; // 0x800 set if record contains a
birthday
unsigned state :1; // 0x400 set if record contains a
birthday
unsigned city :1; // 0x200 set if record contains a
birthday
unsigned address :1; // 0x100 set if record contains a
address
unsigned phone5 :1; // 0x80 set if record contains a phone5
unsigned phone4 :1; // 0x40 set if record contains a phone4
unsigned phone3 :1; // 0x20 set if record contains a phone3
unsigned phone2 :1; // 0x10 set if record contains a phone2
unsigned phone1 :1; // 0x8 set if record contains a phone1
unsigned company :1; // 0x4 set if record contains a company
unsigned firstName :1; // 0x2 set if record contains a
firstName
unsigned name :1; // 0x1 set if record contains a name
(bit 0)
} bits;
UInt32 allBits;
} AddrDBRecordFlags;
firstField is the start of a bunch of concatenated, null-terminated
strings (the one's whose bits are set in flags) in the order of name,
firstName, ..., note.
companyFieldOffset is the offset from the companyFieldOffset field itself
to the start of the company string, or 0 if there is no company string.
A packed date book record consists of the following structure:
// structure to hold an appointment -- PACKED -- in the database
// The actual order of the fields is:
// date / time 6 bytes
// flags 2 bytes
// alarm 2 bytes
// repeat 8 bytes
// exceptions 2(n+1) bytes
// description null terminated string
// note null terminated string
typedef struct {
ApptDateTimeType when;
ApptDBRecordFlags flags;
char firstField;
} ApptPackedDBRecordType;
typedef ApptPackedDBRecordType * ApptPackedDBRecordPtr;
where
typedef struct {
TimeType startTime; // Time the appointment starts
TimeType endTime; // Time the appointment ends
DateType date; // date of appointment
} ApptDateTimeType;
and
// bit flags for appointments
typedef struct {
unsigned padding1 :1; // 0x8000 used internally by
datebook
unsigned alarm :1; // 0x4000 set if record contains
alarm info
unsigned repeat :1; // 0x2000 set if record contains
repeat info
unsigned note :1; // 0x1000 set if record contains
a note
unsigned exceptions :1; // 0x0800 set if record contains
exceptions list
unsigned description :1; // 0x0400 set if record contains
a description
unsigned padding2 :10; // 0x03ff garbage (top 2 bits
used by datebook3/4)
} ApptDBRecordFlags;
The alarm, repeat, and exceptions are defined by:
// Alarm unit enum
typedef enum alarmTypes {
aauMinutes, // 0
aauHours, // 1
aauDays // 2
} AlarmUnitType;
// alarm structure (2 bytes)
typedef struct {
Int8 advance; // Alarm advance (-1 = no
alarm)
AlarmUnitType advanceUnit; // minutes, hours, days
} AlarmInfoType;
// Repeat type enum
enum repeatTypes {
repeatNone,
repeatDaily,
repeatWeekly,
repeatMonthlyByDay,
repeatMonthlyByDate,
repeatYearly};
typedef enum repeatTypes RepeatType;
// this structure specifies the repeating info for a
// repeating appointment (8 bytes)
typedef struct {
RepeatType repeatType; // daily, weekly,
monthlyByDay, etc.
Int8 padding1; // non-explicit pad-byte on
Palm
DateType repeatEndDate; // minus one if forever
unsigned char repeatFrequency; // i.e. every 2 days if
repeatType daily
unsigned char repeatOn; // monthlyByDay and
repeatWeekly only
unsigned char repeatStartOfWeek; // repeatWeekly only
Int8 padding2; // non-explicit pad-byte on
Palm
} RepeatInfoType;
typedef RepeatInfoType * RepeatInfoPtr;
// list of times for a repeating appointment when
// the appointment does NOT occurr (these times have
// been pulled off to individual appointments)
// used when you walk the repeating appointment list
// to handle changes that were applied to only one occurrance
typedef struct {
UInt16 numExceptions;
DateType exception; // there are numExceptions of these
} ExceptionsListType;
typedef ExceptionsListType * ExceptionsListPtr;
which is followed by the null-terminated description and note fields.
The when field is always present, the other 5 fields are present if
and only if their respective bits are set in the flags byte.
All this and much, much, more can be found in the address book and date book
examples which ship with the sdks.
-bob mckenzie
<[EMAIL PROTECTED]>
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of
dexMilano
Sent: Monday, September 11, 2000 7:48 AM
To: Palm Developer Forum
Subject: Re: DB structure of Palm Applications
Is there somewhere some documentation on them?
I have to write a simple application using those data.
Any suggestion ...
dex
<[EMAIL PROTECTED]> ha scritto nel messaggio
news:23687@palm-dev-forum...
>
> Ummm.. wouldn't it be in AddressDB.h ?
>
> dexMilano wrote:
> >
> > Do you know where I can find the structure of Address and Calendar
> > Application?
> >
> > thx
> >
> > dex
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/