1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
/*
* $Id: pi-location.h,v 1.1 2009/02/22 08:08:59 nicholas Exp $
*
* pi-location.h: Support for Palm Location databases (locLCusLocationDB, locLDefLocationDB and part of CalendarDB-PDat)
* (c) 2008, Jon Schewe
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Library General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
* General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _PILOT_LOCATION_H_
#define _PILOT_LOCATION_H_
#include <stdint.h>
#include <pi-appinfo.h>
#include <pi-buffer.h>
#ifdef __cplusplus
extern "C" {
#endif
enum DayOfWeek {
sunday, monday, tuesday, wednesday, thursday, friday, saturday
};
enum WeekOfMonth {
first, second, third, fourth, last
};
enum Month {
none, january, february, march, april, may, june, july, august,
september, october, november, december
};
typedef struct {
enum DayOfWeek dayOfWeek;
enum WeekOfMonth weekOfMonth;
enum Month month;
uint8_t unknown;
} DST_t;
enum CompassDirection { north, east, south, west };
typedef struct {
int16_t degrees; /* negative is N/E */
int16_t minutes; /* negative is N/E */
enum CompassDirection direction;
} EarthPoint_t;
typedef struct {
int16_t offset; /* Offset from GMT */
uint8_t t2; /* 00 - 03 */
DST_t dstStart;
DST_t dstEnd;
uint8_t dstObserved;
uint8_t t4;
uint8_t unknown; /* always 0x80 or 0x00 */
char* name; /* the name of the entry, null terminated, max 21 plus null */
} Timezone_t;
typedef struct {
Timezone_t tz;
uint8_t unknownExists;
uint8_t unknown; /* byte that sometimes exists before the lat/lon */
EarthPoint_t latitude;
EarthPoint_t longitude;
char* note; /* the note for this timezone, null terminated string or just null */
} Location_t;
extern void new_Timezone
PI_ARGS((Timezone_t *));
extern void new_Location
PI_ARGS((Location_t *));
extern void free_Timezone
PI_ARGS((Timezone_t *tz));
extern void free_Location
PI_ARGS((Location_t *loc));
extern int unpack_DST
PI_ARGS((DST_t *dst, const pi_buffer_t *buf));
extern int unpack_DST_p
PI_ARGS((DST_t *dst, const unsigned char *data, const size_t position));
extern int unpack_Timezone
PI_ARGS((Timezone_t *tz, const pi_buffer_t *buf));
extern int unpack_Timezone_p
PI_ARGS((Timezone_t *tz, const unsigned char *data, const size_t position));
extern int unpack_Location
PI_ARGS((Location_t *tz, const pi_buffer_t *buf));
extern int pack_DST
PI_ARGS((const DST_t *dst, pi_buffer_t *buf));
extern int pack_Timezone
PI_ARGS((const Timezone_t *tz, pi_buffer_t *buf));
extern int pack_Location
PI_ARGS((const Location_t *tz, pi_buffer_t *buf));
extern Timezone_t *dup_Timezone
PI_ARGS((const Timezone_t *tz));
extern int copy_Timezone
PI_ARGS((const Timezone_t *source, Timezone_t *dest));
extern int copy_Location
PI_ARGS((const Location_t *source, Location_t *dest));
#ifdef __cplusplus
};
#endif
#endif /* _PILOT_LOCATION_H_ */
/* vi: set ts=8 sw=4 sts=4 noexpandtab: cin */
/* ex: set tabstop=4 expandtab: */
/* Local Variables: */
/* indent-tabs-mode: t */
/* c-basic-offset: 8 */
/* End: */
|