Imported gammu 0.90.7
[gammu.git] / common / service / gsmcal.h
blobfbeaa82efdffa922ef1bb0370129f707ed0e9459
1 #ifndef __gsm_calendar_h
2 #define __gsm_calendar_h
4 #include "../gsmcomon.h"
6 /* ---------------------------- calendar ----------------------------------- */
8 #define GSM_CALENDAR_ENTRIES 16
9 #define MAX_CALENDAR_TEXT_LENGTH 256 /* In 6310 max. 256 chars */
11 /**
12 * Define enums for Calendar Note types.
14 typedef enum {
15 /**
16 * Reminder or Date
18 GCN_REMINDER=1,
19 /**
20 * Call
22 GCN_CALL,
23 /**
24 * Meeting
26 GCN_MEETING,
27 /**
28 * Birthday or Anniversary or Special Occasion
30 GCN_BIRTHDAY,
31 /**
32 * Memo or Miscellaneous
34 GCN_MEMO,
35 /**
36 * Travel
38 GCN_TRAVEL,
39 /**
40 * Vacation
42 GCN_VACATION,
43 /**
44 * Training - Athletism
46 GCN_T_ATHL,
47 /**
48 * Training - Ball Games
50 GCN_T_BALL,
51 /**
52 * Training - Cycling
54 GCN_T_CYCL,
55 /**
56 * Training - Budo
58 GCN_T_BUDO,
59 /**
60 * Training - Dance
62 GCN_T_DANC,
63 /**
64 * Training - Extreme Sports
66 GCN_T_EXTR,
67 /**
68 * Training - Football
70 GCN_T_FOOT,
71 /**
72 * Training - Golf
74 GCN_T_GOLF,
75 /**
76 * Training - Gym
78 GCN_T_GYM,
79 /**
80 * Training - Horse Race
82 GCN_T_HORS,
83 /**
84 * Training - Hockey
86 GCN_T_HOCK,
87 /**
88 * Training - Races
90 GCN_T_RACE,
91 /**
92 * Training - Rugby
94 GCN_T_RUGB,
95 /**
96 * Training - Sailing
98 GCN_T_SAIL,
99 /**
100 * Training - Street Games
102 GCN_T_STRE,
104 * Training - Swimming
106 GCN_T_SWIM,
108 * Training - Tennis
110 GCN_T_TENN,
112 * Training - Travels
114 GCN_T_TRAV,
116 * Training - Winter Games
118 GCN_T_WINT,
120 * Alarm
122 GCN_ALARM,
124 * Alarm repeating each day.
126 GCN_DAILY_ALARM
127 } GSM_CalendarNoteType;
130 * One value of calendar event.
132 typedef enum {
134 * Date and time of event start.
136 CAL_START_DATETIME = 1,
138 * Date and time of event end.
140 CAL_END_DATETIME,
142 * Alarm date and time.
144 CAL_ALARM_DATETIME,
146 * Date and time of silent alarm.
148 CAL_SILENT_ALARM_DATETIME,
150 * Recurrance.
152 CAL_RECURRANCE,
154 * Text.
156 CAL_TEXT,
158 * Location.
160 CAL_LOCATION,
162 * Phone number.
164 CAL_PHONE,
166 * Whether this entry is private.
168 CAL_PRIVATE,
170 * Related contact id.
172 CAL_CONTACTID,
174 * Repeat each x'th day of week.
176 CAL_REPEAT_DAYOFWEEK,
178 * Repeat each x'th day of month.
180 CAL_REPEAT_DAY,
182 * Repeat x'th week of month.
184 CAL_REPEAT_WEEKOFMONTH,
186 * Repeat x'th month.
188 CAL_REPEAT_MONTH,
190 * Repeating frequency.
192 CAL_REPEAT_FREQUENCY,
194 * Repeating start.
196 CAL_REPEAT_STARTDATE,
198 * Repeating end.
200 CAL_REPEAT_STOPDATE,
201 } GSM_CalendarType;
204 * One value of calendar event.
206 typedef struct {
208 * Type of value.
210 GSM_CalendarType EntryType;
212 * Text of value, if applicable.
214 unsigned char Text[(MAX_CALENDAR_TEXT_LENGTH + 1)*2];
216 * Date and time of value, if applicable.
218 GSM_DateTime Date;
220 * Number of value, if applicable.
222 unsigned int Number;
223 } GSM_SubCalendarEntry;
226 * Calendar note values.
228 typedef struct {
230 * Type of calendar note.
232 GSM_CalendarNoteType Type;
234 * Location in memory.
236 int Location;
238 * Number of entries.
240 int EntriesNum;
242 * Values of entries.
244 GSM_SubCalendarEntry Entries[GSM_CALENDAR_ENTRIES];
245 } GSM_CalendarEntry;
247 void GSM_CalendarFindDefaultTextTimeAlarmPhoneRecurrance(GSM_CalendarEntry *entry, int *Text, int *Time, int *Alarm, int *Phone, int *Recurrance, int *EndTime, int *Location);
249 typedef enum {
250 Nokia_VCalendar = 1,
251 Siemens_VCalendar,
252 SonyEricsson_VCalendar
253 } GSM_VCalendarVersion;
255 GSM_Error GSM_EncodeVCALENDAR(char *Buffer, int *Length, GSM_CalendarEntry *note, bool header, GSM_VCalendarVersion Version);
257 bool IsCalendarNoteFromThePast(GSM_CalendarEntry *note);
259 typedef struct {
261 * Monday = 1, Tuesday = 2,...
263 int StartDay;
265 * 0 = no delete, 1 = after day,...
267 int AutoDelete;
268 } GSM_CalendarSettings;
271 * Structure used for returning calendar status.
273 typedef struct {
275 * Number of used positions.
277 int Used;
278 } GSM_CalendarStatus;
281 /* ------------------------------ to-do ------------------------------------ */
283 #define GSM_TODO_ENTRIES 7
284 #define MAX_TODO_TEXT_LENGTH 50 /* Alcatel BE5 50 chars */
287 * Types of to do values. In parenthesis is member of @ref GSM_SubToDoEntry,
288 * where value is stored.
290 typedef enum {
292 * Due date. (Date)
294 TODO_END_DATETIME = 1,
296 * Whether is completed. (Number)
298 TODO_COMPLETED,
300 * When should alarm be fired (Date).
302 TODO_ALARM_DATETIME,
304 * When should silent alarm be fired (Date).
306 TODO_SILENT_ALARM_DATETIME,
308 * Text of to do (Text).
310 TODO_TEXT,
312 * Whether entry is private (Number).
314 TODO_PRIVATE,
316 * Category of entry (Number).
318 TODO_CATEGORY,
320 * Related contact ID (Number).
322 TODO_CONTACTID,
324 * Number to call (Text).
326 TODO_PHONE
327 } GSM_ToDoType;
330 * Priority of to do.
332 typedef enum {
333 GSM_Priority_High = 1,
334 GSM_Priority_Medium,
335 GSM_Priority_Low
336 } GSM_ToDo_Priority;
339 * Value of to do entry.
341 typedef struct {
343 * Type of entry.
345 GSM_ToDoType EntryType;
347 * Text of value, if appropriate, see @ref GSM_ToDoType.
349 unsigned char Text[(MAX_TODO_TEXT_LENGTH + 1)*2];
351 * Date of value, if appropriate, see @ref GSM_ToDoType.
353 GSM_DateTime Date;
355 * Number of value, if appropriate, see @ref GSM_ToDoType.
357 unsigned int Number;
358 } GSM_SubToDoEntry;
361 * To do entry.
363 typedef struct {
365 * Priority of entry.
367 GSM_ToDo_Priority Priority;
369 * Location in memory.
371 int Location;
373 * Number of entries.
375 int EntriesNum;
377 * Values of current entry.
379 GSM_SubToDoEntry Entries[GSM_TODO_ENTRIES];
380 } GSM_ToDoEntry;
382 void GSM_ToDoFindDefaultTextTimeAlarmCompleted(GSM_ToDoEntry *entry, int *Text, int *Alarm, int *Completed, int *EndTime, int *Phone);
384 typedef enum {
385 Nokia_VToDo = 1,
386 SonyEricsson_VToDo
387 } GSM_VToDoVersion;
389 GSM_Error GSM_EncodeVTODO(char *Buffer, int *Length, GSM_ToDoEntry *note, bool header, GSM_VToDoVersion Version);
392 * Status of to do entries.
394 typedef struct {
396 * Number of used positions.
398 int Used;
399 } GSM_ToDoStatus;
401 /* --------------------------- note ---------------------------------------- */
403 typedef struct {
404 int Location;
405 char Text[100];
406 } GSM_NoteEntry;
408 GSM_Error GSM_EncodeVNTFile(unsigned char *Buffer, int *Length, GSM_NoteEntry *Note);
410 /* --------------------------- alarm --------------------------------------- */
413 * Alarm values.
415 typedef struct {
417 * Location where it is stored.
419 int Location;
421 * Date and time of alarm.
423 GSM_DateTime DateTime;
425 * Whether it repeats each day.
427 bool Repeating;
429 * Text that is shown on display.
431 char Text[(MAX_CALENDAR_TEXT_LENGTH + 1) * 2];
432 } GSM_Alarm;
434 /* --------------------------- calendar & todo ----------------------------- */
436 GSM_Error GSM_DecodeVCALENDAR_VTODO(unsigned char *Buffer, int *Pos, GSM_CalendarEntry *Calendar, GSM_ToDoEntry *ToDo, GSM_VCalendarVersion CalVer, GSM_VToDoVersion ToDoVer);
438 #endif
440 /* How should editor hadle tabs in this file? Add editor commands here.
441 * vim: noexpandtab sw=8 ts=8 sts=8: