# Calendar

void GSM_CalendarFindDefaultTextTimeAlarmPhone(GSM_CalendarEntry *entry, int *Text, int *Time, int *Alarm, int *Phone, int *EndTime, int *Location)

  Finds inxedes of default entries.

GSM_Error GSM_EncodeVTODO(char *Buffer, const size_t buff_len, size_t *Length, const GSM_ToDoEntry *note, const gboolean header, const GSM_VToDoVersion Version)

  Encodes vTodo to buffer.

  Parameters:

    - Buffer – Storage for data.

    - buff_len – [in] Size of output buffer.

    - Length – Pointer to current position in data (will be incremented).

    - note – Note to encode.

    - header – Whether to include vCalendar header.

    - Version – Format of vTodo to create.

  Returns:

    Error code.

GSM_Error GSM_EncodeVCALENDAR(char *Buffer, const size_t buff_len, size_t *Length, GSM_CalendarEntry *note, const gboolean header, const GSM_VCalendarVersion Version)

  Encodes vCalendar to buffer.

  Parameters:

    - Buffer – Storage for data.

    - buff_len – [in] Size of output buffer.

    - Length – Pointer to current position in data (will be incremented).

    - note – Note to encode.

    - header – Whether to include vCalendar header.

    - Version – Format of vCalendar to create.

  Returns:

    Error code.

GSM_Error GSM_DecodeVNOTE(char *Buffer, size_t *Pos, GSM_NoteEntry *Note)

  Decodes vNote from buffer.

  Parameters:

    - Buffer – Buffer to decode.

    - Pos – Current position in buffer (will be updated).

    - Note – Storage for note entry.

  Returns:

    Error code.

GSM_Error GSM_EncodeVNTFile(char *Buffer, const size_t buff_len, size_t *Length, GSM_NoteEntry *Note)

  Encodes vNote to buffer.

  Parameters:

    - Buffer – Storage for data.

    - buff_len – [in] Size of output buffer.

    - Length – Pointer to current position in data (will be incremented).

    - Note – Note to encode.

  Returns:

    Error code.

GSM_Error GSM_DecodeVCALENDAR_VTODO(GSM_Debug_Info *di, char *Buffer, size_t *Pos, GSM_CalendarEntry *Calendar, GSM_ToDoEntry *ToDo, GSM_VCalendarVersion CalVer, GSM_VToDoVersion ToDoVer)

  Decodes vCalendar and vTodo buffer.

  Parameters:

    - di – Pointer to debugging description.

    - Buffer – Buffer to decode.

    - Pos – Current position in buffer (will be updated).

    - Calendar – Storage for calendar entry.

    - ToDo – Storage for todo entry.

    - CalVer – Format of vCalendar.

    - ToDoVer – Format of vTodo.

  Returns:

    Error code

gboolean GSM_IsCalendarNoteFromThePast(GSM_CalendarEntry *note)

  Detects whether calendar note is in past.

  Parameters:

    - note – Note to check.

  Returns:

    Whether entry is in past.

GSM_Error GSM_GetAlarm(GSM_StateMachine *s, GSM_Alarm *Alarm)

  Reads alarm set in phone.

  Parameters:

    - s – State machine pointer.

    - Alarm – Storage for alarm.

  Returns:

    Error code

GSM_Error GSM_SetAlarm(GSM_StateMachine *s, GSM_Alarm *Alarm)

  Sets alarm in phone.

  Parameters:

    - s – State machine pointer.

    - Alarm – Alarm to set.

  Returns:

    Error code

GSM_Error GSM_GetToDoStatus(GSM_StateMachine *s, GSM_ToDoStatus *status)

  Gets status of ToDos (count of used entries).

  Parameters:

    - s – State machine pointer.

    - status – Storage for todo status.

  Returns:

    Error code

GSM_Error GSM_GetToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo)

  Reads ToDo from phone.

  Parameters:

    - s – State machine pointer.

    - ToDo – Storage for note.

  Returns:

    Error code

GSM_Error GSM_GetNextToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, gboolean start)

  Reads ToDo from phone.

  Parameters:

    - s – State machine pointer.

    - ToDo – Storage for note, if start is FALSE, should contain data from previous read (at least position).

    - start – Whether we’re doing initial read or continue in reading.

  Returns:

    Error code

GSM_Error GSM_SetToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo)

  Sets ToDo in phone.

  Parameters:

    - s – State machine pointer.

    - ToDo – ToDo to set, should contain valid location.

  Returns:

    Error code

