Translated using Weblate.
[gammu.git] / include / gammu-backup.h
blob0334e066ebafd68399bc60bd9128c1959cde1e59
1 /**
2 * \file gammu-backup.h
3 * \author Michal Čihař
5 * Backup data and functions.
6 */
7 #ifndef __gammu_backup_h
8 #define __gammu_backup_h
10 /**
11 * \defgroup Backup Backup
12 * Backups manipulations.
15 #include <gammu-message.h>
16 #include <gammu-memory.h>
17 #include <gammu-calendar.h>
18 #include <gammu-bitmap.h>
19 #include <gammu-wap.h>
20 #include <gammu-settings.h>
21 #include <gammu-ringtone.h>
22 #include <gammu-config.h>
24 #ifdef GSM_ENABLE_BACKUP
26 /**
27 * Maximal number of SMSes in backup.
29 * \todo This should not be hardcoded.
31 #define GSM_BACKUP_MAX_SMS 100000
33 /**
34 * SMS backup data.
36 * \ingroup Backup
38 typedef struct {
39 /**
40 * List of SMS messages.
42 GSM_SMSMessage *SMS[GSM_BACKUP_MAX_SMS + 1];
43 } GSM_SMS_Backup;
45 /**
46 * Reads SMS backup file.
48 * \ingroup Backup
50 * \param FileName file name
51 * \param backup structure where backup will be stored
53 * \return Error code
55 GSM_Error GSM_ReadSMSBackupFile(const char *FileName, GSM_SMS_Backup * backup);
57 /**
58 * Adds data to SMS backup file.
60 * \ingroup Backup
62 * \param FileName file name
63 * \param backup structure holding backup data
65 * \return Error code
67 GSM_Error GSM_AddSMSBackupFile(const char *FileName, GSM_SMS_Backup * backup);
69 /**
70 * Clears SMS backup structure
72 * \ingroup Backup
74 * \param backup structure where backup data will be stored
76 void GSM_ClearSMSBackup(GSM_SMS_Backup * backup);
78 /**
79 * Deallocates all members of SMS backup structure
81 * \ingroup Backup
83 * \param backup structure where backup data will be stored
85 void GSM_FreeSMSBackup(GSM_SMS_Backup * backup);
87 /**
88 * Maximal number of phonebook entries in backup.
90 * \ingroup Backup
92 * \todo This should not be hardcoded.
94 #define GSM_BACKUP_MAX_PHONEPHONEBOOK 1001
95 /**
96 * Maximal number of SIM entries in backup.
98 * \ingroup Backup
100 * \todo This should not be hardcoded.
102 #define GSM_BACKUP_MAX_SIMPHONEBOOK 251
104 * Maximal number of caller groups in backup.
106 * \ingroup Backup
108 * \todo This should not be hardcoded.
110 #define GSM_BACKUP_MAX_CALLER 101
112 * Maximal number of SMSC in backup.
114 * \ingroup Backup
116 * \todo This should not be hardcoded.
118 #define GSM_BACKUP_MAX_SMSC 10
120 * Maximal number of WAP bookmarks in backup.
122 * \ingroup Backup
124 * \todo This should not be hardcoded.
126 #define GSM_BACKUP_MAX_WAPBOOKMARK 40
128 * Maximal number of WAP settings in backup.
130 * \ingroup Backup
132 * \todo This should not be hardcoded.
134 #define GSM_BACKUP_MAX_WAPSETTINGS 30
136 * Maximal number of MMS settings in backup.
138 * \ingroup Backup
140 * \todo This should not be hardcoded.
142 #define GSM_BACKUP_MAX_MMSSETTINGS 30
144 * Maximal number of SyncML settings in backup.
146 * \ingroup Backup
148 * \todo This should not be hardcoded.
150 #define GSM_BACKUP_MAX_SYNCMLSETTINGS 30
152 * Maximal number of chat settings in backup.
154 * \ingroup Backup
156 * \todo This should not be hardcoded.
158 #define GSM_BACKUP_MAX_CHATSETTINGS 30
160 * Maximal number of ringtones in backup.
162 * \ingroup Backup
164 * \todo This should not be hardcoded.
166 #define GSM_BACKUP_MAX_RINGTONES 30
168 * Maximal number of profiles in backup.
170 * \ingroup Backup
172 * \todo This should not be hardcoded.
174 #define GSM_BACKUP_MAX_PROFILES 10
176 * Maximal number of FM stations in backup.
178 * \ingroup Backup
180 * \todo This should not be hardcoded.
182 #define GSM_BACKUP_MAX_FMSTATIONS 20
184 * Maximal number of GPRS points in backup.
186 * \ingroup Backup
188 * \todo This should not be hardcoded.
190 #define GSM_BACKUP_MAX_GPRSPOINT 10
192 * Maximal number of notes in backup.
194 * \ingroup Backup
196 * \todo This should not be hardcoded.
198 #define GSM_BACKUP_MAX_NOTE 50
201 * Backup data.
203 * \ingroup Backup
205 typedef struct {
207 * IMEI of phone which has been backed up
209 char IMEI[GSM_MAX_IMEI_LENGTH];
211 * Model of phone which has been backed up
213 char Model[GSM_MAX_MODEL_LENGTH + GSM_MAX_VERSION_LENGTH];
215 * Name of program which created backup
217 char Creator[80];
219 * Timestamp of backup
221 GSM_DateTime DateTime;
223 * Whether timestamp is present
225 gboolean DateTimeAvailable;
227 * Original MD5 of backup from file
229 char MD5Original[100];
231 * Calculated MD5 of backup
233 char MD5Calculated[100];
235 * Phone phonebook
237 GSM_MemoryEntry *PhonePhonebook[GSM_BACKUP_MAX_PHONEPHONEBOOK + 1];
239 * SIM phonebook
241 GSM_MemoryEntry *SIMPhonebook[GSM_BACKUP_MAX_SIMPHONEBOOK + 1];
243 * Calendar
245 GSM_CalendarEntry *Calendar[GSM_MAXCALENDARTODONOTES + 1];
247 * Caller logos
249 GSM_Bitmap *CallerLogos[GSM_BACKUP_MAX_CALLER + 1];
251 * SMS configuration
253 GSM_SMSC *SMSC[GSM_BACKUP_MAX_SMSC + 1];
255 * WAP bookmarks
257 GSM_WAPBookmark *WAPBookmark[GSM_BACKUP_MAX_WAPBOOKMARK + 1];
259 * WAP settings
261 GSM_MultiWAPSettings *WAPSettings[GSM_BACKUP_MAX_WAPSETTINGS + 1];
263 * MMS settings
265 GSM_MultiWAPSettings *MMSSettings[GSM_BACKUP_MAX_MMSSETTINGS + 1];
267 * SyncMC settings
269 GSM_SyncMLSettings *SyncMLSettings[GSM_BACKUP_MAX_SYNCMLSETTINGS + 1];
271 * Chat settings
273 GSM_ChatSettings *ChatSettings[GSM_BACKUP_MAX_CHATSETTINGS + 1];
275 * Ringtones
277 GSM_Ringtone *Ringtone[GSM_BACKUP_MAX_RINGTONES + 1];
279 * To do tasks
281 GSM_ToDoEntry *ToDo[GSM_MAXCALENDARTODONOTES + 1];
283 * Progiles
285 GSM_Profile *Profiles[GSM_BACKUP_MAX_PROFILES + 1];
287 * FM stations
289 GSM_FMStation *FMStation[GSM_BACKUP_MAX_FMSTATIONS + 1];
291 * GPRS configurations
293 GSM_GPRSAccessPoint *GPRSPoint[GSM_BACKUP_MAX_GPRSPOINT + 1];
295 * Notes
297 GSM_NoteEntry *Note[GSM_BACKUP_MAX_NOTE + 1];
299 * Statup logo
301 GSM_Bitmap *StartupLogo;
303 * Operator logo
305 GSM_Bitmap *OperatorLogo;
306 } GSM_Backup;
309 * Backup data.
311 * \ingroup Backup
313 typedef enum {
315 * Compatibility with old gboolean used instead of format.
317 * File type is guessed for extension, non unicode format used
318 * for Gammu backup.
320 GSM_Backup_Auto = 0,
322 * Compatibility with old gboolean used instead of format.
324 * File type is guessed for extension, unicode format used
325 * for Gammu backup.
327 GSM_Backup_AutoUnicode = 1,
329 * LMB format, compatible with Logo manager, can store
330 * phonebooks and logos.
332 GSM_Backup_LMB,
334 * vCalendar standard, can store todo and calendar entries.
336 GSM_Backup_VCalendar,
338 * vCard standard, can store phone phonebook entries.
340 GSM_Backup_VCard,
342 * LDIF (LDAP Data Interchange Format), can store phone
343 * phonebook entries.
345 GSM_Backup_LDIF,
347 * iCalendar standard, can store todo and calendar entries.
349 GSM_Backup_ICS,
351 * Gammu own format can store almost anything from phone.
353 * This is ASCII version of the format, Unicode strings are HEX
354 * encoded. Use GSM_Backup_GammuUCS2 instead if possible.
356 GSM_Backup_Gammu,
358 * Gammu own format can store almost anything from phone.
360 * This is UCS2-BE version of the format.
362 GSM_Backup_GammuUCS2,
364 * vNote standard, can store phone notes.
366 GSM_Backup_VNote,
367 } GSM_BackupFormat;
370 * Save backup file.
372 * \ingroup Backup
374 * \param FileName Name of file (format is detected from it).
375 * \param Backup structure holding backup data
376 * \param Format Backup format.
378 * \return Error code
380 GSM_Error GSM_SaveBackupFile(char *FileName, GSM_Backup * Backup,
381 GSM_BackupFormat Format);
384 * Guesses backup format based on filename.
386 * \ingroup Backup
388 * \param FileName Name of backup filename.
389 * \param UseUnicode Whether to prefer unicode variant when guessing.
391 * \return Backup format on success -1 on error.
393 GSM_BackupFormat GSM_GuessBackupFormat(const char *FileName,
394 const gboolean UseUnicode);
397 * Reads data from backup file.
399 * \ingroup Backup
401 * \param FileName Name of file (format is detected from it).
402 * \param backup structure where backup data will be stored
403 * \param Format Format of backup. For Gammu backups, unicode subformats
404 * are ignored.
406 * \return Error code
408 GSM_Error GSM_ReadBackupFile(const char *FileName, GSM_Backup * backup,
409 GSM_BackupFormat Format);
412 * Clears backup structure
414 * \ingroup Backup
416 * \param backup structure where backup data will be stored
418 void GSM_ClearBackup(GSM_Backup * backup);
421 * Deallocates all members of backup structure
423 * \ingroup Backup
425 * \param backup structure where backup data will be stored
427 void GSM_FreeBackup(GSM_Backup * backup);
430 * Information about supported backup features.
432 * \ingroup Backup
434 typedef struct {
435 gboolean UseUnicode;
436 gboolean IMEI;
437 gboolean Model;
438 gboolean DateTime;
439 gboolean ToDo;
440 gboolean PhonePhonebook;
441 gboolean SIMPhonebook;
442 gboolean Calendar;
443 gboolean CallerLogos;
444 gboolean SMSC;
445 gboolean WAPBookmark;
446 gboolean Profiles;
447 gboolean WAPSettings;
448 gboolean MMSSettings;
449 gboolean SyncMLSettings;
450 gboolean ChatSettings;
451 gboolean Ringtone;
452 gboolean StartupLogo;
453 gboolean OperatorLogo;
454 gboolean FMStation;
455 gboolean GPRSPoint;
456 gboolean Note;
457 } GSM_Backup_Info;
460 * Gets information about format features.
462 * \param Format Format of backup.
463 * \param info Output information about backup features.
465 * \ingroup Backup
467 void GSM_GetBackupFormatFeatures(GSM_BackupFormat Format,
468 GSM_Backup_Info * info);
471 * Gets information about backup data features (resp. which data it contains).
473 * \param Format Format of backup.
474 * \param info Output information about backup features.
475 * \param backup Backup data to chech.
477 * \ingroup Backup
479 void GSM_GetBackupFileFeatures(GSM_BackupFormat Format, GSM_Backup_Info * info,
480 GSM_Backup * backup);
482 #endif
484 #endif
486 /* Editor configuration
487 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: