5 * Backup data and functions.
7 #ifndef __gammu_backup_h
8 #define __gammu_backup_h
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
27 * Maximal number of SMSes in backup.
29 * \todo This should not be hardcoded.
31 #define GSM_BACKUP_MAX_SMS 100000
40 * List of SMS messages.
42 GSM_SMSMessage
*SMS
[GSM_BACKUP_MAX_SMS
+ 1];
46 * Reads SMS backup file.
50 * \param FileName file name
51 * \param backup structure where backup will be stored
55 GSM_Error
GSM_ReadSMSBackupFile(const char *FileName
, GSM_SMS_Backup
* backup
);
58 * Adds data to SMS backup file.
62 * \param FileName file name
63 * \param backup structure holding backup data
67 GSM_Error
GSM_AddSMSBackupFile(const char *FileName
, GSM_SMS_Backup
* backup
);
70 * Clears SMS backup structure
74 * \param backup structure where backup data will be stored
76 void GSM_ClearSMSBackup(GSM_SMS_Backup
* backup
);
79 * Deallocates all members of SMS backup structure
83 * \param backup structure where backup data will be stored
85 void GSM_FreeSMSBackup(GSM_SMS_Backup
* backup
);
88 * Maximal number of phonebook entries in backup.
92 * \todo This should not be hardcoded.
94 #define GSM_BACKUP_MAX_PHONEPHONEBOOK 1001
96 * Maximal number of SIM entries in backup.
100 * \todo This should not be hardcoded.
102 #define GSM_BACKUP_MAX_SIMPHONEBOOK 251
104 * Maximal number of caller groups in backup.
108 * \todo This should not be hardcoded.
110 #define GSM_BACKUP_MAX_CALLER 101
112 * Maximal number of SMSC in backup.
116 * \todo This should not be hardcoded.
118 #define GSM_BACKUP_MAX_SMSC 10
120 * Maximal number of WAP bookmarks in backup.
124 * \todo This should not be hardcoded.
126 #define GSM_BACKUP_MAX_WAPBOOKMARK 40
128 * Maximal number of WAP settings in backup.
132 * \todo This should not be hardcoded.
134 #define GSM_BACKUP_MAX_WAPSETTINGS 30
136 * Maximal number of MMS settings in backup.
140 * \todo This should not be hardcoded.
142 #define GSM_BACKUP_MAX_MMSSETTINGS 30
144 * Maximal number of SyncML settings in backup.
148 * \todo This should not be hardcoded.
150 #define GSM_BACKUP_MAX_SYNCMLSETTINGS 30
152 * Maximal number of chat settings in backup.
156 * \todo This should not be hardcoded.
158 #define GSM_BACKUP_MAX_CHATSETTINGS 30
160 * Maximal number of ringtones in backup.
164 * \todo This should not be hardcoded.
166 #define GSM_BACKUP_MAX_RINGTONES 30
168 * Maximal number of profiles in backup.
172 * \todo This should not be hardcoded.
174 #define GSM_BACKUP_MAX_PROFILES 10
176 * Maximal number of FM stations in backup.
180 * \todo This should not be hardcoded.
182 #define GSM_BACKUP_MAX_FMSTATIONS 20
184 * Maximal number of GPRS points in backup.
188 * \todo This should not be hardcoded.
190 #define GSM_BACKUP_MAX_GPRSPOINT 10
192 * Maximal number of notes in backup.
196 * \todo This should not be hardcoded.
198 #define GSM_BACKUP_MAX_NOTE 50
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
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];
237 GSM_MemoryEntry
*PhonePhonebook
[GSM_BACKUP_MAX_PHONEPHONEBOOK
+ 1];
241 GSM_MemoryEntry
*SIMPhonebook
[GSM_BACKUP_MAX_SIMPHONEBOOK
+ 1];
245 GSM_CalendarEntry
*Calendar
[GSM_MAXCALENDARTODONOTES
+ 1];
249 GSM_Bitmap
*CallerLogos
[GSM_BACKUP_MAX_CALLER
+ 1];
253 GSM_SMSC
*SMSC
[GSM_BACKUP_MAX_SMSC
+ 1];
257 GSM_WAPBookmark
*WAPBookmark
[GSM_BACKUP_MAX_WAPBOOKMARK
+ 1];
261 GSM_MultiWAPSettings
*WAPSettings
[GSM_BACKUP_MAX_WAPSETTINGS
+ 1];
265 GSM_MultiWAPSettings
*MMSSettings
[GSM_BACKUP_MAX_MMSSETTINGS
+ 1];
269 GSM_SyncMLSettings
*SyncMLSettings
[GSM_BACKUP_MAX_SYNCMLSETTINGS
+ 1];
273 GSM_ChatSettings
*ChatSettings
[GSM_BACKUP_MAX_CHATSETTINGS
+ 1];
277 GSM_Ringtone
*Ringtone
[GSM_BACKUP_MAX_RINGTONES
+ 1];
281 GSM_ToDoEntry
*ToDo
[GSM_MAXCALENDARTODONOTES
+ 1];
285 GSM_Profile
*Profiles
[GSM_BACKUP_MAX_PROFILES
+ 1];
289 GSM_FMStation
*FMStation
[GSM_BACKUP_MAX_FMSTATIONS
+ 1];
291 * GPRS configurations
293 GSM_GPRSAccessPoint
*GPRSPoint
[GSM_BACKUP_MAX_GPRSPOINT
+ 1];
297 GSM_NoteEntry
*Note
[GSM_BACKUP_MAX_NOTE
+ 1];
301 GSM_Bitmap
*StartupLogo
;
305 GSM_Bitmap
*OperatorLogo
;
315 * Compatibility with old gboolean used instead of format.
317 * File type is guessed for extension, non unicode format used
322 * Compatibility with old gboolean used instead of format.
324 * File type is guessed for extension, unicode format used
327 GSM_Backup_AutoUnicode
= 1,
329 * LMB format, compatible with Logo manager, can store
330 * phonebooks and logos.
334 * vCalendar standard, can store todo and calendar entries.
336 GSM_Backup_VCalendar
,
338 * vCard standard, can store phone phonebook entries.
342 * LDIF (LDAP Data Interchange Format), can store phone
347 * iCalendar standard, can store todo and calendar entries.
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.
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.
374 * \param FileName Name of file (format is detected from it).
375 * \param Backup structure holding backup data
376 * \param Format Backup format.
380 GSM_Error
GSM_SaveBackupFile(char *FileName
, GSM_Backup
* Backup
,
381 GSM_BackupFormat Format
);
384 * Guesses backup format based on filename.
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.
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
408 GSM_Error
GSM_ReadBackupFile(const char *FileName
, GSM_Backup
* backup
,
409 GSM_BackupFormat Format
);
412 * Clears backup structure
416 * \param backup structure where backup data will be stored
418 void GSM_ClearBackup(GSM_Backup
* backup
);
421 * Deallocates all members of backup structure
425 * \param backup structure where backup data will be stored
427 void GSM_FreeBackup(GSM_Backup
* backup
);
430 * Information about supported backup features.
440 gboolean PhonePhonebook
;
441 gboolean SIMPhonebook
;
443 gboolean CallerLogos
;
445 gboolean WAPBookmark
;
447 gboolean WAPSettings
;
448 gboolean MMSSettings
;
449 gboolean SyncMLSettings
;
450 gboolean ChatSettings
;
452 gboolean StartupLogo
;
453 gboolean OperatorLogo
;
460 * Gets information about format features.
462 * \param Format Format of backup.
463 * \param info Output information about backup features.
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.
479 void GSM_GetBackupFileFeatures(GSM_BackupFormat Format
, GSM_Backup_Info
* info
,
480 GSM_Backup
* backup
);
486 /* Editor configuration
487 * vim: noexpandtab sw=8 ts=8 sts=8 tw=72: