-rw-r--r-- | gammu/emb/gammu/gammu.c | 4 | ||||
-rw-r--r-- | gammu/gammu.tar.bz2 | bin | 612042 -> 0 bytes |
2 files changed, 2 insertions, 2 deletions
diff --git a/gammu/emb/gammu/gammu.c b/gammu/emb/gammu/gammu.c index f49ae36..c436b90 100644 --- a/gammu/emb/gammu/gammu.c +++ b/gammu/emb/gammu/gammu.c | |||
@@ -4010,1968 +4010,1968 @@ static void Backup(int argc, char *argv[]) | |||
4010 | strcat(Backup.Creator+strlen(Backup.Creator),GetCompiler()); | 4010 | strcat(Backup.Creator+strlen(Backup.Creator),GetCompiler()); |
4011 | } | 4011 | } |
4012 | 4012 | ||
4013 | signal(SIGINT, interrupt); | 4013 | signal(SIGINT, interrupt); |
4014 | printmsgerr("Press Ctrl+C to break...\n"); | 4014 | printmsgerr("Press Ctrl+C to break...\n"); |
4015 | 4015 | ||
4016 | GSM_Init(true); | 4016 | GSM_Init(true); |
4017 | 4017 | ||
4018 | if (Info.UseUnicode) { | 4018 | if (Info.UseUnicode) { |
4019 | Info.UseUnicode=answer_yes("Use Unicode subformat of backup file"); | 4019 | Info.UseUnicode=answer_yes("Use Unicode subformat of backup file"); |
4020 | } | 4020 | } |
4021 | if (Info.DateTime) { | 4021 | if (Info.DateTime) { |
4022 | GSM_GetCurrentDateTime (&Backup.DateTime); | 4022 | GSM_GetCurrentDateTime (&Backup.DateTime); |
4023 | Backup.DateTimeAvailable=true; | 4023 | Backup.DateTimeAvailable=true; |
4024 | } | 4024 | } |
4025 | if (Info.Model) { | 4025 | if (Info.Model) { |
4026 | error=Phone->GetManufacturer(&s); | 4026 | error=Phone->GetManufacturer(&s); |
4027 | Print_Error(error); | 4027 | Print_Error(error); |
4028 | sprintf(Backup.Model,"%s ",s.Phone.Data.Manufacturer); | 4028 | sprintf(Backup.Model,"%s ",s.Phone.Data.Manufacturer); |
4029 | if (s.Phone.Data.ModelInfo->model[0]!=0) { | 4029 | if (s.Phone.Data.ModelInfo->model[0]!=0) { |
4030 | strcat(Backup.Model,s.Phone.Data.ModelInfo->model); | 4030 | strcat(Backup.Model,s.Phone.Data.ModelInfo->model); |
4031 | } else { | 4031 | } else { |
4032 | strcat(Backup.Model,s.Phone.Data.Model); | 4032 | strcat(Backup.Model,s.Phone.Data.Model); |
4033 | } | 4033 | } |
4034 | strcat(Backup.Model," "); | 4034 | strcat(Backup.Model," "); |
4035 | strcat(Backup.Model,s.Phone.Data.Version); | 4035 | strcat(Backup.Model,s.Phone.Data.Version); |
4036 | } | 4036 | } |
4037 | if (Info.IMEI) { | 4037 | if (Info.IMEI) { |
4038 | error=Phone->GetIMEI(&s); | 4038 | error=Phone->GetIMEI(&s); |
4039 | if (error != ERR_NOTSUPPORTED) { | 4039 | if (error != ERR_NOTSUPPORTED) { |
4040 | strcpy(Backup.IMEI, s.Phone.Data.IMEI); | 4040 | strcpy(Backup.IMEI, s.Phone.Data.IMEI); |
4041 | Print_Error(error); | 4041 | Print_Error(error); |
4042 | } else { | 4042 | } else { |
4043 | Backup.IMEI[0] = 0; | 4043 | Backup.IMEI[0] = 0; |
4044 | } | 4044 | } |
4045 | } | 4045 | } |
4046 | printf("\n"); | 4046 | printf("\n"); |
4047 | 4047 | ||
4048 | DoBackup = false; | 4048 | DoBackup = false; |
4049 | if (Info.PhonePhonebook) { | 4049 | if (Info.PhonePhonebook) { |
4050 | printmsg("Checking phone phonebook\n"); | 4050 | printmsg("Checking phone phonebook\n"); |
4051 | MemStatus.MemoryType = MEM_ME; | 4051 | MemStatus.MemoryType = MEM_ME; |
4052 | error=Phone->GetMemoryStatus(&s, &MemStatus); | 4052 | error=Phone->GetMemoryStatus(&s, &MemStatus); |
4053 | if (error==ERR_NONE && MemStatus.MemoryUsed != 0) { | 4053 | if (error==ERR_NONE && MemStatus.MemoryUsed != 0) { |
4054 | if (answer_yes(" Backup phone phonebook")) DoBackup = true; | 4054 | if (answer_yes(" Backup phone phonebook")) DoBackup = true; |
4055 | } | 4055 | } |
4056 | } | 4056 | } |
4057 | if (DoBackup) { | 4057 | if (DoBackup) { |
4058 | Pbk.MemoryType = MEM_ME; | 4058 | Pbk.MemoryType = MEM_ME; |
4059 | i = 1; | 4059 | i = 1; |
4060 | used = 0; | 4060 | used = 0; |
4061 | while (used != MemStatus.MemoryUsed) { | 4061 | while (used != MemStatus.MemoryUsed) { |
4062 | Pbk.Location = i; | 4062 | Pbk.Location = i; |
4063 | error=Phone->GetMemory(&s, &Pbk); | 4063 | error=Phone->GetMemory(&s, &Pbk); |
4064 | if (error != ERR_EMPTY) { | 4064 | if (error != ERR_EMPTY) { |
4065 | Print_Error(error); | 4065 | Print_Error(error); |
4066 | if (used < GSM_BACKUP_MAX_PHONEPHONEBOOK) { | 4066 | if (used < GSM_BACKUP_MAX_PHONEPHONEBOOK) { |
4067 | Backup.PhonePhonebook[used] = malloc(sizeof(GSM_MemoryEntry)); | 4067 | Backup.PhonePhonebook[used] = malloc(sizeof(GSM_MemoryEntry)); |
4068 | if (Backup.PhonePhonebook[used] == NULL) Print_Error(ERR_MOREMEMORY); | 4068 | if (Backup.PhonePhonebook[used] == NULL) Print_Error(ERR_MOREMEMORY); |
4069 | Backup.PhonePhonebook[used+1] = NULL; | 4069 | Backup.PhonePhonebook[used+1] = NULL; |
4070 | } else { | 4070 | } else { |
4071 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_PHONEPHONEBOOK"); | 4071 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_PHONEPHONEBOOK"); |
4072 | GSM_Terminate(); | 4072 | GSM_Terminate(); |
4073 | exit(-1); | 4073 | exit(-1); |
4074 | } | 4074 | } |
4075 | *Backup.PhonePhonebook[used]=Pbk; | 4075 | *Backup.PhonePhonebook[used]=Pbk; |
4076 | used++; | 4076 | used++; |
4077 | } | 4077 | } |
4078 | printmsgerr("%c Reading: %i percent",13,used*100/MemStatus.MemoryUsed); | 4078 | printmsgerr("%c Reading: %i percent",13,used*100/MemStatus.MemoryUsed); |
4079 | i++; | 4079 | i++; |
4080 | if (gshutdown) { | 4080 | if (gshutdown) { |
4081 | GSM_Terminate(); | 4081 | GSM_Terminate(); |
4082 | exit(0); | 4082 | exit(0); |
4083 | } | 4083 | } |
4084 | } | 4084 | } |
4085 | printmsgerr("\n"); | 4085 | printmsgerr("\n"); |
4086 | } | 4086 | } |
4087 | DoBackup = false; | 4087 | DoBackup = false; |
4088 | if (Info.SIMPhonebook) { | 4088 | if (Info.SIMPhonebook) { |
4089 | printmsg("Checking SIM phonebook\n"); | 4089 | printmsg("Checking SIM phonebook\n"); |
4090 | MemStatus.MemoryType = MEM_SM; | 4090 | MemStatus.MemoryType = MEM_SM; |
4091 | error=Phone->GetMemoryStatus(&s, &MemStatus); | 4091 | error=Phone->GetMemoryStatus(&s, &MemStatus); |
4092 | if (error==ERR_NONE && MemStatus.MemoryUsed != 0) { | 4092 | if (error==ERR_NONE && MemStatus.MemoryUsed != 0) { |
4093 | if (answer_yes(" Backup SIM phonebook")) DoBackup=true; | 4093 | if (answer_yes(" Backup SIM phonebook")) DoBackup=true; |
4094 | } | 4094 | } |
4095 | } | 4095 | } |
4096 | if (DoBackup) { | 4096 | if (DoBackup) { |
4097 | Pbk.MemoryType = MEM_SM; | 4097 | Pbk.MemoryType = MEM_SM; |
4098 | i = 1; | 4098 | i = 1; |
4099 | used = 0; | 4099 | used = 0; |
4100 | while (used != MemStatus.MemoryUsed) { | 4100 | while (used != MemStatus.MemoryUsed) { |
4101 | Pbk.Location = i; | 4101 | Pbk.Location = i; |
4102 | error=Phone->GetMemory(&s, &Pbk); | 4102 | error=Phone->GetMemory(&s, &Pbk); |
4103 | if (error != ERR_EMPTY) { | 4103 | if (error != ERR_EMPTY) { |
4104 | Print_Error(error); | 4104 | Print_Error(error); |
4105 | if (used < GSM_BACKUP_MAX_SIMPHONEBOOK) { | 4105 | if (used < GSM_BACKUP_MAX_SIMPHONEBOOK) { |
4106 | Backup.SIMPhonebook[used] = malloc(sizeof(GSM_MemoryEntry)); | 4106 | Backup.SIMPhonebook[used] = malloc(sizeof(GSM_MemoryEntry)); |
4107 | if (Backup.SIMPhonebook[used] == NULL) Print_Error(ERR_MOREMEMORY); | 4107 | if (Backup.SIMPhonebook[used] == NULL) Print_Error(ERR_MOREMEMORY); |
4108 | Backup.SIMPhonebook[used + 1] = NULL; | 4108 | Backup.SIMPhonebook[used + 1] = NULL; |
4109 | } else { | 4109 | } else { |
4110 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_SIMPHONEBOOK"); | 4110 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_SIMPHONEBOOK"); |
4111 | GSM_Terminate(); | 4111 | GSM_Terminate(); |
4112 | exit(-1); | 4112 | exit(-1); |
4113 | } | 4113 | } |
4114 | *Backup.SIMPhonebook[used]=Pbk; | 4114 | *Backup.SIMPhonebook[used]=Pbk; |
4115 | used++; | 4115 | used++; |
4116 | } | 4116 | } |
4117 | printmsgerr("%c Reading: %i percent",13,used*100/MemStatus.MemoryUsed); | 4117 | printmsgerr("%c Reading: %i percent",13,used*100/MemStatus.MemoryUsed); |
4118 | i++; | 4118 | i++; |
4119 | if (gshutdown) { | 4119 | if (gshutdown) { |
4120 | GSM_Terminate(); | 4120 | GSM_Terminate(); |
4121 | exit(0); | 4121 | exit(0); |
4122 | } | 4122 | } |
4123 | } | 4123 | } |
4124 | printmsgerr("\n"); | 4124 | printmsgerr("\n"); |
4125 | } | 4125 | } |
4126 | DoBackup = false; | 4126 | DoBackup = false; |
4127 | if (Info.Calendar) { | 4127 | if (Info.Calendar) { |
4128 | printmsg("Checking calendar\n"); | 4128 | printmsg("Checking calendar\n"); |
4129 | error=Phone->GetNextCalendar(&s,&Calendar,true); | 4129 | error=Phone->GetNextCalendar(&s,&Calendar,true); |
4130 | if (error==ERR_NONE) { | 4130 | if (error==ERR_NONE) { |
4131 | if (answer_yes(" Backup calendar notes")) DoBackup = true; | 4131 | if (answer_yes(" Backup calendar notes")) DoBackup = true; |
4132 | } | 4132 | } |
4133 | } | 4133 | } |
4134 | if (DoBackup) { | 4134 | if (DoBackup) { |
4135 | used = 0; | 4135 | used = 0; |
4136 | printmsgerr(" Reading : "); | 4136 | printmsgerr(" Reading : "); |
4137 | while (error == ERR_NONE) { | 4137 | while (error == ERR_NONE) { |
4138 | if (used < GSM_MAXCALENDARTODONOTES) { | 4138 | if (used < GSM_MAXCALENDARTODONOTES) { |
4139 | Backup.Calendar[used] = malloc(sizeof(GSM_CalendarEntry)); | 4139 | Backup.Calendar[used] = malloc(sizeof(GSM_CalendarEntry)); |
4140 | if (Backup.Calendar[used] == NULL) Print_Error(ERR_MOREMEMORY); | 4140 | if (Backup.Calendar[used] == NULL) Print_Error(ERR_MOREMEMORY); |
4141 | Backup.Calendar[used+1] = NULL; | 4141 | Backup.Calendar[used+1] = NULL; |
4142 | } else { | 4142 | } else { |
4143 | printmsg(" Increase %s\n" , "GSM_MAXCALENDARTODONOTES"); | 4143 | printmsg(" Increase %s\n" , "GSM_MAXCALENDARTODONOTES"); |
4144 | GSM_Terminate(); | 4144 | GSM_Terminate(); |
4145 | exit(-1); | 4145 | exit(-1); |
4146 | } | 4146 | } |
4147 | *Backup.Calendar[used]=Calendar; | 4147 | *Backup.Calendar[used]=Calendar; |
4148 | used ++; | 4148 | used ++; |
4149 | error=Phone->GetNextCalendar(&s,&Calendar,false); | 4149 | error=Phone->GetNextCalendar(&s,&Calendar,false); |
4150 | printmsgerr("*"); | 4150 | printmsgerr("*"); |
4151 | if (gshutdown) { | 4151 | if (gshutdown) { |
4152 | GSM_Terminate(); | 4152 | GSM_Terminate(); |
4153 | exit(0); | 4153 | exit(0); |
4154 | } | 4154 | } |
4155 | } | 4155 | } |
4156 | printmsgerr("\n"); | 4156 | printmsgerr("\n"); |
4157 | } | 4157 | } |
4158 | DoBackup = false; | 4158 | DoBackup = false; |
4159 | if (Info.ToDo) { | 4159 | if (Info.ToDo) { |
4160 | printmsg("Checking ToDo\n"); | 4160 | printmsg("Checking ToDo\n"); |
4161 | error=Phone->GetToDoStatus(&s,&ToDoStatus); | 4161 | error=Phone->GetToDoStatus(&s,&ToDoStatus); |
4162 | if (error == ERR_NONE && ToDoStatus.Used != 0) { | 4162 | if (error == ERR_NONE && ToDoStatus.Used != 0) { |
4163 | if (answer_yes(" Backup ToDo")) DoBackup = true; | 4163 | if (answer_yes(" Backup ToDo")) DoBackup = true; |
4164 | } | 4164 | } |
4165 | } | 4165 | } |
4166 | if (DoBackup) { | 4166 | if (DoBackup) { |
4167 | used = 0; | 4167 | used = 0; |
4168 | error=Phone->GetNextToDo(&s,&ToDo,true); | 4168 | error=Phone->GetNextToDo(&s,&ToDo,true); |
4169 | while (error == ERR_NONE) { | 4169 | while (error == ERR_NONE) { |
4170 | if (used < GSM_MAXCALENDARTODONOTES) { | 4170 | if (used < GSM_MAXCALENDARTODONOTES) { |
4171 | Backup.ToDo[used] = malloc(sizeof(GSM_ToDoEntry)); | 4171 | Backup.ToDo[used] = malloc(sizeof(GSM_ToDoEntry)); |
4172 | if (Backup.ToDo[used] == NULL) Print_Error(ERR_MOREMEMORY); | 4172 | if (Backup.ToDo[used] == NULL) Print_Error(ERR_MOREMEMORY); |
4173 | Backup.ToDo[used+1] = NULL; | 4173 | Backup.ToDo[used+1] = NULL; |
4174 | } else { | 4174 | } else { |
4175 | printmsg(" Increase %s\n" , "GSM_MAXCALENDARTODONOTES"); | 4175 | printmsg(" Increase %s\n" , "GSM_MAXCALENDARTODONOTES"); |
4176 | GSM_Terminate(); | 4176 | GSM_Terminate(); |
4177 | exit(-1); | 4177 | exit(-1); |
4178 | } | 4178 | } |
4179 | *Backup.ToDo[used]=ToDo; | 4179 | *Backup.ToDo[used]=ToDo; |
4180 | used ++; | 4180 | used ++; |
4181 | error=Phone->GetNextToDo(&s,&ToDo,false); | 4181 | error=Phone->GetNextToDo(&s,&ToDo,false); |
4182 | printmsgerr("%c Reading: %i percent",13,used*100/ToDoStatus.Used); | 4182 | printmsgerr("%c Reading: %i percent",13,used*100/ToDoStatus.Used); |
4183 | if (gshutdown) { | 4183 | if (gshutdown) { |
4184 | GSM_Terminate(); | 4184 | GSM_Terminate(); |
4185 | exit(0); | 4185 | exit(0); |
4186 | } | 4186 | } |
4187 | } | 4187 | } |
4188 | printmsgerr("\n"); | 4188 | printmsgerr("\n"); |
4189 | } | 4189 | } |
4190 | DoBackup = false; | 4190 | DoBackup = false; |
4191 | if (Info.Note) { | 4191 | if (Info.Note) { |
4192 | printmsg("Checking notes\n"); | 4192 | printmsg("Checking notes\n"); |
4193 | error=Phone->GetNextNote(&s,&Note,true); | 4193 | error=Phone->GetNextNote(&s,&Note,true); |
4194 | if (error==ERR_NONE) { | 4194 | if (error==ERR_NONE) { |
4195 | if (answer_yes(" Backup notes")) DoBackup = true; | 4195 | if (answer_yes(" Backup notes")) DoBackup = true; |
4196 | } | 4196 | } |
4197 | } | 4197 | } |
4198 | if (DoBackup) { | 4198 | if (DoBackup) { |
4199 | used = 0; | 4199 | used = 0; |
4200 | printmsgerr(" Reading : "); | 4200 | printmsgerr(" Reading : "); |
4201 | while (error == ERR_NONE) { | 4201 | while (error == ERR_NONE) { |
4202 | if (used < GSM_BACKUP_MAX_NOTE) { | 4202 | if (used < GSM_BACKUP_MAX_NOTE) { |
4203 | Backup.Note[used] = malloc(sizeof(GSM_NoteEntry)); | 4203 | Backup.Note[used] = malloc(sizeof(GSM_NoteEntry)); |
4204 | if (Backup.Note[used] == NULL) Print_Error(ERR_MOREMEMORY); | 4204 | if (Backup.Note[used] == NULL) Print_Error(ERR_MOREMEMORY); |
4205 | Backup.Note[used+1] = NULL; | 4205 | Backup.Note[used+1] = NULL; |
4206 | } else { | 4206 | } else { |
4207 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_NOTE"); | 4207 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_NOTE"); |
4208 | GSM_Terminate(); | 4208 | GSM_Terminate(); |
4209 | exit(-1); | 4209 | exit(-1); |
4210 | } | 4210 | } |
4211 | *Backup.Note[used]=Note; | 4211 | *Backup.Note[used]=Note; |
4212 | used ++; | 4212 | used ++; |
4213 | error=Phone->GetNextNote(&s,&Note,false); | 4213 | error=Phone->GetNextNote(&s,&Note,false); |
4214 | printmsgerr("*"); | 4214 | printmsgerr("*"); |
4215 | if (gshutdown) { | 4215 | if (gshutdown) { |
4216 | GSM_Terminate(); | 4216 | GSM_Terminate(); |
4217 | exit(0); | 4217 | exit(0); |
4218 | } | 4218 | } |
4219 | } | 4219 | } |
4220 | printmsgerr("\n"); | 4220 | printmsgerr("\n"); |
4221 | } | 4221 | } |
4222 | DoBackup = false; | 4222 | DoBackup = false; |
4223 | if (Info.CallerLogos) { | 4223 | if (Info.CallerLogos) { |
4224 | printmsg("Checking caller logos\n"); | 4224 | printmsg("Checking caller logos\n"); |
4225 | Bitmap.Type = GSM_CallerGroupLogo; | 4225 | Bitmap.Type = GSM_CallerGroupLogo; |
4226 | Bitmap.Location = 1; | 4226 | Bitmap.Location = 1; |
4227 | error=Phone->GetBitmap(&s,&Bitmap); | 4227 | error=Phone->GetBitmap(&s,&Bitmap); |
4228 | if (error == ERR_NONE) { | 4228 | if (error == ERR_NONE) { |
4229 | if (answer_yes(" Backup caller groups and logos")) DoBackup = true; | 4229 | if (answer_yes(" Backup caller groups and logos")) DoBackup = true; |
4230 | } | 4230 | } |
4231 | } | 4231 | } |
4232 | if (DoBackup) { | 4232 | if (DoBackup) { |
4233 | printmsgerr(" Reading : "); | 4233 | printmsgerr(" Reading : "); |
4234 | error = ERR_NONE; | 4234 | error = ERR_NONE; |
4235 | used = 0; | 4235 | used = 0; |
4236 | while (error == ERR_NONE) { | 4236 | while (error == ERR_NONE) { |
4237 | if (used < GSM_BACKUP_MAX_CALLER) { | 4237 | if (used < GSM_BACKUP_MAX_CALLER) { |
4238 | Backup.CallerLogos[used] = malloc(sizeof(GSM_Bitmap)); | 4238 | Backup.CallerLogos[used] = malloc(sizeof(GSM_Bitmap)); |
4239 | if (Backup.CallerLogos[used] == NULL) Print_Error(ERR_MOREMEMORY); | 4239 | if (Backup.CallerLogos[used] == NULL) Print_Error(ERR_MOREMEMORY); |
4240 | Backup.CallerLogos[used+1] = NULL; | 4240 | Backup.CallerLogos[used+1] = NULL; |
4241 | } else { | 4241 | } else { |
4242 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_CALLER"); | 4242 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_CALLER"); |
4243 | GSM_Terminate(); | 4243 | GSM_Terminate(); |
4244 | exit(-1); | 4244 | exit(-1); |
4245 | } | 4245 | } |
4246 | *Backup.CallerLogos[used] = Bitmap; | 4246 | *Backup.CallerLogos[used] = Bitmap; |
4247 | used ++; | 4247 | used ++; |
4248 | Bitmap.Location = used + 1; | 4248 | Bitmap.Location = used + 1; |
4249 | error=Phone->GetBitmap(&s,&Bitmap); | 4249 | error=Phone->GetBitmap(&s,&Bitmap); |
4250 | printmsgerr("*"); | 4250 | printmsgerr("*"); |
4251 | if (gshutdown) { | 4251 | if (gshutdown) { |
4252 | GSM_Terminate(); | 4252 | GSM_Terminate(); |
4253 | exit(0); | 4253 | exit(0); |
4254 | } | 4254 | } |
4255 | } | 4255 | } |
4256 | printmsgerr("\n"); | 4256 | printmsgerr("\n"); |
4257 | } | 4257 | } |
4258 | DoBackup = false; | 4258 | DoBackup = false; |
4259 | if (Info.SMSC) { | 4259 | if (Info.SMSC) { |
4260 | printmsg("Checking SMS profiles\n"); | 4260 | printmsg("Checking SMS profiles\n"); |
4261 | if (answer_yes(" Backup SMS profiles")) DoBackup = true; | 4261 | if (answer_yes(" Backup SMS profiles")) DoBackup = true; |
4262 | } | 4262 | } |
4263 | if (DoBackup) { | 4263 | if (DoBackup) { |
4264 | used = 0; | 4264 | used = 0; |
4265 | printmsgerr(" Reading: "); | 4265 | printmsgerr(" Reading: "); |
4266 | while (true) { | 4266 | while (true) { |
4267 | SMSC.Location = used + 1; | 4267 | SMSC.Location = used + 1; |
4268 | error = Phone->GetSMSC(&s,&SMSC); | 4268 | error = Phone->GetSMSC(&s,&SMSC); |
4269 | if (error != ERR_NONE) break; | 4269 | if (error != ERR_NONE) break; |
4270 | if (used < GSM_BACKUP_MAX_SMSC) { | 4270 | if (used < GSM_BACKUP_MAX_SMSC) { |
4271 | Backup.SMSC[used] = malloc(sizeof(GSM_SMSC)); | 4271 | Backup.SMSC[used] = malloc(sizeof(GSM_SMSC)); |
4272 | if (Backup.SMSC[used] == NULL) Print_Error(ERR_MOREMEMORY); | 4272 | if (Backup.SMSC[used] == NULL) Print_Error(ERR_MOREMEMORY); |
4273 | Backup.SMSC[used + 1] = NULL; | 4273 | Backup.SMSC[used + 1] = NULL; |
4274 | } else { | 4274 | } else { |
4275 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_SMSC"); | 4275 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_SMSC"); |
4276 | GSM_Terminate(); | 4276 | GSM_Terminate(); |
4277 | exit(-1); | 4277 | exit(-1); |
4278 | } | 4278 | } |
4279 | *Backup.SMSC[used]=SMSC; | 4279 | *Backup.SMSC[used]=SMSC; |
4280 | used++; | 4280 | used++; |
4281 | printmsgerr("*"); | 4281 | printmsgerr("*"); |
4282 | } | 4282 | } |
4283 | printmsgerr("\n"); | 4283 | printmsgerr("\n"); |
4284 | } | 4284 | } |
4285 | DoBackup = false; | 4285 | DoBackup = false; |
4286 | if (Info.StartupLogo) { | 4286 | if (Info.StartupLogo) { |
4287 | printmsg("Checking startup text\n"); | 4287 | printmsg("Checking startup text\n"); |
4288 | Bitmap.Type = GSM_WelcomeNote_Text; | 4288 | Bitmap.Type = GSM_WelcomeNote_Text; |
4289 | error = Phone->GetBitmap(&s,&Bitmap); | 4289 | error = Phone->GetBitmap(&s,&Bitmap); |
4290 | if (error == ERR_NONE) { | 4290 | if (error == ERR_NONE) { |
4291 | if (answer_yes(" Backup startup logo/text")) DoBackup = true; | 4291 | if (answer_yes(" Backup startup logo/text")) DoBackup = true; |
4292 | } | 4292 | } |
4293 | } | 4293 | } |
4294 | if (DoBackup) { | 4294 | if (DoBackup) { |
4295 | Backup.StartupLogo = malloc(sizeof(GSM_Bitmap)); | 4295 | Backup.StartupLogo = malloc(sizeof(GSM_Bitmap)); |
4296 | if (Backup.StartupLogo == NULL) Print_Error(ERR_MOREMEMORY); | 4296 | if (Backup.StartupLogo == NULL) Print_Error(ERR_MOREMEMORY); |
4297 | *Backup.StartupLogo = Bitmap; | 4297 | *Backup.StartupLogo = Bitmap; |
4298 | if (Bitmap.Text[0]==0 && Bitmap.Text[1]==0) { | 4298 | if (Bitmap.Text[0]==0 && Bitmap.Text[1]==0) { |
4299 | Bitmap.Type = GSM_StartupLogo; | 4299 | Bitmap.Type = GSM_StartupLogo; |
4300 | error = Phone->GetBitmap(&s,&Bitmap); | 4300 | error = Phone->GetBitmap(&s,&Bitmap); |
4301 | if (error == ERR_NONE) *Backup.StartupLogo = Bitmap; | 4301 | if (error == ERR_NONE) *Backup.StartupLogo = Bitmap; |
4302 | } | 4302 | } |
4303 | } | 4303 | } |
4304 | DoBackup = false; | 4304 | DoBackup = false; |
4305 | if (Info.OperatorLogo) { | 4305 | if (Info.OperatorLogo) { |
4306 | printmsg("Checking operator logo\n"); | 4306 | printmsg("Checking operator logo\n"); |
4307 | Bitmap.Type = GSM_OperatorLogo; | 4307 | Bitmap.Type = GSM_OperatorLogo; |
4308 | error=Phone->GetBitmap(&s,&Bitmap); | 4308 | error=Phone->GetBitmap(&s,&Bitmap); |
4309 | if (error == ERR_NONE) { | 4309 | if (error == ERR_NONE) { |
4310 | if (strcmp(Bitmap.NetworkCode,"000 00")!=0) { | 4310 | if (strcmp(Bitmap.NetworkCode,"000 00")!=0) { |
4311 | if (answer_yes(" Backup operator logo")) DoBackup = true; | 4311 | if (answer_yes(" Backup operator logo")) DoBackup = true; |
4312 | } | 4312 | } |
4313 | } | 4313 | } |
4314 | } | 4314 | } |
4315 | if (DoBackup) { | 4315 | if (DoBackup) { |
4316 | Backup.OperatorLogo = malloc(sizeof(GSM_Bitmap)); | 4316 | Backup.OperatorLogo = malloc(sizeof(GSM_Bitmap)); |
4317 | if (Backup.OperatorLogo == NULL) Print_Error(ERR_MOREMEMORY); | 4317 | if (Backup.OperatorLogo == NULL) Print_Error(ERR_MOREMEMORY); |
4318 | *Backup.OperatorLogo = Bitmap; | 4318 | *Backup.OperatorLogo = Bitmap; |
4319 | } | 4319 | } |
4320 | DoBackup = false; | 4320 | DoBackup = false; |
4321 | if (Info.WAPBookmark) { | 4321 | if (Info.WAPBookmark) { |
4322 | printmsg("Checking WAP bookmarks\n"); | 4322 | printmsg("Checking WAP bookmarks\n"); |
4323 | Bookmark.Location = 1; | 4323 | Bookmark.Location = 1; |
4324 | error=Phone->GetWAPBookmark(&s,&Bookmark); | 4324 | error=Phone->GetWAPBookmark(&s,&Bookmark); |
4325 | if (error==ERR_NONE) { | 4325 | if (error==ERR_NONE) { |
4326 | if (answer_yes(" Backup WAP bookmarks")) DoBackup = true; | 4326 | if (answer_yes(" Backup WAP bookmarks")) DoBackup = true; |
4327 | } | 4327 | } |
4328 | } | 4328 | } |
4329 | if (DoBackup) { | 4329 | if (DoBackup) { |
4330 | used = 0; | 4330 | used = 0; |
4331 | printmsgerr(" Reading : "); | 4331 | printmsgerr(" Reading : "); |
4332 | while (error == ERR_NONE) { | 4332 | while (error == ERR_NONE) { |
4333 | if (used < GSM_BACKUP_MAX_WAPBOOKMARK) { | 4333 | if (used < GSM_BACKUP_MAX_WAPBOOKMARK) { |
4334 | Backup.WAPBookmark[used] = malloc(sizeof(GSM_WAPBookmark)); | 4334 | Backup.WAPBookmark[used] = malloc(sizeof(GSM_WAPBookmark)); |
4335 | if (Backup.WAPBookmark[used] == NULL) Print_Error(ERR_MOREMEMORY); | 4335 | if (Backup.WAPBookmark[used] == NULL) Print_Error(ERR_MOREMEMORY); |
4336 | Backup.WAPBookmark[used+1] = NULL; | 4336 | Backup.WAPBookmark[used+1] = NULL; |
4337 | } else { | 4337 | } else { |
4338 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_WAPBOOKMARK"); | 4338 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_WAPBOOKMARK"); |
4339 | GSM_Terminate(); | 4339 | GSM_Terminate(); |
4340 | exit(-1); | 4340 | exit(-1); |
4341 | } | 4341 | } |
4342 | *Backup.WAPBookmark[used]=Bookmark; | 4342 | *Backup.WAPBookmark[used]=Bookmark; |
4343 | used ++; | 4343 | used ++; |
4344 | Bookmark.Location = used+1; | 4344 | Bookmark.Location = used+1; |
4345 | error=Phone->GetWAPBookmark(&s,&Bookmark); | 4345 | error=Phone->GetWAPBookmark(&s,&Bookmark); |
4346 | printmsgerr("*"); | 4346 | printmsgerr("*"); |
4347 | if (gshutdown) { | 4347 | if (gshutdown) { |
4348 | GSM_Terminate(); | 4348 | GSM_Terminate(); |
4349 | exit(0); | 4349 | exit(0); |
4350 | } | 4350 | } |
4351 | } | 4351 | } |
4352 | printmsgerr("\n"); | 4352 | printmsgerr("\n"); |
4353 | } | 4353 | } |
4354 | DoBackup = false; | 4354 | DoBackup = false; |
4355 | if (Info.WAPSettings) { | 4355 | if (Info.WAPSettings) { |
4356 | printmsg("Checking WAP settings\n"); | 4356 | printmsg("Checking WAP settings\n"); |
4357 | Settings.Location = 1; | 4357 | Settings.Location = 1; |
4358 | error=Phone->GetWAPSettings(&s,&Settings); | 4358 | error=Phone->GetWAPSettings(&s,&Settings); |
4359 | if (error==ERR_NONE) { | 4359 | if (error==ERR_NONE) { |
4360 | if (answer_yes(" Backup WAP settings")) DoBackup = true; | 4360 | if (answer_yes(" Backup WAP settings")) DoBackup = true; |
4361 | } | 4361 | } |
4362 | } | 4362 | } |
4363 | if (DoBackup) { | 4363 | if (DoBackup) { |
4364 | used = 0; | 4364 | used = 0; |
4365 | printmsgerr(" Reading : "); | 4365 | printmsgerr(" Reading : "); |
4366 | while (error == ERR_NONE) { | 4366 | while (error == ERR_NONE) { |
4367 | if (used < GSM_BACKUP_MAX_WAPSETTINGS) { | 4367 | if (used < GSM_BACKUP_MAX_WAPSETTINGS) { |
4368 | Backup.WAPSettings[used] = malloc(sizeof(GSM_MultiWAPSettings)); | 4368 | Backup.WAPSettings[used] = malloc(sizeof(GSM_MultiWAPSettings)); |
4369 | if (Backup.WAPSettings[used] == NULL) Print_Error(ERR_MOREMEMORY); | 4369 | if (Backup.WAPSettings[used] == NULL) Print_Error(ERR_MOREMEMORY); |
4370 | Backup.WAPSettings[used+1] = NULL; | 4370 | Backup.WAPSettings[used+1] = NULL; |
4371 | } else { | 4371 | } else { |
4372 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_WAPSETTINGS"); | 4372 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_WAPSETTINGS"); |
4373 | GSM_Terminate(); | 4373 | GSM_Terminate(); |
4374 | exit(-1); | 4374 | exit(-1); |
4375 | } | 4375 | } |
4376 | *Backup.WAPSettings[used]=Settings; | 4376 | *Backup.WAPSettings[used]=Settings; |
4377 | used ++; | 4377 | used ++; |
4378 | Settings.Location = used+1; | 4378 | Settings.Location = used+1; |
4379 | error=Phone->GetWAPSettings(&s,&Settings); | 4379 | error=Phone->GetWAPSettings(&s,&Settings); |
4380 | printmsgerr("*"); | 4380 | printmsgerr("*"); |
4381 | if (gshutdown) { | 4381 | if (gshutdown) { |
4382 | GSM_Terminate(); | 4382 | GSM_Terminate(); |
4383 | exit(0); | 4383 | exit(0); |
4384 | } | 4384 | } |
4385 | } | 4385 | } |
4386 | printmsgerr("\n"); | 4386 | printmsgerr("\n"); |
4387 | } | 4387 | } |
4388 | DoBackup = false; | 4388 | DoBackup = false; |
4389 | if (Info.MMSSettings) { | 4389 | if (Info.MMSSettings) { |
4390 | printmsg("Checking MMS settings\n"); | 4390 | printmsg("Checking MMS settings\n"); |
4391 | Settings.Location = 1; | 4391 | Settings.Location = 1; |
4392 | error=Phone->GetMMSSettings(&s,&Settings); | 4392 | error=Phone->GetMMSSettings(&s,&Settings); |
4393 | if (error==ERR_NONE) { | 4393 | if (error==ERR_NONE) { |
4394 | if (answer_yes(" Backup MMS settings")) DoBackup = true; | 4394 | if (answer_yes(" Backup MMS settings")) DoBackup = true; |
4395 | } | 4395 | } |
4396 | } | 4396 | } |
4397 | if (DoBackup) { | 4397 | if (DoBackup) { |
4398 | used = 0; | 4398 | used = 0; |
4399 | printmsgerr(" Reading : "); | 4399 | printmsgerr(" Reading : "); |
4400 | while (error == ERR_NONE) { | 4400 | while (error == ERR_NONE) { |
4401 | if (used < GSM_BACKUP_MAX_MMSSETTINGS) { | 4401 | if (used < GSM_BACKUP_MAX_MMSSETTINGS) { |
4402 | Backup.MMSSettings[used] = malloc(sizeof(GSM_MultiWAPSettings)); | 4402 | Backup.MMSSettings[used] = malloc(sizeof(GSM_MultiWAPSettings)); |
4403 | if (Backup.MMSSettings[used] == NULL) Print_Error(ERR_MOREMEMORY); | 4403 | if (Backup.MMSSettings[used] == NULL) Print_Error(ERR_MOREMEMORY); |
4404 | Backup.MMSSettings[used+1] = NULL; | 4404 | Backup.MMSSettings[used+1] = NULL; |
4405 | } else { | 4405 | } else { |
4406 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_MMSSETTINGS"); | 4406 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_MMSSETTINGS"); |
4407 | GSM_Terminate(); | 4407 | GSM_Terminate(); |
4408 | exit(-1); | 4408 | exit(-1); |
4409 | } | 4409 | } |
4410 | *Backup.MMSSettings[used]=Settings; | 4410 | *Backup.MMSSettings[used]=Settings; |
4411 | used ++; | 4411 | used ++; |
4412 | Settings.Location = used+1; | 4412 | Settings.Location = used+1; |
4413 | error=Phone->GetMMSSettings(&s,&Settings); | 4413 | error=Phone->GetMMSSettings(&s,&Settings); |
4414 | printmsgerr("*"); | 4414 | printmsgerr("*"); |
4415 | if (gshutdown) { | 4415 | if (gshutdown) { |
4416 | GSM_Terminate(); | 4416 | GSM_Terminate(); |
4417 | exit(0); | 4417 | exit(0); |
4418 | } | 4418 | } |
4419 | } | 4419 | } |
4420 | printmsgerr("\n"); | 4420 | printmsgerr("\n"); |
4421 | } | 4421 | } |
4422 | DoBackup = false; | 4422 | DoBackup = false; |
4423 | if (Info.ChatSettings) { | 4423 | if (Info.ChatSettings) { |
4424 | printmsg("Checking Chat settings\n"); | 4424 | printmsg("Checking Chat settings\n"); |
4425 | Chat.Location = 1; | 4425 | Chat.Location = 1; |
4426 | error=Phone->GetChatSettings(&s,&Chat); | 4426 | error=Phone->GetChatSettings(&s,&Chat); |
4427 | if (error==ERR_NONE) { | 4427 | if (error==ERR_NONE) { |
4428 | if (answer_yes(" Backup Chat settings")) DoBackup = true; | 4428 | if (answer_yes(" Backup Chat settings")) DoBackup = true; |
4429 | } | 4429 | } |
4430 | } | 4430 | } |
4431 | if (DoBackup) { | 4431 | if (DoBackup) { |
4432 | used = 0; | 4432 | used = 0; |
4433 | printmsgerr(" Reading : "); | 4433 | printmsgerr(" Reading : "); |
4434 | while (error == ERR_NONE) { | 4434 | while (error == ERR_NONE) { |
4435 | if (used < GSM_BACKUP_MAX_CHATSETTINGS) { | 4435 | if (used < GSM_BACKUP_MAX_CHATSETTINGS) { |
4436 | Backup.ChatSettings[used] = malloc(sizeof(GSM_ChatSettings)); | 4436 | Backup.ChatSettings[used] = malloc(sizeof(GSM_ChatSettings)); |
4437 | if (Backup.ChatSettings[used] == NULL) Print_Error(ERR_MOREMEMORY); | 4437 | if (Backup.ChatSettings[used] == NULL) Print_Error(ERR_MOREMEMORY); |
4438 | Backup.ChatSettings[used+1] = NULL; | 4438 | Backup.ChatSettings[used+1] = NULL; |
4439 | } else { | 4439 | } else { |
4440 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_CHATSETTINGS"); | 4440 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_CHATSETTINGS"); |
4441 | GSM_Terminate(); | 4441 | GSM_Terminate(); |
4442 | exit(-1); | 4442 | exit(-1); |
4443 | } | 4443 | } |
4444 | *Backup.ChatSettings[used]=Chat; | 4444 | *Backup.ChatSettings[used]=Chat; |
4445 | used ++; | 4445 | used ++; |
4446 | Chat.Location = used+1; | 4446 | Chat.Location = used+1; |
4447 | error=Phone->GetChatSettings(&s,&Chat); | 4447 | error=Phone->GetChatSettings(&s,&Chat); |
4448 | printmsgerr("*"); | 4448 | printmsgerr("*"); |
4449 | if (gshutdown) { | 4449 | if (gshutdown) { |
4450 | GSM_Terminate(); | 4450 | GSM_Terminate(); |
4451 | exit(0); | 4451 | exit(0); |
4452 | } | 4452 | } |
4453 | } | 4453 | } |
4454 | printmsgerr("\n"); | 4454 | printmsgerr("\n"); |
4455 | } | 4455 | } |
4456 | DoBackup = false; | 4456 | DoBackup = false; |
4457 | if (Info.SyncMLSettings) { | 4457 | if (Info.SyncMLSettings) { |
4458 | printmsg("Checking SyncML settings\n"); | 4458 | printmsg("Checking SyncML settings\n"); |
4459 | SyncML.Location = 1; | 4459 | SyncML.Location = 1; |
4460 | error=Phone->GetSyncMLSettings(&s,&SyncML); | 4460 | error=Phone->GetSyncMLSettings(&s,&SyncML); |
4461 | if (error==ERR_NONE) { | 4461 | if (error==ERR_NONE) { |
4462 | if (answer_yes(" Backup SyncML settings")) DoBackup = true; | 4462 | if (answer_yes(" Backup SyncML settings")) DoBackup = true; |
4463 | } | 4463 | } |
4464 | } | 4464 | } |
4465 | if (DoBackup) { | 4465 | if (DoBackup) { |
4466 | used = 0; | 4466 | used = 0; |
4467 | printmsgerr(" Reading : "); | 4467 | printmsgerr(" Reading : "); |
4468 | while (error == ERR_NONE) { | 4468 | while (error == ERR_NONE) { |
4469 | if (used < GSM_BACKUP_MAX_SYNCMLSETTINGS) { | 4469 | if (used < GSM_BACKUP_MAX_SYNCMLSETTINGS) { |
4470 | Backup.SyncMLSettings[used] = malloc(sizeof(GSM_SyncMLSettings)); | 4470 | Backup.SyncMLSettings[used] = malloc(sizeof(GSM_SyncMLSettings)); |
4471 | if (Backup.SyncMLSettings[used] == NULL) Print_Error(ERR_MOREMEMORY); | 4471 | if (Backup.SyncMLSettings[used] == NULL) Print_Error(ERR_MOREMEMORY); |
4472 | Backup.SyncMLSettings[used+1] = NULL; | 4472 | Backup.SyncMLSettings[used+1] = NULL; |
4473 | } else { | 4473 | } else { |
4474 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_SYNCMLSETTINGS"); | 4474 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_SYNCMLSETTINGS"); |
4475 | GSM_Terminate(); | 4475 | GSM_Terminate(); |
4476 | exit(-1); | 4476 | exit(-1); |
4477 | } | 4477 | } |
4478 | *Backup.SyncMLSettings[used]=SyncML; | 4478 | *Backup.SyncMLSettings[used]=SyncML; |
4479 | used ++; | 4479 | used ++; |
4480 | SyncML.Location = used+1; | 4480 | SyncML.Location = used+1; |
4481 | error=Phone->GetSyncMLSettings(&s,&SyncML); | 4481 | error=Phone->GetSyncMLSettings(&s,&SyncML); |
4482 | printmsgerr("*"); | 4482 | printmsgerr("*"); |
4483 | if (gshutdown) { | 4483 | if (gshutdown) { |
4484 | GSM_Terminate(); | 4484 | GSM_Terminate(); |
4485 | exit(0); | 4485 | exit(0); |
4486 | } | 4486 | } |
4487 | } | 4487 | } |
4488 | printmsgerr("\n"); | 4488 | printmsgerr("\n"); |
4489 | } | 4489 | } |
4490 | DoBackup = false; | 4490 | DoBackup = false; |
4491 | if (Info.Ringtone) { | 4491 | if (Info.Ringtone) { |
4492 | printmsg("Checking user ringtones\n"); | 4492 | printmsg("Checking user ringtones\n"); |
4493 | Ringtone.Location = 1; | 4493 | Ringtone.Location = 1; |
4494 | Ringtone.Format = 0; | 4494 | Ringtone.Format = 0; |
4495 | error=Phone->GetRingtone(&s,&Ringtone,false); | 4495 | error=Phone->GetRingtone(&s,&Ringtone,false); |
4496 | if (error==ERR_EMPTY || error == ERR_NONE) { | 4496 | if (error==ERR_EMPTY || error == ERR_NONE) { |
4497 | if (answer_yes(" Backup user ringtones")) DoBackup = true; | 4497 | if (answer_yes(" Backup user ringtones")) DoBackup = true; |
4498 | } | 4498 | } |
4499 | } | 4499 | } |
4500 | if (DoBackup) { | 4500 | if (DoBackup) { |
4501 | used = 0; | 4501 | used = 0; |
4502 | i= 1; | 4502 | i= 1; |
4503 | printmsgerr(" Reading : "); | 4503 | printmsgerr(" Reading : "); |
4504 | while (error == ERR_NONE || error == ERR_EMPTY) { | 4504 | while (error == ERR_NONE || error == ERR_EMPTY) { |
4505 | if (error == ERR_NONE) { | 4505 | if (error == ERR_NONE) { |
4506 | if (used < GSM_BACKUP_MAX_RINGTONES) { | 4506 | if (used < GSM_BACKUP_MAX_RINGTONES) { |
4507 | Backup.Ringtone[used] = malloc(sizeof(GSM_Ringtone)); | 4507 | Backup.Ringtone[used] = malloc(sizeof(GSM_Ringtone)); |
4508 | if (Backup.Ringtone[used] == NULL) Print_Error(ERR_MOREMEMORY); | 4508 | if (Backup.Ringtone[used] == NULL) Print_Error(ERR_MOREMEMORY); |
4509 | Backup.Ringtone[used+1] = NULL; | 4509 | Backup.Ringtone[used+1] = NULL; |
4510 | } else { | 4510 | } else { |
4511 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_RINGTONES"); | 4511 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_RINGTONES"); |
4512 | GSM_Terminate(); | 4512 | GSM_Terminate(); |
4513 | exit(-1); | 4513 | exit(-1); |
4514 | } | 4514 | } |
4515 | *Backup.Ringtone[used]=Ringtone; | 4515 | *Backup.Ringtone[used]=Ringtone; |
4516 | used ++; | 4516 | used ++; |
4517 | } | 4517 | } |
4518 | i++; | 4518 | i++; |
4519 | Ringtone.Location = i; | 4519 | Ringtone.Location = i; |
4520 | Ringtone.Format = 0; | 4520 | Ringtone.Format = 0; |
4521 | error=Phone->GetRingtone(&s,&Ringtone,false); | 4521 | error=Phone->GetRingtone(&s,&Ringtone,false); |
4522 | printmsgerr("*"); | 4522 | printmsgerr("*"); |
4523 | if (gshutdown) { | 4523 | if (gshutdown) { |
4524 | GSM_Terminate(); | 4524 | GSM_Terminate(); |
4525 | exit(0); | 4525 | exit(0); |
4526 | } | 4526 | } |
4527 | } | 4527 | } |
4528 | printmsgerr("\n"); | 4528 | printmsgerr("\n"); |
4529 | } | 4529 | } |
4530 | DoBackup = false; | 4530 | DoBackup = false; |
4531 | if (Info.Profiles) { | 4531 | if (Info.Profiles) { |
4532 | printmsg("Checking phone profiles\n"); | 4532 | printmsg("Checking phone profiles\n"); |
4533 | Profile.Location = 1; | 4533 | Profile.Location = 1; |
4534 | error = Phone->GetProfile(&s,&Profile); | 4534 | error = Phone->GetProfile(&s,&Profile); |
4535 | if (error == ERR_NONE) { | 4535 | if (error == ERR_NONE) { |
4536 | if (answer_yes(" Backup phone profiles")) DoBackup = true; | 4536 | if (answer_yes(" Backup phone profiles")) DoBackup = true; |
4537 | } | 4537 | } |
4538 | } | 4538 | } |
4539 | if (DoBackup) { | 4539 | if (DoBackup) { |
4540 | used = 0; | 4540 | used = 0; |
4541 | printmsgerr(" Reading: "); | 4541 | printmsgerr(" Reading: "); |
4542 | while (true) { | 4542 | while (true) { |
4543 | Profile.Location = used + 1; | 4543 | Profile.Location = used + 1; |
4544 | error = Phone->GetProfile(&s,&Profile); | 4544 | error = Phone->GetProfile(&s,&Profile); |
4545 | if (error != ERR_NONE) break; | 4545 | if (error != ERR_NONE) break; |
4546 | if (used < GSM_BACKUP_MAX_PROFILES) { | 4546 | if (used < GSM_BACKUP_MAX_PROFILES) { |
4547 | Backup.Profiles[used] = malloc(sizeof(GSM_Profile)); | 4547 | Backup.Profiles[used] = malloc(sizeof(GSM_Profile)); |
4548 | if (Backup.Profiles[used] == NULL) Print_Error(ERR_MOREMEMORY); | 4548 | if (Backup.Profiles[used] == NULL) Print_Error(ERR_MOREMEMORY); |
4549 | Backup.Profiles[used + 1] = NULL; | 4549 | Backup.Profiles[used + 1] = NULL; |
4550 | } else { | 4550 | } else { |
4551 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_PROFILES"); | 4551 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_PROFILES"); |
4552 | GSM_Terminate(); | 4552 | GSM_Terminate(); |
4553 | exit(-1); | 4553 | exit(-1); |
4554 | } | 4554 | } |
4555 | *Backup.Profiles[used]=Profile; | 4555 | *Backup.Profiles[used]=Profile; |
4556 | used++; | 4556 | used++; |
4557 | printmsgerr("*"); | 4557 | printmsgerr("*"); |
4558 | } | 4558 | } |
4559 | printmsgerr("\n"); | 4559 | printmsgerr("\n"); |
4560 | } | 4560 | } |
4561 | DoBackup = false; | 4561 | DoBackup = false; |
4562 | if (Info.FMStation) { | 4562 | if (Info.FMStation) { |
4563 | printmsg("Checking FM stations\n"); | 4563 | printmsg("Checking FM stations\n"); |
4564 | FMStation.Location = 1; | 4564 | FMStation.Location = 1; |
4565 | error = Phone->GetFMStation(&s,&FMStation); | 4565 | error = Phone->GetFMStation(&s,&FMStation); |
4566 | if (error == ERR_NONE || error == ERR_EMPTY) { | 4566 | if (error == ERR_NONE || error == ERR_EMPTY) { |
4567 | if (answer_yes(" Backup phone FM stations")) DoBackup=true; | 4567 | if (answer_yes(" Backup phone FM stations")) DoBackup=true; |
4568 | } | 4568 | } |
4569 | } | 4569 | } |
4570 | if (DoBackup) { | 4570 | if (DoBackup) { |
4571 | used= 0; | 4571 | used= 0; |
4572 | i = 1; | 4572 | i = 1; |
4573 | printmsgerr(" Reading: "); | 4573 | printmsgerr(" Reading: "); |
4574 | while (error == ERR_NONE || error == ERR_EMPTY) { | 4574 | while (error == ERR_NONE || error == ERR_EMPTY) { |
4575 | error = Phone->GetFMStation(&s,&FMStation); | 4575 | error = Phone->GetFMStation(&s,&FMStation); |
4576 | if (error == ERR_NONE) { | 4576 | if (error == ERR_NONE) { |
4577 | if (used < GSM_BACKUP_MAX_FMSTATIONS) { | 4577 | if (used < GSM_BACKUP_MAX_FMSTATIONS) { |
4578 | Backup.FMStation[used] = malloc(sizeof(GSM_FMStation)); | 4578 | Backup.FMStation[used] = malloc(sizeof(GSM_FMStation)); |
4579 | if (Backup.FMStation[used] == NULL) Print_Error(ERR_MOREMEMORY); | 4579 | if (Backup.FMStation[used] == NULL) Print_Error(ERR_MOREMEMORY); |
4580 | Backup.FMStation[used + 1] = NULL; | 4580 | Backup.FMStation[used + 1] = NULL; |
4581 | } else { | 4581 | } else { |
4582 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_FMSTATIONS"); | 4582 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_FMSTATIONS"); |
4583 | GSM_Terminate(); | 4583 | GSM_Terminate(); |
4584 | exit(-1); | 4584 | exit(-1); |
4585 | } | 4585 | } |
4586 | *Backup.FMStation[used]=FMStation; | 4586 | *Backup.FMStation[used]=FMStation; |
4587 | used++; | 4587 | used++; |
4588 | } | 4588 | } |
4589 | i++; | 4589 | i++; |
4590 | FMStation.Location = i; | 4590 | FMStation.Location = i; |
4591 | printmsgerr("*"); | 4591 | printmsgerr("*"); |
4592 | } | 4592 | } |
4593 | printmsgerr("\n"); | 4593 | printmsgerr("\n"); |
4594 | } | 4594 | } |
4595 | DoBackup = false; | 4595 | DoBackup = false; |
4596 | if (Info.GPRSPoint) { | 4596 | if (Info.GPRSPoint) { |
4597 | printmsg("Checking GPRS access points\n"); | 4597 | printmsg("Checking GPRS access points\n"); |
4598 | GPRSPoint.Location = 1; | 4598 | GPRSPoint.Location = 1; |
4599 | error = Phone->GetGPRSAccessPoint(&s,&GPRSPoint); | 4599 | error = Phone->GetGPRSAccessPoint(&s,&GPRSPoint); |
4600 | if (error == ERR_NONE || error == ERR_EMPTY) { | 4600 | if (error == ERR_NONE || error == ERR_EMPTY) { |
4601 | if (answer_yes(" Backup GPRS access points")) DoBackup = true; | 4601 | if (answer_yes(" Backup GPRS access points")) DoBackup = true; |
4602 | } | 4602 | } |
4603 | } | 4603 | } |
4604 | if (DoBackup) { | 4604 | if (DoBackup) { |
4605 | used= 0; | 4605 | used= 0; |
4606 | i = 1; | 4606 | i = 1; |
4607 | printmsgerr(" Reading: "); | 4607 | printmsgerr(" Reading: "); |
4608 | while (error == ERR_NONE || error == ERR_EMPTY) { | 4608 | while (error == ERR_NONE || error == ERR_EMPTY) { |
4609 | error = Phone->GetGPRSAccessPoint(&s,&GPRSPoint); | 4609 | error = Phone->GetGPRSAccessPoint(&s,&GPRSPoint); |
4610 | if (error == ERR_NONE) { | 4610 | if (error == ERR_NONE) { |
4611 | if (used < GSM_BACKUP_MAX_GPRSPOINT) { | 4611 | if (used < GSM_BACKUP_MAX_GPRSPOINT) { |
4612 | Backup.GPRSPoint[used] = malloc(sizeof(GSM_GPRSAccessPoint)); | 4612 | Backup.GPRSPoint[used] = malloc(sizeof(GSM_GPRSAccessPoint)); |
4613 | if (Backup.GPRSPoint[used] == NULL) Print_Error(ERR_MOREMEMORY); | 4613 | if (Backup.GPRSPoint[used] == NULL) Print_Error(ERR_MOREMEMORY); |
4614 | Backup.GPRSPoint[used + 1] = NULL; | 4614 | Backup.GPRSPoint[used + 1] = NULL; |
4615 | } else { | 4615 | } else { |
4616 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_GPRSPOINT"); | 4616 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_GPRSPOINT"); |
4617 | GSM_Terminate(); | 4617 | GSM_Terminate(); |
4618 | exit(-1); | 4618 | exit(-1); |
4619 | } | 4619 | } |
4620 | *Backup.GPRSPoint[used]=GPRSPoint; | 4620 | *Backup.GPRSPoint[used]=GPRSPoint; |
4621 | used++; | 4621 | used++; |
4622 | } | 4622 | } |
4623 | i++; | 4623 | i++; |
4624 | GPRSPoint.Location = i; | 4624 | GPRSPoint.Location = i; |
4625 | printmsgerr("*"); | 4625 | printmsgerr("*"); |
4626 | } | 4626 | } |
4627 | printmsgerr("\n"); | 4627 | printmsgerr("\n"); |
4628 | } | 4628 | } |
4629 | 4629 | ||
4630 | GSM_Terminate(); | 4630 | GSM_Terminate(); |
4631 | 4631 | ||
4632 | GSM_SaveBackupFile(argv[2],&Backup, Info.UseUnicode); | 4632 | GSM_SaveBackupFile(argv[2],&Backup, Info.UseUnicode); |
4633 | GSM_FreeBackup(&Backup); | 4633 | GSM_FreeBackup(&Backup); |
4634 | } | 4634 | } |
4635 | 4635 | ||
4636 | static void Restore(int argc, char *argv[]) | 4636 | static void Restore(int argc, char *argv[]) |
4637 | { | 4637 | { |
4638 | GSM_Backup Backup; | 4638 | GSM_Backup Backup; |
4639 | GSM_FMStation FMStation; | 4639 | GSM_FMStation FMStation; |
4640 | GSM_DateTime date_time; | 4640 | GSM_DateTime date_time; |
4641 | GSM_CalendarEntryCalendar; | 4641 | GSM_CalendarEntryCalendar; |
4642 | GSM_Bitmap Bitmap; | 4642 | GSM_Bitmap Bitmap; |
4643 | GSM_Ringtone Ringtone; | 4643 | GSM_Ringtone Ringtone; |
4644 | GSM_MemoryEntry Pbk; | 4644 | GSM_MemoryEntry Pbk; |
4645 | GSM_MemoryStatusMemStatus; | 4645 | GSM_MemoryStatusMemStatus; |
4646 | GSM_ToDoEntry ToDo; | 4646 | GSM_ToDoEntry ToDo; |
4647 | GSM_ToDoStatus ToDoStatus; | 4647 | GSM_ToDoStatus ToDoStatus; |
4648 | GSM_Profile Profile; | 4648 | GSM_Profile Profile; |
4649 | GSM_MultiWAPSettingsSettings; | 4649 | GSM_MultiWAPSettingsSettings; |
4650 | GSM_GPRSAccessPointGPRSPoint; | 4650 | GSM_GPRSAccessPointGPRSPoint; |
4651 | GSM_WAPBookmark Bookmark; | 4651 | GSM_WAPBookmark Bookmark; |
4652 | int i, used, max = 0; | 4652 | int i, used, max = 0; |
4653 | bool Past = true; | 4653 | bool Past = true; |
4654 | bool Found, DoRestore; | 4654 | bool Found, DoRestore; |
4655 | 4655 | ||
4656 | error=GSM_ReadBackupFile(argv[2],&Backup); | 4656 | error=GSM_ReadBackupFile(argv[2],&Backup); |
4657 | if (error!=ERR_NOTIMPLEMENTED) { | 4657 | if (error!=ERR_NOTIMPLEMENTED) { |
4658 | Print_Error(error); | 4658 | Print_Error(error); |
4659 | } else { | 4659 | } else { |
4660 | printmsgerr("WARNING: Some data not read from file. It can be damaged or restoring some settings from this file format not implemented (maybe higher Gammu required ?)\n"); | 4660 | printmsgerr("WARNING: Some data not read from file. It can be damaged or restoring some settings from this file format not implemented (maybe higher Gammu required ?)\n"); |
4661 | } | 4661 | } |
4662 | 4662 | ||
4663 | signal(SIGINT, interrupt); | 4663 | signal(SIGINT, interrupt); |
4664 | printmsgerr("Press Ctrl+C to break...\n"); | 4664 | printmsgerr("Press Ctrl+C to break...\n"); |
4665 | 4665 | ||
4666 | if (Backup.DateTimeAvailable) printmsgerr("Time of backup : %s\n",OSDateTime(Backup.DateTime,false)); | 4666 | if (Backup.DateTimeAvailable) printmsgerr("Time of backup : %s\n",OSDateTime(Backup.DateTime,false)); |
4667 | if (Backup.Model[0]!=0) printmsgerr("Phone : %s\n",Backup.Model); | 4667 | if (Backup.Model[0]!=0) printmsgerr("Phone : %s\n",Backup.Model); |
4668 | if (Backup.IMEI[0]!=0) printmsgerr("IMEI : %s\n",Backup.IMEI); | 4668 | if (Backup.IMEI[0]!=0) printmsgerr("IMEI : %s\n",Backup.IMEI); |
4669 | if (Backup.Creator[0]!=0) printmsgerr("File created by : %s\n",Backup.Creator); | 4669 | if (Backup.Creator[0]!=0) printmsgerr("File created by : %s\n",Backup.Creator); |
4670 | 4670 | ||
4671 | if (Backup.MD5Calculated[0]!=0) { | 4671 | if (Backup.MD5Calculated[0]!=0) { |
4672 | dbgprintf("\"%s\"\n",Backup.MD5Original); | 4672 | dbgprintf("\"%s\"\n",Backup.MD5Original); |
4673 | dbgprintf("\"%s\"\n",Backup.MD5Calculated); | 4673 | dbgprintf("\"%s\"\n",Backup.MD5Calculated); |
4674 | if (strcmp(Backup.MD5Original,Backup.MD5Calculated)) { | 4674 | if (strcmp(Backup.MD5Original,Backup.MD5Calculated)) { |
4675 | if (!answer_yes("Checksum in backup file do not match. Continue")) return; | 4675 | if (!answer_yes("Checksum in backup file do not match. Continue")) return; |
4676 | } | 4676 | } |
4677 | } | 4677 | } |
4678 | 4678 | ||
4679 | GSM_Init(true); | 4679 | GSM_Init(true); |
4680 | 4680 | ||
4681 | DoRestore = false; | 4681 | DoRestore = false; |
4682 | if (Backup.PhonePhonebook[0] != NULL) { | 4682 | if (Backup.PhonePhonebook[0] != NULL) { |
4683 | MemStatus.MemoryType = MEM_ME; | 4683 | MemStatus.MemoryType = MEM_ME; |
4684 | error=Phone->GetMemoryStatus(&s, &MemStatus); | 4684 | error=Phone->GetMemoryStatus(&s, &MemStatus); |
4685 | if (error==ERR_NONE) { | 4685 | if (error==ERR_NONE) { |
4686 | max = 0; | 4686 | max = 0; |
4687 | while (Backup.PhonePhonebook[max]!=NULL) max++; | 4687 | while (Backup.PhonePhonebook[max]!=NULL) max++; |
4688 | printmsgerr("%i entries in backup file\n",max); | 4688 | printmsgerr("%i entries in backup file\n",max); |
4689 | if (answer_yes("Restore phone phonebook")) DoRestore = true; | 4689 | if (answer_yes("Restore phone phonebook")) DoRestore = true; |
4690 | } | 4690 | } |
4691 | } | 4691 | } |
4692 | if (DoRestore) { | 4692 | if (DoRestore) { |
4693 | used = 0; | 4693 | used = 0; |
4694 | for (i=0;i<MemStatus.MemoryUsed+MemStatus.MemoryFree;i++) { | 4694 | for (i=0;i<MemStatus.MemoryUsed+MemStatus.MemoryFree;i++) { |
4695 | Pbk.MemoryType = MEM_ME; | 4695 | Pbk.MemoryType = MEM_ME; |
4696 | Pbk.Location= i + 1; | 4696 | Pbk.Location= i + 1; |
4697 | Pbk.EntriesNum= 0; | 4697 | Pbk.EntriesNum= 0; |
4698 | if (used<max) { | 4698 | if (used<max) { |
4699 | if (Backup.PhonePhonebook[used]->Location == Pbk.Location) { | 4699 | if (Backup.PhonePhonebook[used]->Location == Pbk.Location) { |
4700 | Pbk = *Backup.PhonePhonebook[used]; | 4700 | Pbk = *Backup.PhonePhonebook[used]; |
4701 | used++; | 4701 | used++; |
4702 | dbgprintf("Location %i\n",Pbk.Location); | 4702 | dbgprintf("Location %i\n",Pbk.Location); |
4703 | if (Pbk.EntriesNum != 0) error=Phone->SetMemory(&s, &Pbk); | 4703 | if (Pbk.EntriesNum != 0) error=Phone->SetMemory(&s, &Pbk); |
4704 | } | 4704 | } |
4705 | } | 4705 | } |
4706 | if (Pbk.EntriesNum == 0) error=Phone->DeleteMemory(&s, &Pbk); | 4706 | if (Pbk.EntriesNum == 0) error=Phone->DeleteMemory(&s, &Pbk); |
4707 | Print_Error(error); | 4707 | Print_Error(error); |
4708 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/(MemStatus.MemoryUsed+MemStatus.MemoryFree)); | 4708 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/(MemStatus.MemoryUsed+MemStatus.MemoryFree)); |
4709 | if (gshutdown) { | 4709 | if (gshutdown) { |
4710 | GSM_Terminate(); | 4710 | GSM_Terminate(); |
4711 | exit(0); | 4711 | exit(0); |
4712 | } | 4712 | } |
4713 | } | 4713 | } |
4714 | printmsgerr("\n"); | 4714 | printmsgerr("\n"); |
4715 | } | 4715 | } |
4716 | 4716 | ||
4717 | DoRestore = false; | 4717 | DoRestore = false; |
4718 | if (Backup.SIMPhonebook[0] != NULL) { | 4718 | if (Backup.SIMPhonebook[0] != NULL) { |
4719 | MemStatus.MemoryType = MEM_SM; | 4719 | MemStatus.MemoryType = MEM_SM; |
4720 | error=Phone->GetMemoryStatus(&s, &MemStatus); | 4720 | error=Phone->GetMemoryStatus(&s, &MemStatus); |
4721 | if (error==ERR_NONE) { | 4721 | if (error==ERR_NONE) { |
4722 | max = 0; | 4722 | max = 0; |
4723 | while (Backup.SIMPhonebook[max]!=NULL) max++; | 4723 | while (Backup.SIMPhonebook[max]!=NULL) max++; |
4724 | printmsgerr("%i entries in backup file\n",max); | 4724 | printmsgerr("%i entries in backup file\n",max); |
4725 | if (answer_yes("Restore SIM phonebook")) DoRestore = true; | 4725 | if (answer_yes("Restore SIM phonebook")) DoRestore = true; |
4726 | } | 4726 | } |
4727 | } | 4727 | } |
4728 | if (DoRestore) { | 4728 | if (DoRestore) { |
4729 | used = 0; | 4729 | used = 0; |
4730 | for (i=0;i<MemStatus.MemoryUsed+MemStatus.MemoryFree;i++) { | 4730 | for (i=0;i<MemStatus.MemoryUsed+MemStatus.MemoryFree;i++) { |
4731 | Pbk.MemoryType = MEM_SM; | 4731 | Pbk.MemoryType = MEM_SM; |
4732 | Pbk.Location= i + 1; | 4732 | Pbk.Location= i + 1; |
4733 | Pbk.EntriesNum= 0; | 4733 | Pbk.EntriesNum= 0; |
4734 | if (used<max) { | 4734 | if (used<max) { |
4735 | if (Backup.SIMPhonebook[used]->Location == Pbk.Location) { | 4735 | if (Backup.SIMPhonebook[used]->Location == Pbk.Location) { |
4736 | Pbk = *Backup.SIMPhonebook[used]; | 4736 | Pbk = *Backup.SIMPhonebook[used]; |
4737 | used++; | 4737 | used++; |
4738 | dbgprintf("Location %i\n",Pbk.Location); | 4738 | dbgprintf("Location %i\n",Pbk.Location); |
4739 | if (Pbk.EntriesNum != 0) error=Phone->SetMemory(&s, &Pbk); | 4739 | if (Pbk.EntriesNum != 0) error=Phone->SetMemory(&s, &Pbk); |
4740 | } | 4740 | } |
4741 | } | 4741 | } |
4742 | if (Pbk.EntriesNum == 0) error=Phone->DeleteMemory(&s, &Pbk); | 4742 | if (Pbk.EntriesNum == 0) error=Phone->DeleteMemory(&s, &Pbk); |
4743 | Print_Error(error); | 4743 | Print_Error(error); |
4744 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/(MemStatus.MemoryUsed+MemStatus.MemoryFree)); | 4744 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/(MemStatus.MemoryUsed+MemStatus.MemoryFree)); |
4745 | if (gshutdown) { | 4745 | if (gshutdown) { |
4746 | GSM_Terminate(); | 4746 | GSM_Terminate(); |
4747 | exit(0); | 4747 | exit(0); |
4748 | } | 4748 | } |
4749 | } | 4749 | } |
4750 | printmsgerr("\n"); | 4750 | printmsgerr("\n"); |
4751 | } | 4751 | } |
4752 | 4752 | ||
4753 | DoRestore = false; | 4753 | DoRestore = false; |
4754 | if (Backup.CallerLogos[0] != NULL) { | 4754 | if (Backup.CallerLogos[0] != NULL) { |
4755 | Bitmap.Type = GSM_CallerGroupLogo; | 4755 | Bitmap.Type = GSM_CallerGroupLogo; |
4756 | Bitmap.Location = 1; | 4756 | Bitmap.Location = 1; |
4757 | error=Phone->GetBitmap(&s,&Bitmap); | 4757 | error=Phone->GetBitmap(&s,&Bitmap); |
4758 | if (error == ERR_NONE) { | 4758 | if (error == ERR_NONE) { |
4759 | if (answer_yes("Restore caller groups and logos")) DoRestore = true; | 4759 | if (answer_yes("Restore caller groups and logos")) DoRestore = true; |
4760 | } | 4760 | } |
4761 | } | 4761 | } |
4762 | if (DoRestore) { | 4762 | if (DoRestore) { |
4763 | max = 0; | 4763 | max = 0; |
4764 | while (Backup.CallerLogos[max]!=NULL) max++; | 4764 | while (Backup.CallerLogos[max]!=NULL) max++; |
4765 | for (i=0;i<max;i++) { | 4765 | for (i=0;i<max;i++) { |
4766 | error=Phone->SetBitmap(&s,Backup.CallerLogos[i]); | 4766 | error=Phone->SetBitmap(&s,Backup.CallerLogos[i]); |
4767 | Print_Error(error); | 4767 | Print_Error(error); |
4768 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 4768 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
4769 | if (gshutdown) { | 4769 | if (gshutdown) { |
4770 | GSM_Terminate(); | 4770 | GSM_Terminate(); |
4771 | exit(0); | 4771 | exit(0); |
4772 | } | 4772 | } |
4773 | } | 4773 | } |
4774 | printmsgerr("\n"); | 4774 | printmsgerr("\n"); |
4775 | } | 4775 | } |
4776 | 4776 | ||
4777 | if (!mystrncasecmp(s.CurrentConfig->SyncTime,"yes",0)) { | 4777 | if (!mystrncasecmp(s.CurrentConfig->SyncTime,"yes",0)) { |
4778 | if (answer_yes("Do you want to set date/time in phone (NOTE: in some phones it's required to correctly restore calendar notes and other items)")) { | 4778 | if ( true /*LRanswer_yes("Do you want to set date/time in phone (NOTE: in some phones it's required to correctly restore calendar notes and other items)")*/) { |
4779 | GSM_GetCurrentDateTime(&date_time); | 4779 | GSM_GetCurrentDateTime(&date_time); |
4780 | 4780 | ||
4781 | error=Phone->SetDateTime(&s, &date_time); | 4781 | error=Phone->SetDateTime(&s, &date_time); |
4782 | Print_Error(error); | 4782 | Print_Error(error); |
4783 | } | 4783 | } |
4784 | } | 4784 | } |
4785 | DoRestore = false; | 4785 | DoRestore = false; |
4786 | if (Backup.Calendar[0] != NULL) { | 4786 | if (Backup.Calendar[0] != NULL) { |
4787 | /* N6110 doesn't support getting calendar status */ | 4787 | /* N6110 doesn't support getting calendar status */ |
4788 | error = Phone->GetNextCalendar(&s,&Calendar,true); | 4788 | error = Phone->GetNextCalendar(&s,&Calendar,true); |
4789 | if (error == ERR_NONE || error == ERR_INVALIDLOCATION || error == ERR_EMPTY) { | 4789 | if (error == ERR_NONE || error == ERR_INVALIDLOCATION || error == ERR_EMPTY) { |
4790 | max = 0; | 4790 | max = 0; |
4791 | while (Backup.Calendar[max] != NULL) max++; | 4791 | while (Backup.Calendar[max] != NULL) max++; |
4792 | printmsgerr("%i entries in backup file\n",max); | 4792 | printmsgerr("%i entries in backup file\n",max); |
4793 | // LR | 4793 | // LR |
4794 | //if (answer_yes("Restore calendar notes")) { | 4794 | //if (answer_yes("Restore calendar notes")) { |
4795 | //Past = answer_yes("Restore notes from the past"); | 4795 | //Past = answer_yes("Restore notes from the past"); |
4796 | DoRestore = true; | 4796 | DoRestore = true; |
4797 | //} | 4797 | //} |
4798 | } | 4798 | } |
4799 | } | 4799 | } |
4800 | if (DoRestore) { | 4800 | if (DoRestore) { |
4801 | printmsgerr("Deleting old notes: "); | 4801 | printmsgerr("Deleting old notes: "); |
4802 | error = Phone->DeleteAllCalendar(&s); | 4802 | error = Phone->DeleteAllCalendar(&s); |
4803 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { | 4803 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { |
4804 | while (1) { | 4804 | while (1) { |
4805 | error = Phone->GetNextCalendar(&s,&Calendar,true); | 4805 | error = Phone->GetNextCalendar(&s,&Calendar,true); |
4806 | if (error != ERR_NONE) break; | 4806 | if (error != ERR_NONE) break; |
4807 | error = Phone->DeleteCalendar(&s,&Calendar); | 4807 | error = Phone->DeleteCalendar(&s,&Calendar); |
4808 | Print_Error(error); | 4808 | Print_Error(error); |
4809 | printmsgerr("*"); | 4809 | printmsgerr("*"); |
4810 | } | 4810 | } |
4811 | printmsgerr("\n"); | 4811 | printmsgerr("\n"); |
4812 | } else { | 4812 | } else { |
4813 | printmsgerr("Done\n"); | 4813 | printmsgerr("Done\n"); |
4814 | Print_Error(error); | 4814 | Print_Error(error); |
4815 | } | 4815 | } |
4816 | 4816 | ||
4817 | for (i=0;i<max;i++) { | 4817 | for (i=0;i<max;i++) { |
4818 | if (!Past && IsCalendarNoteFromThePast(Backup.Calendar[i])) continue; | 4818 | if (!Past && IsCalendarNoteFromThePast(Backup.Calendar[i])) continue; |
4819 | 4819 | ||
4820 | Calendar = *Backup.Calendar[i]; | 4820 | Calendar = *Backup.Calendar[i]; |
4821 | error=Phone->AddCalendar(&s,&Calendar); | 4821 | error=Phone->AddCalendar(&s,&Calendar); |
4822 | Print_Error(error); | 4822 | Print_Error(error); |
4823 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 4823 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
4824 | if (gshutdown) { | 4824 | if (gshutdown) { |
4825 | GSM_Terminate(); | 4825 | GSM_Terminate(); |
4826 | exit(0); | 4826 | exit(0); |
4827 | } | 4827 | } |
4828 | } | 4828 | } |
4829 | printmsgerr("\n"); | 4829 | printmsgerr("\n"); |
4830 | } | 4830 | } |
4831 | 4831 | ||
4832 | DoRestore = false; | 4832 | DoRestore = false; |
4833 | if (Backup.ToDo[0] != NULL) { | 4833 | if (Backup.ToDo[0] != NULL) { |
4834 | error = Phone->GetToDoStatus(&s,&ToDoStatus); | 4834 | error = Phone->GetToDoStatus(&s,&ToDoStatus); |
4835 | if (error == ERR_NONE) { | 4835 | if (error == ERR_NONE) { |
4836 | max = 0; | 4836 | max = 0; |
4837 | while (Backup.ToDo[max]!=NULL) max++; | 4837 | while (Backup.ToDo[max]!=NULL) max++; |
4838 | printmsgerr("%i entries in backup file\n",max); | 4838 | printmsgerr("%i entries in backup file\n",max); |
4839 | 4839 | ||
4840 | //LR if (answer_yes("Restore ToDo")) | 4840 | //LR if (answer_yes("Restore ToDo")) |
4841 | DoRestore = true; | 4841 | DoRestore = true; |
4842 | } | 4842 | } |
4843 | } | 4843 | } |
4844 | if (DoRestore) { | 4844 | if (DoRestore) { |
4845 | ToDo = *Backup.ToDo[0]; | 4845 | ToDo = *Backup.ToDo[0]; |
4846 | error = Phone->SetToDo(&s,&ToDo); | 4846 | error = Phone->SetToDo(&s,&ToDo); |
4847 | } | 4847 | } |
4848 | if (DoRestore && (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED)) { | 4848 | if (DoRestore && (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED)) { |
4849 | printmsgerr("Deleting old ToDo: "); | 4849 | printmsgerr("Deleting old ToDo: "); |
4850 | error=Phone->DeleteAllToDo(&s); | 4850 | error=Phone->DeleteAllToDo(&s); |
4851 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { | 4851 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { |
4852 | while (1) { | 4852 | while (1) { |
4853 | error = Phone->GetNextToDo(&s,&ToDo,true); | 4853 | error = Phone->GetNextToDo(&s,&ToDo,true); |
4854 | if (error != ERR_NONE) break; | 4854 | if (error != ERR_NONE) break; |
4855 | error = Phone->DeleteToDo(&s,&ToDo); | 4855 | error = Phone->DeleteToDo(&s,&ToDo); |
4856 | Print_Error(error); | 4856 | Print_Error(error); |
4857 | printmsgerr("*"); | 4857 | printmsgerr("*"); |
4858 | } | 4858 | } |
4859 | printmsgerr("\n"); | 4859 | printmsgerr("\n"); |
4860 | } else { | 4860 | } else { |
4861 | printmsgerr("Done\n"); | 4861 | printmsgerr("Done\n"); |
4862 | Print_Error(error); | 4862 | Print_Error(error); |
4863 | } | 4863 | } |
4864 | 4864 | ||
4865 | for (i=0;i<max;i++) { | 4865 | for (i=0;i<max;i++) { |
4866 | ToDo = *Backup.ToDo[i]; | 4866 | ToDo = *Backup.ToDo[i]; |
4867 | ToDo.Location = 0; | 4867 | ToDo.Location = 0; |
4868 | error=Phone->AddToDo(&s,&ToDo); | 4868 | error=Phone->AddToDo(&s,&ToDo); |
4869 | Print_Error(error); | 4869 | Print_Error(error); |
4870 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 4870 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
4871 | if (gshutdown) { | 4871 | if (gshutdown) { |
4872 | GSM_Terminate(); | 4872 | GSM_Terminate(); |
4873 | exit(0); | 4873 | exit(0); |
4874 | } | 4874 | } |
4875 | } | 4875 | } |
4876 | printmsgerr("\n"); | 4876 | printmsgerr("\n"); |
4877 | } else if (DoRestore) { | 4877 | } else if (DoRestore) { |
4878 | /* At first delete entries, that were deleted */ | 4878 | /* At first delete entries, that were deleted */ |
4879 | used = 0; | 4879 | used = 0; |
4880 | error = Phone->GetNextToDo(&s,&ToDo,true); | 4880 | error = Phone->GetNextToDo(&s,&ToDo,true); |
4881 | while (error == ERR_NONE) { | 4881 | while (error == ERR_NONE) { |
4882 | used++; | 4882 | used++; |
4883 | Found = false; | 4883 | Found = false; |
4884 | for (i=0;i<max;i++) { | 4884 | for (i=0;i<max;i++) { |
4885 | if (Backup.ToDo[i]->Location == ToDo.Location) { | 4885 | if (Backup.ToDo[i]->Location == ToDo.Location) { |
4886 | Found = true; | 4886 | Found = true; |
4887 | break; | 4887 | break; |
4888 | } | 4888 | } |
4889 | } | 4889 | } |
4890 | if (!Found) { | 4890 | if (!Found) { |
4891 | error=Phone->DeleteToDo(&s,&ToDo); | 4891 | error=Phone->DeleteToDo(&s,&ToDo); |
4892 | Print_Error(error); | 4892 | Print_Error(error); |
4893 | } | 4893 | } |
4894 | error = Phone->GetNextToDo(&s,&ToDo,false); | 4894 | error = Phone->GetNextToDo(&s,&ToDo,false); |
4895 | printmsgerr("%cCleaning: %i percent",13,used*100/ToDoStatus.Used); | 4895 | printmsgerr("%cCleaning: %i percent",13,used*100/ToDoStatus.Used); |
4896 | if (gshutdown) { | 4896 | if (gshutdown) { |
4897 | GSM_Terminate(); | 4897 | GSM_Terminate(); |
4898 | exit(0); | 4898 | exit(0); |
4899 | } | 4899 | } |
4900 | } | 4900 | } |
4901 | printmsgerr("\n"); | 4901 | printmsgerr("\n"); |
4902 | 4902 | ||
4903 | /* Now write modified/new entries */ | 4903 | /* Now write modified/new entries */ |
4904 | for (i=0;i<max;i++) { | 4904 | for (i=0;i<max;i++) { |
4905 | ToDo = *Backup.ToDo[i]; | 4905 | ToDo = *Backup.ToDo[i]; |
4906 | error = Phone->SetToDo(&s,&ToDo); | 4906 | error = Phone->SetToDo(&s,&ToDo); |
4907 | Print_Error(error); | 4907 | Print_Error(error); |
4908 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 4908 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
4909 | if (gshutdown) { | 4909 | if (gshutdown) { |
4910 | GSM_Terminate(); | 4910 | GSM_Terminate(); |
4911 | exit(0); | 4911 | exit(0); |
4912 | } | 4912 | } |
4913 | } | 4913 | } |
4914 | printmsgerr("\n"); | 4914 | printmsgerr("\n"); |
4915 | } | 4915 | } |
4916 | 4916 | ||
4917 | if (Backup.SMSC[0] != NULL && answer_yes("Restore SMSC profiles")) { | 4917 | if (Backup.SMSC[0] != NULL && answer_yes("Restore SMSC profiles")) { |
4918 | max = 0; | 4918 | max = 0; |
4919 | while (Backup.SMSC[max]!=NULL) max++; | 4919 | while (Backup.SMSC[max]!=NULL) max++; |
4920 | for (i=0;i<max;i++) { | 4920 | for (i=0;i<max;i++) { |
4921 | error=Phone->SetSMSC(&s,Backup.SMSC[i]); | 4921 | error=Phone->SetSMSC(&s,Backup.SMSC[i]); |
4922 | Print_Error(error); | 4922 | Print_Error(error); |
4923 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 4923 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
4924 | if (gshutdown) { | 4924 | if (gshutdown) { |
4925 | GSM_Terminate(); | 4925 | GSM_Terminate(); |
4926 | exit(0); | 4926 | exit(0); |
4927 | } | 4927 | } |
4928 | } | 4928 | } |
4929 | printmsgerr("\n"); | 4929 | printmsgerr("\n"); |
4930 | } | 4930 | } |
4931 | if (Backup.StartupLogo != NULL && answer_yes("Restore startup logo/text")) { | 4931 | if (Backup.StartupLogo != NULL && answer_yes("Restore startup logo/text")) { |
4932 | error=Phone->SetBitmap(&s,Backup.StartupLogo); | 4932 | error=Phone->SetBitmap(&s,Backup.StartupLogo); |
4933 | Print_Error(error); | 4933 | Print_Error(error); |
4934 | } | 4934 | } |
4935 | if (Backup.OperatorLogo != NULL && answer_yes("Restore operator logo")) { | 4935 | if (Backup.OperatorLogo != NULL && answer_yes("Restore operator logo")) { |
4936 | error=Phone->SetBitmap(&s,Backup.OperatorLogo); | 4936 | error=Phone->SetBitmap(&s,Backup.OperatorLogo); |
4937 | Print_Error(error); | 4937 | Print_Error(error); |
4938 | } | 4938 | } |
4939 | DoRestore = false; | 4939 | DoRestore = false; |
4940 | if (Backup.WAPBookmark[0] != NULL) { | 4940 | if (Backup.WAPBookmark[0] != NULL) { |
4941 | Bookmark.Location = 1; | 4941 | Bookmark.Location = 1; |
4942 | error = Phone->GetWAPBookmark(&s,&Bookmark); | 4942 | error = Phone->GetWAPBookmark(&s,&Bookmark); |
4943 | if (error == ERR_NONE || error == ERR_INVALIDLOCATION) { | 4943 | if (error == ERR_NONE || error == ERR_INVALIDLOCATION) { |
4944 | if (answer_yes("Restore WAP bookmarks")) DoRestore = true; | 4944 | if (answer_yes("Restore WAP bookmarks")) DoRestore = true; |
4945 | } | 4945 | } |
4946 | } | 4946 | } |
4947 | if (DoRestore) { | 4947 | if (DoRestore) { |
4948 | printmsgerr("Deleting old bookmarks: "); | 4948 | printmsgerr("Deleting old bookmarks: "); |
4949 | /* One thing to explain: DCT4 phones seems to have bug here. | 4949 | /* One thing to explain: DCT4 phones seems to have bug here. |
4950 | * When delete for example first bookmark, phone change | 4950 | * When delete for example first bookmark, phone change |
4951 | * numeration for getting frame, not for deleting. So, we try to | 4951 | * numeration for getting frame, not for deleting. So, we try to |
4952 | * get 1'st bookmark. Inside frame is "correct" location. We use | 4952 | * get 1'st bookmark. Inside frame is "correct" location. We use |
4953 | * it later | 4953 | * it later |
4954 | */ | 4954 | */ |
4955 | while (error==ERR_NONE) { | 4955 | while (error==ERR_NONE) { |
4956 | error = Phone->DeleteWAPBookmark(&s,&Bookmark); | 4956 | error = Phone->DeleteWAPBookmark(&s,&Bookmark); |
4957 | Bookmark.Location = 1; | 4957 | Bookmark.Location = 1; |
4958 | error = Phone->GetWAPBookmark(&s,&Bookmark); | 4958 | error = Phone->GetWAPBookmark(&s,&Bookmark); |
4959 | printmsgerr("*"); | 4959 | printmsgerr("*"); |
4960 | } | 4960 | } |
4961 | printmsgerr("\n"); | 4961 | printmsgerr("\n"); |
4962 | max = 0; | 4962 | max = 0; |
4963 | while (Backup.WAPBookmark[max]!=NULL) max++; | 4963 | while (Backup.WAPBookmark[max]!=NULL) max++; |
4964 | for (i=0;i<max;i++) { | 4964 | for (i=0;i<max;i++) { |
4965 | Bookmark = *Backup.WAPBookmark[i]; | 4965 | Bookmark = *Backup.WAPBookmark[i]; |
4966 | Bookmark.Location = 0; | 4966 | Bookmark.Location = 0; |
4967 | error=Phone->SetWAPBookmark(&s,&Bookmark); | 4967 | error=Phone->SetWAPBookmark(&s,&Bookmark); |
4968 | Print_Error(error); | 4968 | Print_Error(error); |
4969 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 4969 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
4970 | if (gshutdown) { | 4970 | if (gshutdown) { |
4971 | GSM_Terminate(); | 4971 | GSM_Terminate(); |
4972 | exit(0); | 4972 | exit(0); |
4973 | } | 4973 | } |
4974 | } | 4974 | } |
4975 | printmsgerr("\n"); | 4975 | printmsgerr("\n"); |
4976 | } | 4976 | } |
4977 | DoRestore = false; | 4977 | DoRestore = false; |
4978 | if (Backup.WAPSettings[0] != NULL) { | 4978 | if (Backup.WAPSettings[0] != NULL) { |
4979 | Settings.Location = 1; | 4979 | Settings.Location = 1; |
4980 | error = Phone->GetWAPSettings(&s,&Settings); | 4980 | error = Phone->GetWAPSettings(&s,&Settings); |
4981 | if (error == ERR_NONE) { | 4981 | if (error == ERR_NONE) { |
4982 | if (answer_yes("Restore WAP settings")) DoRestore = true; | 4982 | if (answer_yes("Restore WAP settings")) DoRestore = true; |
4983 | } | 4983 | } |
4984 | } | 4984 | } |
4985 | if (DoRestore) { | 4985 | if (DoRestore) { |
4986 | max = 0; | 4986 | max = 0; |
4987 | while (Backup.WAPSettings[max]!=NULL) max++; | 4987 | while (Backup.WAPSettings[max]!=NULL) max++; |
4988 | for (i=0;i<max;i++) { | 4988 | for (i=0;i<max;i++) { |
4989 | error=Phone->SetWAPSettings(&s,Backup.WAPSettings[i]); | 4989 | error=Phone->SetWAPSettings(&s,Backup.WAPSettings[i]); |
4990 | Print_Error(error); | 4990 | Print_Error(error); |
4991 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 4991 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
4992 | if (gshutdown) { | 4992 | if (gshutdown) { |
4993 | GSM_Terminate(); | 4993 | GSM_Terminate(); |
4994 | exit(0); | 4994 | exit(0); |
4995 | } | 4995 | } |
4996 | } | 4996 | } |
4997 | printmsgerr("\n"); | 4997 | printmsgerr("\n"); |
4998 | } | 4998 | } |
4999 | DoRestore = false; | 4999 | DoRestore = false; |
5000 | if (Backup.MMSSettings[0] != NULL) { | 5000 | if (Backup.MMSSettings[0] != NULL) { |
5001 | Settings.Location = 1; | 5001 | Settings.Location = 1; |
5002 | error = Phone->GetMMSSettings(&s,&Settings); | 5002 | error = Phone->GetMMSSettings(&s,&Settings); |
5003 | if (error == ERR_NONE) { | 5003 | if (error == ERR_NONE) { |
5004 | if (answer_yes("Restore MMS settings")) DoRestore = true; | 5004 | if (answer_yes("Restore MMS settings")) DoRestore = true; |
5005 | } | 5005 | } |
5006 | } | 5006 | } |
5007 | if (DoRestore) { | 5007 | if (DoRestore) { |
5008 | max = 0; | 5008 | max = 0; |
5009 | while (Backup.MMSSettings[max]!=NULL) max++; | 5009 | while (Backup.MMSSettings[max]!=NULL) max++; |
5010 | for (i=0;i<max;i++) { | 5010 | for (i=0;i<max;i++) { |
5011 | error=Phone->SetMMSSettings(&s,Backup.MMSSettings[i]); | 5011 | error=Phone->SetMMSSettings(&s,Backup.MMSSettings[i]); |
5012 | Print_Error(error); | 5012 | Print_Error(error); |
5013 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 5013 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
5014 | if (gshutdown) { | 5014 | if (gshutdown) { |
5015 | GSM_Terminate(); | 5015 | GSM_Terminate(); |
5016 | exit(0); | 5016 | exit(0); |
5017 | } | 5017 | } |
5018 | } | 5018 | } |
5019 | printmsgerr("\n"); | 5019 | printmsgerr("\n"); |
5020 | } | 5020 | } |
5021 | DoRestore = false; | 5021 | DoRestore = false; |
5022 | if (Backup.Ringtone[0] != NULL) { | 5022 | if (Backup.Ringtone[0] != NULL) { |
5023 | Ringtone.Location = 1; | 5023 | Ringtone.Location = 1; |
5024 | Ringtone.Format = 0; | 5024 | Ringtone.Format = 0; |
5025 | error = Phone->GetRingtone(&s,&Ringtone,false); | 5025 | error = Phone->GetRingtone(&s,&Ringtone,false); |
5026 | if (error == ERR_NONE || error ==ERR_EMPTY) { | 5026 | if (error == ERR_NONE || error ==ERR_EMPTY) { |
5027 | if (Phone->DeleteUserRingtones != NOTSUPPORTED) { | 5027 | if (Phone->DeleteUserRingtones != NOTSUPPORTED) { |
5028 | if (answer_yes("Delete all user ringtones")) DoRestore = true; | 5028 | if (answer_yes("Delete all user ringtones")) DoRestore = true; |
5029 | } | 5029 | } |
5030 | } | 5030 | } |
5031 | } | 5031 | } |
5032 | if (DoRestore) { | 5032 | if (DoRestore) { |
5033 | printmsgerr("Deleting: "); | 5033 | printmsgerr("Deleting: "); |
5034 | error=Phone->DeleteUserRingtones(&s); | 5034 | error=Phone->DeleteUserRingtones(&s); |
5035 | Print_Error(error); | 5035 | Print_Error(error); |
5036 | printmsgerr("Done\n"); | 5036 | printmsgerr("Done\n"); |
5037 | DoRestore = false; | 5037 | DoRestore = false; |
5038 | if (answer_yes("Restore user ringtones")) DoRestore = true; | 5038 | if (answer_yes("Restore user ringtones")) DoRestore = true; |
5039 | } | 5039 | } |
5040 | if (DoRestore) { | 5040 | if (DoRestore) { |
5041 | max = 0; | 5041 | max = 0; |
5042 | while (Backup.Ringtone[max]!=NULL) max++; | 5042 | while (Backup.Ringtone[max]!=NULL) max++; |
5043 | for (i=0;i<max;i++) { | 5043 | for (i=0;i<max;i++) { |
5044 | error=GSM_RingtoneConvert(&Ringtone, Backup.Ringtone[i], Ringtone.Format); | 5044 | error=GSM_RingtoneConvert(&Ringtone, Backup.Ringtone[i], Ringtone.Format); |
5045 | Print_Error(error); | 5045 | Print_Error(error); |
5046 | error=Phone->SetRingtone(&s,&Ringtone,&i); | 5046 | error=Phone->SetRingtone(&s,&Ringtone,&i); |
5047 | Print_Error(error); | 5047 | Print_Error(error); |
5048 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 5048 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
5049 | if (gshutdown) { | 5049 | if (gshutdown) { |
5050 | GSM_Terminate(); | 5050 | GSM_Terminate(); |
5051 | exit(0); | 5051 | exit(0); |
5052 | } | 5052 | } |
5053 | } | 5053 | } |
5054 | printmsgerr("\n"); | 5054 | printmsgerr("\n"); |
5055 | } | 5055 | } |
5056 | DoRestore = false; | 5056 | DoRestore = false; |
5057 | if (Backup.Profiles[0] != NULL) { | 5057 | if (Backup.Profiles[0] != NULL) { |
5058 | Profile.Location = 1; | 5058 | Profile.Location = 1; |
5059 | error = Phone->GetProfile(&s,&Profile); | 5059 | error = Phone->GetProfile(&s,&Profile); |
5060 | if (error == ERR_NONE) { | 5060 | if (error == ERR_NONE) { |
5061 | if (answer_yes("Restore profiles")) DoRestore = true; | 5061 | if (answer_yes("Restore profiles")) DoRestore = true; |
5062 | } | 5062 | } |
5063 | } | 5063 | } |
5064 | if (DoRestore) { | 5064 | if (DoRestore) { |
5065 | Profile.Location= 0; | 5065 | Profile.Location= 0; |
5066 | max = 0; | 5066 | max = 0; |
5067 | while (Backup.Profiles[max]!=NULL) max++; | 5067 | while (Backup.Profiles[max]!=NULL) max++; |
5068 | for (i=0;i<max;i++) { | 5068 | for (i=0;i<max;i++) { |
5069 | Profile= *Backup.Profiles[i]; | 5069 | Profile= *Backup.Profiles[i]; |
5070 | error=Phone->SetProfile(&s,&Profile); | 5070 | error=Phone->SetProfile(&s,&Profile); |
5071 | Print_Error(error); | 5071 | Print_Error(error); |
5072 | if (gshutdown) { | 5072 | if (gshutdown) { |
5073 | GSM_Terminate(); | 5073 | GSM_Terminate(); |
5074 | exit(0); | 5074 | exit(0); |
5075 | } | 5075 | } |
5076 | } | 5076 | } |
5077 | printmsgerr("\n"); | 5077 | printmsgerr("\n"); |
5078 | } | 5078 | } |
5079 | DoRestore = false; | 5079 | DoRestore = false; |
5080 | if (Backup.FMStation[0] != NULL) { | 5080 | if (Backup.FMStation[0] != NULL) { |
5081 | FMStation.Location = 1; | 5081 | FMStation.Location = 1; |
5082 | error = Phone->GetFMStation(&s,&FMStation); | 5082 | error = Phone->GetFMStation(&s,&FMStation); |
5083 | if (error == ERR_NONE || error == ERR_EMPTY) { | 5083 | if (error == ERR_NONE || error == ERR_EMPTY) { |
5084 | if (answer_yes("Restore FM stations")) DoRestore = true; | 5084 | if (answer_yes("Restore FM stations")) DoRestore = true; |
5085 | } | 5085 | } |
5086 | } | 5086 | } |
5087 | if (DoRestore) { | 5087 | if (DoRestore) { |
5088 | printmsgerr("Deleting old FM stations: "); | 5088 | printmsgerr("Deleting old FM stations: "); |
5089 | error=Phone->ClearFMStations(&s); | 5089 | error=Phone->ClearFMStations(&s); |
5090 | Print_Error(error); | 5090 | Print_Error(error); |
5091 | printmsgerr("Done\n"); | 5091 | printmsgerr("Done\n"); |
5092 | max = 0; | 5092 | max = 0; |
5093 | while (Backup.FMStation[max]!=NULL) max++; | 5093 | while (Backup.FMStation[max]!=NULL) max++; |
5094 | for (i=0;i<max;i++) { | 5094 | for (i=0;i<max;i++) { |
5095 | FMStation = *Backup.FMStation[i]; | 5095 | FMStation = *Backup.FMStation[i]; |
5096 | error=Phone->SetFMStation(&s,&FMStation); | 5096 | error=Phone->SetFMStation(&s,&FMStation); |
5097 | Print_Error(error); | 5097 | Print_Error(error); |
5098 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 5098 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
5099 | if (gshutdown) { | 5099 | if (gshutdown) { |
5100 | GSM_Terminate(); | 5100 | GSM_Terminate(); |
5101 | exit(0); | 5101 | exit(0); |
5102 | } | 5102 | } |
5103 | } | 5103 | } |
5104 | printmsgerr("\n"); | 5104 | printmsgerr("\n"); |
5105 | } | 5105 | } |
5106 | DoRestore = false; | 5106 | DoRestore = false; |
5107 | if (Backup.GPRSPoint[0] != NULL) { | 5107 | if (Backup.GPRSPoint[0] != NULL) { |
5108 | GPRSPoint.Location = 1; | 5108 | GPRSPoint.Location = 1; |
5109 | error = Phone->GetGPRSAccessPoint(&s,&GPRSPoint); | 5109 | error = Phone->GetGPRSAccessPoint(&s,&GPRSPoint); |
5110 | if (error == ERR_NONE || error == ERR_EMPTY) { | 5110 | if (error == ERR_NONE || error == ERR_EMPTY) { |
5111 | if (answer_yes("Restore GPRS Points")) DoRestore = true; | 5111 | if (answer_yes("Restore GPRS Points")) DoRestore = true; |
5112 | } | 5112 | } |
5113 | } | 5113 | } |
5114 | if (DoRestore) { | 5114 | if (DoRestore) { |
5115 | max = 0; | 5115 | max = 0; |
5116 | while (Backup.GPRSPoint[max]!=NULL) max++; | 5116 | while (Backup.GPRSPoint[max]!=NULL) max++; |
5117 | for (i=0;i<max;i++) { | 5117 | for (i=0;i<max;i++) { |
5118 | error=Phone->SetGPRSAccessPoint(&s,Backup.GPRSPoint[i]); | 5118 | error=Phone->SetGPRSAccessPoint(&s,Backup.GPRSPoint[i]); |
5119 | Print_Error(error); | 5119 | Print_Error(error); |
5120 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 5120 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
5121 | if (gshutdown) { | 5121 | if (gshutdown) { |
5122 | GSM_Terminate(); | 5122 | GSM_Terminate(); |
5123 | exit(0); | 5123 | exit(0); |
5124 | } | 5124 | } |
5125 | } | 5125 | } |
5126 | printmsgerr("\n"); | 5126 | printmsgerr("\n"); |
5127 | } | 5127 | } |
5128 | 5128 | ||
5129 | GSM_Terminate(); | 5129 | GSM_Terminate(); |
5130 | } | 5130 | } |
5131 | 5131 | ||
5132 | static void AddNew(int argc, char *argv[]) | 5132 | static void AddNew(int argc, char *argv[]) |
5133 | { | 5133 | { |
5134 | GSM_Backup Backup; | 5134 | GSM_Backup Backup; |
5135 | GSM_DateTime date_time; | 5135 | GSM_DateTime date_time; |
5136 | GSM_MemoryEntry Pbk; | 5136 | GSM_MemoryEntry Pbk; |
5137 | GSM_MemoryStatusMemStatus; | 5137 | GSM_MemoryStatusMemStatus; |
5138 | GSM_ToDoEntry ToDo; | 5138 | GSM_ToDoEntry ToDo; |
5139 | GSM_ToDoStatus ToDoStatus; | 5139 | GSM_ToDoStatus ToDoStatus; |
5140 | GSM_CalendarEntryCalendar; | 5140 | GSM_CalendarEntryCalendar; |
5141 | GSM_WAPBookmark Bookmark; | 5141 | GSM_WAPBookmark Bookmark; |
5142 | int i, max, j; | 5142 | int i, max, j; |
5143 | 5143 | ||
5144 | error=GSM_ReadBackupFile(argv[2],&Backup); | 5144 | error=GSM_ReadBackupFile(argv[2],&Backup); |
5145 | if (error!=ERR_NOTIMPLEMENTED) Print_Error(error); | 5145 | if (error!=ERR_NOTIMPLEMENTED) Print_Error(error); |
5146 | 5146 | ||
5147 | signal(SIGINT, interrupt); | 5147 | signal(SIGINT, interrupt); |
5148 | printmsgerr("Press Ctrl+C to break...\n"); | 5148 | printmsgerr("Press Ctrl+C to break...\n"); |
5149 | 5149 | ||
5150 | if (Backup.DateTimeAvailable) printmsgerr("Time of backup : %s\n",OSDateTime(Backup.DateTime,false)); | 5150 | if (Backup.DateTimeAvailable) printmsgerr("Time of backup : %s\n",OSDateTime(Backup.DateTime,false)); |
5151 | if (Backup.Model[0]!=0) printmsgerr("Phone : %s\n",Backup.Model); | 5151 | if (Backup.Model[0]!=0) printmsgerr("Phone : %s\n",Backup.Model); |
5152 | if (Backup.IMEI[0]!=0) printmsgerr("IMEI : %s\n",Backup.IMEI); | 5152 | if (Backup.IMEI[0]!=0) printmsgerr("IMEI : %s\n",Backup.IMEI); |
5153 | 5153 | ||
5154 | GSM_Init(true); | 5154 | GSM_Init(true); |
5155 | 5155 | ||
5156 | if (Backup.PhonePhonebook[0] != NULL) { | 5156 | if (Backup.PhonePhonebook[0] != NULL) { |
5157 | MemStatus.MemoryType = MEM_ME; | 5157 | MemStatus.MemoryType = MEM_ME; |
5158 | error=Phone->GetMemoryStatus(&s, &MemStatus); | 5158 | error=Phone->GetMemoryStatus(&s, &MemStatus); |
5159 | if (error==ERR_NONE) { | 5159 | if (error==ERR_NONE) { |
5160 | max = 0; | 5160 | max = 0; |
5161 | while (Backup.PhonePhonebook[max]!=NULL) max++; | 5161 | while (Backup.PhonePhonebook[max]!=NULL) max++; |
5162 | printmsgerr("%i entries in backup file\n",max); | 5162 | printmsgerr("%i entries in backup file\n",max); |
5163 | if (MemStatus.MemoryFree < max) { | 5163 | if (MemStatus.MemoryFree < max) { |
5164 | printmsgerr("Memory has only %i free locations.Exiting\n",MemStatus.MemoryFree); | 5164 | printmsgerr("Memory has only %i free locations.Exiting\n",MemStatus.MemoryFree); |
5165 | } else if (answer_yes("Add phone phonebook entries")) { | 5165 | } else if (answer_yes("Add phone phonebook entries")) { |
5166 | for (i=0;i<max;i++) { | 5166 | for (i=0;i<max;i++) { |
5167 | Pbk = *Backup.PhonePhonebook[i]; | 5167 | Pbk = *Backup.PhonePhonebook[i]; |
5168 | Pbk.MemoryType = MEM_ME; | 5168 | Pbk.MemoryType = MEM_ME; |
5169 | error=Phone->AddMemory(&s, &Pbk); | 5169 | error=Phone->AddMemory(&s, &Pbk); |
5170 | Print_Error(error); | 5170 | Print_Error(error); |
5171 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 5171 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
5172 | if (gshutdown) { | 5172 | if (gshutdown) { |
5173 | GSM_Terminate(); | 5173 | GSM_Terminate(); |
5174 | exit(0); | 5174 | exit(0); |
5175 | } | 5175 | } |
5176 | } | 5176 | } |
5177 | printmsgerr("\n"); | 5177 | printmsgerr("\n"); |
5178 | } | 5178 | } |
5179 | } | 5179 | } |
5180 | } | 5180 | } |
5181 | if (Backup.SIMPhonebook[0] != NULL) { | 5181 | if (Backup.SIMPhonebook[0] != NULL) { |
5182 | MemStatus.MemoryType = MEM_SM; | 5182 | MemStatus.MemoryType = MEM_SM; |
5183 | error=Phone->GetMemoryStatus(&s, &MemStatus); | 5183 | error=Phone->GetMemoryStatus(&s, &MemStatus); |
5184 | if (error==ERR_NONE) { | 5184 | if (error==ERR_NONE) { |
5185 | max = 0; | 5185 | max = 0; |
5186 | while (Backup.SIMPhonebook[max]!=NULL) max++; | 5186 | while (Backup.SIMPhonebook[max]!=NULL) max++; |
5187 | printmsgerr("%i entries in backup file\n",max); | 5187 | printmsgerr("%i entries in backup file\n",max); |
5188 | if (MemStatus.MemoryFree < max) { | 5188 | if (MemStatus.MemoryFree < max) { |
5189 | printmsgerr("Memory has only %i free locations.Exiting\n",MemStatus.MemoryFree); | 5189 | printmsgerr("Memory has only %i free locations.Exiting\n",MemStatus.MemoryFree); |
5190 | } else if (answer_yes("Add SIM phonebook entries")) { | 5190 | } else if (answer_yes("Add SIM phonebook entries")) { |
5191 | j = 1; | 5191 | j = 1; |
5192 | for (i=0;i<max;i++) { | 5192 | for (i=0;i<max;i++) { |
5193 | Pbk = *Backup.SIMPhonebook[i]; | 5193 | Pbk = *Backup.SIMPhonebook[i]; |
5194 | Pbk.MemoryType = MEM_SM; | 5194 | Pbk.MemoryType = MEM_SM; |
5195 | error=Phone->AddMemory(&s, &Pbk); | 5195 | error=Phone->AddMemory(&s, &Pbk); |
5196 | Print_Error(error); | 5196 | Print_Error(error); |
5197 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 5197 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
5198 | if (gshutdown) { | 5198 | if (gshutdown) { |
5199 | GSM_Terminate(); | 5199 | GSM_Terminate(); |
5200 | exit(0); | 5200 | exit(0); |
5201 | } | 5201 | } |
5202 | } | 5202 | } |
5203 | printmsgerr("\n"); | 5203 | printmsgerr("\n"); |
5204 | } | 5204 | } |
5205 | } | 5205 | } |
5206 | } | 5206 | } |
5207 | 5207 | ||
5208 | if (!mystrncasecmp(s.CurrentConfig->SyncTime,"yes",0)) { | 5208 | if (!mystrncasecmp(s.CurrentConfig->SyncTime,"yes",0)) { |
5209 | if (answer_yes("Do you want to set date/time in phone (NOTE: in some phones it's required to correctly restore calendar notes and other items)")) { | 5209 | if (true /*LRanswer_yes("Do you want to set date/time in phone (NOTE: in some phones it's required to correctly restore calendar notes and other items)")*/) { |
5210 | GSM_GetCurrentDateTime(&date_time); | 5210 | GSM_GetCurrentDateTime(&date_time); |
5211 | 5211 | ||
5212 | error=Phone->SetDateTime(&s, &date_time); | 5212 | error=Phone->SetDateTime(&s, &date_time); |
5213 | Print_Error(error); | 5213 | Print_Error(error); |
5214 | } | 5214 | } |
5215 | } | 5215 | } |
5216 | if (Backup.Calendar[0] != NULL) { | 5216 | if (Backup.Calendar[0] != NULL) { |
5217 | error = Phone->GetNextCalendar(&s,&Calendar,true); | 5217 | error = Phone->GetNextCalendar(&s,&Calendar,true); |
5218 | if (error == ERR_NONE || error == ERR_INVALIDLOCATION || error == ERR_EMPTY) { | 5218 | if (error == ERR_NONE || error == ERR_INVALIDLOCATION || error == ERR_EMPTY) { |
5219 | if (answer_yes("Add calendar notes")) { | 5219 | if (answer_yes("Add calendar notes")) { |
5220 | max = 0; | 5220 | max = 0; |
5221 | while (Backup.Calendar[max]!=NULL) max++; | 5221 | while (Backup.Calendar[max]!=NULL) max++; |
5222 | for (i=0;i<max;i++) { | 5222 | for (i=0;i<max;i++) { |
5223 | Calendar = *Backup.Calendar[i]; | 5223 | Calendar = *Backup.Calendar[i]; |
5224 | error=Phone->AddCalendar(&s,&Calendar); | 5224 | error=Phone->AddCalendar(&s,&Calendar); |
5225 | Print_Error(error); | 5225 | Print_Error(error); |
5226 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 5226 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
5227 | if (gshutdown) { | 5227 | if (gshutdown) { |
5228 | GSM_Terminate(); | 5228 | GSM_Terminate(); |
5229 | exit(0); | 5229 | exit(0); |
5230 | } | 5230 | } |
5231 | } | 5231 | } |
5232 | printmsgerr("\n"); | 5232 | printmsgerr("\n"); |
5233 | } | 5233 | } |
5234 | } | 5234 | } |
5235 | } | 5235 | } |
5236 | if (Backup.ToDo[0] != NULL) { | 5236 | if (Backup.ToDo[0] != NULL) { |
5237 | ToDo.Location = 1; | 5237 | ToDo.Location = 1; |
5238 | error=Phone->GetToDoStatus(&s,&ToDoStatus); | 5238 | error=Phone->GetToDoStatus(&s,&ToDoStatus); |
5239 | if (error == ERR_NONE) { | 5239 | if (error == ERR_NONE) { |
5240 | if (answer_yes("Add ToDo")) { | 5240 | if (answer_yes("Add ToDo")) { |
5241 | max = 0; | 5241 | max = 0; |
5242 | while (Backup.ToDo[max]!=NULL) max++; | 5242 | while (Backup.ToDo[max]!=NULL) max++; |
5243 | for (i=0;i<max;i++) { | 5243 | for (i=0;i<max;i++) { |
5244 | ToDo = *Backup.ToDo[i]; | 5244 | ToDo = *Backup.ToDo[i]; |
5245 | error = Phone->AddToDo(&s,&ToDo); | 5245 | error = Phone->AddToDo(&s,&ToDo); |
5246 | Print_Error(error); | 5246 | Print_Error(error); |
5247 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 5247 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
5248 | if (gshutdown) { | 5248 | if (gshutdown) { |
5249 | GSM_Terminate(); | 5249 | GSM_Terminate(); |
5250 | exit(0); | 5250 | exit(0); |
5251 | } | 5251 | } |
5252 | } | 5252 | } |
5253 | printmsgerr("\n"); | 5253 | printmsgerr("\n"); |
5254 | } | 5254 | } |
5255 | } | 5255 | } |
5256 | } | 5256 | } |
5257 | if (Backup.WAPBookmark[0] != NULL) { | 5257 | if (Backup.WAPBookmark[0] != NULL) { |
5258 | Bookmark.Location = 1; | 5258 | Bookmark.Location = 1; |
5259 | error = Phone->GetWAPBookmark(&s,&Bookmark); | 5259 | error = Phone->GetWAPBookmark(&s,&Bookmark); |
5260 | if (error == ERR_NONE || error == ERR_INVALIDLOCATION) { | 5260 | if (error == ERR_NONE || error == ERR_INVALIDLOCATION) { |
5261 | if (answer_yes("Add WAP bookmarks")) { | 5261 | if (answer_yes("Add WAP bookmarks")) { |
5262 | max = 0; | 5262 | max = 0; |
5263 | while (Backup.WAPBookmark[max]!=NULL) max++; | 5263 | while (Backup.WAPBookmark[max]!=NULL) max++; |
5264 | for (i=0;i<max;i++) { | 5264 | for (i=0;i<max;i++) { |
5265 | Bookmark = *Backup.WAPBookmark[i]; | 5265 | Bookmark = *Backup.WAPBookmark[i]; |
5266 | Bookmark.Location = 0; | 5266 | Bookmark.Location = 0; |
5267 | error=Phone->SetWAPBookmark(&s,&Bookmark); | 5267 | error=Phone->SetWAPBookmark(&s,&Bookmark); |
5268 | Print_Error(error); | 5268 | Print_Error(error); |
5269 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 5269 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
5270 | if (gshutdown) { | 5270 | if (gshutdown) { |
5271 | GSM_Terminate(); | 5271 | GSM_Terminate(); |
5272 | exit(0); | 5272 | exit(0); |
5273 | } | 5273 | } |
5274 | } | 5274 | } |
5275 | printmsgerr("\n"); | 5275 | printmsgerr("\n"); |
5276 | } | 5276 | } |
5277 | } | 5277 | } |
5278 | } | 5278 | } |
5279 | 5279 | ||
5280 | GSM_Terminate(); | 5280 | GSM_Terminate(); |
5281 | } | 5281 | } |
5282 | #endif | 5282 | #endif |
5283 | 5283 | ||
5284 | static void ClearAll(int argc, char *argv[]) | 5284 | static void ClearAll(int argc, char *argv[]) |
5285 | { | 5285 | { |
5286 | GSM_MemoryStatusMemStatus; | 5286 | GSM_MemoryStatusMemStatus; |
5287 | GSM_ToDoStatus ToDoStatus; | 5287 | GSM_ToDoStatus ToDoStatus; |
5288 | GSM_CalendarEntryCalendar; | 5288 | GSM_CalendarEntryCalendar; |
5289 | GSM_ToDoEntry ToDo; | 5289 | GSM_ToDoEntry ToDo; |
5290 | GSM_WAPBookmark Bookmark; | 5290 | GSM_WAPBookmark Bookmark; |
5291 | GSM_FMStation Station; | 5291 | GSM_FMStation Station; |
5292 | GSM_MemoryEntry Pbk; | 5292 | GSM_MemoryEntry Pbk; |
5293 | bool DoClear; | 5293 | bool DoClear; |
5294 | 5294 | ||
5295 | GSM_Init(true); | 5295 | GSM_Init(true); |
5296 | 5296 | ||
5297 | DoClear = false; | 5297 | DoClear = false; |
5298 | MemStatus.MemoryType = MEM_ME; | 5298 | MemStatus.MemoryType = MEM_ME; |
5299 | error=Phone->GetMemoryStatus(&s, &MemStatus); | 5299 | error=Phone->GetMemoryStatus(&s, &MemStatus); |
5300 | if (error==ERR_NONE && MemStatus.MemoryUsed !=0) { | 5300 | if (error==ERR_NONE && MemStatus.MemoryUsed !=0) { |
5301 | if (answer_yes("Delete phone phonebook")) DoClear = true; | 5301 | if (answer_yes("Delete phone phonebook")) DoClear = true; |
5302 | } | 5302 | } |
5303 | if (DoClear) { | 5303 | if (DoClear) { |
5304 | error = Phone->DeleteAllMemory(&s,MEM_ME); | 5304 | error = Phone->DeleteAllMemory(&s,MEM_ME); |
5305 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { | 5305 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { |
5306 | for (i=0;i<MemStatus.MemoryUsed+MemStatus.MemoryFree;i++) { | 5306 | for (i=0;i<MemStatus.MemoryUsed+MemStatus.MemoryFree;i++) { |
5307 | Pbk.MemoryType = MEM_ME; | 5307 | Pbk.MemoryType = MEM_ME; |
5308 | Pbk.Location= i + 1; | 5308 | Pbk.Location= i + 1; |
5309 | Pbk.EntriesNum= 0; | 5309 | Pbk.EntriesNum= 0; |
5310 | error=Phone->DeleteMemory(&s, &Pbk); | 5310 | error=Phone->DeleteMemory(&s, &Pbk); |
5311 | Print_Error(error); | 5311 | Print_Error(error); |
5312 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/(MemStatus.MemoryUsed+MemStatus.MemoryFree)); | 5312 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/(MemStatus.MemoryUsed+MemStatus.MemoryFree)); |
5313 | if (gshutdown) { | 5313 | if (gshutdown) { |
5314 | GSM_Terminate(); | 5314 | GSM_Terminate(); |
5315 | exit(0); | 5315 | exit(0); |
5316 | } | 5316 | } |
5317 | } | 5317 | } |
5318 | printmsgerr("\n"); | 5318 | printmsgerr("\n"); |
5319 | } else { | 5319 | } else { |
5320 | printmsgerr("Done\n"); | 5320 | printmsgerr("Done\n"); |
5321 | Print_Error(error); | 5321 | Print_Error(error); |
5322 | } | 5322 | } |
5323 | } | 5323 | } |
5324 | 5324 | ||
5325 | DoClear = false; | 5325 | DoClear = false; |
5326 | MemStatus.MemoryType = MEM_SM; | 5326 | MemStatus.MemoryType = MEM_SM; |
5327 | error=Phone->GetMemoryStatus(&s, &MemStatus); | 5327 | error=Phone->GetMemoryStatus(&s, &MemStatus); |
5328 | if (error==ERR_NONE && MemStatus.MemoryUsed !=0) { | 5328 | if (error==ERR_NONE && MemStatus.MemoryUsed !=0) { |
5329 | if (answer_yes("Delete SIM phonebook")) DoClear = true; | 5329 | if (answer_yes("Delete SIM phonebook")) DoClear = true; |
5330 | } | 5330 | } |
5331 | if (DoClear) { | 5331 | if (DoClear) { |
5332 | error = Phone->DeleteAllMemory(&s,MEM_SM); | 5332 | error = Phone->DeleteAllMemory(&s,MEM_SM); |
5333 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { | 5333 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { |
5334 | for (i=0;i<MemStatus.MemoryUsed+MemStatus.MemoryFree;i++) { | 5334 | for (i=0;i<MemStatus.MemoryUsed+MemStatus.MemoryFree;i++) { |
5335 | Pbk.MemoryType = MEM_SM; | 5335 | Pbk.MemoryType = MEM_SM; |
5336 | Pbk.Location= i + 1; | 5336 | Pbk.Location= i + 1; |
5337 | Pbk.EntriesNum= 0; | 5337 | Pbk.EntriesNum= 0; |
5338 | error=Phone->DeleteMemory(&s, &Pbk); | 5338 | error=Phone->DeleteMemory(&s, &Pbk); |
5339 | Print_Error(error); | 5339 | Print_Error(error); |
5340 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/(MemStatus.MemoryUsed+MemStatus.MemoryFree)); | 5340 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/(MemStatus.MemoryUsed+MemStatus.MemoryFree)); |
5341 | if (gshutdown) { | 5341 | if (gshutdown) { |
5342 | GSM_Terminate(); | 5342 | GSM_Terminate(); |
5343 | exit(0); | 5343 | exit(0); |
5344 | } | 5344 | } |
5345 | } | 5345 | } |
5346 | printmsgerr("\n"); | 5346 | printmsgerr("\n"); |
5347 | } else { | 5347 | } else { |
5348 | printmsgerr("Done\n"); | 5348 | printmsgerr("Done\n"); |
5349 | Print_Error(error); | 5349 | Print_Error(error); |
5350 | } | 5350 | } |
5351 | } | 5351 | } |
5352 | 5352 | ||
5353 | DoClear = false; | 5353 | DoClear = false; |
5354 | error = Phone->GetNextCalendar(&s,&Calendar,true); | 5354 | error = Phone->GetNextCalendar(&s,&Calendar,true); |
5355 | if (error == ERR_NONE) { | 5355 | if (error == ERR_NONE) { |
5356 | if (answer_yes("Delete calendar notes")) DoClear = true; | 5356 | if (answer_yes("Delete calendar notes")) DoClear = true; |
5357 | } | 5357 | } |
5358 | if (DoClear) { | 5358 | if (DoClear) { |
5359 | printmsgerr("Deleting: "); | 5359 | printmsgerr("Deleting: "); |
5360 | error=Phone->DeleteAllCalendar(&s); | 5360 | error=Phone->DeleteAllCalendar(&s); |
5361 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { | 5361 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { |
5362 | while (1) { | 5362 | while (1) { |
5363 | error = Phone->GetNextCalendar(&s,&Calendar,true); | 5363 | error = Phone->GetNextCalendar(&s,&Calendar,true); |
5364 | if (error != ERR_NONE) break; | 5364 | if (error != ERR_NONE) break; |
5365 | error = Phone->DeleteCalendar(&s,&Calendar); | 5365 | error = Phone->DeleteCalendar(&s,&Calendar); |
5366 | Print_Error(error); | 5366 | Print_Error(error); |
5367 | printmsgerr("*"); | 5367 | printmsgerr("*"); |
5368 | } | 5368 | } |
5369 | printmsgerr("\n"); | 5369 | printmsgerr("\n"); |
5370 | } else { | 5370 | } else { |
5371 | printmsgerr("Done\n"); | 5371 | printmsgerr("Done\n"); |
5372 | Print_Error(error); | 5372 | Print_Error(error); |
5373 | } | 5373 | } |
5374 | } | 5374 | } |
5375 | 5375 | ||
5376 | DoClear = false; | 5376 | DoClear = false; |
5377 | error = Phone->GetToDoStatus(&s,&ToDoStatus); | 5377 | error = Phone->GetToDoStatus(&s,&ToDoStatus); |
5378 | if (error == ERR_NONE && ToDoStatus.Used != 0) { | 5378 | if (error == ERR_NONE && ToDoStatus.Used != 0) { |
5379 | if (answer_yes("Delete ToDo")) DoClear = true; | 5379 | if (answer_yes("Delete ToDo")) DoClear = true; |
5380 | } | 5380 | } |
5381 | if (DoClear) { | 5381 | if (DoClear) { |
5382 | printmsgerr("Deleting: "); | 5382 | printmsgerr("Deleting: "); |
5383 | error=Phone->DeleteAllToDo(&s); | 5383 | error=Phone->DeleteAllToDo(&s); |
5384 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { | 5384 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { |
5385 | while (1) { | 5385 | while (1) { |
5386 | error = Phone->GetNextToDo(&s,&ToDo,true); | 5386 | error = Phone->GetNextToDo(&s,&ToDo,true); |
5387 | if (error != ERR_NONE) break; | 5387 | if (error != ERR_NONE) break; |
5388 | error = Phone->DeleteToDo(&s,&ToDo); | 5388 | error = Phone->DeleteToDo(&s,&ToDo); |
5389 | Print_Error(error); | 5389 | Print_Error(error); |
5390 | printmsgerr("*"); | 5390 | printmsgerr("*"); |
5391 | } | 5391 | } |
5392 | printmsgerr("\n"); | 5392 | printmsgerr("\n"); |
5393 | } else { | 5393 | } else { |
5394 | printmsgerr("Done\n"); | 5394 | printmsgerr("Done\n"); |
5395 | Print_Error(error); | 5395 | Print_Error(error); |
5396 | } | 5396 | } |
5397 | } | 5397 | } |
5398 | 5398 | ||
5399 | Bookmark.Location = 1; | 5399 | Bookmark.Location = 1; |
5400 | error = Phone->GetWAPBookmark(&s,&Bookmark); | 5400 | error = Phone->GetWAPBookmark(&s,&Bookmark); |
5401 | if (error == ERR_NONE || error == ERR_INVALIDLOCATION) { | 5401 | if (error == ERR_NONE || error == ERR_INVALIDLOCATION) { |
5402 | if (answer_yes("Delete WAP bookmarks")) { | 5402 | if (answer_yes("Delete WAP bookmarks")) { |
5403 | printmsgerr("Deleting: "); | 5403 | printmsgerr("Deleting: "); |
5404 | /* One thing to explain: DCT4 phones seems to have bug here. | 5404 | /* One thing to explain: DCT4 phones seems to have bug here. |
5405 | * When delete for example first bookmark, phone change | 5405 | * When delete for example first bookmark, phone change |
5406 | * numeration for getting frame, not for deleting. So, we try to | 5406 | * numeration for getting frame, not for deleting. So, we try to |
5407 | * get 1'st bookmark. Inside frame is "correct" location. We use | 5407 | * get 1'st bookmark. Inside frame is "correct" location. We use |
5408 | * it later | 5408 | * it later |
5409 | */ | 5409 | */ |
5410 | while (error==ERR_NONE) { | 5410 | while (error==ERR_NONE) { |
5411 | error = Phone->DeleteWAPBookmark(&s,&Bookmark); | 5411 | error = Phone->DeleteWAPBookmark(&s,&Bookmark); |
5412 | Bookmark.Location = 1; | 5412 | Bookmark.Location = 1; |
5413 | error = Phone->GetWAPBookmark(&s,&Bookmark); | 5413 | error = Phone->GetWAPBookmark(&s,&Bookmark); |
5414 | printmsgerr("*"); | 5414 | printmsgerr("*"); |
5415 | } | 5415 | } |
5416 | printmsgerr("\n"); | 5416 | printmsgerr("\n"); |
5417 | } | 5417 | } |
5418 | } | 5418 | } |
5419 | if (Phone->DeleteUserRingtones != NOTSUPPORTED) { | 5419 | if (Phone->DeleteUserRingtones != NOTSUPPORTED) { |
5420 | if (answer_yes("Delete all user ringtones")) { | 5420 | if (answer_yes("Delete all user ringtones")) { |
5421 | printmsgerr("Deleting: "); | 5421 | printmsgerr("Deleting: "); |
5422 | error=Phone->DeleteUserRingtones(&s); | 5422 | error=Phone->DeleteUserRingtones(&s); |
5423 | Print_Error(error); | 5423 | Print_Error(error); |
5424 | printmsgerr("Done\n"); | 5424 | printmsgerr("Done\n"); |
5425 | } | 5425 | } |
5426 | } | 5426 | } |
5427 | Station.Location=i; | 5427 | Station.Location=i; |
5428 | error=Phone->GetFMStation(&s,&Station); | 5428 | error=Phone->GetFMStation(&s,&Station); |
5429 | if (error == ERR_NONE || error == ERR_EMPTY) { | 5429 | if (error == ERR_NONE || error == ERR_EMPTY) { |
5430 | if (answer_yes("Delete all FM station")) { | 5430 | if (answer_yes("Delete all FM station")) { |
5431 | error=Phone->ClearFMStations(&s); | 5431 | error=Phone->ClearFMStations(&s); |
5432 | Print_Error(error); | 5432 | Print_Error(error); |
5433 | } | 5433 | } |
5434 | } | 5434 | } |
5435 | 5435 | ||
5436 | GSM_Terminate(); | 5436 | GSM_Terminate(); |
5437 | } | 5437 | } |
5438 | 5438 | ||
5439 | static void DisplayConnectionSettings(GSM_MultiWAPSettings *settings,int j) | 5439 | static void DisplayConnectionSettings(GSM_MultiWAPSettings *settings,int j) |
5440 | { | 5440 | { |
5441 | if (settings->Settings[j].IsContinuous) { | 5441 | if (settings->Settings[j].IsContinuous) { |
5442 | printmsg("Connection type : Continuous\n"); | 5442 | printmsg("Connection type : Continuous\n"); |
5443 | } else { | 5443 | } else { |
5444 | printmsg("Connection type : Temporary\n"); | 5444 | printmsg("Connection type : Temporary\n"); |
5445 | } | 5445 | } |
5446 | if (settings->Settings[j].IsSecurity) { | 5446 | if (settings->Settings[j].IsSecurity) { |
5447 | printmsg("Connection security : On\n"); | 5447 | printmsg("Connection security : On\n"); |
5448 | } else { | 5448 | } else { |
5449 | printmsg("Connection security : Off\n"); | 5449 | printmsg("Connection security : Off\n"); |
5450 | } | 5450 | } |
5451 | printmsg("Proxy : address \"%s\", port %i\n",DecodeUnicodeConsole(settings->Proxy),settings->ProxyPort); | 5451 | printmsg("Proxy : address \"%s\", port %i\n",DecodeUnicodeConsole(settings->Proxy),settings->ProxyPort); |
5452 | printmsg("2'nd proxy : address \"%s\", port %i\n",DecodeUnicodeConsole(settings->Proxy2),settings->Proxy2Port); | 5452 | printmsg("2'nd proxy : address \"%s\", port %i\n",DecodeUnicodeConsole(settings->Proxy2),settings->Proxy2Port); |
5453 | switch (settings->Settings[j].Bearer) { | 5453 | switch (settings->Settings[j].Bearer) { |
5454 | case WAPSETTINGS_BEARER_SMS: | 5454 | case WAPSETTINGS_BEARER_SMS: |
5455 | printmsg("Bearer : SMS"); | 5455 | printmsg("Bearer : SMS"); |
5456 | if (settings->ActiveBearer == WAPSETTINGS_BEARER_SMS) printf(" (active)"); | 5456 | if (settings->ActiveBearer == WAPSETTINGS_BEARER_SMS) printf(" (active)"); |
5457 | printmsg("\nServer number : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].Server)); | 5457 | printmsg("\nServer number : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].Server)); |
5458 | printmsg("Service number : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].Service)); | 5458 | printmsg("Service number : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].Service)); |
5459 | break; | 5459 | break; |
5460 | case WAPSETTINGS_BEARER_DATA: | 5460 | case WAPSETTINGS_BEARER_DATA: |
5461 | printmsg("Bearer : Data (CSD)"); | 5461 | printmsg("Bearer : Data (CSD)"); |
5462 | if (settings->ActiveBearer == WAPSETTINGS_BEARER_DATA) printf(" (active)"); | 5462 | if (settings->ActiveBearer == WAPSETTINGS_BEARER_DATA) printf(" (active)"); |
5463 | printmsg("\nDial-up number : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].DialUp)); | 5463 | printmsg("\nDial-up number : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].DialUp)); |
5464 | printmsg("IP address : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].IPAddress)); | 5464 | printmsg("IP address : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].IPAddress)); |
5465 | if (settings->Settings[j].ManualLogin) { | 5465 | if (settings->Settings[j].ManualLogin) { |
5466 | printmsg("Login Type : Manual\n"); | 5466 | printmsg("Login Type : Manual\n"); |
5467 | } else { | 5467 | } else { |
5468 | printmsg("Login Type : Automatic\n"); | 5468 | printmsg("Login Type : Automatic\n"); |
5469 | } | 5469 | } |
5470 | if (settings->Settings[j].IsNormalAuthentication) { | 5470 | if (settings->Settings[j].IsNormalAuthentication) { |
5471 | printmsg("Authentication type : Normal\n"); | 5471 | printmsg("Authentication type : Normal\n"); |
5472 | } else { | 5472 | } else { |
5473 | printmsg("Authentication type : Secure\n"); | 5473 | printmsg("Authentication type : Secure\n"); |
5474 | } | 5474 | } |
5475 | if (settings->Settings[j].IsISDNCall) { | 5475 | if (settings->Settings[j].IsISDNCall) { |
5476 | printmsg("Data call type : ISDN\n"); | 5476 | printmsg("Data call type : ISDN\n"); |
5477 | } else { | 5477 | } else { |
5478 | printmsg("Data call type : Analogue\n"); | 5478 | printmsg("Data call type : Analogue\n"); |
5479 | } | 5479 | } |
5480 | switch (settings->Settings[j].Speed) { | 5480 | switch (settings->Settings[j].Speed) { |
5481 | case WAPSETTINGS_SPEED_9600 : printmsg("Data call speed : 9600\n"); break; | 5481 | case WAPSETTINGS_SPEED_9600 : printmsg("Data call speed : 9600\n"); break; |
5482 | case WAPSETTINGS_SPEED_14400 : printmsg("Data call speed : 14400\n"); break; | 5482 | case WAPSETTINGS_SPEED_14400 : printmsg("Data call speed : 14400\n"); break; |
5483 | case WAPSETTINGS_SPEED_AUTO : printmsg("Data call speed : Auto\n"); break; | 5483 | case WAPSETTINGS_SPEED_AUTO : printmsg("Data call speed : Auto\n"); break; |
5484 | } | 5484 | } |
5485 | printmsg("User name : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].User)); | 5485 | printmsg("User name : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].User)); |
5486 | printmsg("Password : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].Password)); | 5486 | printmsg("Password : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].Password)); |
5487 | break; | 5487 | break; |
5488 | case WAPSETTINGS_BEARER_USSD: | 5488 | case WAPSETTINGS_BEARER_USSD: |
5489 | printmsg("Bearer : USSD"); | 5489 | printmsg("Bearer : USSD"); |
5490 | if (settings->ActiveBearer == WAPSETTINGS_BEARER_USSD) printf(" (active)"); | 5490 | if (settings->ActiveBearer == WAPSETTINGS_BEARER_USSD) printf(" (active)"); |
5491 | printmsg("\nService code : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].Code)); | 5491 | printmsg("\nService code : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].Code)); |
5492 | if (settings->Settings[j].IsIP) { | 5492 | if (settings->Settings[j].IsIP) { |
5493 | printmsg("Address type : IP address\nIPaddress : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].Service)); | 5493 | printmsg("Address type : IP address\nIPaddress : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].Service)); |
5494 | } else { | 5494 | } else { |
5495 | printmsg("Address type : Service number\nService number : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].Service)); | 5495 | printmsg("Address type : Service number\nService number : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].Service)); |
5496 | } | 5496 | } |
5497 | break; | 5497 | break; |
5498 | case WAPSETTINGS_BEARER_GPRS: | 5498 | case WAPSETTINGS_BEARER_GPRS: |
5499 | printmsg("Bearer : GPRS"); | 5499 | printmsg("Bearer : GPRS"); |
5500 | if (settings->ActiveBearer == WAPSETTINGS_BEARER_GPRS) printf(" (active)"); | 5500 | if (settings->ActiveBearer == WAPSETTINGS_BEARER_GPRS) printf(" (active)"); |
5501 | if (settings->Settings[j].ManualLogin) { | 5501 | if (settings->Settings[j].ManualLogin) { |
5502 | printmsg("\nLogin Type : Manual\n"); | 5502 | printmsg("\nLogin Type : Manual\n"); |
5503 | } else { | 5503 | } else { |
5504 | printmsg("\nLogin Type : Automatic\n"); | 5504 | printmsg("\nLogin Type : Automatic\n"); |
5505 | } | 5505 | } |
5506 | if (settings->Settings[j].IsNormalAuthentication) { | 5506 | if (settings->Settings[j].IsNormalAuthentication) { |
5507 | printmsg("Authentication type : Normal\n"); | 5507 | printmsg("Authentication type : Normal\n"); |
5508 | } else { | 5508 | } else { |
5509 | printmsg("Authentication type : Secure\n"); | 5509 | printmsg("Authentication type : Secure\n"); |
5510 | } | 5510 | } |
5511 | printmsg("Access point : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].DialUp)); | 5511 | printmsg("Access point : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].DialUp)); |
5512 | printmsg("IP address : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].IPAddress)); | 5512 | printmsg("IP address : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].IPAddress)); |
5513 | printmsg("User name : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].User)); | 5513 | printmsg("User name : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].User)); |
5514 | printmsg("Password : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].Password)); | 5514 | printmsg("Password : \"%s\"\n",DecodeUnicodeConsole(settings->Settings[j].Password)); |
5515 | } | 5515 | } |
5516 | } | 5516 | } |
5517 | 5517 | ||
5518 | static void GetSyncMLSettings(int argc, char *argv[]) | 5518 | static void GetSyncMLSettings(int argc, char *argv[]) |
5519 | { | 5519 | { |
5520 | GSM_SyncMLSettingssettings; | 5520 | GSM_SyncMLSettingssettings; |
5521 | int start,stop,j; | 5521 | int start,stop,j; |
5522 | 5522 | ||
5523 | GetStartStop(&start, &stop, 2, argc, argv); | 5523 | GetStartStop(&start, &stop, 2, argc, argv); |
5524 | 5524 | ||
5525 | GSM_Init(true); | 5525 | GSM_Init(true); |
5526 | 5526 | ||
5527 | for (i=start;i<=stop;i++) { | 5527 | for (i=start;i<=stop;i++) { |
5528 | settings.Location=i; | 5528 | settings.Location=i; |
5529 | error=Phone->GetSyncMLSettings(&s,&settings); | 5529 | error=Phone->GetSyncMLSettings(&s,&settings); |
5530 | Print_Error(error); | 5530 | Print_Error(error); |
5531 | printmsg("%i. ",i); | 5531 | printmsg("%i. ",i); |
5532 | if (settings.Name[0]==0 && settings.Name[1]==0) { | 5532 | if (settings.Name[0]==0 && settings.Name[1]==0) { |
5533 | printmsg("Set %i",i); | 5533 | printmsg("Set %i",i); |
5534 | } else { | 5534 | } else { |
5535 | printmsg("%s",DecodeUnicodeConsole(settings.Name)); | 5535 | printmsg("%s",DecodeUnicodeConsole(settings.Name)); |
5536 | } | 5536 | } |
5537 | if (settings.Active) printmsg(" (active)"); | 5537 | if (settings.Active) printmsg(" (active)"); |
5538 | // if (settings.ReadOnly) printmsg("\nRead only : yes"); | 5538 | // if (settings.ReadOnly) printmsg("\nRead only : yes"); |
5539 | printmsg("\n"); | 5539 | printmsg("\n"); |
5540 | printmsg("User : \"%s\"\n",DecodeUnicodeConsole(settings.User)); | 5540 | printmsg("User : \"%s\"\n",DecodeUnicodeConsole(settings.User)); |
5541 | printmsg("Password : \"%s\"\n",DecodeUnicodeConsole(settings.Password)); | 5541 | printmsg("Password : \"%s\"\n",DecodeUnicodeConsole(settings.Password)); |
5542 | printmsg("Phonebook database : \"%s\"\n",DecodeUnicodeConsole(settings.PhonebookDataBase)); | 5542 | printmsg("Phonebook database : \"%s\"\n",DecodeUnicodeConsole(settings.PhonebookDataBase)); |
5543 | printmsg("Calendar database : \"%s\"\n",DecodeUnicodeConsole(settings.CalendarDataBase)); | 5543 | printmsg("Calendar database : \"%s\"\n",DecodeUnicodeConsole(settings.CalendarDataBase)); |
5544 | printmsg("Server : \"%s\"\n",DecodeUnicodeConsole(settings.Server)); | 5544 | printmsg("Server : \"%s\"\n",DecodeUnicodeConsole(settings.Server)); |
5545 | printmsg("Sync. phonebook : "); | 5545 | printmsg("Sync. phonebook : "); |
5546 | if (settings.SyncPhonebook) printmsg("yes\n"); | 5546 | if (settings.SyncPhonebook) printmsg("yes\n"); |
5547 | if (!settings.SyncPhonebook) printmsg("no\n"); | 5547 | if (!settings.SyncPhonebook) printmsg("no\n"); |
5548 | printmsg("Sync. calendar : "); | 5548 | printmsg("Sync. calendar : "); |
5549 | if (settings.SyncCalendar) printmsg("yes\n"); | 5549 | if (settings.SyncCalendar) printmsg("yes\n"); |
5550 | if (!settings.SyncCalendar) printmsg("no\n"); | 5550 | if (!settings.SyncCalendar) printmsg("no\n"); |
5551 | printmsg("\n"); | 5551 | printmsg("\n"); |
5552 | for (j=0;j<settings.Connection.Number;j++) { | 5552 | for (j=0;j<settings.Connection.Number;j++) { |
5553 | if (settings.Connection.Settings[j].Title[0]==0 && settings.Connection.Settings[j].Title[1]==0) { | 5553 | if (settings.Connection.Settings[j].Title[0]==0 && settings.Connection.Settings[j].Title[1]==0) { |
5554 | printmsg("Connection set name : Set %i\n",i); | 5554 | printmsg("Connection set name : Set %i\n",i); |
5555 | } else { | 5555 | } else { |
5556 | printmsg("Connection set name : %s\n",DecodeUnicodeConsole(settings.Connection.Settings[j].Title)); | 5556 | printmsg("Connection set name : %s\n",DecodeUnicodeConsole(settings.Connection.Settings[j].Title)); |
5557 | } | 5557 | } |
5558 | DisplayConnectionSettings(&settings.Connection,j); | 5558 | DisplayConnectionSettings(&settings.Connection,j); |
5559 | printf("\n"); | 5559 | printf("\n"); |
5560 | } | 5560 | } |
5561 | } | 5561 | } |
5562 | GSM_Terminate(); | 5562 | GSM_Terminate(); |
5563 | } | 5563 | } |
5564 | 5564 | ||
5565 | static void GetChatSettings(int argc, char *argv[]) | 5565 | static void GetChatSettings(int argc, char *argv[]) |
5566 | { | 5566 | { |
5567 | GSM_ChatSettingssettings; | 5567 | GSM_ChatSettingssettings; |
5568 | int start,stop,j; | 5568 | int start,stop,j; |
5569 | 5569 | ||
5570 | GetStartStop(&start, &stop, 2, argc, argv); | 5570 | GetStartStop(&start, &stop, 2, argc, argv); |
5571 | 5571 | ||
5572 | GSM_Init(true); | 5572 | GSM_Init(true); |
5573 | 5573 | ||
5574 | for (i=start;i<=stop;i++) { | 5574 | for (i=start;i<=stop;i++) { |
5575 | settings.Location=i; | 5575 | settings.Location=i; |
5576 | error=Phone->GetChatSettings(&s,&settings); | 5576 | error=Phone->GetChatSettings(&s,&settings); |
5577 | Print_Error(error); | 5577 | Print_Error(error); |
5578 | printmsg("%i. ",i); | 5578 | printmsg("%i. ",i); |
5579 | if (settings.Name[0]==0 && settings.Name[1]==0) { | 5579 | if (settings.Name[0]==0 && settings.Name[1]==0) { |
5580 | printmsg("Set %i",i); | 5580 | printmsg("Set %i",i); |
5581 | } else { | 5581 | } else { |
5582 | printmsg("%s",DecodeUnicodeConsole(settings.Name)); | 5582 | printmsg("%s",DecodeUnicodeConsole(settings.Name)); |
5583 | } | 5583 | } |
5584 | if (settings.Active) printmsg(" (active)"); | 5584 | if (settings.Active) printmsg(" (active)"); |
5585 | // if (settings.ReadOnly) printmsg("\nRead only : yes"); | 5585 | // if (settings.ReadOnly) printmsg("\nRead only : yes"); |
5586 | printmsg("\n"); | 5586 | printmsg("\n"); |
5587 | printmsg("Homepage : \"%s\"\n",DecodeUnicodeConsole(settings.HomePage)); | 5587 | printmsg("Homepage : \"%s\"\n",DecodeUnicodeConsole(settings.HomePage)); |
5588 | printmsg("User : \"%s\"\n",DecodeUnicodeConsole(settings.User)); | 5588 | printmsg("User : \"%s\"\n",DecodeUnicodeConsole(settings.User)); |
5589 | printmsg("Password : \"%s\"\n",DecodeUnicodeConsole(settings.Password)); | 5589 | printmsg("Password : \"%s\"\n",DecodeUnicodeConsole(settings.Password)); |
5590 | printmsg("\n"); | 5590 | printmsg("\n"); |
5591 | for (j=0;j<settings.Connection.Number;j++) { | 5591 | for (j=0;j<settings.Connection.Number;j++) { |
5592 | if (settings.Connection.Settings[j].Title[0]==0 && settings.Connection.Settings[j].Title[1]==0) { | 5592 | if (settings.Connection.Settings[j].Title[0]==0 && settings.Connection.Settings[j].Title[1]==0) { |
5593 | printmsg("Connection set name : Set %i\n",i); | 5593 | printmsg("Connection set name : Set %i\n",i); |
5594 | } else { | 5594 | } else { |
5595 | printmsg("Connection set name : %s\n",DecodeUnicodeConsole(settings.Connection.Settings[j].Title)); | 5595 | printmsg("Connection set name : %s\n",DecodeUnicodeConsole(settings.Connection.Settings[j].Title)); |
5596 | } | 5596 | } |
5597 | DisplayConnectionSettings(&settings.Connection,j); | 5597 | DisplayConnectionSettings(&settings.Connection,j); |
5598 | printf("\n"); | 5598 | printf("\n"); |
5599 | } | 5599 | } |
5600 | } | 5600 | } |
5601 | GSM_Terminate(); | 5601 | GSM_Terminate(); |
5602 | } | 5602 | } |
5603 | 5603 | ||
5604 | static void GetWAPMMSSettings(int argc, char *argv[]) | 5604 | static void GetWAPMMSSettings(int argc, char *argv[]) |
5605 | { | 5605 | { |
5606 | GSM_MultiWAPSettingssettings; | 5606 | GSM_MultiWAPSettingssettings; |
5607 | int start,stop,j; | 5607 | int start,stop,j; |
5608 | 5608 | ||
5609 | GetStartStop(&start, &stop, 2, argc, argv); | 5609 | GetStartStop(&start, &stop, 2, argc, argv); |
5610 | 5610 | ||
5611 | GSM_Init(true); | 5611 | GSM_Init(true); |
5612 | 5612 | ||
5613 | for (i=start;i<=stop;i++) { | 5613 | for (i=start;i<=stop;i++) { |
5614 | settings.Location=i; | 5614 | settings.Location=i; |
5615 | if (mystrncasecmp(argv[1],"--getwapsettings",0)) { | 5615 | if (mystrncasecmp(argv[1],"--getwapsettings",0)) { |
5616 | error=Phone->GetWAPSettings(&s,&settings); | 5616 | error=Phone->GetWAPSettings(&s,&settings); |
5617 | } else { | 5617 | } else { |
5618 | error=Phone->GetMMSSettings(&s,&settings); | 5618 | error=Phone->GetMMSSettings(&s,&settings); |
5619 | } | 5619 | } |
5620 | Print_Error(error); | 5620 | Print_Error(error); |
5621 | for (j=0;j<settings.Number;j++) { | 5621 | for (j=0;j<settings.Number;j++) { |
5622 | printmsg("%i. ",i); | 5622 | printmsg("%i. ",i); |
5623 | if (settings.Settings[j].Title[0]==0 && settings.Settings[j].Title[1]==0) { | 5623 | if (settings.Settings[j].Title[0]==0 && settings.Settings[j].Title[1]==0) { |
5624 | printmsg("Set %i",i); | 5624 | printmsg("Set %i",i); |
5625 | } else { | 5625 | } else { |
5626 | printmsg("%s",DecodeUnicodeConsole(settings.Settings[j].Title)); | 5626 | printmsg("%s",DecodeUnicodeConsole(settings.Settings[j].Title)); |
5627 | } | 5627 | } |
5628 | if (settings.Active) printmsg(" (active)"); | 5628 | if (settings.Active) printmsg(" (active)"); |
5629 | if (settings.ReadOnly) printmsg("\nRead only : yes"); | 5629 | if (settings.ReadOnly) printmsg("\nRead only : yes"); |
5630 | printmsg("\nHomepage : \"%s\"\n",DecodeUnicodeConsole(settings.Settings[j].HomePage)); | 5630 | printmsg("\nHomepage : \"%s\"\n",DecodeUnicodeConsole(settings.Settings[j].HomePage)); |
5631 | DisplayConnectionSettings(&settings,j); | 5631 | DisplayConnectionSettings(&settings,j); |
5632 | printf("\n"); | 5632 | printf("\n"); |
5633 | } | 5633 | } |
5634 | } | 5634 | } |
5635 | GSM_Terminate(); | 5635 | GSM_Terminate(); |
5636 | } | 5636 | } |
5637 | 5637 | ||
5638 | #ifdef GSM_ENABLE_BACKUP | 5638 | #ifdef GSM_ENABLE_BACKUP |
5639 | static void BackupSMS(int argc, char *argv[]) | 5639 | static void BackupSMS(int argc, char *argv[]) |
5640 | { | 5640 | { |
5641 | GSM_SMS_Backup Backup; | 5641 | GSM_SMS_Backup Backup; |
5642 | GSM_MultiSMSMessage sms; | 5642 | GSM_MultiSMSMessage sms; |
5643 | GSM_SMSFolders folders; | 5643 | GSM_SMSFolders folders; |
5644 | bool BackupFromFolder[GSM_MAX_SMS_FOLDERS]; | 5644 | bool BackupFromFolder[GSM_MAX_SMS_FOLDERS]; |
5645 | bool start = true; | 5645 | bool start = true; |
5646 | bool DeleteAfter; | 5646 | bool DeleteAfter; |
5647 | int j, smsnum; | 5647 | int j, smsnum; |
5648 | char buffer[200]; | 5648 | char buffer[200]; |
5649 | 5649 | ||
5650 | /* We ignore return code, because (when file doesn't exist) we | 5650 | /* We ignore return code, because (when file doesn't exist) we |
5651 | * will create new later | 5651 | * will create new later |
5652 | */ | 5652 | */ |
5653 | GSM_ReadSMSBackupFile(argv[2], &Backup); | 5653 | GSM_ReadSMSBackupFile(argv[2], &Backup); |
5654 | smsnum = 0; | 5654 | smsnum = 0; |
5655 | while (Backup.SMS[smsnum]!=NULL) smsnum++; | 5655 | while (Backup.SMS[smsnum]!=NULL) smsnum++; |
5656 | 5656 | ||
5657 | GSM_Init(true); | 5657 | GSM_Init(true); |
5658 | 5658 | ||
5659 | error=Phone->GetSMSFolders(&s, &folders); | 5659 | error=Phone->GetSMSFolders(&s, &folders); |
5660 | Print_Error(error); | 5660 | Print_Error(error); |
5661 | 5661 | ||
5662 | DeleteAfter=answer_yes("Delete each sms after backup"); | 5662 | DeleteAfter=answer_yes("Delete each sms after backup"); |
5663 | 5663 | ||
5664 | for (j=0;j<folders.Number;j++) { | 5664 | for (j=0;j<folders.Number;j++) { |
5665 | BackupFromFolder[j] = false; | 5665 | BackupFromFolder[j] = false; |
5666 | sprintf(buffer,"Backup sms from folder \"%s\"",DecodeUnicodeConsole(folders.Folder[j].Name)); | 5666 | sprintf(buffer,"Backup sms from folder \"%s\"",DecodeUnicodeConsole(folders.Folder[j].Name)); |
5667 | if (answer_yes(buffer)) BackupFromFolder[j] = true; | 5667 | if (answer_yes(buffer)) BackupFromFolder[j] = true; |
5668 | } | 5668 | } |
5669 | 5669 | ||
5670 | while (error == ERR_NONE) { | 5670 | while (error == ERR_NONE) { |
5671 | sms.SMS[0].Folder=0x00; | 5671 | sms.SMS[0].Folder=0x00; |
5672 | error=Phone->GetNextSMS(&s, &sms, start); | 5672 | error=Phone->GetNextSMS(&s, &sms, start); |
5673 | switch (error) { | 5673 | switch (error) { |
5674 | case ERR_EMPTY: | 5674 | case ERR_EMPTY: |
5675 | break; | 5675 | break; |
5676 | default: | 5676 | default: |
5677 | Print_Error(error); | 5677 | Print_Error(error); |
5678 | for (j=0;j<sms.Number;j++) { | 5678 | for (j=0;j<sms.Number;j++) { |
5679 | if (BackupFromFolder[sms.SMS[j].Folder-1]) { | 5679 | if (BackupFromFolder[sms.SMS[j].Folder-1]) { |
5680 | switch (sms.SMS[j].PDU) { | 5680 | switch (sms.SMS[j].PDU) { |
5681 | case SMS_Status_Report: | 5681 | case SMS_Status_Report: |
5682 | break; | 5682 | break; |
5683 | case SMS_Submit: | 5683 | case SMS_Submit: |
5684 | case SMS_Deliver: | 5684 | case SMS_Deliver: |
5685 | if (sms.SMS[j].Length == 0) break; | 5685 | if (sms.SMS[j].Length == 0) break; |
5686 | if (smsnum < GSM_BACKUP_MAX_SMS) { | 5686 | if (smsnum < GSM_BACKUP_MAX_SMS) { |
5687 | Backup.SMS[smsnum] = malloc(sizeof(GSM_SMSMessage)); | 5687 | Backup.SMS[smsnum] = malloc(sizeof(GSM_SMSMessage)); |
5688 | if (Backup.SMS[smsnum] == NULL) Print_Error(ERR_MOREMEMORY); | 5688 | if (Backup.SMS[smsnum] == NULL) Print_Error(ERR_MOREMEMORY); |
5689 | Backup.SMS[smsnum+1] = NULL; | 5689 | Backup.SMS[smsnum+1] = NULL; |
5690 | } else { | 5690 | } else { |
5691 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_SMS"); | 5691 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_SMS"); |
5692 | GSM_Terminate(); | 5692 | GSM_Terminate(); |
5693 | exit(-1); | 5693 | exit(-1); |
5694 | } | 5694 | } |
5695 | *Backup.SMS[smsnum] = sms.SMS[j]; | 5695 | *Backup.SMS[smsnum] = sms.SMS[j]; |
5696 | smsnum++; | 5696 | smsnum++; |
5697 | break; | 5697 | break; |
5698 | } | 5698 | } |
5699 | } | 5699 | } |
5700 | } | 5700 | } |
5701 | } | 5701 | } |
5702 | start=false; | 5702 | start=false; |
5703 | } | 5703 | } |
5704 | 5704 | ||
5705 | error = GSM_SaveSMSBackupFile(argv[2],&Backup); | 5705 | error = GSM_SaveSMSBackupFile(argv[2],&Backup); |
5706 | Print_Error(error); | 5706 | Print_Error(error); |
5707 | 5707 | ||
5708 | if (DeleteAfter) { | 5708 | if (DeleteAfter) { |
5709 | for (j=0;j<smsnum;j++) { | 5709 | for (j=0;j<smsnum;j++) { |
5710 | Backup.SMS[j]->Folder = 0; | 5710 | Backup.SMS[j]->Folder = 0; |
5711 | error=Phone->DeleteSMS(&s, Backup.SMS[j]); | 5711 | error=Phone->DeleteSMS(&s, Backup.SMS[j]); |
5712 | Print_Error(error); | 5712 | Print_Error(error); |
5713 | printmsgerr("%cDeleting: %i percent",13,(j+1)*100/smsnum); | 5713 | printmsgerr("%cDeleting: %i percent",13,(j+1)*100/smsnum); |
5714 | } | 5714 | } |
5715 | } | 5715 | } |
5716 | 5716 | ||
5717 | GSM_Terminate(); | 5717 | GSM_Terminate(); |
5718 | } | 5718 | } |
5719 | 5719 | ||
5720 | static void AddSMS(int argc, char *argv[]) | 5720 | static void AddSMS(int argc, char *argv[]) |
5721 | { | 5721 | { |
5722 | GSM_MultiSMSMessage SMS; | 5722 | GSM_MultiSMSMessage SMS; |
5723 | GSM_SMS_Backup Backup; | 5723 | GSM_SMS_Backup Backup; |
5724 | int smsnum = 0; | 5724 | int smsnum = 0; |
5725 | int folder; | 5725 | int folder; |
5726 | 5726 | ||
5727 | folder = atoi(argv[2]); | 5727 | folder = atoi(argv[2]); |
5728 | 5728 | ||
5729 | error = GSM_ReadSMSBackupFile(argv[3], &Backup); | 5729 | error = GSM_ReadSMSBackupFile(argv[3], &Backup); |
5730 | Print_Error(error); | 5730 | Print_Error(error); |
5731 | 5731 | ||
5732 | GSM_Init(true); | 5732 | GSM_Init(true); |
5733 | 5733 | ||
5734 | while (Backup.SMS[smsnum] != NULL) { | 5734 | while (Backup.SMS[smsnum] != NULL) { |
5735 | Backup.SMS[smsnum]->Folder = folder; | 5735 | Backup.SMS[smsnum]->Folder = folder; |
5736 | Backup.SMS[smsnum]->SMSC.Location = 1; | 5736 | Backup.SMS[smsnum]->SMSC.Location = 1; |
5737 | SMS.Number = 1; | 5737 | SMS.Number = 1; |
5738 | SMS.SMS[0] = *Backup.SMS[smsnum]; | 5738 | SMS.SMS[0] = *Backup.SMS[smsnum]; |
5739 | displaymultismsinfo(SMS,false,false); | 5739 | displaymultismsinfo(SMS,false,false); |
5740 | if (answer_yes("Restore sms")) { | 5740 | if (answer_yes("Restore sms")) { |
5741 | error=Phone->AddSMS(&s, Backup.SMS[smsnum]); | 5741 | error=Phone->AddSMS(&s, Backup.SMS[smsnum]); |
5742 | Print_Error(error); | 5742 | Print_Error(error); |
5743 | } | 5743 | } |
5744 | smsnum++; | 5744 | smsnum++; |
5745 | } | 5745 | } |
5746 | 5746 | ||
5747 | GSM_Terminate(); | 5747 | GSM_Terminate(); |
5748 | } | 5748 | } |
5749 | 5749 | ||
5750 | static void RestoreSMS(int argc, char *argv[]) | 5750 | static void RestoreSMS(int argc, char *argv[]) |
5751 | { | 5751 | { |
5752 | GSM_MultiSMSMessage SMS; | 5752 | GSM_MultiSMSMessage SMS; |
5753 | GSM_SMS_Backup Backup; | 5753 | GSM_SMS_Backup Backup; |
5754 | GSM_SMSFolders folders; | 5754 | GSM_SMSFolders folders; |
5755 | int smsnum = 0; | 5755 | int smsnum = 0; |
5756 | char buffer[200]; | 5756 | char buffer[200]; |
5757 | 5757 | ||
5758 | error=GSM_ReadSMSBackupFile(argv[2], &Backup); | 5758 | error=GSM_ReadSMSBackupFile(argv[2], &Backup); |
5759 | Print_Error(error); | 5759 | Print_Error(error); |
5760 | 5760 | ||
5761 | GSM_Init(true); | 5761 | GSM_Init(true); |
5762 | 5762 | ||
5763 | error=Phone->GetSMSFolders(&s, &folders); | 5763 | error=Phone->GetSMSFolders(&s, &folders); |
5764 | Print_Error(error); | 5764 | Print_Error(error); |
5765 | 5765 | ||
5766 | while (Backup.SMS[smsnum] != NULL) { | 5766 | while (Backup.SMS[smsnum] != NULL) { |
5767 | SMS.Number = 1; | 5767 | SMS.Number = 1; |
5768 | memcpy(&SMS.SMS[0],Backup.SMS[smsnum],sizeof(GSM_SMSMessage)); | 5768 | memcpy(&SMS.SMS[0],Backup.SMS[smsnum],sizeof(GSM_SMSMessage)); |
5769 | displaymultismsinfo(SMS,false,false); | 5769 | displaymultismsinfo(SMS,false,false); |
5770 | sprintf(buffer,"Restore sms to folder \"%s\"",DecodeUnicodeConsole(folders.Folder[Backup.SMS[smsnum]->Folder-1].Name)); | 5770 | sprintf(buffer,"Restore sms to folder \"%s\"",DecodeUnicodeConsole(folders.Folder[Backup.SMS[smsnum]->Folder-1].Name)); |
5771 | if (answer_yes(buffer)) { | 5771 | if (answer_yes(buffer)) { |
5772 | error=Phone->AddSMS(&s, Backup.SMS[smsnum]); | 5772 | error=Phone->AddSMS(&s, Backup.SMS[smsnum]); |
5773 | Print_Error(error); | 5773 | Print_Error(error); |
5774 | } | 5774 | } |
5775 | smsnum++; | 5775 | smsnum++; |
5776 | } | 5776 | } |
5777 | 5777 | ||
5778 | GSM_Terminate(); | 5778 | GSM_Terminate(); |
5779 | } | 5779 | } |
5780 | #endif | 5780 | #endif |
5781 | 5781 | ||
5782 | static void CopyBitmap(int argc, char *argv[]) | 5782 | static void CopyBitmap(int argc, char *argv[]) |
5783 | { | 5783 | { |
5784 | GSM_MultiBitmap Bitmap; | 5784 | GSM_MultiBitmap Bitmap; |
5785 | int i; | 5785 | int i; |
5786 | 5786 | ||
5787 | Bitmap.Bitmap[0].Type = GSM_None; | 5787 | Bitmap.Bitmap[0].Type = GSM_None; |
5788 | 5788 | ||
5789 | error=GSM_ReadBitmapFile(argv[2],&Bitmap); | 5789 | error=GSM_ReadBitmapFile(argv[2],&Bitmap); |
5790 | Print_Error(error); | 5790 | Print_Error(error); |
5791 | 5791 | ||
5792 | if (argc==3) { | 5792 | if (argc==3) { |
5793 | for (i=0;i<Bitmap.Number;i++) { | 5793 | for (i=0;i<Bitmap.Number;i++) { |
5794 | switch (Bitmap.Bitmap[i].Type) { | 5794 | switch (Bitmap.Bitmap[i].Type) { |
5795 | case GSM_StartupLogo : printmsg("Startup logo"); break; | 5795 | case GSM_StartupLogo : printmsg("Startup logo"); break; |
5796 | case GSM_OperatorLogo: printmsg("Operator logo"); break; | 5796 | case GSM_OperatorLogo: printmsg("Operator logo"); break; |
5797 | case GSM_PictureImage: printmsg("Picture Image"); break; | 5797 | case GSM_PictureImage: printmsg("Picture Image"); break; |
5798 | case GSM_CallerGroupLogo : printmsg("Caller group logo"); break; | 5798 | case GSM_CallerGroupLogo : printmsg("Caller group logo"); break; |
5799 | default : break; | 5799 | default : break; |
5800 | } | 5800 | } |
5801 | printmsg(", width %i, height %i\n",Bitmap.Bitmap[i].BitmapWidth,Bitmap.Bitmap[i].BitmapHeight); | 5801 | printmsg(", width %i, height %i\n",Bitmap.Bitmap[i].BitmapWidth,Bitmap.Bitmap[i].BitmapHeight); |
5802 | GSM_PrintBitmap(stdout,&Bitmap.Bitmap[i]); | 5802 | GSM_PrintBitmap(stdout,&Bitmap.Bitmap[i]); |
5803 | } | 5803 | } |
5804 | } else { | 5804 | } else { |
5805 | if (argc == 5) { | 5805 | if (argc == 5) { |
5806 | for (i=0;i<Bitmap.Number;i++) { | 5806 | for (i=0;i<Bitmap.Number;i++) { |
5807 | if (mystrncasecmp(argv[4],"PICTURE",0)) { | 5807 | if (mystrncasecmp(argv[4],"PICTURE",0)) { |
5808 | Bitmap.Bitmap[i].Type = GSM_PictureImage; | 5808 | Bitmap.Bitmap[i].Type = GSM_PictureImage; |
5809 | } else if (mystrncasecmp(argv[4],"STARTUP",0)) { | 5809 | } else if (mystrncasecmp(argv[4],"STARTUP",0)) { |
5810 | Bitmap.Bitmap[i].Type = GSM_StartupLogo; | 5810 | Bitmap.Bitmap[i].Type = GSM_StartupLogo; |
5811 | } else if (mystrncasecmp(argv[4],"CALLER",0)) { | 5811 | } else if (mystrncasecmp(argv[4],"CALLER",0)) { |
5812 | Bitmap.Bitmap[i].Type = GSM_CallerGroupLogo; | 5812 | Bitmap.Bitmap[i].Type = GSM_CallerGroupLogo; |
5813 | } else if (mystrncasecmp(argv[4],"OPERATOR",0)) { | 5813 | } else if (mystrncasecmp(argv[4],"OPERATOR",0)) { |
5814 | Bitmap.Bitmap[i].Type = GSM_OperatorLogo; | 5814 | Bitmap.Bitmap[i].Type = GSM_OperatorLogo; |
5815 | } else { | 5815 | } else { |
5816 | printmsg("What format of output file logo (\"%s\") ?\n",argv[4]); | 5816 | printmsg("What format of output file logo (\"%s\") ?\n",argv[4]); |
5817 | exit(-1); | 5817 | exit(-1); |
5818 | } | 5818 | } |
5819 | } | 5819 | } |
5820 | } | 5820 | } |
5821 | error=GSM_SaveBitmapFile(argv[3],&Bitmap); | 5821 | error=GSM_SaveBitmapFile(argv[3],&Bitmap); |
5822 | Print_Error(error); | 5822 | Print_Error(error); |
5823 | } | 5823 | } |
5824 | } | 5824 | } |
5825 | 5825 | ||
5826 | static void NokiaComposer(int argc, char *argv[]) | 5826 | static void NokiaComposer(int argc, char *argv[]) |
5827 | { | 5827 | { |
5828 | GSM_Ringtone ringtone; | 5828 | GSM_Ringtone ringtone; |
5829 | bool started; | 5829 | bool started; |
5830 | int i,j; | 5830 | int i,j; |
5831 | GSM_RingNote *Note; | 5831 | GSM_RingNote *Note; |
5832 | GSM_RingNoteDuration Duration; | 5832 | GSM_RingNoteDuration Duration; |
5833 | GSM_RingNoteDuration DefNoteDuration = 32; /* 32 = Duration_1_4 */ | 5833 | GSM_RingNoteDuration DefNoteDuration = 32; /* 32 = Duration_1_4 */ |
5834 | unsigned int DefNoteScale = Scale_880; | 5834 | unsigned int DefNoteScale = Scale_880; |
5835 | 5835 | ||
5836 | ringtone.Format= 0; | 5836 | ringtone.Format= 0; |
5837 | error=GSM_ReadRingtoneFile(argv[2],&ringtone); | 5837 | error=GSM_ReadRingtoneFile(argv[2],&ringtone); |
5838 | 5838 | ||
5839 | if (ringtone.Format != RING_NOTETONE) { | 5839 | if (ringtone.Format != RING_NOTETONE) { |
5840 | printmsg("It can be RTTL ringtone only used with this option\n"); | 5840 | printmsg("It can be RTTL ringtone only used with this option\n"); |
5841 | exit(-1); | 5841 | exit(-1); |
5842 | } | 5842 | } |
5843 | 5843 | ||
5844 | started = false; | 5844 | started = false; |
5845 | j= 0; | 5845 | j= 0; |
5846 | for (i=0;i<ringtone.NoteTone.NrCommands;i++) { | 5846 | for (i=0;i<ringtone.NoteTone.NrCommands;i++) { |
5847 | if (ringtone.NoteTone.Commands[i].Type == RING_Note) { | 5847 | if (ringtone.NoteTone.Commands[i].Type == RING_Note) { |
5848 | Note = &ringtone.NoteTone.Commands[i].Note; | 5848 | Note = &ringtone.NoteTone.Commands[i].Note; |
5849 | if (!started) { | 5849 | if (!started) { |
5850 | if (Note->Note != Note_Pause) { | 5850 | if (Note->Note != Note_Pause) { |
5851 | printmsg("Ringtone \"%s\" (tempo = %i Beats Per Minute)\n\n",DecodeUnicodeConsole(ringtone.Name),GSM_RTTLGetTempo(Note->Tempo)); | 5851 | printmsg("Ringtone \"%s\" (tempo = %i Beats Per Minute)\n\n",DecodeUnicodeConsole(ringtone.Name),GSM_RTTLGetTempo(Note->Tempo)); |
5852 | started = true; | 5852 | started = true; |
5853 | } | 5853 | } |
5854 | } | 5854 | } |
5855 | if (started) j++; | 5855 | if (started) j++; |
5856 | } | 5856 | } |
5857 | } | 5857 | } |
5858 | if (j>50) printmsg("WARNING: LENGTH=%i NOTES, BUT YOU WILL ENTER ONLY FIRST 50 TONES.",j); | 5858 | if (j>50) printmsg("WARNING: LENGTH=%i NOTES, BUT YOU WILL ENTER ONLY FIRST 50 TONES.",j); |
5859 | 5859 | ||
5860 | printmsg("\n\nThis ringtone in Nokia Composer in phone should look: "); | 5860 | printmsg("\n\nThis ringtone in Nokia Composer in phone should look: "); |
5861 | started = false; | 5861 | started = false; |
5862 | for (i=0;i<ringtone.NoteTone.NrCommands;i++) { | 5862 | for (i=0;i<ringtone.NoteTone.NrCommands;i++) { |
5863 | if (ringtone.NoteTone.Commands[i].Type == RING_Note) { | 5863 | if (ringtone.NoteTone.Commands[i].Type == RING_Note) { |
5864 | Note = &ringtone.NoteTone.Commands[i].Note; | 5864 | Note = &ringtone.NoteTone.Commands[i].Note; |
5865 | if (!started) { | 5865 | if (!started) { |
5866 | if (Note->Note != Note_Pause) started = true; | 5866 | if (Note->Note != Note_Pause) started = true; |
5867 | } | 5867 | } |
5868 | if (started) { | 5868 | if (started) { |
5869 | switch (Note->Duration) { | 5869 | switch (Note->Duration) { |
5870 | case Duration_Full: printmsg("1"); break; | 5870 | case Duration_Full: printmsg("1"); break; |
5871 | case Duration_1_2 : printmsg("2"); break; | 5871 | case Duration_1_2 : printmsg("2"); break; |
5872 | case Duration_1_4 : printmsg("4"); break; | 5872 | case Duration_1_4 : printmsg("4"); break; |
5873 | case Duration_1_8 : printmsg("8"); break; | 5873 | case Duration_1_8 : printmsg("8"); break; |
5874 | case Duration_1_16: printmsg("16");break; | 5874 | case Duration_1_16: printmsg("16");break; |
5875 | case Duration_1_32: printmsg("32");break; | 5875 | case Duration_1_32: printmsg("32");break; |
5876 | } | 5876 | } |
5877 | if (Note->DurationSpec == DottedNote) printmsg("."); | 5877 | if (Note->DurationSpec == DottedNote) printmsg("."); |
5878 | switch (Note->Note) { | 5878 | switch (Note->Note) { |
5879 | case Note_C : printmsg("c");break; | 5879 | case Note_C : printmsg("c");break; |
5880 | case Note_Cis : printmsg("#c");break; | 5880 | case Note_Cis : printmsg("#c");break; |
5881 | case Note_D :printmsg("d");break; | 5881 | case Note_D :printmsg("d");break; |
5882 | case Note_Dis : printmsg("#d");break; | 5882 | case Note_Dis : printmsg("#d");break; |
5883 | case Note_E : printmsg("e");break; | 5883 | case Note_E : printmsg("e");break; |
5884 | case Note_F : printmsg("f");break; | 5884 | case Note_F : printmsg("f");break; |
5885 | case Note_Fis : printmsg("#f");break; | 5885 | case Note_Fis : printmsg("#f");break; |
5886 | case Note_G : printmsg("g");break; | 5886 | case Note_G : printmsg("g");break; |
5887 | case Note_Gis : printmsg("#g");break; | 5887 | case Note_Gis : printmsg("#g");break; |
5888 | case Note_A : printmsg("a");break; | 5888 | case Note_A : printmsg("a");break; |
5889 | case Note_Ais : printmsg("#a");break; | 5889 | case Note_Ais : printmsg("#a");break; |
5890 | case Note_H : printmsg("h");break; | 5890 | case Note_H : printmsg("h");break; |
5891 | case Note_Pause : printmsg("-");break; | 5891 | case Note_Pause : printmsg("-");break; |
5892 | } | 5892 | } |
5893 | if (Note->Note != Note_Pause) printmsg("%i",Note->Scale - 4); | 5893 | if (Note->Note != Note_Pause) printmsg("%i",Note->Scale - 4); |
5894 | printmsg(" "); | 5894 | printmsg(" "); |
5895 | } | 5895 | } |
5896 | } | 5896 | } |
5897 | } | 5897 | } |
5898 | 5898 | ||
5899 | printmsg("\n\nTo enter it please press: "); | 5899 | printmsg("\n\nTo enter it please press: "); |
5900 | started = false; | 5900 | started = false; |
5901 | for (i=0;i<ringtone.NoteTone.NrCommands;i++) { | 5901 | for (i=0;i<ringtone.NoteTone.NrCommands;i++) { |
5902 | if (ringtone.NoteTone.Commands[i].Type == RING_Note) { | 5902 | if (ringtone.NoteTone.Commands[i].Type == RING_Note) { |
5903 | Note = &ringtone.NoteTone.Commands[i].Note; | 5903 | Note = &ringtone.NoteTone.Commands[i].Note; |
5904 | if (!started) { | 5904 | if (!started) { |
5905 | if (Note->Note != Note_Pause) started = true; | 5905 | if (Note->Note != Note_Pause) started = true; |
5906 | } | 5906 | } |
5907 | if (started) { | 5907 | if (started) { |
5908 | switch (Note->Note) { | 5908 | switch (Note->Note) { |
5909 | case Note_C : case Note_Cis:printmsg("1");break; | 5909 | case Note_C : case Note_Cis:printmsg("1");break; |
5910 | case Note_D : case Note_Dis:printmsg("2");break; | 5910 | case Note_D : case Note_Dis:printmsg("2");break; |
5911 | case Note_E : printmsg("3");break; | 5911 | case Note_E : printmsg("3");break; |
5912 | case Note_F : case Note_Fis:printmsg("4");break; | 5912 | case Note_F : case Note_Fis:printmsg("4");break; |
5913 | case Note_G : case Note_Gis:printmsg("5");break; | 5913 | case Note_G : case Note_Gis:printmsg("5");break; |
5914 | case Note_A : case Note_Ais:printmsg("6");break; | 5914 | case Note_A : case Note_Ais:printmsg("6");break; |
5915 | case Note_H : printmsg("7");break; | 5915 | case Note_H : printmsg("7");break; |
5916 | default : printmsg("0");break; | 5916 | default : printmsg("0");break; |
5917 | } | 5917 | } |
5918 | if (Note->DurationSpec == DottedNote) printmsg("(longer)"); | 5918 | if (Note->DurationSpec == DottedNote) printmsg("(longer)"); |
5919 | switch (Note->Note) { | 5919 | switch (Note->Note) { |
5920 | case Note_Cis: case Note_Dis: | 5920 | case Note_Cis: case Note_Dis: |
5921 | case Note_Fis: case Note_Gis: | 5921 | case Note_Fis: case Note_Gis: |
5922 | case Note_Ais: | 5922 | case Note_Ais: |
5923 | printmsg("#"); | 5923 | printmsg("#"); |
5924 | break; | 5924 | break; |
5925 | default : | 5925 | default : |
5926 | break; | 5926 | break; |
5927 | } | 5927 | } |
5928 | if (Note->Note != Note_Pause) { | 5928 | if (Note->Note != Note_Pause) { |
5929 | if ((unsigned int)Note->Scale != DefNoteScale) { | 5929 | if ((unsigned int)Note->Scale != DefNoteScale) { |
5930 | while (DefNoteScale != (unsigned int)Note->Scale) { | 5930 | while (DefNoteScale != (unsigned int)Note->Scale) { |
5931 | printmsg("*"); | 5931 | printmsg("*"); |
5932 | DefNoteScale++; | 5932 | DefNoteScale++; |
5933 | if (DefNoteScale==Scale_7040) DefNoteScale = Scale_880; | 5933 | if (DefNoteScale==Scale_7040) DefNoteScale = Scale_880; |
5934 | } | 5934 | } |
5935 | } | 5935 | } |
5936 | } | 5936 | } |
5937 | Duration = 0; | 5937 | Duration = 0; |
5938 | switch (Note->Duration) { | 5938 | switch (Note->Duration) { |
5939 | case Duration_Full : Duration = 128;break; | 5939 | case Duration_Full : Duration = 128;break; |
5940 | case Duration_1_2 : Duration = 64;break; | 5940 | case Duration_1_2 : Duration = 64;break; |
5941 | case Duration_1_4 : Duration = 32;break; | 5941 | case Duration_1_4 : Duration = 32;break; |
5942 | case Duration_1_8 : Duration = 16;break; | 5942 | case Duration_1_8 : Duration = 16;break; |
5943 | case Duration_1_16 : Duration = 8;break; | 5943 | case Duration_1_16 : Duration = 8;break; |
5944 | case Duration_1_32 : Duration = 4;break; | 5944 | case Duration_1_32 : Duration = 4;break; |
5945 | default : dbgprintf("error\n");break; | 5945 | default : dbgprintf("error\n");break; |
5946 | } | 5946 | } |
5947 | if (Duration > DefNoteDuration) { | 5947 | if (Duration > DefNoteDuration) { |
5948 | while (DefNoteDuration != Duration) { | 5948 | while (DefNoteDuration != Duration) { |
5949 | printmsg("9"); | 5949 | printmsg("9"); |
5950 | DefNoteDuration = DefNoteDuration * 2; | 5950 | DefNoteDuration = DefNoteDuration * 2; |
5951 | } | 5951 | } |
5952 | } | 5952 | } |
5953 | if (Duration < DefNoteDuration) { | 5953 | if (Duration < DefNoteDuration) { |
5954 | while (DefNoteDuration != Duration) { | 5954 | while (DefNoteDuration != Duration) { |
5955 | printmsg("8"); | 5955 | printmsg("8"); |
5956 | DefNoteDuration = DefNoteDuration / 2; | 5956 | DefNoteDuration = DefNoteDuration / 2; |
5957 | } | 5957 | } |
5958 | } | 5958 | } |
5959 | printmsg(" "); | 5959 | printmsg(" "); |
5960 | } | 5960 | } |
5961 | } | 5961 | } |
5962 | } | 5962 | } |
5963 | 5963 | ||
5964 | printf("\n"); | 5964 | printf("\n"); |
5965 | } | 5965 | } |
5966 | 5966 | ||
5967 | static void CopyRingtone(int argc, char *argv[]) | 5967 | static void CopyRingtone(int argc, char *argv[]) |
5968 | { | 5968 | { |
5969 | GSM_Ringtone ringtone, ringtone2; | 5969 | GSM_Ringtone ringtone, ringtone2; |
5970 | GSM_RingtoneFormatFormat; | 5970 | GSM_RingtoneFormatFormat; |
5971 | 5971 | ||
5972 | ringtone.Format= 0; | 5972 | ringtone.Format= 0; |
5973 | error=GSM_ReadRingtoneFile(argv[2],&ringtone); | 5973 | error=GSM_ReadRingtoneFile(argv[2],&ringtone); |
5974 | Print_Error(error); | 5974 | Print_Error(error); |
5975 | 5975 | ||
5976 | Format = ringtone.Format; | 5976 | Format = ringtone.Format; |
5977 | if (argc == 5) { | 5977 | if (argc == 5) { |
diff --git a/gammu/gammu.tar.bz2 b/gammu/gammu.tar.bz2 deleted file mode 100644 index 7c921a7..0000000 --- a/gammu/gammu.tar.bz2 +++ b/dev/null | |||
Binary files differ | |||