-rw-r--r-- | gammu/emb/gammu/gammu.c | 662 |
1 files changed, 382 insertions, 280 deletions
diff --git a/gammu/emb/gammu/gammu.c b/gammu/emb/gammu/gammu.c index 997485a..f49ae36 100644 --- a/gammu/emb/gammu/gammu.c +++ b/gammu/emb/gammu/gammu.c | |||
@@ -1,95 +1,82 @@ | |||
1 | /* (c) 2002-2004 by Marcin Wiacek and Michal Cihar */ | 1 | /* (c) 2002-2004 by Marcin Wiacek and Michal Cihar */ |
2 | /* FM stuff by Walek */ | 2 | /* FM stuff by Walek */ |
3 | 3 | ||
4 | #include <string.h> | 4 | #include <string.h> |
5 | #include <stdio.h> | 5 | #include <stdio.h> |
6 | #include <stdlib.h> | 6 | #include <stdlib.h> |
7 | #include <stdarg.h> | 7 | #include <stdarg.h> |
8 | #include <locale.h> | 8 | #include <locale.h> |
9 | #include <signal.h> | 9 | #include <signal.h> |
10 | #include <ctype.h> | 10 | #include <ctype.h> |
11 | #include <wchar.h> | 11 | #include <wchar.h> |
12 | #undef HAVE_MYSQL_MYSQL_H | ||
13 | #ifdef WIN32 | 12 | #ifdef WIN32 |
14 | # include <windows.h> | 13 | # include <windows.h> |
15 | # include <process.h> | 14 | # include <process.h> |
16 | # ifdef _MSC_VER | 15 | # ifdef _MSC_VER |
17 | # include <sys/utime.h> | 16 | # include <sys/utime.h> |
18 | # else | 17 | # else |
19 | # include <utime.h> | 18 | # include <utime.h> |
20 | # endif | 19 | # endif |
21 | #else | 20 | #else |
22 | # include <utime.h> | 21 | # include <utime.h> |
23 | #endif | 22 | #endif |
24 | 23 | ||
25 | #include "../common/gammu.h" | 24 | #include "../common/gammu.h" |
26 | #include "gammu.h" | 25 | #include "gammu.h" |
27 | #include "smsd/smsdcore.h" | 26 | #include "smsd/smsdcore.h" |
28 | #ifdef DEBUG | 27 | #ifdef DEBUG |
29 | # include "sniff.h" | 28 | # include "sniff.h" |
30 | #endif | 29 | #endif |
31 | #ifdef GSM_ENABLE_NOKIA_DCT3 | 30 | #ifdef GSM_ENABLE_NOKIA_DCT3 |
32 | # include "depend/nokia/dct3.h" | 31 | # include "depend/nokia/dct3.h" |
33 | # include "depend/nokia/dct3trac/wmx.h" | 32 | # include "depend/nokia/dct3trac/wmx.h" |
34 | #endif | 33 | #endif |
35 | #ifdef GSM_ENABLE_NOKIA_DCT4 | 34 | #ifdef GSM_ENABLE_NOKIA_DCT4 |
36 | # include "depend/nokia/dct4.h" | 35 | # include "depend/nokia/dct4.h" |
37 | #endif | 36 | #endif |
38 | #ifdef GSM_ENABLE_ATGEN | 37 | #ifdef GSM_ENABLE_ATGEN |
39 | # include "depend/siemens/dsiemens.h" | 38 | # include "depend/siemens/dsiemens.h" |
40 | #endif | 39 | #endif |
41 | 40 | ||
42 | #ifdef HAVE_PTHREAD | 41 | #ifdef HAVE_PTHREAD |
43 | # include <pthread.h> | 42 | # include <pthread.h> |
44 | #endif | 43 | #endif |
45 | 44 | ||
46 | #ifdef HAVE_SYS_IOCTL_H | 45 | #ifdef HAVE_SYS_IOCTL_H |
47 | # include <sys/ioctl.h> | 46 | # include <sys/ioctl.h> |
48 | #endif | 47 | #endif |
49 | 48 | ||
50 | 49 | ||
51 | //static GSM_StateMachine s; | 50 | GSM_StateMachine s; |
52 | //static GSM_Phone_Functions *Phone; | 51 | GSM_Phone_Functions *Phone; |
53 | static INI_Section *cfg = NULL; | 52 | static INI_Section *cfg = NULL; |
54 | 53 | ||
55 | //static GSM_Error error = ERR_NONE; | 54 | GSM_Error error = ERR_NONE; |
56 | static int i; | 55 | static int i; |
57 | 56 | ||
58 | //static bool gshutdown = false; | 57 | volatile bool gshutdown = false; |
59 | typedef struct { | ||
60 | unsigned char Connection[50]; | ||
61 | } OneConnectionInfo; | ||
62 | 58 | ||
63 | typedef struct { | ||
64 | unsigned char Device[50]; | ||
65 | OneConnectionInfo Connections[6]; | ||
66 | //GSM_StateMachines; | ||
67 | } OneDeviceInfo; | ||
68 | |||
69 | static int num; | ||
70 | static OneDeviceInfo SearchDevices[100]; | ||
71 | static bool SearchOutput; | ||
72 | void interrupt(int sign) | 59 | void interrupt(int sign) |
73 | { | 60 | { |
74 | signal(sign, SIG_IGN); | 61 | signal(sign, SIG_IGN); |
75 | gshutdown = true; | 62 | gshutdown = true; |
76 | } | 63 | } |
77 | 64 | ||
78 | #ifdef __GNUC__ | 65 | #ifdef __GNUC__ |
79 | __attribute__((format(printf, 1, 2))) | 66 | __attribute__((format(printf, 1, 2))) |
80 | #endif | 67 | #endif |
81 | int printmsg(char *format, ...) | 68 | int printmsg(char *format, ...) |
82 | { | 69 | { |
83 | va_list argp; | 70 | va_list argp; |
84 | int result; | 71 | int result; |
85 | 72 | ||
86 | va_start(argp, format); | 73 | va_start(argp, format); |
87 | result = vfprintf(stdout,GetMsg(s.msg,format),argp); | 74 | result = vfprintf(stdout,GetMsg(s.msg,format),argp); |
88 | va_end(argp); | 75 | va_end(argp); |
89 | return result; | 76 | return result; |
90 | } | 77 | } |
91 | 78 | ||
92 | #ifdef __GNUC__ | 79 | #ifdef __GNUC__ |
93 | __attribute__((format(printf, 1, 2))) | 80 | __attribute__((format(printf, 1, 2))) |
94 | #endif | 81 | #endif |
95 | int printmsgerr(char *format, ...) | 82 | int printmsgerr(char *format, ...) |
@@ -222,48 +209,49 @@ void GSM_PhoneBeep(void) | |||
222 | if (error != ERR_NOTSUPPORTED && error != ERR_NOTIMPLEMENTED) Print_Error(error); | 209 | if (error != ERR_NOTSUPPORTED && error != ERR_NOTIMPLEMENTED) Print_Error(error); |
223 | } | 210 | } |
224 | #endif | 211 | #endif |
225 | 212 | ||
226 | static GSM_Error GSM_PlayRingtone(GSM_Ringtone ringtone) | 213 | static GSM_Error GSM_PlayRingtone(GSM_Ringtone ringtone) |
227 | { | 214 | { |
228 | int i; | 215 | int i; |
229 | bool first=true; | 216 | bool first=true; |
230 | GSM_Error error; | 217 | GSM_Error error; |
231 | 218 | ||
232 | signal(SIGINT, interrupt); | 219 | signal(SIGINT, interrupt); |
233 | printmsg("Press Ctrl+C to break...\n"); | 220 | printmsg("Press Ctrl+C to break...\n"); |
234 | 221 | ||
235 | for (i=0;i<ringtone.NoteTone.NrCommands;i++) { | 222 | for (i=0;i<ringtone.NoteTone.NrCommands;i++) { |
236 | if (gshutdown) break; | 223 | if (gshutdown) break; |
237 | if (ringtone.NoteTone.Commands[i].Type != RING_NOTETONE) continue; | 224 | if (ringtone.NoteTone.Commands[i].Type != RING_NOTETONE) continue; |
238 | error=PHONE_RTTLPlayOneNote(&s,ringtone.NoteTone.Commands[i].Note,first); | 225 | error=PHONE_RTTLPlayOneNote(&s,ringtone.NoteTone.Commands[i].Note,first); |
239 | if (error!=ERR_NONE) return error; | 226 | if (error!=ERR_NONE) return error; |
240 | first = false; | 227 | first = false; |
241 | } | 228 | } |
242 | 229 | ||
243 | /* Disables buzzer */ | 230 | /* Disables buzzer */ |
244 | return s.Phone.Functions->PlayTone(&s,255*255,0,false); | 231 | return s.Phone.Functions->PlayTone(&s,255*255,0,false); |
245 | } | 232 | } |
233 | |||
246 | static void PlayRingtone(int argc, char *argv[]) | 234 | static void PlayRingtone(int argc, char *argv[]) |
247 | { | 235 | { |
248 | GSM_Ringtone ringtone,ringtone2; | 236 | GSM_Ringtone ringtone,ringtone2; |
249 | 237 | ||
250 | ringtone.Format= 0; | 238 | ringtone.Format= 0; |
251 | error=GSM_ReadRingtoneFile(argv[2],&ringtone); | 239 | error=GSM_ReadRingtoneFile(argv[2],&ringtone); |
252 | Print_Error(error); | 240 | Print_Error(error); |
253 | 241 | ||
254 | error=GSM_RingtoneConvert(&ringtone2,&ringtone,RING_NOTETONE); | 242 | error=GSM_RingtoneConvert(&ringtone2,&ringtone,RING_NOTETONE); |
255 | Print_Error(error); | 243 | Print_Error(error); |
256 | 244 | ||
257 | GSM_Init(true); | 245 | GSM_Init(true); |
258 | 246 | ||
259 | error=GSM_PlayRingtone(ringtone2); | 247 | error=GSM_PlayRingtone(ringtone2); |
260 | Print_Error(error); | 248 | Print_Error(error); |
261 | 249 | ||
262 | GSM_Terminate(); | 250 | GSM_Terminate(); |
263 | } | 251 | } |
264 | 252 | ||
265 | static void Identify(int argc, char *argv[]) | 253 | static void Identify(int argc, char *argv[]) |
266 | { | 254 | { |
267 | unsigned char buffer[100]; | 255 | unsigned char buffer[100]; |
268 | 256 | ||
269 | GSM_Init(true); | 257 | GSM_Init(true); |
@@ -320,82 +308,82 @@ static void Identify(int argc, char *argv[]) | |||
320 | 308 | ||
321 | error=Phone->GetSIMIMSI(&s, buffer); | 309 | error=Phone->GetSIMIMSI(&s, buffer); |
322 | switch (error) { | 310 | switch (error) { |
323 | case ERR_SECURITYERROR: | 311 | case ERR_SECURITYERROR: |
324 | case ERR_NOTSUPPORTED: | 312 | case ERR_NOTSUPPORTED: |
325 | case ERR_NOTIMPLEMENTED: | 313 | case ERR_NOTIMPLEMENTED: |
326 | break; | 314 | break; |
327 | case ERR_NONE: | 315 | case ERR_NONE: |
328 | printmsg("SIM IMSI : %s\n",buffer); | 316 | printmsg("SIM IMSI : %s\n",buffer); |
329 | break; | 317 | break; |
330 | default: | 318 | default: |
331 | Print_Error(error); | 319 | Print_Error(error); |
332 | } | 320 | } |
333 | 321 | ||
334 | #ifdef GSM_ENABLE_NOKIA_DCT3 | 322 | #ifdef GSM_ENABLE_NOKIA_DCT3 |
335 | DCT3Info(argc, argv); | 323 | DCT3Info(argc, argv); |
336 | #endif | 324 | #endif |
337 | #ifdef GSM_ENABLE_NOKIA_DCT4 | 325 | #ifdef GSM_ENABLE_NOKIA_DCT4 |
338 | DCT4Info(argc, argv); | 326 | DCT4Info(argc, argv); |
339 | #endif | 327 | #endif |
340 | 328 | ||
341 | GSM_Terminate(); | 329 | GSM_Terminate(); |
342 | } | 330 | } |
343 | 331 | ||
344 | //#if 0 | ||
345 | static void GetDateTime(int argc, char *argv[]) | 332 | static void GetDateTime(int argc, char *argv[]) |
346 | { | 333 | { |
347 | GSM_DateTime date_time; | 334 | GSM_DateTime date_time; |
348 | GSM_Localelocale; | 335 | GSM_Localelocale; |
349 | 336 | ||
350 | GSM_Init(true); | 337 | GSM_Init(true); |
351 | 338 | ||
352 | error=Phone->GetDateTime(&s, &date_time); | 339 | error=Phone->GetDateTime(&s, &date_time); |
353 | switch (error) { | 340 | switch (error) { |
354 | case ERR_EMPTY: | 341 | case ERR_EMPTY: |
355 | printmsg("Date and time not set in phone\n"); | 342 | printmsg("Date and time not set in phone\n"); |
356 | break; | 343 | break; |
357 | case ERR_NONE: | 344 | case ERR_NONE: |
358 | printmsg("Phone time is %s\n",OSDateTime(date_time,false)); | 345 | printmsg("Phone time is %s\n",OSDateTime(date_time,false)); |
359 | break; | 346 | break; |
360 | default: | 347 | default: |
361 | Print_Error(error); | 348 | Print_Error(error); |
362 | } | 349 | } |
363 | 350 | ||
364 | error=Phone->GetLocale(&s, &locale); | 351 | error=Phone->GetLocale(&s, &locale); |
365 | switch (error) { | 352 | switch (error) { |
366 | case ERR_NOTSUPPORTED: | 353 | case ERR_NOTSUPPORTED: |
367 | case ERR_NOTIMPLEMENTED: | 354 | case ERR_NOTIMPLEMENTED: |
368 | break; | 355 | break; |
369 | default: | 356 | default: |
370 | Print_Error(error); | 357 | Print_Error(error); |
371 | printmsg("Time format is "); | 358 | printmsg("Time format is "); |
372 | if (locale.AMPMTime) printmsg("12 hours\n"); else printmsg("24 hours\n"); | 359 | if (locale.AMPMTime) printmsg("12 hours\n"); else printmsg("24 hours\n"); |
373 | printmsg("Date format is "); | 360 | printmsg("Date format is "); |
374 | switch (locale.DateFormat) { | 361 | switch (locale.DateFormat) { |
375 | case GSM_Date_DDMMYYYY:printmsg("DD MM YYYY");break; | 362 | case GSM_Date_DDMMYYYY:printmsg("DD MM YYYY");break; |
376 | case GSM_Date_MMDDYYYY:printmsg("MM DD YYYY");break; | 363 | case GSM_Date_MMDDYYYY:printmsg("MM DD YYYY");break; |
377 | case GSM_Date_YYYYMMDD:printmsg("YYYY MM DD"); | 364 | case GSM_Date_YYYYMMDD:printmsg("YYYY MM DD"); |
365 | default :break; | ||
378 | } | 366 | } |
379 | printmsg(", date separator is %c\n",locale.DateSeparator); | 367 | printmsg(", date separator is %c\n",locale.DateSeparator); |
380 | } | 368 | } |
381 | 369 | ||
382 | GSM_Terminate(); | 370 | GSM_Terminate(); |
383 | } | 371 | } |
384 | 372 | ||
385 | static void SetDateTime(int argc, char *argv[]) | 373 | static void SetDateTime(int argc, char *argv[]) |
386 | { | 374 | { |
387 | GSM_DateTime date_time; | 375 | GSM_DateTime date_time; |
388 | 376 | ||
389 | GSM_GetCurrentDateTime(&date_time); | 377 | GSM_GetCurrentDateTime(&date_time); |
390 | 378 | ||
391 | GSM_Init(true); | 379 | GSM_Init(true); |
392 | 380 | ||
393 | error=Phone->SetDateTime(&s, &date_time); | 381 | error=Phone->SetDateTime(&s, &date_time); |
394 | Print_Error(error); | 382 | Print_Error(error); |
395 | 383 | ||
396 | GSM_Terminate(); | 384 | GSM_Terminate(); |
397 | } | 385 | } |
398 | 386 | ||
399 | static void GetAlarm(int argc, char *argv[]) | 387 | static void GetAlarm(int argc, char *argv[]) |
400 | { | 388 | { |
401 | GSM_Alarm alarm; | 389 | GSM_Alarm alarm; |
@@ -566,136 +554,153 @@ static void GetAllMemory(int argc, char *argv[]) | |||
566 | if (mystrncasecmp(argv[2],"SM",0)) Entry.MemoryType=MEM_SM; | 554 | if (mystrncasecmp(argv[2],"SM",0)) Entry.MemoryType=MEM_SM; |
567 | if (mystrncasecmp(argv[2],"VM",0)) Entry.MemoryType=MEM_VM; | 555 | if (mystrncasecmp(argv[2],"VM",0)) Entry.MemoryType=MEM_VM; |
568 | if (mystrncasecmp(argv[2],"FD",0)) Entry.MemoryType=MEM_FD; | 556 | if (mystrncasecmp(argv[2],"FD",0)) Entry.MemoryType=MEM_FD; |
569 | if (Entry.MemoryType==0) { | 557 | if (Entry.MemoryType==0) { |
570 | printmsg("ERROR: unknown memory type (\"%s\")\n",argv[2]); | 558 | printmsg("ERROR: unknown memory type (\"%s\")\n",argv[2]); |
571 | exit (-1); | 559 | exit (-1); |
572 | } | 560 | } |
573 | 561 | ||
574 | GSM_Init(true); | 562 | GSM_Init(true); |
575 | 563 | ||
576 | while (!gshutdown) { | 564 | while (!gshutdown) { |
577 | error = Phone->GetNextMemory(&s, &Entry, start); | 565 | error = Phone->GetNextMemory(&s, &Entry, start); |
578 | if (error == ERR_EMPTY) break; | 566 | if (error == ERR_EMPTY) break; |
579 | Print_Error(error); | 567 | Print_Error(error); |
580 | printmsg("Memory %s, Location %i\n",argv[2],Entry.Location); | 568 | printmsg("Memory %s, Location %i\n",argv[2],Entry.Location); |
581 | PrintMemoryEntry(&Entry); | 569 | PrintMemoryEntry(&Entry); |
582 | start = false; | 570 | start = false; |
583 | } | 571 | } |
584 | 572 | ||
585 | GSM_Terminate(); | 573 | GSM_Terminate(); |
586 | } | 574 | } |
587 | 575 | ||
588 | static void GetMemory(int argc, char *argv[]) | 576 | static void GetMemory(int argc, char *argv[]) |
589 | { | 577 | { |
590 | int j, start, stop; | 578 | int j, start, stop, emptynum = 0, fillednum = 0; |
591 | GSM_MemoryEntry entry; | 579 | GSM_MemoryEntry entry; |
580 | bool empty = true; | ||
592 | 581 | ||
593 | entry.MemoryType=0; | 582 | entry.MemoryType=0; |
594 | 583 | ||
595 | if (mystrncasecmp(argv[2],"DC",0)) entry.MemoryType=MEM_DC; | 584 | if (mystrncasecmp(argv[2],"DC",0)) entry.MemoryType=MEM_DC; |
596 | if (mystrncasecmp(argv[2],"ON",0)) entry.MemoryType=MEM_ON; | 585 | if (mystrncasecmp(argv[2],"ON",0)) entry.MemoryType=MEM_ON; |
597 | if (mystrncasecmp(argv[2],"RC",0)) entry.MemoryType=MEM_RC; | 586 | if (mystrncasecmp(argv[2],"RC",0)) entry.MemoryType=MEM_RC; |
598 | if (mystrncasecmp(argv[2],"MC",0)) entry.MemoryType=MEM_MC; | 587 | if (mystrncasecmp(argv[2],"MC",0)) entry.MemoryType=MEM_MC; |
599 | if (mystrncasecmp(argv[2],"ME",0)) entry.MemoryType=MEM_ME; | 588 | if (mystrncasecmp(argv[2],"ME",0)) entry.MemoryType=MEM_ME; |
600 | if (mystrncasecmp(argv[2],"SM",0)) entry.MemoryType=MEM_SM; | 589 | if (mystrncasecmp(argv[2],"SM",0)) entry.MemoryType=MEM_SM; |
601 | if (mystrncasecmp(argv[2],"VM",0)) entry.MemoryType=MEM_VM; | 590 | if (mystrncasecmp(argv[2],"VM",0)) entry.MemoryType=MEM_VM; |
602 | if (mystrncasecmp(argv[2],"FD",0)) entry.MemoryType=MEM_FD; | 591 | if (mystrncasecmp(argv[2],"FD",0)) entry.MemoryType=MEM_FD; |
603 | if (entry.MemoryType==0) { | 592 | if (entry.MemoryType==0) { |
604 | printmsg("ERROR: unknown memory type (\"%s\")\n",argv[2]); | 593 | printmsg("ERROR: unknown memory type (\"%s\")\n",argv[2]); |
605 | exit (-1); | 594 | exit (-1); |
606 | } | 595 | } |
607 | 596 | ||
608 | GetStartStop(&start, &stop, 3, argc, argv); | 597 | GetStartStop(&start, &stop, 3, argc, argv); |
609 | 598 | ||
599 | if (argc > 5 && strcmp(argv[5],"")) { | ||
600 | if (mystrncasecmp(argv[5],"-nonempty",0)) { | ||
601 | empty = false; | ||
602 | } else { | ||
603 | printmsg("ERROR: unknown parameter \"%s\"\n",argv[5]); | ||
604 | exit (-1); | ||
605 | } | ||
606 | } | ||
607 | |||
610 | GSM_Init(true); | 608 | GSM_Init(true); |
611 | 609 | ||
612 | if (!strcmp(s.Phone.Data.ModelInfo->model,"3310")) { | 610 | if (!strcmp(s.Phone.Data.ModelInfo->model,"3310")) { |
613 | if (s.Phone.Data.VerNum<=4.06) printmsg("WARNING: you will have null names in entries. Upgrade firmware in phone to higher than 4.06\n"); | 611 | if (s.Phone.Data.VerNum<=4.06) printmsg("WARNING: you will have null names in entries. Upgrade firmware in phone to higher than 4.06\n"); |
614 | } | 612 | } |
615 | 613 | ||
616 | for (j=start;j<=stop;j++) { | 614 | for (j=start;j<=stop;j++) { |
617 | printmsg("Memory %s, Location %i\n",argv[2],j); | 615 | if (empty) printmsg("Memory %s, Location %i\n",argv[2],j); |
618 | 616 | ||
619 | entry.Location=j; | 617 | entry.Location=j; |
620 | 618 | ||
621 | error=Phone->GetMemory(&s, &entry); | 619 | error=Phone->GetMemory(&s, &entry); |
622 | if (error != ERR_EMPTY) Print_Error(error); | 620 | if (error != ERR_EMPTY) Print_Error(error); |
623 | 621 | ||
624 | if (error == ERR_EMPTY) { | 622 | if (error == ERR_EMPTY) { |
625 | printmsg("Entry is empty\n"); | 623 | emptynum++; |
626 | printf("\n"); | 624 | if (empty) { |
625 | printmsg("Entry is empty\n"); | ||
626 | printf("\n"); | ||
627 | } | ||
627 | } else { | 628 | } else { |
629 | fillednum++; | ||
630 | if (!empty) printmsg("Memory %s, Location %i\n",argv[2],j); | ||
628 | PrintMemoryEntry(&entry); | 631 | PrintMemoryEntry(&entry); |
629 | } | 632 | } |
630 | } | 633 | } |
634 | |||
635 | printmsg("%i entries empty, %i entries filled\n",emptynum,fillednum); | ||
631 | 636 | ||
632 | GSM_Terminate(); | 637 | GSM_Terminate(); |
633 | } | 638 | } |
634 | 639 | ||
635 | #define MemoryLocationToString(x) ( \ | 640 | #define MemoryLocationToString(x) ( \ |
636 | x == MEM_ON ? "ON" : \ | 641 | x == MEM_ON ? "ON" : \ |
637 | x == MEM_RC ? "RC" : \ | 642 | x == MEM_RC ? "RC" : \ |
638 | x == MEM_MC ? "MC" : \ | 643 | x == MEM_MC ? "MC" : \ |
639 | x == MEM_ME ? "ME" : \ | 644 | x == MEM_ME ? "ME" : \ |
640 | x == MEM_SM ? "SM" : \ | 645 | x == MEM_SM ? "SM" : \ |
641 | x == MEM_VM ? "VM" : \ | 646 | x == MEM_VM ? "VM" : \ |
642 | x == MEM_FD ? "FD" : "XX") | 647 | x == MEM_FD ? "FD" : "XX") |
643 | 648 | ||
644 | static void SearchOneEntry(GSM_MemoryEntry *Entry, unsigned char *Text) | 649 | static void SearchOneEntry(GSM_MemoryEntry *Entry, unsigned char *Text) |
645 | { | 650 | { |
646 | int i; | 651 | int i; |
647 | 652 | ||
648 | for (i=0;i<Entry->EntriesNum;i++) { | 653 | for (i=0;i<Entry->EntriesNum;i++) { |
649 | switch (Entry->Entries[i].EntryType) { | 654 | switch (Entry->Entries[i].EntryType) { |
650 | case PBK_Number_General : | 655 | case PBK_Number_General : |
651 | case PBK_Number_Mobile : | 656 | case PBK_Number_Mobile : |
652 | case PBK_Number_Work : | 657 | case PBK_Number_Work : |
653 | case PBK_Number_Fax : | 658 | case PBK_Number_Fax : |
654 | case PBK_Number_Home : | 659 | case PBK_Number_Home : |
655 | case PBK_Number_Pager : | 660 | case PBK_Number_Pager : |
656 | case PBK_Number_Other : | 661 | case PBK_Number_Other : |
657 | case PBK_Text_Note : | 662 | case PBK_Text_Note : |
658 | case PBK_Text_Postal : | 663 | case PBK_Text_Postal : |
659 | case PBK_Text_Email : | 664 | case PBK_Text_Email : |
660 | case PBK_Text_Email2 : | 665 | case PBK_Text_Email2 : |
661 | case PBK_Text_URL : | 666 | case PBK_Text_URL : |
662 | case PBK_Text_Name : | 667 | case PBK_Text_Name : |
663 | case PBK_Text_LastName : | 668 | case PBK_Text_LastName : |
664 | case PBK_Text_FirstName : | 669 | case PBK_Text_FirstName : |
665 | case PBK_Text_Company : | 670 | case PBK_Text_Company : |
666 | case PBK_Text_JobTitle : | 671 | case PBK_Text_JobTitle : |
667 | case PBK_Text_StreetAddress : | 672 | case PBK_Text_StreetAddress : |
668 | case PBK_Text_City : | 673 | case PBK_Text_City : |
669 | case PBK_Text_State : | 674 | case PBK_Text_State : |
670 | case PBK_Text_Zip : | 675 | case PBK_Text_Zip : |
671 | case PBK_Text_Country : | 676 | case PBK_Text_Country : |
672 | case PBK_Text_Custom1 : | 677 | case PBK_Text_Custom1 : |
673 | case PBK_Text_Custom2 : | 678 | case PBK_Text_Custom2 : |
674 | case PBK_Text_Custom3 : | 679 | case PBK_Text_Custom3 : |
675 | case PBK_Text_Custom4 : | 680 | case PBK_Text_Custom4 : |
676 | case PBK_Caller_Group : | 681 | case PBK_Caller_Group : |
677 | if (mystrstr(Entry->Entries[i].Text, Text) != NULL) { | 682 | if (mywstrstr(Entry->Entries[i].Text, Text) != NULL) { |
678 | fprintf(stderr,"\n"); | 683 | fprintf(stderr,"\n"); |
679 | printmsg("Memory %s, Location %i\n",MemoryLocationToString(Entry->MemoryType),Entry->Location); | 684 | printmsg("Memory %s, Location %i\n",MemoryLocationToString(Entry->MemoryType),Entry->Location); |
680 | PrintMemoryEntry(Entry); | 685 | PrintMemoryEntry(Entry); |
681 | return; | 686 | return; |
682 | } | 687 | } |
683 | break; | 688 | break; |
684 | default: | 689 | default: |
685 | break; | 690 | break; |
686 | } | 691 | } |
687 | } | 692 | } |
688 | } | 693 | } |
689 | 694 | ||
690 | static void SearchOneMemory(GSM_MemoryType MemoryType, char *Title, unsigned char *Text) | 695 | static void SearchOneMemory(GSM_MemoryType MemoryType, char *Title, unsigned char *Text) |
691 | { | 696 | { |
692 | GSM_MemoryEntry Entry; | 697 | GSM_MemoryEntry Entry; |
693 | GSM_MemoryStatusStatus; | 698 | GSM_MemoryStatusStatus; |
694 | int i = 0, l = 1; | 699 | int i = 0, l = 1; |
695 | bool start = true; | 700 | bool start = true; |
696 | 701 | ||
697 | Status.MemoryType = MemoryType; | 702 | Status.MemoryType = MemoryType; |
698 | Entry.MemoryType = MemoryType; | 703 | Entry.MemoryType = MemoryType; |
699 | 704 | ||
700 | if (Phone->GetMemoryStatus(&s, &Status) == ERR_NONE) { | 705 | if (Phone->GetMemoryStatus(&s, &Status) == ERR_NONE) { |
701 | fprintf(stderr,"%c%s: %i%%", 13, Title, (i+1)*100/(Status.MemoryUsed+1)); | 706 | fprintf(stderr,"%c%s: %i%%", 13, Title, (i+1)*100/(Status.MemoryUsed+1)); |
@@ -803,152 +808,162 @@ static void ListMemoryCategory(int argc, char *argv[]) | |||
803 | } | 808 | } |
804 | 809 | ||
805 | if (Number) { | 810 | if (Number) { |
806 | j = atoi(argv[2]); | 811 | j = atoi(argv[2]); |
807 | if (j > 0) { | 812 | if (j > 0) { |
808 | ListMemoryCategoryEntries(j); | 813 | ListMemoryCategoryEntries(j); |
809 | } | 814 | } |
810 | } else { | 815 | } else { |
811 | if (Length > GSM_MAX_CATEGORY_NAME_LENGTH) { | 816 | if (Length > GSM_MAX_CATEGORY_NAME_LENGTH) { |
812 | printmsg("Search text too long, truncating to %d chars!\n", GSM_MAX_CATEGORY_NAME_LENGTH); | 817 | printmsg("Search text too long, truncating to %d chars!\n", GSM_MAX_CATEGORY_NAME_LENGTH); |
813 | Length = GSM_MAX_CATEGORY_NAME_LENGTH; | 818 | Length = GSM_MAX_CATEGORY_NAME_LENGTH; |
814 | } | 819 | } |
815 | EncodeUnicode(Text, argv[2], Length); | 820 | EncodeUnicode(Text, argv[2], Length); |
816 | 821 | ||
817 | Category.Type = Category_Phonebook; | 822 | Category.Type = Category_Phonebook; |
818 | Status.Type = Category_Phonebook; | 823 | Status.Type = Category_Phonebook; |
819 | 824 | ||
820 | if (Phone->GetCategoryStatus(&s, &Status) == ERR_NONE) { | 825 | if (Phone->GetCategoryStatus(&s, &Status) == ERR_NONE) { |
821 | for (count=0,j=1;count<Status.Used;j++) { | 826 | for (count=0,j=1;count<Status.Used;j++) { |
822 | Category.Location=j; | 827 | Category.Location=j; |
823 | error=Phone->GetCategory(&s, &Category); | 828 | error=Phone->GetCategory(&s, &Category); |
824 | 829 | ||
825 | if (error != ERR_EMPTY) { | 830 | if (error != ERR_EMPTY) { |
826 | count++; | 831 | count++; |
827 | if (mystrstr(Category.Name, Text) != NULL) { | 832 | if (mywstrstr(Category.Name, Text) != NULL) { |
828 | ListMemoryCategoryEntries(j); | 833 | ListMemoryCategoryEntries(j); |
829 | } | 834 | } |
830 | } | 835 | } |
831 | } | 836 | } |
832 | } | 837 | } |
833 | } | 838 | } |
834 | GSM_Terminate(); | 839 | GSM_Terminate(); |
835 | } | 840 | } |
836 | 841 | ||
837 | static void displaysinglesmsinfo(GSM_SMSMessage sms, bool displaytext, bool displayudh) | 842 | static void displaysinglesmsinfo(GSM_SMSMessage sms, bool displaytext, bool displayudh) |
838 | { | 843 | { |
839 | switch (sms.PDU) { | 844 | switch (sms.PDU) { |
840 | case SMS_Status_Report: | 845 | case SMS_Status_Report: |
841 | printmsg("SMS status report\n"); | 846 | printmsg("SMS status report\n"); |
842 | printmsg("Status : "); | 847 | printmsg("Status : "); |
843 | switch (sms.State) { | 848 | switch (sms.State) { |
844 | case SMS_Sent : printmsg("Sent");break; | 849 | case SMS_Sent : printmsg("Sent");break; |
845 | case SMS_Read : printmsg("Read");break; | 850 | case SMS_Read : printmsg("Read");break; |
846 | case SMS_UnRead : printmsg("UnRead");break; | 851 | case SMS_UnRead : printmsg("UnRead");break; |
847 | case SMS_UnSent : printmsg("UnSent");break; | 852 | case SMS_UnSent : printmsg("UnSent");break; |
848 | } | 853 | } |
849 | printmsg("\nRemote number : \"%s\"\n",DecodeUnicodeConsole(sms.Number)); | 854 | printmsg("\nRemote number : \"%s\"\n",DecodeUnicodeConsole(sms.Number)); |
850 | printmsg("Reference number: 0x%02X\n",sms.MessageReference); | 855 | printmsg("Reference number: %d\n",sms.MessageReference); |
851 | printmsg("Sent : %s\n",OSDateTime(sms.DateTime,true)); | 856 | printmsg("Sent : %s\n",OSDateTime(sms.DateTime,true)); |
852 | printmsg("SMSC number : \"%s\"\n",DecodeUnicodeConsole(sms.SMSC.Number)); | 857 | printmsg("SMSC number : \"%s\"\n",DecodeUnicodeConsole(sms.SMSC.Number)); |
853 | printmsg("SMSC response : %s\n",OSDateTime(sms.SMSCTime,true)); | 858 | printmsg("SMSC response : %s\n",OSDateTime(sms.SMSCTime,true)); |
854 | printmsg("Delivery status : %s\n",DecodeUnicodeConsole(sms.Text)); | 859 | printmsg("Delivery status : %s\n",DecodeUnicodeConsole(sms.Text)); |
855 | printmsg("Details : "); | 860 | printmsg("Details : "); |
856 | if (sms.DeliveryStatus & 0x40) { | 861 | if (sms.DeliveryStatus & 0x40) { |
857 | if (sms.DeliveryStatus & 0x20) { | 862 | if (sms.DeliveryStatus & 0x20) { |
858 | printmsg("Temporary error, "); | 863 | printmsg("Temporary error, "); |
859 | } else { | 864 | } else { |
860 | printmsg("Permanent error, "); | 865 | printmsg("Permanent error, "); |
861 | } | 866 | } |
862 | } else if (sms.DeliveryStatus & 0x20) { | 867 | } else if (sms.DeliveryStatus & 0x20) { |
863 | printmsg("Temporary error, "); | 868 | printmsg("Temporary error, "); |
864 | } | 869 | } |
865 | switch (sms.DeliveryStatus) { | 870 | switch (sms.DeliveryStatus) { |
866 | case 0x00: printmsg("SM received by the SME"); break; | 871 | case 0x00: printmsg("SM received by the SME"); break; |
867 | case 0x01: printmsg("SM forwarded by the SC to the SME but the SC is unable to confirm delivery");break; | 872 | case 0x01: printmsg("SM forwarded by the SC to the SME but the SC is unable to confirm delivery");break; |
868 | case 0x02: printmsg("SM replaced by the SC"); break; | 873 | case 0x02: printmsg("SM replaced by the SC"); break; |
869 | case 0x20: printmsg("Congestion"); break; | 874 | case 0x20: printmsg("Congestion"); break; |
870 | case 0x21: printmsg("SME busy"); break; | 875 | case 0x21: printmsg("SME busy"); break; |
871 | case 0x22: printmsg("No response from SME"); break; | 876 | case 0x22: printmsg("No response from SME"); break; |
872 | case 0x23: printmsg("Service rejected"); break; | 877 | case 0x23: printmsg("Service rejected"); break; |
873 | case 0x24: printmsg("Quality of service not aviable"); break; | 878 | case 0x24: printmsg("Quality of service not aviable"); break; |
874 | case 0x25: printmsg("Error in SME"); break; | 879 | case 0x25: printmsg("Error in SME"); break; |
875 | case 0x40: printmsg("Remote procedure error"); break; | 880 | case 0x40: printmsg("Remote procedure error"); break; |
876 | case 0x41: printmsg("Incompatibile destination"); break; | 881 | case 0x41: printmsg("Incompatibile destination"); break; |
877 | case 0x42: printmsg("Connection rejected by SME"); break; | 882 | case 0x42: printmsg("Connection rejected by SME"); break; |
878 | case 0x43: printmsg("Not obtainable"); break; | 883 | case 0x43: printmsg("Not obtainable"); break; |
879 | case 0x44: printmsg("Quality of service not available"); break; | 884 | case 0x44: printmsg("Quality of service not available"); break; |
880 | case 0x45: printmsg("No internetworking available"); break; | 885 | case 0x45: printmsg("No internetworking available"); break; |
881 | case 0x46: printmsg("SM Validity Period Expired"); break; | 886 | case 0x46: printmsg("SM Validity Period Expired"); break; |
882 | case 0x47: printmsg("SM deleted by originating SME"); break; | 887 | case 0x47: printmsg("SM deleted by originating SME"); break; |
883 | case 0x48: printmsg("SM Deleted by SC Administration"); break; | 888 | case 0x48: printmsg("SM Deleted by SC Administration"); break; |
884 | case 0x49: printmsg("SM does not exist"); break; | 889 | case 0x49: printmsg("SM does not exist"); break; |
885 | case 0x60: printmsg("Congestion"); break; | 890 | case 0x60: printmsg("Congestion"); break; |
886 | case 0x61: printmsg("SME busy"); break; | 891 | case 0x61: printmsg("SME busy"); break; |
887 | case 0x62: printmsg("No response from SME"); break; | 892 | case 0x62: printmsg("No response from SME"); break; |
888 | case 0x63: printmsg("Service rejected"); break; | 893 | case 0x63: printmsg("Service rejected"); break; |
889 | case 0x64: printmsg("Quality of service not available"); break; | 894 | case 0x64: printmsg("Quality of service not available"); break; |
890 | case 0x65: printmsg("Error in SME"); break; | 895 | case 0x65: printmsg("Error in SME"); break; |
891 | default : printmsg("Reserved/Specific to SC: %x",sms.DeliveryStatus);break; | 896 | default : printmsg("Reserved/Specific to SC: %x",sms.DeliveryStatus);break; |
892 | } | 897 | } |
893 | printf("\n"); | 898 | printf("\n"); |
894 | break; | 899 | break; |
895 | case SMS_Deliver: | 900 | case SMS_Deliver: |
896 | printmsg("SMS message\n"); | 901 | printmsg("SMS message\n"); |
897 | printmsg("SMSC number : \"%s\"",DecodeUnicodeConsole(sms.SMSC.Number)); | 902 | if (sms.State==SMS_UnSent && sms.Memory==MEM_ME) { |
898 | if (sms.ReplyViaSameSMSC) printmsg(" (set for reply)"); | 903 | printmsg("Saved : %s\n",OSDateTime(sms.DateTime,true)); |
899 | printmsg("\nSent : %s\n",OSDateTime(sms.DateTime,true)); | 904 | } else { |
905 | printmsg("SMSC number : \"%s\"",DecodeUnicodeConsole(sms.SMSC.Number)); | ||
906 | if (sms.ReplyViaSameSMSC) printmsg(" (set for reply)"); | ||
907 | printmsg("\nSent : %s\n",OSDateTime(sms.DateTime,true)); | ||
908 | } | ||
900 | /* No break. The only difference for SMS_Deliver and SMS_Submit is, | 909 | /* No break. The only difference for SMS_Deliver and SMS_Submit is, |
901 | * that SMS_Deliver contains additional data. We wrote them and then go | 910 | * that SMS_Deliver contains additional data. We wrote them and then go |
902 | * for data shared with SMS_Submit | 911 | * for data shared with SMS_Submit |
903 | */ | 912 | */ |
904 | case SMS_Submit: | 913 | case SMS_Submit: |
905 | if (sms.ReplaceMessage != 0) printmsg("SMS replacing ID : %i\n",sms.ReplaceMessage); | 914 | if (sms.ReplaceMessage != 0) printmsg("SMS replacing ID : %i\n",sms.ReplaceMessage); |
906 | /* If we went here from "case SMS_Deliver", we don't write "SMS Message" */ | 915 | /* If we went here from "case SMS_Deliver", we don't write "SMS Message" */ |
907 | if (sms.PDU==SMS_Submit) { | 916 | if (sms.PDU==SMS_Submit) { |
908 | printmsg("SMS message\n"); | 917 | printmsg("SMS message\n"); |
909 | printmsg("Reference number : 0x%02X\n",sms.MessageReference); | 918 | if (sms.State==SMS_UnSent && sms.Memory==MEM_ME) { |
919 | } else { | ||
920 | printmsg("Reference number : %d\n",sms.MessageReference); | ||
921 | } | ||
910 | } | 922 | } |
911 | if (sms.Name[0] != 0x00 || sms.Name[1] != 0x00) { | 923 | if (sms.Name[0] != 0x00 || sms.Name[1] != 0x00) { |
912 | printmsg("Name : \"%s\"\n",DecodeUnicodeConsole(sms.Name)); | 924 | printmsg("Name : \"%s\"\n",DecodeUnicodeConsole(sms.Name)); |
913 | } | 925 | } |
914 | if (sms.Class != -1) { | 926 | if (sms.Class != -1) { |
915 | printmsg("Class : %i\n",sms.Class); | 927 | printmsg("Class : %i\n",sms.Class); |
916 | } | 928 | } |
917 | printmsg("Coding : "); | 929 | printmsg("Coding : "); |
918 | switch (sms.Coding) { | 930 | switch (sms.Coding) { |
919 | case SMS_Coding_Unicode : printmsg("Unicode\n"); break; | 931 | case SMS_Coding_Unicode : printmsg("Unicode\n"); break; |
920 | case SMS_Coding_Default : printmsg("Default GSM alphabet\n");break; | 932 | case SMS_Coding_Default : printmsg("Default GSM alphabet\n");break; |
921 | case SMS_Coding_8bit : printmsg("8 bit\n"); break; | 933 | case SMS_Coding_8bit : printmsg("8 bit\n"); break; |
922 | } | 934 | } |
935 | if (sms.State==SMS_UnSent && sms.Memory==MEM_ME) { | ||
936 | } else { | ||
937 | printmsg("Remote number : \"%s\"\n",DecodeUnicodeConsole(sms.Number)); | ||
938 | } | ||
923 | printmsg("Status : "); | 939 | printmsg("Status : "); |
924 | switch (sms.State) { | 940 | switch (sms.State) { |
925 | case SMS_Sent : printmsg("Sent");break; | 941 | case SMS_Sent : printmsg("Sent\n");break; |
926 | case SMS_Read : printmsg("Read");break; | 942 | case SMS_Read : printmsg("Read\n");break; |
927 | case SMS_UnRead : printmsg("UnRead");break; | 943 | case SMS_UnRead : printmsg("UnRead\n");break; |
928 | case SMS_UnSent : printmsg("UnSent");break; | 944 | case SMS_UnSent : printmsg("UnSent\n");break; |
929 | } | 945 | } |
930 | printmsg("\nRemote number : \"%s\"\n",DecodeUnicodeConsole(sms.Number)); | ||
931 | if (sms.UDH.Type != UDH_NoUDH) { | 946 | if (sms.UDH.Type != UDH_NoUDH) { |
932 | printmsg("User Data Header : "); | 947 | printmsg("User Data Header : "); |
933 | switch (sms.UDH.Type) { | 948 | switch (sms.UDH.Type) { |
934 | case UDH_ConcatenatedMessages : printmsg("Concatenated (linked) message"); break; | 949 | case UDH_ConcatenatedMessages : printmsg("Concatenated (linked) message"); break; |
935 | case UDH_ConcatenatedMessages16bit : printmsg("Concatenated (linked) message"); break; | 950 | case UDH_ConcatenatedMessages16bit : printmsg("Concatenated (linked) message"); break; |
936 | case UDH_DisableVoice : printmsg("Disables voice indicator"); break; | 951 | case UDH_DisableVoice : printmsg("Disables voice indicator"); break; |
937 | case UDH_EnableVoice : printmsg("Enables voice indicator"); break; | 952 | case UDH_EnableVoice : printmsg("Enables voice indicator"); break; |
938 | case UDH_DisableFax : printmsg("Disables fax indicator"); break; | 953 | case UDH_DisableFax : printmsg("Disables fax indicator"); break; |
939 | case UDH_EnableFax : printmsg("Enables fax indicator"); break; | 954 | case UDH_EnableFax : printmsg("Enables fax indicator"); break; |
940 | case UDH_DisableEmail : printmsg("Disables email indicator"); break; | 955 | case UDH_DisableEmail : printmsg("Disables email indicator"); break; |
941 | case UDH_EnableEmail : printmsg("Enables email indicator"); break; | 956 | case UDH_EnableEmail : printmsg("Enables email indicator"); break; |
942 | case UDH_VoidSMS : printmsg("Void SMS"); break; | 957 | case UDH_VoidSMS : printmsg("Void SMS"); break; |
943 | case UDH_NokiaWAP : printmsg("Nokia WAP bookmark"); break; | 958 | case UDH_NokiaWAP : printmsg("Nokia WAP bookmark"); break; |
944 | case UDH_NokiaOperatorLogoLong : printmsg("Nokia operator logo"); break; | 959 | case UDH_NokiaOperatorLogoLong : printmsg("Nokia operator logo"); break; |
945 | case UDH_NokiaWAPLong : printmsg("Nokia WAP bookmark or WAP/MMS settings"); break; | 960 | case UDH_NokiaWAPLong : printmsg("Nokia WAP bookmark or WAP/MMS settings"); break; |
946 | case UDH_NokiaRingtone : printmsg("Nokia ringtone"); break; | 961 | case UDH_NokiaRingtone : printmsg("Nokia ringtone"); break; |
947 | case UDH_NokiaRingtoneLong : printmsg("Nokia ringtone"); break; | 962 | case UDH_NokiaRingtoneLong : printmsg("Nokia ringtone"); break; |
948 | case UDH_NokiaOperatorLogo : printmsg("Nokia GSM operator logo"); break; | 963 | case UDH_NokiaOperatorLogo : printmsg("Nokia GSM operator logo"); break; |
949 | case UDH_NokiaCallerLogo : printmsg("Nokia caller logo"); break; | 964 | case UDH_NokiaCallerLogo : printmsg("Nokia caller logo"); break; |
950 | case UDH_NokiaProfileLong : printmsg("Nokia profile"); break; | 965 | case UDH_NokiaProfileLong : printmsg("Nokia profile"); break; |
951 | case UDH_NokiaCalendarLong : printmsg("Nokia calendar note"); break; | 966 | case UDH_NokiaCalendarLong : printmsg("Nokia calendar note"); break; |
952 | case UDH_NokiaPhonebookLong : printmsg("Nokia phonebook entry"); break; | 967 | case UDH_NokiaPhonebookLong : printmsg("Nokia phonebook entry"); break; |
953 | case UDH_UserUDH : printmsg("User UDH"); break; | 968 | case UDH_UserUDH : printmsg("User UDH"); break; |
954 | case UDH_MMSIndicatorLong : printmsg("MMS indicator"); break; | 969 | case UDH_MMSIndicatorLong : printmsg("MMS indicator"); break; |
@@ -957,49 +972,49 @@ static void displaysinglesmsinfo(GSM_SMSMessage sms, bool displaytext, bool disp | |||
957 | if (sms.UDH.Type != UDH_NoUDH) { | 972 | if (sms.UDH.Type != UDH_NoUDH) { |
958 | if (sms.UDH.ID8bit != -1) printmsg(", ID (8 bit) %i",sms.UDH.ID8bit); | 973 | if (sms.UDH.ID8bit != -1) printmsg(", ID (8 bit) %i",sms.UDH.ID8bit); |
959 | if (sms.UDH.ID16bit != -1) printmsg(", ID (16 bit) %i",sms.UDH.ID16bit); | 974 | if (sms.UDH.ID16bit != -1) printmsg(", ID (16 bit) %i",sms.UDH.ID16bit); |
960 | if (sms.UDH.PartNumber != -1 && sms.UDH.AllParts != -1) { | 975 | if (sms.UDH.PartNumber != -1 && sms.UDH.AllParts != -1) { |
961 | if (displayudh) { | 976 | if (displayudh) { |
962 | printmsg(", part %i of %i",sms.UDH.PartNumber,sms.UDH.AllParts); | 977 | printmsg(", part %i of %i",sms.UDH.PartNumber,sms.UDH.AllParts); |
963 | } else { | 978 | } else { |
964 | printmsg(", %i parts",sms.UDH.AllParts); | 979 | printmsg(", %i parts",sms.UDH.AllParts); |
965 | } | 980 | } |
966 | } | 981 | } |
967 | } | 982 | } |
968 | printf("\n"); | 983 | printf("\n"); |
969 | } | 984 | } |
970 | if (displaytext) { | 985 | if (displaytext) { |
971 | printf("\n"); | 986 | printf("\n"); |
972 | if (sms.Coding!=SMS_Coding_8bit) { | 987 | if (sms.Coding!=SMS_Coding_8bit) { |
973 | printmsg("%s\n",DecodeUnicodeConsole(sms.Text)); | 988 | printmsg("%s\n",DecodeUnicodeConsole(sms.Text)); |
974 | } else { | 989 | } else { |
975 | printmsg("8 bit SMS, cannot be displayed here\n"); | 990 | printmsg("8 bit SMS, cannot be displayed here\n"); |
976 | } | 991 | } |
977 | } | 992 | } |
978 | break; | 993 | break; |
979 | } | 994 | } |
980 | } | 995 | } |
981 | //#if 0 | 996 | |
982 | static void displaymultismsinfo (GSM_MultiSMSMessage sms, bool eachsms, bool ems) | 997 | static void displaymultismsinfo (GSM_MultiSMSMessage sms, bool eachsms, bool ems) |
983 | { | 998 | { |
984 | GSM_MultiPartSMSInfoSMSInfo; | 999 | GSM_MultiPartSMSInfoSMSInfo; |
985 | bool RetVal,udhinfo=true; | 1000 | bool RetVal,udhinfo=true; |
986 | int j; | 1001 | int j; |
987 | 1002 | ||
988 | /* GSM_DecodeMultiPartSMS returns if decoded SMS contenst correctly */ | 1003 | /* GSM_DecodeMultiPartSMS returns if decoded SMS contenst correctly */ |
989 | RetVal = GSM_DecodeMultiPartSMS(&SMSInfo,&sms,ems); | 1004 | RetVal = GSM_DecodeMultiPartSMS(&SMSInfo,&sms,ems); |
990 | 1005 | ||
991 | if (eachsms) { | 1006 | if (eachsms) { |
992 | if (sms.SMS[0].UDH.Type != UDH_NoUDH && sms.SMS[0].UDH.AllParts == sms.Number) udhinfo = false; | 1007 | if (sms.SMS[0].UDH.Type != UDH_NoUDH && sms.SMS[0].UDH.AllParts == sms.Number) udhinfo = false; |
993 | if (RetVal && !udhinfo) { | 1008 | if (RetVal && !udhinfo) { |
994 | displaysinglesmsinfo(sms.SMS[0],false,false); | 1009 | displaysinglesmsinfo(sms.SMS[0],false,false); |
995 | printf("\n"); | 1010 | printf("\n"); |
996 | } else { | 1011 | } else { |
997 | for (j=0;j<sms.Number;j++) { | 1012 | for (j=0;j<sms.Number;j++) { |
998 | displaysinglesmsinfo(sms.SMS[j],!RetVal,udhinfo); | 1013 | displaysinglesmsinfo(sms.SMS[j],!RetVal,udhinfo); |
999 | printf("\n"); | 1014 | printf("\n"); |
1000 | } | 1015 | } |
1001 | } | 1016 | } |
1002 | } else { | 1017 | } else { |
1003 | for (j=0;j<sms.Number;j++) { | 1018 | for (j=0;j<sms.Number;j++) { |
1004 | displaysinglesmsinfo(sms.SMS[j],!RetVal,true); | 1019 | displaysinglesmsinfo(sms.SMS[j],!RetVal,true); |
1005 | printf("\n"); | 1020 | printf("\n"); |
@@ -1264,56 +1279,63 @@ static void Monitor(int argc, char *argv[]) | |||
1264 | case GSM_RoamingNetwork : printmsg("roaming network\n"); break; | 1279 | case GSM_RoamingNetwork : printmsg("roaming network\n"); break; |
1265 | case GSM_RequestingNetwork : printmsg("requesting network\n"); break; | 1280 | case GSM_RequestingNetwork : printmsg("requesting network\n"); break; |
1266 | case GSM_NoNetwork : printmsg("not logged into network\n"); break; | 1281 | case GSM_NoNetwork : printmsg("not logged into network\n"); break; |
1267 | case GSM_RegistrationDenied : printmsg("registration to network denied\n");break; | 1282 | case GSM_RegistrationDenied : printmsg("registration to network denied\n");break; |
1268 | case GSM_NetworkStatusUnknown : printmsg("unknown\n"); break; | 1283 | case GSM_NetworkStatusUnknown : printmsg("unknown\n"); break; |
1269 | default : printmsg("unknown\n"); | 1284 | default : printmsg("unknown\n"); |
1270 | } | 1285 | } |
1271 | if (NetInfo.State == GSM_HomeNetwork || NetInfo.State == GSM_RoamingNetwork) { | 1286 | if (NetInfo.State == GSM_HomeNetwork || NetInfo.State == GSM_RoamingNetwork) { |
1272 | printmsg("Network : %s (%s",NetInfo.NetworkCode,DecodeUnicodeConsole(GSM_GetNetworkName(NetInfo.NetworkCode))); | 1287 | printmsg("Network : %s (%s",NetInfo.NetworkCode,DecodeUnicodeConsole(GSM_GetNetworkName(NetInfo.NetworkCode))); |
1273 | printmsg(", %s)", DecodeUnicodeConsole(GSM_GetCountryName(NetInfo.NetworkCode))); | 1288 | printmsg(", %s)", DecodeUnicodeConsole(GSM_GetCountryName(NetInfo.NetworkCode))); |
1274 | printmsg(", LAC %s, CID %s\n", NetInfo.LAC,NetInfo.CID); | 1289 | printmsg(", LAC %s, CID %s\n", NetInfo.LAC,NetInfo.CID); |
1275 | if (NetInfo.NetworkName[0] != 0x00 || NetInfo.NetworkName[1] != 0x00) { | 1290 | if (NetInfo.NetworkName[0] != 0x00 || NetInfo.NetworkName[1] != 0x00) { |
1276 | printmsg("Name in phone : \"%s\"\n",DecodeUnicodeConsole(NetInfo.NetworkName)); | 1291 | printmsg("Name in phone : \"%s\"\n",DecodeUnicodeConsole(NetInfo.NetworkName)); |
1277 | } | 1292 | } |
1278 | } | 1293 | } |
1279 | } | 1294 | } |
1280 | printf("\n"); | 1295 | printf("\n"); |
1281 | } | 1296 | } |
1282 | 1297 | ||
1283 | printmsg("Leaving monitor mode...\n"); | 1298 | printmsg("Leaving monitor mode...\n"); |
1284 | 1299 | ||
1285 | GSM_Terminate(); | 1300 | GSM_Terminate(); |
1286 | } | 1301 | } |
1287 | 1302 | ||
1303 | static void IncomingUSSD2(char *Device, char *Buffer) | ||
1304 | { | ||
1305 | printmsg("Service reply: \"%s\"\n",DecodeUnicodeConsole(Buffer)); | ||
1306 | |||
1307 | gshutdown = true; | ||
1308 | } | ||
1309 | |||
1288 | static void GetUSSD(int argc, char *argv[]) | 1310 | static void GetUSSD(int argc, char *argv[]) |
1289 | { | 1311 | { |
1290 | GSM_Init(true); | 1312 | GSM_Init(true); |
1291 | 1313 | ||
1292 | signal(SIGINT, interrupt); | 1314 | signal(SIGINT, interrupt); |
1293 | printmsgerr("Press Ctrl+C to break...\n"); | 1315 | printmsgerr("Press Ctrl+C to break...\n"); |
1294 | 1316 | ||
1295 | s.User.IncomingUSSD = IncomingUSSD; | 1317 | s.User.IncomingUSSD = IncomingUSSD2; |
1296 | 1318 | ||
1297 | error=Phone->SetIncomingUSSD(&s,true); | 1319 | error=Phone->SetIncomingUSSD(&s,true); |
1298 | Print_Error(error); | 1320 | Print_Error(error); |
1299 | 1321 | ||
1300 | error=Phone->DialVoice(&s, argv[2], GSM_CALL_DefaultNumberPresence); | 1322 | error=Phone->DialVoice(&s, argv[2], GSM_CALL_DefaultNumberPresence); |
1301 | Print_Error(error); | 1323 | Print_Error(error); |
1302 | 1324 | ||
1303 | while (!gshutdown) GSM_ReadDevice(&s,true); | 1325 | while (!gshutdown) GSM_ReadDevice(&s,true); |
1304 | 1326 | ||
1305 | GSM_Terminate(); | 1327 | GSM_Terminate(); |
1306 | } | 1328 | } |
1307 | 1329 | ||
1308 | static void GetSMSC(int argc, char *argv[]) | 1330 | static void GetSMSC(int argc, char *argv[]) |
1309 | { | 1331 | { |
1310 | GSM_SMSC smsc; | 1332 | GSM_SMSC smsc; |
1311 | int start, stop; | 1333 | int start, stop; |
1312 | 1334 | ||
1313 | GetStartStop(&start, &stop, 2, argc, argv); | 1335 | GetStartStop(&start, &stop, 2, argc, argv); |
1314 | 1336 | ||
1315 | GSM_Init(true); | 1337 | GSM_Init(true); |
1316 | 1338 | ||
1317 | for (i=start;i<=stop;i++) { | 1339 | for (i=start;i<=stop;i++) { |
1318 | smsc.Location=i; | 1340 | smsc.Location=i; |
1319 | 1341 | ||
@@ -1324,49 +1346,58 @@ static void GetSMSC(int argc, char *argv[]) | |||
1324 | printmsg("%i. Set %i\n",smsc.Location, smsc.Location); | 1346 | printmsg("%i. Set %i\n",smsc.Location, smsc.Location); |
1325 | } else { | 1347 | } else { |
1326 | printmsg("%i. \"%s\"\n",smsc.Location, DecodeUnicodeConsole(smsc.Name)); | 1348 | printmsg("%i. \"%s\"\n",smsc.Location, DecodeUnicodeConsole(smsc.Name)); |
1327 | } | 1349 | } |
1328 | printmsg("Number : \"%s\"\n",DecodeUnicodeConsole(smsc.Number)); | 1350 | printmsg("Number : \"%s\"\n",DecodeUnicodeConsole(smsc.Number)); |
1329 | printmsg("Default number : \"%s\"\n",DecodeUnicodeConsole(smsc.DefaultNumber)); | 1351 | printmsg("Default number : \"%s\"\n",DecodeUnicodeConsole(smsc.DefaultNumber)); |
1330 | 1352 | ||
1331 | printmsg("Format : "); | 1353 | printmsg("Format : "); |
1332 | switch (smsc.Format) { | 1354 | switch (smsc.Format) { |
1333 | case SMS_FORMAT_Text : printmsg("Text");break; | 1355 | case SMS_FORMAT_Text : printmsg("Text");break; |
1334 | case SMS_FORMAT_Fax : printmsg("Fax");break; | 1356 | case SMS_FORMAT_Fax : printmsg("Fax");break; |
1335 | case SMS_FORMAT_Email : printmsg("Email");break; | 1357 | case SMS_FORMAT_Email : printmsg("Email");break; |
1336 | case SMS_FORMAT_Pager : printmsg("Pager");break; | 1358 | case SMS_FORMAT_Pager : printmsg("Pager");break; |
1337 | } | 1359 | } |
1338 | printf("\n"); | 1360 | printf("\n"); |
1339 | 1361 | ||
1340 | printmsg("Validity : "); | 1362 | printmsg("Validity : "); |
1341 | switch (smsc.Validity.Relative) { | 1363 | switch (smsc.Validity.Relative) { |
1342 | case SMS_VALID_1_Hour : printmsg("1 hour"); break; | 1364 | case SMS_VALID_1_Hour : printmsg("1 hour"); break; |
1343 | case SMS_VALID_6_Hours : printmsg("6 hours"); break; | 1365 | case SMS_VALID_6_Hours : printmsg("6 hours"); break; |
1344 | case SMS_VALID_1_Day : printmsg("24 hours"); break; | 1366 | case SMS_VALID_1_Day : printmsg("24 hours"); break; |
1345 | case SMS_VALID_3_Days : printmsg("72 hours"); break; | 1367 | case SMS_VALID_3_Days : printmsg("72 hours"); break; |
1346 | case SMS_VALID_1_Week : printmsg("1 week"); break; | 1368 | case SMS_VALID_1_Week : printmsg("1 week"); break; |
1347 | case SMS_VALID_Max_Time: printmsg("Maximum time"); break; | 1369 | case SMS_VALID_Max_Time: printmsg("Maximum time"); break; |
1348 | default : printmsg("Unknown"); | 1370 | default : |
1371 | if (smsc.Validity.Relative >= 0 && smsc.Validity.Relative <= 143) { | ||
1372 | printmsg("%i minutes",(smsc.Validity.Relative+1)*5); | ||
1373 | } else if (smsc.Validity.Relative >= 144 && smsc.Validity.Relative <= 167) { | ||
1374 | printmsg("%i minutes",12*60 + (smsc.Validity.Relative-143)*30); | ||
1375 | } else if (smsc.Validity.Relative >= 168 && smsc.Validity.Relative <= 196) { | ||
1376 | printmsg("%i days",smsc.Validity.Relative-166); | ||
1377 | } else if (smsc.Validity.Relative >= 197 && smsc.Validity.Relative <= 255) { | ||
1378 | printmsg("%i weeks",smsc.Validity.Relative-192); | ||
1379 | } | ||
1349 | } | 1380 | } |
1350 | printf("\n"); | 1381 | printf("\n"); |
1351 | } | 1382 | } |
1352 | 1383 | ||
1353 | GSM_Terminate(); | 1384 | GSM_Terminate(); |
1354 | } | 1385 | } |
1355 | 1386 | ||
1356 | static void GetSMS(int argc, char *argv[]) | 1387 | static void GetSMS(int argc, char *argv[]) |
1357 | { | 1388 | { |
1358 | GSM_MultiSMSMessagesms; | 1389 | GSM_MultiSMSMessagesms; |
1359 | GSM_SMSFolders folders; | 1390 | GSM_SMSFolders folders; |
1360 | int start, stop; | 1391 | int start, stop; |
1361 | int j; | 1392 | int j; |
1362 | 1393 | ||
1363 | GetStartStop(&start, &stop, 3, argc, argv); | 1394 | GetStartStop(&start, &stop, 3, argc, argv); |
1364 | 1395 | ||
1365 | GSM_Init(true); | 1396 | GSM_Init(true); |
1366 | 1397 | ||
1367 | error=Phone->GetSMSFolders(&s, &folders); | 1398 | error=Phone->GetSMSFolders(&s, &folders); |
1368 | Print_Error(error); | 1399 | Print_Error(error); |
1369 | 1400 | ||
1370 | for (j = start; j <= stop; j++) { | 1401 | for (j = start; j <= stop; j++) { |
1371 | sms.SMS[0].Folder= atoi(argv[2]); | 1402 | sms.SMS[0].Folder= atoi(argv[2]); |
1372 | sms.SMS[0].Location= j; | 1403 | sms.SMS[0].Location= j; |
@@ -1407,69 +1438,67 @@ static void DeleteSMS(int argc, char *argv[]) | |||
1407 | 1438 | ||
1408 | for (i=start;i<=stop;i++) { | 1439 | for (i=start;i<=stop;i++) { |
1409 | sms.Folder= 0; | 1440 | sms.Folder= 0; |
1410 | sms.Location= i; | 1441 | sms.Location= i; |
1411 | error=Phone->DeleteSMS(&s, &sms); | 1442 | error=Phone->DeleteSMS(&s, &sms); |
1412 | Print_Error(error); | 1443 | Print_Error(error); |
1413 | } | 1444 | } |
1414 | #ifdef GSM_ENABLE_BEEP | 1445 | #ifdef GSM_ENABLE_BEEP |
1415 | GSM_PhoneBeep(); | 1446 | GSM_PhoneBeep(); |
1416 | #endif | 1447 | #endif |
1417 | GSM_Terminate(); | 1448 | GSM_Terminate(); |
1418 | } | 1449 | } |
1419 | 1450 | ||
1420 | static void GetAllSMS(int argc, char *argv[]) | 1451 | static void GetAllSMS(int argc, char *argv[]) |
1421 | { | 1452 | { |
1422 | GSM_MultiSMSMessage sms; | 1453 | GSM_MultiSMSMessage sms; |
1423 | GSM_SMSFolders folders; | 1454 | GSM_SMSFolders folders; |
1424 | bool start = true; | 1455 | bool start = true; |
1425 | 1456 | ||
1426 | GSM_Init(true); | 1457 | GSM_Init(true); |
1427 | 1458 | ||
1428 | error=Phone->GetSMSFolders(&s, &folders); | 1459 | error=Phone->GetSMSFolders(&s, &folders); |
1429 | Print_Error(error); | 1460 | Print_Error(error); |
1430 | 1461 | ||
1431 | fprintf(stderr,"Reading: "); | ||
1432 | while (error == ERR_NONE) { | 1462 | while (error == ERR_NONE) { |
1433 | sms.SMS[0].Folder=0x00; | 1463 | sms.SMS[0].Folder=0x00; |
1434 | error=Phone->GetNextSMS(&s, &sms, start); | 1464 | error=Phone->GetNextSMS(&s, &sms, start); |
1435 | switch (error) { | 1465 | switch (error) { |
1436 | case ERR_EMPTY: | 1466 | case ERR_EMPTY: |
1437 | break; | 1467 | break; |
1438 | default: | 1468 | default: |
1439 | Print_Error(error); | 1469 | Print_Error(error); |
1440 | printmsg("Location %i, folder \"%s\"",sms.SMS[0].Location,DecodeUnicodeConsole(folders.Folder[sms.SMS[0].Folder-1].Name)); | 1470 | printmsg("Location %i, folder \"%s\"",sms.SMS[0].Location,DecodeUnicodeConsole(folders.Folder[sms.SMS[0].Folder-1].Name)); |
1441 | switch(sms.SMS[0].Memory) { | 1471 | switch(sms.SMS[0].Memory) { |
1442 | case MEM_SM: printmsg(", SIM memory"); break; | 1472 | case MEM_SM: printmsg(", SIM memory"); break; |
1443 | case MEM_ME: printmsg(", phone memory"); break; | 1473 | case MEM_ME: printmsg(", phone memory"); break; |
1444 | case MEM_MT: printmsg(", phone or SIM memory"); break; | 1474 | case MEM_MT: printmsg(", phone or SIM memory"); break; |
1445 | default : break; | 1475 | default : break; |
1446 | } | 1476 | } |
1447 | if (sms.SMS[0].InboxFolder) printmsg(", Inbox folder"); | 1477 | if (sms.SMS[0].InboxFolder) printmsg(", Inbox folder"); |
1448 | printf("\n"); | 1478 | printf("\n"); |
1449 | displaymultismsinfo(sms,false,false); | 1479 | displaymultismsinfo(sms,false,false); |
1450 | } | 1480 | } |
1451 | fprintf(stderr,"*"); | ||
1452 | start=false; | 1481 | start=false; |
1453 | } | 1482 | } |
1454 | fprintf(stderr,"\n"); | 1483 | fprintf(stderr,"\n"); |
1455 | 1484 | ||
1456 | #ifdef GSM_ENABLE_BEEP | 1485 | #ifdef GSM_ENABLE_BEEP |
1457 | GSM_PhoneBeep(); | 1486 | GSM_PhoneBeep(); |
1458 | #endif | 1487 | #endif |
1459 | GSM_Terminate(); | 1488 | GSM_Terminate(); |
1460 | } | 1489 | } |
1461 | 1490 | ||
1462 | static void GetEachSMS(int argc, char *argv[]) | 1491 | static void GetEachSMS(int argc, char *argv[]) |
1463 | { | 1492 | { |
1464 | GSM_MultiSMSMessage*GetSMS[PHONE_MAXSMSINFOLDER],*SortedSMS[PHONE_MAXSMSINFOLDER],sms; | 1493 | GSM_MultiSMSMessage*GetSMS[PHONE_MAXSMSINFOLDER],*SortedSMS[PHONE_MAXSMSINFOLDER],sms; |
1465 | int GetSMSNumber = 0,i,j; | 1494 | int GetSMSNumber = 0,i,j; |
1466 | GSM_SMSFolders folders; | 1495 | GSM_SMSFolders folders; |
1467 | bool start = true, ems = true; | 1496 | bool start = true, ems = true; |
1468 | 1497 | ||
1469 | GetSMS[0] = NULL; | 1498 | GetSMS[0] = NULL; |
1470 | 1499 | ||
1471 | GSM_Init(true); | 1500 | GSM_Init(true); |
1472 | 1501 | ||
1473 | error=Phone->GetSMSFolders(&s, &folders); | 1502 | error=Phone->GetSMSFolders(&s, &folders); |
1474 | Print_Error(error); | 1503 | Print_Error(error); |
1475 | 1504 | ||
@@ -1558,49 +1587,50 @@ static void GetSMSFolders(int argc, char *argv[]) | |||
1558 | } | 1587 | } |
1559 | 1588 | ||
1560 | GSM_Terminate(); | 1589 | GSM_Terminate(); |
1561 | } | 1590 | } |
1562 | 1591 | ||
1563 | static void GetRingtone(int argc, char *argv[]) | 1592 | static void GetRingtone(int argc, char *argv[]) |
1564 | { | 1593 | { |
1565 | GSM_Ringtone ringtone; | 1594 | GSM_Ringtone ringtone; |
1566 | bool PhoneRingtone = false; | 1595 | bool PhoneRingtone = false; |
1567 | 1596 | ||
1568 | if (mystrncasecmp(argv[1],"--getphoneringtone",0)) PhoneRingtone = true; | 1597 | if (mystrncasecmp(argv[1],"--getphoneringtone",0)) PhoneRingtone = true; |
1569 | 1598 | ||
1570 | GetStartStop(&ringtone.Location, NULL, 2, argc, argv); | 1599 | GetStartStop(&ringtone.Location, NULL, 2, argc, argv); |
1571 | 1600 | ||
1572 | GSM_Init(true); | 1601 | GSM_Init(true); |
1573 | 1602 | ||
1574 | ringtone.Format=0; | 1603 | ringtone.Format=0; |
1575 | 1604 | ||
1576 | error=Phone->GetRingtone(&s,&ringtone,PhoneRingtone); | 1605 | error=Phone->GetRingtone(&s,&ringtone,PhoneRingtone); |
1577 | Print_Error(error); | 1606 | Print_Error(error); |
1578 | 1607 | ||
1579 | switch (ringtone.Format) { | 1608 | switch (ringtone.Format) { |
1580 | case RING_NOTETONE : printmsg("Smart Messaging");break; | 1609 | case RING_NOTETONE : printmsg("Smart Messaging");break; |
1581 | case RING_NOKIABINARY : printmsg("Nokia binary");break; | 1610 | case RING_NOKIABINARY : printmsg("Nokia binary");break; |
1582 | case RING_MIDI : printmsg("Midi format");break; | 1611 | case RING_MIDI : printmsg("MIDI"); break; |
1612 | case RING_MMF : printmsg("SMAF (MMF)");break; | ||
1583 | } | 1613 | } |
1584 | printmsg(" format, ringtone \"%s\"\n",DecodeUnicodeConsole(ringtone.Name)); | 1614 | printmsg(" format, ringtone \"%s\"\n",DecodeUnicodeConsole(ringtone.Name)); |
1585 | 1615 | ||
1586 | if (argc==4) { | 1616 | if (argc==4) { |
1587 | error=GSM_SaveRingtoneFile(argv[3], &ringtone); | 1617 | error=GSM_SaveRingtoneFile(argv[3], &ringtone); |
1588 | Print_Error(error); | 1618 | Print_Error(error); |
1589 | } | 1619 | } |
1590 | 1620 | ||
1591 | GSM_Terminate(); | 1621 | GSM_Terminate(); |
1592 | } | 1622 | } |
1593 | 1623 | ||
1594 | static void GetRingtonesList(int argc, char *argv[]) | 1624 | static void GetRingtonesList(int argc, char *argv[]) |
1595 | { | 1625 | { |
1596 | GSM_AllRingtonesInfo Info; | 1626 | GSM_AllRingtonesInfo Info; |
1597 | int i; | 1627 | int i; |
1598 | 1628 | ||
1599 | GSM_Init(true); | 1629 | GSM_Init(true); |
1600 | 1630 | ||
1601 | error=Phone->GetRingtonesInfo(&s,&Info); | 1631 | error=Phone->GetRingtonesInfo(&s,&Info); |
1602 | Print_Error(error); | 1632 | Print_Error(error); |
1603 | 1633 | ||
1604 | GSM_Terminate(); | 1634 | GSM_Terminate(); |
1605 | 1635 | ||
1606 | for (i=0;i<Info.Number;i++) printmsg("%i. \"%s\"\n",i,DecodeUnicodeConsole(Info.Ringtone[i].Name)); | 1636 | for (i=0;i<Info.Number;i++) printmsg("%i. \"%s\"\n",i,DecodeUnicodeConsole(Info.Ringtone[i].Name)); |
@@ -2021,50 +2051,50 @@ static void DeleteCalendar(int argc, char *argv[]) | |||
2021 | Note.Location=i; | 2051 | Note.Location=i; |
2022 | error = Phone->DeleteCalendar(&s, &Note); | 2052 | error = Phone->DeleteCalendar(&s, &Note); |
2023 | if (error == ERR_EMPTY) continue; | 2053 | if (error == ERR_EMPTY) continue; |
2024 | Print_Error(error); | 2054 | Print_Error(error); |
2025 | PrintCalendar(&Note); | 2055 | PrintCalendar(&Note); |
2026 | } | 2056 | } |
2027 | 2057 | ||
2028 | GSM_Terminate(); | 2058 | GSM_Terminate(); |
2029 | } | 2059 | } |
2030 | 2060 | ||
2031 | 2061 | ||
2032 | static void GetAllCalendar(int argc, char *argv[]) | 2062 | static void GetAllCalendar(int argc, char *argv[]) |
2033 | { | 2063 | { |
2034 | GSM_CalendarEntryNote; | 2064 | GSM_CalendarEntryNote; |
2035 | bool refresh= true; | 2065 | bool refresh= true; |
2036 | 2066 | ||
2037 | signal(SIGINT, interrupt); | 2067 | signal(SIGINT, interrupt); |
2038 | printmsgerr("Press Ctrl+C to break...\n"); | 2068 | printmsgerr("Press Ctrl+C to break...\n"); |
2039 | 2069 | ||
2040 | GSM_Init(true); | 2070 | GSM_Init(true); |
2041 | 2071 | ||
2042 | while (!gshutdown) { | 2072 | while (!gshutdown) { |
2043 | error=Phone->GetNextCalendar(&s,&Note,refresh); | 2073 | error=Phone->GetNextCalendar(&s,&Note,refresh); |
2044 | if (error == ERR_EMPTY) break; | 2074 | if (error == ERR_EMPTY) break; |
2045 | PrintCalendar(&Note); | ||
2046 | Print_Error(error); | 2075 | Print_Error(error); |
2076 | PrintCalendar(&Note); | ||
2047 | refresh=false; | 2077 | refresh=false; |
2048 | } | 2078 | } |
2049 | 2079 | ||
2050 | GSM_Terminate(); | 2080 | GSM_Terminate(); |
2051 | } | 2081 | } |
2052 | 2082 | ||
2053 | static void GetCalendarSettings(int argc, char *argv[]) | 2083 | static void GetCalendarSettings(int argc, char *argv[]) |
2054 | { | 2084 | { |
2055 | GSM_CalendarSettings settings; | 2085 | GSM_CalendarSettings settings; |
2056 | 2086 | ||
2057 | GSM_Init(true); | 2087 | GSM_Init(true); |
2058 | 2088 | ||
2059 | error=Phone->GetCalendarSettings(&s,&settings); | 2089 | error=Phone->GetCalendarSettings(&s,&settings); |
2060 | Print_Error(error); | 2090 | Print_Error(error); |
2061 | 2091 | ||
2062 | if (settings.AutoDelete == 0) { | 2092 | if (settings.AutoDelete == 0) { |
2063 | printmsg("Auto deleting disabled"); | 2093 | printmsg("Auto deleting disabled"); |
2064 | } else { | 2094 | } else { |
2065 | printmsg("Auto deleting notes after %i day(s)",settings.AutoDelete); | 2095 | printmsg("Auto deleting notes after %i day(s)",settings.AutoDelete); |
2066 | } | 2096 | } |
2067 | printmsg("\nWeek start on "); | 2097 | printmsg("\nWeek start on "); |
2068 | switch(settings.StartDay) { | 2098 | switch(settings.StartDay) { |
2069 | case 1: printmsg("Monday"); break; | 2099 | case 1: printmsg("Monday"); break; |
2070 | case 6: printmsg("Saturday"); break; | 2100 | case 6: printmsg("Saturday"); break; |
@@ -2221,48 +2251,50 @@ static void GetBitmap(int argc, char *argv[]) | |||
2221 | } | 2251 | } |
2222 | if (MultiBitmap.Bitmap[0].BitmapEnabled) { | 2252 | if (MultiBitmap.Bitmap[0].BitmapEnabled) { |
2223 | printmsg("Bitmap : enabled\n"); | 2253 | printmsg("Bitmap : enabled\n"); |
2224 | } else { | 2254 | } else { |
2225 | printmsg("Bitmap : disabled\n"); | 2255 | printmsg("Bitmap : disabled\n"); |
2226 | } | 2256 | } |
2227 | if (argc>4 && !MultiBitmap.Bitmap[0].DefaultBitmap) error=GSM_SaveBitmapFile(argv[4],&MultiBitmap); | 2257 | if (argc>4 && !MultiBitmap.Bitmap[0].DefaultBitmap) error=GSM_SaveBitmapFile(argv[4],&MultiBitmap); |
2228 | break; | 2258 | break; |
2229 | case GSM_StartupLogo: | 2259 | case GSM_StartupLogo: |
2230 | GSM_PrintBitmap(stdout,&MultiBitmap.Bitmap[0]); | 2260 | GSM_PrintBitmap(stdout,&MultiBitmap.Bitmap[0]); |
2231 | if (argc>3) error=GSM_SaveBitmapFile(argv[3],&MultiBitmap); | 2261 | if (argc>3) error=GSM_SaveBitmapFile(argv[3],&MultiBitmap); |
2232 | break; | 2262 | break; |
2233 | case GSM_OperatorLogo: | 2263 | case GSM_OperatorLogo: |
2234 | if (strcmp(MultiBitmap.Bitmap[0].NetworkCode,"000 00")!=0) { | 2264 | if (strcmp(MultiBitmap.Bitmap[0].NetworkCode,"000 00")!=0) { |
2235 | GSM_PrintBitmap(stdout,&MultiBitmap.Bitmap[0]); | 2265 | GSM_PrintBitmap(stdout,&MultiBitmap.Bitmap[0]); |
2236 | if (argc>3) error=GSM_SaveBitmapFile(argv[3],&MultiBitmap); | 2266 | if (argc>3) error=GSM_SaveBitmapFile(argv[3],&MultiBitmap); |
2237 | } else { | 2267 | } else { |
2238 | printmsg("No operator logo in phone\n"); | 2268 | printmsg("No operator logo in phone\n"); |
2239 | } | 2269 | } |
2240 | break; | 2270 | break; |
2241 | case GSM_PictureImage: | 2271 | case GSM_PictureImage: |
2242 | GSM_PrintBitmap(stdout,&MultiBitmap.Bitmap[0]); | 2272 | GSM_PrintBitmap(stdout,&MultiBitmap.Bitmap[0]); |
2243 | printmsg("Text : \"%s\"\n",DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Text)); | 2273 | printmsg("Text : \"%s\"\n",DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Text)); |
2244 | printmsg("Sender : \"%s\"\n",DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Sender)); | 2274 | printmsg("Sender : \"%s\"\n",DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Sender)); |
2275 | if (MultiBitmap.Bitmap[0].Name) | ||
2276 | printmsg("Name : \"%s\"\n",DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Name)); | ||
2245 | if (argc>4) error=GSM_SaveBitmapFile(argv[4],&MultiBitmap); | 2277 | if (argc>4) error=GSM_SaveBitmapFile(argv[4],&MultiBitmap); |
2246 | break; | 2278 | break; |
2247 | case GSM_WelcomeNote_Text: | 2279 | case GSM_WelcomeNote_Text: |
2248 | printmsg("Welcome note text is \"%s\"\n",DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Text)); | 2280 | printmsg("Welcome note text is \"%s\"\n",DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Text)); |
2249 | break; | 2281 | break; |
2250 | case GSM_DealerNote_Text: | 2282 | case GSM_DealerNote_Text: |
2251 | printmsg("Dealer note text is \"%s\"\n",DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Text)); | 2283 | printmsg("Dealer note text is \"%s\"\n",DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Text)); |
2252 | break; | 2284 | break; |
2253 | default: | 2285 | default: |
2254 | break; | 2286 | break; |
2255 | } | 2287 | } |
2256 | Print_Error(error); | 2288 | Print_Error(error); |
2257 | 2289 | ||
2258 | GSM_Terminate(); | 2290 | GSM_Terminate(); |
2259 | } | 2291 | } |
2260 | 2292 | ||
2261 | static void SetBitmap(int argc, char *argv[]) | 2293 | static void SetBitmap(int argc, char *argv[]) |
2262 | { | 2294 | { |
2263 | GSM_Bitmap Bitmap, NewBitmap; | 2295 | GSM_Bitmap Bitmap, NewBitmap; |
2264 | GSM_MultiBitmap MultiBitmap; | 2296 | GSM_MultiBitmap MultiBitmap; |
2265 | GSM_NetworkInfo NetInfo; | 2297 | GSM_NetworkInfo NetInfo; |
2266 | bool init = true; | 2298 | bool init = true; |
2267 | 2299 | ||
2268 | if (mystrncasecmp(argv[2],"STARTUP",0)) { | 2300 | if (mystrncasecmp(argv[2],"STARTUP",0)) { |
@@ -2484,155 +2516,172 @@ static void DisplaySMSFrame(GSM_SMSMessage *SMS) | |||
2484 | (buffer[PHONE_SMSSubmit.TPUDL]-SMS->UDH.Length)*8, | 2516 | (buffer[PHONE_SMSSubmit.TPUDL]-SMS->UDH.Length)*8, |
2485 | hexudh); | 2517 | hexudh); |
2486 | #else | 2518 | #else |
2487 | for (i=0;i<buffer[PHONE_SMSSubmit.SMSCNumber]+1;i++) { | 2519 | for (i=0;i<buffer[PHONE_SMSSubmit.SMSCNumber]+1;i++) { |
2488 | req[current++]=buffer[PHONE_SMSSubmit.SMSCNumber+i]; | 2520 | req[current++]=buffer[PHONE_SMSSubmit.SMSCNumber+i]; |
2489 | } | 2521 | } |
2490 | req[current++]=buffer[PHONE_SMSSubmit.firstbyte]; | 2522 | req[current++]=buffer[PHONE_SMSSubmit.firstbyte]; |
2491 | req[current++]=buffer[PHONE_SMSSubmit.TPMR]; | 2523 | req[current++]=buffer[PHONE_SMSSubmit.TPMR]; |
2492 | for (i=0;i<((buffer[PHONE_SMSSubmit.Number]+1)/2+1)+1;i++) { | 2524 | for (i=0;i<((buffer[PHONE_SMSSubmit.Number]+1)/2+1)+1;i++) { |
2493 | req[current++]=buffer[PHONE_SMSSubmit.Number+i]; | 2525 | req[current++]=buffer[PHONE_SMSSubmit.Number+i]; |
2494 | } | 2526 | } |
2495 | req[current++]=buffer[PHONE_SMSSubmit.TPPID]; | 2527 | req[current++]=buffer[PHONE_SMSSubmit.TPPID]; |
2496 | req[current++]=buffer[PHONE_SMSSubmit.TPDCS]; | 2528 | req[current++]=buffer[PHONE_SMSSubmit.TPDCS]; |
2497 | req[current++]=buffer[PHONE_SMSSubmit.TPVP]; | 2529 | req[current++]=buffer[PHONE_SMSSubmit.TPVP]; |
2498 | req[current++]=buffer[PHONE_SMSSubmit.TPUDL]; | 2530 | req[current++]=buffer[PHONE_SMSSubmit.TPUDL]; |
2499 | for(i=0;i<length;i++) req[current++]=buffer[PHONE_SMSSubmit.Text+i]; | 2531 | for(i=0;i<length;i++) req[current++]=buffer[PHONE_SMSSubmit.Text+i]; |
2500 | EncodeHexBin(hexreq, req, current); | 2532 | EncodeHexBin(hexreq, req, current); |
2501 | printmsg("%s\n\n",hexreq); | 2533 | printmsg("%s\n\n",hexreq); |
2502 | #endif | 2534 | #endif |
2503 | } | 2535 | } |
2504 | 2536 | ||
2505 | #define SEND_SAVE_SMS_BUFFER_SIZE 10000 | 2537 | #define SEND_SAVE_SMS_BUFFER_SIZE 10000 |
2506 | 2538 | ||
2507 | static GSM_Error SMSStatus; | 2539 | static GSM_Error SMSStatus; |
2508 | //#if 0 | 2540 | |
2509 | static void SendSMSStatus (char *Device, int status, int MessageReference) | 2541 | static void SendSMSStatus (char *Device, int status, int MessageReference) |
2510 | { | 2542 | { |
2511 | dbgprintf("Sent SMS on device: \"%s\"\n",Device); | 2543 | dbgprintf("Sent SMS on device: \"%s\"\n",Device); |
2512 | if (status==0) { | 2544 | if (status==0) { |
2513 | printmsg("..OK"); | 2545 | printmsg("..OK"); |
2514 | SMSStatus = ERR_NONE; | 2546 | SMSStatus = ERR_NONE; |
2515 | } else { | 2547 | } else { |
2516 | printmsg("..error %i",status); | 2548 | printmsg("..error %i",status); |
2517 | SMSStatus = ERR_UNKNOWN; | 2549 | SMSStatus = ERR_UNKNOWN; |
2518 | } | 2550 | } |
2519 | printmsg(", message reference=%02x\n",MessageReference); | 2551 | printmsg(", message reference=%d\n",MessageReference); |
2520 | } | 2552 | } |
2521 | 2553 | ||
2522 | static void SendSaveDisplaySMS(int argc, char *argv[]) | 2554 | static void SendSaveDisplaySMS(int argc, char *argv[]) |
2523 | { | 2555 | { |
2524 | #ifdef GSM_ENABLE_BACKUP | 2556 | #ifdef GSM_ENABLE_BACKUP |
2525 | GSM_Backup Backup; | 2557 | GSM_Backup Backup; |
2526 | #endif | 2558 | #endif |
2527 | int i,j,z,FramesNum = 0; | 2559 | int i,j,z,FramesNum = 0; |
2528 | int Protected = 0; | 2560 | int Protected = 0; |
2529 | GSM_SMSFolders folders; | 2561 | GSM_SMSFolders folders; |
2530 | GSM_MultiSMSMessage sms; | 2562 | GSM_MultiSMSMessage sms; |
2531 | GSM_Ringtone ringtone[MAX_MULTI_SMS]; | 2563 | GSM_Ringtone ringtone[MAX_MULTI_SMS]; |
2532 | GSM_MultiBitmap bitmap[MAX_MULTI_SMS],bitmap2; | 2564 | GSM_MultiBitmap bitmap[MAX_MULTI_SMS],bitmap2; |
2533 | GSM_MultiPartSMSInfoSMSInfo; | 2565 | GSM_MultiPartSMSInfo SMSInfo; |
2534 | GSM_NetworkInfo NetInfo; | 2566 | GSM_NetworkInfo NetInfo; |
2535 | GSM_MMSIndicator MMSInfo; | 2567 | GSM_MMSIndicator MMSInfo; |
2536 | FILE *ReplaceFile,*f; | 2568 | FILE *ReplaceFile,*f; |
2537 | char ReplaceBuffer2[200],ReplaceBuffer[200]; | 2569 | char ReplaceBuffer2[200],ReplaceBuffer[200]; |
2538 | char InputBuffer[SEND_SAVE_SMS_BUFFER_SIZE/2+1]; | 2570 | char InputBuffer[SEND_SAVE_SMS_BUFFER_SIZE/2+1]; |
2539 | char Buffer [MAX_MULTI_SMS][SEND_SAVE_SMS_BUFFER_SIZE]; | 2571 | char Buffer [MAX_MULTI_SMS][SEND_SAVE_SMS_BUFFER_SIZE]; |
2540 | char Sender [(GSM_MAX_NUMBER_LENGTH+1)*2]; | 2572 | char Sender [(GSM_MAX_NUMBER_LENGTH+1)*2]; |
2541 | char Name [(GSM_MAX_NUMBER_LENGTH+1)*2]; | 2573 | char Name [(GSM_MAX_NUMBER_LENGTH+1)*2]; |
2542 | char SMSC [(GSM_MAX_NUMBER_LENGTH+1)*2]; | 2574 | char SMSC [(GSM_MAX_NUMBER_LENGTH+1)*2]; |
2543 | int startarg = 0; | 2575 | int startarg = 0; |
2544 | int chars_read = 0; | 2576 | int chars_read = 0; |
2545 | int nextlong = 0; | 2577 | int nextlong = 0; |
2546 | bool ReplyViaSameSMSC = false; | 2578 | bool ReplyViaSameSMSC = false; |
2547 | int SMSCSet = 1; | 2579 | int SMSCSet = 1; |
2548 | int MaxSMS = -1; | 2580 | int MaxSMS = -1; |
2549 | bool EMS16Bit = false; | 2581 | bool EMS16Bit = false; |
2550 | bool SendSaved = false; | 2582 | bool SendSaved = false; |
2551 | 2583 | ||
2552 | /* Parameters required only during saving */ | 2584 | /* Parameters required only during saving */ |
2553 | int Folder = 1; /*Inbox by default */ | 2585 | int Folder = 1; /*Inbox by default */ |
2554 | GSM_SMS_State State = SMS_Sent; | 2586 | GSM_SMS_State State = SMS_Sent; |
2555 | 2587 | ||
2556 | /* Required only during sending */ | 2588 | /* Required only during sending */ |
2557 | GSM_SMSValidity Validity; | 2589 | GSM_SMSValidity Validity; |
2558 | GSM_SMSC PhoneSMSC; | 2590 | GSM_SMSC PhoneSMSC; |
2559 | bool DeliveryReport = false; | 2591 | bool DeliveryReport = false; |
2560 | 2592 | ||
2561 | ReplaceBuffer[0] = 0; | 2593 | ReplaceBuffer[0] = 0; |
2562 | ReplaceBuffer[1] = 0; | 2594 | ReplaceBuffer[1] = 0; |
2563 | GSM_ClearMultiPartSMSInfo(&SMSInfo); | 2595 | GSM_ClearMultiPartSMSInfo(&SMSInfo); |
2564 | SMSInfo.ReplaceMessage = 0; | 2596 | SMSInfo.ReplaceMessage = 0; |
2565 | SMSInfo.EntriesNum = 1; | 2597 | SMSInfo.EntriesNum = 1; |
2566 | 2598 | ||
2567 | if (mystrncasecmp(argv[1],"--savesms",0)) { | 2599 | if (mystrncasecmp(argv[1],"--savesms",0)) { |
2568 | EncodeUnicode(Sender,"Gammu",5); | 2600 | EncodeUnicode(Sender,"Gammu",5); |
2569 | Name[0] = 0; | 2601 | Name[0] = 0; |
2570 | Name[1] = 0; | 2602 | Name[1] = 0; |
2571 | startarg = 0; | 2603 | startarg = 0; |
2572 | } else { | 2604 | } else { |
2573 | EncodeUnicode(Sender,argv[3],strlen(argv[3])); | 2605 | EncodeUnicode(Sender,argv[3],strlen(argv[3])); |
2574 | startarg = 1; | 2606 | startarg = 1; |
2575 | Validity.Format = 0; | 2607 | Validity.Format = 0; |
2576 | } | 2608 | } |
2577 | if (mystrncasecmp(argv[1],"--sendsmsdsms",0)) startarg=startarg+2; | 2609 | if (mystrncasecmp(argv[1],"--sendsmsdsms",0)) { |
2610 | startarg=startarg+2; | ||
2611 | EncodeUnicode(SMSC,"1234",4); | ||
2612 | SMSCSet= 0; | ||
2613 | } | ||
2578 | 2614 | ||
2579 | if (mystrncasecmp(argv[2],"TEXT",0)) { | 2615 | if (mystrncasecmp(argv[2],"TEXT",0)) { |
2580 | chars_read = fread(InputBuffer, 1, SEND_SAVE_SMS_BUFFER_SIZE/2, stdin); | 2616 | chars_read = fread(InputBuffer, 1, SEND_SAVE_SMS_BUFFER_SIZE/2, stdin); |
2581 | if (chars_read == 0) printmsg("Warning: 0 chars read !\n"); | 2617 | if (chars_read == 0) printmsg("Warning: 0 chars read !\n"); |
2582 | InputBuffer[chars_read] = 0x00; | 2618 | InputBuffer[chars_read] = 0x00; |
2583 | InputBuffer[chars_read+1] = 0x00; | 2619 | InputBuffer[chars_read+1] = 0x00; |
2584 | EncodeUnicode(Buffer[0],InputBuffer,strlen(InputBuffer)); | 2620 | EncodeUnicode(Buffer[0],InputBuffer,strlen(InputBuffer)); |
2585 | SMSInfo.Entries[0].Buffer = Buffer[0]; | 2621 | SMSInfo.Entries[0].Buffer = Buffer[0]; |
2586 | SMSInfo.Entries[0].ID = SMS_Text; | 2622 | SMSInfo.Entries[0].ID = SMS_Text; |
2587 | SMSInfo.UnicodeCoding = false; | 2623 | SMSInfo.UnicodeCoding = false; |
2588 | startarg += 3; | 2624 | startarg += 3; |
2589 | } else if (mystrncasecmp(argv[2],"SMSTEMPLATE",0)) { | 2625 | } else if (mystrncasecmp(argv[2],"SMSTEMPLATE",0)) { |
2590 | SMSInfo.UnicodeCoding = false; | 2626 | SMSInfo.UnicodeCoding = false; |
2591 | SMSInfo.EntriesNum = 1; | 2627 | SMSInfo.EntriesNum = 1; |
2592 | Buffer[0][0] = 0x00; | 2628 | Buffer[0][0] = 0x00; |
2593 | Buffer[0][1] = 0x00; | 2629 | Buffer[0][1] = 0x00; |
2594 | SMSInfo.Entries[0].Buffer = Buffer[0]; | 2630 | SMSInfo.Entries[0].Buffer = Buffer[0]; |
2595 | SMSInfo.Entries[0].ID = SMS_AlcatelSMSTemplateName; | 2631 | SMSInfo.Entries[0].ID = SMS_AlcatelSMSTemplateName; |
2596 | startarg += 3; | 2632 | startarg += 3; |
2597 | } else if (mystrncasecmp(argv[2],"EMS",0)) { | 2633 | } else if (mystrncasecmp(argv[2],"EMS",0)) { |
2598 | SMSInfo.UnicodeCoding = false; | 2634 | SMSInfo.UnicodeCoding = false; |
2599 | SMSInfo.EntriesNum = 0; | 2635 | SMSInfo.EntriesNum = 0; |
2600 | startarg += 3; | 2636 | startarg += 3; |
2601 | } else if (mystrncasecmp(argv[2],"MMSINDICATOR",0)) { | 2637 | } else if (mystrncasecmp(argv[2],"MMSINDICATOR",0)) { |
2602 | if (argc<6+startarg) { | 2638 | if (argc<6+startarg) { |
2603 | printmsg("Where is ringtone filename ?\n"); | 2639 | printmsg("Where are parameters ?\n"); |
2604 | exit(-1); | 2640 | exit(-1); |
2605 | } | 2641 | } |
2606 | SMSInfo.Entries[0].ID = SMS_MMSIndicatorLong; | 2642 | SMSInfo.Entries[0].ID = SMS_MMSIndicatorLong; |
2607 | SMSInfo.Entries[0].MMSIndicator = &MMSInfo; | 2643 | SMSInfo.Entries[0].MMSIndicator = &MMSInfo; |
2608 | if (mystrncasecmp(argv[1],"--savesms",0)) { | 2644 | if (mystrncasecmp(argv[1],"--savesms",0)) { |
2609 | EncodeUnicode(Sender,"MMS Info",8); | 2645 | EncodeUnicode(Sender,"MMS Info",8); |
2610 | } | 2646 | } |
2611 | strcpy(MMSInfo.Address,argv[3+startarg]); | 2647 | strcpy(MMSInfo.Address,argv[3+startarg]); |
2612 | strcpy(MMSInfo.Title,argv[4+startarg]); | 2648 | strcpy(MMSInfo.Title,argv[4+startarg]); |
2613 | strcpy(MMSInfo.Sender,argv[5+startarg]); | 2649 | strcpy(MMSInfo.Sender,argv[5+startarg]); |
2614 | startarg += 6; | 2650 | startarg += 6; |
2651 | } else if (mystrncasecmp(argv[2],"WAPINDICATOR",0)) { | ||
2652 | if (argc<5+startarg) { | ||
2653 | printmsg("Where are parameters ?\n"); | ||
2654 | exit(-1); | ||
2655 | } | ||
2656 | SMSInfo.Entries[0].ID = SMS_WAPIndicatorLong; | ||
2657 | SMSInfo.Entries[0].MMSIndicator = &MMSInfo; | ||
2658 | if (mystrncasecmp(argv[1],"--savesms",0)) { | ||
2659 | EncodeUnicode(Sender,"WAP Info",8); | ||
2660 | } | ||
2661 | strcpy(MMSInfo.Address,argv[3+startarg]); | ||
2662 | strcpy(MMSInfo.Title,argv[4+startarg]); | ||
2663 | startarg += 5; | ||
2615 | } else if (mystrncasecmp(argv[2],"RINGTONE",0)) { | 2664 | } else if (mystrncasecmp(argv[2],"RINGTONE",0)) { |
2616 | if (argc<4+startarg) { | 2665 | if (argc<4+startarg) { |
2617 | printmsg("Where is ringtone filename ?\n"); | 2666 | printmsg("Where is ringtone filename ?\n"); |
2618 | exit(-1); | 2667 | exit(-1); |
2619 | } | 2668 | } |
2620 | ringtone[0].Format=RING_NOTETONE; | 2669 | ringtone[0].Format=RING_NOTETONE; |
2621 | error=GSM_ReadRingtoneFile(argv[3+startarg],&ringtone[0]); | 2670 | error=GSM_ReadRingtoneFile(argv[3+startarg],&ringtone[0]); |
2622 | Print_Error(error); | 2671 | Print_Error(error); |
2623 | SMSInfo.Entries[0].ID = SMS_NokiaRingtone; | 2672 | SMSInfo.Entries[0].ID = SMS_NokiaRingtone; |
2624 | SMSInfo.Entries[0].Ringtone = &ringtone[0]; | 2673 | SMSInfo.Entries[0].Ringtone = &ringtone[0]; |
2625 | if (mystrncasecmp(argv[1],"--savesms",0)) { | 2674 | if (mystrncasecmp(argv[1],"--savesms",0)) { |
2626 | CopyUnicodeString(Sender, ringtone[0].Name); | 2675 | CopyUnicodeString(Sender, ringtone[0].Name); |
2627 | EncodeUnicode(Name,"Ringtone ",9); | 2676 | EncodeUnicode(Name,"Ringtone ",9); |
2628 | CopyUnicodeString(Name+9*2, ringtone[0].Name); | 2677 | CopyUnicodeString(Name+9*2, ringtone[0].Name); |
2629 | } | 2678 | } |
2630 | startarg += 4; | 2679 | startarg += 4; |
2631 | } else if (mystrncasecmp(argv[2],"OPERATOR",0)) { | 2680 | } else if (mystrncasecmp(argv[2],"OPERATOR",0)) { |
2632 | if (argc<4+startarg) { | 2681 | if (argc<4+startarg) { |
2633 | printmsg("Where is logo filename ?\n"); | 2682 | printmsg("Where is logo filename ?\n"); |
2634 | exit(-1); | 2683 | exit(-1); |
2635 | } | 2684 | } |
2636 | bitmap[0].Bitmap[0].Type=GSM_OperatorLogo; | 2685 | bitmap[0].Bitmap[0].Type=GSM_OperatorLogo; |
2637 | error=GSM_ReadBitmapFile(argv[3+startarg],&bitmap[0]); | 2686 | error=GSM_ReadBitmapFile(argv[3+startarg],&bitmap[0]); |
2638 | Print_Error(error); | 2687 | Print_Error(error); |
@@ -2689,195 +2738,195 @@ static void SendSaveDisplaySMS(int argc, char *argv[]) | |||
2689 | printmsg("Where is logo filename ?\n"); | 2738 | printmsg("Where is logo filename ?\n"); |
2690 | exit(-1); | 2739 | exit(-1); |
2691 | } | 2740 | } |
2692 | bitmap[0].Bitmap[0].Type=GSM_PictureImage; | 2741 | bitmap[0].Bitmap[0].Type=GSM_PictureImage; |
2693 | error=GSM_ReadBitmapFile(argv[3+startarg],&bitmap[0]); | 2742 | error=GSM_ReadBitmapFile(argv[3+startarg],&bitmap[0]); |
2694 | printmsg("File \"%s\"\n",argv[3+startarg]); | 2743 | printmsg("File \"%s\"\n",argv[3+startarg]); |
2695 | Print_Error(error); | 2744 | Print_Error(error); |
2696 | SMSInfo.Entries[0].ID = SMS_NokiaPictureImageLong; | 2745 | SMSInfo.Entries[0].ID = SMS_NokiaPictureImageLong; |
2697 | SMSInfo.Entries[0].Bitmap = &bitmap[0]; | 2746 | SMSInfo.Entries[0].Bitmap = &bitmap[0]; |
2698 | SMSInfo.UnicodeCoding = false; | 2747 | SMSInfo.UnicodeCoding = false; |
2699 | bitmap[0].Bitmap[0].Text[0]= 0; | 2748 | bitmap[0].Bitmap[0].Text[0]= 0; |
2700 | bitmap[0].Bitmap[0].Text[1]= 0; | 2749 | bitmap[0].Bitmap[0].Text[1]= 0; |
2701 | if (mystrncasecmp(argv[1],"--savesms",0)) { | 2750 | if (mystrncasecmp(argv[1],"--savesms",0)) { |
2702 | EncodeUnicode(Sender, "Picture",7); | 2751 | EncodeUnicode(Sender, "Picture",7); |
2703 | EncodeUnicode(Name,"Picture Image",13); | 2752 | EncodeUnicode(Name,"Picture Image",13); |
2704 | } | 2753 | } |
2705 | startarg += 4; | 2754 | startarg += 4; |
2706 | #ifdef GSM_ENABLE_BACKUP | 2755 | #ifdef GSM_ENABLE_BACKUP |
2707 | } else if (mystrncasecmp(argv[2],"BOOKMARK",0)) { | 2756 | } else if (mystrncasecmp(argv[2],"BOOKMARK",0)) { |
2708 | if (argc<5+startarg) { | 2757 | if (argc<5+startarg) { |
2709 | printmsg("Where is backup filename and location ?\n"); | 2758 | printmsg("Where is backup filename and location ?\n"); |
2710 | exit(-1); | 2759 | exit(-1); |
2711 | } | 2760 | } |
2712 | error=GSM_ReadBackupFile(argv[3+startarg],&Backup); | 2761 | error=GSM_ReadBackupFile(argv[3+startarg],&Backup); |
2713 | Print_Error(error); | 2762 | if (error!=ERR_NOTIMPLEMENTED) Print_Error(error); |
2714 | i = 0; | 2763 | i = 0; |
2715 | while (Backup.WAPBookmark[i]!=NULL) { | 2764 | while (Backup.WAPBookmark[i]!=NULL) { |
2716 | if (i == atoi(argv[4+startarg])-1) break; | 2765 | if (i == atoi(argv[4+startarg])-1) break; |
2717 | i++; | 2766 | i++; |
2718 | } | 2767 | } |
2719 | if (i != atoi(argv[4+startarg])-1) { | 2768 | if (i != atoi(argv[4+startarg])-1) { |
2720 | printmsg("Bookmark not found in file\n"); | 2769 | printmsg("Bookmark not found in file\n"); |
2721 | exit(-1); | 2770 | exit(-1); |
2722 | } | 2771 | } |
2723 | SMSInfo.Entries[0].ID = SMS_NokiaWAPBookmarkLong; | 2772 | SMSInfo.Entries[0].ID = SMS_NokiaWAPBookmarkLong; |
2724 | SMSInfo.Entries[0].Bookmark = Backup.WAPBookmark[i]; | 2773 | SMSInfo.Entries[0].Bookmark = Backup.WAPBookmark[i]; |
2725 | if (mystrncasecmp(argv[1],"--savesms",0)) { | 2774 | if (mystrncasecmp(argv[1],"--savesms",0)) { |
2726 | EncodeUnicode(Sender, "Bookmark",8); | 2775 | EncodeUnicode(Sender, "Bookmark",8); |
2727 | EncodeUnicode(Name,"WAP Bookmark",12); | 2776 | EncodeUnicode(Name,"WAP Bookmark",12); |
2728 | } | 2777 | } |
2729 | startarg += 5; | 2778 | startarg += 5; |
2730 | } else if (mystrncasecmp(argv[2],"WAPSETTINGS",0)) { | 2779 | } else if (mystrncasecmp(argv[2],"WAPSETTINGS",0)) { |
2731 | if (argc<6+startarg) { | 2780 | if (argc<6+startarg) { |
2732 | printmsg("Where is backup filename and location ?\n"); | 2781 | printmsg("Where is backup filename and location ?\n"); |
2733 | exit(-1); | 2782 | exit(-1); |
2734 | } | 2783 | } |
2735 | error=GSM_ReadBackupFile(argv[3+startarg],&Backup); | 2784 | error=GSM_ReadBackupFile(argv[3+startarg],&Backup); |
2736 | Print_Error(error); | 2785 | if (error!=ERR_NOTIMPLEMENTED) Print_Error(error); |
2737 | i = 0; | 2786 | i = 0; |
2738 | while (Backup.WAPSettings[i]!=NULL) { | 2787 | while (Backup.WAPSettings[i]!=NULL) { |
2739 | if (i == atoi(argv[4+startarg])-1) break; | 2788 | if (i == atoi(argv[4+startarg])-1) break; |
2740 | i++; | 2789 | i++; |
2741 | } | 2790 | } |
2742 | if (i != atoi(argv[4+startarg])-1) { | 2791 | if (i != atoi(argv[4+startarg])-1) { |
2743 | printmsg("WAP settings not found in file\n"); | 2792 | printmsg("WAP settings not found in file\n"); |
2744 | exit(-1); | 2793 | exit(-1); |
2745 | } | 2794 | } |
2746 | SMSInfo.Entries[0].Settings = NULL; | 2795 | SMSInfo.Entries[0].Settings = NULL; |
2747 | for (j=0;j<Backup.WAPSettings[i]->Number;j++) { | 2796 | for (j=0;j<Backup.WAPSettings[i]->Number;j++) { |
2748 | switch (Backup.WAPSettings[i]->Settings[j].Bearer) { | 2797 | switch (Backup.WAPSettings[i]->Settings[j].Bearer) { |
2749 | case WAPSETTINGS_BEARER_GPRS: | 2798 | case WAPSETTINGS_BEARER_GPRS: |
2750 | if (mystrncasecmp(argv[5+startarg],"GPRS",0)) { | 2799 | if (mystrncasecmp(argv[5+startarg],"GPRS",0)) { |
2751 | SMSInfo.Entries[0].Settings = &Backup.WAPSettings[i]->Settings[j]; | 2800 | SMSInfo.Entries[0].Settings = &Backup.WAPSettings[i]->Settings[j]; |
2752 | break; | 2801 | break; |
2753 | } | 2802 | } |
2754 | case WAPSETTINGS_BEARER_DATA: | 2803 | case WAPSETTINGS_BEARER_DATA: |
2755 | if (mystrncasecmp(argv[5+startarg],"DATA",0)) { | 2804 | if (mystrncasecmp(argv[5+startarg],"DATA",0)) { |
2756 | SMSInfo.Entries[0].Settings = &Backup.WAPSettings[i]->Settings[j]; | 2805 | SMSInfo.Entries[0].Settings = &Backup.WAPSettings[i]->Settings[j]; |
2757 | break; | 2806 | break; |
2758 | } | 2807 | } |
2759 | default: | 2808 | default: |
2760 | break; | 2809 | break; |
2761 | } | 2810 | } |
2762 | } | 2811 | } |
2763 | if (SMSInfo.Entries[0].Settings == NULL) { | 2812 | if (SMSInfo.Entries[0].Settings == NULL) { |
2764 | printmsg("Sorry. For now there is only support for GPRS or DATA bearers end\n"); | 2813 | printmsg("Sorry. For now there is only support for GPRS or DATA bearers end\n"); |
2765 | exit(-1); | 2814 | exit(-1); |
2766 | } | 2815 | } |
2767 | SMSInfo.Entries[0].ID = SMS_NokiaWAPSettingsLong; | 2816 | SMSInfo.Entries[0].ID = SMS_NokiaWAPSettingsLong; |
2768 | if (mystrncasecmp(argv[1],"--savesms",0)) { | 2817 | if (mystrncasecmp(argv[1],"--savesms",0)) { |
2769 | EncodeUnicode(Sender, "Settings",8); | 2818 | EncodeUnicode(Sender, "Settings",8); |
2770 | EncodeUnicode(Name,"WAP Settings",12); | 2819 | EncodeUnicode(Name,"WAP Settings",12); |
2771 | } | 2820 | } |
2772 | startarg += 6; | 2821 | startarg += 6; |
2773 | } else if (mystrncasecmp(argv[2],"MMSSETTINGS",0)) { | 2822 | } else if (mystrncasecmp(argv[2],"MMSSETTINGS",0)) { |
2774 | if (argc<5+startarg) { | 2823 | if (argc<5+startarg) { |
2775 | printmsg("Where is backup filename and location ?\n"); | 2824 | printmsg("Where is backup filename and location ?\n"); |
2776 | exit(-1); | 2825 | exit(-1); |
2777 | } | 2826 | } |
2778 | error=GSM_ReadBackupFile(argv[3+startarg],&Backup); | 2827 | error=GSM_ReadBackupFile(argv[3+startarg],&Backup); |
2779 | Print_Error(error); | 2828 | if (error!=ERR_NOTIMPLEMENTED) Print_Error(error); |
2780 | i = 0; | 2829 | i = 0; |
2781 | while (Backup.MMSSettings[i]!=NULL) { | 2830 | while (Backup.MMSSettings[i]!=NULL) { |
2782 | if (i == atoi(argv[4+startarg])-1) break; | 2831 | if (i == atoi(argv[4+startarg])-1) break; |
2783 | i++; | 2832 | i++; |
2784 | } | 2833 | } |
2785 | if (i != atoi(argv[4+startarg])-1) { | 2834 | if (i != atoi(argv[4+startarg])-1) { |
2786 | printmsg("MMS settings not found in file\n"); | 2835 | printmsg("MMS settings not found in file\n"); |
2787 | exit(-1); | 2836 | exit(-1); |
2788 | } | 2837 | } |
2789 | SMSInfo.Entries[0].Settings = NULL; | 2838 | SMSInfo.Entries[0].Settings = NULL; |
2790 | for (j=0;j<Backup.MMSSettings[i]->Number;j++) { | 2839 | for (j=0;j<Backup.MMSSettings[i]->Number;j++) { |
2791 | switch (Backup.MMSSettings[i]->Settings[j].Bearer) { | 2840 | switch (Backup.MMSSettings[i]->Settings[j].Bearer) { |
2792 | case WAPSETTINGS_BEARER_GPRS: | 2841 | case WAPSETTINGS_BEARER_GPRS: |
2793 | SMSInfo.Entries[0].Settings = &Backup.MMSSettings[i]->Settings[j]; | 2842 | SMSInfo.Entries[0].Settings = &Backup.MMSSettings[i]->Settings[j]; |
2794 | break; | 2843 | break; |
2795 | default: | 2844 | default: |
2796 | break; | 2845 | break; |
2797 | } | 2846 | } |
2798 | } | 2847 | } |
2799 | if (SMSInfo.Entries[0].Settings == NULL) { | 2848 | if (SMSInfo.Entries[0].Settings == NULL) { |
2800 | printmsg("Sorry. No GPRS bearer found in MMS settings\n"); | 2849 | printmsg("Sorry. No GPRS bearer found in MMS settings\n"); |
2801 | exit(-1); | 2850 | exit(-1); |
2802 | } | 2851 | } |
2803 | SMSInfo.Entries[0].ID = SMS_NokiaMMSSettingsLong; | 2852 | SMSInfo.Entries[0].ID = SMS_NokiaMMSSettingsLong; |
2804 | if (mystrncasecmp(argv[1],"--savesms",0)) { | 2853 | if (mystrncasecmp(argv[1],"--savesms",0)) { |
2805 | EncodeUnicode(Sender, "Settings",8); | 2854 | EncodeUnicode(Sender, "Settings",8); |
2806 | EncodeUnicode(Name,"MMS Settings",12); | 2855 | EncodeUnicode(Name,"MMS Settings",12); |
2807 | } | 2856 | } |
2808 | startarg += 5; | 2857 | startarg += 5; |
2809 | } else if (mystrncasecmp(argv[2],"CALENDAR",0)) { | 2858 | } else if (mystrncasecmp(argv[2],"CALENDAR",0)) { |
2810 | if (argc<5+startarg) { | 2859 | if (argc<5+startarg) { |
2811 | printmsg("Where is backup filename and location ?\n"); | 2860 | printmsg("Where is backup filename and location ?\n"); |
2812 | exit(-1); | 2861 | exit(-1); |
2813 | } | 2862 | } |
2814 | error=GSM_ReadBackupFile(argv[3+startarg],&Backup); | 2863 | error=GSM_ReadBackupFile(argv[3+startarg],&Backup); |
2815 | Print_Error(error); | 2864 | if (error!=ERR_NOTIMPLEMENTED) Print_Error(error); |
2816 | i = 0; | 2865 | i = 0; |
2817 | while (Backup.Calendar[i]!=NULL) { | 2866 | while (Backup.Calendar[i]!=NULL) { |
2818 | if (i == atoi(argv[4+startarg])-1) break; | 2867 | if (i == atoi(argv[4+startarg])-1) break; |
2819 | i++; | 2868 | i++; |
2820 | } | 2869 | } |
2821 | if (i != atoi(argv[4+startarg])-1) { | 2870 | if (i != atoi(argv[4+startarg])-1) { |
2822 | printmsg("Calendar note not found in file\n"); | 2871 | printmsg("Calendar note not found in file\n"); |
2823 | exit(-1); | 2872 | exit(-1); |
2824 | } | 2873 | } |
2825 | SMSInfo.Entries[0].ID = SMS_NokiaVCALENDAR10Long; | 2874 | SMSInfo.Entries[0].ID = SMS_NokiaVCALENDAR10Long; |
2826 | SMSInfo.Entries[0].Calendar = Backup.Calendar[i]; | 2875 | SMSInfo.Entries[0].Calendar = Backup.Calendar[i]; |
2827 | if (mystrncasecmp(argv[1],"--savesms",0)) { | 2876 | if (mystrncasecmp(argv[1],"--savesms",0)) { |
2828 | EncodeUnicode(Sender, "Calendar",8); | 2877 | EncodeUnicode(Sender, "Calendar",8); |
2829 | } | 2878 | } |
2830 | startarg += 5; | 2879 | startarg += 5; |
2831 | } else if (mystrncasecmp(argv[2],"TODO",0)) { | 2880 | } else if (mystrncasecmp(argv[2],"TODO",0)) { |
2832 | if (argc<5+startarg) { | 2881 | if (argc<5+startarg) { |
2833 | printmsg("Where is backup filename and location ?\n"); | 2882 | printmsg("Where is backup filename and location ?\n"); |
2834 | exit(-1); | 2883 | exit(-1); |
2835 | } | 2884 | } |
2836 | error=GSM_ReadBackupFile(argv[3+startarg],&Backup); | 2885 | error=GSM_ReadBackupFile(argv[3+startarg],&Backup); |
2837 | Print_Error(error); | 2886 | if (error!=ERR_NOTIMPLEMENTED) Print_Error(error); |
2838 | i = 0; | 2887 | i = 0; |
2839 | while (Backup.ToDo[i]!=NULL) { | 2888 | while (Backup.ToDo[i]!=NULL) { |
2840 | if (i == atoi(argv[4+startarg])-1) break; | 2889 | if (i == atoi(argv[4+startarg])-1) break; |
2841 | i++; | 2890 | i++; |
2842 | } | 2891 | } |
2843 | if (i != atoi(argv[4+startarg])-1) { | 2892 | if (i != atoi(argv[4+startarg])-1) { |
2844 | printmsg("ToDo note not found in file\n"); | 2893 | printmsg("ToDo note not found in file\n"); |
2845 | exit(-1); | 2894 | exit(-1); |
2846 | } | 2895 | } |
2847 | SMSInfo.Entries[0].ID = SMS_NokiaVTODOLong; | 2896 | SMSInfo.Entries[0].ID = SMS_NokiaVTODOLong; |
2848 | SMSInfo.Entries[0].ToDo = Backup.ToDo[i]; | 2897 | SMSInfo.Entries[0].ToDo = Backup.ToDo[i]; |
2849 | if (mystrncasecmp(argv[1],"--savesms",0)) { | 2898 | if (mystrncasecmp(argv[1],"--savesms",0)) { |
2850 | EncodeUnicode(Sender, "ToDo",8); | 2899 | EncodeUnicode(Sender, "ToDo",8); |
2851 | } | 2900 | } |
2852 | startarg += 5; | 2901 | startarg += 5; |
2853 | } else if (mystrncasecmp(argv[2],"VCARD10",0) || mystrncasecmp(argv[2],"VCARD21",0)) { | 2902 | } else if (mystrncasecmp(argv[2],"VCARD10",0) || mystrncasecmp(argv[2],"VCARD21",0)) { |
2854 | if (argc<6+startarg) { | 2903 | if (argc<6+startarg) { |
2855 | printmsg("Where is backup filename and location and memory type ?\n"); | 2904 | printmsg("Where is backup filename and location and memory type ?\n"); |
2856 | exit(-1); | 2905 | exit(-1); |
2857 | } | 2906 | } |
2858 | error=GSM_ReadBackupFile(argv[3+startarg],&Backup); | 2907 | error=GSM_ReadBackupFile(argv[3+startarg],&Backup); |
2859 | Print_Error(error); | 2908 | if (error!=ERR_NOTIMPLEMENTED) Print_Error(error); |
2860 | i = 0; | 2909 | i = 0; |
2861 | if (mystrncasecmp(argv[4+startarg],"SM",0)) { | 2910 | if (mystrncasecmp(argv[4+startarg],"SM",0)) { |
2862 | while (Backup.SIMPhonebook[i]!=NULL) { | 2911 | while (Backup.SIMPhonebook[i]!=NULL) { |
2863 | if (i == atoi(argv[5+startarg])-1) break; | 2912 | if (i == atoi(argv[5+startarg])-1) break; |
2864 | i++; | 2913 | i++; |
2865 | } | 2914 | } |
2866 | if (i != atoi(argv[5+startarg])-1) { | 2915 | if (i != atoi(argv[5+startarg])-1) { |
2867 | printmsg("Phonebook entry not found in file\n"); | 2916 | printmsg("Phonebook entry not found in file\n"); |
2868 | exit(-1); | 2917 | exit(-1); |
2869 | } | 2918 | } |
2870 | SMSInfo.Entries[0].Phonebook = Backup.SIMPhonebook[i]; | 2919 | SMSInfo.Entries[0].Phonebook = Backup.SIMPhonebook[i]; |
2871 | } else if (mystrncasecmp(argv[4+startarg],"ME",0)) { | 2920 | } else if (mystrncasecmp(argv[4+startarg],"ME",0)) { |
2872 | while (Backup.PhonePhonebook[i]!=NULL) { | 2921 | while (Backup.PhonePhonebook[i]!=NULL) { |
2873 | if (i == atoi(argv[5+startarg])-1) break; | 2922 | if (i == atoi(argv[5+startarg])-1) break; |
2874 | i++; | 2923 | i++; |
2875 | } | 2924 | } |
2876 | if (i != atoi(argv[5+startarg])-1) { | 2925 | if (i != atoi(argv[5+startarg])-1) { |
2877 | printmsg("Phonebook entry not found in file\n"); | 2926 | printmsg("Phonebook entry not found in file\n"); |
2878 | exit(-1); | 2927 | exit(-1); |
2879 | } | 2928 | } |
2880 | SMSInfo.Entries[0].Phonebook = Backup.PhonePhonebook[i]; | 2929 | SMSInfo.Entries[0].Phonebook = Backup.PhonePhonebook[i]; |
2881 | } else { | 2930 | } else { |
2882 | printmsg("Unknown memory type: \"%s\"\n",argv[4+startarg]); | 2931 | printmsg("Unknown memory type: \"%s\"\n",argv[4+startarg]); |
2883 | exit(-1); | 2932 | exit(-1); |
@@ -3788,177 +3837,180 @@ static void SendSaveDisplaySMS(int argc, char *argv[]) | |||
3788 | } | 3837 | } |
3789 | if (SMSStatus == ERR_NONE) break; | 3838 | if (SMSStatus == ERR_NONE) break; |
3790 | } | 3839 | } |
3791 | } | 3840 | } |
3792 | } | 3841 | } |
3793 | 3842 | ||
3794 | GSM_Terminate(); | 3843 | GSM_Terminate(); |
3795 | } | 3844 | } |
3796 | 3845 | ||
3797 | #ifdef GSM_ENABLE_BACKUP | 3846 | #ifdef GSM_ENABLE_BACKUP |
3798 | static void SaveFile(int argc, char *argv[]) | 3847 | static void SaveFile(int argc, char *argv[]) |
3799 | { | 3848 | { |
3800 | GSM_Backup Backup; | 3849 | GSM_Backup Backup; |
3801 | int i,j; | 3850 | int i,j; |
3802 | FILE *file; | 3851 | FILE *file; |
3803 | unsigned char Buffer[10000]; | 3852 | unsigned char Buffer[10000]; |
3804 | GSM_MemoryEntry *pbk; | 3853 | GSM_MemoryEntry *pbk; |
3805 | 3854 | ||
3806 | if (mystrncasecmp(argv[2],"CALENDAR",0)) { | 3855 | if (mystrncasecmp(argv[2],"CALENDAR",0)) { |
3807 | if (argc<5) { | 3856 | if (argc<5) { |
3808 | printmsg("Where is backup filename and location ?\n"); | 3857 | printmsg("Where is backup filename and location ?\n"); |
3809 | exit(-1); | 3858 | exit(-1); |
3810 | } | 3859 | } |
3811 | error=GSM_ReadBackupFile(argv[4],&Backup); | 3860 | error=GSM_ReadBackupFile(argv[4],&Backup); |
3812 | Print_Error(error); | 3861 | if (error!=ERR_NOTIMPLEMENTED) Print_Error(error); |
3813 | i = 0; | 3862 | i = 0; |
3814 | while (Backup.Calendar[i]!=NULL) { | 3863 | while (Backup.Calendar[i]!=NULL) { |
3815 | if (i == atoi(argv[5])-1) break; | 3864 | if (i == atoi(argv[5])-1) break; |
3816 | i++; | 3865 | i++; |
3817 | } | 3866 | } |
3818 | if (i != atoi(argv[5])-1) { | 3867 | if (i != atoi(argv[5])-1) { |
3819 | printmsg("Calendar note not found in file\n"); | 3868 | printmsg("Calendar note not found in file\n"); |
3820 | exit(-1); | 3869 | exit(-1); |
3821 | } | 3870 | } |
3822 | j = 0; | 3871 | j = 0; |
3823 | GSM_EncodeVCALENDAR(Buffer, &j, Backup.Calendar[i],true,Nokia_VCalendar); | 3872 | GSM_EncodeVCALENDAR(Buffer, &j, Backup.Calendar[i],true,Nokia_VCalendar); |
3824 | } else if (mystrncasecmp(argv[2],"BOOKMARK",0)) { | 3873 | } else if (mystrncasecmp(argv[2],"BOOKMARK",0)) { |
3825 | if (argc<5) { | 3874 | if (argc<5) { |
3826 | printmsg("Where is backup filename and location ?\n"); | 3875 | printmsg("Where is backup filename and location ?\n"); |
3827 | exit(-1); | 3876 | exit(-1); |
3828 | } | 3877 | } |
3829 | error=GSM_ReadBackupFile(argv[4],&Backup); | 3878 | error=GSM_ReadBackupFile(argv[4],&Backup); |
3830 | Print_Error(error); | 3879 | if (error!=ERR_NOTIMPLEMENTED) Print_Error(error); |
3831 | i = 0; | 3880 | i = 0; |
3832 | while (Backup.WAPBookmark[i]!=NULL) { | 3881 | while (Backup.WAPBookmark[i]!=NULL) { |
3833 | if (i == atoi(argv[5])-1) break; | 3882 | if (i == atoi(argv[5])-1) break; |
3834 | i++; | 3883 | i++; |
3835 | } | 3884 | } |
3836 | if (i != atoi(argv[5])-1) { | 3885 | if (i != atoi(argv[5])-1) { |
3837 | printmsg("WAP bookmark not found in file\n"); | 3886 | printmsg("WAP bookmark not found in file\n"); |
3838 | exit(-1); | 3887 | exit(-1); |
3839 | } | 3888 | } |
3840 | j = 0; | 3889 | j = 0; |
3841 | GSM_EncodeURLFile(Buffer, &j, Backup.WAPBookmark[i]); | 3890 | GSM_EncodeURLFile(Buffer, &j, Backup.WAPBookmark[i]); |
3842 | } else if (mystrncasecmp(argv[2],"NOTE",0)) { | 3891 | } else if (mystrncasecmp(argv[2],"NOTE",0)) { |
3843 | if (argc<5) { | 3892 | if (argc<5) { |
3844 | printmsg("Where is backup filename and location ?\n"); | 3893 | printmsg("Where is backup filename and location ?\n"); |
3845 | exit(-1); | 3894 | exit(-1); |
3846 | } | 3895 | } |
3847 | error=GSM_ReadBackupFile(argv[4],&Backup); | 3896 | error=GSM_ReadBackupFile(argv[4],&Backup); |
3848 | Print_Error(error); | 3897 | if (error!=ERR_NOTIMPLEMENTED) Print_Error(error); |
3849 | i = 0; | 3898 | i = 0; |
3850 | while (Backup.Note[i]!=NULL) { | 3899 | while (Backup.Note[i]!=NULL) { |
3851 | if (i == atoi(argv[5])-1) break; | 3900 | if (i == atoi(argv[5])-1) break; |
3852 | i++; | 3901 | i++; |
3853 | } | 3902 | } |
3854 | if (i != atoi(argv[5])-1) { | 3903 | if (i != atoi(argv[5])-1) { |
3855 | printmsg("Note not found in file\n"); | 3904 | printmsg("Note not found in file\n"); |
3856 | exit(-1); | 3905 | exit(-1); |
3857 | } | 3906 | } |
3858 | j = 0; | 3907 | j = 0; |
3859 | GSM_EncodeVNTFile(Buffer, &j, Backup.Note[i]); | 3908 | GSM_EncodeVNTFile(Buffer, &j, Backup.Note[i]); |
3860 | } else if (mystrncasecmp(argv[2],"TODO",0)) { | 3909 | } else if (mystrncasecmp(argv[2],"TODO",0)) { |
3861 | if (argc<5) { | 3910 | if (argc<5) { |
3862 | printmsg("Where is backup filename and location ?\n"); | 3911 | printmsg("Where is backup filename and location ?\n"); |
3863 | exit(-1); | 3912 | exit(-1); |
3864 | } | 3913 | } |
3865 | error=GSM_ReadBackupFile(argv[4],&Backup); | 3914 | error=GSM_ReadBackupFile(argv[4],&Backup); |
3866 | Print_Error(error); | 3915 | if (error!=ERR_NOTIMPLEMENTED) Print_Error(error); |
3867 | i = 0; | 3916 | i = 0; |
3868 | while (Backup.ToDo[i]!=NULL) { | 3917 | while (Backup.ToDo[i]!=NULL) { |
3869 | if (i == atoi(argv[5])-1) break; | 3918 | if (i == atoi(argv[5])-1) break; |
3870 | i++; | 3919 | i++; |
3871 | } | 3920 | } |
3872 | if (i != atoi(argv[5])-1) { | 3921 | if (i != atoi(argv[5])-1) { |
3873 | printmsg("ToDo note not found in file\n"); | 3922 | printmsg("ToDo note not found in file\n"); |
3874 | exit(-1); | 3923 | exit(-1); |
3875 | } | 3924 | } |
3876 | j = 0; | 3925 | j = 0; |
3877 | GSM_EncodeVTODO(Buffer, &j, Backup.ToDo[i], true, Nokia_VToDo); | 3926 | GSM_EncodeVTODO(Buffer, &j, Backup.ToDo[i], true, Nokia_VToDo); |
3878 | } else if (mystrncasecmp(argv[2],"VCARD10",0) || mystrncasecmp(argv[2],"VCARD21",0)) { | 3927 | } else if (mystrncasecmp(argv[2],"VCARD10",0) || mystrncasecmp(argv[2],"VCARD21",0)) { |
3879 | if (argc<6) { | 3928 | if (argc<6) { |
3880 | printmsg("Where is backup filename and location and memory type ?\n"); | 3929 | printmsg("Where is backup filename and location and memory type ?\n"); |
3881 | exit(-1); | 3930 | exit(-1); |
3882 | } | 3931 | } |
3883 | error=GSM_ReadBackupFile(argv[4],&Backup); | 3932 | error=GSM_ReadBackupFile(argv[4],&Backup); |
3884 | Print_Error(error); | 3933 | if (error!=ERR_NOTIMPLEMENTED) Print_Error(error); |
3885 | i = 0; | 3934 | i = 0; |
3886 | if (mystrncasecmp(argv[5],"SM",0)) { | 3935 | if (mystrncasecmp(argv[5],"SM",0)) { |
3887 | while (Backup.SIMPhonebook[i]!=NULL) { | 3936 | while (Backup.SIMPhonebook[i]!=NULL) { |
3888 | if (i == atoi(argv[6])-1) break; | 3937 | if (i == atoi(argv[6])-1) break; |
3889 | i++; | 3938 | i++; |
3890 | } | 3939 | } |
3891 | if (i != atoi(argv[6])-1) { | 3940 | if (i != atoi(argv[6])-1) { |
3892 | printmsg("Phonebook entry not found in file\n"); | 3941 | printmsg("Phonebook entry not found in file\n"); |
3893 | exit(-1); | 3942 | exit(-1); |
3894 | } | 3943 | } |
3895 | pbk = Backup.SIMPhonebook[i]; | 3944 | pbk = Backup.SIMPhonebook[i]; |
3896 | } else if (mystrncasecmp(argv[5],"ME",0)) { | 3945 | } else if (mystrncasecmp(argv[5],"ME",0)) { |
3897 | while (Backup.PhonePhonebook[i]!=NULL) { | 3946 | while (Backup.PhonePhonebook[i]!=NULL) { |
3898 | if (i == atoi(argv[6])-1) break; | 3947 | if (i == atoi(argv[6])-1) break; |
3899 | i++; | 3948 | i++; |
3900 | } | 3949 | } |
3901 | if (i != atoi(argv[6])-1) { | 3950 | if (i != atoi(argv[6])-1) { |
3902 | printmsg("Phonebook entry not found in file\n"); | 3951 | printmsg("Phonebook entry not found in file\n"); |
3903 | exit(-1); | 3952 | exit(-1); |
3904 | } | 3953 | } |
3905 | pbk = Backup.PhonePhonebook[i]; | 3954 | pbk = Backup.PhonePhonebook[i]; |
3906 | } else { | 3955 | } else { |
3907 | printmsg("Unknown memory type: \"%s\"\n",argv[5]); | 3956 | printmsg("Unknown memory type: \"%s\"\n",argv[5]); |
3908 | exit(-1); | 3957 | exit(-1); |
3909 | } | 3958 | } |
3910 | j = 0; | 3959 | j = 0; |
3911 | if (mystrncasecmp(argv[2],"VCARD10",0)) { | 3960 | if (mystrncasecmp(argv[2],"VCARD10",0)) { |
3912 | GSM_EncodeVCARD(Buffer,&j,pbk,true,Nokia_VCard10); | 3961 | GSM_EncodeVCARD(Buffer,&j,pbk,true,Nokia_VCard10); |
3913 | } else { | 3962 | } else { |
3914 | GSM_EncodeVCARD(Buffer,&j,pbk,true,Nokia_VCard21); | 3963 | GSM_EncodeVCARD(Buffer,&j,pbk,true,Nokia_VCard21); |
3915 | } | 3964 | } |
3916 | } else { | 3965 | } else { |
3917 | printmsg("What format of file (\"%s\") ?\n",argv[2]); | 3966 | printmsg("What format of file (\"%s\") ?\n",argv[2]); |
3918 | exit(-1); | 3967 | exit(-1); |
3919 | } | 3968 | } |
3920 | 3969 | ||
3921 | file = fopen(argv[3],"wb"); | 3970 | file = fopen(argv[3],"wb"); |
3922 | fwrite(Buffer,1,j,file); | 3971 | fwrite(Buffer,1,j,file); |
3923 | fclose(file); | 3972 | fclose(file); |
3924 | } | 3973 | } |
3925 | 3974 | ||
3926 | static void Backup(int argc, char *argv[]) | 3975 | static void Backup(int argc, char *argv[]) |
3927 | { | 3976 | { |
3928 | int i, used; | 3977 | int i, used; |
3929 | GSM_MemoryStatusMemStatus; | 3978 | GSM_MemoryStatusMemStatus; |
3930 | GSM_ToDoEntry ToDo; | 3979 | GSM_ToDoEntry ToDo; |
3931 | GSM_ToDoStatus ToDoStatus; | 3980 | GSM_ToDoStatus ToDoStatus; |
3932 | GSM_MemoryEntry Pbk; | 3981 | GSM_MemoryEntry Pbk; |
3933 | GSM_CalendarEntryNote; | 3982 | GSM_CalendarEntryCalendar; |
3934 | GSM_Bitmap Bitmap; | 3983 | GSM_Bitmap Bitmap; |
3935 | GSM_WAPBookmark Bookmark; | 3984 | GSM_WAPBookmark Bookmark; |
3936 | GSM_Profile Profile; | 3985 | GSM_Profile Profile; |
3937 | GSM_MultiWAPSettingsSettings; | 3986 | GSM_MultiWAPSettingsSettings; |
3987 | GSM_SyncMLSettingsSyncML; | ||
3988 | GSM_ChatSettingsChat; | ||
3938 | GSM_Ringtone Ringtone; | 3989 | GSM_Ringtone Ringtone; |
3939 | GSM_SMSC SMSC; | 3990 | GSM_SMSC SMSC; |
3940 | GSM_Backup Backup; | 3991 | GSM_Backup Backup; |
3992 | GSM_NoteEntry Note; | ||
3941 | GSM_Backup_Info Info; | 3993 | GSM_Backup_Info Info; |
3942 | GSM_FMStation FMStation; | 3994 | GSM_FMStation FMStation; |
3943 | GSM_GPRSAccessPointGPRSPoint; | 3995 | GSM_GPRSAccessPointGPRSPoint; |
3944 | bool DoBackup; | 3996 | bool DoBackup; |
3945 | 3997 | ||
3946 | if (argc == 4 && mystrncasecmp(argv[3],"-yes",0)) always_answer_yes = true; | 3998 | if (argc == 4 && mystrncasecmp(argv[3],"-yes",0)) always_answer_yes = true; |
3947 | 3999 | ||
3948 | GSM_ClearBackup(&Backup); | 4000 | GSM_ClearBackup(&Backup); |
3949 | GSM_GetBackupFormatFeatures(argv[2],&Info); | 4001 | GSM_GetBackupFormatFeatures(argv[2],&Info); |
3950 | 4002 | ||
3951 | sprintf(Backup.Creator,"Gammu %s",VERSION); | 4003 | sprintf(Backup.Creator,"Gammu %s",VERSION); |
3952 | if (strlen(GetOS()) != 0) { | 4004 | if (strlen(GetOS()) != 0) { |
3953 | strcat(Backup.Creator+strlen(Backup.Creator),", "); | 4005 | strcat(Backup.Creator+strlen(Backup.Creator),", "); |
3954 | strcat(Backup.Creator+strlen(Backup.Creator),GetOS()); | 4006 | strcat(Backup.Creator+strlen(Backup.Creator),GetOS()); |
3955 | } | 4007 | } |
3956 | if (strlen(GetCompiler()) != 0) { | 4008 | if (strlen(GetCompiler()) != 0) { |
3957 | strcat(Backup.Creator+strlen(Backup.Creator),", "); | 4009 | strcat(Backup.Creator+strlen(Backup.Creator),", "); |
3958 | strcat(Backup.Creator+strlen(Backup.Creator),GetCompiler()); | 4010 | strcat(Backup.Creator+strlen(Backup.Creator),GetCompiler()); |
3959 | } | 4011 | } |
3960 | 4012 | ||
3961 | signal(SIGINT, interrupt); | 4013 | signal(SIGINT, interrupt); |
3962 | printmsgerr("Press Ctrl+C to break...\n"); | 4014 | printmsgerr("Press Ctrl+C to break...\n"); |
3963 | 4015 | ||
3964 | GSM_Init(true); | 4016 | GSM_Init(true); |
@@ -4053,110 +4105,142 @@ static void Backup(int argc, char *argv[]) | |||
4053 | if (used < GSM_BACKUP_MAX_SIMPHONEBOOK) { | 4105 | if (used < GSM_BACKUP_MAX_SIMPHONEBOOK) { |
4054 | Backup.SIMPhonebook[used] = malloc(sizeof(GSM_MemoryEntry)); | 4106 | Backup.SIMPhonebook[used] = malloc(sizeof(GSM_MemoryEntry)); |
4055 | if (Backup.SIMPhonebook[used] == NULL) Print_Error(ERR_MOREMEMORY); | 4107 | if (Backup.SIMPhonebook[used] == NULL) Print_Error(ERR_MOREMEMORY); |
4056 | Backup.SIMPhonebook[used + 1] = NULL; | 4108 | Backup.SIMPhonebook[used + 1] = NULL; |
4057 | } else { | 4109 | } else { |
4058 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_SIMPHONEBOOK"); | 4110 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_SIMPHONEBOOK"); |
4059 | GSM_Terminate(); | 4111 | GSM_Terminate(); |
4060 | exit(-1); | 4112 | exit(-1); |
4061 | } | 4113 | } |
4062 | *Backup.SIMPhonebook[used]=Pbk; | 4114 | *Backup.SIMPhonebook[used]=Pbk; |
4063 | used++; | 4115 | used++; |
4064 | } | 4116 | } |
4065 | printmsgerr("%c Reading: %i percent",13,used*100/MemStatus.MemoryUsed); | 4117 | printmsgerr("%c Reading: %i percent",13,used*100/MemStatus.MemoryUsed); |
4066 | i++; | 4118 | i++; |
4067 | if (gshutdown) { | 4119 | if (gshutdown) { |
4068 | GSM_Terminate(); | 4120 | GSM_Terminate(); |
4069 | exit(0); | 4121 | exit(0); |
4070 | } | 4122 | } |
4071 | } | 4123 | } |
4072 | printmsgerr("\n"); | 4124 | printmsgerr("\n"); |
4073 | } | 4125 | } |
4074 | DoBackup = false; | 4126 | DoBackup = false; |
4075 | if (Info.Calendar) { | 4127 | if (Info.Calendar) { |
4076 | printmsg("Checking calendar\n"); | 4128 | printmsg("Checking calendar\n"); |
4077 | error=Phone->GetNextCalendar(&s,&Note,true); | 4129 | error=Phone->GetNextCalendar(&s,&Calendar,true); |
4078 | if (error==ERR_NONE) { | 4130 | if (error==ERR_NONE) { |
4079 | if (answer_yes(" Backup calendar notes")) DoBackup = true; | 4131 | if (answer_yes(" Backup calendar notes")) DoBackup = true; |
4080 | } | 4132 | } |
4081 | } | 4133 | } |
4082 | if (DoBackup) { | 4134 | if (DoBackup) { |
4083 | used = 0; | 4135 | used = 0; |
4084 | printmsgerr(" Reading : "); | 4136 | printmsgerr(" Reading : "); |
4085 | while (error == ERR_NONE) { | 4137 | while (error == ERR_NONE) { |
4086 | if (used < GSM_MAXCALENDARTODONOTES) { | 4138 | if (used < GSM_MAXCALENDARTODONOTES) { |
4087 | Backup.Calendar[used] = malloc(sizeof(GSM_CalendarEntry)); | 4139 | Backup.Calendar[used] = malloc(sizeof(GSM_CalendarEntry)); |
4088 | if (Backup.Calendar[used] == NULL) Print_Error(ERR_MOREMEMORY); | 4140 | if (Backup.Calendar[used] == NULL) Print_Error(ERR_MOREMEMORY); |
4089 | Backup.Calendar[used+1] = NULL; | 4141 | Backup.Calendar[used+1] = NULL; |
4090 | } else { | 4142 | } else { |
4091 | printmsg(" Increase %s\n" , "GSM_MAXCALENDARTODONOTES"); | 4143 | printmsg(" Increase %s\n" , "GSM_MAXCALENDARTODONOTES"); |
4092 | GSM_Terminate(); | 4144 | GSM_Terminate(); |
4093 | exit(-1); | 4145 | exit(-1); |
4094 | } | 4146 | } |
4095 | *Backup.Calendar[used]=Note; | 4147 | *Backup.Calendar[used]=Calendar; |
4096 | used ++; | 4148 | used ++; |
4097 | error=Phone->GetNextCalendar(&s,&Note,false); | 4149 | error=Phone->GetNextCalendar(&s,&Calendar,false); |
4098 | printmsgerr("*"); | 4150 | printmsgerr("*"); |
4099 | if (gshutdown) { | 4151 | if (gshutdown) { |
4100 | GSM_Terminate(); | 4152 | GSM_Terminate(); |
4101 | exit(0); | 4153 | exit(0); |
4102 | } | 4154 | } |
4103 | } | 4155 | } |
4104 | printmsgerr("\n"); | 4156 | printmsgerr("\n"); |
4105 | } | 4157 | } |
4106 | DoBackup = false; | 4158 | DoBackup = false; |
4107 | if (Info.ToDo) { | 4159 | if (Info.ToDo) { |
4108 | printmsg("Checking ToDo\n"); | 4160 | printmsg("Checking ToDo\n"); |
4109 | error=Phone->GetToDoStatus(&s,&ToDoStatus); | 4161 | error=Phone->GetToDoStatus(&s,&ToDoStatus); |
4110 | if (error == ERR_NONE && ToDoStatus.Used != 0) { | 4162 | if (error == ERR_NONE && ToDoStatus.Used != 0) { |
4111 | if (answer_yes(" Backup ToDo")) DoBackup = true; | 4163 | if (answer_yes(" Backup ToDo")) DoBackup = true; |
4112 | } | 4164 | } |
4113 | } | 4165 | } |
4114 | if (DoBackup) { | 4166 | if (DoBackup) { |
4115 | used = 0; | 4167 | used = 0; |
4116 | error=Phone->GetNextToDo(&s,&ToDo,true); | 4168 | error=Phone->GetNextToDo(&s,&ToDo,true); |
4117 | while (error == ERR_NONE) { | 4169 | while (error == ERR_NONE) { |
4118 | if (used < GSM_MAXCALENDARTODONOTES) { | 4170 | if (used < GSM_MAXCALENDARTODONOTES) { |
4119 | Backup.ToDo[used] = malloc(sizeof(GSM_ToDoEntry)); | 4171 | Backup.ToDo[used] = malloc(sizeof(GSM_ToDoEntry)); |
4120 | if (Backup.ToDo[used] == NULL) Print_Error(ERR_MOREMEMORY); | 4172 | if (Backup.ToDo[used] == NULL) Print_Error(ERR_MOREMEMORY); |
4121 | Backup.ToDo[used+1] = NULL; | 4173 | Backup.ToDo[used+1] = NULL; |
4122 | } else { | 4174 | } else { |
4123 | printmsg(" Increase %s\n" , "GSM_MAXCALENDARTODONOTES"); | 4175 | printmsg(" Increase %s\n" , "GSM_MAXCALENDARTODONOTES"); |
4124 | GSM_Terminate(); | 4176 | GSM_Terminate(); |
4125 | exit(-1); | 4177 | exit(-1); |
4126 | } | 4178 | } |
4127 | *Backup.ToDo[used]=ToDo; | 4179 | *Backup.ToDo[used]=ToDo; |
4128 | used ++; | 4180 | used ++; |
4129 | error=Phone->GetNextToDo(&s,&ToDo,false); | 4181 | error=Phone->GetNextToDo(&s,&ToDo,false); |
4130 | printmsgerr("%c Reading: %i percent",13,used*100/ToDoStatus.Used); | 4182 | printmsgerr("%c Reading: %i percent",13,used*100/ToDoStatus.Used); |
4131 | if (gshutdown) { | 4183 | if (gshutdown) { |
4132 | GSM_Terminate(); | 4184 | GSM_Terminate(); |
4133 | exit(0); | 4185 | exit(0); |
4134 | } | 4186 | } |
4135 | } | 4187 | } |
4136 | printmsgerr("\n"); | 4188 | printmsgerr("\n"); |
4137 | } | 4189 | } |
4138 | DoBackup = false; | 4190 | DoBackup = false; |
4191 | if (Info.Note) { | ||
4192 | printmsg("Checking notes\n"); | ||
4193 | error=Phone->GetNextNote(&s,&Note,true); | ||
4194 | if (error==ERR_NONE) { | ||
4195 | if (answer_yes(" Backup notes")) DoBackup = true; | ||
4196 | } | ||
4197 | } | ||
4198 | if (DoBackup) { | ||
4199 | used = 0; | ||
4200 | printmsgerr(" Reading : "); | ||
4201 | while (error == ERR_NONE) { | ||
4202 | if (used < GSM_BACKUP_MAX_NOTE) { | ||
4203 | Backup.Note[used] = malloc(sizeof(GSM_NoteEntry)); | ||
4204 | if (Backup.Note[used] == NULL) Print_Error(ERR_MOREMEMORY); | ||
4205 | Backup.Note[used+1] = NULL; | ||
4206 | } else { | ||
4207 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_NOTE"); | ||
4208 | GSM_Terminate(); | ||
4209 | exit(-1); | ||
4210 | } | ||
4211 | *Backup.Note[used]=Note; | ||
4212 | used ++; | ||
4213 | error=Phone->GetNextNote(&s,&Note,false); | ||
4214 | printmsgerr("*"); | ||
4215 | if (gshutdown) { | ||
4216 | GSM_Terminate(); | ||
4217 | exit(0); | ||
4218 | } | ||
4219 | } | ||
4220 | printmsgerr("\n"); | ||
4221 | } | ||
4222 | DoBackup = false; | ||
4139 | if (Info.CallerLogos) { | 4223 | if (Info.CallerLogos) { |
4140 | printmsg("Checking caller logos\n"); | 4224 | printmsg("Checking caller logos\n"); |
4141 | Bitmap.Type = GSM_CallerGroupLogo; | 4225 | Bitmap.Type = GSM_CallerGroupLogo; |
4142 | Bitmap.Location = 1; | 4226 | Bitmap.Location = 1; |
4143 | error=Phone->GetBitmap(&s,&Bitmap); | 4227 | error=Phone->GetBitmap(&s,&Bitmap); |
4144 | if (error == ERR_NONE) { | 4228 | if (error == ERR_NONE) { |
4145 | if (answer_yes(" Backup caller groups and logos")) DoBackup = true; | 4229 | if (answer_yes(" Backup caller groups and logos")) DoBackup = true; |
4146 | } | 4230 | } |
4147 | } | 4231 | } |
4148 | if (DoBackup) { | 4232 | if (DoBackup) { |
4149 | printmsgerr(" Reading : "); | 4233 | printmsgerr(" Reading : "); |
4150 | error = ERR_NONE; | 4234 | error = ERR_NONE; |
4151 | used = 0; | 4235 | used = 0; |
4152 | while (error == ERR_NONE) { | 4236 | while (error == ERR_NONE) { |
4153 | if (used < GSM_BACKUP_MAX_CALLER) { | 4237 | if (used < GSM_BACKUP_MAX_CALLER) { |
4154 | Backup.CallerLogos[used] = malloc(sizeof(GSM_Bitmap)); | 4238 | Backup.CallerLogos[used] = malloc(sizeof(GSM_Bitmap)); |
4155 | if (Backup.CallerLogos[used] == NULL) Print_Error(ERR_MOREMEMORY); | 4239 | if (Backup.CallerLogos[used] == NULL) Print_Error(ERR_MOREMEMORY); |
4156 | Backup.CallerLogos[used+1] = NULL; | 4240 | Backup.CallerLogos[used+1] = NULL; |
4157 | } else { | 4241 | } else { |
4158 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_CALLER"); | 4242 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_CALLER"); |
4159 | GSM_Terminate(); | 4243 | GSM_Terminate(); |
4160 | exit(-1); | 4244 | exit(-1); |
4161 | } | 4245 | } |
4162 | *Backup.CallerLogos[used] = Bitmap; | 4246 | *Backup.CallerLogos[used] = Bitmap; |
@@ -4213,141 +4297,209 @@ static void Backup(int argc, char *argv[]) | |||
4213 | *Backup.StartupLogo = Bitmap; | 4297 | *Backup.StartupLogo = Bitmap; |
4214 | if (Bitmap.Text[0]==0 && Bitmap.Text[1]==0) { | 4298 | if (Bitmap.Text[0]==0 && Bitmap.Text[1]==0) { |
4215 | Bitmap.Type = GSM_StartupLogo; | 4299 | Bitmap.Type = GSM_StartupLogo; |
4216 | error = Phone->GetBitmap(&s,&Bitmap); | 4300 | error = Phone->GetBitmap(&s,&Bitmap); |
4217 | if (error == ERR_NONE) *Backup.StartupLogo = Bitmap; | 4301 | if (error == ERR_NONE) *Backup.StartupLogo = Bitmap; |
4218 | } | 4302 | } |
4219 | } | 4303 | } |
4220 | DoBackup = false; | 4304 | DoBackup = false; |
4221 | if (Info.OperatorLogo) { | 4305 | if (Info.OperatorLogo) { |
4222 | printmsg("Checking operator logo\n"); | 4306 | printmsg("Checking operator logo\n"); |
4223 | Bitmap.Type = GSM_OperatorLogo; | 4307 | Bitmap.Type = GSM_OperatorLogo; |
4224 | error=Phone->GetBitmap(&s,&Bitmap); | 4308 | error=Phone->GetBitmap(&s,&Bitmap); |
4225 | if (error == ERR_NONE) { | 4309 | if (error == ERR_NONE) { |
4226 | if (strcmp(Bitmap.NetworkCode,"000 00")!=0) { | 4310 | if (strcmp(Bitmap.NetworkCode,"000 00")!=0) { |
4227 | if (answer_yes(" Backup operator logo")) DoBackup = true; | 4311 | if (answer_yes(" Backup operator logo")) DoBackup = true; |
4228 | } | 4312 | } |
4229 | } | 4313 | } |
4230 | } | 4314 | } |
4231 | if (DoBackup) { | 4315 | if (DoBackup) { |
4232 | Backup.OperatorLogo = malloc(sizeof(GSM_Bitmap)); | 4316 | Backup.OperatorLogo = malloc(sizeof(GSM_Bitmap)); |
4233 | if (Backup.OperatorLogo == NULL) Print_Error(ERR_MOREMEMORY); | 4317 | if (Backup.OperatorLogo == NULL) Print_Error(ERR_MOREMEMORY); |
4234 | *Backup.OperatorLogo = Bitmap; | 4318 | *Backup.OperatorLogo = Bitmap; |
4235 | } | 4319 | } |
4236 | DoBackup = false; | 4320 | DoBackup = false; |
4321 | if (Info.WAPBookmark) { | ||
4322 | printmsg("Checking WAP bookmarks\n"); | ||
4323 | Bookmark.Location = 1; | ||
4324 | error=Phone->GetWAPBookmark(&s,&Bookmark); | ||
4325 | if (error==ERR_NONE) { | ||
4326 | if (answer_yes(" Backup WAP bookmarks")) DoBackup = true; | ||
4327 | } | ||
4328 | } | ||
4329 | if (DoBackup) { | ||
4330 | used = 0; | ||
4331 | printmsgerr(" Reading : "); | ||
4332 | while (error == ERR_NONE) { | ||
4333 | if (used < GSM_BACKUP_MAX_WAPBOOKMARK) { | ||
4334 | Backup.WAPBookmark[used] = malloc(sizeof(GSM_WAPBookmark)); | ||
4335 | if (Backup.WAPBookmark[used] == NULL) Print_Error(ERR_MOREMEMORY); | ||
4336 | Backup.WAPBookmark[used+1] = NULL; | ||
4337 | } else { | ||
4338 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_WAPBOOKMARK"); | ||
4339 | GSM_Terminate(); | ||
4340 | exit(-1); | ||
4341 | } | ||
4342 | *Backup.WAPBookmark[used]=Bookmark; | ||
4343 | used ++; | ||
4344 | Bookmark.Location = used+1; | ||
4345 | error=Phone->GetWAPBookmark(&s,&Bookmark); | ||
4346 | printmsgerr("*"); | ||
4347 | if (gshutdown) { | ||
4348 | GSM_Terminate(); | ||
4349 | exit(0); | ||
4350 | } | ||
4351 | } | ||
4352 | printmsgerr("\n"); | ||
4353 | } | ||
4354 | DoBackup = false; | ||
4355 | if (Info.WAPSettings) { | ||
4356 | printmsg("Checking WAP settings\n"); | ||
4357 | Settings.Location = 1; | ||
4358 | error=Phone->GetWAPSettings(&s,&Settings); | ||
4359 | if (error==ERR_NONE) { | ||
4360 | if (answer_yes(" Backup WAP settings")) DoBackup = true; | ||
4361 | } | ||
4362 | } | ||
4363 | if (DoBackup) { | ||
4364 | used = 0; | ||
4365 | printmsgerr(" Reading : "); | ||
4366 | while (error == ERR_NONE) { | ||
4367 | if (used < GSM_BACKUP_MAX_WAPSETTINGS) { | ||
4368 | Backup.WAPSettings[used] = malloc(sizeof(GSM_MultiWAPSettings)); | ||
4369 | if (Backup.WAPSettings[used] == NULL) Print_Error(ERR_MOREMEMORY); | ||
4370 | Backup.WAPSettings[used+1] = NULL; | ||
4371 | } else { | ||
4372 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_WAPSETTINGS"); | ||
4373 | GSM_Terminate(); | ||
4374 | exit(-1); | ||
4375 | } | ||
4376 | *Backup.WAPSettings[used]=Settings; | ||
4377 | used ++; | ||
4378 | Settings.Location = used+1; | ||
4379 | error=Phone->GetWAPSettings(&s,&Settings); | ||
4380 | printmsgerr("*"); | ||
4381 | if (gshutdown) { | ||
4382 | GSM_Terminate(); | ||
4383 | exit(0); | ||
4384 | } | ||
4385 | } | ||
4386 | printmsgerr("\n"); | ||
4387 | } | ||
4388 | DoBackup = false; | ||
4237 | if (Info.MMSSettings) { | 4389 | if (Info.MMSSettings) { |
4238 | printmsg("Checking MMS settings\n"); | 4390 | printmsg("Checking MMS settings\n"); |
4239 | Settings.Location = 1; | 4391 | Settings.Location = 1; |
4240 | error=Phone->GetMMSSettings(&s,&Settings); | 4392 | error=Phone->GetMMSSettings(&s,&Settings); |
4241 | if (error==ERR_NONE) { | 4393 | if (error==ERR_NONE) { |
4242 | if (answer_yes(" Backup MMS settings")) DoBackup = true; | 4394 | if (answer_yes(" Backup MMS settings")) DoBackup = true; |
4243 | } | 4395 | } |
4244 | } | 4396 | } |
4245 | if (DoBackup) { | 4397 | if (DoBackup) { |
4246 | used = 0; | 4398 | used = 0; |
4247 | printmsgerr(" Reading : "); | 4399 | printmsgerr(" Reading : "); |
4248 | while (error == ERR_NONE) { | 4400 | while (error == ERR_NONE) { |
4249 | if (used < GSM_BACKUP_MAX_MMSSETTINGS) { | 4401 | if (used < GSM_BACKUP_MAX_MMSSETTINGS) { |
4250 | Backup.MMSSettings[used] = malloc(sizeof(GSM_MultiWAPSettings)); | 4402 | Backup.MMSSettings[used] = malloc(sizeof(GSM_MultiWAPSettings)); |
4251 | if (Backup.MMSSettings[used] == NULL) Print_Error(ERR_MOREMEMORY); | 4403 | if (Backup.MMSSettings[used] == NULL) Print_Error(ERR_MOREMEMORY); |
4252 | Backup.MMSSettings[used+1] = NULL; | 4404 | Backup.MMSSettings[used+1] = NULL; |
4253 | } else { | 4405 | } else { |
4254 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_MMSSETTINGS"); | 4406 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_MMSSETTINGS"); |
4255 | GSM_Terminate(); | 4407 | GSM_Terminate(); |
4256 | exit(-1); | 4408 | exit(-1); |
4257 | } | 4409 | } |
4258 | *Backup.MMSSettings[used]=Settings; | 4410 | *Backup.MMSSettings[used]=Settings; |
4259 | used ++; | 4411 | used ++; |
4260 | Settings.Location = used+1; | 4412 | Settings.Location = used+1; |
4261 | error=Phone->GetMMSSettings(&s,&Settings); | 4413 | error=Phone->GetMMSSettings(&s,&Settings); |
4262 | printmsgerr("*"); | 4414 | printmsgerr("*"); |
4263 | if (gshutdown) { | 4415 | if (gshutdown) { |
4264 | GSM_Terminate(); | 4416 | GSM_Terminate(); |
4265 | exit(0); | 4417 | exit(0); |
4266 | } | 4418 | } |
4267 | } | 4419 | } |
4268 | printmsgerr("\n"); | 4420 | printmsgerr("\n"); |
4269 | } | 4421 | } |
4270 | DoBackup = false; | 4422 | DoBackup = false; |
4271 | if (Info.WAPBookmark) { | 4423 | if (Info.ChatSettings) { |
4272 | printmsg("Checking WAP bookmarks\n"); | 4424 | printmsg("Checking Chat settings\n"); |
4273 | Bookmark.Location = 1; | 4425 | Chat.Location = 1; |
4274 | error=Phone->GetWAPBookmark(&s,&Bookmark); | 4426 | error=Phone->GetChatSettings(&s,&Chat); |
4275 | if (error==ERR_NONE) { | 4427 | if (error==ERR_NONE) { |
4276 | if (answer_yes(" Backup WAP bookmarks")) DoBackup = true; | 4428 | if (answer_yes(" Backup Chat settings")) DoBackup = true; |
4277 | } | 4429 | } |
4278 | } | 4430 | } |
4279 | if (DoBackup) { | 4431 | if (DoBackup) { |
4280 | used = 0; | 4432 | used = 0; |
4281 | printmsgerr(" Reading : "); | 4433 | printmsgerr(" Reading : "); |
4282 | while (error == ERR_NONE) { | 4434 | while (error == ERR_NONE) { |
4283 | if (used < GSM_BACKUP_MAX_WAPBOOKMARK) { | 4435 | if (used < GSM_BACKUP_MAX_CHATSETTINGS) { |
4284 | Backup.WAPBookmark[used] = malloc(sizeof(GSM_WAPBookmark)); | 4436 | Backup.ChatSettings[used] = malloc(sizeof(GSM_ChatSettings)); |
4285 | if (Backup.WAPBookmark[used] == NULL) Print_Error(ERR_MOREMEMORY); | 4437 | if (Backup.ChatSettings[used] == NULL) Print_Error(ERR_MOREMEMORY); |
4286 | Backup.WAPBookmark[used+1] = NULL; | 4438 | Backup.ChatSettings[used+1] = NULL; |
4287 | } else { | 4439 | } else { |
4288 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_WAPBOOKMARK"); | 4440 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_CHATSETTINGS"); |
4289 | GSM_Terminate(); | 4441 | GSM_Terminate(); |
4290 | exit(-1); | 4442 | exit(-1); |
4291 | } | 4443 | } |
4292 | *Backup.WAPBookmark[used]=Bookmark; | 4444 | *Backup.ChatSettings[used]=Chat; |
4293 | used ++; | 4445 | used ++; |
4294 | Bookmark.Location = used+1; | 4446 | Chat.Location = used+1; |
4295 | error=Phone->GetWAPBookmark(&s,&Bookmark); | 4447 | error=Phone->GetChatSettings(&s,&Chat); |
4296 | printmsgerr("*"); | 4448 | printmsgerr("*"); |
4297 | if (gshutdown) { | 4449 | if (gshutdown) { |
4298 | GSM_Terminate(); | 4450 | GSM_Terminate(); |
4299 | exit(0); | 4451 | exit(0); |
4300 | } | 4452 | } |
4301 | } | 4453 | } |
4302 | printmsgerr("\n"); | 4454 | printmsgerr("\n"); |
4303 | } | 4455 | } |
4304 | DoBackup = false; | 4456 | DoBackup = false; |
4305 | if (Info.WAPSettings) { | 4457 | if (Info.SyncMLSettings) { |
4306 | printmsg("Checking WAP settings\n"); | 4458 | printmsg("Checking SyncML settings\n"); |
4307 | Settings.Location = 1; | 4459 | SyncML.Location = 1; |
4308 | error=Phone->GetWAPSettings(&s,&Settings); | 4460 | error=Phone->GetSyncMLSettings(&s,&SyncML); |
4309 | if (error==ERR_NONE) { | 4461 | if (error==ERR_NONE) { |
4310 | if (answer_yes(" Backup WAP settings")) DoBackup = true; | 4462 | if (answer_yes(" Backup SyncML settings")) DoBackup = true; |
4311 | } | 4463 | } |
4312 | } | 4464 | } |
4313 | if (DoBackup) { | 4465 | if (DoBackup) { |
4314 | used = 0; | 4466 | used = 0; |
4315 | printmsgerr(" Reading : "); | 4467 | printmsgerr(" Reading : "); |
4316 | while (error == ERR_NONE) { | 4468 | while (error == ERR_NONE) { |
4317 | if (used < GSM_BACKUP_MAX_WAPSETTINGS) { | 4469 | if (used < GSM_BACKUP_MAX_SYNCMLSETTINGS) { |
4318 | Backup.WAPSettings[used] = malloc(sizeof(GSM_MultiWAPSettings)); | 4470 | Backup.SyncMLSettings[used] = malloc(sizeof(GSM_SyncMLSettings)); |
4319 | if (Backup.WAPSettings[used] == NULL) Print_Error(ERR_MOREMEMORY); | 4471 | if (Backup.SyncMLSettings[used] == NULL) Print_Error(ERR_MOREMEMORY); |
4320 | Backup.WAPSettings[used+1] = NULL; | 4472 | Backup.SyncMLSettings[used+1] = NULL; |
4321 | } else { | 4473 | } else { |
4322 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_WAPSETTINGS"); | 4474 | printmsg(" Increase %s\n" , "GSM_BACKUP_MAX_SYNCMLSETTINGS"); |
4323 | GSM_Terminate(); | 4475 | GSM_Terminate(); |
4324 | exit(-1); | 4476 | exit(-1); |
4325 | } | 4477 | } |
4326 | *Backup.WAPSettings[used]=Settings; | 4478 | *Backup.SyncMLSettings[used]=SyncML; |
4327 | used ++; | 4479 | used ++; |
4328 | Settings.Location = used+1; | 4480 | SyncML.Location = used+1; |
4329 | error=Phone->GetWAPSettings(&s,&Settings); | 4481 | error=Phone->GetSyncMLSettings(&s,&SyncML); |
4330 | printmsgerr("*"); | 4482 | printmsgerr("*"); |
4331 | if (gshutdown) { | 4483 | if (gshutdown) { |
4332 | GSM_Terminate(); | 4484 | GSM_Terminate(); |
4333 | exit(0); | 4485 | exit(0); |
4334 | } | 4486 | } |
4335 | } | 4487 | } |
4336 | printmsgerr("\n"); | 4488 | printmsgerr("\n"); |
4337 | } | 4489 | } |
4338 | DoBackup = false; | 4490 | DoBackup = false; |
4339 | if (Info.Ringtone) { | 4491 | if (Info.Ringtone) { |
4340 | printmsg("Checking user ringtones\n"); | 4492 | printmsg("Checking user ringtones\n"); |
4341 | Ringtone.Location = 1; | 4493 | Ringtone.Location = 1; |
4342 | Ringtone.Format = 0; | 4494 | Ringtone.Format = 0; |
4343 | error=Phone->GetRingtone(&s,&Ringtone,false); | 4495 | error=Phone->GetRingtone(&s,&Ringtone,false); |
4344 | if (error==ERR_EMPTY || error == ERR_NONE) { | 4496 | if (error==ERR_EMPTY || error == ERR_NONE) { |
4345 | if (answer_yes(" Backup user ringtones")) DoBackup = true; | 4497 | if (answer_yes(" Backup user ringtones")) DoBackup = true; |
4346 | } | 4498 | } |
4347 | } | 4499 | } |
4348 | if (DoBackup) { | 4500 | if (DoBackup) { |
4349 | used = 0; | 4501 | used = 0; |
4350 | i= 1; | 4502 | i= 1; |
4351 | printmsgerr(" Reading : "); | 4503 | printmsgerr(" Reading : "); |
4352 | while (error == ERR_NONE || error == ERR_EMPTY) { | 4504 | while (error == ERR_NONE || error == ERR_EMPTY) { |
4353 | if (error == ERR_NONE) { | 4505 | if (error == ERR_NONE) { |
@@ -4481,56 +4633,61 @@ static void Backup(int argc, char *argv[]) | |||
4481 | GSM_FreeBackup(&Backup); | 4633 | GSM_FreeBackup(&Backup); |
4482 | } | 4634 | } |
4483 | 4635 | ||
4484 | static void Restore(int argc, char *argv[]) | 4636 | static void Restore(int argc, char *argv[]) |
4485 | { | 4637 | { |
4486 | GSM_Backup Backup; | 4638 | GSM_Backup Backup; |
4487 | GSM_FMStation FMStation; | 4639 | GSM_FMStation FMStation; |
4488 | GSM_DateTime date_time; | 4640 | GSM_DateTime date_time; |
4489 | GSM_CalendarEntryCalendar; | 4641 | GSM_CalendarEntryCalendar; |
4490 | GSM_Bitmap Bitmap; | 4642 | GSM_Bitmap Bitmap; |
4491 | GSM_Ringtone Ringtone; | 4643 | GSM_Ringtone Ringtone; |
4492 | GSM_MemoryEntry Pbk; | 4644 | GSM_MemoryEntry Pbk; |
4493 | GSM_MemoryStatusMemStatus; | 4645 | GSM_MemoryStatusMemStatus; |
4494 | GSM_ToDoEntry ToDo; | 4646 | GSM_ToDoEntry ToDo; |
4495 | GSM_ToDoStatus ToDoStatus; | 4647 | GSM_ToDoStatus ToDoStatus; |
4496 | GSM_Profile Profile; | 4648 | GSM_Profile Profile; |
4497 | GSM_MultiWAPSettingsSettings; | 4649 | GSM_MultiWAPSettingsSettings; |
4498 | GSM_GPRSAccessPointGPRSPoint; | 4650 | GSM_GPRSAccessPointGPRSPoint; |
4499 | GSM_WAPBookmark Bookmark; | 4651 | GSM_WAPBookmark Bookmark; |
4500 | int i, used, max = 0; | 4652 | int i, used, max = 0; |
4501 | bool Past = true; | 4653 | bool Past = true; |
4502 | bool Found, DoRestore; | 4654 | bool Found, DoRestore; |
4503 | 4655 | ||
4504 | error=GSM_ReadBackupFile(argv[2],&Backup); | 4656 | error=GSM_ReadBackupFile(argv[2],&Backup); |
4505 | Print_Error(error); | 4657 | if (error!=ERR_NOTIMPLEMENTED) { |
4658 | Print_Error(error); | ||
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"); | ||
4661 | } | ||
4506 | 4662 | ||
4507 | signal(SIGINT, interrupt); | 4663 | signal(SIGINT, interrupt); |
4508 | printmsgerr("Press Ctrl+C to break...\n"); | 4664 | printmsgerr("Press Ctrl+C to break...\n"); |
4509 | 4665 | ||
4510 | 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)); |
4511 | if (Backup.Model[0]!=0) printmsgerr("Phone : %s\n",Backup.Model); | 4667 | if (Backup.Model[0]!=0) printmsgerr("Phone : %s\n",Backup.Model); |
4512 | 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); | ||
4513 | 4670 | ||
4514 | if (Backup.MD5Calculated[0]!=0) { | 4671 | if (Backup.MD5Calculated[0]!=0) { |
4515 | dbgprintf("\"%s\"\n",Backup.MD5Original); | 4672 | dbgprintf("\"%s\"\n",Backup.MD5Original); |
4516 | dbgprintf("\"%s\"\n",Backup.MD5Calculated); | 4673 | dbgprintf("\"%s\"\n",Backup.MD5Calculated); |
4517 | if (strcmp(Backup.MD5Original,Backup.MD5Calculated)) { | 4674 | if (strcmp(Backup.MD5Original,Backup.MD5Calculated)) { |
4518 | 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; |
4519 | } | 4676 | } |
4520 | } | 4677 | } |
4521 | 4678 | ||
4522 | GSM_Init(true); | 4679 | GSM_Init(true); |
4523 | 4680 | ||
4524 | DoRestore = false; | 4681 | DoRestore = false; |
4525 | if (Backup.PhonePhonebook[0] != NULL) { | 4682 | if (Backup.PhonePhonebook[0] != NULL) { |
4526 | MemStatus.MemoryType = MEM_ME; | 4683 | MemStatus.MemoryType = MEM_ME; |
4527 | error=Phone->GetMemoryStatus(&s, &MemStatus); | 4684 | error=Phone->GetMemoryStatus(&s, &MemStatus); |
4528 | if (error==ERR_NONE) { | 4685 | if (error==ERR_NONE) { |
4529 | max = 0; | 4686 | max = 0; |
4530 | while (Backup.PhonePhonebook[max]!=NULL) max++; | 4687 | while (Backup.PhonePhonebook[max]!=NULL) max++; |
4531 | printmsgerr("%i entries in backup file\n",max); | 4688 | printmsgerr("%i entries in backup file\n",max); |
4532 | if (answer_yes("Restore phone phonebook")) DoRestore = true; | 4689 | if (answer_yes("Restore phone phonebook")) DoRestore = true; |
4533 | } | 4690 | } |
4534 | } | 4691 | } |
4535 | if (DoRestore) { | 4692 | if (DoRestore) { |
4536 | used = 0; | 4693 | used = 0; |
@@ -4597,123 +4754,117 @@ static void Restore(int argc, char *argv[]) | |||
4597 | if (Backup.CallerLogos[0] != NULL) { | 4754 | if (Backup.CallerLogos[0] != NULL) { |
4598 | Bitmap.Type = GSM_CallerGroupLogo; | 4755 | Bitmap.Type = GSM_CallerGroupLogo; |
4599 | Bitmap.Location = 1; | 4756 | Bitmap.Location = 1; |
4600 | error=Phone->GetBitmap(&s,&Bitmap); | 4757 | error=Phone->GetBitmap(&s,&Bitmap); |
4601 | if (error == ERR_NONE) { | 4758 | if (error == ERR_NONE) { |
4602 | if (answer_yes("Restore caller groups and logos")) DoRestore = true; | 4759 | if (answer_yes("Restore caller groups and logos")) DoRestore = true; |
4603 | } | 4760 | } |
4604 | } | 4761 | } |
4605 | if (DoRestore) { | 4762 | if (DoRestore) { |
4606 | max = 0; | 4763 | max = 0; |
4607 | while (Backup.CallerLogos[max]!=NULL) max++; | 4764 | while (Backup.CallerLogos[max]!=NULL) max++; |
4608 | for (i=0;i<max;i++) { | 4765 | for (i=0;i<max;i++) { |
4609 | error=Phone->SetBitmap(&s,Backup.CallerLogos[i]); | 4766 | error=Phone->SetBitmap(&s,Backup.CallerLogos[i]); |
4610 | Print_Error(error); | 4767 | Print_Error(error); |
4611 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 4768 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
4612 | if (gshutdown) { | 4769 | if (gshutdown) { |
4613 | GSM_Terminate(); | 4770 | GSM_Terminate(); |
4614 | exit(0); | 4771 | exit(0); |
4615 | } | 4772 | } |
4616 | } | 4773 | } |
4617 | printmsgerr("\n"); | 4774 | printmsgerr("\n"); |
4618 | } | 4775 | } |
4619 | 4776 | ||
4620 | if (!mystrncasecmp(s.CurrentConfig->SyncTime,"yes",0)) { | 4777 | if (!mystrncasecmp(s.CurrentConfig->SyncTime,"yes",0)) { |
4621 | 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)")*/ true ) { | 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)")) { |
4622 | GSM_GetCurrentDateTime(&date_time); | 4779 | GSM_GetCurrentDateTime(&date_time); |
4623 | 4780 | ||
4624 | error=Phone->SetDateTime(&s, &date_time); | 4781 | error=Phone->SetDateTime(&s, &date_time); |
4625 | Print_Error(error); | 4782 | Print_Error(error); |
4626 | } | 4783 | } |
4627 | } | 4784 | } |
4628 | DoRestore = false; | 4785 | DoRestore = false; |
4629 | if (Backup.Calendar[0] != NULL) { | 4786 | if (Backup.Calendar[0] != NULL) { |
4630 | DoRestore = true; | ||
4631 | /* N6110 doesn't support getting calendar status */ | 4787 | /* N6110 doesn't support getting calendar status */ |
4632 | error = Phone->GetNextCalendar(&s,&Calendar,true); | 4788 | error = Phone->GetNextCalendar(&s,&Calendar,true); |
4633 | if (error == ERR_NONE || error == ERR_INVALIDLOCATION || error == ERR_EMPTY) { | 4789 | if (error == ERR_NONE || error == ERR_INVALIDLOCATION || error == ERR_EMPTY) { |
4634 | max = 0; | 4790 | max = 0; |
4635 | while (Backup.Calendar[max] != NULL) max++; | 4791 | while (Backup.Calendar[max] != NULL) max++; |
4636 | printmsgerr("%i entries in backup file\n",max); | 4792 | printmsgerr("%i entries in backup file\n",max); |
4793 | // LR | ||
4794 | //if (answer_yes("Restore calendar notes")) { | ||
4795 | //Past = answer_yes("Restore notes from the past"); | ||
4637 | DoRestore = true; | 4796 | DoRestore = true; |
4638 | /* | 4797 | //} |
4639 | if (answer_yes("Restore calendar notes")) { | ||
4640 | Past = answer_yes("Restore notes from the past"); | ||
4641 | DoRestore = true; | ||
4642 | } | ||
4643 | */ | ||
4644 | } | 4798 | } |
4645 | } | 4799 | } |
4646 | if (DoRestore) { | 4800 | if (DoRestore) { |
4647 | printmsgerr("Deleting old notes: "); | 4801 | printmsgerr("Deleting old notes: "); |
4648 | error = Phone->DeleteAllCalendar(&s); | 4802 | error = Phone->DeleteAllCalendar(&s); |
4649 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { | 4803 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { |
4650 | while (1) { | 4804 | while (1) { |
4651 | error = Phone->GetNextCalendar(&s,&Calendar,true); | 4805 | error = Phone->GetNextCalendar(&s,&Calendar,true); |
4652 | if (error != ERR_NONE) break; | 4806 | if (error != ERR_NONE) break; |
4653 | error = Phone->DeleteCalendar(&s,&Calendar); | 4807 | error = Phone->DeleteCalendar(&s,&Calendar); |
4654 | Print_Error(error); | 4808 | Print_Error(error); |
4655 | printmsgerr("*"); | 4809 | printmsgerr("*"); |
4656 | } | 4810 | } |
4657 | printmsgerr("\n"); | 4811 | printmsgerr("\n"); |
4658 | } else { | 4812 | } else { |
4659 | printmsgerr("Done\n"); | 4813 | printmsgerr("Done\n"); |
4660 | Print_Error(error); | 4814 | Print_Error(error); |
4661 | } | 4815 | } |
4662 | 4816 | ||
4663 | for (i=0;i<max;i++) { | 4817 | for (i=0;i<max;i++) { |
4664 | if (!Past && IsCalendarNoteFromThePast(Backup.Calendar[i])) continue; | 4818 | if (!Past && IsCalendarNoteFromThePast(Backup.Calendar[i])) continue; |
4665 | 4819 | ||
4666 | Calendar = *Backup.Calendar[i]; | 4820 | Calendar = *Backup.Calendar[i]; |
4667 | error=Phone->AddCalendar(&s,&Calendar); | 4821 | error=Phone->AddCalendar(&s,&Calendar); |
4668 | Print_Error(error); | 4822 | Print_Error(error); |
4669 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 4823 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
4670 | if (gshutdown) { | 4824 | if (gshutdown) { |
4671 | GSM_Terminate(); | 4825 | GSM_Terminate(); |
4672 | exit(0); | 4826 | exit(0); |
4673 | } | 4827 | } |
4674 | } | 4828 | } |
4675 | printmsgerr("\n"); | 4829 | printmsgerr("\n"); |
4676 | } | 4830 | } |
4677 | 4831 | ||
4678 | DoRestore = false; | 4832 | DoRestore = false; |
4679 | if (Backup.ToDo[0] != NULL) { | 4833 | if (Backup.ToDo[0] != NULL) { |
4680 | error = Phone->GetToDoStatus(&s,&ToDoStatus); | 4834 | error = Phone->GetToDoStatus(&s,&ToDoStatus); |
4681 | if (error == ERR_NONE) { | 4835 | if (error == ERR_NONE) { |
4682 | error == ERR_NOTSUPPORTED; | ||
4683 | DoRestore = true; | ||
4684 | max = 0; | 4836 | max = 0; |
4685 | while (Backup.ToDo[max]!=NULL) max++; | 4837 | while (Backup.ToDo[max]!=NULL) max++; |
4686 | printmsgerr("%i entries in backup file\n",max); | 4838 | printmsgerr("%i entries in backup file\n",max); |
4687 | 4839 | ||
4688 | /*if (answer_yes("Restore ToDo")) */DoRestore = true; | 4840 | //LR if (answer_yes("Restore ToDo")) |
4841 | DoRestore = true; | ||
4689 | } | 4842 | } |
4690 | } | 4843 | } |
4691 | if (DoRestore) { | 4844 | if (DoRestore) { |
4692 | if ( max > 0 ) { | ||
4693 | ToDo = *Backup.ToDo[0]; | 4845 | ToDo = *Backup.ToDo[0]; |
4694 | error = Phone->SetToDo(&s,&ToDo); | 4846 | error = Phone->SetToDo(&s,&ToDo); |
4695 | } | ||
4696 | } | 4847 | } |
4697 | if (DoRestore && (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED)) { | 4848 | if (DoRestore && (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED)) { |
4698 | printmsgerr("Deleting old ToDo: "); | 4849 | printmsgerr("Deleting old ToDo: "); |
4699 | error=Phone->DeleteAllToDo(&s); | 4850 | error=Phone->DeleteAllToDo(&s); |
4700 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { | 4851 | if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) { |
4701 | while (1) { | 4852 | while (1) { |
4702 | error = Phone->GetNextToDo(&s,&ToDo,true); | 4853 | error = Phone->GetNextToDo(&s,&ToDo,true); |
4703 | if (error != ERR_NONE) break; | 4854 | if (error != ERR_NONE) break; |
4704 | error = Phone->DeleteToDo(&s,&ToDo); | 4855 | error = Phone->DeleteToDo(&s,&ToDo); |
4705 | Print_Error(error); | 4856 | Print_Error(error); |
4706 | printmsgerr("*"); | 4857 | printmsgerr("*"); |
4707 | } | 4858 | } |
4708 | printmsgerr("\n"); | 4859 | printmsgerr("\n"); |
4709 | } else { | 4860 | } else { |
4710 | printmsgerr("Done\n"); | 4861 | printmsgerr("Done\n"); |
4711 | Print_Error(error); | 4862 | Print_Error(error); |
4712 | } | 4863 | } |
4713 | 4864 | ||
4714 | for (i=0;i<max;i++) { | 4865 | for (i=0;i<max;i++) { |
4715 | ToDo = *Backup.ToDo[i]; | 4866 | ToDo = *Backup.ToDo[i]; |
4716 | ToDo.Location = 0; | 4867 | ToDo.Location = 0; |
4717 | error=Phone->AddToDo(&s,&ToDo); | 4868 | error=Phone->AddToDo(&s,&ToDo); |
4718 | Print_Error(error); | 4869 | Print_Error(error); |
4719 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); | 4870 | printmsgerr("%cWriting: %i percent",13,(i+1)*100/max); |
@@ -4970,49 +5121,49 @@ static void Restore(int argc, char *argv[]) | |||
4970 | if (gshutdown) { | 5121 | if (gshutdown) { |
4971 | GSM_Terminate(); | 5122 | GSM_Terminate(); |
4972 | exit(0); | 5123 | exit(0); |
4973 | } | 5124 | } |
4974 | } | 5125 | } |
4975 | printmsgerr("\n"); | 5126 | printmsgerr("\n"); |
4976 | } | 5127 | } |
4977 | 5128 | ||
4978 | GSM_Terminate(); | 5129 | GSM_Terminate(); |
4979 | } | 5130 | } |
4980 | 5131 | ||
4981 | static void AddNew(int argc, char *argv[]) | 5132 | static void AddNew(int argc, char *argv[]) |
4982 | { | 5133 | { |
4983 | GSM_Backup Backup; | 5134 | GSM_Backup Backup; |
4984 | GSM_DateTime date_time; | 5135 | GSM_DateTime date_time; |
4985 | GSM_MemoryEntry Pbk; | 5136 | GSM_MemoryEntry Pbk; |
4986 | GSM_MemoryStatusMemStatus; | 5137 | GSM_MemoryStatusMemStatus; |
4987 | GSM_ToDoEntry ToDo; | 5138 | GSM_ToDoEntry ToDo; |
4988 | GSM_ToDoStatus ToDoStatus; | 5139 | GSM_ToDoStatus ToDoStatus; |
4989 | GSM_CalendarEntryCalendar; | 5140 | GSM_CalendarEntryCalendar; |
4990 | GSM_WAPBookmark Bookmark; | 5141 | GSM_WAPBookmark Bookmark; |
4991 | int i, max, j; | 5142 | int i, max, j; |
4992 | 5143 | ||
4993 | error=GSM_ReadBackupFile(argv[2],&Backup); | 5144 | error=GSM_ReadBackupFile(argv[2],&Backup); |
4994 | Print_Error(error); | 5145 | if (error!=ERR_NOTIMPLEMENTED) Print_Error(error); |
4995 | 5146 | ||
4996 | signal(SIGINT, interrupt); | 5147 | signal(SIGINT, interrupt); |
4997 | printmsgerr("Press Ctrl+C to break...\n"); | 5148 | printmsgerr("Press Ctrl+C to break...\n"); |
4998 | 5149 | ||
4999 | 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)); |
5000 | if (Backup.Model[0]!=0) printmsgerr("Phone : %s\n",Backup.Model); | 5151 | if (Backup.Model[0]!=0) printmsgerr("Phone : %s\n",Backup.Model); |
5001 | if (Backup.IMEI[0]!=0) printmsgerr("IMEI : %s\n",Backup.IMEI); | 5152 | if (Backup.IMEI[0]!=0) printmsgerr("IMEI : %s\n",Backup.IMEI); |
5002 | 5153 | ||
5003 | GSM_Init(true); | 5154 | GSM_Init(true); |
5004 | 5155 | ||
5005 | if (Backup.PhonePhonebook[0] != NULL) { | 5156 | if (Backup.PhonePhonebook[0] != NULL) { |
5006 | MemStatus.MemoryType = MEM_ME; | 5157 | MemStatus.MemoryType = MEM_ME; |
5007 | error=Phone->GetMemoryStatus(&s, &MemStatus); | 5158 | error=Phone->GetMemoryStatus(&s, &MemStatus); |
5008 | if (error==ERR_NONE) { | 5159 | if (error==ERR_NONE) { |
5009 | max = 0; | 5160 | max = 0; |
5010 | while (Backup.PhonePhonebook[max]!=NULL) max++; | 5161 | while (Backup.PhonePhonebook[max]!=NULL) max++; |
5011 | printmsgerr("%i entries in backup file\n",max); | 5162 | printmsgerr("%i entries in backup file\n",max); |
5012 | if (MemStatus.MemoryFree < max) { | 5163 | if (MemStatus.MemoryFree < max) { |
5013 | printmsgerr("Memory has only %i free locations.Exiting\n",MemStatus.MemoryFree); | 5164 | printmsgerr("Memory has only %i free locations.Exiting\n",MemStatus.MemoryFree); |
5014 | } else if (answer_yes("Add phone phonebook entries")) { | 5165 | } else if (answer_yes("Add phone phonebook entries")) { |
5015 | for (i=0;i<max;i++) { | 5166 | for (i=0;i<max;i++) { |
5016 | Pbk = *Backup.PhonePhonebook[i]; | 5167 | Pbk = *Backup.PhonePhonebook[i]; |
5017 | Pbk.MemoryType = MEM_ME; | 5168 | Pbk.MemoryType = MEM_ME; |
5018 | error=Phone->AddMemory(&s, &Pbk); | 5169 | error=Phone->AddMemory(&s, &Pbk); |
@@ -5597,50 +5748,49 @@ static void AddSMS(int argc, char *argv[]) | |||
5597 | } | 5748 | } |
5598 | 5749 | ||
5599 | static void RestoreSMS(int argc, char *argv[]) | 5750 | static void RestoreSMS(int argc, char *argv[]) |
5600 | { | 5751 | { |
5601 | GSM_MultiSMSMessage SMS; | 5752 | GSM_MultiSMSMessage SMS; |
5602 | GSM_SMS_Backup Backup; | 5753 | GSM_SMS_Backup Backup; |
5603 | GSM_SMSFolders folders; | 5754 | GSM_SMSFolders folders; |
5604 | int smsnum = 0; | 5755 | int smsnum = 0; |
5605 | char buffer[200]; | 5756 | char buffer[200]; |
5606 | 5757 | ||
5607 | error=GSM_ReadSMSBackupFile(argv[2], &Backup); | 5758 | error=GSM_ReadSMSBackupFile(argv[2], &Backup); |
5608 | Print_Error(error); | 5759 | Print_Error(error); |
5609 | 5760 | ||
5610 | GSM_Init(true); | 5761 | GSM_Init(true); |
5611 | 5762 | ||
5612 | error=Phone->GetSMSFolders(&s, &folders); | 5763 | error=Phone->GetSMSFolders(&s, &folders); |
5613 | Print_Error(error); | 5764 | Print_Error(error); |
5614 | 5765 | ||
5615 | while (Backup.SMS[smsnum] != NULL) { | 5766 | while (Backup.SMS[smsnum] != NULL) { |
5616 | SMS.Number = 1; | 5767 | SMS.Number = 1; |
5617 | memcpy(&SMS.SMS[0],Backup.SMS[smsnum],sizeof(GSM_SMSMessage)); | 5768 | memcpy(&SMS.SMS[0],Backup.SMS[smsnum],sizeof(GSM_SMSMessage)); |
5618 | displaymultismsinfo(SMS,false,false); | 5769 | displaymultismsinfo(SMS,false,false); |
5619 | 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)); |
5620 | if (answer_yes(buffer)) { | 5771 | if (answer_yes(buffer)) { |
5621 | Backup.SMS[smsnum]->Location = 0; | 5772 | error=Phone->AddSMS(&s, Backup.SMS[smsnum]); |
5622 | error=Phone->SetSMS(&s, Backup.SMS[smsnum]); | ||
5623 | Print_Error(error); | 5773 | Print_Error(error); |
5624 | } | 5774 | } |
5625 | smsnum++; | 5775 | smsnum++; |
5626 | } | 5776 | } |
5627 | 5777 | ||
5628 | GSM_Terminate(); | 5778 | GSM_Terminate(); |
5629 | } | 5779 | } |
5630 | #endif | 5780 | #endif |
5631 | 5781 | ||
5632 | static void CopyBitmap(int argc, char *argv[]) | 5782 | static void CopyBitmap(int argc, char *argv[]) |
5633 | { | 5783 | { |
5634 | GSM_MultiBitmap Bitmap; | 5784 | GSM_MultiBitmap Bitmap; |
5635 | int i; | 5785 | int i; |
5636 | 5786 | ||
5637 | Bitmap.Bitmap[0].Type = GSM_None; | 5787 | Bitmap.Bitmap[0].Type = GSM_None; |
5638 | 5788 | ||
5639 | error=GSM_ReadBitmapFile(argv[2],&Bitmap); | 5789 | error=GSM_ReadBitmapFile(argv[2],&Bitmap); |
5640 | Print_Error(error); | 5790 | Print_Error(error); |
5641 | 5791 | ||
5642 | if (argc==3) { | 5792 | if (argc==3) { |
5643 | for (i=0;i<Bitmap.Number;i++) { | 5793 | for (i=0;i<Bitmap.Number;i++) { |
5644 | switch (Bitmap.Bitmap[i].Type) { | 5794 | switch (Bitmap.Bitmap[i].Type) { |
5645 | case GSM_StartupLogo : printmsg("Startup logo"); break; | 5795 | case GSM_StartupLogo : printmsg("Startup logo"); break; |
5646 | case GSM_OperatorLogo: printmsg("Operator logo"); break; | 5796 | case GSM_OperatorLogo: printmsg("Operator logo"); break; |
@@ -5792,49 +5942,49 @@ static void NokiaComposer(int argc, char *argv[]) | |||
5792 | case Duration_1_8 : Duration = 16;break; | 5942 | case Duration_1_8 : Duration = 16;break; |
5793 | case Duration_1_16 : Duration = 8;break; | 5943 | case Duration_1_16 : Duration = 8;break; |
5794 | case Duration_1_32 : Duration = 4;break; | 5944 | case Duration_1_32 : Duration = 4;break; |
5795 | default : dbgprintf("error\n");break; | 5945 | default : dbgprintf("error\n");break; |
5796 | } | 5946 | } |
5797 | if (Duration > DefNoteDuration) { | 5947 | if (Duration > DefNoteDuration) { |
5798 | while (DefNoteDuration != Duration) { | 5948 | while (DefNoteDuration != Duration) { |
5799 | printmsg("9"); | 5949 | printmsg("9"); |
5800 | DefNoteDuration = DefNoteDuration * 2; | 5950 | DefNoteDuration = DefNoteDuration * 2; |
5801 | } | 5951 | } |
5802 | } | 5952 | } |
5803 | if (Duration < DefNoteDuration) { | 5953 | if (Duration < DefNoteDuration) { |
5804 | while (DefNoteDuration != Duration) { | 5954 | while (DefNoteDuration != Duration) { |
5805 | printmsg("8"); | 5955 | printmsg("8"); |
5806 | DefNoteDuration = DefNoteDuration / 2; | 5956 | DefNoteDuration = DefNoteDuration / 2; |
5807 | } | 5957 | } |
5808 | } | 5958 | } |
5809 | printmsg(" "); | 5959 | printmsg(" "); |
5810 | } | 5960 | } |
5811 | } | 5961 | } |
5812 | } | 5962 | } |
5813 | 5963 | ||
5814 | printf("\n"); | 5964 | printf("\n"); |
5815 | } | 5965 | } |
5816 | //#if 0 | 5966 | |
5817 | static void CopyRingtone(int argc, char *argv[]) | 5967 | static void CopyRingtone(int argc, char *argv[]) |
5818 | { | 5968 | { |
5819 | GSM_Ringtone ringtone, ringtone2; | 5969 | GSM_Ringtone ringtone, ringtone2; |
5820 | GSM_RingtoneFormatFormat; | 5970 | GSM_RingtoneFormatFormat; |
5821 | 5971 | ||
5822 | ringtone.Format= 0; | 5972 | ringtone.Format= 0; |
5823 | error=GSM_ReadRingtoneFile(argv[2],&ringtone); | 5973 | error=GSM_ReadRingtoneFile(argv[2],&ringtone); |
5824 | Print_Error(error); | 5974 | Print_Error(error); |
5825 | 5975 | ||
5826 | Format = ringtone.Format; | 5976 | Format = ringtone.Format; |
5827 | if (argc == 5) { | 5977 | if (argc == 5) { |
5828 | if (mystrncasecmp(argv[4],"RTTL",0)) { Format = RING_NOTETONE; | 5978 | if (mystrncasecmp(argv[4],"RTTL",0)) { Format = RING_NOTETONE; |
5829 | } else if (mystrncasecmp(argv[4],"BINARY",0)) {Format = RING_NOKIABINARY; | 5979 | } else if (mystrncasecmp(argv[4],"BINARY",0)) {Format = RING_NOKIABINARY; |
5830 | } else { | 5980 | } else { |
5831 | printmsg("What format of output ringtone file (\"%s\") ?\n",argv[4]); | 5981 | printmsg("What format of output ringtone file (\"%s\") ?\n",argv[4]); |
5832 | exit(-1); | 5982 | exit(-1); |
5833 | } | 5983 | } |
5834 | } | 5984 | } |
5835 | 5985 | ||
5836 | error=GSM_RingtoneConvert(&ringtone2,&ringtone,Format); | 5986 | error=GSM_RingtoneConvert(&ringtone2,&ringtone,Format); |
5837 | Print_Error(error); | 5987 | Print_Error(error); |
5838 | 5988 | ||
5839 | error=GSM_SaveRingtoneFile(argv[3],&ringtone2); | 5989 | error=GSM_SaveRingtoneFile(argv[3],&ringtone2); |
5840 | Print_Error(error); | 5990 | Print_Error(error); |
@@ -5953,49 +6103,49 @@ static void DeleteToDo(int argc, char *argv[]) | |||
5953 | for (i=start;i<=stop;i++) { | 6103 | for (i=start;i<=stop;i++) { |
5954 | ToDo.Location=i; | 6104 | ToDo.Location=i; |
5955 | printmsg("Location : %i\n",i); | 6105 | printmsg("Location : %i\n",i); |
5956 | error=Phone->DeleteToDo(&s,&ToDo); | 6106 | error=Phone->DeleteToDo(&s,&ToDo); |
5957 | if (error != ERR_EMPTY) Print_Error(error); | 6107 | if (error != ERR_EMPTY) Print_Error(error); |
5958 | 6108 | ||
5959 | if (error == ERR_EMPTY) { | 6109 | if (error == ERR_EMPTY) { |
5960 | printmsg("Entry was empty\n"); | 6110 | printmsg("Entry was empty\n"); |
5961 | } else { | 6111 | } else { |
5962 | printmsg("Entry was deleted\n"); | 6112 | printmsg("Entry was deleted\n"); |
5963 | } | 6113 | } |
5964 | printf("\n"); | 6114 | printf("\n"); |
5965 | } | 6115 | } |
5966 | 6116 | ||
5967 | GSM_Terminate(); | 6117 | GSM_Terminate(); |
5968 | } | 6118 | } |
5969 | 6119 | ||
5970 | static void PrintToDo(GSM_ToDoEntry *ToDo) | 6120 | static void PrintToDo(GSM_ToDoEntry *ToDo) |
5971 | { | 6121 | { |
5972 | int j; | 6122 | int j; |
5973 | GSM_MemoryEntry entry; | 6123 | GSM_MemoryEntry entry; |
5974 | unsigned char *name; | 6124 | unsigned char *name; |
5975 | GSM_Category Category; | 6125 | GSM_Category Category; |
5976 | 6126 | ||
5977 | printmsg("Location : %i\n",ToDo->Location); | 6127 | printmsg("Location : %i\n",ToDo->Location); |
5978 | printmsg("Priority : "); | 6128 | printmsg("Priority : "); |
5979 | switch (ToDo->Priority) { | 6129 | switch (ToDo->Priority) { |
5980 | case GSM_Priority_Low : printmsg("Low\n"); break; | 6130 | case GSM_Priority_Low : printmsg("Low\n"); break; |
5981 | case GSM_Priority_Medium : printmsg("Medium\n"); break; | 6131 | case GSM_Priority_Medium : printmsg("Medium\n"); break; |
5982 | case GSM_Priority_High : printmsg("High\n"); break; | 6132 | case GSM_Priority_High : printmsg("High\n"); break; |
5983 | default : printmsg("Unknown\n");break; | 6133 | default : printmsg("Unknown\n");break; |
5984 | } | 6134 | } |
5985 | for (j=0;j<ToDo->EntriesNum;j++) { | 6135 | for (j=0;j<ToDo->EntriesNum;j++) { |
5986 | switch (ToDo->Entries[j].EntryType) { | 6136 | switch (ToDo->Entries[j].EntryType) { |
5987 | case TODO_END_DATETIME: | 6137 | case TODO_END_DATETIME: |
5988 | printmsg("DueTime : %s\n",OSDateTime(ToDo->Entries[j].Date,false)); | 6138 | printmsg("DueTime : %s\n",OSDateTime(ToDo->Entries[j].Date,false)); |
5989 | break; | 6139 | break; |
5990 | case TODO_COMPLETED: | 6140 | case TODO_COMPLETED: |
5991 | printmsg("Completed : %s\n",ToDo->Entries[j].Number == 1 ? "Yes" : "No"); | 6141 | printmsg("Completed : %s\n",ToDo->Entries[j].Number == 1 ? "Yes" : "No"); |
5992 | break; | 6142 | break; |
5993 | case TODO_ALARM_DATETIME: | 6143 | case TODO_ALARM_DATETIME: |
5994 | printmsg("Alarm : %s\n",OSDateTime(ToDo->Entries[j].Date,false)); | 6144 | printmsg("Alarm : %s\n",OSDateTime(ToDo->Entries[j].Date,false)); |
5995 | break; | 6145 | break; |
5996 | case TODO_SILENT_ALARM_DATETIME: | 6146 | case TODO_SILENT_ALARM_DATETIME: |
5997 | printmsg("Silent alarm : %s\n",OSDateTime(ToDo->Entries[j].Date,false)); | 6147 | printmsg("Silent alarm : %s\n",OSDateTime(ToDo->Entries[j].Date,false)); |
5998 | break; | 6148 | break; |
5999 | case TODO_TEXT: | 6149 | case TODO_TEXT: |
6000 | printmsg("Text : \"%s\"\n",DecodeUnicodeConsole(ToDo->Entries[j].Text)); | 6150 | printmsg("Text : \"%s\"\n",DecodeUnicodeConsole(ToDo->Entries[j].Text)); |
6001 | break; | 6151 | break; |
@@ -6077,49 +6227,49 @@ static void ListToDoCategory(int argc, char *argv[]) | |||
6077 | } | 6227 | } |
6078 | 6228 | ||
6079 | if (Number) { | 6229 | if (Number) { |
6080 | j = atoi(argv[2]); | 6230 | j = atoi(argv[2]); |
6081 | if (j > 0) { | 6231 | if (j > 0) { |
6082 | ListToDoCategoryEntries(j); | 6232 | ListToDoCategoryEntries(j); |
6083 | } | 6233 | } |
6084 | } else { | 6234 | } else { |
6085 | if (Length > GSM_MAX_CATEGORY_NAME_LENGTH) { | 6235 | if (Length > GSM_MAX_CATEGORY_NAME_LENGTH) { |
6086 | printmsg("Search text too long, truncating to %d chars!\n", GSM_MAX_CATEGORY_NAME_LENGTH); | 6236 | printmsg("Search text too long, truncating to %d chars!\n", GSM_MAX_CATEGORY_NAME_LENGTH); |
6087 | Length = GSM_MAX_CATEGORY_NAME_LENGTH; | 6237 | Length = GSM_MAX_CATEGORY_NAME_LENGTH; |
6088 | } | 6238 | } |
6089 | EncodeUnicode(Text, argv[2], Length); | 6239 | EncodeUnicode(Text, argv[2], Length); |
6090 | 6240 | ||
6091 | Category.Type = Category_ToDo; | 6241 | Category.Type = Category_ToDo; |
6092 | Status.Type = Category_ToDo; | 6242 | Status.Type = Category_ToDo; |
6093 | 6243 | ||
6094 | if (Phone->GetCategoryStatus(&s, &Status) == ERR_NONE) { | 6244 | if (Phone->GetCategoryStatus(&s, &Status) == ERR_NONE) { |
6095 | for (count=0,j=1;count<Status.Used;j++) { | 6245 | for (count=0,j=1;count<Status.Used;j++) { |
6096 | Category.Location=j; | 6246 | Category.Location=j; |
6097 | error=Phone->GetCategory(&s, &Category); | 6247 | error=Phone->GetCategory(&s, &Category); |
6098 | 6248 | ||
6099 | if (error != ERR_EMPTY) { | 6249 | if (error != ERR_EMPTY) { |
6100 | count++; | 6250 | count++; |
6101 | if (mystrstr(Category.Name, Text) != NULL) { | 6251 | if (mywstrstr(Category.Name, Text) != NULL) { |
6102 | ListToDoCategoryEntries(j); | 6252 | ListToDoCategoryEntries(j); |
6103 | } | 6253 | } |
6104 | } | 6254 | } |
6105 | } | 6255 | } |
6106 | } | 6256 | } |
6107 | } | 6257 | } |
6108 | GSM_Terminate(); | 6258 | GSM_Terminate(); |
6109 | } | 6259 | } |
6110 | 6260 | ||
6111 | 6261 | ||
6112 | static void GetToDo(int argc, char *argv[]) | 6262 | static void GetToDo(int argc, char *argv[]) |
6113 | { | 6263 | { |
6114 | GSM_ToDoEntryToDo; | 6264 | GSM_ToDoEntryToDo; |
6115 | int i; | 6265 | int i; |
6116 | int start,stop; | 6266 | int start,stop; |
6117 | 6267 | ||
6118 | GetStartStop(&start, &stop, 2, argc, argv); | 6268 | GetStartStop(&start, &stop, 2, argc, argv); |
6119 | 6269 | ||
6120 | GSM_Init(true); | 6270 | GSM_Init(true); |
6121 | 6271 | ||
6122 | for (i=start;i<=stop;i++) { | 6272 | for (i=start;i<=stop;i++) { |
6123 | ToDo.Location=i; | 6273 | ToDo.Location=i; |
6124 | error = Phone->GetToDo(&s,&ToDo); | 6274 | error = Phone->GetToDo(&s,&ToDo); |
6125 | if (error == ERR_EMPTY) continue; | 6275 | if (error == ERR_EMPTY) continue; |
@@ -6130,73 +6280,66 @@ static void GetToDo(int argc, char *argv[]) | |||
6130 | GSM_Terminate(); | 6280 | GSM_Terminate(); |
6131 | } | 6281 | } |
6132 | 6282 | ||
6133 | static void GetAllToDo(int argc, char *argv[]) | 6283 | static void GetAllToDo(int argc, char *argv[]) |
6134 | { | 6284 | { |
6135 | GSM_ToDoEntry ToDo; | 6285 | GSM_ToDoEntry ToDo; |
6136 | bool start = true; | 6286 | bool start = true; |
6137 | 6287 | ||
6138 | signal(SIGINT, interrupt); | 6288 | signal(SIGINT, interrupt); |
6139 | printmsgerr("Press Ctrl+C to break...\n"); | 6289 | printmsgerr("Press Ctrl+C to break...\n"); |
6140 | 6290 | ||
6141 | GSM_Init(true); | 6291 | GSM_Init(true); |
6142 | 6292 | ||
6143 | while (!gshutdown) { | 6293 | while (!gshutdown) { |
6144 | error = Phone->GetNextToDo(&s, &ToDo, start); | 6294 | error = Phone->GetNextToDo(&s, &ToDo, start); |
6145 | if (error == ERR_EMPTY) break; | 6295 | if (error == ERR_EMPTY) break; |
6146 | Print_Error(error); | 6296 | Print_Error(error); |
6147 | PrintToDo(&ToDo); | 6297 | PrintToDo(&ToDo); |
6148 | start = false; | 6298 | start = false; |
6149 | } | 6299 | } |
6150 | 6300 | ||
6151 | GSM_Terminate(); | 6301 | GSM_Terminate(); |
6152 | } | 6302 | } |
6153 | 6303 | ||
6154 | static void GetNote(int argc, char *argv[]) | 6304 | static void GetAllNotes(int argc, char *argv[]) |
6155 | { | 6305 | { |
6156 | GSM_NoteEntry Note; | 6306 | GSM_NoteEntry Note; |
6157 | int start,stop; | 6307 | bool start = true; |
6158 | bool refresh=true; | ||
6159 | 6308 | ||
6160 | GetStartStop(&start, &stop, 2, argc, argv); | 6309 | signal(SIGINT, interrupt); |
6310 | printmsgerr("Press Ctrl+C to break...\n"); | ||
6161 | 6311 | ||
6162 | GSM_Init(true); | 6312 | GSM_Init(true); |
6163 | 6313 | ||
6164 | for (i=start;i<=stop;i++) { | 6314 | while (!gshutdown) { |
6165 | Note.Location=i; | 6315 | error = Phone->GetNextNote(&s, &Note, start); |
6166 | printmsg("Location : %i\n",i); | 6316 | if (error == ERR_EMPTY) break; |
6167 | error=Phone->GetNote(&s,&Note,refresh); | 6317 | Print_Error(error); |
6168 | if (error != ERR_EMPTY) Print_Error(error); | 6318 | printmsg("Text : \"%s\"\n",DecodeUnicodeConsole(Note.Text)); |
6169 | 6319 | printf("\n"); | |
6170 | if (error == ERR_EMPTY) { | 6320 | start = false; |
6171 | printmsg("Entry is empty\n\n"); | ||
6172 | } else { | ||
6173 | printmsg("Text : \"%s\"\n",DecodeUnicodeConsole(Note.Text)); | ||
6174 | printf("\n"); | ||
6175 | refresh=false; | ||
6176 | } | ||
6177 | } | 6321 | } |
6178 | |||
6179 | GSM_Terminate(); | 6322 | GSM_Terminate(); |
6180 | } | 6323 | } |
6181 | 6324 | ||
6182 | static void GetSecurityStatus(int argc, char *argv[]) | 6325 | static void GetSecurityStatus(int argc, char *argv[]) |
6183 | { | 6326 | { |
6184 | GSM_Init(true); | 6327 | GSM_Init(true); |
6185 | 6328 | ||
6186 | PrintSecurityStatus(); | 6329 | PrintSecurityStatus(); |
6187 | 6330 | ||
6188 | GSM_Terminate(); | 6331 | GSM_Terminate(); |
6189 | } | 6332 | } |
6190 | 6333 | ||
6191 | static void EnterSecurityCode(int argc, char *argv[]) | 6334 | static void EnterSecurityCode(int argc, char *argv[]) |
6192 | { | 6335 | { |
6193 | GSM_SecurityCode Code; | 6336 | GSM_SecurityCode Code; |
6194 | 6337 | ||
6195 | if (mystrncasecmp(argv[2],"PIN",0)) { Code.Type = SEC_Pin; | 6338 | if (mystrncasecmp(argv[2],"PIN",0)) { Code.Type = SEC_Pin; |
6196 | } else if (mystrncasecmp(argv[2],"PUK",0)) {Code.Type = SEC_Puk; | 6339 | } else if (mystrncasecmp(argv[2],"PUK",0)) {Code.Type = SEC_Puk; |
6197 | } else if (mystrncasecmp(argv[2],"PIN2",0)) {Code.Type = SEC_Pin2; | 6340 | } else if (mystrncasecmp(argv[2],"PIN2",0)) {Code.Type = SEC_Pin2; |
6198 | } else if (mystrncasecmp(argv[2],"PUK2",0)) {Code.Type = SEC_Puk2; | 6341 | } else if (mystrncasecmp(argv[2],"PUK2",0)) {Code.Type = SEC_Puk2; |
6199 | } else { | 6342 | } else { |
6200 | printmsg("What security code (\"%s\") ?\n",argv[2]); | 6343 | printmsg("What security code (\"%s\") ?\n",argv[2]); |
6201 | exit(-1); | 6344 | exit(-1); |
6202 | } | 6345 | } |
@@ -6550,63 +6693,88 @@ static void MakeConvertTable(int argc, char *argv[]) | |||
6550 | file = fopen(argv[2], "rb"); | 6693 | file = fopen(argv[2], "rb"); |
6551 | if (file == NULL) Print_Error(ERR_CANTOPENFILE); | 6694 | if (file == NULL) Print_Error(ERR_CANTOPENFILE); |
6552 | size=fread(InputBuffer, 1, 10000-1, file); | 6695 | size=fread(InputBuffer, 1, 10000-1, file); |
6553 | fclose(file); | 6696 | fclose(file); |
6554 | InputBuffer[size] = 0; | 6697 | InputBuffer[size] = 0; |
6555 | InputBuffer[size+1] = 0; | 6698 | InputBuffer[size+1] = 0; |
6556 | 6699 | ||
6557 | ReadUnicodeFile(Buffer,InputBuffer); | 6700 | ReadUnicodeFile(Buffer,InputBuffer); |
6558 | 6701 | ||
6559 | for(i=0;i<((int)UnicodeLength(Buffer));i++) { | 6702 | for(i=0;i<((int)UnicodeLength(Buffer));i++) { |
6560 | j++; | 6703 | j++; |
6561 | if (j==100) { | 6704 | if (j==100) { |
6562 | printf("\"\\\n\""); | 6705 | printf("\"\\\n\""); |
6563 | j=0; | 6706 | j=0; |
6564 | } | 6707 | } |
6565 | printf("\\x%02x\\x%02x",Buffer[i*2],Buffer[i*2+1]); | 6708 | printf("\\x%02x\\x%02x",Buffer[i*2],Buffer[i*2+1]); |
6566 | } | 6709 | } |
6567 | printf("\\x00\\x00"); | 6710 | printf("\\x00\\x00"); |
6568 | } | 6711 | } |
6569 | #endif | 6712 | #endif |
6570 | 6713 | ||
6571 | static void ListNetworks(int argc, char *argv[]) | 6714 | static void ListNetworks(int argc, char *argv[]) |
6572 | { | 6715 | { |
6573 | extern unsigned char *GSM_Networks[]; | 6716 | extern unsigned char *GSM_Networks[]; |
6717 | extern unsigned char *GSM_Countries[]; | ||
6574 | int i=0; | 6718 | int i=0; |
6719 | char country[4]=""; | ||
6575 | 6720 | ||
6576 | printmsg("Network Name\n\n"); | 6721 | if (argc>2) { |
6722 | while (GSM_Countries[i*2]!=NULL) { | ||
6723 | if (!strncmp(GSM_Countries[i*2+1],argv[2],strlen(argv[2]))) { | ||
6724 | strcpy(country,GSM_Countries[i*2]); | ||
6725 | printmsg("Networks for %s:\n\n",GSM_Countries[i*2+1]); | ||
6726 | break; | ||
6727 | } | ||
6728 | i++; | ||
6729 | } | ||
6730 | if (!*country) { | ||
6731 | printmsg("Unknown country name."); | ||
6732 | exit(-1); | ||
6733 | } | ||
6734 | } | ||
6735 | printmsg("Network Name\n"); | ||
6736 | i=0; | ||
6577 | while (GSM_Networks[i*2]!=NULL) { | 6737 | while (GSM_Networks[i*2]!=NULL) { |
6578 | printmsg("%s %s\n", GSM_Networks[i*2], GSM_Networks[i*2+1]); | 6738 | if (argc>2) { |
6739 | if (!strncmp(GSM_Networks[i*2],country,strlen(country))) { | ||
6740 | printmsg("%s %s\n", GSM_Networks[i*2], GSM_Networks[i*2+1]); | ||
6741 | } | ||
6742 | } else { | ||
6743 | printmsg("%s %s\n", GSM_Networks[i*2], GSM_Networks[i*2+1]); | ||
6744 | } | ||
6579 | i++; | 6745 | i++; |
6580 | } | 6746 | } |
6581 | } | 6747 | } |
6582 | 6748 | ||
6583 | static void Version(int argc, char *argv[]) | 6749 | static void Version(int argc, char *argv[]) |
6584 | { | 6750 | { |
6585 | // unsigned char buff[10]; | 6751 | // unsigned char buff[10]; |
6586 | // int len; | 6752 | // int len; |
6587 | 6753 | ||
6588 | printmsg("[Gammu version %s built %s %s]\n\n",VERSION,__TIME__,__DATE__); | 6754 | printmsg("[Gammu version %s built %s %s",VERSION,__TIME__,__DATE__); |
6755 | if (strlen(GetCompiler()) != 0) printmsg(" in %s",GetCompiler()); | ||
6756 | printmsg("]\n\n"); | ||
6589 | 6757 | ||
6590 | #ifdef DEBUG | 6758 | #ifdef DEBUG |
6591 | printf("GSM_SMSMessage - %i\n",sizeof(GSM_SMSMessage)); | 6759 | printf("GSM_SMSMessage - %i\n",sizeof(GSM_SMSMessage)); |
6592 | printf("GSM_SMSC - %i\n",sizeof(GSM_SMSC)); | 6760 | printf("GSM_SMSC - %i\n",sizeof(GSM_SMSC)); |
6593 | printf("GSM_SMS_State - %i\n",sizeof(GSM_SMS_State)); | 6761 | printf("GSM_SMS_State - %i\n",sizeof(GSM_SMS_State)); |
6594 | printf("GSM_UDHHeader - %i\n",sizeof(GSM_UDHHeader)); | 6762 | printf("GSM_UDHHeader - %i\n",sizeof(GSM_UDHHeader)); |
6595 | printf("bool - %i\n",sizeof(bool)); | 6763 | printf("bool - %i\n",sizeof(bool)); |
6596 | printf("GSM_DateTime - %i\n",sizeof(GSM_DateTime)); | 6764 | printf("GSM_DateTime - %i\n",sizeof(GSM_DateTime)); |
6597 | printf("int - %i\n",sizeof(int)); | 6765 | printf("int - %i\n",sizeof(int)); |
6598 | printf("GSM_NetworkInfo - %i\n",sizeof(GSM_NetworkInfo)); | 6766 | printf("GSM_NetworkInfo - %i\n",sizeof(GSM_NetworkInfo)); |
6599 | #endif | 6767 | #endif |
6600 | 6768 | ||
6601 | //len=DecodeBASE64("AXw", buff, 3); | 6769 | //len=DecodeBASE64("AXw", buff, 3); |
6602 | //DumpMessage(stdout, buff, len); | 6770 | //DumpMessage(stdout, buff, len); |
6603 | } | 6771 | } |
6604 | 6772 | ||
6605 | static void GetFMStation(int argc, char *argv[]) | 6773 | static void GetFMStation(int argc, char *argv[]) |
6606 | { | 6774 | { |
6607 | GSM_FMStation Station; | 6775 | GSM_FMStation Station; |
6608 | int start,stop; | 6776 | int start,stop; |
6609 | 6777 | ||
6610 | GetStartStop(&start, &stop, 2, argc, argv); | 6778 | GetStartStop(&start, &stop, 2, argc, argv); |
6611 | 6779 | ||
6612 | GSM_Init(true); | 6780 | GSM_Init(true); |
@@ -6681,77 +6849,71 @@ static void GetFileSystem(int argc, char *argv[]) | |||
6681 | } | 6849 | } |
6682 | if (Files.System) { | 6850 | if (Files.System) { |
6683 | printf("S"); | 6851 | printf("S"); |
6684 | } else { | 6852 | } else { |
6685 | printf(" "); | 6853 | printf(" "); |
6686 | } | 6854 | } |
6687 | if (argc > 2 && mystrncasecmp(argv[2],"-flat",0)) { | 6855 | if (argc > 2 && mystrncasecmp(argv[2],"-flat",0)) { |
6688 | if (!Files.Folder) { | 6856 | if (!Files.Folder) { |
6689 | if (mystrncasecmp(argv[2],"-flatall",0)) { | 6857 | if (mystrncasecmp(argv[2],"-flatall",0)) { |
6690 | if (!Files.ModifiedEmpty) { | 6858 | if (!Files.ModifiedEmpty) { |
6691 | printf(" %30s",OSDateTime(Files.Modified,false)); | 6859 | printf(" %30s",OSDateTime(Files.Modified,false)); |
6692 | } else printf(" %30c",0x20); | 6860 | } else printf(" %30c",0x20); |
6693 | printf(" %9i",Files.Used); | 6861 | printf(" %9i",Files.Used); |
6694 | printf(" "); | 6862 | printf(" "); |
6695 | } else printf("|-- "); | 6863 | } else printf("|-- "); |
6696 | } else printf("Folder "); | 6864 | } else printf("Folder "); |
6697 | } else { | 6865 | } else { |
6698 | if (Files.Level != 1) { | 6866 | if (Files.Level != 1) { |
6699 | for (j=0;j<Files.Level-2;j++) printf(" | "); | 6867 | for (j=0;j<Files.Level-2;j++) printf(" | "); |
6700 | printf(" |-- "); | 6868 | printf(" |-- "); |
6701 | } | 6869 | } |
6702 | if (Files.Folder) printf("Folder "); | 6870 | if (Files.Folder) printf("Folder "); |
6703 | } | 6871 | } |
6704 | printf("\"%s\"",DecodeUnicodeConsole(Files.Name)); | 6872 | printf("\"%s\"",DecodeUnicodeConsole(Files.Name)); |
6705 | printf("\n"); | ||
6706 | |||
6707 | Start = false; | ||
6708 | } else if (argc > 2 && mystrncasecmp(argv[2],"-flatall",0)) { | 6873 | } else if (argc > 2 && mystrncasecmp(argv[2],"-flatall",0)) { |
6709 | /* format for a folder ID;Folder;FOLDER_NAME;[FOLDER_PARAMETERS] | 6874 | /* format for a folder ID;Folder;FOLDER_NAME;[FOLDER_PARAMETERS] |
6710 | * format for a file ID;File;FOLDER_NAME;FILE_NAME;DATESTAMP;FILE_SIZE;[FILE_PARAMETERS] */ | 6875 | * format for a file ID;File;FOLDER_NAME;FILE_NAME;DATESTAMP;FILE_SIZE;[FILE_PARAMETERS] */ |
6711 | if (!Files.Folder) { | 6876 | if (!Files.Folder) { |
6712 | printf("%s;File;",Files.ID_FullName); | 6877 | printf("%s;File;",Files.ID_FullName); |
6713 | printf("\"%s\";",FolderName); | 6878 | printf("\"%s\";",FolderName); |
6714 | printf("\"%s\";",DecodeUnicodeConsole(Files.Name)); | 6879 | printf("\"%s\";",DecodeUnicodeConsole(Files.Name)); |
6715 | if (!Files.ModifiedEmpty) { | 6880 | if (!Files.ModifiedEmpty) { |
6716 | printf("\"%s\";",OSDateTime(Files.Modified,false)); | 6881 | printf("\"%s\";",OSDateTime(Files.Modified,false)); |
6717 | } else printf("\"%c\";",0x20); | 6882 | } else printf("\"%c\";",0x20); |
6718 | printf("%i;",Files.Used); | 6883 | printf("%i;",Files.Used); |
6719 | } else { | 6884 | } else { |
6720 | printf("%s;Folder;",Files.ID_FullName); | 6885 | printf("%s;Folder;",Files.ID_FullName); |
6721 | printf("\"%s\";",DecodeUnicodeConsole(Files.Name)); | 6886 | printf("\"%s\";",DecodeUnicodeConsole(Files.Name)); |
6722 | strcpy(FolderName,DecodeUnicodeConsole(Files.Name)); | 6887 | strcpy(FolderName,DecodeUnicodeConsole(Files.Name)); |
6723 | } | 6888 | } |
6724 | 6889 | ||
6725 | if (Files.Protected) printf("P"); | 6890 | if (Files.Protected) printf("P"); |
6726 | if (Files.ReadOnly) printf("R"); | 6891 | if (Files.ReadOnly) printf("R"); |
6727 | if (Files.Hidden) printf("H"); | 6892 | if (Files.Hidden) printf("H"); |
6728 | if (Files.System) printf("S"); | 6893 | if (Files.System) printf("S"); |
6729 | |||
6730 | printf("\n"); | ||
6731 | |||
6732 | Start = false; | ||
6733 | } | 6894 | } |
6895 | Start = false; | ||
6734 | } | 6896 | } |
6735 | 6897 | ||
6736 | error = Phone->GetFileSystemStatus(&s,&Status); | 6898 | error = Phone->GetFileSystemStatus(&s,&Status); |
6737 | if (error != ERR_NOTSUPPORTED && error != ERR_NOTIMPLEMENTED) { | 6899 | if (error != ERR_NOTSUPPORTED && error != ERR_NOTIMPLEMENTED) { |
6738 | Print_Error(error); | 6900 | Print_Error(error); |
6739 | printmsg("\nFree memory: %i, total memory: %i\n",Status.Free,Status.Free+Status.Used); | 6901 | printmsg("\nFree memory: %i, total memory: %i\n",Status.Free,Status.Free+Status.Used); |
6740 | } | 6902 | } |
6741 | 6903 | ||
6742 | GSM_Terminate(); | 6904 | GSM_Terminate(); |
6743 | } | 6905 | } |
6744 | 6906 | ||
6745 | static void GetOneFile(GSM_File *File, bool newtime, int i) | 6907 | static void GetOneFile(GSM_File *File, bool newtime, int i) |
6746 | { | 6908 | { |
6747 | FILE *file; | 6909 | FILE *file; |
6748 | bool start; | 6910 | bool start; |
6749 | unsigned char buffer[5000]; | 6911 | unsigned char buffer[5000]; |
6750 | struct utimbuf filedate; | 6912 | struct utimbuf filedate; |
6751 | 6913 | ||
6752 | if (File->Buffer != NULL) { | 6914 | if (File->Buffer != NULL) { |
6753 | free(File->Buffer); | 6915 | free(File->Buffer); |
6754 | File->Buffer = NULL; | 6916 | File->Buffer = NULL; |
6755 | } | 6917 | } |
6756 | File->Used = 0; | 6918 | File->Used = 0; |
6757 | start = true; | 6919 | start = true; |
@@ -7017,52 +7179,56 @@ static void AddFolder(int argc, char *argv[]) | |||
7017 | struct NokiaFolderInfo { | 7179 | struct NokiaFolderInfo { |
7018 | char*model; | 7180 | char*model; |
7019 | char *parameter; | 7181 | char *parameter; |
7020 | char*folder; | 7182 | char*folder; |
7021 | char *level; | 7183 | char *level; |
7022 | }; | 7184 | }; |
7023 | 7185 | ||
7024 | static struct NokiaFolderInfo Folder[] = { | 7186 | static struct NokiaFolderInfo Folder[] = { |
7025 | /* Language indepedent in DCT4 */ | 7187 | /* Language indepedent in DCT4 */ |
7026 | {"", "MMSUnreadInbox", "INBOX","3"}, | 7188 | {"", "MMSUnreadInbox", "INBOX","3"}, |
7027 | {"", "MMSReadInbox", "INBOX","3"}, | 7189 | {"", "MMSReadInbox", "INBOX","3"}, |
7028 | {"", "MMSOutbox", "OUTBOX","3"}, | 7190 | {"", "MMSOutbox", "OUTBOX","3"}, |
7029 | {"", "MMSSent", "SENT", "3"}, | 7191 | {"", "MMSSent", "SENT", "3"}, |
7030 | {"", "MMSDrafts", "DRAFTS","3"}, | 7192 | {"", "MMSDrafts", "DRAFTS","3"}, |
7031 | {"", "Application", "applications","3"}, | 7193 | {"", "Application", "applications","3"}, |
7032 | {"", "Game", "games","3"}, | 7194 | {"", "Game", "games","3"}, |
7033 | /* Language depedent in DCT4 */ | 7195 | /* Language depedent in DCT4 */ |
7034 | {"", "Gallery", "Pictures","2"}, /* 3510 */ | 7196 | {"", "Gallery", "Pictures","2"}, /* 3510 */ |
7035 | {"", "Gallery", "Graphics","3"}, /* 3510i */ | 7197 | {"", "Gallery", "Graphics","3"}, /* 3510i */ |
7036 | {"", "Gallery", "Images","3"}, /* 6610 */ | 7198 | {"", "Gallery", "Images","3"}, /* 6610 */ |
7037 | {"3510", "Gallery", "", "8"}, | 7199 | {"3510", "Gallery", "", "8"}, |
7038 | {"3510i","Gallery", "", "3"}, | 7200 | {"3510i","Gallery", "", "3"}, |
7039 | {"5100", "Gallery", "", "3"}, | 7201 | {"5100", "Gallery", "", "3"}, |
7040 | {"6220", "Gallery", "", "5"}, | 7202 | {"6220", "Gallery", "", "5"}, |
7203 | {"6610", "Gallery", "", "2"}, | ||
7204 | {"7210", "Gallery", "", "2"}, | ||
7041 | {"", "Tones", "Tones","3"}, | 7205 | {"", "Tones", "Tones","3"}, |
7042 | {"3510i","Tones", "", "4"}, | 7206 | {"3510i","Tones", "", "4"}, |
7043 | {"5100", "Tones", "", "4"}, | 7207 | {"5100", "Tones", "", "4"}, |
7044 | {"6220", "Tones", "", "6"}, | 7208 | {"6220", "Tones", "", "6"}, |
7209 | {"6610", "Tones", "", "4"}, | ||
7210 | {"7210", "Tones", "", "4"}, | ||
7045 | /* Language indepedent in OBEX */ | 7211 | /* Language indepedent in OBEX */ |
7046 | {"obex", "MMSUnreadInbox", "", "predefMessages\\predefINBOX"}, | 7212 | {"obex", "MMSUnreadInbox", "", "predefMessages\\predefINBOX"}, |
7047 | {"obex", "MMSReadInbox", "", "predefMessages\\predefINBOX"}, | 7213 | {"obex", "MMSReadInbox", "", "predefMessages\\predefINBOX"}, |
7048 | {"obex", "MMSOutbox", "", "predefMessages\\predefOUTBOX"}, | 7214 | {"obex", "MMSOutbox", "", "predefMessages\\predefOUTBOX"}, |
7049 | {"obex", "MMSSent", "", "predefMessages\\predefSENT" }, | 7215 | {"obex", "MMSSent", "", "predefMessages\\predefSENT" }, |
7050 | {"obex", "MMSDrafts", "", "predefMessages\\predefDRAFTS"}, | 7216 | {"obex", "MMSDrafts", "", "predefMessages\\predefDRAFTS"}, |
7051 | // {"obex", "Application, "", "predefjava\\predefapplications"}, | 7217 | // {"obex", "Application, "", "predefjava\\predefapplications"}, |
7052 | // {"obex", "Game", "", "predefjava\\predefgames"}, | 7218 | // {"obex", "Game", "", "predefjava\\predefgames"}, |
7053 | {"obex", "Gallery", "", "predefgallery\\predefgraphics"}, | 7219 | {"obex", "Gallery", "", "predefgallery\\predefgraphics"}, |
7054 | {"obex", "Tones", "", "predefgallery\\predeftones"}, | 7220 | {"obex", "Tones", "", "predefgallery\\predeftones"}, |
7055 | 7221 | ||
7056 | /* End of list */ | 7222 | /* End of list */ |
7057 | {"", "", "", ""} | 7223 | {"", "", "", ""} |
7058 | }; | 7224 | }; |
7059 | 7225 | ||
7060 | static void NokiaAddFile(int argc, char *argv[]) | 7226 | static void NokiaAddFile(int argc, char *argv[]) |
7061 | { | 7227 | { |
7062 | GSM_File File, Files; | 7228 | GSM_File File, Files; |
7063 | FILE *file; | 7229 | FILE *file; |
7064 | GSM_DateTime DT,DT2; | 7230 | GSM_DateTime DT,DT2; |
7065 | time_t t_time1,t_time2; | 7231 | time_t t_time1,t_time2; |
7066 | unsigned char buffer[10000],JAR[500],Vendor[500],Name[500],Version[500],FileID[400]; | 7232 | unsigned char buffer[10000],JAR[500],Vendor[500],Name[500],Version[500],FileID[400]; |
7067 | bool Start = true, Found = false, wasclr; | 7233 | bool Start = true, Found = false, wasclr; |
7068 | bool ModEmpty = false; | 7234 | bool ModEmpty = false; |
@@ -7537,163 +7703,170 @@ static void CallDivert(int argc, char *argv[]) | |||
7537 | case GSM_DIVERT_FaxCalls : printmsg("fax"); break; | 7703 | case GSM_DIVERT_FaxCalls : printmsg("fax"); break; |
7538 | case GSM_DIVERT_DataCalls : printmsg("data"); break; | 7704 | case GSM_DIVERT_DataCalls : printmsg("data"); break; |
7539 | case GSM_DIVERT_AllCalls : printmsg("data & fax & voice"); break; | 7705 | case GSM_DIVERT_AllCalls : printmsg("data & fax & voice"); break; |
7540 | default : printmsg("unknown %i",cd.Request.CallType); break; | 7706 | default : printmsg("unknown %i",cd.Request.CallType); break; |
7541 | } | 7707 | } |
7542 | printmsg("\nResponse:"); | 7708 | printmsg("\nResponse:"); |
7543 | 7709 | ||
7544 | for (i=0;i<cd.Response.EntriesNum;i++) { | 7710 | for (i=0;i<cd.Response.EntriesNum;i++) { |
7545 | printmsg("\n Calls type : "); | 7711 | printmsg("\n Calls type : "); |
7546 | switch (cd.Response.Entries[i].CallType) { | 7712 | switch (cd.Response.Entries[i].CallType) { |
7547 | case GSM_DIVERT_VoiceCalls: printmsg("voice"); break; | 7713 | case GSM_DIVERT_VoiceCalls: printmsg("voice"); break; |
7548 | case GSM_DIVERT_FaxCalls : printmsg("fax"); break; | 7714 | case GSM_DIVERT_FaxCalls : printmsg("fax"); break; |
7549 | case GSM_DIVERT_DataCalls : printmsg("data"); break; | 7715 | case GSM_DIVERT_DataCalls : printmsg("data"); break; |
7550 | default : printmsg("unknown %i",cd.Response.Entries[i].CallType);break; | 7716 | default : printmsg("unknown %i",cd.Response.Entries[i].CallType);break; |
7551 | } | 7717 | } |
7552 | printf("\n"); | 7718 | printf("\n"); |
7553 | printmsg(" Timeout : %i seconds\n",cd.Response.Entries[i].Timeout); | 7719 | printmsg(" Timeout : %i seconds\n",cd.Response.Entries[i].Timeout); |
7554 | printmsg(" Number : %s\n",DecodeUnicodeString(cd.Response.Entries[i].Number)); | 7720 | printmsg(" Number : %s\n",DecodeUnicodeString(cd.Response.Entries[i].Number)); |
7555 | } | 7721 | } |
7556 | printf("\n"); | 7722 | printf("\n"); |
7557 | 7723 | ||
7558 | GSM_Terminate(); | 7724 | GSM_Terminate(); |
7559 | } | 7725 | } |
7560 | 7726 | ||
7561 | |||
7562 | //#if 0 | ||
7563 | static void CancelAllDiverts(int argc, char *argv[]) | 7727 | static void CancelAllDiverts(int argc, char *argv[]) |
7564 | { | 7728 | { |
7565 | GSM_Init(true); | 7729 | GSM_Init(true); |
7566 | 7730 | ||
7567 | error = Phone->CancelAllDiverts(&s); | 7731 | error = Phone->CancelAllDiverts(&s); |
7568 | Print_Error(error); | 7732 | Print_Error(error); |
7569 | 7733 | ||
7570 | GSM_Terminate(); | 7734 | GSM_Terminate(); |
7571 | } | 7735 | } |
7572 | 7736 | ||
7737 | typedef struct { | ||
7738 | unsigned char Connection[50]; | ||
7739 | } OneConnectionInfo; | ||
7573 | 7740 | ||
7741 | typedef struct { | ||
7742 | unsigned char Device[50]; | ||
7743 | OneConnectionInfo Connections[4]; | ||
7744 | } OneDeviceInfo; | ||
7745 | |||
7746 | int num; | ||
7747 | bool SearchOutput; | ||
7574 | 7748 | ||
7575 | void SearchPhoneThread(OneDeviceInfo *Info) | 7749 | void SearchPhoneThread(OneDeviceInfo *Info) |
7576 | { | 7750 | { |
7751 | //LR | ||
7752 | #if 0 | ||
7577 | int j; | 7753 | int j; |
7578 | GSM_Error error; | 7754 | GSM_Error error; |
7579 | fprintf(stderr,"*********************************** \n"); | 7755 | GSM_StateMachiness; |
7580 | fprintf(stderr,"*********************************** \n"); | 7756 | |
7581 | fprintf(stderr,"*********************************** \n"); | ||
7582 | fprintf(stderr,"*********************************** \n"); | ||
7583 | fprintf(stderr,"*********************************** \n"); | ||
7584 | #if 0 | ||
7585 | j = 0; | 7757 | j = 0; |
7586 | while(strlen(Info->Connections[j].Connection) != 0) { | 7758 | while(strlen(Info->Connections[j].Connection) != 0) { |
7587 | memcpy(&Info->s.di,&s.di,sizeof(Debug_Info)); | 7759 | memcpy(&ss.di,&s.di,sizeof(Debug_Info)); |
7588 | Info->s.msg = s.msg; | 7760 | ss.msg = s.msg; |
7589 | Info->s.ConfigNum = 1; | 7761 | ss.ConfigNum = 1; |
7590 | Info->s.opened = false; | 7762 | ss.opened = false; |
7591 | Info->s.Config[0].UseGlobalDebugFile = s.Config[0].UseGlobalDebugFile; | 7763 | ss.Config[0].UseGlobalDebugFile = s.Config[0].UseGlobalDebugFile; |
7592 | Info->s.Config[0].Localize = s.Config[0].Localize; | 7764 | ss.Config[0].Localize = s.Config[0].Localize; |
7593 | Info->s.Config[0].Device = Info->Device; | 7765 | ss.Config[0].Device = Info->Device; |
7594 | Info->s.Config[0].Connection = Info->Connections[j].Connection; | 7766 | ss.Config[0].Connection = Info->Connections[j].Connection; |
7595 | Info->s.Config[0].SyncTime = "no"; | 7767 | ss.Config[0].SyncTime = "no"; |
7596 | Info->s.Config[0].DebugFile = s.Config[0].DebugFile; | 7768 | ss.Config[0].DebugFile = s.Config[0].DebugFile; |
7597 | Info->s.Config[0].Model[0] = 0; | 7769 | ss.Config[0].Model[0] = 0; |
7598 | strcpy(Info->s.Config[0].DebugLevel,s.Config[0].DebugLevel); | 7770 | strcpy(ss.Config[0].DebugLevel,s.Config[0].DebugLevel); |
7599 | Info->s.Config[0].LockDevice = "no"; | 7771 | ss.Config[0].LockDevice = "no"; |
7600 | Info->s.Config[0].StartInfo = "no"; | 7772 | ss.Config[0].StartInfo = "no"; |
7601 | 7773 | ||
7602 | error = GSM_InitConnection(&Info->s,1); | 7774 | error = GSM_InitConnection(&ss,1); |
7603 | if (SearchOutput) printf("Connection \"%s\" on device \"%s\"\n",Info->Connections[j].Connection,Info->Device); | 7775 | if (SearchOutput) printf("Connection \"%s\" on device \"%s\"\n",Info->Connections[j].Connection,Info->Device); |
7604 | if (error == ERR_NONE) { | 7776 | if (error == ERR_NONE) { |
7605 | error=Info->s.Phone.Functions->GetManufacturer(&Info->s); | 7777 | error=ss.Phone.Functions->GetManufacturer(&ss); |
7606 | if (error == ERR_NONE) { | 7778 | if (error == ERR_NONE) { |
7607 | error=Info->s.Phone.Functions->GetModel(&Info->s); | 7779 | error=ss.Phone.Functions->GetModel(&ss); |
7608 | if (error == ERR_NONE) { | 7780 | if (error == ERR_NONE) { |
7609 | if (!SearchOutput) printf("Connection \"%s\" on device \"%s\"\n",Info->Connections[j].Connection,Info->Device); | 7781 | if (!SearchOutput) printf("Connection \"%s\" on device \"%s\"\n",Info->Connections[j].Connection,Info->Device); |
7610 | printmsg(" Manufacturer : %s\n", | 7782 | printmsg(" Manufacturer : %s\n", |
7611 | Info->s.Phone.Data.Manufacturer); | 7783 | ss.Phone.Data.Manufacturer); |
7612 | printmsg(" Model : %s (%s)\n", | 7784 | printmsg(" Model : %s (%s)\n", |
7613 | Info->s.Phone.Data.ModelInfo->model, | 7785 | ss.Phone.Data.ModelInfo->model, |
7614 | Info->s.Phone.Data.Model); | 7786 | ss.Phone.Data.Model); |
7615 | } else { | 7787 | } else { |
7616 | if (SearchOutput) printf(" %s\n",print_error(error,Info->s.di.df,Info->s.msg)); | 7788 | if (SearchOutput) printf(" %s\n",print_error(error,ss.di.df,ss.msg)); |
7617 | } | 7789 | } |
7618 | } else { | 7790 | } else { |
7619 | if (SearchOutput) printf(" %s\n",print_error(error,Info->s.di.df,Info->s.msg)); | 7791 | if (SearchOutput) printf(" %s\n",print_error(error,ss.di.df,ss.msg)); |
7620 | } | 7792 | } |
7621 | } else { | 7793 | } else { |
7622 | if (SearchOutput) printf(" %s\n",print_error(error,Info->s.di.df,Info->s.msg)); | 7794 | if (SearchOutput) printf(" %s\n",print_error(error,ss.di.df,ss.msg)); |
7623 | } | 7795 | } |
7624 | if (error != ERR_DEVICEOPENERROR) { | 7796 | if (error != ERR_DEVICEOPENERROR) { |
7625 | GSM_TerminateConnection(&Info->s); | 7797 | GSM_TerminateConnection(&ss); |
7626 | dbgprintf("Closing done\n"); | 7798 | dbgprintf("Closing done\n"); |
7627 | } | 7799 | } |
7628 | if (error == ERR_DEVICEOPENERROR || error == ERR_NONE) break; | 7800 | if (error == ERR_DEVICEOPENERROR) break; |
7629 | j++; | 7801 | j++; |
7630 | } | 7802 | } |
7631 | num--; | 7803 | num--; |
7632 | #endif | 7804 | #endif |
7633 | } | 7805 | } |
7634 | 7806 | ||
7635 | //#undef HAVE_PTHREAD | ||
7636 | //#if 0 | ||
7637 | #if defined(WIN32) || defined(HAVE_PTHREAD) | 7807 | #if defined(WIN32) || defined(HAVE_PTHREAD) |
7638 | #ifdef HAVE_PTHREAD | 7808 | #ifdef HAVE_PTHREAD |
7639 | pthread_t Thread[100]; | 7809 | pthread_t Thread[100]; |
7640 | #endif | 7810 | #endif |
7641 | 7811 | ||
7812 | OneDeviceInfo SearchDevices[60]; | ||
7813 | |||
7642 | void MakeSearchThread(int i) | 7814 | void MakeSearchThread(int i) |
7643 | { | 7815 | { |
7644 | num++; | 7816 | num++; |
7645 | #ifdef HAVE_PTHREAD | 7817 | #ifdef HAVE_PTHREAD |
7646 | if (pthread_create(&Thread[i],NULL,(void *)SearchPhoneThread,&SearchDevices[i])!=0) { | 7818 | if (pthread_create(&Thread[i],NULL,(void *)SearchPhoneThread,&SearchDevices[i])!=0) { |
7647 | dbgprintf("Error creating thread\n"); | 7819 | dbgprintf("Error creating thread\n"); |
7648 | } | 7820 | } |
7649 | #else | 7821 | #else |
7650 | if (CreateThread((LPSECURITY_ATTRIBUTES)NULL,0, | 7822 | if (CreateThread((LPSECURITY_ATTRIBUTES)NULL,0, |
7651 | (LPTHREAD_START_ROUTINE)SearchPhoneThread,&SearchDevices[i], | 7823 | (LPTHREAD_START_ROUTINE)SearchPhoneThread,&SearchDevices[i], |
7652 | 0,NULL)==NULL) { | 7824 | 0,NULL)==NULL) { |
7653 | dbgprintf("Error creating thread\n"); | 7825 | dbgprintf("Error creating thread\n"); |
7654 | } | 7826 | } |
7655 | #endif | 7827 | #endif |
7656 | } | 7828 | } |
7657 | 7829 | ||
7658 | static void SearchPhone(int argc, char *argv[]) | 7830 | static void SearchPhone(int argc, char *argv[]) |
7659 | { | 7831 | { |
7660 | int i,dev = 0, dev2 = 0; | 7832 | int i,dev = 0, dev2 = 0; |
7661 | 7833 | ||
7662 | SearchOutput = false; | 7834 | SearchOutput = false; |
7663 | if (argc == 3 && mystrncasecmp(argv[2], "-debug",0)) SearchOutput = true; | 7835 | if (argc == 3 && mystrncasecmp(argv[2], "-debug",0)) SearchOutput = true; |
7664 | 7836 | ||
7665 | num = 0; | 7837 | num = 0; |
7666 | #ifdef WIN32 | 7838 | #ifdef WIN32 |
7667 | # ifdef GSM_ENABLE_IRDADEVICE | 7839 | # ifdef GSM_ENABLE_IRDADEVICE |
7668 | sprintf(SearchDevices[dev].Device,""); | 7840 | sprintf(SearchDevices[dev].Device,""); |
7669 | sprintf(SearchDevices[dev].Connections[0].Connection,"irdaphonet"); | 7841 | sprintf(SearchDevices[dev].Connections[0].Connection,"irdaphonet"); |
7670 | SearchDevices[dev].Connections[1].Connection[0] = 0; | 7842 | sprintf(SearchDevices[dev].Connections[1].Connection,"irdaat"); |
7843 | SearchDevices[dev].Connections[2].Connection[0] = 0; | ||
7671 | dev++; | 7844 | dev++; |
7672 | # endif | 7845 | # endif |
7673 | # ifdef GSM_ENABLE_SERIALDEVICE | 7846 | # ifdef GSM_ENABLE_SERIALDEVICE |
7674 | dev2 = dev; | 7847 | dev2 = dev; |
7675 | for(i=0;i<10;i++) { | 7848 | for(i=0;i<20;i++) { |
7676 | sprintf(SearchDevices[dev2].Device,"com%i:",i+1); | 7849 | sprintf(SearchDevices[dev2].Device,"com%i:",i+1); |
7677 | sprintf(SearchDevices[dev2].Connections[0].Connection,"fbusdlr3"); | 7850 | sprintf(SearchDevices[dev2].Connections[0].Connection,"fbusdlr3"); |
7678 | sprintf(SearchDevices[dev2].Connections[1].Connection,"fbus"); | 7851 | sprintf(SearchDevices[dev2].Connections[1].Connection,"fbus"); |
7679 | sprintf(SearchDevices[dev2].Connections[2].Connection,"at19200"); | 7852 | sprintf(SearchDevices[dev2].Connections[2].Connection,"at19200"); |
7680 | sprintf(SearchDevices[dev2].Connections[3].Connection,"mbus"); | 7853 | sprintf(SearchDevices[dev2].Connections[3].Connection,"mbus"); |
7681 | SearchDevices[dev2].Connections[4].Connection[0] = 0; | 7854 | SearchDevices[dev2].Connections[4].Connection[0] = 0; |
7682 | dev2++; | 7855 | dev2++; |
7683 | } | 7856 | } |
7684 | # endif | 7857 | # endif |
7685 | #endif | 7858 | #endif |
7686 | #ifdef __linux__ | 7859 | #ifdef __linux__ |
7687 | # ifdef GSM_ENABLE_IRDADEVICE | 7860 | # ifdef GSM_ENABLE_IRDADEVICE |
7688 | for(i=0;i<6;i++) { | 7861 | for(i=0;i<6;i++) { |
7689 | sprintf(SearchDevices[dev].Device,"/dev/ircomm%i",i); | 7862 | sprintf(SearchDevices[dev].Device,"/dev/ircomm%i",i); |
7690 | sprintf(SearchDevices[dev].Connections[0].Connection,"irdaphonet"); | 7863 | sprintf(SearchDevices[dev].Connections[0].Connection,"irdaphonet"); |
7691 | sprintf(SearchDevices[dev].Connections[1].Connection,"at19200"); | 7864 | sprintf(SearchDevices[dev].Connections[1].Connection,"at19200"); |
7692 | SearchDevices[dev].Connections[2].Connection[0] = 0; | 7865 | SearchDevices[dev].Connections[2].Connection[0] = 0; |
7693 | dev++; | 7866 | dev++; |
7694 | } | 7867 | } |
7695 | # endif | 7868 | # endif |
7696 | # ifdef GSM_ENABLE_SERIALDEVICE | 7869 | # ifdef GSM_ENABLE_SERIALDEVICE |
7697 | dev2 = dev; | 7870 | dev2 = dev; |
7698 | for(i=0;i<10;i++) { | 7871 | for(i=0;i<10;i++) { |
7699 | sprintf(SearchDevices[dev2].Device,"/dev/ttyS%i",i); | 7872 | sprintf(SearchDevices[dev2].Device,"/dev/ttyS%i",i); |
@@ -7709,49 +7882,49 @@ static void SearchPhone(int argc, char *argv[]) | |||
7709 | sprintf(SearchDevices[dev2].Connections[0].Connection,"fbusdlr3"); | 7882 | sprintf(SearchDevices[dev2].Connections[0].Connection,"fbusdlr3"); |
7710 | sprintf(SearchDevices[dev2].Connections[1].Connection,"fbus"); | 7883 | sprintf(SearchDevices[dev2].Connections[1].Connection,"fbus"); |
7711 | sprintf(SearchDevices[dev2].Connections[2].Connection,"at19200"); | 7884 | sprintf(SearchDevices[dev2].Connections[2].Connection,"at19200"); |
7712 | sprintf(SearchDevices[dev2].Connections[3].Connection,"mbus"); | 7885 | sprintf(SearchDevices[dev2].Connections[3].Connection,"mbus"); |
7713 | SearchDevices[dev2].Connections[4].Connection[0] = 0; | 7886 | SearchDevices[dev2].Connections[4].Connection[0] = 0; |
7714 | dev2++; | 7887 | dev2++; |
7715 | } | 7888 | } |
7716 | for(i=0;i<4;i++) { | 7889 | for(i=0;i<4;i++) { |
7717 | sprintf(SearchDevices[dev2].Device,"/dev/usb/tts/%i",i); | 7890 | sprintf(SearchDevices[dev2].Device,"/dev/usb/tts/%i",i); |
7718 | sprintf(SearchDevices[dev2].Connections[0].Connection,"fbusdlr3"); | 7891 | sprintf(SearchDevices[dev2].Connections[0].Connection,"fbusdlr3"); |
7719 | sprintf(SearchDevices[dev2].Connections[1].Connection,"fbus"); | 7892 | sprintf(SearchDevices[dev2].Connections[1].Connection,"fbus"); |
7720 | sprintf(SearchDevices[dev2].Connections[2].Connection,"at19200"); | 7893 | sprintf(SearchDevices[dev2].Connections[2].Connection,"at19200"); |
7721 | sprintf(SearchDevices[dev2].Connections[3].Connection,"mbus"); | 7894 | sprintf(SearchDevices[dev2].Connections[3].Connection,"mbus"); |
7722 | SearchDevices[dev2].Connections[4].Connection[0] = 0; | 7895 | SearchDevices[dev2].Connections[4].Connection[0] = 0; |
7723 | dev2++; | 7896 | dev2++; |
7724 | } | 7897 | } |
7725 | # endif | 7898 | # endif |
7726 | #endif | 7899 | #endif |
7727 | for(i=0;i<dev;i++) MakeSearchThread(i); | 7900 | for(i=0;i<dev;i++) MakeSearchThread(i); |
7728 | while (num != 0) my_sleep(5); | 7901 | while (num != 0) my_sleep(5); |
7729 | for(i=dev;i<dev2;i++) MakeSearchThread(i); | 7902 | for(i=dev;i<dev2;i++) MakeSearchThread(i); |
7730 | while (num != 0) my_sleep(5); | 7903 | while (num != 0) my_sleep(5); |
7731 | } | 7904 | } |
7732 | #endif /*Support for threads */ | 7905 | #endif /*Support for threads */ |
7733 | // #if 0 | 7906 | |
7734 | static void NokiaGetADC(int argc, char *argv[]) | 7907 | static void NokiaGetADC(int argc, char *argv[]) |
7735 | { | 7908 | { |
7736 | GSM_Init(true); | 7909 | GSM_Init(true); |
7737 | 7910 | ||
7738 | #ifdef GSM_ENABLE_NOKIA_DCT3 | 7911 | #ifdef GSM_ENABLE_NOKIA_DCT3 |
7739 | DCT3GetADC(argc,argv); | 7912 | DCT3GetADC(argc,argv); |
7740 | #endif | 7913 | #endif |
7741 | #ifdef GSM_ENABLE_NOKIA_DCT4 | 7914 | #ifdef GSM_ENABLE_NOKIA_DCT4 |
7742 | DCT4GetADC(argc, argv); | 7915 | DCT4GetADC(argc, argv); |
7743 | #endif | 7916 | #endif |
7744 | 7917 | ||
7745 | GSM_Terminate(); | 7918 | GSM_Terminate(); |
7746 | } | 7919 | } |
7747 | 7920 | ||
7748 | static void NokiaDisplayTest(int argc, char *argv[]) | 7921 | static void NokiaDisplayTest(int argc, char *argv[]) |
7749 | { | 7922 | { |
7750 | GSM_Init(true); | 7923 | GSM_Init(true); |
7751 | 7924 | ||
7752 | #ifdef GSM_ENABLE_NOKIA_DCT3 | 7925 | #ifdef GSM_ENABLE_NOKIA_DCT3 |
7753 | DCT3DisplayTest(argc,argv); | 7926 | DCT3DisplayTest(argc,argv); |
7754 | #endif | 7927 | #endif |
7755 | #ifdef GSM_ENABLE_NOKIA_DCT4 | 7928 | #ifdef GSM_ENABLE_NOKIA_DCT4 |
7756 | DCT4DisplayTest(argc, argv); | 7929 | DCT4DisplayTest(argc, argv); |
7757 | #endif | 7930 | #endif |
@@ -7772,163 +7945,165 @@ static void NokiaGetT9(int argc, char *argv[]) | |||
7772 | 7945 | ||
7773 | GSM_Terminate(); | 7946 | GSM_Terminate(); |
7774 | } | 7947 | } |
7775 | 7948 | ||
7776 | static void NokiaVibraTest(int argc, char *argv[]) | 7949 | static void NokiaVibraTest(int argc, char *argv[]) |
7777 | { | 7950 | { |
7778 | GSM_Init(true); | 7951 | GSM_Init(true); |
7779 | 7952 | ||
7780 | #ifdef GSM_ENABLE_NOKIA_DCT3 | 7953 | #ifdef GSM_ENABLE_NOKIA_DCT3 |
7781 | DCT3VibraTest(argc,argv); | 7954 | DCT3VibraTest(argc,argv); |
7782 | #endif | 7955 | #endif |
7783 | #ifdef GSM_ENABLE_NOKIA_DCT4 | 7956 | #ifdef GSM_ENABLE_NOKIA_DCT4 |
7784 | DCT4VibraTest(argc, argv); | 7957 | DCT4VibraTest(argc, argv); |
7785 | #endif | 7958 | #endif |
7786 | 7959 | ||
7787 | GSM_Terminate(); | 7960 | GSM_Terminate(); |
7788 | } | 7961 | } |
7789 | 7962 | ||
7790 | static GSM_Parameters Parameters[] = { | 7963 | static GSM_Parameters Parameters[] = { |
7791 | {"--identify", 0, 0, Identify, {H_Info,0}, ""}, | 7964 | {"--identify", 0, 0, Identify, {H_Info,0}, ""}, |
7792 | {"--version", 0, 0, Version, {H_Other,0}, ""}, | 7965 | {"--version", 0, 0, Version, {H_Other,0}, ""}, |
7793 | {"--getdisplaystatus", 0, 0, GetDisplayStatus, {H_Info,0}, ""}, | 7966 | {"--getdisplaystatus", 0, 0, GetDisplayStatus, {H_Info,0}, ""}, |
7794 | {"--monitor", 0, 1, Monitor, {H_Info,H_Network,H_Call,0},"[times]"}, | 7967 | {"--monitor", 0, 1, Monitor, {H_Info,H_Network,H_Call,0},"[times]"}, |
7795 | {"--setautonetworklogin", 0, 0, SetAutoNetworkLogin, {H_Network,0}, ""}, | 7968 | {"--setautonetworklogin", 0, 0, SetAutoNetworkLogin, {H_Network,0}, ""}, |
7796 | {"--listnetworks", 0, 0, ListNetworks, {H_Network,0}, ""}, | 7969 | {"--listnetworks", 0, 1, ListNetworks, {H_Network,0}, "[country]"}, |
7797 | {"--getgprspoint", 1, 2, GetGPRSPoint, {H_Nokia,H_Network,0}, "start [stop]"}, | 7970 | {"--getgprspoint", 1, 2, GetGPRSPoint, {H_Nokia,H_Network,0}, "start [stop]"}, |
7798 | {"--addfolder", 2, 2, AddFolder, {H_Filesystem,0}, "parentfolderID name"}, | 7971 | {"--addfolder", 2, 2, AddFolder, {H_Filesystem,0}, "parentfolderID name"}, |
7799 | {"--getfilesystem", 0, 1, GetFileSystem, {H_Filesystem,0}, "[-flatall|-flat]"}, | 7972 | {"--getfilesystem", 0, 1, GetFileSystem, {H_Filesystem,0}, "[-flatall|-flat]"}, |
7800 | {"--getfilesystemstatus", 0, 0, GetFileSystemStatus, {H_Filesystem,0}, ""}, | 7973 | {"--getfilesystemstatus", 0, 0, GetFileSystemStatus, {H_Filesystem,0}, ""}, |
7801 | {"--getfiles", 1,40, GetFiles, {H_Filesystem,0}, "ID1, ID2, ..."}, | 7974 | {"--getfiles", 1,40, GetFiles, {H_Filesystem,0}, "ID1, ID2, ..."}, |
7802 | {"--getfilefolder", 1,40, GetFileFolder, {H_Filesystem,0}, "ID1, ID2, ..."}, | 7975 | {"--getfilefolder", 1,40, GetFileFolder, {H_Filesystem,0}, "ID1, ID2, ..."}, |
7803 | {"--addfile", 2, 6, AddFile, {H_Filesystem,0}, "folderID name [-type JAR|BMP|PNG|GIF|JPG|MIDI|WBMP|AMR|3GP|NRT][-readonly][-protected][-system][-hidden][-newtime]"}, | 7976 | {"--addfile", 2, 6, AddFile, {H_Filesystem,0}, "folderID name [-type JAR|BMP|PNG|GIF|JPG|MIDI|WBMP|AMR|3GP|NRT][-readonly][-protected][-system][-hidden][-newtime]"}, |
7804 | {"--nokiaaddfile", 2, 5, NokiaAddFile, {H_Filesystem,H_Nokia,0},"MMSUnreadInbox|MMSReadInbox|MMSOutbox|MMSDrafts|MMSSent file sender title"}, | 7977 | {"--nokiaaddfile", 2, 5, NokiaAddFile, {H_Filesystem,H_Nokia,0},"MMSUnreadInbox|MMSReadInbox|MMSOutbox|MMSDrafts|MMSSent file sender title"}, |
7805 | {"--nokiaaddfile", 2, 5, NokiaAddFile, {H_Filesystem,H_Nokia,0},"Application|Game file [-readonly]"}, | 7978 | {"--nokiaaddfile", 2, 5, NokiaAddFile, {H_Filesystem,H_Nokia,0},"Application|Game file [-readonly]"}, |
7806 | {"--nokiaaddfile", 2, 5, NokiaAddFile, {H_Filesystem,H_Nokia,0},"Gallery|Tones file [-name name][-protected][-readonly][-system][-hidden][-newtime]"}, | 7979 | {"--nokiaaddfile", 2, 5, NokiaAddFile, {H_Filesystem,H_Nokia,0},"Gallery|Tones file [-name name][-protected][-readonly][-system][-hidden][-newtime]"}, |
7807 | {"--deletefiles", 1,20, DeleteFiles, {H_Filesystem,0}, "fileID"}, | 7980 | {"--deletefiles", 1,20, DeleteFiles, {H_Filesystem,0}, "fileID"}, |
7808 | {"--playringtone", 1, 1, PlayRingtone, {H_Ringtone,0}, "file"}, | 7981 | {"--playringtone", 1, 1, PlayRingtone, {H_Ringtone,0}, "file"}, |
7809 | {"--playsavedringtone", 1, 1, DCT4PlaySavedRingtone, {H_Ringtone,0}, ""}, | 7982 | {"--playsavedringtone", 1, 1, DCT4PlaySavedRingtone, {H_Ringtone,0}, ""}, |
7810 | {"--getdatetime", 0, 0, GetDateTime, {H_DateTime,0}, ""}, | 7983 | {"--getdatetime", 0, 0, GetDateTime, {H_DateTime,0}, ""}, |
7811 | {"--setdatetime", 0, 0, SetDateTime, {H_DateTime,0}, ""}, | 7984 | {"--setdatetime", 0, 0, SetDateTime, {H_DateTime,0}, ""}, |
7812 | {"--getalarm", 0, 0, GetAlarm, {H_DateTime,0}, ""}, | 7985 | {"--getalarm", 0, 0, GetAlarm, {H_DateTime,0}, ""}, |
7813 | {"--setalarm", 2, 2, SetAlarm, {H_DateTime,0}, "hour minute"}, | 7986 | {"--setalarm", 2, 2, SetAlarm, {H_DateTime,0}, "hour minute"}, |
7814 | {"--resetphonesettings", 1, 1, ResetPhoneSettings, {H_Settings,0}, "PHONE|DEV|UIF|ALL|FACTORY"}, | 7987 | {"--resetphonesettings", 1, 1, ResetPhoneSettings, {H_Settings,0}, "PHONE|DEV|UIF|ALL|FACTORY"}, |
7815 | {"--getmemory", 2, 3, GetMemory, {H_Memory,0}, "DC|MC|RC|ON|VM|SM|ME|FD start [stop]"}, | 7988 | {"--getmemory", 2, 4, GetMemory, {H_Memory,0}, "DC|MC|RC|ON|VM|SM|ME|FD start [stop [-nonempty]]"}, |
7816 | {"--getallmemory", 1, 1, GetAllMemory, {H_Memory,0}, "DC|MC|RC|ON|VM|SM|ME|FD"}, | 7989 | {"--getallmemory", 1, 2, GetAllMemory, {H_Memory,0}, "DC|MC|RC|ON|VM|SM|ME|FD"}, |
7817 | {"--searchmemory", 1, 1, SearchMemory, {H_Memory,0}, "text"}, | 7990 | {"--searchmemory", 1, 1, SearchMemory, {H_Memory,0}, "text"}, |
7818 | {"--listmemorycategory", 1, 1, ListMemoryCategory, {H_Memory, H_Category,0},"text|number"}, | 7991 | {"--listmemorycategory", 1, 1, ListMemoryCategory, {H_Memory, H_Category,0},"text|number"}, |
7819 | {"--getfmstation", 1, 2, GetFMStation, {H_FM,0}, "start [stop]"}, | 7992 | {"--getfmstation", 1, 2, GetFMStation, {H_FM,0}, "start [stop]"}, |
7820 | {"--getsmsc", 1, 2, GetSMSC, {H_SMS,0}, "start [stop]"}, | 7993 | {"--getsmsc", 1, 2, GetSMSC, {H_SMS,0}, "start [stop]"}, |
7821 | {"--getsms", 2, 3, GetSMS, {H_SMS,0}, "folder start [stop]"}, | 7994 | {"--getsms", 2, 3, GetSMS, {H_SMS,0}, "folder start [stop]"}, |
7822 | {"--deletesms", 2, 3, DeleteSMS, {H_SMS,0}, "folder start [stop]"}, | 7995 | {"--deletesms", 2, 3, DeleteSMS, {H_SMS,0}, "folder start [stop]"}, |
7823 | {"--deleteallsms", 1, 1, DeleteAllSMS, {H_SMS,0}, "folder"}, | 7996 | {"--deleteallsms", 1, 1, DeleteAllSMS, {H_SMS,0}, "folder"}, |
7824 | {"--getsmsfolders", 0, 0, GetSMSFolders, {H_SMS,0}, ""}, | 7997 | {"--getsmsfolders", 0, 0, GetSMSFolders, {H_SMS,0}, ""}, |
7825 | {"--getallsms", 0, 0, GetAllSMS, {H_SMS,0}, ""}, | 7998 | {"--getallsms", 0, 0, GetAllSMS, {H_SMS,0}, ""}, |
7826 | {"--geteachsms", 0, 0, GetEachSMS, {H_SMS,0}, ""}, | 7999 | {"--geteachsms", 0, 0, GetEachSMS, {H_SMS,0}, ""}, |
7827 | 8000 | ||
7828 | #define SMS_TEXT_OPTIONS"[-inputunicode][-16bit][-flash][-len len][-autolen len][-unicode][-enablevoice][-disablevoice][-enablefax][-disablefax][-enableemail][-disableemail][-voidsms][-replacemessages ID][-replacefile file]" | 8001 | #define SMS_TEXT_OPTIONS"[-inputunicode][-16bit][-flash][-len len][-autolen len][-unicode][-enablevoice][-disablevoice][-enablefax][-disablefax][-enableemail][-disableemail][-voidsms][-replacemessages ID][-replacefile file]" |
7829 | #define SMS_PICTURE_OPTIONS"[-text text][-unicode][-alcatelbmmi]" | 8002 | #define SMS_PICTURE_OPTIONS"[-text text][-unicode][-alcatelbmmi]" |
7830 | #define SMS_PROFILE_OPTIONS"[-name name][-bitmap bitmap][-ringtone ringtone]" | 8003 | #define SMS_PROFILE_OPTIONS"[-name name][-bitmap bitmap][-ringtone ringtone]" |
7831 | #define SMS_EMS_OPTIONS "[-unicode][-16bit][-format lcrasbiut][-text text][-unicodefiletext file][-defsound ID][-defanimation ID][-tone10 file][-tone10long file][-tone12 file][-tone12long file][-toneSE file][-toneSElong file][-fixedbitmap file][-variablebitmap file][-variablebitmaplong file][-animation frames file1 ...][-protected number]" | 8004 | #define SMS_EMS_OPTIONS "[-unicode][-16bit][-format lcrasbiut][-text text][-unicodefiletext file][-defsound ID][-defanimation ID][-tone10 file][-tone10long file][-tone12 file][-tone12long file][-toneSE file][-toneSElong file][-fixedbitmap file][-variablebitmap file][-variablebitmaplong file][-animation frames file1 ...][-protected number]" |
7832 | #define SMS_SMSTEMPLATE_OPTIONS"[-unicode][-text text][-unicodefiletext file][-defsound ID][-defanimation ID][-tone10 file][-tone10long file][-tone12 file][-tone12long file][-toneSE file][-toneSElong file][-variablebitmap file][-variablebitmaplong file][-animation frames file1 ...]" | 8005 | #define SMS_SMSTEMPLATE_OPTIONS"[-unicode][-text text][-unicodefiletext file][-defsound ID][-defanimation ID][-tone10 file][-tone10long file][-tone12 file][-tone12long file][-toneSE file][-toneSElong file][-variablebitmap file][-variablebitmaplong file][-animation frames file1 ...]" |
7833 | #define SMS_ANIMATION_OPTIONS"" | 8006 | #define SMS_ANIMATION_OPTIONS"" |
7834 | #define SMS_OPERATOR_OPTIONS"[-netcode netcode][-biglogo]" | 8007 | #define SMS_OPERATOR_OPTIONS"[-netcode netcode][-biglogo]" |
7835 | #define SMS_SAVE_OPTIONS"[-folder id][-unread][-read][-unsent][-sent][-sender number]" | 8008 | #define SMS_SAVE_OPTIONS"[-folder id][-unread][-read][-unsent][-sent][-sender number]" |
7836 | #define SMS_SEND_OPTIONS"[-report][-validity HOUR|6HOURS|DAY|3DAYS|WEEK|MAX][-save [-folder number]]" | 8009 | #define SMS_SEND_OPTIONS"[-report][-validity HOUR|6HOURS|DAY|3DAYS|WEEK|MAX][-save [-folder number]]" |
7837 | #define SMS_COMMON_OPTIONS"[-smscset number][-smscnumber number][-reply][-maxsms num]" | 8010 | #define SMS_COMMON_OPTIONS"[-smscset number][-smscnumber number][-reply][-maxsms num]" |
7838 | 8011 | ||
7839 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,0}, "TEXT " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_TEXT_OPTIONS}, | 8012 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,0}, "TEXT " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_TEXT_OPTIONS}, |
7840 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Ringtone,0}, "RINGTONE file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | 8013 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Ringtone,0}, "RINGTONE file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, |
7841 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "OPERATOR file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_OPERATOR_OPTIONS}, | 8014 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "OPERATOR file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_OPERATOR_OPTIONS}, |
7842 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "CALLER file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | 8015 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "CALLER file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, |
7843 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "PICTURE file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_PICTURE_OPTIONS}, | 8016 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "PICTURE file " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_PICTURE_OPTIONS}, |
7844 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "ANIMATION frames file1 file2... " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_ANIMATION_OPTIONS}, | 8017 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "ANIMATION frames file1 file2... " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_ANIMATION_OPTIONS}, |
7845 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_MMS,0}, "MMSINDICATOR URL Title Sender " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | 8018 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_MMS,0}, "MMSINDICATOR URL Title Sender " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, |
8019 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "WAPINDICATOR URL Title " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | ||
7846 | #ifdef GSM_ENABLE_BACKUP | 8020 | #ifdef GSM_ENABLE_BACKUP |
7847 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "BOOKMARK file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | 8021 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "BOOKMARK file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, |
7848 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "WAPSETTINGS file location DATA|GPRS " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | 8022 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "WAPSETTINGS file location DATA|GPRS " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, |
7849 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_MMS,0}, "MMSSETTINGS file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | 8023 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_MMS,0}, "MMSSETTINGS file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, |
7850 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Calendar,0}, "CALENDAR file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | 8024 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Calendar,0}, "CALENDAR file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, |
7851 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_ToDo,0}, "TODO file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | 8025 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_ToDo,0}, "TODO file location " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, |
7852 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Memory,0}, "VCARD10|VCARD21 file SM|ME location [-nokia]" SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, | 8026 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Memory,0}, "VCARD10|VCARD21 file SM|ME location [-nokia]" SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS}, |
7853 | #endif | 8027 | #endif |
7854 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Settings,0}, "PROFILE " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_PROFILE_OPTIONS}, | 8028 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,H_Settings,0}, "PROFILE " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_PROFILE_OPTIONS}, |
7855 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,0}, "EMS " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_EMS_OPTIONS}, | 8029 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,0}, "EMS " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_EMS_OPTIONS}, |
7856 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,0}, "SMSTEMPLATE " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_SMSTEMPLATE_OPTIONS}, | 8030 | {"--savesms", 1,30, SendSaveDisplaySMS, {H_SMS,0}, "SMSTEMPLATE " SMS_SAVE_OPTIONS SMS_COMMON_OPTIONS SMS_SMSTEMPLATE_OPTIONS}, |
7857 | 8031 | ||
7858 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,0}, "TEXT destination " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_TEXT_OPTIONS}, | 8032 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,0}, "TEXT destination " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_TEXT_OPTIONS}, |
7859 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Ringtone,0}, "RINGTONE destination file " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | 8033 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Ringtone,0}, "RINGTONE destination file " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, |
7860 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "OPERATOR destination file " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_OPERATOR_OPTIONS}, | 8034 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "OPERATOR destination file " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_OPERATOR_OPTIONS}, |
7861 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "CALLER destination file " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | 8035 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "CALLER destination file " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, |
7862 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "PICTURE destination file " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_PICTURE_OPTIONS}, | 8036 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "PICTURE destination file " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_PICTURE_OPTIONS}, |
7863 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "ANIMATION destination frames file1 file2... " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_ANIMATION_OPTIONS}, | 8037 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Logo,0}, "ANIMATION destination frames file1 file2... " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_ANIMATION_OPTIONS}, |
7864 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_MMS,0}, "MMSINDICATOR destination URL Title Sender " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | 8038 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_MMS,0}, "MMSINDICATOR destination URL Title Sender " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, |
8039 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "WAPINDICATOR destination URL Title " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | ||
7865 | #ifdef GSM_ENABLE_BACKUP | 8040 | #ifdef GSM_ENABLE_BACKUP |
7866 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "BOOKMARK destination file location " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | 8041 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "BOOKMARK destination file location " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, |
7867 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "WAPSETTINGS destination file location DATA|GPRS " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | 8042 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_WAP,0}, "WAPSETTINGS destination file location DATA|GPRS " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, |
7868 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_MMS,0}, "MMSSETTINGS destination file location " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | 8043 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_MMS,0}, "MMSSETTINGS destination file location " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, |
7869 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Calendar,0}, "CALENDAR destination file location " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | 8044 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Calendar,0}, "CALENDAR destination file location " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, |
7870 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_ToDo,0}, "TODO destination file location " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | 8045 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_ToDo,0}, "TODO destination file location " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, |
7871 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Memory,0}, "VCARD10|VCARD21 destination file SM|ME location [-nokia]" SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, | 8046 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Memory,0}, "VCARD10|VCARD21 destination file SM|ME location [-nokia]" SMS_SEND_OPTIONS SMS_COMMON_OPTIONS}, |
7872 | #endif | 8047 | #endif |
7873 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Settings,0}, "PROFILE destination " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS ""SMS_PROFILE_OPTIONS}, | 8048 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Settings,0}, "PROFILE destination " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS ""SMS_PROFILE_OPTIONS}, |
7874 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,0}, "EMS destination " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_EMS_OPTIONS}, | 8049 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,0}, "EMS destination " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_EMS_OPTIONS}, |
7875 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,0}, "SMSTEMPLATE destination " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_SMSTEMPLATE_OPTIONS}, | 8050 | {"--sendsms", 2,30, SendSaveDisplaySMS, {H_SMS,0}, "SMSTEMPLATE destination " SMS_SEND_OPTIONS SMS_COMMON_OPTIONS SMS_SMSTEMPLATE_OPTIONS}, |
7876 | 8051 | ||
7877 | {"--displaysms", 2,30, SendSaveDisplaySMS, {H_SMS,0}, "... (options like in sendsms)"}, | 8052 | {"--displaysms", 2,30, SendSaveDisplaySMS, {H_SMS,0}, "... (options like in sendsms)"}, |
7878 | 8053 | ||
7879 | {"--addsmsfolder", 1, 1, AddSMSFolder, {H_SMS,0}, "name"}, | 8054 | {"--addsmsfolder", 1, 1, AddSMSFolder, {H_SMS,0}, "name"}, |
7880 | #ifdef HAVE_MYSQL_MYSQL_H | 8055 | #ifdef HAVE_MYSQL_MYSQL_H |
7881 | {"--smsd", 2, 2, SMSDaemon, {H_SMS,H_Other,0}, "MYSQL configfile"}, | 8056 | {"--smsd", 2, 2, SMSDaemon, {H_SMS,H_Other,0}, "MYSQL configfile"}, |
7882 | #endif | 8057 | #endif |
7883 | {"--smsd", 2, 2, SMSDaemon, {H_SMS,H_Other,0}, "FILES configfile"}, | 8058 | {"--smsd", 2, 2, SMSDaemon, {H_SMS,H_Other,0}, "FILES configfile"}, |
7884 | {"--sendsmsdsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Other,0}, "TEXT|WAPSETTINGS|... destination FILES|MYSQL configfile ... (options like in sendsms)"}, | 8059 | {"--sendsmsdsms", 2,30, SendSaveDisplaySMS, {H_SMS,H_Other,0}, "TEXT|WAPSETTINGS|... destination FILES|MYSQL configfile ... (options like in sendsms)"}, |
7885 | {"--getringtone", 1, 2, GetRingtone, {H_Ringtone,0}, "location [file]"}, | 8060 | {"--getringtone", 1, 2, GetRingtone, {H_Ringtone,0}, "location [file]"}, |
7886 | {"--getphoneringtone", 1, 2, GetRingtone, {H_Ringtone,0}, "location [file]"}, | 8061 | {"--getphoneringtone", 1, 2, GetRingtone, {H_Ringtone,0}, "location [file]"}, |
7887 | {"--getringtoneslist", 0, 0, GetRingtonesList, {H_Ringtone,0}, ""}, | 8062 | {"--getringtoneslist", 0, 0, GetRingtonesList, {H_Ringtone,0}, ""}, |
7888 | {"--setringtone", 1, 6, SetRingtone, {H_Ringtone,0}, "file [-location location][-scale][-name name]"}, | 8063 | {"--setringtone", 1, 6, SetRingtone, {H_Ringtone,0}, "file [-location location][-scale][-name name]"}, |
7889 | {"--nokiacomposer", 1, 1, NokiaComposer, {H_Ringtone,H_Nokia,0}, "file"}, | 8064 | {"--nokiacomposer", 1, 1, NokiaComposer, {H_Ringtone,H_Nokia,0}, "file"}, |
7890 | {"--copyringtone", 2, 3, CopyRingtone, {H_Ringtone,0}, "source destination [RTTL|BINARY]"}, | 8065 | {"--copyringtone", 2, 3, CopyRingtone, {H_Ringtone,0}, "source destination [RTTL|BINARY]"}, |
7891 | {"--getussd", 1, 1, GetUSSD, {H_Call,0}, "code"}, | 8066 | {"--getussd", 1, 1, GetUSSD, {H_Call,0}, "code"}, |
7892 | {"--dialvoice", 1, 2, DialVoice, {H_Call,0}, "number [show|hide]"}, | 8067 | {"--dialvoice", 1, 2, DialVoice, {H_Call,0}, "number [show|hide]"}, |
7893 | {"--getspeeddial", 1, 2, GetSpeedDial, {H_Call,H_Memory,0}, "start [stop]"}, | 8068 | {"--getspeeddial", 1, 2, GetSpeedDial, {H_Call,H_Memory,0}, "start [stop]"}, |
7894 | {"--cancelcall", 0, 1, CancelCall, {H_Call,0}, "[ID]"}, | 8069 | {"--cancelcall", 0, 1, CancelCall, {H_Call,0}, "[ID]"}, |
7895 | {"--answercall", 0, 1, AnswerCall, {H_Call,0}, "[ID]"}, | 8070 | {"--answercall", 0, 1, AnswerCall, {H_Call,0}, "[ID]"}, |
7896 | {"--unholdcall", 1, 1, UnholdCall, {H_Call,0}, "ID"}, | 8071 | {"--unholdcall", 1, 1, UnholdCall, {H_Call,0}, "ID"}, |
7897 | {"--holdcall", 1, 1, HoldCall, {H_Call,0}, "ID"}, | 8072 | {"--holdcall", 1, 1, HoldCall, {H_Call,0}, "ID"}, |
7898 | {"--conferencecall", 1, 1, ConferenceCall, {H_Call,0}, "ID"}, | 8073 | {"--conferencecall", 1, 1, ConferenceCall, {H_Call,0}, "ID"}, |
7899 | {"--splitcall", 1, 1, SplitCall, {H_Call,0}, "ID"}, | 8074 | {"--splitcall", 1, 1, SplitCall, {H_Call,0}, "ID"}, |
7900 | {"--switchcall", 0, 1, SwitchCall, {H_Call,0}, "[ID]"}, | 8075 | {"--switchcall", 0, 1, SwitchCall, {H_Call,0}, "[ID]"}, |
7901 | {"--transfercall", 0, 1, TransferCall, {H_Call,0}, "[ID]"}, | 8076 | {"--transfercall", 0, 1, TransferCall, {H_Call,0}, "[ID]"}, |
7902 | {"--divert", 3, 5, CallDivert, {H_Call,0}, "get|set all|busy|noans|outofreach all|voice|fax|data [number timeout]"}, | 8077 | {"--divert", 3, 5, CallDivert, {H_Call,0}, "get|set all|busy|noans|outofreach all|voice|fax|data [number timeout]"}, |
7903 | {"--canceldiverts", 0, 0, CancelAllDiverts, {H_Call,0}, ""}, | 8078 | {"--canceldiverts", 0, 0, CancelAllDiverts, {H_Call,0}, ""}, |
7904 | {"--senddtmf", 1, 1, SendDTMF, {H_Call,0}, "sequence"}, | 8079 | {"--senddtmf", 1, 1, SendDTMF, {H_Call,0}, "sequence"}, |
7905 | {"--getcalendarsettings", 0, 0, GetCalendarSettings, {H_Calendar,H_Settings,0},""}, | 8080 | {"--getcalendarsettings", 0, 0, GetCalendarSettings, {H_Calendar,H_Settings,0},""}, |
7906 | {"--getalltodo", 0, 0, GetAllToDo, {H_ToDo,0}, ""}, | 8081 | {"--getalltodo", 0, 0, GetAllToDo, {H_ToDo,0}, ""}, |
7907 | {"--listtodocategory", 1, 1, ListToDoCategory, {H_ToDo, H_Category,0}, "text|number"}, | 8082 | {"--listtodocategory", 1, 1, ListToDoCategory, {H_ToDo, H_Category,0}, "text|number"}, |
7908 | {"--gettodo", 1, 2, GetToDo, {H_ToDo,0}, "start [stop]"}, | 8083 | {"--gettodo", 1, 2, GetToDo, {H_ToDo,0}, "start [stop]"}, |
7909 | {"--deletetodo", 1, 2, DeleteToDo, {H_ToDo,0}, "start [stop]"}, | 8084 | {"--deletetodo", 1, 2, DeleteToDo, {H_ToDo,0}, "start [stop]"}, |
7910 | {"--getnote", 1, 2, GetNote, {H_Note,0}, "start [stop]"}, | 8085 | {"--getallnotes", 0, 0, GetAllNotes, {H_Note,0}, ""}, |
7911 | {"--deletecalendar", 1, 2, DeleteCalendar, {H_Calendar,0}, "start [stop]"}, | 8086 | {"--deletecalendar", 1, 2, DeleteCalendar, {H_Calendar,0}, "start [stop]"}, |
7912 | {"--getallcalendar", 0, 0, GetAllCalendar, {H_Calendar,0}, ""}, | 8087 | {"--getallcalendar", 0, 0, GetAllCalendar, {H_Calendar,0}, ""}, |
7913 | {"--getcalendar", 1, 2, GetCalendar, {H_Calendar,0}, "start [stop]"}, | 8088 | {"--getcalendar", 1, 2, GetCalendar, {H_Calendar,0}, "start [stop]"}, |
7914 | {"--getcategory", 2, 3, GetCategory, {H_Category,H_ToDo,H_Memory,0},"TODO|PHONEBOOK start [stop]"}, | 8089 | {"--getcategory", 2, 3, GetCategory, {H_Category,H_ToDo,H_Memory,0},"TODO|PHONEBOOK start [stop]"}, |
7915 | {"--getallcategory", 1, 1, GetAllCategories, {H_Category,H_ToDo,H_Memory,0},"TODO|PHONEBOOK"}, | 8090 | {"--getallcategory", 1, 1, GetAllCategories, {H_Category,H_ToDo,H_Memory,0},"TODO|PHONEBOOK"}, |
7916 | {"--reset", 1, 1, Reset, {H_Other,0}, "SOFT|HARD"}, | 8091 | {"--reset", 1, 1, Reset, {H_Other,0}, "SOFT|HARD"}, |
7917 | {"--getprofile", 1, 2, GetProfile, {H_Settings,0}, "start [stop]"}, | 8092 | {"--getprofile", 1, 2, GetProfile, {H_Settings,0}, "start [stop]"}, |
7918 | {"--getsecuritystatus", 0, 0, GetSecurityStatus, {H_Info,0}, ""}, | 8093 | {"--getsecuritystatus", 0, 0, GetSecurityStatus, {H_Info,0}, ""}, |
7919 | {"--entersecuritycode", 2, 2, EnterSecurityCode, {H_Other,0}, "PIN|PUK|PIN2|PUK2 code"}, | 8094 | {"--entersecuritycode", 2, 2, EnterSecurityCode, {H_Other,0}, "PIN|PUK|PIN2|PUK2 code"}, |
7920 | {"--deletewapbookmark", 1, 2, DeleteWAPBookmark, {H_WAP,0}, "start [stop]"}, | 8095 | {"--deletewapbookmark", 1, 2, DeleteWAPBookmark, {H_WAP,0}, "start [stop]"}, |
7921 | {"--getwapbookmark", 1, 2, GetWAPBookmark, {H_WAP,0}, "start [stop]"}, | 8096 | {"--getwapbookmark", 1, 2, GetWAPBookmark, {H_WAP,0}, "start [stop]"}, |
7922 | {"--getwapsettings", 1, 2, GetWAPMMSSettings, {H_WAP,0}, "start [stop]"}, | 8097 | {"--getwapsettings", 1, 2, GetWAPMMSSettings, {H_WAP,0}, "start [stop]"}, |
7923 | {"--getmmssettings", 1, 2, GetWAPMMSSettings, {H_MMS,0}, "start [stop]"}, | 8098 | {"--getmmssettings", 1, 2, GetWAPMMSSettings, {H_MMS,0}, "start [stop]"}, |
7924 | {"--getsyncmlsettings", 1, 2, GetSyncMLSettings, {H_WAP,0}, "start [stop]"}, | 8099 | {"--getsyncmlsettings", 1, 2, GetSyncMLSettings, {H_WAP,0}, "start [stop]"}, |
7925 | {"--getchatsettings", 1, 2, GetChatSettings, {H_WAP,0}, "start [stop]"}, | 8100 | {"--getchatsettings", 1, 2, GetChatSettings, {H_WAP,0}, "start [stop]"}, |
7926 | {"--savemmsfile", 3, 15,SaveMMSFile, {H_MMS,0}, "file [-subject text][-text text]"}, | 8101 | {"--savemmsfile", 3, 15,SaveMMSFile, {H_MMS,0}, "file [-subject text][-text text]"}, |
7927 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "STARTUP [file]"}, | 8102 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "STARTUP [file]"}, |
7928 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "CALLER location [file]"}, | 8103 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "CALLER location [file]"}, |
7929 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "OPERATOR [file]"}, | 8104 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "OPERATOR [file]"}, |
7930 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "PICTURE location [file]"}, | 8105 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "PICTURE location [file]"}, |
7931 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "TEXT"}, | 8106 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "TEXT"}, |
7932 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "DEALER"}, | 8107 | {"--getbitmap", 1, 3, GetBitmap, {H_Logo,0}, "DEALER"}, |
7933 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "STARTUP file|1|2|3"}, | 8108 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "STARTUP file|1|2|3"}, |
7934 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "COLOURSTARTUP [fileID]"}, | 8109 | {"--setbitmap", 1, 4, SetBitmap, {H_Logo,0}, "COLOURSTARTUP [fileID]"}, |
@@ -7955,50 +8130,52 @@ static GSM_Parameters Parameters[] = { | |||
7955 | {"--addnew", 1, 1, AddNew, {H_Backup,H_Memory,H_Calendar,H_ToDo,H_Category,H_Ringtone,H_WAP,H_FM,0}, "file"}, | 8130 | {"--addnew", 1, 1, AddNew, {H_Backup,H_Memory,H_Calendar,H_ToDo,H_Category,H_Ringtone,H_WAP,H_FM,0}, "file"}, |
7956 | {"--restoresms", 1, 1, RestoreSMS, {H_Backup,H_SMS,0}, "file"}, | 8131 | {"--restoresms", 1, 1, RestoreSMS, {H_Backup,H_SMS,0}, "file"}, |
7957 | {"--addsms", 2, 2, AddSMS, {H_Backup,H_SMS,0}, "folder file"}, | 8132 | {"--addsms", 2, 2, AddSMS, {H_Backup,H_SMS,0}, "folder file"}, |
7958 | #endif | 8133 | #endif |
7959 | {"--clearall", 0, 0, ClearAll, {H_Memory,H_Calendar,H_ToDo,H_Category,H_Ringtone,H_WAP,H_FM,0},""}, | 8134 | {"--clearall", 0, 0, ClearAll, {H_Memory,H_Calendar,H_ToDo,H_Category,H_Ringtone,H_WAP,H_FM,0},""}, |
7960 | {"--networkinfo", 0, 0, NetworkInfo, {H_Network,0}, ""}, | 8135 | {"--networkinfo", 0, 0, NetworkInfo, {H_Network,0}, ""}, |
7961 | #ifdef GSM_ENABLE_AT | 8136 | #ifdef GSM_ENABLE_AT |
7962 | {"--siemenssatnetmon", 0, 0, ATSIEMENSSATNetmon, {H_Siemens,H_Network,0},""}, | 8137 | {"--siemenssatnetmon", 0, 0, ATSIEMENSSATNetmon, {H_Siemens,H_Network,0},""}, |
7963 | {"--siemensnetmonact", 1, 1, ATSIEMENSActivateNetmon, {H_Siemens,H_Network,0}, "netmon_type (1-full, 2-simple)"}, | 8138 | {"--siemensnetmonact", 1, 1, ATSIEMENSActivateNetmon, {H_Siemens,H_Network,0}, "netmon_type (1-full, 2-simple)"}, |
7964 | {"--siemensnetmonitor", 1, 1, ATSIEMENSNetmonitor, {H_Siemens,H_Network,0},"test"}, | 8139 | {"--siemensnetmonitor", 1, 1, ATSIEMENSNetmonitor, {H_Siemens,H_Network,0},"test"}, |
7965 | #endif | 8140 | #endif |
7966 | #ifdef GSM_ENABLE_NOKIA6110 | 8141 | #ifdef GSM_ENABLE_NOKIA6110 |
7967 | {"--nokiagetoperatorname", 0, 0, DCT3GetOperatorName, {H_Nokia,H_Network,0}, ""}, | 8142 | {"--nokiagetoperatorname", 0, 0, DCT3GetOperatorName, {H_Nokia,H_Network,0}, ""}, |
7968 | {"--nokiasetoperatorname", 0, 2, DCT3SetOperatorName, {H_Nokia,H_Network,0}, "[networkcode name]"}, | 8143 | {"--nokiasetoperatorname", 0, 2, DCT3SetOperatorName, {H_Nokia,H_Network,0}, "[networkcode name]"}, |
7969 | {"--nokiadisplayoutput", 0, 0, DCT3DisplayOutput, {H_Nokia,0}, ""}, | 8144 | {"--nokiadisplayoutput", 0, 0, DCT3DisplayOutput, {H_Nokia,0}, ""}, |
7970 | #endif | 8145 | #endif |
7971 | #ifdef GSM_ENABLE_NOKIA_DCT3 | 8146 | #ifdef GSM_ENABLE_NOKIA_DCT3 |
7972 | {"--nokianetmonitor", 1, 1, DCT3netmonitor, {H_Nokia,H_Network,0}, "test"}, | 8147 | {"--nokianetmonitor", 1, 1, DCT3netmonitor, {H_Nokia,H_Network,0}, "test"}, |
7973 | {"--nokianetmonitor36", 0, 0, DCT3ResetTest36, {H_Nokia,0}, ""}, | 8148 | {"--nokianetmonitor36", 0, 0, DCT3ResetTest36, {H_Nokia,0}, ""}, |
7974 | {"--nokiadebug", 1, 2, DCT3SetDebug, {H_Nokia,H_Network,0}, "filename [[v11-22][,v33-44]...]"}, | 8149 | {"--nokiadebug", 1, 2, DCT3SetDebug, {H_Nokia,H_Network,0}, "filename [[v11-22][,v33-44]...]"}, |
7975 | #endif | 8150 | #endif |
7976 | #ifdef GSM_ENABLE_NOKIA_DCT4 | 8151 | #ifdef GSM_ENABLE_NOKIA_DCT4 |
7977 | {"--nokiasetvibralevel", 1, 1, DCT4SetVibraLevel, {H_Nokia,H_Other,0}, "level"}, | 8152 | {"--nokiasetvibralevel", 1, 1, DCT4SetVibraLevel, {H_Nokia,H_Other,0}, "level"}, |
7978 | {"--nokiagetvoicerecord", 1, 1, DCT4GetVoiceRecord, {H_Nokia,H_Other,0}, "location"}, | 8153 | {"--nokiagetvoicerecord", 1, 1, DCT4GetVoiceRecord, {H_Nokia,H_Other,0}, "location"}, |
8154 | #ifdef GSM_ENABLE_NOKIA6510 | ||
7979 | {"--nokiasetlights", 2, 2, DCT4SetLight, {H_Nokia,H_Tests,0}, "keypad|display|torch on|off"}, | 8155 | {"--nokiasetlights", 2, 2, DCT4SetLight, {H_Nokia,H_Tests,0}, "keypad|display|torch on|off"}, |
7980 | {"--nokiatuneradio", 0, 0, DCT4TuneRadio, {H_Nokia,H_FM,0}, ""}, | 8156 | {"--nokiatuneradio", 0, 0, DCT4TuneRadio, {H_Nokia,H_FM,0}, ""}, |
8157 | #endif | ||
7981 | {"--nokiamakecamerashoot", 0, 0, DCT4MakeCameraShoot, {H_Nokia,H_Other,0}, ""}, | 8158 | {"--nokiamakecamerashoot", 0, 0, DCT4MakeCameraShoot, {H_Nokia,H_Other,0}, ""}, |
7982 | {"--nokiagetscreendump", 0, 0, DCT4GetScreenDump, {H_Nokia,H_Other,0}, ""}, | 8159 | {"--nokiagetscreendump", 0, 0, DCT4GetScreenDump, {H_Nokia,H_Other,0}, ""}, |
7983 | #endif | 8160 | #endif |
7984 | #if defined(GSM_ENABLE_NOKIA_DCT3) || defined(GSM_ENABLE_NOKIA_DCT4) | 8161 | #if defined(GSM_ENABLE_NOKIA_DCT3) || defined(GSM_ENABLE_NOKIA_DCT4) |
7985 | {"--nokiavibratest", 0, 0, NokiaVibraTest, {H_Nokia,H_Tests,0}, ""}, | 8162 | {"--nokiavibratest", 0, 0, NokiaVibraTest, {H_Nokia,H_Tests,0}, ""}, |
7986 | {"--nokiagett9", 0, 0, NokiaGetT9, {H_Nokia,H_SMS,0}, ""}, | 8163 | {"--nokiagett9", 0, 0, NokiaGetT9, {H_Nokia,H_SMS,0}, ""}, |
7987 | {"--nokiadisplaytest", 1, 1, NokiaDisplayTest, {H_Nokia,H_Tests,0}, "number"}, | 8164 | {"--nokiadisplaytest", 1, 1, NokiaDisplayTest, {H_Nokia,H_Tests,0}, "number"}, |
7988 | {"--nokiagetadc", 0, 0, NokiaGetADC, {H_Nokia,H_Tests,0}, ""}, | 8165 | {"--nokiagetadc", 0, 0, NokiaGetADC, {H_Nokia,H_Tests,0}, ""}, |
7989 | {"--nokiasecuritycode", 0, 0, NokiaSecurityCode, {H_Nokia,H_Info,0}, ""}, | 8166 | {"--nokiasecuritycode", 0, 0, NokiaSecurityCode, {H_Nokia,H_Info,0}, ""}, |
7990 | {"--nokiaselftests", 0, 0, NokiaSelfTests, {H_Nokia,H_Tests,0}, ""}, | 8167 | {"--nokiaselftests", 0, 0, NokiaSelfTests, {H_Nokia,H_Tests,0}, ""}, |
7991 | {"--nokiasetphonemenus", 0, 0, NokiaSetPhoneMenus, {H_Nokia,H_Other,0}, ""}, | 8168 | {"--nokiasetphonemenus", 0, 0, NokiaSetPhoneMenus, {H_Nokia,H_Other,0}, ""}, |
7992 | #endif | 8169 | #endif |
7993 | #ifdef DEBUG | 8170 | #ifdef DEBUG |
7994 | {"--decodesniff", 2, 3, decodesniff, {H_Decode,0}, "MBUS2|IRDA file [phonemodel]"}, | 8171 | {"--decodesniff", 2, 3, decodesniff, {H_Decode,0}, "MBUS2|IRDA file [phonemodel]"}, |
7995 | {"--decodebinarydump", 1, 2, decodebinarydump, {H_Decode,0}, "file [phonemodel]"}, | 8172 | {"--decodebinarydump", 1, 2, decodebinarydump, {H_Decode,0}, "file [phonemodel]"}, |
7996 | {"--makeconverttable", 1, 1, MakeConvertTable, {H_Decode,0}, "file"}, | 8173 | {"--makeconverttable", 1, 1, MakeConvertTable, {H_Decode,0}, "file"}, |
7997 | #endif | 8174 | #endif |
7998 | {"", 0, 0, NULL } | 8175 | {"", 0, 0, NULL } |
7999 | }; | 8176 | }; |
8000 | 8177 | ||
8001 | static HelpCategoryDescriptions HelpDescriptions[] = { | 8178 | static HelpCategoryDescriptions HelpDescriptions[] = { |
8002 | {H_Call, "call", "Calls",}, | 8179 | {H_Call, "call", "Calls",}, |
8003 | {H_SMS, "sms", "SMS and EMS"}, | 8180 | {H_SMS, "sms", "SMS and EMS"}, |
8004 | {H_Memory, "memory","Memory (phonebooks and calls)"}, | 8181 | {H_Memory, "memory","Memory (phonebooks and calls)"}, |
@@ -8025,53 +8202,53 @@ static HelpCategoryDescriptions HelpDescriptions[] = { | |||
8025 | {H_Tests, "tests","Phone tests"}, | 8202 | {H_Tests, "tests","Phone tests"}, |
8026 | {H_FM, "fm", "FM radio"}, | 8203 | {H_FM, "fm", "FM radio"}, |
8027 | {H_Info, "info", "Phone information"}, | 8204 | {H_Info, "info", "Phone information"}, |
8028 | {H_Settings, "settings","Phone settings"}, | 8205 | {H_Settings, "settings","Phone settings"}, |
8029 | #ifdef DEBUG | 8206 | #ifdef DEBUG |
8030 | {H_Decode, "decode","Dumps decoding"}, | 8207 | {H_Decode, "decode","Dumps decoding"}, |
8031 | #endif | 8208 | #endif |
8032 | {H_Other, "other","Functions that don't fit elsewhere"}, | 8209 | {H_Other, "other","Functions that don't fit elsewhere"}, |
8033 | {0, NULL, NULL} | 8210 | {0, NULL, NULL} |
8034 | }; | 8211 | }; |
8035 | 8212 | ||
8036 | 8213 | ||
8037 | void HelpHeader(void) | 8214 | void HelpHeader(void) |
8038 | { | 8215 | { |
8039 | printmsg("[Gammu version %s built %s %s]\n\n",VERSION,__TIME__,__DATE__); | 8216 | printmsg("[Gammu version %s built %s %s]\n\n",VERSION,__TIME__,__DATE__); |
8040 | } | 8217 | } |
8041 | 8218 | ||
8042 | static void HelpGeneral(void) | 8219 | static void HelpGeneral(void) |
8043 | { | 8220 | { |
8044 | inti=0; | 8221 | inti=0; |
8045 | 8222 | ||
8046 | HelpHeader(); | 8223 | HelpHeader(); |
8047 | 8224 | ||
8048 | printmsg("Usage: gammu [confign] [nothing|text|textall|binary|errors] [options]\n\n"); | 8225 | printmsg("Usage: gammu [confign] [nothing|text|textall|binary|errors] [options]\n\n"); |
8049 | printmsg("First parameter optionally specifies which config section to use (by default are probed all).\n"); | 8226 | printmsg("First parameter optionally specifies which config section to use (all are probed by default).\n"); |
8050 | printmsg("Second parameter optionally controls debug level, next specify actions.\n\n"); | 8227 | printmsg("Second parameter optionally controls debug level, next one specifies actions.\n\n"); |
8051 | 8228 | ||
8052 | /* We might want to put here some most used commands */ | 8229 | /* We might want to put here some most used commands */ |
8053 | printmsg("For more details call help on specific topic (gammu --help topic), topics are:\n\n"); | 8230 | printmsg("For more details, call help on specific topic (gammu --help topic). Topics are:\n\n"); |
8054 | 8231 | ||
8055 | while (HelpDescriptions[i].category != 0) { | 8232 | while (HelpDescriptions[i].category != 0) { |
8056 | printf("%11s - %s\n", HelpDescriptions[i].option, HelpDescriptions[i].description); | 8233 | printf("%11s - %s\n", HelpDescriptions[i].option, HelpDescriptions[i].description); |
8057 | i++; | 8234 | i++; |
8058 | } | 8235 | } |
8059 | printf("\n"); | 8236 | printf("\n"); |
8060 | } | 8237 | } |
8061 | 8238 | ||
8062 | static void HelpSplit(int cols, int len, unsigned char *buff) | 8239 | static void HelpSplit(int cols, int len, unsigned char *buff) |
8063 | { | 8240 | { |
8064 | int l, len2, pos, split; | 8241 | int l, len2, pos, split; |
8065 | bool in_opt,first=true; | 8242 | bool in_opt,first=true; |
8066 | char *remain, spaces[50], buffer[500]; | 8243 | char *remain, spaces[50], buffer[500]; |
8067 | 8244 | ||
8068 | if (cols == 0) { | 8245 | if (cols == 0) { |
8069 | printf(" %s\n", buff); | 8246 | printf(" %s\n", buff); |
8070 | } else { | 8247 | } else { |
8071 | printf(" "); | 8248 | printf(" "); |
8072 | spaces[0] = 0; | 8249 | spaces[0] = 0; |
8073 | len2 = strlen(buff); | 8250 | len2 = strlen(buff); |
8074 | if (len + len2 < cols) { | 8251 | if (len + len2 < cols) { |
8075 | printf("%s\n", buff); | 8252 | printf("%s\n", buff); |
8076 | } else { | 8253 | } else { |
8077 | for(l = 0; l < len; l++) strcat(spaces, " "); | 8254 | for(l = 0; l < len; l++) strcat(spaces, " "); |
@@ -8113,49 +8290,49 @@ static void HelpSplit(int cols, int len, unsigned char *buff) | |||
8113 | } | 8290 | } |
8114 | 8291 | ||
8115 | static void Help(int argc, char *argv[]) | 8292 | static void Help(int argc, char *argv[]) |
8116 | { | 8293 | { |
8117 | int i = 0, j = 0, k, cols; | 8294 | int i = 0, j = 0, k, cols; |
8118 | bool disp; | 8295 | bool disp; |
8119 | #ifdef TIOCGWINSZ | 8296 | #ifdef TIOCGWINSZ |
8120 | struct winsize w; | 8297 | struct winsize w; |
8121 | #endif | 8298 | #endif |
8122 | #if defined(WIN32) || defined(DJGPP) | 8299 | #if defined(WIN32) || defined(DJGPP) |
8123 | #else | 8300 | #else |
8124 | char *columns; | 8301 | char *columns; |
8125 | #endif | 8302 | #endif |
8126 | 8303 | ||
8127 | /* Just --help */ | 8304 | /* Just --help */ |
8128 | if (argc == 2) { | 8305 | if (argc == 2) { |
8129 | HelpGeneral(); | 8306 | HelpGeneral(); |
8130 | return; | 8307 | return; |
8131 | } | 8308 | } |
8132 | 8309 | ||
8133 | if (!strcmp(argv[2],"all")) { | 8310 | if (!strcmp(argv[2],"all")) { |
8134 | HelpHeader(); | 8311 | HelpHeader(); |
8135 | } else { | 8312 | } else { |
8136 | while (HelpDescriptions[i].category != 0) { | 8313 | while (HelpDescriptions[i].category != 0) { |
8137 | if (strcmp(argv[2], HelpDescriptions[i].option) == 0) break; | 8314 | if (mystrncasecmp(argv[2], HelpDescriptions[i].option,strlen(argv[2]))) break; |
8138 | i++; | 8315 | i++; |
8139 | } | 8316 | } |
8140 | if (HelpDescriptions[i].category == 0) { | 8317 | if (HelpDescriptions[i].category == 0) { |
8141 | HelpGeneral(); | 8318 | HelpGeneral(); |
8142 | printmsg("Unknown help topic specified!\n"); | 8319 | printmsg("Unknown help topic specified!\n"); |
8143 | return; | 8320 | return; |
8144 | } | 8321 | } |
8145 | HelpHeader(); | 8322 | HelpHeader(); |
8146 | printmsg("Gammu parameters, topic: %s\n\n", HelpDescriptions[i].description); | 8323 | printmsg("Gammu parameters, topic: %s\n\n", HelpDescriptions[i].description); |
8147 | } | 8324 | } |
8148 | 8325 | ||
8149 | #if defined(WIN32) || defined(DJGPP) | 8326 | #if defined(WIN32) || defined(DJGPP) |
8150 | cols = 80; | 8327 | cols = 80; |
8151 | #else | 8328 | #else |
8152 | cols = 0; | 8329 | cols = 0; |
8153 | /* If stdout is a tty, we will wrap to columns it has */ | 8330 | /* If stdout is a tty, we will wrap to columns it has */ |
8154 | if (isatty(1)) { | 8331 | if (isatty(1)) { |
8155 | #ifdef TIOCGWINSZ | 8332 | #ifdef TIOCGWINSZ |
8156 | if (ioctl(2, TIOCGWINSZ, &w) == 0) { | 8333 | if (ioctl(2, TIOCGWINSZ, &w) == 0) { |
8157 | if (w.ws_col > 0) cols = w.ws_col; | 8334 | if (w.ws_col > 0) cols = w.ws_col; |
8158 | } | 8335 | } |
8159 | #endif | 8336 | #endif |
8160 | if (cols == 0) { | 8337 | if (cols == 0) { |
8161 | columns = getenv("COLUMNS"); | 8338 | columns = getenv("COLUMNS"); |
@@ -8185,248 +8362,173 @@ static void Help(int argc, char *argv[]) | |||
8185 | disp = true; | 8362 | disp = true; |
8186 | } | 8363 | } |
8187 | } | 8364 | } |
8188 | } | 8365 | } |
8189 | } else { | 8366 | } else { |
8190 | while (Parameters[j].help_cat[k] != 0) { | 8367 | while (Parameters[j].help_cat[k] != 0) { |
8191 | if (Parameters[j].help_cat[k] == HelpDescriptions[i].category) { | 8368 | if (Parameters[j].help_cat[k] == HelpDescriptions[i].category) { |
8192 | disp = true; | 8369 | disp = true; |
8193 | break; | 8370 | break; |
8194 | } | 8371 | } |
8195 | k++; | 8372 | k++; |
8196 | } | 8373 | } |
8197 | } | 8374 | } |
8198 | if (disp) { | 8375 | if (disp) { |
8199 | printf("%s", Parameters[j].parameter); | 8376 | printf("%s", Parameters[j].parameter); |
8200 | if (Parameters[j].help[0] == 0) { | 8377 | if (Parameters[j].help[0] == 0) { |
8201 | printf("\n"); | 8378 | printf("\n"); |
8202 | } else { | 8379 | } else { |
8203 | HelpSplit(cols - 1, strlen(Parameters[j].parameter) + 1, Parameters[j].help); | 8380 | HelpSplit(cols - 1, strlen(Parameters[j].parameter) + 1, Parameters[j].help); |
8204 | } | 8381 | } |
8205 | } | 8382 | } |
8206 | j++; | 8383 | j++; |
8207 | } | 8384 | } |
8208 | } | 8385 | } |
8209 | #if 0 | 8386 | |
8210 | #endif // 0 | ||
8211 | int main(int argc, char *argv[]) | 8387 | int main(int argc, char *argv[]) |
8212 | { | 8388 | { |
8213 | 8389 | int z = 0,start=0,i; | |
8214 | //fprintf(stderr,"HIIIIIIIIIIIII \n"); | 8390 | intonly_config = -1; |
8215 | //#if 0 | 8391 | #if !defined(WIN32) && !defined(DJGPP) && defined(LOCALE_PATH) |
8216 | static int z ,start,i; | 8392 | char*locale, locale_file[201]; |
8217 | static intonly_config ; | ||
8218 | #if !defined(WIN32) && defined(LOCALE_PATH) | ||
8219 | static char*locale, locale_file[201]; | ||
8220 | #endif | 8393 | #endif |
8221 | static char*cp; | 8394 | char*cp; |
8222 | static boolcount_failed; | 8395 | boolcount_failed = false; |
8223 | z = 0; | 8396 | |
8224 | start=0;only_config = -1;count_failed = false; | ||
8225 | s.opened = false; | 8397 | s.opened = false; |
8226 | s.msg = NULL; | 8398 | s.msg = NULL; |
8227 | s.ConfigNum = 0; | 8399 | s.ConfigNum = 0; |
8228 | 8400 | ||
8229 | setlocale(LC_ALL, ""); | 8401 | setlocale(LC_ALL, ""); |
8230 | #ifdef DEBUG | 8402 | #ifdef DEBUG |
8231 | di.dl = DL_TEXTALL; | 8403 | di.dl = DL_TEXTALL; |
8232 | di.df = stdout; | 8404 | di.df = stdout; |
8233 | #endif | 8405 | #endif |
8234 | //#if 0 | 8406 | |
8235 | /* Any parameters? */ | 8407 | /* Any parameters? */ |
8236 | if (argc == 1) { | 8408 | if (argc == 1) { |
8237 | HelpGeneral(); | 8409 | HelpGeneral(); |
8238 | printmsg("Too few parameters!\n"); | 8410 | printmsg("Too few parameters!\n"); |
8239 | exit(1); | 8411 | exit(1); |
8240 | } | 8412 | } |
8241 | 8413 | ||
8242 | /* Help? */ | 8414 | /* Help? */ |
8243 | if (strncmp(argv[1 + start], "--help", 6) == 0) { | 8415 | if (strncmp(argv[1 + start], "--help", 6) == 0) { |
8244 | Help(argc - start, argv + start); | 8416 | Help(argc - start, argv + start); |
8245 | exit(1); | 8417 | exit(1); |
8246 | } | 8418 | } |
8247 | 8419 | ||
8248 | /* Is first parameter numeric? If so treat it as config that should be loaded. */ | 8420 | /* Is first parameter numeric? If so treat it as config that should be loaded. */ |
8249 | //if (isdigit(argv[1][0])) { | 8421 | if (isdigit(argv[1][0])) { |
8250 | //only_config = atoi(argv[1]); | 8422 | only_config = atoi(argv[1]); |
8251 | //if (only_config >= 0) start++; else only_config = -1; | 8423 | if (only_config >= 0) start++; else only_config = -1; |
8252 | //} | 8424 | } |
8253 | only_config = 0;; | ||
8254 | #if 0 | ||
8255 | GSM_ReadConfig(NULL, &s.Config[0], 0); | ||
8256 | s.ConfigNum = 1; | ||
8257 | GSM_Config *con = &s.Config[0]; | ||
8258 | |||
8259 | char* tempC; | ||
8260 | tempC = argv[argc-1]+2; | ||
8261 | if ( *tempC != 0 ) { | ||
8262 | fprintf(stderr,"Using model %s \n",tempC); | ||
8263 | strcpy(con->Model,tempC ); | ||
8264 | } | ||
8265 | tempC = argv[argc-2]+2; | ||
8266 | if ( *tempC != 0 ) { | ||
8267 | fprintf(stderr,"Using device %s \n",tempC); | ||
8268 | con->Device = strdup(tempC); | ||
8269 | con->DefaultDevice = false; | ||
8270 | } | ||
8271 | tempC = argv[argc-3]+2; | ||
8272 | if ( *tempC != 0 ) { | ||
8273 | fprintf(stderr,"Using connection %s \n",tempC); | ||
8274 | con->Connection = strdup(tempC); | ||
8275 | con->DefaultConnection = false; | ||
8276 | } | ||
8277 | argc = argc-3; | ||
8278 | //#if 0 | ||
8279 | if ( ! mConnection.isEmpty() ) { | ||
8280 | cfg->Connection = strdup(mConnection.latin1()); | ||
8281 | cfg->DefaultConnection = false; | ||
8282 | qDebug("Connection set %s ", cfg->Connection ); | ||
8283 | |||
8284 | } | ||
8285 | if ( ! mDevice.isEmpty() ) { | ||
8286 | cfg->Device = strdup(mDevice.latin1()); | ||
8287 | cfg->DefaultDevice = false; | ||
8288 | qDebug("Device set %s ", cfg->Device); | ||
8289 | |||
8290 | } | ||
8291 | if ( ! mModel.isEmpty() ) { | ||
8292 | strcpy(cfg->Model,mModel.latin1() ); | ||
8293 | cfg->DefaultModel = false; | ||
8294 | qDebug("Model set %s ",cfg->Model ); | ||
8295 | } | ||
8296 | |||
8297 | #endif | ||
8298 | 8425 | ||
8426 | cfg = GSM_FindGammuRC(); | ||
8427 | if (cfg == NULL) printmsg("Warning: No configuration file found!\n"); | ||
8299 | 8428 | ||
8300 | cfg=GSM_FindGammuRC(); | ||
8301 | for (i = 0; i <= MAX_CONFIG_NUM; i++) { | 8429 | for (i = 0; i <= MAX_CONFIG_NUM; i++) { |
8302 | if (cfg!=NULL) { | 8430 | if (cfg!=NULL) { |
8303 | cp = INI_GetValue(cfg, "gammu", "gammucoding", false); | 8431 | cp = INI_GetValue(cfg, "gammu", "gammucoding", false); |
8304 | if (cp) di.coding = cp; | 8432 | if (cp) di.coding = cp; |
8305 | 8433 | ||
8306 | s.Config[i].Localize = INI_GetValue(cfg, "gammu", "gammuloc", false); | 8434 | s.Config[i].Localize = INI_GetValue(cfg, "gammu", "gammuloc", false); |
8307 | if (s.Config[i].Localize) { | 8435 | if (s.Config[i].Localize) { |
8308 | s.msg=INI_ReadFile(s.Config[i].Localize, true); | 8436 | s.msg=INI_ReadFile(s.Config[i].Localize, true); |
8309 | } else { | 8437 | } else { |
8310 | #if !defined(WIN32) && defined(LOCALE_PATH) | 8438 | #if !defined(WIN32) && !defined(DJGPP) && defined(LOCALE_PATH) |
8311 | locale = setlocale(LC_MESSAGES, NULL); | 8439 | locale = setlocale(LC_MESSAGES, NULL); |
8312 | if (locale != NULL) { | 8440 | if (locale != NULL) { |
8313 | snprintf(locale_file, 200, "%s/gammu_%c%c.txt", | 8441 | snprintf(locale_file, 200, "%s/gammu_%c%c.txt", |
8314 | LOCALE_PATH, | 8442 | LOCALE_PATH, |
8315 | tolower(locale[0]), | 8443 | tolower(locale[0]), |
8316 | tolower(locale[1])); | 8444 | tolower(locale[1])); |
8317 | s.msg = INI_ReadFile(locale_file, true); | 8445 | s.msg = INI_ReadFile(locale_file, true); |
8318 | } | 8446 | } |
8319 | #endif | 8447 | #endif |
8320 | } | 8448 | } |
8321 | } | 8449 | } |
8322 | 8450 | ||
8323 | /* Wanted user specific configuration? */ | 8451 | /* Wanted user specific configuration? */ |
8324 | |||
8325 | if (only_config != -1) { | 8452 | if (only_config != -1) { |
8326 | /* Here we get only in first for loop */ | 8453 | /* Here we get only in first for loop */ |
8327 | if (!GSM_ReadConfig(cfg, &s.Config[0], only_config)) break; | 8454 | if (!GSM_ReadConfig(cfg, &s.Config[0], only_config)) break; |
8328 | } else { | 8455 | } else { |
8329 | if (!GSM_ReadConfig(cfg, &s.Config[i], i) && i != 0) break; | 8456 | if (!GSM_ReadConfig(cfg, &s.Config[i], i) && i != 0) break; |
8330 | } | 8457 | } |
8331 | s.ConfigNum++; | 8458 | s.ConfigNum++; |
8332 | 8459 | ||
8333 | /* We want to use only one file descriptor for global and state machine debug output */ | 8460 | /* We want to use only one file descriptor for global and state machine debug output */ |
8334 | s.Config[i].UseGlobalDebugFile = true; | 8461 | s.Config[i].UseGlobalDebugFile = true; |
8335 | 8462 | ||
8336 | /* It makes no sense to open several debug logs... */ | 8463 | /* It makes no sense to open several debug logs... */ |
8337 | if (i != 0) { | 8464 | if (i != 0) { |
8338 | strcpy(s.Config[i].DebugLevel, s.Config[0].DebugLevel); | 8465 | strcpy(s.Config[i].DebugLevel, s.Config[0].DebugLevel); |
8339 | free(s.Config[i].DebugFile); | 8466 | free(s.Config[i].DebugFile); |
8340 | s.Config[i].DebugFile = strdup(s.Config[0].DebugFile); | 8467 | s.Config[i].DebugFile = strdup(s.Config[0].DebugFile); |
8341 | } else { | 8468 | } else { |
8342 | /* Just for first config */ | 8469 | /* Just for first config */ |
8343 | /* When user gave debug level on command line */ | 8470 | /* When user gave debug level on command line */ |
8344 | if (argc > 1 + start && GSM_SetDebugLevel(argv[1 + start], &di)) { | 8471 | if (argc > 1 + start && GSM_SetDebugLevel(argv[1 + start], &di)) { |
8345 | /* Debug level from command line will be used with phone too */ | 8472 | /* Debug level from command line will be used with phone too */ |
8346 | strcpy(s.Config[i].DebugLevel,argv[1 + start]); | 8473 | strcpy(s.Config[i].DebugLevel,argv[1 + start]); |
8347 | start++; | 8474 | start++; |
8348 | } else { | 8475 | } else { |
8349 | /* Try to set debug level from config file */ | 8476 | /* Try to set debug level from config file */ |
8350 | GSM_SetDebugLevel(s.Config[i].DebugLevel, &di); | 8477 | GSM_SetDebugLevel(s.Config[i].DebugLevel, &di); |
8351 | } | 8478 | } |
8352 | /* If user gave debug file in gammurc, we will use it */ | 8479 | /* If user gave debug file in gammurc, we will use it */ |
8353 | error=GSM_SetDebugFile(s.Config[i].DebugFile, &di); | 8480 | error=GSM_SetDebugFile(s.Config[i].DebugFile, &di); |
8354 | Print_Error(error); | 8481 | Print_Error(error); |
8355 | } | 8482 | } |
8356 | 8483 | ||
8357 | /* We wanted to read just user specified configuration. */ | 8484 | /* We wanted to read just user specified configuration. */ |
8358 | if (only_config != -1) {break;} | 8485 | if (only_config != -1) {break;} |
8359 | } | 8486 | } |
8360 | #if 0 | 8487 | |
8361 | GSM_Config *con = &s.Config[0]; | ||
8362 | |||
8363 | char* tempC; | ||
8364 | tempC = argv[argc-1]+2; | ||
8365 | if ( *tempC != 0 ) { | ||
8366 | fprintf(stderr,"Using model %s \n",tempC); | ||
8367 | strcpy(con->Model,tempC ); | ||
8368 | } | ||
8369 | tempC = argv[argc-2]+2; | ||
8370 | if ( *tempC != 0 ) { | ||
8371 | fprintf(stderr,"Using device %s \n",tempC); | ||
8372 | con->Device = strdup(tempC); | ||
8373 | con->DefaultDevice = false; | ||
8374 | } | ||
8375 | tempC = argv[argc-3]+2; | ||
8376 | if ( *tempC != 0 ) { | ||
8377 | fprintf(stderr,"Using connection %s \n",tempC); | ||
8378 | con->Connection = strdup(tempC); | ||
8379 | con->DefaultConnection = false; | ||
8380 | } | ||
8381 | #endif | ||
8382 | |||
8383 | |||
8384 | /* Do we have enough parameters? */ | 8488 | /* Do we have enough parameters? */ |
8385 | if (argc == 1 + start) { | 8489 | if (argc == 1 + start) { |
8386 | HelpGeneral(); | 8490 | HelpGeneral(); |
8387 | printmsg("Too few parameters!\n"); | 8491 | printmsg("Too few parameters!\n"); |
8388 | exit(-2); | 8492 | exit(-2); |
8389 | } | 8493 | } |
8390 | 8494 | ||
8391 | /* Check used version vs. compiled */ | 8495 | /* Check used version vs. compiled */ |
8392 | if (!mystrncasecmp(GetGammuVersion(),VERSION,0)) { | 8496 | if (!mystrncasecmp(GetGammuVersion(),VERSION,0)) { |
8393 | printmsg("ERROR: version of installed libGammu.so (%s) is different to version of Gammu (%s)\n", | 8497 | printmsg("ERROR: version of installed libGammu.so (%s) is different to version of Gammu (%s)\n", |
8394 | GetGammuVersion(),VERSION); | 8498 | GetGammuVersion(),VERSION); |
8395 | exit(-1); | 8499 | exit(-1); |
8396 | } | 8500 | } |
8397 | 8501 | ||
8398 | /* Check parameters */ | 8502 | /* Check parameters */ |
8399 | while (Parameters[z].Function != NULL) { | 8503 | while (Parameters[z].Function != NULL) { |
8400 | if (mystrncasecmp(Parameters[z].parameter,argv[1+start], 0)) { | 8504 | if (mystrncasecmp(Parameters[z].parameter,argv[1+start], 0)) { |
8401 | if (argc-2-start >= Parameters[z].min_arg && argc-2-start <= Parameters[z].max_arg) { | 8505 | if (argc-2-start >= Parameters[z].min_arg && argc-2-start <= Parameters[z].max_arg) { |
8402 | fprintf(stderr,"Executing \n"); | ||
8403 | Parameters[z].Function(argc - start, argv + start); | 8506 | Parameters[z].Function(argc - start, argv + start); |
8404 | break; | 8507 | break; |
8405 | } else { | 8508 | } else { |
8406 | count_failed = true; | 8509 | count_failed = true; |
8407 | } | 8510 | } |
8408 | } | 8511 | } |
8409 | z++; | 8512 | z++; |
8410 | } | 8513 | } |
8411 | 8514 | ||
8412 | /* Tell user when we did nothing */ | 8515 | /* Tell user when we did nothing */ |
8413 | if (Parameters[z].Function == NULL) { | 8516 | if (Parameters[z].Function == NULL) { |
8414 | HelpGeneral(); | 8517 | HelpGeneral(); |
8415 | if (count_failed) { | 8518 | if (count_failed) { |
8416 | printmsg("Bad parameter count!\n"); | 8519 | printmsg("Bad parameter count!\n"); |
8417 | } else { | 8520 | } else { |
8418 | printmsg("Bad option!\n"); | 8521 | printmsg("Bad option!\n"); |
8419 | } | 8522 | } |
8420 | } | 8523 | } |
8421 | 8524 | ||
8422 | /* Close debug output if opened */ | 8525 | /* Close debug output if opened */ |
8423 | if (di.df!=stdout) fclose(di.df); | 8526 | if (di.df!=stdout) fclose(di.df); |
8424 | //#endif // 0 | 8527 | |
8425 | fprintf(stderr,"kammu: Success. End. \n"); | ||
8426 | exit(0); | 8528 | exit(0); |
8427 | } | 8529 | } |
8428 | 8530 | ||
8429 | /* How should editor hadle tabs in this file? Add editor commands here. | 8531 | /* How should editor hadle tabs in this file? Add editor commands here. |
8430 | * vim: noexpandtab sw=8 ts=8 sts=8: | 8532 | * vim: noexpandtab sw=8 ts=8 sts=8: |
8431 | */ | 8533 | */ |
8432 | 8534 | ||