summaryrefslogtreecommitdiffabout
path: root/gammu/emb/common/service/gsmcal.h
Unidiff
Diffstat (limited to 'gammu/emb/common/service/gsmcal.h') (more/less context) (show whitespace changes)
-rw-r--r--gammu/emb/common/service/gsmcal.h445
1 files changed, 445 insertions, 0 deletions
diff --git a/gammu/emb/common/service/gsmcal.h b/gammu/emb/common/service/gsmcal.h
new file mode 100644
index 0000000..067a4a4
--- a/dev/null
+++ b/gammu/emb/common/service/gsmcal.h
@@ -0,0 +1,445 @@
1/* (c) 2002-2004 by Marcin Wiacek */
2/* 5210 calendar IDs by Frederick Ros */
3
4#ifndef __gsm_cal_h
5#define __gsm_cal_h
6
7#include "../gsmcomon.h"
8
9/* ---------------------------- calendar ----------------------------------- */
10
11 #define GSM_CALENDAR_ENTRIES 16
12 #define MAX_CALENDAR_TEXT_LENGTH256 /* In 6310 max. 256 chars */
13
14/**
15 * Enum defines types of calendar notes
16 */
17typedef enum {
18 /**
19 * Reminder or Date
20 */
21 GSM_CAL_REMINDER=1,
22 /**
23 * Call
24 */
25 GSM_CAL_CALL,
26 /**
27 * Meeting
28 */
29 GSM_CAL_MEETING,
30 /**
31 * Birthday or Anniversary or Special Occasion
32 */
33 GSM_CAL_BIRTHDAY,
34 /**
35 * Memo or Miscellaneous
36 */
37 GSM_CAL_MEMO,
38 /**
39 * Travel
40 */
41 GSM_CAL_TRAVEL,
42 /**
43 * Vacation
44 */
45 GSM_CAL_VACATION,
46 /**
47 * Training - Athletism
48 */
49 GSM_CAL_T_ATHL,
50 /**
51 * Training - Ball Games
52 */
53 GSM_CAL_T_BALL,
54 /**
55 * Training - Cycling
56 */
57 GSM_CAL_T_CYCL,
58 /**
59 * Training - Budo
60 */
61 GSM_CAL_T_BUDO,
62 /**
63 * Training - Dance
64 */
65 GSM_CAL_T_DANC,
66 /**
67 * Training - Extreme Sports
68 */
69 GSM_CAL_T_EXTR,
70 /**
71 * Training - Football
72 */
73 GSM_CAL_T_FOOT,
74 /**
75 * Training - Golf
76 */
77 GSM_CAL_T_GOLF,
78 /**
79 * Training - Gym
80 */
81 GSM_CAL_T_GYM,
82 /**
83 * Training - Horse Race
84 */
85 GSM_CAL_T_HORS,
86 /**
87 * Training - Hockey
88 */
89 GSM_CAL_T_HOCK,
90 /**
91 * Training - Races
92 */
93 GSM_CAL_T_RACE,
94 /**
95 * Training - Rugby
96 */
97 GSM_CAL_T_RUGB,
98 /**
99 * Training - Sailing
100 */
101 GSM_CAL_T_SAIL,
102 /**
103 * Training - Street Games
104 */
105 GSM_CAL_T_STRE,
106 /**
107 * Training - Swimming
108 */
109 GSM_CAL_T_SWIM,
110 /**
111 * Training - Tennis
112 */
113 GSM_CAL_T_TENN,
114 /**
115 * Training - Travels
116 */
117 GSM_CAL_T_TRAV,
118 /**
119 * Training - Winter Games
120 */
121 GSM_CAL_T_WINT,
122 /**
123 * Alarm
124 */
125 GSM_CAL_ALARM,
126 /**
127 * Alarm repeating each day.
128 */
129 GSM_CAL_DAILY_ALARM
130} GSM_CalendarNoteType;
131
132/**
133 * One value of calendar event.
134 */
135typedef enum {
136 /**
137 * Date and time of event start.
138 */
139 CAL_START_DATETIME = 1,
140 /**
141 * Date and time of event end.
142 */
143 CAL_END_DATETIME,
144 /**
145 * Alarm date and time.
146 */
147 CAL_ALARM_DATETIME,
148 /**
149 * Date and time of silent alarm.
150 */
151 CAL_SILENT_ALARM_DATETIME,
152 /**
153 * Recurrance.
154 */
155 CAL_RECURRANCE,
156 /**
157 * Text.
158 */
159 CAL_TEXT,
160 /**
161 * Location.
162 */
163 CAL_LOCATION,
164 /**
165 * Phone number.
166 */
167 CAL_PHONE,
168 /**
169 * Whether this entry is private.
170 */
171 CAL_PRIVATE,
172 /**
173 * Related contact id.
174 */
175 CAL_CONTACTID,
176 /**
177 * Repeat each x'th day of week.
178 */
179 CAL_REPEAT_DAYOFWEEK,
180 /**
181 * Repeat each x'th day of month.
182 */
183 CAL_REPEAT_DAY,
184 /**
185 * Repeat x'th week of month.
186 */
187 CAL_REPEAT_WEEKOFMONTH,
188 /**
189 * Repeat x'th month.
190 */
191 CAL_REPEAT_MONTH,
192 /**
193 * Repeating frequency.
194 */
195 CAL_REPEAT_FREQUENCY,
196 /**
197 * Repeating start.
198 */
199 CAL_REPEAT_STARTDATE,
200 /**
201 * Repeating end.
202 */
203 CAL_REPEAT_STOPDATE
204} GSM_CalendarType;
205
206/**
207 * One value of calendar event.
208 */
209typedef struct {
210 /**
211 * Type of value.
212 */
213 GSM_CalendarTypeEntryType;
214 /**
215 * Text of value, if applicable.
216 */
217 unsigned char Text[(MAX_CALENDAR_TEXT_LENGTH + 1)*2];
218 /**
219 * Date and time of value, if applicable.
220 */
221 GSM_DateTime Date;
222 /**
223 * Number of value, if applicable.
224 */
225 unsigned int Number;
226} GSM_SubCalendarEntry;
227
228/**
229 * Calendar note values.
230 */
231typedef struct {
232 /**
233 * Type of calendar note.
234 */
235 GSM_CalendarNoteType Type;
236 /**
237 * Location in memory.
238 */
239 int Location;
240 /**
241 * Number of entries.
242 */
243 int EntriesNum;
244 /**
245 * Values of entries.
246 */
247 GSM_SubCalendarEntry Entries[GSM_CALENDAR_ENTRIES];
248} GSM_CalendarEntry;
249
250void GSM_CalendarFindDefaultTextTimeAlarmPhoneRecurrance(GSM_CalendarEntry *entry, int *Text, int *Time, int *Alarm, int *Phone, int *Recurrance, int *EndTime, int *Location);
251
252typedef enum {
253 Nokia_VCalendar = 1,
254 Siemens_VCalendar,
255 SonyEricsson_VCalendar
256} GSM_VCalendarVersion;
257
258GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note, bool header, GSM_VCalendarVersion Version);
259
260bool IsCalendarNoteFromThePast(GSM_CalendarEntry *note);
261
262typedef struct {
263 /**
264 * Monday = 1, Tuesday = 2,...
265 */
266 int StartDay;
267 /**
268 * 0 = no delete, 1 = after day,...
269 */
270 int AutoDelete;
271} GSM_CalendarSettings;
272
273/**
274 * Structure used for returning calendar status.
275 */
276typedef struct {
277 /**
278 * Number of used positions.
279 */
280 int Used;
281} GSM_CalendarStatus;
282
283
284/* ------------------------------ to-do ------------------------------------ */
285
286 #define GSM_TODO_ENTRIES 7
287 #define MAX_TODO_TEXT_LENGTH 50 /* Alcatel BE5 50 chars */
288
289/**
290 * Types of to do values. In parenthesis is member of @ref GSM_SubToDoEntry,
291 * where value is stored.
292 */
293typedef enum {
294 /**
295 * Due date. (Date)
296 */
297 TODO_END_DATETIME = 1,
298 /**
299 * Whether is completed. (Number)
300 */
301 TODO_COMPLETED,
302 /**
303 * When should alarm be fired (Date).
304 */
305 TODO_ALARM_DATETIME,
306 /**
307 * When should silent alarm be fired (Date).
308 */
309 TODO_SILENT_ALARM_DATETIME,
310 /**
311 * Text of to do (Text).
312 */
313 TODO_TEXT,
314 /**
315 * Whether entry is private (Number).
316 */
317 TODO_PRIVATE,
318 /**
319 * Category of entry (Number).
320 */
321 TODO_CATEGORY,
322 /**
323 * Related contact ID (Number).
324 */
325 TODO_CONTACTID,
326 /**
327 * Number to call (Text).
328 */
329 TODO_PHONE
330} GSM_ToDoType;
331
332/**
333 * Priority of to do.
334 */
335typedef enum {
336 GSM_Priority_High = 1,
337 GSM_Priority_Medium,
338 GSM_Priority_Low
339} GSM_ToDo_Priority;
340
341/**
342 * Value of to do entry.
343 */
344typedef struct {
345 /**
346 * Type of entry.
347 */
348 GSM_ToDoType EntryType;
349 /**
350 * Text of value, if appropriate, see @ref GSM_ToDoType.
351 */
352 unsigned char Text[(MAX_TODO_TEXT_LENGTH + 1)*2];
353 /**
354 * Date of value, if appropriate, see @ref GSM_ToDoType.
355 */
356 GSM_DateTime Date;
357 /**
358 * Number of value, if appropriate, see @ref GSM_ToDoType.
359 */
360 unsigned int Number;
361} GSM_SubToDoEntry;
362
363/**
364 * To do entry.
365 */
366typedef struct {
367 /**
368 * Priority of entry.
369 */
370 GSM_ToDo_Priority Priority;
371 /**
372 * Location in memory.
373 */
374 int Location;
375 /**
376 * Number of entries.
377 */
378 int EntriesNum;
379 /**
380 * Values of current entry.
381 */
382 GSM_SubToDoEntryEntries[GSM_TODO_ENTRIES];
383} GSM_ToDoEntry;
384
385void GSM_ToDoFindDefaultTextTimeAlarmCompleted(GSM_ToDoEntry *entry, int *Text, int *Alarm, int *Completed, int *EndTime, int *Phone);
386
387typedef enum {
388 Nokia_VToDo = 1,
389 SonyEricsson_VToDo
390} GSM_VToDoVersion;
391
392GSM_Error GSM_EncodeVTODO(char *Buffer, int *Length, GSM_ToDoEntry *note, bool header, GSM_VToDoVersion Version);
393
394/**
395 * Status of to do entries.
396 */
397typedef struct {
398 /**
399 * Number of used positions.
400 */
401 int Used;
402} GSM_ToDoStatus;
403
404/* --------------------------- note ---------------------------------------- */
405
406typedef struct {
407 int Location;
408 char Text[100];
409} GSM_NoteEntry;
410
411GSM_Error GSM_EncodeVNTFile(unsigned char *Buffer, int *Length, GSM_NoteEntry *Note);
412
413/* --------------------------- alarm --------------------------------------- */
414
415/**
416 * Alarm values.
417 */
418typedef struct {
419 /**
420 * Location where it is stored.
421 */
422 int Location;
423 /**
424 * Date and time of alarm.
425 */
426 GSM_DateTime DateTime;
427 /**
428 * Whether it repeats each day.
429 */
430 bool Repeating;
431 /**
432 * Text that is shown on display.
433 */
434 char Text[(MAX_CALENDAR_TEXT_LENGTH + 1) * 2];
435} GSM_Alarm;
436
437/* --------------------------- calendar & todo ----------------------------- */
438
439GSM_Error GSM_DecodeVCALENDAR_VTODO(unsigned char *Buffer, int *Pos, GSM_CalendarEntry *Calendar, GSM_ToDoEntry *ToDo, GSM_VCalendarVersion CalVer, GSM_VToDoVersion ToDoVer);
440
441#endif
442
443/* How should editor hadle tabs in this file? Add editor commands here.
444 * vim: noexpandtab sw=8 ts=8 sts=8:
445 */