-rw-r--r-- | gammu/emb/common/service/backup/backgen.h | 4 | ||||
-rw-r--r-- | gammu/emb/common/service/backup/backtext.c | 221 | ||||
-rw-r--r-- | gammu/emb/common/service/backup/gsmback.c | 36 | ||||
-rw-r--r-- | gammu/emb/common/service/backup/gsmback.h | 2 | ||||
-rw-r--r-- | gammu/emb/common/service/gsmcal.h | 2 | ||||
-rw-r--r-- | gammu/emb/common/service/gsmdata.c | 120 | ||||
-rw-r--r-- | gammu/emb/common/service/gsmdata.h | 2 | ||||
-rw-r--r-- | gammu/emb/common/service/gsmlogo.c | 47 | ||||
-rw-r--r-- | gammu/emb/common/service/gsmlogo.h | 28 | ||||
-rw-r--r-- | gammu/emb/common/service/gsmmisc.h | 7 | ||||
-rw-r--r-- | gammu/emb/common/service/gsmring.c | 45 | ||||
-rw-r--r-- | gammu/emb/common/service/gsmring.h | 8 | ||||
-rw-r--r-- | gammu/emb/common/service/sms/gsmmulti.c | 5 | ||||
-rw-r--r-- | gammu/emb/common/service/sms/gsmmulti.h | 11 | ||||
-rw-r--r-- | gammu/emb/common/service/sms/gsmsms.c | 5 | ||||
-rw-r--r-- | gammu/emb/common/service/sms/gsmsms.h | 5 |
16 files changed, 491 insertions, 57 deletions
diff --git a/gammu/emb/common/service/backup/backgen.h b/gammu/emb/common/service/backup/backgen.h index 9d7d973..9a930fc 100644 --- a/gammu/emb/common/service/backup/backgen.h +++ b/gammu/emb/common/service/backup/backgen.h | |||
@@ -12,46 +12,50 @@ | |||
12 | #include "../gsmdata.h" | 12 | #include "../gsmdata.h" |
13 | #include "../gsmprof.h" | 13 | #include "../gsmprof.h" |
14 | #include "../gsmmisc.h" | 14 | #include "../gsmmisc.h" |
15 | #include "../sms/gsmsms.h" | 15 | #include "../sms/gsmsms.h" |
16 | 16 | ||
17 | #define GSM_BACKUP_MAX_PHONEPHONEBOOK 501 | 17 | #define GSM_BACKUP_MAX_PHONEPHONEBOOK 501 |
18 | #define GSM_BACKUP_MAX_SIMPHONEBOOK 251 | 18 | #define GSM_BACKUP_MAX_SIMPHONEBOOK 251 |
19 | #define GSM_BACKUP_MAX_CALLER 6 | 19 | #define GSM_BACKUP_MAX_CALLER 6 |
20 | #define GSM_BACKUP_MAX_SMSC 10 | 20 | #define GSM_BACKUP_MAX_SMSC 10 |
21 | #define GSM_BACKUP_MAX_WAPBOOKMARK40 | 21 | #define GSM_BACKUP_MAX_WAPBOOKMARK40 |
22 | #define GSM_BACKUP_MAX_WAPSETTINGS30 | 22 | #define GSM_BACKUP_MAX_WAPSETTINGS30 |
23 | #define GSM_BACKUP_MAX_MMSSETTINGS30 | 23 | #define GSM_BACKUP_MAX_MMSSETTINGS30 |
24 | #define GSM_BACKUP_MAX_SYNCMLSETTINGS10 | ||
25 | #define GSM_BACKUP_MAX_CHATSETTINGS10 | ||
24 | #define GSM_BACKUP_MAX_RINGTONES30 | 26 | #define GSM_BACKUP_MAX_RINGTONES30 |
25 | #define GSM_BACKUP_MAX_PROFILES 10 | 27 | #define GSM_BACKUP_MAX_PROFILES 10 |
26 | #define GSM_BACKUP_MAX_FMSTATIONS20 | 28 | #define GSM_BACKUP_MAX_FMSTATIONS20 |
27 | #define GSM_BACKUP_MAX_GPRSPOINT10 | 29 | #define GSM_BACKUP_MAX_GPRSPOINT10 |
28 | #define GSM_BACKUP_MAX_NOTE 10/* FIXME */ | 30 | #define GSM_BACKUP_MAX_NOTE 10/* FIXME */ |
29 | 31 | ||
30 | typedef struct { | 32 | typedef struct { |
31 | char IMEI [MAX_IMEI_LENGTH]; | 33 | char IMEI [MAX_IMEI_LENGTH]; |
32 | char Model [MAX_MODEL_LENGTH+MAX_VERSION_LENGTH]; | 34 | char Model [MAX_MODEL_LENGTH+MAX_VERSION_LENGTH]; |
33 | char Creator [80]; | 35 | char Creator [80]; |
34 | GSM_DateTime DateTime; | 36 | GSM_DateTime DateTime; |
35 | bool DateTimeAvailable; | 37 | bool DateTimeAvailable; |
36 | char MD5Original[100]; | 38 | char MD5Original[100]; |
37 | char MD5Calculated[100]; | 39 | char MD5Calculated[100]; |
38 | GSM_MemoryEntry *PhonePhonebook[GSM_BACKUP_MAX_PHONEPHONEBOOK + 1]; | 40 | GSM_MemoryEntry *PhonePhonebook[GSM_BACKUP_MAX_PHONEPHONEBOOK + 1]; |
39 | GSM_MemoryEntry *SIMPhonebook[GSM_BACKUP_MAX_SIMPHONEBOOK + 1]; | 41 | GSM_MemoryEntry *SIMPhonebook[GSM_BACKUP_MAX_SIMPHONEBOOK + 1]; |
40 | GSM_CalendarEntry *Calendar[GSM_MAXCALENDARTODONOTES + 1]; | 42 | GSM_CalendarEntry *Calendar[GSM_MAXCALENDARTODONOTES + 1]; |
41 | GSM_Bitmap *CallerLogos[GSM_BACKUP_MAX_CALLER + 1]; | 43 | GSM_Bitmap *CallerLogos[GSM_BACKUP_MAX_CALLER + 1]; |
42 | GSM_SMSC *SMSC [GSM_BACKUP_MAX_SMSC + 1]; | 44 | GSM_SMSC *SMSC [GSM_BACKUP_MAX_SMSC + 1]; |
43 | GSM_WAPBookmark *WAPBookmark[GSM_BACKUP_MAX_WAPBOOKMARK + 1]; | 45 | GSM_WAPBookmark *WAPBookmark[GSM_BACKUP_MAX_WAPBOOKMARK + 1]; |
44 | GSM_MultiWAPSettings *WAPSettings[GSM_BACKUP_MAX_WAPSETTINGS + 1]; | 46 | GSM_MultiWAPSettings *WAPSettings[GSM_BACKUP_MAX_WAPSETTINGS + 1]; |
45 | GSM_MultiWAPSettings *MMSSettings[GSM_BACKUP_MAX_MMSSETTINGS + 1]; | 47 | GSM_MultiWAPSettings *MMSSettings[GSM_BACKUP_MAX_MMSSETTINGS + 1]; |
48 | GSM_SyncMLSettings*SyncMLSettings [GSM_BACKUP_MAX_SYNCMLSETTINGS + 1]; | ||
49 | GSM_ChatSettings *ChatSettings [GSM_BACKUP_MAX_CHATSETTINGS + 1]; | ||
46 | GSM_Ringtone *Ringtone[GSM_BACKUP_MAX_RINGTONES + 1]; | 50 | GSM_Ringtone *Ringtone[GSM_BACKUP_MAX_RINGTONES + 1]; |
47 | GSM_ToDoEntry *ToDo [GSM_MAXCALENDARTODONOTES + 1]; | 51 | GSM_ToDoEntry *ToDo [GSM_MAXCALENDARTODONOTES + 1]; |
48 | GSM_Profile *Profiles[GSM_BACKUP_MAX_PROFILES + 1]; | 52 | GSM_Profile *Profiles[GSM_BACKUP_MAX_PROFILES + 1]; |
49 | GSM_FMStation *FMStation[GSM_BACKUP_MAX_FMSTATIONS +1]; | 53 | GSM_FMStation *FMStation[GSM_BACKUP_MAX_FMSTATIONS +1]; |
50 | GSM_GPRSAccessPoint *GPRSPoint[GSM_BACKUP_MAX_GPRSPOINT + 1]; | 54 | GSM_GPRSAccessPoint *GPRSPoint[GSM_BACKUP_MAX_GPRSPOINT + 1]; |
51 | GSM_NoteEntry *Note [GSM_BACKUP_MAX_NOTE + 1]; | 55 | GSM_NoteEntry *Note [GSM_BACKUP_MAX_NOTE + 1]; |
52 | GSM_Bitmap *StartupLogo; | 56 | GSM_Bitmap *StartupLogo; |
53 | GSM_Bitmap *OperatorLogo; | 57 | GSM_Bitmap *OperatorLogo; |
54 | } GSM_Backup; | 58 | } GSM_Backup; |
55 | 59 | ||
56 | #define GSM_BACKUP_MAX_SMS500 | 60 | #define GSM_BACKUP_MAX_SMS500 |
57 | 61 | ||
diff --git a/gammu/emb/common/service/backup/backtext.c b/gammu/emb/common/service/backup/backtext.c index fee0f73..4cb1bb7 100644 --- a/gammu/emb/common/service/backup/backtext.c +++ b/gammu/emb/common/service/backup/backtext.c | |||
@@ -142,71 +142,72 @@ static void SaveBackupText(FILE *file, char *myname, char *myvalue, bool UseUnic | |||
142 | 142 | ||
143 | if (myname[0] == 0x00) { | 143 | if (myname[0] == 0x00) { |
144 | if (UseUnicode) { | 144 | if (UseUnicode) { |
145 | EncodeUnicode(buffer,myvalue,strlen(myvalue)); | 145 | EncodeUnicode(buffer,myvalue,strlen(myvalue)); |
146 | fwrite(buffer,1,strlen(myvalue)*2,file); | 146 | fwrite(buffer,1,strlen(myvalue)*2,file); |
147 | } else fprintf(file,"%s",myvalue); | 147 | } else fprintf(file,"%s",myvalue); |
148 | } else { | 148 | } else { |
149 | if (UseUnicode) { | 149 | if (UseUnicode) { |
150 | sprintf(buffer,"%s = \"",myname); | 150 | sprintf(buffer,"%s = \"",myname); |
151 | EncodeUnicode(buffer2,buffer,strlen(buffer)); | 151 | EncodeUnicode(buffer2,buffer,strlen(buffer)); |
152 | fwrite(buffer2,1,strlen(buffer)*2,file); | 152 | fwrite(buffer2,1,strlen(buffer)*2,file); |
153 | 153 | ||
154 | fwrite(myvalue,1,UnicodeLength(myvalue)*2,file); | 154 | fwrite(EncodeUnicodeSpecialChars(myvalue),1,UnicodeLength(EncodeUnicodeSpecialChars(myvalue))*2,file); |
155 | 155 | ||
156 | sprintf(buffer,"\"%c%c",13,10); | 156 | sprintf(buffer,"\"%c%c",13,10); |
157 | EncodeUnicode(buffer2,buffer,strlen(buffer)); | 157 | EncodeUnicode(buffer2,buffer,strlen(buffer)); |
158 | fwrite(buffer2,1,strlen(buffer)*2,file); | 158 | fwrite(buffer2,1,strlen(buffer)*2,file); |
159 | } else { | 159 | } else { |
160 | sprintf(buffer,"%s = \"%s\"%c%c",myname,DecodeUnicodeString(myvalue),13,10); | 160 | sprintf(buffer,"%s = \"%s\"%c%c",myname,EncodeSpecialChars(DecodeUnicodeString(myvalue)),13,10); |
161 | fprintf(file,"%s",buffer); | 161 | fprintf(file,"%s",buffer); |
162 | 162 | ||
163 | EncodeHexBin(buffer,myvalue,UnicodeLength(myvalue)*2); | 163 | EncodeHexBin(buffer,myvalue,UnicodeLength(myvalue)*2); |
164 | fprintf(file,"%sUnicode = %s%c%c",myname,buffer,13,10); | 164 | fprintf(file,"%sUnicode = %s%c%c",myname,buffer,13,10); |
165 | } | 165 | } |
166 | } | 166 | } |
167 | } | 167 | } |
168 | 168 | ||
169 | static bool ReadBackupText(INI_Section *file_info, char *section, char *myname, char *myvalue, bool UseUnicode) | 169 | static bool ReadBackupText(INI_Section *file_info, char *section, char *myname, char *myvalue, bool UseUnicode) |
170 | { | 170 | { |
171 | unsigned char paramname[10000],*readvalue; | 171 | unsigned char paramname[10000],*readvalue; |
172 | 172 | ||
173 | if (UseUnicode) { | 173 | if (UseUnicode) { |
174 | EncodeUnicode(paramname,myname,strlen(myname)); | 174 | EncodeUnicode(paramname,myname,strlen(myname)); |
175 | readvalue = INI_GetValue(file_info, section, paramname, UseUnicode); | 175 | readvalue = INI_GetValue(file_info, section, paramname, UseUnicode); |
176 | if (readvalue!=NULL) { | 176 | if (readvalue!=NULL) { |
177 | CopyUnicodeString(myvalue,readvalue+2); | 177 | CopyUnicodeString(myvalue,DecodeUnicodeSpecialChars(readvalue+2)); |
178 | myvalue[UnicodeLength(readvalue)*2-4]=0; | 178 | myvalue[UnicodeLength(myvalue)*2-2]=0; |
179 | myvalue[UnicodeLength(readvalue)*2-3]=0; | 179 | myvalue[UnicodeLength(myvalue)*2-1]=0; |
180 | |||
180 | dbgprintf("%s\n",DecodeUnicodeString(readvalue)); | 181 | dbgprintf("%s\n",DecodeUnicodeString(readvalue)); |
181 | } else { | 182 | } else { |
182 | myvalue[0]=0; | 183 | myvalue[0]=0; |
183 | myvalue[1]=0; | 184 | myvalue[1]=0; |
184 | return false; | 185 | return false; |
185 | } | 186 | } |
186 | } else { | 187 | } else { |
187 | strcpy(paramname,myname); | 188 | strcpy(paramname,myname); |
188 | strcat(paramname,"Unicode"); | 189 | strcat(paramname,"Unicode"); |
189 | readvalue = ReadCFGText(file_info, section, paramname, UseUnicode); | 190 | readvalue = ReadCFGText(file_info, section, paramname, UseUnicode); |
190 | if (readvalue!=NULL) { | 191 | if (readvalue!=NULL) { |
191 | dbgprintf("%s %i\n",readvalue,strlen(readvalue)); | 192 | dbgprintf("%s %i\n",readvalue,strlen(readvalue)); |
192 | DecodeHexBin (myvalue, readvalue, strlen(readvalue)); | 193 | DecodeHexBin (myvalue, readvalue, strlen(readvalue)); |
193 | myvalue[strlen(readvalue)/2]=0; | 194 | myvalue[strlen(readvalue)/2]=0; |
194 | myvalue[strlen(readvalue)/2+1]=0; | 195 | myvalue[strlen(readvalue)/2+1]=0; |
195 | dbgprintf("%s\n",DecodeUnicodeString(myvalue)); | 196 | dbgprintf("%s\n",DecodeUnicodeString(myvalue)); |
196 | } else { | 197 | } else { |
197 | strcpy(paramname,myname); | 198 | strcpy(paramname,myname); |
198 | readvalue = ReadCFGText(file_info, section, paramname, UseUnicode); | 199 | readvalue = ReadCFGText(file_info, section, paramname, UseUnicode); |
199 | if (readvalue!=NULL) { | 200 | if (readvalue!=NULL) { |
200 | EncodeUnicode(myvalue,readvalue+1,strlen(readvalue)-2); | 201 | EncodeUnicode(myvalue,DecodeSpecialChars(readvalue+1),strlen(DecodeSpecialChars(readvalue+1))-1); |
201 | } else { | 202 | } else { |
202 | myvalue[0]=0; | 203 | myvalue[0]=0; |
203 | myvalue[1]=0; | 204 | myvalue[1]=0; |
204 | return false; | 205 | return false; |
205 | } | 206 | } |
206 | } | 207 | } |
207 | } | 208 | } |
208 | return true; | 209 | return true; |
209 | } | 210 | } |
210 | 211 | ||
211 | static void SaveVCalDateTime(FILE *file, GSM_DateTime *dt, bool UseUnicode) | 212 | static void SaveVCalDateTime(FILE *file, GSM_DateTime *dt, bool UseUnicode) |
212 | { | 213 | { |
@@ -409,24 +410,35 @@ static void SavePbkEntry(FILE *file, GSM_MemoryEntry *Pbk, bool UseUnicode) | |||
409 | SaveBackupText(file, "", buffer, UseUnicode); | 410 | SaveBackupText(file, "", buffer, UseUnicode); |
410 | i++; | 411 | i++; |
411 | } | 412 | } |
412 | break; | 413 | break; |
413 | default: | 414 | default: |
414 | break; | 415 | break; |
415 | } | 416 | } |
416 | } | 417 | } |
417 | sprintf(buffer,"%c%c",13,10); | 418 | sprintf(buffer,"%c%c",13,10); |
418 | SaveBackupText(file, "", buffer, UseUnicode); | 419 | SaveBackupText(file, "", buffer, UseUnicode); |
419 | } | 420 | } |
420 | 421 | ||
422 | static void SaveNoteEntry(FILE *file, GSM_NoteEntry *Note, bool UseUnicode) | ||
423 | { | ||
424 | char buffer[1000]; | ||
425 | |||
426 | sprintf(buffer,"Location = %d%c%c", Note->Location,13,10); | ||
427 | SaveBackupText(file, "", buffer, UseUnicode); | ||
428 | SaveBackupText(file, "Text", Note->Text, UseUnicode); | ||
429 | sprintf(buffer, "%c%c",13,10); | ||
430 | SaveBackupText(file, "", buffer, UseUnicode); | ||
431 | } | ||
432 | |||
421 | static void SaveCalendarEntry(FILE *file, GSM_CalendarEntry *Note, bool UseUnicode) | 433 | static void SaveCalendarEntry(FILE *file, GSM_CalendarEntry *Note, bool UseUnicode) |
422 | { | 434 | { |
423 | int i; | 435 | int i; |
424 | charbuffer[1000]; | 436 | charbuffer[1000]; |
425 | 437 | ||
426 | sprintf(buffer,"Location = %d%c%c", Note->Location,13,10); | 438 | sprintf(buffer,"Location = %d%c%c", Note->Location,13,10); |
427 | SaveBackupText(file, "", buffer, UseUnicode); | 439 | SaveBackupText(file, "", buffer, UseUnicode); |
428 | SaveBackupText(file, "", "Type = ", UseUnicode); | 440 | SaveBackupText(file, "", "Type = ", UseUnicode); |
429 | switch (Note->Type) { | 441 | switch (Note->Type) { |
430 | case GSM_CAL_REMINDER : sprintf(buffer,"Reminder%c%c", 13,10); break; | 442 | case GSM_CAL_REMINDER : sprintf(buffer,"Reminder%c%c", 13,10); break; |
431 | case GSM_CAL_CALL : sprintf(buffer,"Call%c%c", 13,10); break; | 443 | case GSM_CAL_CALL : sprintf(buffer,"Call%c%c", 13,10); break; |
432 | case GSM_CAL_MEETING : sprintf(buffer,"Meeting%c%c", 13,10); break; | 444 | case GSM_CAL_MEETING : sprintf(buffer,"Meeting%c%c", 13,10); break; |
@@ -648,24 +660,66 @@ static void SaveWAPSettingsEntry(FILE *file, GSM_MultiWAPSettings *settings, boo | |||
648 | if (settings->Settings[i].IsIP) { | 660 | if (settings->Settings[i].IsIP) { |
649 | sprintf(buffer,"IP%02i",i); | 661 | sprintf(buffer,"IP%02i",i); |
650 | } else { | 662 | } else { |
651 | sprintf(buffer,"Number%02i",i); | 663 | sprintf(buffer,"Number%02i",i); |
652 | } | 664 | } |
653 | SaveBackupText(file, buffer, settings->Settings[i].Service, UseUnicode); | 665 | SaveBackupText(file, buffer, settings->Settings[i].Service, UseUnicode); |
654 | } | 666 | } |
655 | sprintf(buffer,"%c%c",13,10); | 667 | sprintf(buffer,"%c%c",13,10); |
656 | SaveBackupText(file, "", buffer, UseUnicode); | 668 | SaveBackupText(file, "", buffer, UseUnicode); |
657 | } | 669 | } |
658 | } | 670 | } |
659 | 671 | ||
672 | static void SaveChatSettingsEntry(FILE *file, GSM_ChatSettings *settings, bool UseUnicode) | ||
673 | { | ||
674 | char buffer[10000]; | ||
675 | |||
676 | sprintf(buffer,"HomePage"); | ||
677 | SaveBackupText(file, buffer, settings->HomePage, UseUnicode); | ||
678 | sprintf(buffer,"User"); | ||
679 | SaveBackupText(file, buffer, settings->User, UseUnicode); | ||
680 | sprintf(buffer,"Password"); | ||
681 | SaveBackupText(file, buffer, settings->Password, UseUnicode); | ||
682 | SaveWAPSettingsEntry(file, &settings->Connection, UseUnicode); | ||
683 | } | ||
684 | |||
685 | static void SaveSyncMLSettingsEntry(FILE *file, GSM_SyncMLSettings *settings, bool UseUnicode) | ||
686 | { | ||
687 | char buffer[10000]; | ||
688 | |||
689 | sprintf(buffer,"User"); | ||
690 | SaveBackupText(file, buffer, settings->User, UseUnicode); | ||
691 | sprintf(buffer,"Password"); | ||
692 | SaveBackupText(file, buffer, settings->Password, UseUnicode); | ||
693 | sprintf(buffer,"PhonebookDB"); | ||
694 | SaveBackupText(file, buffer, settings->PhonebookDataBase, UseUnicode); | ||
695 | sprintf(buffer,"CalendarDB"); | ||
696 | SaveBackupText(file, buffer, settings->CalendarDataBase, UseUnicode); | ||
697 | sprintf(buffer,"Server"); | ||
698 | SaveBackupText(file, buffer, settings->Server, UseUnicode); | ||
699 | if (settings->SyncPhonebook) { | ||
700 | sprintf(buffer,"SyncPhonebook = True%c%c",13,10); | ||
701 | } else { | ||
702 | sprintf(buffer,"SyncPhonebook = False%c%c",13,10); | ||
703 | } | ||
704 | SaveBackupText(file, "", buffer, UseUnicode); | ||
705 | if (settings->SyncCalendar) { | ||
706 | sprintf(buffer,"SyncCalendar = True%c%c",13,10); | ||
707 | } else { | ||
708 | sprintf(buffer,"SyncCalendar = False%c%c",13,10); | ||
709 | } | ||
710 | SaveBackupText(file, "", buffer, UseUnicode); | ||
711 | SaveWAPSettingsEntry(file, &settings->Connection, UseUnicode); | ||
712 | } | ||
713 | |||
660 | static void SaveBitmapEntry(FILE *file, GSM_Bitmap *bitmap, bool UseUnicode) | 714 | static void SaveBitmapEntry(FILE *file, GSM_Bitmap *bitmap, bool UseUnicode) |
661 | { | 715 | { |
662 | unsigned char buffer[10000],buffer2[10000]; | 716 | unsigned char buffer[10000],buffer2[10000]; |
663 | int x,y; | 717 | int x,y; |
664 | 718 | ||
665 | sprintf(buffer,"Width = %i%c%c",bitmap->BitmapWidth,13,10); | 719 | sprintf(buffer,"Width = %i%c%c",bitmap->BitmapWidth,13,10); |
666 | SaveBackupText(file, "", buffer, UseUnicode); | 720 | SaveBackupText(file, "", buffer, UseUnicode); |
667 | sprintf(buffer,"Height = %i%c%c",bitmap->BitmapHeight,13,10); | 721 | sprintf(buffer,"Height = %i%c%c",bitmap->BitmapHeight,13,10); |
668 | SaveBackupText(file, "", buffer, UseUnicode); | 722 | SaveBackupText(file, "", buffer, UseUnicode); |
669 | for (y=0;y<bitmap->BitmapHeight;y++) { | 723 | for (y=0;y<bitmap->BitmapHeight;y++) { |
670 | for (x=0;x<bitmap->BitmapWidth;x++) { | 724 | for (x=0;x<bitmap->BitmapWidth;x++) { |
671 | buffer[x] = ' '; | 725 | buffer[x] = ' '; |
@@ -756,40 +810,41 @@ static void SaveSMSCEntry(FILE *file, GSM_SMSC *SMSC, bool UseUnicode) | |||
756 | case SMS_VALID_1_Week : sprintf(buffer, "1week"); break; | 810 | case SMS_VALID_1_Week : sprintf(buffer, "1week"); break; |
757 | case SMS_VALID_Max_Time: | 811 | case SMS_VALID_Max_Time: |
758 | default : sprintf(buffer,"MaximumTime"); break; | 812 | default : sprintf(buffer,"MaximumTime"); break; |
759 | } | 813 | } |
760 | SaveBackupText(file, "", buffer, UseUnicode); | 814 | SaveBackupText(file, "", buffer, UseUnicode); |
761 | sprintf(buffer,"%c%c%c%c",13,10,13,10); | 815 | sprintf(buffer,"%c%c%c%c",13,10,13,10); |
762 | SaveBackupText(file, "", buffer, UseUnicode); | 816 | SaveBackupText(file, "", buffer, UseUnicode); |
763 | } | 817 | } |
764 | 818 | ||
765 | static void SaveRingtoneEntry(FILE *file, GSM_Ringtone *ringtone, bool UseUnicode) | 819 | static void SaveRingtoneEntry(FILE *file, GSM_Ringtone *ringtone, bool UseUnicode) |
766 | { | 820 | { |
767 | unsigned char buffer[45000]; | 821 | unsigned char buffer[45000]; |
768 | int i,j; | ||
769 | 822 | ||
770 | sprintf(buffer,"Location = %i%c%c",ringtone->Location,13,10); | 823 | sprintf(buffer,"Location = %i%c%c",ringtone->Location,13,10); |
771 | SaveBackupText(file, "", buffer, UseUnicode); | 824 | SaveBackupText(file, "", buffer, UseUnicode); |
772 | SaveBackupText(file, "Name", ringtone->Name, UseUnicode); | 825 | SaveBackupText(file, "Name", ringtone->Name, UseUnicode); |
773 | switch (ringtone->Format) { | 826 | switch (ringtone->Format) { |
774 | case RING_NOKIABINARY: | 827 | case RING_NOKIABINARY: |
775 | j = 0; i = 0; | ||
776 | EncodeHexBin(buffer,ringtone->NokiaBinary.Frame,ringtone->NokiaBinary.Length); | 828 | EncodeHexBin(buffer,ringtone->NokiaBinary.Frame,ringtone->NokiaBinary.Length); |
777 | SaveLinkedBackupText(file, "NokiaBinary", buffer, UseUnicode); | 829 | SaveLinkedBackupText(file, "NokiaBinary", buffer, UseUnicode); |
778 | break; | 830 | break; |
779 | case RING_MIDI: | 831 | case RING_MIDI: |
780 | j = 0; i = 0; | ||
781 | EncodeHexBin(buffer,ringtone->NokiaBinary.Frame,ringtone->NokiaBinary.Length); | 832 | EncodeHexBin(buffer,ringtone->NokiaBinary.Frame,ringtone->NokiaBinary.Length); |
782 | SaveLinkedBackupText(file, "Pure Midi", buffer, UseUnicode); | 833 | SaveLinkedBackupText(file, "Pure Midi", buffer, UseUnicode); |
783 | break; | 834 | break; |
835 | case RING_MMF: | ||
836 | EncodeHexBin(buffer,ringtone->NokiaBinary.Frame,ringtone->NokiaBinary.Length); | ||
837 | SaveLinkedBackupText(file, "SMAF", buffer, UseUnicode); | ||
838 | break; | ||
784 | case RING_NOTETONE: | 839 | case RING_NOTETONE: |
785 | break; | 840 | break; |
786 | } | 841 | } |
787 | sprintf(buffer,"%c%c",13,10); | 842 | sprintf(buffer,"%c%c",13,10); |
788 | SaveBackupText(file, "", buffer, UseUnicode); | 843 | SaveBackupText(file, "", buffer, UseUnicode); |
789 | } | 844 | } |
790 | 845 | ||
791 | static void SaveOperatorEntry(FILE *file, GSM_Bitmap *bitmap, bool UseUnicode) | 846 | static void SaveOperatorEntry(FILE *file, GSM_Bitmap *bitmap, bool UseUnicode) |
792 | { | 847 | { |
793 | unsigned char buffer[1000]; | 848 | unsigned char buffer[1000]; |
794 | 849 | ||
795 | sprintf(buffer,"[Operator]%c%c",13,10); | 850 | sprintf(buffer,"[Operator]%c%c",13,10); |
@@ -1066,24 +1121,31 @@ GSM_Error SaveBackup(char *FileName, GSM_Backup *backup, bool UseUnicode) | |||
1066 | SaveBackupText(file, "", buffer, UseUnicode); | 1121 | SaveBackupText(file, "", buffer, UseUnicode); |
1067 | SavePbkEntry(file, backup->SIMPhonebook[i], UseUnicode); | 1122 | SavePbkEntry(file, backup->SIMPhonebook[i], UseUnicode); |
1068 | i++; | 1123 | i++; |
1069 | } | 1124 | } |
1070 | i=0; | 1125 | i=0; |
1071 | while (backup->Calendar[i]!=NULL) { | 1126 | while (backup->Calendar[i]!=NULL) { |
1072 | sprintf(buffer,"[Calendar%03i]%c%c",i+1,13,10); | 1127 | sprintf(buffer,"[Calendar%03i]%c%c",i+1,13,10); |
1073 | SaveBackupText(file, "", buffer, UseUnicode); | 1128 | SaveBackupText(file, "", buffer, UseUnicode); |
1074 | SaveCalendarEntry(file, backup->Calendar[i], UseUnicode); | 1129 | SaveCalendarEntry(file, backup->Calendar[i], UseUnicode); |
1075 | i++; | 1130 | i++; |
1076 | } | 1131 | } |
1077 | i=0; | 1132 | i=0; |
1133 | while (backup->Note[i]!=NULL) { | ||
1134 | sprintf(buffer,"[Note%03i]%c%c",i+1,13,10); | ||
1135 | SaveBackupText(file, "", buffer, UseUnicode); | ||
1136 | SaveNoteEntry(file, backup->Note[i], UseUnicode); | ||
1137 | i++; | ||
1138 | } | ||
1139 | i=0; | ||
1078 | while (backup->CallerLogos[i]!=NULL) { | 1140 | while (backup->CallerLogos[i]!=NULL) { |
1079 | sprintf(buffer,"[Caller%03i]%c%c",i+1,13,10); | 1141 | sprintf(buffer,"[Caller%03i]%c%c",i+1,13,10); |
1080 | SaveBackupText(file, "", buffer, UseUnicode); | 1142 | SaveBackupText(file, "", buffer, UseUnicode); |
1081 | SaveCallerEntry(file, backup->CallerLogos[i], UseUnicode); | 1143 | SaveCallerEntry(file, backup->CallerLogos[i], UseUnicode); |
1082 | i++; | 1144 | i++; |
1083 | } | 1145 | } |
1084 | i=0; | 1146 | i=0; |
1085 | while (backup->SMSC[i]!=NULL) { | 1147 | while (backup->SMSC[i]!=NULL) { |
1086 | sprintf(buffer,"[SMSC%03i]%c%c",i+1,13,10); | 1148 | sprintf(buffer,"[SMSC%03i]%c%c",i+1,13,10); |
1087 | SaveBackupText(file, "", buffer, UseUnicode); | 1149 | SaveBackupText(file, "", buffer, UseUnicode); |
1088 | SaveSMSCEntry(file, backup->SMSC[i], UseUnicode); | 1150 | SaveSMSCEntry(file, backup->SMSC[i], UseUnicode); |
1089 | i++; | 1151 | i++; |
@@ -1101,24 +1163,38 @@ GSM_Error SaveBackup(char *FileName, GSM_Backup *backup, bool UseUnicode) | |||
1101 | SaveBackupText(file, "", buffer, UseUnicode); | 1163 | SaveBackupText(file, "", buffer, UseUnicode); |
1102 | SaveWAPSettingsEntry(file, backup->WAPSettings[i], UseUnicode); | 1164 | SaveWAPSettingsEntry(file, backup->WAPSettings[i], UseUnicode); |
1103 | i++; | 1165 | i++; |
1104 | } | 1166 | } |
1105 | i=0; | 1167 | i=0; |
1106 | while (backup->MMSSettings[i]!=NULL) { | 1168 | while (backup->MMSSettings[i]!=NULL) { |
1107 | sprintf(buffer,"[MMSSettings%03i]%c%c",i+1,13,10); | 1169 | sprintf(buffer,"[MMSSettings%03i]%c%c",i+1,13,10); |
1108 | SaveBackupText(file, "", buffer, UseUnicode); | 1170 | SaveBackupText(file, "", buffer, UseUnicode); |
1109 | SaveWAPSettingsEntry(file, backup->MMSSettings[i], UseUnicode); | 1171 | SaveWAPSettingsEntry(file, backup->MMSSettings[i], UseUnicode); |
1110 | i++; | 1172 | i++; |
1111 | } | 1173 | } |
1112 | i=0; | 1174 | i=0; |
1175 | while (backup->SyncMLSettings[i]!=NULL) { | ||
1176 | sprintf(buffer,"[SyncMLSettings%03i]%c%c",i+1,13,10); | ||
1177 | SaveBackupText(file, "", buffer, UseUnicode); | ||
1178 | SaveSyncMLSettingsEntry(file, backup->SyncMLSettings[i], UseUnicode); | ||
1179 | i++; | ||
1180 | } | ||
1181 | i=0; | ||
1182 | while (backup->ChatSettings[i]!=NULL) { | ||
1183 | sprintf(buffer,"[ChatSettings%03i]%c%c",i+1,13,10); | ||
1184 | SaveBackupText(file, "", buffer, UseUnicode); | ||
1185 | SaveChatSettingsEntry(file, backup->ChatSettings[i], UseUnicode); | ||
1186 | i++; | ||
1187 | } | ||
1188 | i=0; | ||
1113 | while (backup->Ringtone[i]!=NULL) { | 1189 | while (backup->Ringtone[i]!=NULL) { |
1114 | sprintf(buffer,"[Ringtone%03i]%c%c",i+1,13,10); | 1190 | sprintf(buffer,"[Ringtone%03i]%c%c",i+1,13,10); |
1115 | SaveBackupText(file, "", buffer, UseUnicode); | 1191 | SaveBackupText(file, "", buffer, UseUnicode); |
1116 | SaveRingtoneEntry(file, backup->Ringtone[i], UseUnicode); | 1192 | SaveRingtoneEntry(file, backup->Ringtone[i], UseUnicode); |
1117 | i++; | 1193 | i++; |
1118 | } | 1194 | } |
1119 | i=0; | 1195 | i=0; |
1120 | while (backup->ToDo[i]!=NULL) { | 1196 | while (backup->ToDo[i]!=NULL) { |
1121 | sprintf(buffer,"[TODO%03i]%c%c",i+1,13,10); | 1197 | sprintf(buffer,"[TODO%03i]%c%c",i+1,13,10); |
1122 | SaveBackupText(file, "", buffer, UseUnicode); | 1198 | SaveBackupText(file, "", buffer, UseUnicode); |
1123 | SaveToDoEntry(file, backup->ToDo[i], UseUnicode); | 1199 | SaveToDoEntry(file, backup->ToDo[i], UseUnicode); |
1124 | i++; | 1200 | i++; |
@@ -2647,25 +2723,150 @@ GSM_Error LoadBackup(char *FileName, GSM_Backup *backup, bool UseUnicode) | |||
2647 | backup->Note[num + 1] = NULL; | 2723 | backup->Note[num + 1] = NULL; |
2648 | } else { | 2724 | } else { |
2649 | dbgprintf("Increase GSM_BACKUP_MAX_NOTE\n"); | 2725 | dbgprintf("Increase GSM_BACKUP_MAX_NOTE\n"); |
2650 | return ERR_MOREMEMORY; | 2726 | return ERR_MOREMEMORY; |
2651 | } | 2727 | } |
2652 | ReadNoteEntry(file_info, h->SectionName, backup->Note[num],UseUnicode); | 2728 | ReadNoteEntry(file_info, h->SectionName, backup->Note[num],UseUnicode); |
2653 | num++; | 2729 | num++; |
2654 | } | 2730 | } |
2655 | } | 2731 | } |
2656 | if (backup->MD5Original[0]!=0) { | 2732 | if (backup->MD5Original[0]!=0) { |
2657 | FindBackupChecksum(FileName, UseUnicode, backup->MD5Calculated); | 2733 | FindBackupChecksum(FileName, UseUnicode, backup->MD5Calculated); |
2658 | } | 2734 | } |
2659 | 2735 | for (h = file_info; h != NULL; h = h->Next) { | |
2736 | found = false; | ||
2737 | if (UseUnicode) { | ||
2738 | EncodeUnicode(buffer,"Backup",4); | ||
2739 | if (mywstrncasecmp(buffer, h->SectionName, 6)) found = true; | ||
2740 | } else { | ||
2741 | if (mystrncasecmp("Backup", h->SectionName, 6)) found = true; | ||
2742 | } | ||
2743 | if (UseUnicode) { | ||
2744 | EncodeUnicode(buffer,"Checksum",4); | ||
2745 | if (mywstrncasecmp(buffer, h->SectionName, 8)) found = true; | ||
2746 | } else { | ||
2747 | if (mystrncasecmp("Checksum", h->SectionName, 8)) found = true; | ||
2748 | } | ||
2749 | if (UseUnicode) { | ||
2750 | EncodeUnicode(buffer,"Profile",7); | ||
2751 | if (mywstrncasecmp(buffer, h->SectionName, 7)) found = true; | ||
2752 | } else { | ||
2753 | if (mystrncasecmp("Profile", h->SectionName, 7)) found = true; | ||
2754 | } | ||
2755 | if (UseUnicode) { | ||
2756 | EncodeUnicode(buffer,"PhonePBK",8); | ||
2757 | if (mywstrncasecmp(buffer, h->SectionName, 8)) found = true; | ||
2758 | } else { | ||
2759 | if (mystrncasecmp("PhonePBK", h->SectionName, 8)) found = true; | ||
2760 | } | ||
2761 | if (UseUnicode) { | ||
2762 | EncodeUnicode(buffer,"SIMPBK",6); | ||
2763 | if (mywstrncasecmp(buffer, h->SectionName, 6)) found = true; | ||
2764 | } else { | ||
2765 | if (mystrncasecmp("SIMPBK", h->SectionName, 6)) found = true; | ||
2766 | } | ||
2767 | if (UseUnicode) { | ||
2768 | EncodeUnicode(buffer,"Calendar",8); | ||
2769 | if (mywstrncasecmp(buffer, h->SectionName, 8)) found = true; | ||
2770 | } else { | ||
2771 | if (mystrncasecmp("Calendar", h->SectionName, 8)) found = true; | ||
2772 | } | ||
2773 | if (UseUnicode) { | ||
2774 | EncodeUnicode(buffer,"Caller",6); | ||
2775 | if (mywstrncasecmp(buffer, h->SectionName, 6)) found = true; | ||
2776 | } else { | ||
2777 | if (mystrncasecmp("Caller", h->SectionName, 6)) found = true; | ||
2778 | } | ||
2779 | if (UseUnicode) { | ||
2780 | EncodeUnicode(buffer,"SMSC",4); | ||
2781 | if (mywstrncasecmp(buffer, h->SectionName, 4)) found = true; | ||
2782 | } else { | ||
2783 | if (mystrncasecmp("SMSC", h->SectionName, 4)) found = true; | ||
2784 | } | ||
2785 | if (UseUnicode) { | ||
2786 | EncodeUnicode(buffer,"WAPBookmark",11); | ||
2787 | if (mywstrncasecmp(buffer, h->SectionName, 11)) found = true; | ||
2788 | if (!found) { | ||
2789 | EncodeUnicode(buffer,"Bookmark",8); | ||
2790 | if (mywstrncasecmp(buffer, h->SectionName, 8)) found = true; | ||
2791 | } | ||
2792 | } else { | ||
2793 | if (mystrncasecmp("WAPBookmark", h->SectionName, 11)) found = true; | ||
2794 | if (!found) { | ||
2795 | if (mystrncasecmp("Bookmark", h->SectionName, 8)) found = true; | ||
2796 | } | ||
2797 | } | ||
2798 | if (UseUnicode) { | ||
2799 | EncodeUnicode(buffer,"WAPSettings",11); | ||
2800 | if (mywstrncasecmp(buffer, h->SectionName, 11)) found = true; | ||
2801 | if (!found) { | ||
2802 | EncodeUnicode(buffer,"Settings",8); | ||
2803 | if (mywstrncasecmp(buffer, h->SectionName, 8)) found = true; | ||
2804 | } | ||
2805 | } else { | ||
2806 | if (mystrncasecmp("WAPSettings", h->SectionName, 11)) found = true; | ||
2807 | if (!found) { | ||
2808 | if (mystrncasecmp("Settings", h->SectionName, 8)) found = true; | ||
2809 | } | ||
2810 | } | ||
2811 | if (UseUnicode) { | ||
2812 | EncodeUnicode(buffer,"MMSSettings",8); | ||
2813 | if (mywstrncasecmp(buffer, h->SectionName, 8)) found = true; | ||
2814 | } else { | ||
2815 | if (mystrncasecmp("MMSSettings", h->SectionName, 8)) found = true; | ||
2816 | } | ||
2817 | if (UseUnicode) { | ||
2818 | EncodeUnicode(buffer,"Ringtone",8); | ||
2819 | if (mywstrncasecmp(buffer, h->SectionName, 8)) found = true; | ||
2820 | } else { | ||
2821 | if (mystrncasecmp("Ringtone", h->SectionName, 8)) found = true; | ||
2822 | } | ||
2823 | if (UseUnicode) { | ||
2824 | EncodeUnicode(buffer,"TODO",4); | ||
2825 | if (mywstrncasecmp(buffer, h->SectionName, 4)) found = true; | ||
2826 | } else { | ||
2827 | if (mystrncasecmp("TODO", h->SectionName, 4)) found = true; | ||
2828 | } | ||
2829 | if (UseUnicode) { | ||
2830 | EncodeUnicode(buffer,"Startup",7); | ||
2831 | if (mywstrncasecmp(buffer, h->SectionName, 7)) found = true; | ||
2832 | } else { | ||
2833 | if (mystrncasecmp("Startup", h->SectionName, 7)) found = true; | ||
2834 | } | ||
2835 | if (UseUnicode) { | ||
2836 | EncodeUnicode(buffer,"Operator",7); | ||
2837 | if (mywstrncasecmp(buffer, h->SectionName, 8)) found = true; | ||
2838 | } else { | ||
2839 | if (mystrncasecmp("Operator", h->SectionName, 8)) found = true; | ||
2840 | } | ||
2841 | if (UseUnicode) { | ||
2842 | EncodeUnicode(buffer,"FMStation",9); | ||
2843 | if (mywstrncasecmp(buffer, h->SectionName, 9)) found = true; | ||
2844 | } else { | ||
2845 | if (mystrncasecmp("FMStation", h->SectionName, 9)) found = true; | ||
2846 | } | ||
2847 | if (UseUnicode) { | ||
2848 | EncodeUnicode(buffer,"GPRSPoint",9); | ||
2849 | if (mywstrncasecmp(buffer, h->SectionName, 9)) found = true; | ||
2850 | } else { | ||
2851 | if (mystrncasecmp("GPRSPoint", h->SectionName, 9)) found = true; | ||
2852 | } | ||
2853 | if (UseUnicode) { | ||
2854 | EncodeUnicode(buffer,"Note",4); | ||
2855 | if (mywstrncasecmp(buffer, h->SectionName, 4)) found = true; | ||
2856 | } else { | ||
2857 | if (mystrncasecmp("Note", h->SectionName, 4)) found = true; | ||
2858 | } | ||
2859 | if (!found) return ERR_NOTIMPLEMENTED; | ||
2860 | } | ||
2660 | return ERR_NONE; | 2861 | return ERR_NONE; |
2661 | } | 2862 | } |
2662 | 2863 | ||
2663 | /* ---------------------- backup files for SMS ----------------------------- */ | 2864 | /* ---------------------- backup files for SMS ----------------------------- */ |
2664 | 2865 | ||
2665 | static void ReadSMSBackupEntry(INI_Section *file_info, char *section, GSM_SMSMessage *SMS) | 2866 | static void ReadSMSBackupEntry(INI_Section *file_info, char *section, GSM_SMSMessage *SMS) |
2666 | { | 2867 | { |
2667 | unsigned char buffer[10000], *readvalue; | 2868 | unsigned char buffer[10000], *readvalue; |
2668 | 2869 | ||
2669 | GSM_SetDefaultSMSData(SMS); | 2870 | GSM_SetDefaultSMSData(SMS); |
2670 | 2871 | ||
2671 | SMS->PDU = SMS_Submit; | 2872 | SMS->PDU = SMS_Submit; |
diff --git a/gammu/emb/common/service/backup/gsmback.c b/gammu/emb/common/service/backup/gsmback.c index 91ac745..c94a4d2 100644 --- a/gammu/emb/common/service/backup/gsmback.c +++ b/gammu/emb/common/service/backup/gsmback.c | |||
@@ -64,24 +64,36 @@ void GSM_FreeBackup(GSM_Backup *backup) | |||
64 | while (backup->WAPSettings[i]!=NULL) { | 64 | while (backup->WAPSettings[i]!=NULL) { |
65 | free(backup->WAPSettings[i]); | 65 | free(backup->WAPSettings[i]); |
66 | backup->WAPSettings[i] = NULL; | 66 | backup->WAPSettings[i] = NULL; |
67 | i++; | 67 | i++; |
68 | } | 68 | } |
69 | i=0; | 69 | i=0; |
70 | while (backup->MMSSettings[i]!=NULL) { | 70 | while (backup->MMSSettings[i]!=NULL) { |
71 | free(backup->MMSSettings[i]); | 71 | free(backup->MMSSettings[i]); |
72 | backup->MMSSettings[i] = NULL; | 72 | backup->MMSSettings[i] = NULL; |
73 | i++; | 73 | i++; |
74 | } | 74 | } |
75 | i=0; | 75 | i=0; |
76 | while (backup->SyncMLSettings[i]!=NULL) { | ||
77 | free(backup->SyncMLSettings[i]); | ||
78 | backup->SyncMLSettings[i] = NULL; | ||
79 | i++; | ||
80 | } | ||
81 | i=0; | ||
82 | while (backup->ChatSettings[i]!=NULL) { | ||
83 | free(backup->ChatSettings[i]); | ||
84 | backup->ChatSettings[i] = NULL; | ||
85 | i++; | ||
86 | } | ||
87 | i=0; | ||
76 | while (backup->Ringtone[i]!=NULL) { | 88 | while (backup->Ringtone[i]!=NULL) { |
77 | free(backup->Ringtone[i]); | 89 | free(backup->Ringtone[i]); |
78 | backup->Ringtone[i] = NULL; | 90 | backup->Ringtone[i] = NULL; |
79 | i++; | 91 | i++; |
80 | } | 92 | } |
81 | i=0; | 93 | i=0; |
82 | while (backup->ToDo[i]!=NULL) { | 94 | while (backup->ToDo[i]!=NULL) { |
83 | free(backup->ToDo[i]); | 95 | free(backup->ToDo[i]); |
84 | backup->ToDo[i] = NULL; | 96 | backup->ToDo[i] = NULL; |
85 | i++; | 97 | i++; |
86 | } | 98 | } |
87 | i=0; | 99 | i=0; |
@@ -111,81 +123,83 @@ void GSM_FreeBackup(GSM_Backup *backup) | |||
111 | i++; | 123 | i++; |
112 | } | 124 | } |
113 | i=0; | 125 | i=0; |
114 | while (backup->Note[i]!=NULL) { | 126 | while (backup->Note[i]!=NULL) { |
115 | free(backup->Note[i]); | 127 | free(backup->Note[i]); |
116 | backup->Note[i] = NULL; | 128 | backup->Note[i] = NULL; |
117 | i++; | 129 | i++; |
118 | } | 130 | } |
119 | } | 131 | } |
120 | 132 | ||
121 | GSM_Error GSM_SaveBackupFile(char *FileName, GSM_Backup *backup, bool UseUnicode) | 133 | GSM_Error GSM_SaveBackupFile(char *FileName, GSM_Backup *backup, bool UseUnicode) |
122 | { | 134 | { |
123 | if (strstr(FileName,".lmb")) { | 135 | if (mystrcasestr(FileName,".lmb")) { |
124 | return SaveLMB(FileName,backup); | 136 | return SaveLMB(FileName,backup); |
125 | } else if (strstr(FileName,".vcs")) { | 137 | } else if (mystrcasestr(FileName,".vcs")) { |
126 | return SaveVCalendar(FileName,backup); | 138 | return SaveVCalendar(FileName,backup); |
127 | } else if (strstr(FileName,".vcf")) { | 139 | } else if (mystrcasestr(FileName,".vcf")) { |
128 | return SaveVCard(FileName,backup); | 140 | return SaveVCard(FileName,backup); |
129 | } else if (strstr(FileName,".ldif")) { | 141 | } else if (mystrcasestr(FileName,".ldif")) { |
130 | return SaveLDIF(FileName,backup); | 142 | return SaveLDIF(FileName,backup); |
131 | } else if (strstr(FileName,".ics")) { | 143 | } else if (mystrcasestr(FileName,".ics")) { |
132 | return SaveICS(FileName,backup); | 144 | return SaveICS(FileName,backup); |
133 | } else { | 145 | } else { |
134 | return SaveBackup(FileName,backup, UseUnicode); | 146 | return SaveBackup(FileName,backup, UseUnicode); |
135 | } | 147 | } |
136 | } | 148 | } |
137 | 149 | ||
138 | GSM_Error GSM_ReadBackupFile(char *FileName, GSM_Backup *backup) | 150 | GSM_Error GSM_ReadBackupFile(char *FileName, GSM_Backup *backup) |
139 | { | 151 | { |
140 | FILE *file; | 152 | FILE *file; |
141 | unsigned charbuffer[300]; | 153 | unsigned charbuffer[300]; |
142 | 154 | ||
143 | file = fopen(FileName, "rb"); | 155 | file = fopen(FileName, "rb"); |
144 | if (file == NULL) return ERR_CANTOPENFILE; | 156 | if (file == NULL) return ERR_CANTOPENFILE; |
145 | fread(buffer, 1, 9, file); /* Read the header of the file. */ | 157 | fread(buffer, 1, 9, file); /* Read the header of the file. */ |
146 | fclose(file); | 158 | fclose(file); |
147 | 159 | ||
148 | GSM_ClearBackup(backup); | 160 | GSM_ClearBackup(backup); |
149 | 161 | ||
150 | /* Attempt to identify filetype */ | 162 | /* Attempt to identify filetype */ |
151 | if (strstr(FileName,".vcs")) { | 163 | if (mystrcasestr(FileName,".vcs")) { |
152 | return LoadVCalendar(FileName,backup); | 164 | return LoadVCalendar(FileName,backup); |
153 | } else if (strstr(FileName,".vcf")) { | 165 | } else if (mystrcasestr(FileName,".vcf")) { |
154 | return LoadVCard(FileName,backup); | 166 | return LoadVCard(FileName,backup); |
155 | } else if (strstr(FileName,".ldif")) { | 167 | } else if (mystrcasestr(FileName,".ldif")) { |
156 | return LoadLDIF(FileName,backup); | 168 | return LoadLDIF(FileName,backup); |
157 | } else if (strstr(FileName,".ics")) { | 169 | } else if (mystrcasestr(FileName,".ics")) { |
158 | return LoadICS(FileName,backup); | 170 | return LoadICS(FileName,backup); |
159 | } else if (memcmp(buffer, "LMB ",4)==0) { | 171 | } else if (memcmp(buffer, "LMB ",4)==0) { |
160 | return LoadLMB(FileName,backup); | 172 | return LoadLMB(FileName,backup); |
161 | } else if (buffer[0] == 0xFE && buffer[1] == 0xFF) { | 173 | } else if (buffer[0] == 0xFE && buffer[1] == 0xFF) { |
162 | return LoadBackup(FileName,backup,true); | 174 | return LoadBackup(FileName,backup,true); |
163 | } else if (buffer[0] == 0xFF && buffer[1] == 0xFE) { | 175 | } else if (buffer[0] == 0xFF && buffer[1] == 0xFE) { |
164 | return LoadBackup(FileName,backup,true); | 176 | return LoadBackup(FileName,backup,true); |
165 | } else { | 177 | } else { |
166 | return LoadBackup(FileName,backup,false); | 178 | return LoadBackup(FileName,backup,false); |
167 | } | 179 | } |
168 | } | 180 | } |
169 | 181 | ||
170 | void GSM_ClearBackup(GSM_Backup *backup) | 182 | void GSM_ClearBackup(GSM_Backup *backup) |
171 | { | 183 | { |
172 | backup->PhonePhonebook[0] = NULL; | 184 | backup->PhonePhonebook[0] = NULL; |
173 | backup->SIMPhonebook[0] = NULL; | 185 | backup->SIMPhonebook[0] = NULL; |
174 | backup->Calendar[0] = NULL; | 186 | backup->Calendar[0] = NULL; |
175 | backup->CallerLogos[0] = NULL; | 187 | backup->CallerLogos[0] = NULL; |
176 | backup->SMSC [0] = NULL; | 188 | backup->SMSC [0] = NULL; |
177 | backup->WAPBookmark[0] = NULL; | 189 | backup->WAPBookmark[0] = NULL; |
178 | backup->WAPSettings[0] = NULL; | 190 | backup->WAPSettings[0] = NULL; |
179 | backup->MMSSettings[0] = NULL; | 191 | backup->MMSSettings[0] = NULL; |
192 | backup->SyncMLSettings[0] = NULL; | ||
193 | backup->ChatSettings[0] = NULL; | ||
180 | backup->Ringtone[0] = NULL; | 194 | backup->Ringtone[0] = NULL; |
181 | backup->Profiles[0] = NULL; | 195 | backup->Profiles[0] = NULL; |
182 | backup->ToDo [0] = NULL; | 196 | backup->ToDo [0] = NULL; |
183 | backup->GPRSPoint[0] = NULL; | 197 | backup->GPRSPoint[0] = NULL; |
184 | backup->FMStation[0] = NULL; | 198 | backup->FMStation[0] = NULL; |
185 | backup->Note [0] = NULL; | 199 | backup->Note [0] = NULL; |
186 | backup->StartupLogo = NULL; | 200 | backup->StartupLogo = NULL; |
187 | backup->OperatorLogo = NULL; | 201 | backup->OperatorLogo = NULL; |
188 | 202 | ||
189 | backup->Creator [0] = 0; | 203 | backup->Creator [0] = 0; |
190 | backup->IMEI [0] = 0; | 204 | backup->IMEI [0] = 0; |
191 | backup->Model [0] = 0; | 205 | backup->Model [0] = 0; |
@@ -200,24 +214,26 @@ void GSM_GetBackupFormatFeatures(char *FileName, GSM_Backup_Info *info) | |||
200 | info->IMEI = false; | 214 | info->IMEI = false; |
201 | info->Model = false; | 215 | info->Model = false; |
202 | info->DateTime = false; | 216 | info->DateTime = false; |
203 | info->PhonePhonebook = false; | 217 | info->PhonePhonebook = false; |
204 | info->SIMPhonebook = false; | 218 | info->SIMPhonebook = false; |
205 | info->ToDo = false; | 219 | info->ToDo = false; |
206 | info->Calendar = false; | 220 | info->Calendar = false; |
207 | info->CallerLogos = false; | 221 | info->CallerLogos = false; |
208 | info->SMSC = false; | 222 | info->SMSC = false; |
209 | info->WAPBookmark = false; | 223 | info->WAPBookmark = false; |
210 | info->WAPSettings = false; | 224 | info->WAPSettings = false; |
211 | info->MMSSettings = false; | 225 | info->MMSSettings = false; |
226 | info->SyncMLSettings = false; | ||
227 | info->ChatSettings = false; | ||
212 | info->Ringtone = false; | 228 | info->Ringtone = false; |
213 | info->StartupLogo = false; | 229 | info->StartupLogo = false; |
214 | info->OperatorLogo = false; | 230 | info->OperatorLogo = false; |
215 | info->Profiles = false; | 231 | info->Profiles = false; |
216 | info->FMStation = false; | 232 | info->FMStation = false; |
217 | info->GPRSPoint = false; | 233 | info->GPRSPoint = false; |
218 | info->Note = false; | 234 | info->Note = false; |
219 | 235 | ||
220 | if (strstr(FileName,".lmb")) { | 236 | if (strstr(FileName,".lmb")) { |
221 | info->PhonePhonebook = true; | 237 | info->PhonePhonebook = true; |
222 | info->SIMPhonebook = true; | 238 | info->SIMPhonebook = true; |
223 | info->CallerLogos = true; | 239 | info->CallerLogos = true; |
@@ -237,24 +253,26 @@ void GSM_GetBackupFormatFeatures(char *FileName, GSM_Backup_Info *info) | |||
237 | info->IMEI = true; | 253 | info->IMEI = true; |
238 | info->Model = true; | 254 | info->Model = true; |
239 | info->DateTime = true; | 255 | info->DateTime = true; |
240 | info->PhonePhonebook = true; | 256 | info->PhonePhonebook = true; |
241 | info->SIMPhonebook = true; | 257 | info->SIMPhonebook = true; |
242 | info->ToDo = true; | 258 | info->ToDo = true; |
243 | info->Calendar = true; | 259 | info->Calendar = true; |
244 | info->CallerLogos = true; | 260 | info->CallerLogos = true; |
245 | info->SMSC = true; | 261 | info->SMSC = true; |
246 | info->WAPBookmark = true; | 262 | info->WAPBookmark = true; |
247 | info->WAPSettings = true; | 263 | info->WAPSettings = true; |
248 | info->MMSSettings = true; | 264 | info->MMSSettings = true; |
265 | info->SyncMLSettings = true; | ||
266 | info->ChatSettings = true; | ||
249 | info->Ringtone = true; | 267 | info->Ringtone = true; |
250 | info->StartupLogo = true; | 268 | info->StartupLogo = true; |
251 | info->OperatorLogo = true; | 269 | info->OperatorLogo = true; |
252 | info->Profiles = true; | 270 | info->Profiles = true; |
253 | info->FMStation = true; | 271 | info->FMStation = true; |
254 | info->GPRSPoint = true; | 272 | info->GPRSPoint = true; |
255 | info->Note = true; | 273 | info->Note = true; |
256 | } | 274 | } |
257 | } | 275 | } |
258 | 276 | ||
259 | void GSM_GetBackupFileFeatures(char *FileName, GSM_Backup_Info *info, GSM_Backup *backup) | 277 | void GSM_GetBackupFileFeatures(char *FileName, GSM_Backup_Info *info, GSM_Backup *backup) |
260 | { | 278 | { |
diff --git a/gammu/emb/common/service/backup/gsmback.h b/gammu/emb/common/service/backup/gsmback.h index 1fd99b0..791e81d 100644 --- a/gammu/emb/common/service/backup/gsmback.h +++ b/gammu/emb/common/service/backup/gsmback.h | |||
@@ -20,24 +20,26 @@ typedef struct { | |||
20 | bool Model; | 20 | bool Model; |
21 | bool DateTime; | 21 | bool DateTime; |
22 | bool ToDo; | 22 | bool ToDo; |
23 | bool PhonePhonebook; | 23 | bool PhonePhonebook; |
24 | bool SIMPhonebook; | 24 | bool SIMPhonebook; |
25 | bool Calendar; | 25 | bool Calendar; |
26 | bool CallerLogos; | 26 | bool CallerLogos; |
27 | bool SMSC; | 27 | bool SMSC; |
28 | bool WAPBookmark; | 28 | bool WAPBookmark; |
29 | bool Profiles; | 29 | bool Profiles; |
30 | bool WAPSettings; | 30 | bool WAPSettings; |
31 | bool MMSSettings; | 31 | bool MMSSettings; |
32 | bool SyncMLSettings; | ||
33 | bool ChatSettings; | ||
32 | bool Ringtone; | 34 | bool Ringtone; |
33 | bool StartupLogo; | 35 | bool StartupLogo; |
34 | bool OperatorLogo; | 36 | bool OperatorLogo; |
35 | bool FMStation; | 37 | bool FMStation; |
36 | bool GPRSPoint; | 38 | bool GPRSPoint; |
37 | bool Note; | 39 | bool Note; |
38 | } GSM_Backup_Info; | 40 | } GSM_Backup_Info; |
39 | 41 | ||
40 | void GSM_GetBackupFormatFeatures(char *FileName, GSM_Backup_Info *info); | 42 | void GSM_GetBackupFormatFeatures(char *FileName, GSM_Backup_Info *info); |
41 | void GSM_GetBackupFileFeatures (char *FileName, GSM_Backup_Info *info, GSM_Backup *backup); | 43 | void GSM_GetBackupFileFeatures (char *FileName, GSM_Backup_Info *info, GSM_Backup *backup); |
42 | 44 | ||
43 | #endif | 45 | #endif |
diff --git a/gammu/emb/common/service/gsmcal.h b/gammu/emb/common/service/gsmcal.h index 067a4a4..0a41b7b 100644 --- a/gammu/emb/common/service/gsmcal.h +++ b/gammu/emb/common/service/gsmcal.h | |||
@@ -396,25 +396,25 @@ GSM_Error GSM_EncodeVTODO(char *Buffer, int *Length, GSM_ToDoEntry *note, bool h | |||
396 | */ | 396 | */ |
397 | typedef struct { | 397 | typedef struct { |
398 | /** | 398 | /** |
399 | * Number of used positions. | 399 | * Number of used positions. |
400 | */ | 400 | */ |
401 | int Used; | 401 | int Used; |
402 | } GSM_ToDoStatus; | 402 | } GSM_ToDoStatus; |
403 | 403 | ||
404 | /* --------------------------- note ---------------------------------------- */ | 404 | /* --------------------------- note ---------------------------------------- */ |
405 | 405 | ||
406 | typedef struct { | 406 | typedef struct { |
407 | int Location; | 407 | int Location; |
408 | char Text[100]; | 408 | char Text[3000*2]; |
409 | } GSM_NoteEntry; | 409 | } GSM_NoteEntry; |
410 | 410 | ||
411 | GSM_Error GSM_EncodeVNTFile(unsigned char *Buffer, int *Length, GSM_NoteEntry *Note); | 411 | GSM_Error GSM_EncodeVNTFile(unsigned char *Buffer, int *Length, GSM_NoteEntry *Note); |
412 | 412 | ||
413 | /* --------------------------- alarm --------------------------------------- */ | 413 | /* --------------------------- alarm --------------------------------------- */ |
414 | 414 | ||
415 | /** | 415 | /** |
416 | * Alarm values. | 416 | * Alarm values. |
417 | */ | 417 | */ |
418 | typedef struct { | 418 | typedef struct { |
419 | /** | 419 | /** |
420 | * Location where it is stored. | 420 | * Location where it is stored. |
diff --git a/gammu/emb/common/service/gsmdata.c b/gammu/emb/common/service/gsmdata.c index 94e9b7b..9303b57 100644 --- a/gammu/emb/common/service/gsmdata.c +++ b/gammu/emb/common/service/gsmdata.c | |||
@@ -237,71 +237,149 @@ void NOKIA_EncodeWAPMMSSettingsSMSText(unsigned char *Buffer, int *Length, GSM_W | |||
237 | 237 | ||
238 | /* ISP_NAME (name) */ | 238 | /* ISP_NAME (name) */ |
239 | Buffer[(*Length)++] = 0xC6; //CHARACTERISTIC with content and attributes | 239 | Buffer[(*Length)++] = 0xC6; //CHARACTERISTIC with content and attributes |
240 | Buffer[(*Length)++] = 0x08; //TYPE=NAME | 240 | Buffer[(*Length)++] = 0x08; //TYPE=NAME |
241 | Buffer[(*Length)++] = 0x01; //END PARMeter | 241 | Buffer[(*Length)++] = 0x01; //END PARMeter |
242 | /* Settings name */ | 242 | /* Settings name */ |
243 | AddWAPSMSParameterText(Buffer, Length, 0x15, DecodeUnicodeString(settings->Title), UnicodeLength(settings->Title)); | 243 | AddWAPSMSParameterText(Buffer, Length, 0x15, DecodeUnicodeString(settings->Title), UnicodeLength(settings->Title)); |
244 | Buffer[(*Length)++] = 0x01; //END PARMeter | 244 | Buffer[(*Length)++] = 0x01; //END PARMeter |
245 | Buffer[(*Length)++] = 0x01; //END PARMeter | 245 | Buffer[(*Length)++] = 0x01; //END PARMeter |
246 | } | 246 | } |
247 | 247 | ||
248 | /* http://forum.nokia.com: OTA Settings 7.0 */ | 248 | /* http://forum.nokia.com: OTA Settings 7.0 */ |
249 | /* first it used default/ISO coding */ | ||
250 | /* Joergen Thomsen changed to UTF8 */ | ||
249 | void NOKIA_EncodeWAPBookmarkSMSText(unsigned char *Buffer, int *Length, GSM_WAPBookmark *bookmark) | 251 | void NOKIA_EncodeWAPBookmarkSMSText(unsigned char *Buffer, int *Length, GSM_WAPBookmark *bookmark) |
250 | { | 252 | { |
251 | unsigned charbuffer[100]; | 253 | unsigned charbuffer[100]; |
252 | bool UnicodeCoding = false; | ||
253 | 254 | ||
254 | EncodeUTF8QuotedPrintable(buffer,bookmark->Title); | 255 | // bool UnicodeCoding = false; |
255 | if (UnicodeLength(bookmark->Title)!=strlen(buffer)) UnicodeCoding = true; | 256 | //EncodeUTF8QuotedPrintable(buffer,bookmark->Title); |
257 | //if (UnicodeLength(bookmark->Title)!=strlen(buffer)) UnicodeCoding = true; | ||
256 | 258 | ||
257 | Buffer[(*Length)++] = 0x01; //Push ID | 259 | Buffer[(*Length)++] = 0x01; //Push ID |
258 | Buffer[(*Length)++] = 0x06; //PDU Type (push) | 260 | Buffer[(*Length)++] = 0x06; //PDU Type (push) |
259 | Buffer[(*Length)++] = 0x2D; //Headers length (content type + headers) | 261 | Buffer[(*Length)++] = 0x2D; //Headers length (content type + headers) |
260 | strcpy(Buffer+(*Length),"\x1F\x2B"); | 262 | strcpy(Buffer+(*Length),"\x1F\x2B"); |
261 | (*Length)=(*Length)+2; //Value length | 263 | (*Length)=(*Length)+2; //Value length |
262 | strcpy(Buffer+(*Length),"application/x-wap-prov.browser-bookmarks"); | 264 | strcpy(Buffer+(*Length),"application/x-wap-prov.browser-bookmarks"); |
263 | (*Length)=(*Length)+40; //MIME-Type | 265 | (*Length)=(*Length)+40; //MIME-Type |
264 | Buffer[(*Length)++] = 0x00; //end inline string | 266 | Buffer[(*Length)++] = 0x00; //end inline string |
265 | strcpy(Buffer+(*Length),"\x81\xEA"); | 267 | strcpy(Buffer+(*Length),"\x81\xEA"); |
266 | (*Length)=(*Length)+2; //charset UTF-8 short int. | 268 | (*Length)=(*Length)+2; //charset UTF-8 short int. |
267 | 269 | ||
270 | /* removed by Joergen Thomsen */ | ||
268 | /* Block from sniffs. UNKNOWN */ | 271 | /* Block from sniffs. UNKNOWN */ |
269 | if (!UnicodeCoding) { | 272 | //if (!UnicodeCoding) { |
270 | Buffer[(*Length)++] = 0x00; | 273 | // Buffer[(*Length)++] = 0x00; |
271 | Buffer[(*Length)++] = 0x01; | 274 | // Buffer[(*Length)++] = 0x01; |
272 | } else { | 275 | //} else { |
273 | strcpy(Buffer+(*Length),"\x01\x01\x87\x68"); | 276 | // strcpy(Buffer+(*Length),"\x01\x01\x87\x68"); |
274 | (*Length)=(*Length)+4; | 277 | // (*Length)=(*Length)+4; |
275 | } | 278 | //} |
276 | Buffer[(*Length)++] = 0x00; | 279 | //Buffer[(*Length)++] = 0x00; |
280 | |||
281 | /* added by Joergen Thomsen */ | ||
282 | Buffer[(*Length)++] = 0x01; // Version WBXML 1.1 | ||
283 | Buffer[(*Length)++] = 0x01; // Unknown public identifier | ||
284 | Buffer[(*Length)++] = 0x6A; // charset UTF-8 | ||
285 | Buffer[(*Length)++] = 0x00; // string table length | ||
277 | 286 | ||
278 | Buffer[(*Length)++] = 0x45; //CHARACTERISTIC-LIST with content | 287 | Buffer[(*Length)++] = 0x45; //CHARACTERISTIC-LIST with content |
279 | /* URL */ | 288 | /* URL */ |
280 | Buffer[(*Length)++] = 0xC6; //CHARACTERISTIC with content and attributes | 289 | Buffer[(*Length)++] = 0xC6; //CHARACTERISTIC with content and attributes |
281 | Buffer[(*Length)++] = 0x7F; //TYPE = BOOKMARK | 290 | Buffer[(*Length)++] = 0x7F; //TYPE = BOOKMARK |
282 | Buffer[(*Length)++] = 0x01; //END PARMeter | 291 | Buffer[(*Length)++] = 0x01; //END PARMeter |
283 | if (!UnicodeCoding) { | 292 | |
284 | /* TITLE */ | 293 | /* removed by Joergen Thomsen */ |
285 | AddWAPSMSParameterText(Buffer, Length, 0x15, DecodeUnicodeString(bookmark->Title), UnicodeLength(bookmark->Title)); | 294 | // if (!UnicodeCoding) { |
286 | /* URL */ | 295 | // /* TITLE */ |
287 | AddWAPSMSParameterText(Buffer, Length, 0x17, DecodeUnicodeString(bookmark->Address), UnicodeLength(bookmark->Address)); | 296 | // AddWAPSMSParameterText(Buffer, Length, 0x15, DecodeUnicodeString(bookmark->Title), UnicodeLength(bookmark->Title)); |
288 | } else { | 297 | // /* URL */ |
298 | // AddWAPSMSParameterText(Buffer, Length, 0x17, DecodeUnicodeString(bookmark->Address), UnicodeLength(bookmark->Address)); | ||
299 | // } else { | ||
300 | // /* TITLE */ | ||
301 | // AddWAPSMSParameterText(Buffer, Length, 0x15, bookmark->Title, UnicodeLength(bookmark->Title)*2+1); | ||
302 | // /* URL */ | ||
303 | // AddWAPSMSParameterText(Buffer, Length, 0x17, bookmark->Address, UnicodeLength(bookmark->Address)*2+1); | ||
304 | // } | ||
305 | |||
306 | /* added by Joergen Thomsen */ | ||
289 | /* TITLE */ | 307 | /* TITLE */ |
290 | AddWAPSMSParameterText(Buffer, Length, 0x15, bookmark->Title, UnicodeLength(bookmark->Title)*2+1); | 308 | EncodeUTF8(buffer, bookmark->Title); |
309 | AddWAPSMSParameterText(Buffer, Length, 0x15, buffer, strlen(buffer)); | ||
291 | /* URL */ | 310 | /* URL */ |
292 | AddWAPSMSParameterText(Buffer, Length, 0x17, bookmark->Address, UnicodeLength(bookmark->Address)*2+1); | 311 | EncodeUTF8(buffer, bookmark->Address); |
312 | AddWAPSMSParameterText(Buffer, Length, 0x17, buffer, strlen(buffer)); | ||
313 | |||
314 | Buffer[(*Length)++] = 0x01; //END (CHARACTERISTIC) | ||
315 | Buffer[(*Length)++] = 0x01; //END (CHARACTERISTIC-LIST) | ||
293 | } | 316 | } |
294 | Buffer[(*Length)++] = 0x01; //END PARMeter | 317 | |
295 | Buffer[(*Length)++] = 0x01; //END PARMeter | 318 | void GSM_EncodeWAPIndicatorSMSText(unsigned char *Buffer, int *Length, char *Text, char *URL) |
319 | { | ||
320 | int i; | ||
321 | |||
322 | Buffer[(*Length)++] = 0x01; //Push ID | ||
323 | Buffer[(*Length)++] = 0x06; //PDU Type (push) | ||
324 | Buffer[(*Length)++] = 28; //Headers length (content type + headers) | ||
325 | strcpy(Buffer+(*Length),"\x1F\x23"); | ||
326 | (*Length)=(*Length)+2; //Value length | ||
327 | strcpy(Buffer+(*Length),"application/vnd.wap.sic"); | ||
328 | (*Length)=(*Length)+23; //MIME-Type | ||
329 | Buffer[(*Length)++] = 0x00; //end inline string | ||
330 | strcpy(Buffer+(*Length),"\x81\xEA"); | ||
331 | (*Length)=(*Length)+2; //charset UTF-8 short int. | ||
332 | |||
333 | Buffer[(*Length)++] = 0x02; // WBXML 1.2 | ||
334 | Buffer[(*Length)++] = 0x05; // SI 1.0 Public Identifier | ||
335 | Buffer[(*Length)++] = 0x6A; // charset UTF-8 | ||
336 | Buffer[(*Length)++] = 0x00; // string table length | ||
337 | Buffer[(*Length)++] = 0x45; // SI with content | ||
338 | Buffer[(*Length)++] = 0xC6; // indication with content and attributes | ||
339 | Buffer[(*Length)++] = 0x0B;// address | ||
340 | Buffer[(*Length)++] = 0x03; // Inline string | ||
341 | for (i=0;i<(int)strlen(URL);i++) { | ||
342 | Buffer[(*Length)++] = URL[i];//Text | ||
343 | } | ||
344 | Buffer[(*Length)++] = 0x00; // END Inline string | ||
345 | |||
346 | #ifdef XXX | ||
347 | Buffer[(*Length)++] = 0x0A;// created... | ||
348 | Buffer[(*Length)++] = 0xC3;// OPAQUE | ||
349 | Buffer[(*Length)++] = 0x07;// length | ||
350 | Buffer[(*Length)++] = 0x19;// year | ||
351 | Buffer[(*Length)++] = 0x80;// year | ||
352 | Buffer[(*Length)++] = 0x21;// month | ||
353 | Buffer[(*Length)++] = 0x12;// .. | ||
354 | Buffer[(*Length)++] = 0x00;// .. | ||
355 | Buffer[(*Length)++] = 0x00;// .. | ||
356 | Buffer[(*Length)++] = 0x00;// .. | ||
357 | Buffer[(*Length)++] = 0x10;// expires | ||
358 | Buffer[(*Length)++] = 0xC3;// OPAQUE | ||
359 | Buffer[(*Length)++] = 0x04;// length | ||
360 | Buffer[(*Length)++] = 0x20;// year | ||
361 | Buffer[(*Length)++] = 0x10;// year | ||
362 | Buffer[(*Length)++] = 0x06;// month | ||
363 | Buffer[(*Length)++] = 0x25;// day | ||
364 | #endif | ||
365 | |||
366 | Buffer[(*Length)++] = 0x01; // END (indication) | ||
367 | Buffer[(*Length)++] = 0x03; // Inline string | ||
368 | for (i=0;i<(int)strlen(Text);i++) { | ||
369 | Buffer[(*Length)++] = Text[i];//Text | ||
370 | } | ||
371 | Buffer[(*Length)++] = 0x00; // END Inline string | ||
372 | Buffer[(*Length)++] = 0x01; // END (indication) | ||
373 | Buffer[(*Length)++] = 0x01; // END (SI) | ||
296 | } | 374 | } |
297 | 375 | ||
298 | void GSM_EncodeMMSFile(GSM_EncodeMultiPartMMSInfo *Info, unsigned char *Buffer, int *Length) | 376 | void GSM_EncodeMMSFile(GSM_EncodeMultiPartMMSInfo *Info, unsigned char *Buffer, int *Length) |
299 | { | 377 | { |
300 | int i; | 378 | int i; |
301 | 379 | ||
302 | strcpy(Buffer+(*Length),"\x8C\x80\x98\x4F"); | 380 | strcpy(Buffer+(*Length),"\x8C\x80\x98\x4F"); |
303 | (*Length)=(*Length)+4; | 381 | (*Length)=(*Length)+4; |
304 | 382 | ||
305 | /* Unique MMS ID ? */ | 383 | /* Unique MMS ID ? */ |
306 | strcpy(Buffer+(*Length),"123456789"); | 384 | strcpy(Buffer+(*Length),"123456789"); |
307 | (*Length)=(*Length)+9; | 385 | (*Length)=(*Length)+9; |
diff --git a/gammu/emb/common/service/gsmdata.h b/gammu/emb/common/service/gsmdata.h index f5f8e07..e81589f 100644 --- a/gammu/emb/common/service/gsmdata.h +++ b/gammu/emb/common/service/gsmdata.h | |||
@@ -79,24 +79,26 @@ void NOKIA_EncodeWAPBookmarkSMSText (unsigned char *Buffer, int *Length, GSM_W | |||
79 | GSM_Error GSM_EncodeURLFile (unsigned char *Buffer, int *Length, GSM_WAPBookmark *bookmark); | 79 | GSM_Error GSM_EncodeURLFile (unsigned char *Buffer, int *Length, GSM_WAPBookmark *bookmark); |
80 | 80 | ||
81 | /* ------------------------------ MMS Indicator ---------------------------- */ | 81 | /* ------------------------------ MMS Indicator ---------------------------- */ |
82 | 82 | ||
83 | typedef struct { | 83 | typedef struct { |
84 | unsigned char Address[500]; | 84 | unsigned char Address[500]; |
85 | unsigned char Title[200]; | 85 | unsigned char Title[200]; |
86 | unsigned char Sender[200]; | 86 | unsigned char Sender[200]; |
87 | } GSM_MMSIndicator; | 87 | } GSM_MMSIndicator; |
88 | 88 | ||
89 | void GSM_EncodeMMSIndicatorSMSText(unsigned char *Buffer, int *Length, GSM_MMSIndicator Indicator); | 89 | void GSM_EncodeMMSIndicatorSMSText(unsigned char *Buffer, int *Length, GSM_MMSIndicator Indicator); |
90 | 90 | ||
91 | void GSM_EncodeWAPIndicatorSMSText(unsigned char *Buffer, int *Length, char *Text, char *URL); | ||
92 | |||
91 | /* ------------------------------ MMS file --------------------------------- */ | 93 | /* ------------------------------ MMS file --------------------------------- */ |
92 | 94 | ||
93 | #define MAX_MULTI_MMS 20 | 95 | #define MAX_MULTI_MMS 20 |
94 | 96 | ||
95 | typedef enum { | 97 | typedef enum { |
96 | MMS_Text = 1, | 98 | MMS_Text = 1, |
97 | MMS_Bitmap_JPG | 99 | MMS_Bitmap_JPG |
98 | } EncodeMultiPartMMSID; | 100 | } EncodeMultiPartMMSID; |
99 | 101 | ||
100 | typedef struct { | 102 | typedef struct { |
101 | EncodeMultiPartMMSID ID; | 103 | EncodeMultiPartMMSID ID; |
102 | 104 | ||
diff --git a/gammu/emb/common/service/gsmlogo.c b/gammu/emb/common/service/gsmlogo.c index c992915..7c19967 100644 --- a/gammu/emb/common/service/gsmlogo.c +++ b/gammu/emb/common/service/gsmlogo.c | |||
@@ -1,16 +1,17 @@ | |||
1 | /* (c) 2001-2004 by Marcin Wiacek */ | 1 | /* (c) 2001-2004 by Marcin Wiacek */ |
2 | 2 | ||
3 | #include <string.h> | 3 | #include <string.h> |
4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
5 | #include <sys/stat.h> | ||
5 | 6 | ||
6 | #include "../misc/misc.h" | 7 | #include "../misc/misc.h" |
7 | #include "../misc/coding/coding.h" | 8 | #include "../misc/coding/coding.h" |
8 | #include "gsmlogo.h" | 9 | #include "gsmlogo.h" |
9 | #include "gsmnet.h" | 10 | #include "gsmnet.h" |
10 | 11 | ||
11 | void PHONE_GetBitmapWidthHeight(GSM_Phone_Bitmap_Types Type, int *width, int *height) | 12 | void PHONE_GetBitmapWidthHeight(GSM_Phone_Bitmap_Types Type, int *width, int *height) |
12 | { | 13 | { |
13 | *width = 0; | 14 | *width = 0; |
14 | *height= 0; | 15 | *height= 0; |
15 | switch (Type) { | 16 | switch (Type) { |
16 | case GSM_EMSSmallPicture: *width=8; *height=8; break; | 17 | case GSM_EMSSmallPicture: *width=8; *height=8; break; |
@@ -152,24 +153,25 @@ void PHONE_DecodeBitmap(GSM_Phone_Bitmap_Types Type, char *buffer, GSM_Bitmap *B | |||
152 | Bitmap->Location = 0; | 153 | Bitmap->Location = 0; |
153 | Bitmap->Text[0] = 0; | 154 | Bitmap->Text[0] = 0; |
154 | Bitmap->Text[1] = 0; | 155 | Bitmap->Text[1] = 0; |
155 | Bitmap->BitmapEnabled = false; | 156 | Bitmap->BitmapEnabled = false; |
156 | Bitmap->DefaultName = false; | 157 | Bitmap->DefaultName = false; |
157 | Bitmap->DefaultBitmap = false; | 158 | Bitmap->DefaultBitmap = false; |
158 | Bitmap->DefaultRingtone = false; | 159 | Bitmap->DefaultRingtone = false; |
159 | Bitmap->RingtoneID = 0; | 160 | Bitmap->RingtoneID = 0; |
160 | Bitmap->NetworkCode[0] = 0; | 161 | Bitmap->NetworkCode[0] = 0; |
161 | Bitmap->Sender[0] = 0; | 162 | Bitmap->Sender[0] = 0; |
162 | Bitmap->Sender[1] = 0; | 163 | Bitmap->Sender[1] = 0; |
163 | Bitmap->ID = 0; | 164 | Bitmap->ID = 0; |
165 | Bitmap->Name = NULL; | ||
164 | 166 | ||
165 | GSM_ClearBitmap(Bitmap); | 167 | GSM_ClearBitmap(Bitmap); |
166 | for (x=0;x<Bitmap->BitmapWidth;x++) { | 168 | for (x=0;x<Bitmap->BitmapWidth;x++) { |
167 | for (y=0;y<Bitmap->BitmapHeight;y++) { | 169 | for (y=0;y<Bitmap->BitmapHeight;y++) { |
168 | if (PHONE_IsPointBitmap(Type, buffer, x, y, Bitmap->BitmapWidth, Bitmap->BitmapHeight)) { | 170 | if (PHONE_IsPointBitmap(Type, buffer, x, y, Bitmap->BitmapWidth, Bitmap->BitmapHeight)) { |
169 | GSM_SetPointBitmap(Bitmap,x,y); | 171 | GSM_SetPointBitmap(Bitmap,x,y); |
170 | } | 172 | } |
171 | } | 173 | } |
172 | } | 174 | } |
173 | } | 175 | } |
174 | 176 | ||
175 | void PHONE_ClearBitmap(GSM_Phone_Bitmap_Types Type, char *buffer, int width, int height) | 177 | void PHONE_ClearBitmap(GSM_Phone_Bitmap_Types Type, char *buffer, int width, int height) |
@@ -617,35 +619,35 @@ static GSM_Error savewbmp(FILE *file, GSM_MultiBitmap *bitmap) | |||
617 | return ERR_NONE; | 619 | return ERR_NONE; |
618 | } | 620 | } |
619 | 621 | ||
620 | GSM_Error GSM_SaveBitmapFile(char *FileName, GSM_MultiBitmap *bitmap) | 622 | GSM_Error GSM_SaveBitmapFile(char *FileName, GSM_MultiBitmap *bitmap) |
621 | { | 623 | { |
622 | FILE *file; | 624 | FILE *file; |
623 | GSM_Error error=ERR_NONE; | 625 | GSM_Error error=ERR_NONE; |
624 | 626 | ||
625 | file = fopen(FileName, "wb"); | 627 | file = fopen(FileName, "wb"); |
626 | if (file == NULL) return ERR_CANTOPENFILE; | 628 | if (file == NULL) return ERR_CANTOPENFILE; |
627 | 629 | ||
628 | /* Attempt to identify filetype */ | 630 | /* Attempt to identify filetype */ |
629 | if (strstr(FileName,".nlm")) { | 631 | if (mystrcasestr(FileName,".nlm")) { |
630 | error=savenlm(file,bitmap); | 632 | error=savenlm(file,bitmap); |
631 | } else if (strstr(FileName,".ngg")) { | 633 | } else if (mystrcasestr(FileName,".ngg")) { |
632 | error=savengg(file,bitmap); | 634 | error=savengg(file,bitmap); |
633 | } else if (strstr(FileName,".nol")) { | 635 | } else if (mystrcasestr(FileName,".nol")) { |
634 | error=savenol(file,bitmap); | 636 | error=savenol(file,bitmap); |
635 | } else if (strstr(FileName,".xpm")) { | 637 | } else if (mystrcasestr(FileName,".xpm")) { |
636 | error=savexpm(file,bitmap); | 638 | error=savexpm(file,bitmap); |
637 | } else if (strstr(FileName,".nsl")) { | 639 | } else if (mystrcasestr(FileName,".nsl")) { |
638 | error=savensl(file,bitmap); | 640 | error=savensl(file,bitmap); |
639 | } else if (strstr(FileName,".wbmp")) { | 641 | } else if (mystrcasestr(FileName,".wbmp")) { |
640 | error=savewbmp(file,bitmap); | 642 | error=savewbmp(file,bitmap); |
641 | } else { | 643 | } else { |
642 | error=savebmp(file,bitmap); | 644 | error=savebmp(file,bitmap); |
643 | } | 645 | } |
644 | fclose(file); | 646 | fclose(file); |
645 | 647 | ||
646 | return error; | 648 | return error; |
647 | } | 649 | } |
648 | 650 | ||
649 | GSM_Error BMP2Bitmap(unsigned char *buffer, FILE *file,GSM_Bitmap *bitmap) | 651 | GSM_Error BMP2Bitmap(unsigned char *buffer, FILE *file,GSM_Bitmap *bitmap) |
650 | { | 652 | { |
651 | bool first_white,isfile=false; | 653 | bool first_white,isfile=false; |
@@ -946,50 +948,83 @@ static GSM_Error loadwbmp(FILE *file, GSM_MultiBitmap *bitmap) | |||
946 | fread(buffer,1,4,file); | 948 | fread(buffer,1,4,file); |
947 | bitmap->Bitmap[0].BitmapWidth = buffer[2]; | 949 | bitmap->Bitmap[0].BitmapWidth = buffer[2]; |
948 | bitmap->Bitmap[0].BitmapHeight = buffer[3]; | 950 | bitmap->Bitmap[0].BitmapHeight = buffer[3]; |
949 | bitmap->Number = 1; | 951 | bitmap->Number = 1; |
950 | 952 | ||
951 | fread(buffer,1,10000,file); | 953 | fread(buffer,1,10000,file); |
952 | PHONE_DecodeBitmap(GSM_Nokia7110OperatorLogo, buffer, &bitmap->Bitmap[0]); | 954 | PHONE_DecodeBitmap(GSM_Nokia7110OperatorLogo, buffer, &bitmap->Bitmap[0]); |
953 | GSM_ReverseBitmap(&bitmap->Bitmap[0]); | 955 | GSM_ReverseBitmap(&bitmap->Bitmap[0]); |
954 | 956 | ||
955 | return ERR_NONE; | 957 | return ERR_NONE; |
956 | } | 958 | } |
957 | 959 | ||
960 | static GSM_Error loadgif(FILE *file, GSM_MultiBitmap *bitmap) | ||
961 | { | ||
962 | GSM_Bitmap *bmap = &bitmap->Bitmap[0]; | ||
963 | char *buffer; | ||
964 | struct stat st; | ||
965 | int length; | ||
966 | |||
967 | dbgprintf("loading gif file\n"); | ||
968 | fstat(fileno(file), &st); | ||
969 | bmap->BinaryPic.Length = length = st.st_size; | ||
970 | bmap->BinaryPic.Buffer = buffer = malloc(length); | ||
971 | if (bmap->BinaryPic.Buffer == NULL) | ||
972 | return ERR_MOREMEMORY; | ||
973 | |||
974 | fread(buffer, 1, length, file); | ||
975 | dbgprintf("Length %i name \"%s\"\n", length, | ||
976 | DecodeUnicodeString(bmap->Name)); | ||
977 | |||
978 | bmap->Type = GSM_PictureBinary; | ||
979 | bmap->BinaryPic.Type = PICTURE_GIF; | ||
980 | bmap->BitmapWidth = 256 * buffer[7] + buffer[6]; | ||
981 | bmap->BitmapHeight = 256 * buffer[9] + buffer[8]; | ||
982 | bitmap->Number = 1; | ||
983 | |||
984 | return ERR_NONE; | ||
985 | } | ||
986 | |||
958 | GSM_Error GSM_ReadBitmapFile(char *FileName, GSM_MultiBitmap *bitmap) | 987 | GSM_Error GSM_ReadBitmapFile(char *FileName, GSM_MultiBitmap *bitmap) |
959 | { | 988 | { |
960 | FILE *file; | 989 | FILE *file; |
961 | unsigned charbuffer[300]; | 990 | unsigned charbuffer[300]; |
962 | 991 | ||
963 | file = fopen(FileName, "rb"); | 992 | file = fopen(FileName, "rb"); |
964 | if (file == NULL) return ERR_CANTOPENFILE; | 993 | if (file == NULL) return ERR_CANTOPENFILE; |
965 | 994 | ||
995 | bitmap->Bitmap[0].Name = malloc((strlen(FileName) + 1) * 2); | ||
996 | if (bitmap->Bitmap[0].Name == NULL) return ERR_MOREMEMORY; | ||
997 | EncodeUnicode(bitmap->Bitmap[0].Name, FileName, strlen(FileName)); | ||
998 | |||
966 | fread(buffer, 1, 9, file); /* Read the header of the file. */ | 999 | fread(buffer, 1, 9, file); /* Read the header of the file. */ |
967 | rewind(file); | 1000 | rewind(file); |
968 | 1001 | ||
969 | bitmap->Bitmap[0].DefaultBitmap = false; | 1002 | bitmap->Bitmap[0].DefaultBitmap = false; |
970 | 1003 | ||
971 | /* Attempt to identify filetype */ | 1004 | /* Attempt to identify filetype */ |
972 | if (memcmp(buffer, "BM",2)==0) { | 1005 | if (memcmp(buffer, "BM",2)==0) { |
973 | return loadbmp(file,bitmap); | 1006 | return loadbmp(file,bitmap); |
974 | } else if (buffer[0] == 0x00 && buffer[1] == 0x00) { | 1007 | } else if (buffer[0] == 0x00 && buffer[1] == 0x00) { |
975 | return loadwbmp(file,bitmap); | 1008 | return loadwbmp(file,bitmap); |
976 | } else if (memcmp(buffer, "NLM",3)==0) { | 1009 | } else if (memcmp(buffer, "NLM",3)==0) { |
977 | return loadnlm(file,bitmap); | 1010 | return loadnlm(file,bitmap); |
978 | } else if (memcmp(buffer, "NOL",3)==0) { | 1011 | } else if (memcmp(buffer, "NOL",3)==0) { |
979 | return loadnolngg(file,bitmap,true); | 1012 | return loadnolngg(file,bitmap,true); |
980 | } else if (memcmp(buffer, "NGG",3)==0) { | 1013 | } else if (memcmp(buffer, "NGG",3)==0) { |
981 | return loadnolngg(file,bitmap,false); | 1014 | return loadnolngg(file,bitmap,false); |
982 | } else if (memcmp(buffer, "FORM",4)==0) { | 1015 | } else if (memcmp(buffer, "FORM",4)==0) { |
983 | return loadnsl(file,bitmap); | 1016 | return loadnsl(file,bitmap); |
1017 | } else if (memcmp(buffer, "GIF",3)==0) { | ||
1018 | return loadgif(file,bitmap); | ||
984 | } | 1019 | } |
985 | return ERR_UNKNOWN; | 1020 | return ERR_UNKNOWN; |
986 | } | 1021 | } |
987 | 1022 | ||
988 | void NOKIA_CopyBitmap(GSM_Phone_Bitmap_Types Type, GSM_Bitmap *Bitmap, char *Buffer, int *Length) | 1023 | void NOKIA_CopyBitmap(GSM_Phone_Bitmap_Types Type, GSM_Bitmap *Bitmap, char *Buffer, int *Length) |
989 | { | 1024 | { |
990 | int Width, Height; | 1025 | int Width, Height; |
991 | 1026 | ||
992 | Buffer[(*Length)++] = 0x00; | 1027 | Buffer[(*Length)++] = 0x00; |
993 | PHONE_GetBitmapWidthHeight(Type, &Width, &Height); | 1028 | PHONE_GetBitmapWidthHeight(Type, &Width, &Height); |
994 | Buffer[(*Length)++] = Width; | 1029 | Buffer[(*Length)++] = Width; |
995 | Buffer[(*Length)++] = Height; | 1030 | Buffer[(*Length)++] = Height; |
diff --git a/gammu/emb/common/service/gsmlogo.h b/gammu/emb/common/service/gsmlogo.h index b1b579d..6c6e2d8 100644 --- a/gammu/emb/common/service/gsmlogo.h +++ b/gammu/emb/common/service/gsmlogo.h | |||
@@ -1,19 +1,33 @@ | |||
1 | /* (c) 2002-2004 by Marcin Wiacek */ | 1 | /* (c) 2002-2004 by Marcin Wiacek */ |
2 | 2 | ||
3 | #ifndef __gsm_bitmaps_h | 3 | #ifndef __gsm_bitmaps_h |
4 | #define __gsm_bitmaps_h | 4 | #define __gsm_bitmaps_h |
5 | 5 | ||
6 | #include "../gsmcomon.h" | 6 | #include "../gsmcomon.h" |
7 | 7 | ||
8 | typedef enum { | ||
9 | PICTURE_BMP = 1, | ||
10 | PICTURE_GIF, | ||
11 | PICTURE_JPG, | ||
12 | PICTURE_ICN, | ||
13 | PICTURE_PNG | ||
14 | } GSM_BinaryPicture_Types; | ||
15 | |||
16 | typedef struct { | ||
17 | GSM_BinaryPicture_Types Type; | ||
18 | unsigned char *Buffer; | ||
19 | int Length; | ||
20 | } GSM_BinaryPicture; | ||
21 | |||
8 | /** | 22 | /** |
9 | * Enum to handle all possible bitmaps, which are not saved in various filesystems. | 23 | * Enum to handle all possible bitmaps, which are not saved in various filesystems. |
10 | */ | 24 | */ |
11 | typedef enum { | 25 | typedef enum { |
12 | GSM_None = 1, | 26 | GSM_None = 1, |
13 | /** | 27 | /** |
14 | * ID of static file in filesystem displayed during startup | 28 | * ID of static file in filesystem displayed during startup |
15 | */ | 29 | */ |
16 | GSM_ColourStartupLogo_ID, | 30 | GSM_ColourStartupLogo_ID, |
17 | /** | 31 | /** |
18 | * Static mono bitmap/ID of animated mono bitmap displayed during startup | 32 | * Static mono bitmap/ID of animated mono bitmap displayed during startup |
19 | */ | 33 | */ |
@@ -36,25 +50,29 @@ typedef enum { | |||
36 | GSM_CallerGroupLogo, | 50 | GSM_CallerGroupLogo, |
37 | /** | 51 | /** |
38 | * Text displayed during startup, which can't be removed from phone menu | 52 | * Text displayed during startup, which can't be removed from phone menu |
39 | */ | 53 | */ |
40 | GSM_DealerNote_Text, | 54 | GSM_DealerNote_Text, |
41 | /** | 55 | /** |
42 | * Text displayed during startup | 56 | * Text displayed during startup |
43 | */ | 57 | */ |
44 | GSM_WelcomeNote_Text, | 58 | GSM_WelcomeNote_Text, |
45 | /** | 59 | /** |
46 | * Image defined in Smart Messaging specification | 60 | * Image defined in Smart Messaging specification |
47 | */ | 61 | */ |
48 | GSM_PictureImage | 62 | GSM_PictureImage, |
63 | /** | ||
64 | * Binary picture (BMP, GIF, etc.) | ||
65 | */ | ||
66 | GSM_PictureBinary | ||
49 | } GSM_Bitmap_Types; | 67 | } GSM_Bitmap_Types; |
50 | 68 | ||
51 | #define GSM_BITMAP_SIZE(65+7)/8*96 | 69 | #define GSM_BITMAP_SIZE(65+7)/8*96 |
52 | #define GSM_BITMAP_TEXT_LENGTH 128 | 70 | #define GSM_BITMAP_TEXT_LENGTH 128 |
53 | 71 | ||
54 | /** | 72 | /** |
55 | * Structure for all possible bitmaps, which are not saved in various filesystems | 73 | * Structure for all possible bitmaps, which are not saved in various filesystems |
56 | */ | 74 | */ |
57 | typedef struct { | 75 | typedef struct { |
58 | /** | 76 | /** |
59 | * For all: bitmap type | 77 | * For all: bitmap type |
60 | */ | 78 | */ |
@@ -106,24 +124,32 @@ typedef struct { | |||
106 | /** | 124 | /** |
107 | * For operator logos: Network operator code | 125 | * For operator logos: Network operator code |
108 | */ | 126 | */ |
109 | char NetworkCode[7]; | 127 | char NetworkCode[7]; |
110 | /** | 128 | /** |
111 | * For picture images: number of sender | 129 | * For picture images: number of sender |
112 | */ | 130 | */ |
113 | unsigned char Sender[2 * (GSM_MAX_NUMBER_LENGTH + 1)]; | 131 | unsigned char Sender[2 * (GSM_MAX_NUMBER_LENGTH + 1)]; |
114 | /** | 132 | /** |
115 | * For colour bitmaps: ID | 133 | * For colour bitmaps: ID |
116 | */ | 134 | */ |
117 | unsigned char ID; | 135 | unsigned char ID; |
136 | /** | ||
137 | * For binary pictures (GIF, BMP, etc.): frame and length | ||
138 | */ | ||
139 | GSM_BinaryPicture BinaryPic; | ||
140 | /** | ||
141 | * Bitmap name | ||
142 | */ | ||
143 | char *Name; | ||
118 | } GSM_Bitmap; | 144 | } GSM_Bitmap; |
119 | 145 | ||
120 | #define MAX_MULTI_BITMAP 6 | 146 | #define MAX_MULTI_BITMAP 6 |
121 | 147 | ||
122 | /** | 148 | /** |
123 | * Structure to handle more than one bitmap | 149 | * Structure to handle more than one bitmap |
124 | */ | 150 | */ |
125 | typedef struct { | 151 | typedef struct { |
126 | /** | 152 | /** |
127 | * Number of bitmaps | 153 | * Number of bitmaps |
128 | */ | 154 | */ |
129 | unsigned char Number; | 155 | unsigned char Number; |
diff --git a/gammu/emb/common/service/gsmmisc.h b/gammu/emb/common/service/gsmmisc.h index 37501ad..793d3d1 100644 --- a/gammu/emb/common/service/gsmmisc.h +++ b/gammu/emb/common/service/gsmmisc.h | |||
@@ -283,25 +283,30 @@ typedef struct { | |||
283 | typedef struct { | 283 | typedef struct { |
284 | int Location; | 284 | int Location; |
285 | unsigned char Name[300]; | 285 | unsigned char Name[300]; |
286 | unsigned char URL[500]; | 286 | unsigned char URL[500]; |
287 | bool Active; | 287 | bool Active; |
288 | } GSM_GPRSAccessPoint; | 288 | } GSM_GPRSAccessPoint; |
289 | 289 | ||
290 | /* ------------------------------------------------------------------------ */ | 290 | /* ------------------------------------------------------------------------ */ |
291 | 291 | ||
292 | typedef enum { | 292 | typedef enum { |
293 | GSM_Date_DDMMYYYY = 1, | 293 | GSM_Date_DDMMYYYY = 1, |
294 | GSM_Date_MMDDYYYY, | 294 | GSM_Date_MMDDYYYY, |
295 | GSM_Date_YYYYMMDD | 295 | GSM_Date_YYYYMMDD, |
296 | GSM_Date_DDMMMYY, | ||
297 | GSM_Date_MMDDYY, | ||
298 | GSM_Date_DDMMYY, | ||
299 | GSM_Date_YYMMDD, | ||
300 | GSM_Date_OFF | ||
296 | } GSM_DateFormat; | 301 | } GSM_DateFormat; |
297 | 302 | ||
298 | typedef struct { | 303 | typedef struct { |
299 | unsigned char DateSeparator; | 304 | unsigned char DateSeparator; |
300 | GSM_DateFormatDateFormat; | 305 | GSM_DateFormatDateFormat; |
301 | bool AMPMTime; | 306 | bool AMPMTime; |
302 | } GSM_Locale; | 307 | } GSM_Locale; |
303 | 308 | ||
304 | /* ------------------------------------------------------------------------ */ | 309 | /* ------------------------------------------------------------------------ */ |
305 | 310 | ||
306 | void ReadVCALDateTime(char *Buffer, GSM_DateTime *dt); | 311 | void ReadVCALDateTime(char *Buffer, GSM_DateTime *dt); |
307 | void SaveVCALDateTime(char *Buffer, int *Length, GSM_DateTime *Date, char *Start); | 312 | void SaveVCALDateTime(char *Buffer, int *Length, GSM_DateTime *Date, char *Start); |
diff --git a/gammu/emb/common/service/gsmring.c b/gammu/emb/common/service/gsmring.c index 7df46f1..dab028c 100644 --- a/gammu/emb/common/service/gsmring.c +++ b/gammu/emb/common/service/gsmring.c | |||
@@ -1,21 +1,24 @@ | |||
1 | /* (c) 2001-2004 by Marcin Wiacek */ | 1 | /* (c) 2001-2004 by Marcin Wiacek */ |
2 | /* Based on some work from Ralf Thelen (7110 ringtones), | 2 | /* Based on some work from Ralf Thelen (7110 ringtones) and others */ |
3 | * Gnokii (RTTL and SM) and others | 3 | /* Based on some work (RTTL and SM) from Gnokii (www.gnokii.org) |
4 | * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot | ||
5 | * GNU GPL version 2 or later | ||
4 | */ | 6 | */ |
5 | 7 | ||
6 | #include <stdlib.h> | 8 | #include <stdlib.h> |
7 | #include <string.h> | 9 | #include <string.h> |
8 | #include <ctype.h> | 10 | #include <ctype.h> |
9 | #include <math.h> | 11 | #include <math.h> |
12 | #include <sys/stat.h> | ||
10 | #ifdef WIN32 | 13 | #ifdef WIN32 |
11 | # include <windows.h> | 14 | # include <windows.h> |
12 | #endif | 15 | #endif |
13 | 16 | ||
14 | #include "../gsmcomon.h" | 17 | #include "../gsmcomon.h" |
15 | #include "../misc/coding/coding.h" | 18 | #include "../misc/coding/coding.h" |
16 | #include "../gsmstate.h" | 19 | #include "../gsmstate.h" |
17 | #include "gsmring.h" | 20 | #include "gsmring.h" |
18 | #include "sms/gsmsms.h" | 21 | #include "sms/gsmsms.h" |
19 | 22 | ||
20 | int GSM_RingNoteGetFrequency(GSM_RingNote Note) | 23 | int GSM_RingNoteGetFrequency(GSM_RingNote Note) |
21 | { | 24 | { |
@@ -147,24 +150,30 @@ static GSM_Error savebin(FILE *file, GSM_Ringtone *ringtone) | |||
147 | fwrite(&nullchar,1,1,file); | 150 | fwrite(&nullchar,1,1,file); |
148 | fwrite(&nullchar,1,1,file); | 151 | fwrite(&nullchar,1,1,file); |
149 | fwrite(ringtone->NokiaBinary.Frame,1,ringtone->NokiaBinary.Length,file); | 152 | fwrite(ringtone->NokiaBinary.Frame,1,ringtone->NokiaBinary.Length,file); |
150 | return ERR_NONE; | 153 | return ERR_NONE; |
151 | } | 154 | } |
152 | 155 | ||
153 | static GSM_Error savepuremidi(FILE *file, GSM_Ringtone *ringtone) | 156 | static GSM_Error savepuremidi(FILE *file, GSM_Ringtone *ringtone) |
154 | { | 157 | { |
155 | fwrite(ringtone->NokiaBinary.Frame,1,ringtone->NokiaBinary.Length,file); | 158 | fwrite(ringtone->NokiaBinary.Frame,1,ringtone->NokiaBinary.Length,file); |
156 | return ERR_NONE; | 159 | return ERR_NONE; |
157 | } | 160 | } |
158 | 161 | ||
162 | static GSM_Error savemmf(FILE *file, GSM_Ringtone *ringtone) | ||
163 | { | ||
164 | fwrite(ringtone->NokiaBinary.Frame,1,ringtone->NokiaBinary.Length,file); | ||
165 | return ERR_NONE; | ||
166 | } | ||
167 | |||
159 | GSM_Error saverttl(FILE *file, GSM_Ringtone *ringtone) | 168 | GSM_Error saverttl(FILE *file, GSM_Ringtone *ringtone) |
160 | { | 169 | { |
161 | GSM_RingNoteScaleDefNoteScale; | 170 | GSM_RingNoteScaleDefNoteScale; |
162 | GSM_RingNoteDurationDefNoteDuration; | 171 | GSM_RingNoteDurationDefNoteDuration; |
163 | 172 | ||
164 | GSM_RingNoteStyleDefNoteStyle=0; | 173 | GSM_RingNoteStyleDefNoteStyle=0; |
165 | int DefNoteTempo=0; | 174 | int DefNoteTempo=0; |
166 | 175 | ||
167 | bool started = false, firstcomma = true; | 176 | bool started = false, firstcomma = true; |
168 | GSM_RingNote *Note; | 177 | GSM_RingNote *Note; |
169 | 178 | ||
170 | unsigned char buffer[15]; | 179 | unsigned char buffer[15]; |
@@ -476,24 +485,27 @@ GSM_Error GSM_SaveRingtoneFile(char *FileName, GSM_Ringtone *ringtone) | |||
476 | } else if (strstr(FileName,".wav")) { | 485 | } else if (strstr(FileName,".wav")) { |
477 | savewav(file,ringtone); | 486 | savewav(file,ringtone); |
478 | } else { | 487 | } else { |
479 | saverttl(file, ringtone); | 488 | saverttl(file, ringtone); |
480 | } | 489 | } |
481 | break; | 490 | break; |
482 | case RING_NOKIABINARY: | 491 | case RING_NOKIABINARY: |
483 | savebin(file, ringtone); | 492 | savebin(file, ringtone); |
484 | break; | 493 | break; |
485 | case RING_MIDI: | 494 | case RING_MIDI: |
486 | savepuremidi(file, ringtone); | 495 | savepuremidi(file, ringtone); |
487 | break; | 496 | break; |
497 | case RING_MMF: | ||
498 | savemmf(file, ringtone); | ||
499 | break; | ||
488 | } | 500 | } |
489 | 501 | ||
490 | fclose(file); | 502 | fclose(file); |
491 | 503 | ||
492 | return ERR_NONE; | 504 | return ERR_NONE; |
493 | } | 505 | } |
494 | 506 | ||
495 | static GSM_Error loadrttl(FILE *file, GSM_Ringtone *ringtone) | 507 | static GSM_Error loadrttl(FILE *file, GSM_Ringtone *ringtone) |
496 | { | 508 | { |
497 | GSM_RingNoteScale DefNoteScale= Scale_880; | 509 | GSM_RingNoteScale DefNoteScale= Scale_880; |
498 | GSM_RingNoteDuration DefNoteDuration= Duration_1_4; | 510 | GSM_RingNoteDuration DefNoteDuration= Duration_1_4; |
499 | GSM_RingNoteStyle DefNoteStyle= NaturalStyle; | 511 | GSM_RingNoteStyle DefNoteStyle= NaturalStyle; |
@@ -760,24 +772,44 @@ static GSM_Error loadbin(FILE *file, GSM_Ringtone *ringtone) | |||
760 | static GSM_Error loadpuremidi(FILE *file, GSM_Ringtone *ringtone) | 772 | static GSM_Error loadpuremidi(FILE *file, GSM_Ringtone *ringtone) |
761 | { | 773 | { |
762 | unsigned char buffer[30000]; | 774 | unsigned char buffer[30000]; |
763 | 775 | ||
764 | dbgprintf("loading midi\n"); | 776 | dbgprintf("loading midi\n"); |
765 | EncodeUnicode(ringtone->Name,"MIDI",4); | 777 | EncodeUnicode(ringtone->Name,"MIDI",4); |
766 | ringtone->NokiaBinary.Length=fread(buffer, 1, 30000, file); | 778 | ringtone->NokiaBinary.Length=fread(buffer, 1, 30000, file); |
767 | memcpy(ringtone->NokiaBinary.Frame,buffer,ringtone->NokiaBinary.Length); | 779 | memcpy(ringtone->NokiaBinary.Frame,buffer,ringtone->NokiaBinary.Length); |
768 | dbgprintf("Length %i name \"%s\"\n",ringtone->NokiaBinary.Length,DecodeUnicodeString(ringtone->Name)); | 780 | dbgprintf("Length %i name \"%s\"\n",ringtone->NokiaBinary.Length,DecodeUnicodeString(ringtone->Name)); |
769 | return ERR_NONE; | 781 | return ERR_NONE; |
770 | } | 782 | } |
771 | 783 | ||
784 | static GSM_Error loadmmf(FILE *file, GSM_Ringtone *ringtone) | ||
785 | { | ||
786 | struct stat st; | ||
787 | char *buffer; | ||
788 | int length; | ||
789 | |||
790 | dbgprintf("loading smaf file\n"); | ||
791 | fstat(fileno(file), &st); | ||
792 | ringtone->BinaryTone.Length = length = st.st_size; | ||
793 | ringtone->BinaryTone.Buffer = buffer = malloc(length); | ||
794 | if (buffer == NULL) | ||
795 | return ERR_MOREMEMORY; | ||
796 | fread(buffer, 1, length, file); | ||
797 | |||
798 | dbgprintf("Length %i name \"%s\"\n", length, | ||
799 | DecodeUnicodeString(ringtone->Name)); | ||
800 | |||
801 | return ERR_NONE; | ||
802 | } | ||
803 | |||
772 | static GSM_Error loadre(FILE *file, GSM_Ringtone *ringtone) | 804 | static GSM_Error loadre(FILE *file, GSM_Ringtone *ringtone) |
773 | { | 805 | { |
774 | unsigned char buffer[2000]; | 806 | unsigned char buffer[2000]; |
775 | 807 | ||
776 | ringtone->NokiaBinary.Length=fread(buffer, 1, 500, file); | 808 | ringtone->NokiaBinary.Length=fread(buffer, 1, 500, file); |
777 | 809 | ||
778 | if (buffer[18]==0x00 && buffer[21]!=0x02) { | 810 | if (buffer[18]==0x00 && buffer[21]!=0x02) { |
779 | /* DCT3, Unicode subformat, 62xx & 7110 */ | 811 | /* DCT3, Unicode subformat, 62xx & 7110 */ |
780 | CopyUnicodeString(ringtone->Name,buffer+18); | 812 | CopyUnicodeString(ringtone->Name,buffer+18); |
781 | ringtone->NokiaBinary.Length = ringtone->NokiaBinary.Length - (21+UnicodeLength(ringtone->Name)*2); | 813 | ringtone->NokiaBinary.Length = ringtone->NokiaBinary.Length - (21+UnicodeLength(ringtone->Name)*2); |
782 | memcpy(ringtone->NokiaBinary.Frame,buffer+21+UnicodeLength(ringtone->Name)*2,ringtone->NokiaBinary.Length); | 814 | memcpy(ringtone->NokiaBinary.Frame,buffer+21+UnicodeLength(ringtone->Name)*2,ringtone->NokiaBinary.Length); |
783 | } else { | 815 | } else { |
@@ -807,24 +839,28 @@ GSM_Error GSM_ReadRingtoneFile(char *FileName, GSM_Ringtone *ringtone) | |||
807 | if (buffer[0]==0x00 && buffer[1]==0x00 && | 839 | if (buffer[0]==0x00 && buffer[1]==0x00 && |
808 | buffer[2]==0x0C && buffer[3]==0x01) { | 840 | buffer[2]==0x0C && buffer[3]==0x01) { |
809 | ringtone->Format = RING_NOKIABINARY; | 841 | ringtone->Format = RING_NOKIABINARY; |
810 | } | 842 | } |
811 | if (buffer[0]==0x00 && buffer[1]==0x00 && | 843 | if (buffer[0]==0x00 && buffer[1]==0x00 && |
812 | buffer[2]==0x00) { | 844 | buffer[2]==0x00) { |
813 | ringtone->Format = RING_NOKIABINARY; | 845 | ringtone->Format = RING_NOKIABINARY; |
814 | } | 846 | } |
815 | if (buffer[0]==0x4D && buffer[1]==0x54 && | 847 | if (buffer[0]==0x4D && buffer[1]==0x54 && |
816 | buffer[2]==0x68 && buffer[3]==0x64) { | 848 | buffer[2]==0x68 && buffer[3]==0x64) { |
817 | ringtone->Format = RING_MIDI; | 849 | ringtone->Format = RING_MIDI; |
818 | } | 850 | } |
851 | if (buffer[0]==0x4D && buffer[1]==0x4D && | ||
852 | buffer[2]==0x4D && buffer[3]==0x44) { | ||
853 | ringtone->Format = RING_MMF; | ||
854 | } | ||
819 | } | 855 | } |
820 | rewind(file); | 856 | rewind(file); |
821 | switch (ringtone->Format) { | 857 | switch (ringtone->Format) { |
822 | case RING_NOTETONE: | 858 | case RING_NOTETONE: |
823 | if (buffer[0]==0x02 && buffer[1]==0x4A) { | 859 | if (buffer[0]==0x02 && buffer[1]==0x4A) { |
824 | error=loadott(file,ringtone); | 860 | error=loadott(file,ringtone); |
825 | } else if (buffer[0]==0xC7 && buffer[1]==0x45) { | 861 | } else if (buffer[0]==0xC7 && buffer[1]==0x45) { |
826 | error=loadcommunicator(file,ringtone); | 862 | error=loadcommunicator(file,ringtone); |
827 | } else { | 863 | } else { |
828 | error=loadrttl(file,ringtone); | 864 | error=loadrttl(file,ringtone); |
829 | } | 865 | } |
830 | ringtone->NoteTone.AllNotesScale=false; | 866 | ringtone->NoteTone.AllNotesScale=false; |
@@ -833,24 +869,29 @@ GSM_Error GSM_ReadRingtoneFile(char *FileName, GSM_Ringtone *ringtone) | |||
833 | if (buffer[0]==0x00 && buffer[1]==0x00 && | 869 | if (buffer[0]==0x00 && buffer[1]==0x00 && |
834 | buffer[2]==0x0C && buffer[3]==0x01) { | 870 | buffer[2]==0x0C && buffer[3]==0x01) { |
835 | error=loadbin(file,ringtone); | 871 | error=loadbin(file,ringtone); |
836 | } | 872 | } |
837 | if (buffer[0]==0x00 && buffer[1]==0x00 && | 873 | if (buffer[0]==0x00 && buffer[1]==0x00 && |
838 | buffer[2]==0x00) { | 874 | buffer[2]==0x00) { |
839 | error=loadre(file,ringtone); | 875 | error=loadre(file,ringtone); |
840 | } | 876 | } |
841 | break; | 877 | break; |
842 | case RING_MIDI: | 878 | case RING_MIDI: |
843 | EncodeUnicode(ringtone->Name,FileName,strlen(FileName)); | 879 | EncodeUnicode(ringtone->Name,FileName,strlen(FileName)); |
844 | error = loadpuremidi(file,ringtone); | 880 | error = loadpuremidi(file,ringtone); |
881 | break; | ||
882 | case RING_MMF: | ||
883 | EncodeUnicode(ringtone->Name,FileName,strlen(FileName)); | ||
884 | error = loadmmf(file,ringtone); | ||
885 | break; | ||
845 | } | 886 | } |
846 | fclose(file); | 887 | fclose(file); |
847 | return(error); | 888 | return(error); |
848 | } | 889 | } |
849 | 890 | ||
850 | /* -------------------------- required with Nokia & RTTL ------------------- */ | 891 | /* -------------------------- required with Nokia & RTTL ------------------- */ |
851 | 892 | ||
852 | /* Beats per Minute like written in Smart Messaging */ | 893 | /* Beats per Minute like written in Smart Messaging */ |
853 | static int SM_BeatsPerMinute[] = { | 894 | static int SM_BeatsPerMinute[] = { |
854 | 25, 28, 31, 35, 40, 45, 50, 56, 63,70, | 895 | 25, 28, 31, 35, 40, 45, 50, 56, 63,70, |
855 | 80, 90, 100, 112, 125, 140, 160, 180, 200,225, | 896 | 80, 90, 100, 112, 125, 140, 160, 180, 200,225, |
856 | 250, 285, 320, 355, 400, 450, 500, 565, 635,715, | 897 | 250, 285, 320, 355, 400, 450, 500, 565, 635,715, |
diff --git a/gammu/emb/common/service/gsmring.h b/gammu/emb/common/service/gsmring.h index 207cf31..2d2dd7a 100644 --- a/gammu/emb/common/service/gsmring.h +++ b/gammu/emb/common/service/gsmring.h | |||
@@ -111,39 +111,41 @@ typedef enum { | |||
111 | typedef struct { | 111 | typedef struct { |
112 | GSM_RingCommandType Type; | 112 | GSM_RingCommandType Type; |
113 | GSM_RingNote Note; | 113 | GSM_RingNote Note; |
114 | unsigned char Value; | 114 | unsigned char Value; |
115 | } GSM_RingCommand; | 115 | } GSM_RingCommand; |
116 | 116 | ||
117 | typedef struct { | 117 | typedef struct { |
118 | int NrCommands; | 118 | int NrCommands; |
119 | GSM_RingCommand Commands[MAX_RINGTONE_NOTES]; | 119 | GSM_RingCommand Commands[MAX_RINGTONE_NOTES]; |
120 | bool AllNotesScale; | 120 | bool AllNotesScale; |
121 | } GSM_NoteRingtone; | 121 | } GSM_NoteRingtone; |
122 | 122 | ||
123 | /* FIXME: should use BinaryTone instead? */ | ||
123 | /* Structure to hold Nokia binary ringtones. */ | 124 | /* Structure to hold Nokia binary ringtones. */ |
124 | typedef struct { | 125 | typedef struct { |
125 | unsigned char Frame[30000]; | 126 | unsigned char Frame[50000]; |
126 | int Length; | 127 | int Length; |
127 | } GSM_NokiaBinaryRingtone; | 128 | } GSM_NokiaBinaryRingtone; |
128 | 129 | ||
129 | typedef struct { | 130 | typedef struct { |
130 | unsigned char *Frame; | 131 | unsigned char *Buffer; |
131 | int Length; | 132 | int Length; |
132 | } GSM_BinaryTone; | 133 | } GSM_BinaryTone; |
133 | 134 | ||
134 | typedef enum { | 135 | typedef enum { |
135 | RING_NOTETONE = 1, | 136 | RING_NOTETONE = 1, |
136 | RING_NOKIABINARY, | 137 | RING_NOKIABINARY, |
137 | RING_MIDI | 138 | RING_MIDI, |
139 | RING_MMF | ||
138 | } GSM_RingtoneFormat; | 140 | } GSM_RingtoneFormat; |
139 | 141 | ||
140 | /** | 142 | /** |
141 | * Structure for saving various ringtones formats | 143 | * Structure for saving various ringtones formats |
142 | */ | 144 | */ |
143 | typedef struct { | 145 | typedef struct { |
144 | /** | 146 | /** |
145 | * Ringtone saved in one of three formats | 147 | * Ringtone saved in one of three formats |
146 | */ | 148 | */ |
147 | GSM_NokiaBinaryRingtone NokiaBinary; | 149 | GSM_NokiaBinaryRingtone NokiaBinary; |
148 | GSM_BinaryTone BinaryTone; | 150 | GSM_BinaryTone BinaryTone; |
149 | GSM_NoteRingtone NoteTone; | 151 | GSM_NoteRingtone NoteTone; |
diff --git a/gammu/emb/common/service/sms/gsmmulti.c b/gammu/emb/common/service/sms/gsmmulti.c index 6c1cdcd..bdb5ee9 100644 --- a/gammu/emb/common/service/sms/gsmmulti.c +++ b/gammu/emb/common/service/sms/gsmmulti.c | |||
@@ -478,24 +478,29 @@ GSM_Error GSM_EncodeMultiPartSMS(GSM_MultiPartSMSInfo *Info, | |||
478 | for (i=0;i<Info->Entries[0].Bitmap->Number;i++) { | 478 | for (i=0;i<Info->Entries[0].Bitmap->Number;i++) { |
479 | Buffer[Length++] = Info->Entries[0].Bitmap->Bitmap[i].BitmapWidth; | 479 | Buffer[Length++] = Info->Entries[0].Bitmap->Bitmap[i].BitmapWidth; |
480 | Buffer[Length++] = Info->Entries[0].Bitmap->Bitmap[i].BitmapHeight; | 480 | Buffer[Length++] = Info->Entries[0].Bitmap->Bitmap[i].BitmapHeight; |
481 | PHONE_EncodeBitmap(GSM_AlcatelBMMIPicture, Buffer+Length, &Info->Entries[0].Bitmap->Bitmap[i]); | 481 | PHONE_EncodeBitmap(GSM_AlcatelBMMIPicture, Buffer+Length, &Info->Entries[0].Bitmap->Bitmap[i]); |
482 | Length += PHONE_GetBitmapSize(GSM_AlcatelBMMIPicture,Info->Entries[0].Bitmap->Bitmap[i].BitmapWidth,Info->Entries[0].Bitmap->Bitmap[i].BitmapHeight); | 482 | Length += PHONE_GetBitmapSize(GSM_AlcatelBMMIPicture,Info->Entries[0].Bitmap->Bitmap[i].BitmapWidth,Info->Entries[0].Bitmap->Bitmap[i].BitmapHeight); |
483 | } | 483 | } |
484 | return GSM_EncodeAlcatelMultiPartSMS(SMS,Buffer,Length,Info->Entries[0].Bitmap->Bitmap[0].Text,ALCATELTDD_ANIMATION); | 484 | return GSM_EncodeAlcatelMultiPartSMS(SMS,Buffer,Length,Info->Entries[0].Bitmap->Bitmap[0].Text,ALCATELTDD_ANIMATION); |
485 | case SMS_MMSIndicatorLong: | 485 | case SMS_MMSIndicatorLong: |
486 | Class= 1; | 486 | Class= 1; |
487 | UDH= UDH_MMSIndicatorLong; | 487 | UDH= UDH_MMSIndicatorLong; |
488 | GSM_EncodeMMSIndicatorSMSText(Buffer,&Length,*Info->Entries[0].MMSIndicator); | 488 | GSM_EncodeMMSIndicatorSMSText(Buffer,&Length,*Info->Entries[0].MMSIndicator); |
489 | break; | 489 | break; |
490 | case SMS_WAPIndicatorLong: | ||
491 | Class= 1; | ||
492 | UDH= UDH_MMSIndicatorLong; | ||
493 | GSM_EncodeWAPIndicatorSMSText(Buffer,&Length,Info->Entries[0].MMSIndicator->Title,Info->Entries[0].MMSIndicator->Address); | ||
494 | break; | ||
490 | case SMS_NokiaRingtoneLong: | 495 | case SMS_NokiaRingtoneLong: |
491 | case SMS_NokiaRingtone: | 496 | case SMS_NokiaRingtone: |
492 | UDH= UDH_NokiaRingtone; | 497 | UDH= UDH_NokiaRingtone; |
493 | Class= 1; | 498 | Class= 1; |
494 | /* 7 = length of UDH_NokiaRingtone UDH header */ | 499 | /* 7 = length of UDH_NokiaRingtone UDH header */ |
495 | Length = GSM_MAX_8BIT_SMS_LENGTH-7; | 500 | Length = GSM_MAX_8BIT_SMS_LENGTH-7; |
496 | Info->Entries[0].RingtoneNotes = GSM_EncodeNokiaRTTLRingtone(*Info->Entries[0].Ringtone,Buffer,&Length); | 501 | Info->Entries[0].RingtoneNotes = GSM_EncodeNokiaRTTLRingtone(*Info->Entries[0].Ringtone,Buffer,&Length); |
497 | if (Info->Entries[0].ID == SMS_NokiaRingtone) break; | 502 | if (Info->Entries[0].ID == SMS_NokiaRingtone) break; |
498 | if (Info->Entries[0].RingtoneNotes != Info->Entries[0].Ringtone->NoteTone.NrCommands) { | 503 | if (Info->Entries[0].RingtoneNotes != Info->Entries[0].Ringtone->NoteTone.NrCommands) { |
499 | UDH = UDH_NokiaRingtoneLong; | 504 | UDH = UDH_NokiaRingtoneLong; |
500 | Length = (GSM_MAX_8BIT_SMS_LENGTH-12)*3; | 505 | Length = (GSM_MAX_8BIT_SMS_LENGTH-12)*3; |
501 | Info->Entries[0].RingtoneNotes = GSM_EncodeNokiaRTTLRingtone(*Info->Entries[0].Ringtone,Buffer,&Length); | 506 | Info->Entries[0].RingtoneNotes = GSM_EncodeNokiaRTTLRingtone(*Info->Entries[0].Ringtone,Buffer,&Length); |
diff --git a/gammu/emb/common/service/sms/gsmmulti.h b/gammu/emb/common/service/sms/gsmmulti.h index c672261..3f70d81 100644 --- a/gammu/emb/common/service/sms/gsmmulti.h +++ b/gammu/emb/common/service/sms/gsmmulti.h | |||
@@ -1,17 +1,21 @@ | |||
1 | /* (c) 2002-2004 by Marcin Wiacek */ | 1 | /* (c) 2002-2004 by Marcin Wiacek */ |
2 | 2 | ||
3 | #ifndef __gsm_multi_h | 3 | #ifndef __gsm_multi_h |
4 | #define __gsm_multi_h | 4 | #define __gsm_multi_h |
5 | 5 | ||
6 | #if defined(_MSC_VER) && defined(__cplusplus) | ||
7 | extern "C" { | ||
8 | #endif | ||
9 | |||
6 | #include "../../gsmcomon.h" | 10 | #include "../../gsmcomon.h" |
7 | #include "../gsmlogo.h" | 11 | #include "../gsmlogo.h" |
8 | #include "../gsmcal.h" | 12 | #include "../gsmcal.h" |
9 | #include "../gsmpbk.h" | 13 | #include "../gsmpbk.h" |
10 | #include "../gsmdata.h" | 14 | #include "../gsmdata.h" |
11 | #include "../gsmring.h" | 15 | #include "../gsmring.h" |
12 | #include "gsmsms.h" | 16 | #include "gsmsms.h" |
13 | 17 | ||
14 | /* ---------------------- multi SMS --------------------------------------- */ | 18 | /* ---------------------- multi SMS --------------------------------------- */ |
15 | 19 | ||
16 | /* Identifiers for Smart Messaging 3.0 multipart SMS */ | 20 | /* Identifiers for Smart Messaging 3.0 multipart SMS */ |
17 | 21 | ||
@@ -163,42 +167,43 @@ typedef enum { | |||
163 | /** | 167 | /** |
164 | * IMelody 1.2 | 168 | * IMelody 1.2 |
165 | */ | 169 | */ |
166 | SMS_EMSSound12, | 170 | SMS_EMSSound12, |
167 | /** | 171 | /** |
168 | * IMelody without header - SonyEricsson extension | 172 | * IMelody without header - SonyEricsson extension |
169 | */ | 173 | */ |
170 | SMS_EMSSonyEricssonSound, | 174 | SMS_EMSSonyEricssonSound, |
171 | /** | 175 | /** |
172 | * IMelody 1.0 with UPI. | 176 | * IMelody 1.0 with UPI. |
173 | */ | 177 | */ |
174 | SMS_EMSSound10Long, | 178 | SMS_EMSSound10Long, |
175 | /*** | 179 | /** |
176 | * IMelody 1.2 with UPI. | 180 | * IMelody 1.2 with UPI. |
177 | */ | 181 | */ |
178 | SMS_EMSSound12Long, | 182 | SMS_EMSSound12Long, |
179 | /** | 183 | /** |
180 | * IMelody without header with UPI. | 184 | * IMelody without header with UPI. |
181 | */ | 185 | */ |
182 | SMS_EMSSonyEricssonSoundLong, | 186 | SMS_EMSSonyEricssonSoundLong, |
183 | SMS_EMSPredefinedSound, | 187 | SMS_EMSPredefinedSound, |
184 | SMS_EMSPredefinedAnimation, | 188 | SMS_EMSPredefinedAnimation, |
185 | SMS_EMSAnimation, | 189 | SMS_EMSAnimation, |
186 | /** | 190 | /** |
187 | * Fixed bitmap of size 16x16 or 32x32. | 191 | * Fixed bitmap of size 16x16 or 32x32. |
188 | */ | 192 | */ |
189 | SMS_EMSFixedBitmap, | 193 | SMS_EMSFixedBitmap, |
190 | SMS_EMSVariableBitmap, | 194 | SMS_EMSVariableBitmap, |
191 | SMS_EMSVariableBitmapLong, | 195 | SMS_EMSVariableBitmapLong, |
192 | SMS_MMSIndicatorLong, | 196 | SMS_MMSIndicatorLong, |
197 | SMS_WAPIndicatorLong, | ||
193 | /** | 198 | /** |
194 | * Variable bitmap with black and white colors | 199 | * Variable bitmap with black and white colors |
195 | */ | 200 | */ |
196 | SMS_AlcatelMonoBitmapLong, | 201 | SMS_AlcatelMonoBitmapLong, |
197 | /** | 202 | /** |
198 | * Variable animation with black and white colors | 203 | * Variable animation with black and white colors |
199 | */ | 204 | */ |
200 | SMS_AlcatelMonoAnimationLong, | 205 | SMS_AlcatelMonoAnimationLong, |
201 | SMS_AlcatelSMSTemplateName | 206 | SMS_AlcatelSMSTemplateName |
202 | } EncodeMultiPartSMSID; | 207 | } EncodeMultiPartSMSID; |
203 | 208 | ||
204 | typedef struct { | 209 | typedef struct { |
@@ -255,17 +260,21 @@ bool GSM_DecodeMultiPartSMS (GSM_MultiPartSMSInfo *Info, GSM_MultiSMSMessage *SM | |||
255 | void GSM_ClearMultiPartSMSInfo (GSM_MultiPartSMSInfo *Info); | 260 | void GSM_ClearMultiPartSMSInfo (GSM_MultiPartSMSInfo *Info); |
256 | 261 | ||
257 | /** | 262 | /** |
258 | * Frees any allocated structures inside @ref GSM_MultiPartSMSInfo. | 263 | * Frees any allocated structures inside @ref GSM_MultiPartSMSInfo. |
259 | */ | 264 | */ |
260 | void GSM_FreeMultiPartSMSInfo (GSM_MultiPartSMSInfo *Info); | 265 | void GSM_FreeMultiPartSMSInfo (GSM_MultiPartSMSInfo *Info); |
261 | 266 | ||
262 | /** | 267 | /** |
263 | * Links SMS messages according to IDs. | 268 | * Links SMS messages according to IDs. |
264 | */ | 269 | */ |
265 | GSM_Error GSM_LinkSMS(GSM_MultiSMSMessage **INPUT, GSM_MultiSMSMessage **OUTPUT, bool ems); | 270 | GSM_Error GSM_LinkSMS(GSM_MultiSMSMessage **INPUT, GSM_MultiSMSMessage **OUTPUT, bool ems); |
266 | 271 | ||
272 | #if defined(_MSC_VER) && defined(__cplusplus) | ||
273 | } | ||
274 | #endif | ||
275 | |||
267 | #endif | 276 | #endif |
268 | 277 | ||
269 | /* How should editor hadle tabs in this file? Add editor commands here. | 278 | /* How should editor hadle tabs in this file? Add editor commands here. |
270 | * vim: noexpandtab sw=8 ts=8 sts=8: | 279 | * vim: noexpandtab sw=8 ts=8 sts=8: |
271 | */ | 280 | */ |
diff --git a/gammu/emb/common/service/sms/gsmsms.c b/gammu/emb/common/service/sms/gsmsms.c index 9920835..feceba4 100644 --- a/gammu/emb/common/service/sms/gsmsms.c +++ b/gammu/emb/common/service/sms/gsmsms.c | |||
@@ -1,14 +1,17 @@ | |||
1 | /* (c) 2001-2004 by Marcin Wiacek */ | 1 | /* (c) 2001-2004 by Marcin Wiacek */ |
2 | /* based on some work from Pawel Kot, others and Gnokii */ | 2 | /* Based on some Pawel Kot and others work from Gnokii (www.gnokii.org) |
3 | * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot | ||
4 | * GNU GPL version 2 or later | ||
5 | */ | ||
3 | 6 | ||
4 | #include <ctype.h> | 7 | #include <ctype.h> |
5 | #include <string.h> | 8 | #include <string.h> |
6 | #include <time.h> | 9 | #include <time.h> |
7 | 10 | ||
8 | #include "../../gsmcomon.h" | 11 | #include "../../gsmcomon.h" |
9 | #include "../../misc/coding/coding.h" | 12 | #include "../../misc/coding/coding.h" |
10 | #include "../gsmcal.h" | 13 | #include "../gsmcal.h" |
11 | #include "../gsmpbk.h" | 14 | #include "../gsmpbk.h" |
12 | #include "../gsmlogo.h" | 15 | #include "../gsmlogo.h" |
13 | #include "../gsmring.h" | 16 | #include "../gsmring.h" |
14 | #include "../gsmdata.h" | 17 | #include "../gsmdata.h" |
diff --git a/gammu/emb/common/service/sms/gsmsms.h b/gammu/emb/common/service/sms/gsmsms.h index d87ff60..0b950d3 100644 --- a/gammu/emb/common/service/sms/gsmsms.h +++ b/gammu/emb/common/service/sms/gsmsms.h | |||
@@ -1,14 +1,17 @@ | |||
1 | /* (c) 2001-2004 by Marcin Wiacek */ | 1 | /* (c) 2001-2004 by Marcin Wiacek */ |
2 | /* based on some work from Pawel Kot, others and Gnokii */ | 2 | /* Based on some Pawel Kot and others work from Gnokii (www.gnokii.org) |
3 | * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot | ||
4 | * GNU GPL version 2 or later | ||
5 | */ | ||
3 | 6 | ||
4 | #ifndef __gsm_sms_h | 7 | #ifndef __gsm_sms_h |
5 | #define __gsm_sms_h | 8 | #define __gsm_sms_h |
6 | 9 | ||
7 | #include "../../gsmcomon.h" | 10 | #include "../../gsmcomon.h" |
8 | #include "../gsmlogo.h" | 11 | #include "../gsmlogo.h" |
9 | #include "../gsmcal.h" | 12 | #include "../gsmcal.h" |
10 | #include "../gsmpbk.h" | 13 | #include "../gsmpbk.h" |
11 | #include "../gsmdata.h" | 14 | #include "../gsmdata.h" |
12 | #include "../gsmring.h" | 15 | #include "../gsmring.h" |
13 | 16 | ||
14 | /* --------------------- Some general definitions ------------------------- */ | 17 | /* --------------------- Some general definitions ------------------------- */ |