GSM_Error GSM_AddToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo)

  Adds ToDo in phone.

  Parameters:

    - s – State machine pointer.

    - ToDo – ToDo to add.

  Returns:

    Error code

GSM_Error GSM_DeleteToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo)

  Deletes ToDo entry in phone.

  Parameters:

    - s – State machine pointer.

    - ToDo – ToDo to delete, only location is actually used.

  Returns:

    Error code

GSM_Error GSM_DeleteAllToDo(GSM_StateMachine *s)

  Deletes all todo entries in phone.

  Parameters:

    - s – State machine pointer.

  Returns:

    Error code

GSM_Error GSM_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus *Status)

  Retrieves calendar status (number of used entries).

  Parameters:

    - s – State machine pointer.

    - Status – Storage for status.

  Returns:

    Error code

GSM_Error GSM_GetCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note)

  Retrieves calendar entry.

  Parameters:

    - s – State machine pointer.

    - Note – Storage for note.

  Returns:

    Error code

GSM_Error GSM_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note, gboolean start)

  Retrieves calendar entry. This is useful for continuous reading of all calendar entries.

  Parameters:

    - s – State machine pointer.

    - Note – Storage for note, if start is FALSE, should contain data from previous read (at least position).

    - start – Whether we’re doing initial read or continue in reading.

  Returns:

    Error code

GSM_Error GSM_SetCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note)

  Sets calendar entry

  Parameters:

    - s – State machine pointer.

    - Note – New note values, needs to contain valid position.

  Returns:

    Error code

GSM_Error GSM_AddCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note)

  Adds calendar entry.

  Parameters:

    - s – State machine pointer.

    - Note – Note to add.

  Returns:

    Error code

GSM_Error GSM_DeleteCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note)

  Deletes calendar entry.

  Parameters:

    - s – State machine pointer.

    - Note – Note to delete, must contain position.

  Returns:

    Error code

GSM_Error GSM_DeleteAllCalendar(GSM_StateMachine *s)

  Deletes all calendar entries.

  Parameters:

    - s – State machine pointer.

  Returns:

    Error code

GSM_Error GSM_GetCalendarSettings(GSM_StateMachine *s, GSM_CalendarSettings *settings)

  Reads calendar settings.

  Parameters:

    - s – State machine pointer.

    - settings – Storage for settings.

  Returns:

    Error code

GSM_Error GSM_SetCalendarSettings(GSM_StateMachine *s, GSM_CalendarSettings *settings)

  Sets calendar settings.

  Parameters:

    - s – State machine pointer.

    - settings – New calendar settings.

  Returns:

    Error code

GSM_Error GSM_GetNotesStatus(GSM_StateMachine *s, GSM_ToDoStatus *status)

  Retrieves notes status (number of used entries).

  Parameters:

    - s – State machine pointer.

    - status – Storage for status.

  Returns:

    Error code

GSM_Error GSM_GetNote(GSM_StateMachine *s, GSM_NoteEntry *Note)

  Retrieves notes entry.

  Parameters:

    - s – State machine pointer.

    - Note – Storage for note.

  Returns:

    Error code

GSM_Error GSM_GetNextNote(GSM_StateMachine *s, GSM_NoteEntry *Note, gboolean start)

  Retrieves note entry. This is useful for continuous reading of all notes entries.

  Parameters:

    - s – State machine pointer.

    - Note – Storage for note, if start is FALSE, should contain data from previous read (at least position).

    - start – Whether we’re doing initial read or continue in reading.

  Returns:

    Error code

GSM_Error GSM_SetNote(GSM_StateMachine *s, GSM_NoteEntry *Note)

  Sets note entry

  Parameters:

    - s – State machine pointer.

    - Note – New note values, needs to contain valid position.

  Returns:

    Error code

GSM_Error GSM_AddNote(GSM_StateMachine *s, GSM_NoteEntry *Note)

  Adds note entry.

  Parameters:

    - s – State machine pointer.

    - Note – Note to add.

  Returns:

    Error code

GSM_Error GSM_DeleteNote(GSM_StateMachine *s, GSM_NoteEntry *Note)

  Deletes note entry.

  Parameters:

    - s – State machine pointer.

    - Note – Note to delete, must contain position.

  Returns:

    Error code

GSM_Error GSM_DeleteAllNotes(GSM_StateMachine *s)

  Deletes all notes entries.

  Parameters:

    - s – State machine pointer.

  Returns:

    Error code

struct GSM_CalendarSettings

  Calendar settings structure.

  Public Members

  int StartDay

    Monday = 1, Tuesday = 2,…

  int AutoDelete

    0 = no delete, 1 = after day,…

struct GSM_ToDoStatus

  Status of to do entries.

  Public Members

  int Free

    Number of free positions.

  int Used

    Number of used positions.

struct GSM_CalendarStatus

  Structure used for returning calendar status.

  Public Members

  int Free

    Number of free positions.

  int Used

    Number of used positions.

enum GSM_CalendarNoteType

  Enum defines types of calendar notes

  Values:

  enumerator GSM_CAL_REMINDER

    Reminder or Date

  enumerator GSM_CAL_CALL

    Call

  enumerator GSM_CAL_MEETING

    Meeting

  enumerator GSM_CAL_BIRTHDAY

    Birthday or Anniversary or Special Occasion

  enumerator GSM_CAL_MEMO

    Memo or Miscellaneous

  enumerator GSM_CAL_TRAVEL

    Travel

  enumerator GSM_CAL_VACATION

    Vacation

  enumerator GSM_CAL_T_ATHL

    Training - Athletism

  enumerator GSM_CAL_T_BALL

    Training - Ball Games

  enumerator GSM_CAL_T_CYCL

    Training - Cycling

  enumerator GSM_CAL_T_BUDO

    Training - Budo

  enumerator GSM_CAL_T_DANC

    Training - Dance

  enumerator GSM_CAL_T_EXTR

    Training - Extreme Sports

  enumerator GSM_CAL_T_FOOT

    Training - Football

  enumerator GSM_CAL_T_GOLF

    Training - Golf

  enumerator GSM_CAL_T_GYM

    Training - Gym

  enumerator GSM_CAL_T_HORS

    Training - Horse Race

  enumerator GSM_CAL_T_HOCK

    Training - Hockey

  enumerator GSM_CAL_T_RACE

    Training - Races

  enumerator GSM_CAL_T_RUGB

    Training - Rugby

  enumerator GSM_CAL_T_SAIL

    Training - Sailing

  enumerator GSM_CAL_T_STRE

    Training - Street Games

  enumerator GSM_CAL_T_SWIM

    Training - Swimming

  enumerator GSM_CAL_T_TENN

    Training - Tennis

  enumerator GSM_CAL_T_TRAV

    Training - Travels

  enumerator GSM_CAL_T_WINT

    Training - Winter Games

  enumerator GSM_CAL_ALARM

    Alarm

  enumerator GSM_CAL_DAILY_ALARM

    Alarm repeating each day.

  enumerator GSM_CAL_SHOPPING

    Shopping

enum GSM_CalendarType

  One value of calendar event.

  Values:

  enumerator CAL_START_DATETIME

    Date and time of event start.

  enumerator CAL_END_DATETIME

    Date and time of event end.

  enumerator CAL_TONE_ALARM_DATETIME

    Alarm date and time.

  enumerator CAL_SILENT_ALARM_DATETIME

    Date and time of silent alarm.

  enumerator CAL_TEXT

    Text.

  enumerator CAL_DESCRIPTION

    Detailed description.

  enumerator CAL_LOCATION

    Location.

  enumerator CAL_PHONE

    Phone number.

  enumerator CAL_PRIVATE

    Whether this entry is private.

  enumerator CAL_CONTACTID

    Related contact id.

  enumerator CAL_REPEAT_DAYOFWEEK

    Repeat each x’th day of week.

  enumerator CAL_REPEAT_DAY

    Repeat each x’th day of month.

  enumerator CAL_REPEAT_DAYOFYEAR

    Repeat each x’th day of year.

  enumerator CAL_REPEAT_WEEKOFMONTH

    Repeat x’th week of month.

  enumerator CAL_REPEAT_MONTH

    Repeat x’th month.

  enumerator CAL_REPEAT_FREQUENCY

    Repeating frequency.

  enumerator CAL_REPEAT_STARTDATE

    Repeating start.

  enumerator CAL_REPEAT_STOPDATE

    Repeating end.

  enumerator CAL_REPEAT_COUNT

    Number of repetitions.

  enumerator CAL_LUID

    IrMC LUID which can be used for synchronisation.

  enumerator CAL_LAST_MODIFIED

    Date and time of last modification.

struct GSM_SubCalendarEntry

  One value of calendar event.

  Public Members

  GSM_CalendarType EntryType

    Type of value.

  GSM_DateTime Date

    Date and time of value, if applicable.

  int Number

    Number of value, if applicable.

  GSM_Error AddError

    During adding SubEntry Gammu can return here info, if it was done OK

  unsigned char Text[(GSM_MAX_CALENDAR_TEXT_LENGTH + 1) * 2]

    Text of value, if applicable.

struct GSM_CalendarEntry

  Calendar note values.

  Public Members

  GSM_CalendarNoteType Type

    Type of calendar note.

  int Location

    Location in memory.

  int EntriesNum

    Number of entries.

  GSM_SubCalendarEntry Entries[GSM_CALENDAR_ENTRIES]

    Values of entries.

enum GSM_ToDoType

  Types of to do values. In parenthesis is member of GSM_SubToDoEntry, where value is stored.

  Values:

  enumerator TODO_END_DATETIME

    Due date (Date).

  enumerator TODO_COMPLETED

    Whether is completed (Number).

  enumerator TODO_ALARM_DATETIME

    When should alarm be fired (Date).

  enumerator TODO_SILENT_ALARM_DATETIME

    When should silent alarm be fired (Date).

  enumerator TODO_TEXT

    Text of to do (Text).

  enumerator TODO_DESCRIPTION

    Description of to do (Text).

  enumerator TODO_LOCATION

    Location of to do (Text).

  enumerator TODO_PRIVATE

    Whether entry is private (Number).

  enumerator TODO_CATEGORY

    Category of entry (Number).

  enumerator TODO_CONTACTID

    Related contact ID (Number).

  enumerator TODO_PHONE

    Number to call (Text).

  enumerator TODO_LUID

    IrMC LUID which can be used for synchronisation (Text).

  enumerator TODO_LAST_MODIFIED

    Date and time of last modification (Date).

  enumerator TODO_START_DATETIME

    Start date (Date).

  enumerator TODO_COMPLETED_DATETIME

    Completed date (Date).

enum GSM_ToDo_Priority

  Priority of to do.

  Values:

  enumerator GSM_Priority_None
  enumerator GSM_Priority_High
  enumerator GSM_Priority_Medium
  enumerator GSM_Priority_Low
  enumerator GSM_Priority_INVALID

struct GSM_SubToDoEntry

  Value of to do entry.

  Public Members

  GSM_ToDoType EntryType

    Type of entry.

  GSM_DateTime Date

    Date of value, if appropriate, see GSM_ToDoType.

  unsigned int Number

    Number of value, if appropriate, see GSM_ToDoType.

  unsigned char Text[(GSM_MAX_TODO_TEXT_LENGTH + 1) * 2]

    Text of value, if appropriate, see GSM_ToDoType.

struct GSM_ToDoEntry

  To do entry.

  Public Members

  GSM_CalendarNoteType Type

    Type of todo note.

  GSM_ToDo_Priority Priority

    Priority of entry.

  int Location

    Location in memory.

  int EntriesNum

    Number of entries.

  GSM_SubToDoEntry Entries[GSM_TODO_ENTRIES]

    Values of current entry.

struct GSM_NoteEntry

  Note entry.

  Public Members

  int Location

    Location in memory.

  char Text[(GSM_MAX_NOTE_TEXT_LENGTH + 1) * 2]

    Text of note.

struct GSM_Alarm

  Alarm values.

  Public Members

  int Location

    Location where it is stored.

  GSM_DateTime DateTime

    Date and time of alarm.

  gboolean Repeating

    Whether it repeats each day.

  unsigned char Text[(GSM_MAX_CALENDAR_TEXT_LENGTH + 1) * 2]

    Text that is shown on display.

enum GSM_VToDoVersion

  Format of vTodo.

  Values:

  enumerator Nokia_VToDo

    Format compatible with Nokia - limited subsed of standard.

  enumerator SonyEricsson_VToDo

    Format compatible with SonyEricsson - complete standard.

  enumerator Mozilla_VToDo

    Format compatible with Mozilla - iCalendar based.

enum GSM_VCalendarVersion

  Format of vCalendar export.

  Values:

  enumerator Nokia_VCalendar

    vCalendar specially hacked for Nokia .

  enumerator Siemens_VCalendar

    vCalendar specially hacked for Siemens.

  enumerator SonyEricsson_VCalendar

    Standard vCalendar (which works for Sony-Ericsson phones)

  enumerator Mozilla_iCalendar

    iCalendar as compatible with Mozilla.