Translation update done using Pootle.
[gammu.git] / gammu / misc.c
blob594e8e61997d0f5cbbdb7cb1f2cd2373497345ba
1 #define _GNU_SOURCE /* For strcasestr */
2 #include <string.h>
4 #include "../helper/locales.h"
6 #include <stdarg.h>
7 #include <signal.h>
8 #include <stdlib.h>
9 #include <ctype.h>
10 #include <gammu.h>
11 #ifdef HAVE_UNISTD_H
12 #include <unistd.h>
13 #endif
14 #include <locale.h>
16 #include "common.h"
17 #include "misc.h"
18 #include "message.h"
20 #include "../helper/formats.h"
21 #include "../helper/printing.h"
22 #include "../helper/string.h"
23 #include "../helper/cmdline.h"
25 #ifdef GSM_ENABLE_NOKIA_DCT3
26 # include "depend/nokia/dct3.h"
27 # include "depend/nokia/dct3trac/wmx.h"
28 #endif
29 #ifdef GSM_ENABLE_NOKIA_DCT4
30 # include "depend/nokia/dct4.h"
31 #endif
33 void PrintNetworkInfo(GSM_NetworkInfo NetInfo)
35 printf(LISTFORMAT, _("Network state"));
36 switch (NetInfo.State) {
37 case GSM_HomeNetwork : printf("%s\n", _("home network")); break;
38 case GSM_RoamingNetwork : printf("%s\n", _("roaming network")); break;
39 case GSM_RequestingNetwork : printf("%s\n", _("requesting network")); break;
40 case GSM_NoNetwork : printf("%s\n", _("not logged into network")); break;
41 case GSM_RegistrationDenied : printf("%s\n", _("registration to network denied")); break;
42 case GSM_NetworkStatusUnknown : printf("%s\n", _("unknown")); break;
43 #ifndef CHECK_CASES
44 default : printf("%s\n", _("unknown"));
45 #endif
47 if (NetInfo.State == GSM_HomeNetwork || NetInfo.State == GSM_RoamingNetwork) {
48 printf(LISTFORMAT, _("Network"));
49 printf("%s (%s",
50 NetInfo.NetworkCode,
51 DecodeUnicodeConsole(GSM_GetNetworkName(NetInfo.NetworkCode)));
52 printf(", %s)",
53 DecodeUnicodeConsole(GSM_GetCountryName(NetInfo.NetworkCode)));
54 printf(", LAC %s, CID %s\n",
55 NetInfo.LAC,NetInfo.CID);
56 if (NetInfo.NetworkName[0] != 0x00 || NetInfo.NetworkName[1] != 0x00) {
57 printf(LISTFORMAT "\"%s\"\n",
58 _("Name in phone"),
59 DecodeUnicodeConsole(NetInfo.NetworkName));
62 printf(LISTFORMAT, _("Packet network state"));
63 switch (NetInfo.PacketState) {
64 case GSM_HomeNetwork : printf("%s\n", _("home network")); break;
65 case GSM_RoamingNetwork : printf("%s\n", _("roaming network")); break;
66 case GSM_RequestingNetwork : printf("%s\n", _("requesting network")); break;
67 case GSM_NoNetwork : printf("%s\n", _("not logged into network")); break;
68 case GSM_RegistrationDenied : printf("%s\n", _("registration to network denied")); break;
69 case GSM_NetworkStatusUnknown : printf("%s\n", _("unknown")); break;
70 #ifndef CHECK_CASES
71 default : printf("%s\n", _("unknown"));
72 #endif
74 if (NetInfo.PacketState == GSM_HomeNetwork || NetInfo.PacketState == GSM_RoamingNetwork) {
75 printf(LISTFORMAT, _("Packet network"));
76 printf("%s (%s",
77 NetInfo.NetworkCode,
78 DecodeUnicodeConsole(GSM_GetNetworkName(NetInfo.NetworkCode)));
79 printf(", %s)",
80 DecodeUnicodeConsole(GSM_GetCountryName(NetInfo.NetworkCode)));
81 printf(", LAC %s, CID %s\n",
82 NetInfo.PacketLAC, NetInfo.PacketCID);
83 if (NetInfo.NetworkName[0] != 0x00 || NetInfo.NetworkName[1] != 0x00) {
84 printf(LISTFORMAT "\"%s\"\n",
85 _("Name in phone"),
86 DecodeUnicodeConsole(NetInfo.NetworkName));
89 if (NetInfo.GPRS != 0) {
90 printf(LISTFORMAT, _("GPRS"));
91 switch (NetInfo.GPRS) {
92 case GSM_GPRS_Attached:
93 printf("%s", _("attached"));
94 break;
95 case GSM_GPRS_Detached:
96 printf("%s", _("detached"));
97 break;
99 printf("\n");
103 void PrintBatteryCharge(GSM_BatteryCharge *BatteryCharge)
105 if (BatteryCharge->BatteryPercent != -1) {
106 printf(LISTFORMAT, _("Battery level"));
107 printf(_("%i percent"), BatteryCharge->BatteryPercent);
108 printf("\n");
110 if (BatteryCharge->BatteryCapacity != -1) {
111 printf(LISTFORMAT, _("Battery capacity"));
112 printf(_("%i mAh"), BatteryCharge->BatteryCapacity);
113 printf("\n");
115 if (BatteryCharge->BatteryTemperature != -1) {
116 printf(LISTFORMAT, _("Battery temperature"));
117 /* l10n: This means degrees Celsius */
118 printf(_("%i C"), BatteryCharge->BatteryTemperature);
119 printf("\n");
121 if (BatteryCharge->PhoneTemperature != -1) {
122 printf(LISTFORMAT, _("Phone temperature"));
123 printf(_("%i C"), BatteryCharge->PhoneTemperature);
124 printf("\n");
126 if (BatteryCharge->BatteryVoltage != -1) {
127 printf(LISTFORMAT, _("Battery voltage"));
128 printf(_("%i mV"), BatteryCharge->BatteryVoltage);
129 printf("\n");
131 if (BatteryCharge->ChargeVoltage != -1) {
132 printf(LISTFORMAT, _("Charge voltage"));
133 printf(_("%i mV"), BatteryCharge->ChargeVoltage);
134 printf("\n");
136 if (BatteryCharge->ChargeCurrent != -1) {
137 printf(LISTFORMAT, _("Charge current"));
138 printf(_("%i mA"), BatteryCharge->ChargeCurrent);
139 printf("\n");
141 if (BatteryCharge->PhoneCurrent != -1) {
142 printf(LISTFORMAT, _("Phone current"));
143 printf(_("%i mA"), BatteryCharge->PhoneCurrent);
144 printf("\n");
146 if (BatteryCharge->ChargeState != 0) {
147 printf(LISTFORMAT, _("Charge state"));
148 switch (BatteryCharge->ChargeState) {
149 case GSM_BatteryPowered:
150 printf("%s", _("powered from battery"));
151 break;
152 case GSM_BatteryConnected:
153 printf("%s", _("battery connected, but not powered from battery"));
154 break;
155 case GSM_BatteryCharging:
156 printf("%s", _("battery connected and is being charged"));
157 break;
158 case GSM_BatteryFull:
159 printf("%s", _("battery connected and is fully charged"));
160 break;
161 case GSM_BatteryNotConnected:
162 printf("%s", _("battery not connected"));
163 break;
164 case GSM_PowerFault:
165 printf("%s", _("detected power failure"));
166 break;
167 #ifndef CHECK_CASES
168 default:
169 printf("%s", _("unknown"));
170 break;
171 #endif
173 printf("\n");
175 if (BatteryCharge->BatteryType != 0) {
176 printf(LISTFORMAT, _("Battery type"));
177 switch (BatteryCharge->BatteryType) {
178 case GSM_BatteryLiIon:
179 printf("%s", _("Lithium Ion"));
180 break;
181 case GSM_BatteryLiPol:
182 printf("%s", _("Lithium Polymer"));
183 break;
184 case GSM_BatteryNiMH:
185 printf("%s", _("NiMH"));
186 break;
187 case GSM_BatteryUnknown:
188 #ifndef CHECK_CASES
189 default:
190 #endif
191 printf("%s", _("unknown"));
192 break;
194 printf("\n");
198 GSM_Error GSM_PlayRingtone(GSM_Ringtone ringtone)
200 int i;
201 gboolean first=TRUE;
202 GSM_Error error;
204 signal(SIGINT, interrupt);
205 printf("%s\n", _("Press Ctrl+C to break..."));
207 for (i=0;i<ringtone.NoteTone.NrCommands;i++) {
208 if (gshutdown) break;
209 if (ringtone.NoteTone.Commands[i].Type != RING_Note) continue;
210 error=PHONE_RTTLPlayOneNote(gsm,ringtone.NoteTone.Commands[i].Note,first);
211 if (error!=ERR_NONE) return error;
212 first = FALSE;
215 /* Disables buzzer */
216 return GSM_PlayTone(gsm,255*255,0,FALSE);
219 void PlayRingtone(int argc UNUSED, char *argv[])
221 GSM_Ringtone ringtone,ringtone2;
222 GSM_Error error;
224 ringtone.Format = 0;
225 error=GSM_ReadRingtoneFile(argv[2],&ringtone);
226 Print_Error(error);
228 error=GSM_RingtoneConvert(&ringtone2,&ringtone,RING_NOTETONE);
229 Print_Error(error);
231 GSM_Init(TRUE);
233 error=GSM_PlayRingtone(ringtone2);
234 Print_Error(error);
236 GSM_Terminate();
240 * Get's location from OpenCellID.
242 void GetLocation(int argc UNUSED, char *argv[]UNUSED)
244 GSM_File OpenCell;
245 char url[70 + GSM_MAX_MODEL_LENGTH];
246 char *pos;
247 GSM_Error error;
248 GSM_NetworkInfo netinfo;
249 float latitude, longitude;
250 long int mnc, mcc, lac, cellid, nbSamples, range;
251 char *ret, *old_locale = NULL;
252 gboolean failure = FALSE;
254 GSM_Init(TRUE);
256 /* Get model information */
257 error = GSM_GetNetworkInfo(gsm, &netinfo);
258 Print_Error(error);
260 if (netinfo.State == GSM_NoNetwork) {
261 printf_err("%s", _("Not logged to network!\n"));
262 GSM_Terminate();
263 return;
266 /* We need decimal numbers */
267 lac = strtol(netinfo.LAC, NULL, 16);
268 cellid = strtol(netinfo.CID, NULL, 16);
270 /* Split code to country and network (beware ncc+nmc without space) */
271 if (sscanf(netinfo.NetworkCode, "%3ld%ld", &mcc, &mnc) != 2) {
272 printf_err("%s", _("Wrong network code from phone!\n"));
273 GSM_Terminate();
274 return;
277 /* Request information from OpenCellID */
278 sprintf(url, "http://www.opencellid.org/cell/get?key=%s&mnc=%ld&mcc=%ld&lac=%ld&cellid=%ld",
279 OPENCELLID_API_KEY,
280 mnc, mcc, lac, cellid);
282 OpenCell.Buffer = NULL;
283 OpenCell.Used = 0;
284 error = GSM_ReadHTTPFile(url, &OpenCell);
285 Print_Error(error);
287 /* We need to reset numeric locales because we parse floats with . as decimal separator */
288 ret = setlocale(LC_NUMERIC, "C");
289 if (ret != NULL) {
290 old_locale = strdup(ret);
293 /* Parse reply:
294 <?xml version="1.0" encoding="UTF-8"?>
295 <rsp stat="ok">
296 <cell range="6000" lac="0" lat="54.4910893937777" nbSamples="46" lon="27.9390742994699" cellId="29513" mcc="250" mnc="99"/>
297 </rsp>
299 if (strstr(OpenCell.Buffer, "stat=\"ok\"") == NULL) {
300 printf_err("%s", _("Request for information from OpenCellID failed!\n"));
301 failure = TRUE;
302 goto done;
304 pos = strstr(OpenCell.Buffer, "lat=\"");
305 if (pos == NULL) {
306 printf_err("%s", _("Failed to find latitude in OpenCellID reply!\n"));
307 failure = TRUE;
308 goto done;
310 if (sscanf(pos, "lat=\"%f\"", &latitude) == 0) {
311 printf_err("%s", _("Failed to parse latitude from OpenCellID reply!\n"));
312 failure = TRUE;
313 goto done;
315 pos = strstr(OpenCell.Buffer, "lon=\"");
316 if (pos == NULL) {
317 printf_err("%s", _("Failed to find longitude in OpenCellID reply!\n"));
318 failure = TRUE;
319 goto done;
321 if (sscanf(pos, "lon=\"%f\"", &longitude) == 0) {
322 printf_err("%s", _("Failed to parse longitude from OpenCellID reply!\n"));
323 failure = TRUE;
324 goto done;
326 pos = strstr(OpenCell.Buffer, "range=\"");
327 if (pos == NULL) {
328 printf_err("%s", _("Failed to find range in OpenCellID reply!\n"));
329 failure = TRUE;
330 goto done;
332 if (sscanf(pos, "range=\"%ld\"", &range) == 0) {
333 printf_err("%s", _("Failed to parse range from OpenCellID reply!\n"));
334 failure = TRUE;
335 goto done;
337 pos = strstr(OpenCell.Buffer, "nbSamples=\"");
338 if (pos == NULL) {
339 printf_err("%s", _("Failed to find nbSamples in OpenCellID reply!\n"));
340 failure = TRUE;
341 goto done;
343 if (sscanf(pos, "nbSamples=\"%ld\"", &nbSamples) == 0) {
344 printf_err("%s", _("Failed to parse nbSamples from OpenCellID reply!\n"));
345 failure = TRUE;
346 goto done;
349 done:
350 if (old_locale != NULL) {
351 setlocale(LC_NUMERIC, old_locale);
352 free(old_locale);
354 if (!failure) {
355 printf(LISTFORMAT "%f\n", _("Latitude"), latitude);
356 printf(LISTFORMAT "%f\n", _("Longitude"), longitude);
357 printf(LISTFORMAT "%ld\n", _("Range"), range);
358 printf(LISTFORMAT "%ld\n", _("Number of samples"), nbSamples);
361 free(OpenCell.Buffer);
362 GSM_Terminate();
367 void Identify(int argc, char *argv[])
369 char buffer[GSM_MAX_INFO_LENGTH];
370 char date[GSM_MAX_VERSION_DATE_LENGTH];
371 double num;
372 GSM_Error error;
373 GSM_Config *curcfg;
375 GSM_Init(TRUE);
377 /* Read current configuration */
378 curcfg = GSM_GetConfig(gsm, -1);
379 printf(LISTFORMAT "%s\n", _("Device"), curcfg->Device);
381 error=GSM_GetManufacturer(gsm, buffer);
382 Print_Error(error);
383 printf(LISTFORMAT "%s\n", _("Manufacturer"), buffer);
384 error=GSM_GetModel(gsm, buffer);
385 Print_Error(error);
386 printf(LISTFORMAT "%s (%s)\n", _("Model"),
387 GSM_GetModelInfo(gsm)->model,
388 buffer);
390 error=GSM_GetFirmware(gsm, buffer, date, &num);
391 Print_Error(error);
392 printf(LISTFORMAT "%s", _("Firmware"), buffer);
393 error=GSM_GetPPM(gsm, buffer);
394 if (error != ERR_NOTSUPPORTED) {
395 if (error != ERR_NOTIMPLEMENTED) Print_Error(error);
396 if (error == ERR_NONE) printf(" %s", buffer);
398 if (date[0] != 0) printf(" (%s)", date);
399 printf("\n");
401 error=GSM_GetHardware(gsm, buffer);
402 if (error != ERR_NOTSUPPORTED) {
403 if (error != ERR_NOTIMPLEMENTED) Print_Error(error);
404 if (error == ERR_NONE) printf(LISTFORMAT "%s\n", _("Hardware"),buffer);
407 error=GSM_GetIMEI(gsm, buffer);
408 if (error != ERR_NOTSUPPORTED) {
409 if (error != ERR_NOTIMPLEMENTED) Print_Error(error);
410 if (error == ERR_NONE) printf(LISTFORMAT "%s\n", _("IMEI"), buffer);
412 error=GSM_GetOriginalIMEI(gsm, buffer);
413 if (error != ERR_NOTSUPPORTED && error != ERR_SECURITYERROR) {
414 if (error != ERR_NOTIMPLEMENTED) Print_Error(error);
415 if (error == ERR_NONE) printf(LISTFORMAT "%s\n", _("Original IMEI"), buffer);
419 error=GSM_GetManufactureMonth(gsm, buffer);
420 if (error != ERR_NOTSUPPORTED && error != ERR_SECURITYERROR) {
421 if (error != ERR_NOTIMPLEMENTED) Print_Error(error);
422 if (error == ERR_NONE) printf(LISTFORMAT "%s\n", _("Manufactured"),buffer);
425 error=GSM_GetProductCode(gsm, buffer);
426 if (error != ERR_NOTSUPPORTED) {
427 if (error != ERR_NOTIMPLEMENTED) Print_Error(error);
428 if (error == ERR_NONE) printf(LISTFORMAT "%s\n", _("Product code"),buffer);
431 error=GSM_GetSIMIMSI(gsm, buffer);
432 switch (error) {
433 case ERR_SECURITYERROR:
434 case ERR_NOTSUPPORTED:
435 case ERR_NOTIMPLEMENTED:
436 break;
437 case ERR_NONE:
438 printf(LISTFORMAT "%s\n", _("SIM IMSI"),buffer);
439 break;
440 default:
441 Print_Error(error);
444 #ifdef GSM_ENABLE_NOKIA_DCT3
445 DCT3Info();
446 #endif
447 #ifdef GSM_ENABLE_NOKIA_DCT4
448 DCT4Info();
449 #endif
451 GSM_Terminate();
454 void NetworkInfo(int argc UNUSED, char *argv[] UNUSED)
456 GSM_NetworkInfo NetInfo;
457 GSM_Error error;
459 GSM_Init(TRUE);
461 error = GSM_GetNetworkInfo(gsm,&NetInfo);
462 Print_Error(error);
464 PrintNetworkInfo(NetInfo);
466 GSM_Terminate();
469 void Battery(int argc UNUSED, char *argv[] UNUSED)
471 GSM_BatteryCharge BatteryCharge;
472 GSM_Error error;
474 GSM_Init(TRUE);
476 error = GSM_GetBatteryCharge(gsm, &BatteryCharge);
477 Print_Error(error);
479 PrintBatteryCharge(&BatteryCharge);
481 GSM_Terminate();
484 void Screenshot(int argc UNUSED, char *argv[])
486 GSM_BinaryPicture pic;
487 const char *ext = NULL;
488 char *fname;
489 GSM_Error error;
490 FILE *f;
491 size_t written;
492 int ret;
494 GSM_Init(TRUE);
496 error = GSM_GetScreenshot(gsm, &pic);
497 Print_Error(error);
499 switch (pic.Type) {
500 case PICTURE_BMP:
501 ext = ".bmp";
502 break;
503 case PICTURE_GIF:
504 ext = ".gif";
505 break;
506 case PICTURE_JPG:
507 ext = ".jpg";
508 break;
509 case PICTURE_ICN:
510 ext = ".icn";
511 break;
512 case PICTURE_PNG:
513 ext = ".png";
514 break;
516 if (ext == NULL) {
517 printf_err("Unknown file type: %d\n", pic.Type);
518 return;
521 fname = (char *)malloc(strlen(argv[2]) + strlen(ext) + 1);
522 strcpy(fname, argv[2]);
523 strcat(fname, ext);
525 f = fopen(fname, "w");
526 if (f == NULL) {
527 printf_err("Failed to open file: %s\n", fname);
528 return;
530 written = fwrite(pic.Buffer, 1, pic.Length, f);
531 ret = fclose(f);
532 if (ret != 0 || written != pic.Length) {
533 printf_err("Failed to write file: %s\n", fname);
534 return;
537 printf_info("File saved as %s\n", fname);
539 free(fname);
540 free(pic.Buffer);
542 GSM_Terminate();
545 void IncomingCall(GSM_StateMachine *sm UNUSED, GSM_Call *call, void *user_data)
547 printf(LISTFORMAT, _("Call info"));
549 if (call->CallIDAvailable) {
550 printf(_("ID %i, "),call->CallID);
552 switch(call->Status) {
553 case GSM_CALL_IncomingCall : printf(_("incoming call from \"%s\"\n"),DecodeUnicodeConsole(call->PhoneNumber)); break;
554 case GSM_CALL_OutgoingCall : printf(_("outgoing call to \"%s\"\n"),DecodeUnicodeConsole(call->PhoneNumber)); break;
555 case GSM_CALL_CallStart : printf("%s\n", _("call started")); break;
556 case GSM_CALL_CallEnd : printf("%s\n", _("end of call (unknown side)")); break;
557 case GSM_CALL_CallLocalEnd : printf("%s\n", _("call end from our side")); break;
558 case GSM_CALL_CallRemoteEnd : printf(_("call end from remote side (code %i)\n"),call->StatusCode); break;
559 case GSM_CALL_CallEstablished : printf("%s\n", _("call established. Waiting for answer")); break;
560 case GSM_CALL_CallHeld : printf("%s\n", _("call held")); break;
561 case GSM_CALL_CallResumed : printf("%s\n", _("call resumed")); break;
562 case GSM_CALL_CallSwitched : printf("%s\n", _("call switched")); break;
566 #define PRINTUSED(name, used, free) \
568 printf(LISTFORMAT, name); \
569 printf(_("%3d used"), used); \
570 printf(", "); \
571 printf(_("%3d free"), free); \
572 printf("\n"); \
575 #define CHECKMEMORYSTATUS(x, m, name) \
577 x.MemoryType=m; \
578 if ( (error = GSM_GetMemoryStatus(gsm, &x)) == ERR_NONE) \
579 PRINTUSED(name, x.MemoryUsed, x.MemoryFree); \
582 #define CHECK_EXIT \
584 if (gshutdown) break; \
585 if (error != ERR_NONE && error != ERR_UNKNOWN && error != ERR_NOTSUPPORTED && error != ERR_MEMORY && error != ERR_EMPTY && error != ERR_SOURCENOTAVAILABLE && error != ERR_NOTIMPLEMENTED) break; \
588 void Monitor(int argc, char *argv[])
590 GSM_MemoryStatus MemStatus;
591 GSM_SMSMemoryStatus SMSStatus;
592 GSM_ToDoStatus ToDoStatus;
593 GSM_CalendarStatus CalendarStatus;
594 GSM_NetworkInfo NetInfo;
595 GSM_BatteryCharge BatteryCharge;
596 GSM_SignalQuality SignalQuality;
597 GSM_Error error;
598 int count = -1;
600 if (argc >= 3) {
601 count = GetInt(argv[2]);
602 if (count <= 0) count = -1;
605 signal(SIGINT, interrupt);
606 fprintf(stderr, "%s\n", _("Press Ctrl+C to break..."));
607 printf("%s\n\n", _("Entering monitor mode..."));
609 GSM_Init(TRUE);
611 GSM_SetIncomingSMSCallback(gsm, IncomingSMS, NULL);
612 GSM_SetIncomingCBCallback(gsm, IncomingCB, NULL);
613 GSM_SetIncomingCallCallback(gsm, IncomingCall, NULL);
614 GSM_SetIncomingUSSDCallback(gsm, IncomingUSSD, NULL);
616 error=GSM_SetIncomingSMS (gsm,TRUE);
617 printf("%-35s : %s\n", _("Enabling info about incoming SMS"), GSM_ErrorString(error));
618 error=GSM_SetIncomingCB (gsm,TRUE);
619 printf("%-35s : %s\n", _("Enabling info about incoming CB"), GSM_ErrorString(error));
620 error=GSM_SetIncomingCall (gsm,TRUE);
621 printf("%-35s : %s\n", _("Enabling info about calls"), GSM_ErrorString(error));
622 error=GSM_SetIncomingUSSD (gsm,TRUE);
623 printf("%-35s : %s\n", _("Enabling info about USSD"), GSM_ErrorString(error));
625 while (!gshutdown && count != 0) {
626 if (count > 0) count--;
627 CHECKMEMORYSTATUS(MemStatus,MEM_SM,"SIM phonebook");
628 CHECK_EXIT;
629 CHECKMEMORYSTATUS(MemStatus,MEM_DC,"Dialled numbers");
630 CHECK_EXIT;
631 CHECKMEMORYSTATUS(MemStatus,MEM_RC,"Received numbers");
632 CHECK_EXIT;
633 CHECKMEMORYSTATUS(MemStatus,MEM_MC,"Missed numbers");
634 CHECK_EXIT;
635 CHECKMEMORYSTATUS(MemStatus,MEM_ON,"Own numbers");
636 CHECK_EXIT;
637 CHECKMEMORYSTATUS(MemStatus,MEM_ME,"Phone phonebook");
638 CHECK_EXIT;
639 if ( (error = GSM_GetToDoStatus(gsm, &ToDoStatus)) == ERR_NONE) {
640 PRINTUSED(_("Todos"), ToDoStatus.Used, ToDoStatus.Free);
642 CHECK_EXIT;
643 if ( (error = GSM_GetCalendarStatus(gsm, &CalendarStatus)) == ERR_NONE) {
644 PRINTUSED(_("Calendar"), CalendarStatus.Used, CalendarStatus.Free);
646 CHECK_EXIT;
647 if ( (error = GSM_GetBatteryCharge(gsm,&BatteryCharge)) == ERR_NONE) {
648 PrintBatteryCharge(&BatteryCharge);
650 CHECK_EXIT;
651 if ( (error = GSM_GetSignalQuality(gsm,&SignalQuality)) == ERR_NONE) {
652 if (SignalQuality.SignalStrength != -1) {
653 printf(LISTFORMAT, _("Signal strength"));
654 printf(_("%i dBm"), SignalQuality.SignalStrength);
655 printf("\n");
657 if (SignalQuality.SignalPercent != -1) {
658 printf(LISTFORMAT, _("Network level"));
659 printf(_("%i percent"), SignalQuality.SignalPercent);
660 printf("\n");
662 if (SignalQuality.BitErrorRate != -1) {
663 printf(LISTFORMAT, _("Bit error rate"));
664 printf(_("%i percent"), SignalQuality.BitErrorRate);
665 printf("\n");
668 CHECK_EXIT;
669 if ( (error = GSM_GetSMSStatus(gsm,&SMSStatus)) == ERR_NONE) {
670 if (SMSStatus.SIMSize > 0) {
671 printf(LISTFORMAT, _("SIM SMS status"));
672 printf(_("%i used"), SMSStatus.SIMUsed);
673 printf(", ");
674 printf(_("%i unread"), SMSStatus.SIMUnRead);
675 printf(", ");
676 printf(_("%i locations"), SMSStatus.SIMSize);
677 printf("\n");
680 if (SMSStatus.PhoneSize > 0) {
681 printf(LISTFORMAT, _("Phone SMS status"));
682 printf(_("%i used"), SMSStatus.PhoneUsed);
683 printf(", ");
684 printf(_("%i unread"), SMSStatus.PhoneUnRead);
685 printf(", ");
686 printf(_("%i locations"), SMSStatus.PhoneSize);
687 if (SMSStatus.TemplatesUsed != 0) {
688 printf(", ");
689 printf(_("%i templates"), SMSStatus.TemplatesUsed);
691 printf("\n");
694 CHECK_EXIT;
695 if ( (error = GSM_GetNetworkInfo(gsm,&NetInfo)) == ERR_NONE) {
696 PrintNetworkInfo(NetInfo);
698 if (wasincomingsms) DisplayIncomingSMS();
699 printf("\n");
702 printf("%s\n", _("Leaving monitor mode..."));
704 /* Report if we failed because of an error */
705 Print_Error(error);
707 GSM_Terminate();
710 void GetRingtone(int argc, char *argv[])
712 GSM_Ringtone ringtone;
713 gboolean PhoneRingtone = FALSE;
714 GSM_Error error;
716 if (strcasestr(argv[1], "getphoneringtone") != NULL) {
717 PhoneRingtone = TRUE;
720 GetStartStop(&ringtone.Location, NULL, 2, argc, argv);
722 GSM_Init(TRUE);
724 ringtone.Format=0;
726 error=GSM_GetRingtone(gsm,&ringtone,PhoneRingtone);
727 Print_Error(error);
729 switch (ringtone.Format) {
730 case RING_NOTETONE : printf("%s", _("Smart Messaging")); break;
731 case RING_NOKIABINARY : printf("%s", _("Nokia binary")); break;
732 case RING_MIDI : printf("%s", _("MIDI")); break;
733 case RING_MMF : printf("%s", _("SMAF (MMF)")); break;
735 printf(_(" format, ringtone \"%s\"\n"),DecodeUnicodeConsole(ringtone.Name));
737 if (argc==4) {
738 error=GSM_SaveRingtoneFile(argv[3], &ringtone);
739 Print_Error(error);
742 GSM_Terminate();
745 void GetRingtonesList(int argc UNUSED, char *argv[] UNUSED)
747 GSM_AllRingtonesInfo Info = {0, NULL};
748 GSM_Error error;
749 int i;
751 GSM_Init(TRUE);
753 error=GSM_GetRingtonesInfo(gsm,&Info);
754 if (error != ERR_NONE && Info.Ringtone) free(Info.Ringtone);
755 Print_Error(error);
757 GSM_Terminate();
759 for (i=0;i<Info.Number;i++) printf("%i. \"%s\"\n",i+1,DecodeUnicodeConsole(Info.Ringtone[i].Name));
761 if (Info.Ringtone) free(Info.Ringtone);
764 void DialVoice(int argc, char *argv[])
766 GSM_CallShowNumber ShowNumber = GSM_CALL_DefaultNumberPresence;
767 GSM_Error error;
769 if (argc > 3) {
770 if (strcasecmp(argv[3],"show") == 0) { ShowNumber = GSM_CALL_ShowNumber;
771 } else if (strcasecmp(argv[3],"hide") == 0) { ShowNumber = GSM_CALL_HideNumber;
772 } else {
773 printf(_("Unknown parameter (\"%s\")\n"),argv[3]);
774 Terminate(2);
778 GSM_Init(TRUE);
780 error=GSM_DialVoice(gsm, argv[2], ShowNumber);
781 Print_Error(error);
783 GSM_Terminate();
786 volatile int TerminateID = -1;
788 void IncomingCall0(GSM_StateMachine *sm UNUSED, GSM_Call *call, void * user_data)
790 if (call->CallIDAvailable) {
791 TerminateID = call->CallID;
795 void MakeTerminatedCall(int argc, char *argv[])
797 GSM_CallShowNumber ShowNumber = GSM_CALL_DefaultNumberPresence;
798 GSM_Error error;
800 if (argc > 4) {
801 if (strcasecmp(argv[4], "show") == 0) {
802 ShowNumber = GSM_CALL_ShowNumber;
803 } else if (strcasecmp(argv[4], "hide") == 0) {
804 ShowNumber = GSM_CALL_HideNumber;
805 } else {
806 printf(_("Unknown parameter (\"%s\")\n"), argv[4]);
807 Terminate(2);
811 GSM_Init(TRUE);
813 TerminateID = -1;
814 GSM_SetIncomingCallCallback(gsm, IncomingCall0, NULL);
816 error = GSM_SetIncomingCall(gsm, TRUE);
817 Print_Error(error);
819 error = GSM_DialVoice(gsm, argv[2], ShowNumber);
820 Print_Error(error);
822 sleep(GetInt(argv[3]));
823 GSM_ReadDevice(gsm, TRUE);
825 if (TerminateID != -1) {
826 error = GSM_CancelCall(gsm, TerminateID, FALSE);
827 Print_Error(error);
828 } else {
829 error = GSM_CancelCall(gsm, 0, TRUE);
830 Print_Error(error);
833 GSM_Terminate();
837 void CancelCall(int argc, char *argv[])
839 GSM_Error error;
840 GSM_Init(TRUE);
842 if (argc>2) {
843 error=GSM_CancelCall(gsm,GetInt(argv[2]),FALSE);
844 } else {
845 error=GSM_CancelCall(gsm,0,TRUE);
847 Print_Error(error);
849 GSM_Terminate();
852 void AnswerCall(int argc, char *argv[])
854 GSM_Error error;
855 GSM_Init(TRUE);
857 if (argc>2) {
858 error=GSM_AnswerCall(gsm,GetInt(argv[2]),FALSE);
859 } else {
860 error=GSM_AnswerCall(gsm,0,TRUE);
862 Print_Error(error);
864 GSM_Terminate();
867 void UnholdCall(int argc UNUSED, char *argv[])
869 GSM_Error error;
870 GSM_Init(TRUE);
872 error=GSM_UnholdCall(gsm,GetInt(argv[2]));
873 Print_Error(error);
875 GSM_Terminate();
878 void HoldCall(int argc UNUSED, char *argv[])
880 GSM_Error error;
881 GSM_Init(TRUE);
883 error=GSM_HoldCall(gsm,GetInt(argv[2]));
884 Print_Error(error);
886 GSM_Terminate();
889 void ConferenceCall(int argc UNUSED, char *argv[])
891 GSM_Error error;
892 GSM_Init(TRUE);
894 error=GSM_ConferenceCall(gsm,GetInt(argv[2]));
895 Print_Error(error);
897 GSM_Terminate();
900 void SplitCall(int argc UNUSED, char *argv[])
902 GSM_Error error;
903 GSM_Init(TRUE);
905 error=GSM_SplitCall(gsm,GetInt(argv[2]));
906 Print_Error(error);
908 GSM_Terminate();
911 void SwitchCall(int argc, char *argv[])
913 GSM_Error error;
914 GSM_Init(TRUE);
916 if (argc > 2) {
917 error=GSM_SwitchCall(gsm,GetInt(argv[2]),FALSE);
918 } else {
919 error=GSM_SwitchCall(gsm,0,TRUE);
921 Print_Error(error);
923 GSM_Terminate();
926 void TransferCall(int argc, char *argv[])
928 GSM_Error error;
929 GSM_Init(TRUE);
931 if (argc > 2) {
932 error=GSM_TransferCall(gsm,GetInt(argv[2]),FALSE);
933 } else {
934 error=GSM_TransferCall(gsm,0,TRUE);
936 Print_Error(error);
938 GSM_Terminate();
941 void Reset(int argc UNUSED, char *argv[])
943 gboolean hard;
944 GSM_Error error;
946 if (strcasecmp(argv[2],"SOFT") == 0) { hard=FALSE;
947 } else if (strcasecmp(argv[2],"HARD") == 0) { hard=TRUE;
948 } else {
949 printf(_("What type of reset do you want (\"%s\") ?\n"),argv[2]);
950 Terminate(2);
953 GSM_Init(TRUE);
955 error=GSM_Reset(gsm, hard);
956 Print_Error(error);
958 GSM_Terminate();
961 void GetWAPBookmark(int argc, char *argv[])
963 GSM_WAPBookmark bookmark;
964 int start,stop, i;
965 GSM_Error error;
967 GetStartStop(&start, &stop, 2, argc, argv);
969 GSM_Init(TRUE);
971 for (i=start;i<=stop;i++) {
972 bookmark.Location=i;
973 error=GSM_GetWAPBookmark(gsm,&bookmark);
974 Print_Error(error);
975 printf(LISTFORMAT "\"%s\"\n", _("Name"),DecodeUnicodeConsole(bookmark.Title));
976 printf(LISTFORMAT "\"%s\"\n", _("Address"),DecodeUnicodeConsole(bookmark.Address));
979 GSM_Terminate();
982 void DeleteWAPBookmark(int argc, char *argv[])
984 GSM_WAPBookmark bookmark;
985 int start, stop, i;
986 GSM_Error error;
988 GetStartStop(&start, &stop, 2, argc, argv);
990 GSM_Init(TRUE);
992 for (i=start;i<=stop;i++) {
993 bookmark.Location=i;
994 error=GSM_DeleteWAPBookmark(gsm, &bookmark);
995 Print_Error(error);
998 GSM_Terminate();
1001 void GetGPRSPoint(int argc, char *argv[])
1003 GSM_GPRSAccessPoint point;
1004 int start,stop, i;
1005 GSM_Error error;
1007 GetStartStop(&start, &stop, 2, argc, argv);
1009 GSM_Init(TRUE);
1011 for (i=start;i<=stop;i++) {
1012 point.Location=i;
1013 error=GSM_GetGPRSAccessPoint(gsm,&point);
1014 if (error != ERR_EMPTY) {
1015 Print_Error(error);
1016 printf("%i. \"%s\"",point.Location,DecodeUnicodeConsole(point.Name));
1017 } else {
1018 printf(_("%i. Access point %i"),point.Location,point.Location);
1020 if (point.Active) printf("%s", _(" (active)"));
1021 printf("\n");
1022 if (error != ERR_EMPTY) {
1023 printf(LISTFORMAT "\"%s\"\n\n", _("Address"),DecodeUnicodeConsole(point.URL));
1024 } else {
1025 printf("\n");
1029 GSM_Terminate();
1032 void GetBitmap(int argc, char *argv[])
1034 GSM_File File;
1035 GSM_MultiBitmap MultiBitmap;
1036 int location=0, Handle, Size;
1037 GSM_AllRingtonesInfo Info = {0, NULL};
1038 unsigned char buffer[10];
1039 const unsigned char *ringtonename;
1040 GSM_Error error;
1042 if (strcasecmp(argv[2],"STARTUP") == 0) {
1043 MultiBitmap.Bitmap[0].Type=GSM_StartupLogo;
1044 } else if (strcasecmp(argv[2],"CALLER") == 0) {
1045 MultiBitmap.Bitmap[0].Type=GSM_CallerGroupLogo;
1046 GetStartStop(&location, NULL, 3, argc, argv);
1047 if (location>5) {
1048 printf("%s\n", _("Maximal location for caller logo can be 5"));
1049 Terminate(2);
1051 } else if (strcasecmp(argv[2],"PICTURE") == 0) {
1052 MultiBitmap.Bitmap[0].Type=GSM_PictureImage;
1053 GetStartStop(&location, NULL, 3, argc, argv);
1054 } else if (strcasecmp(argv[2],"TEXT") == 0) {
1055 MultiBitmap.Bitmap[0].Type=GSM_WelcomeNote_Text;
1056 } else if (strcasecmp(argv[2],"DEALER") == 0) {
1057 MultiBitmap.Bitmap[0].Type=GSM_DealerNote_Text;
1058 } else if (strcasecmp(argv[2],"OPERATOR") == 0) {
1059 MultiBitmap.Bitmap[0].Type=GSM_OperatorLogo;
1060 } else {
1061 printf(_("What type of logo do you want to get (\"%s\") ?\n"),argv[2]);
1062 Terminate(2);
1064 MultiBitmap.Bitmap[0].Location=location;
1066 GSM_Init(TRUE);
1068 error=GSM_GetBitmap(gsm,&MultiBitmap.Bitmap[0]);
1069 Print_Error(error);
1071 MultiBitmap.Number = 1;
1073 error=ERR_NONE;
1074 switch (MultiBitmap.Bitmap[0].Type) {
1075 case GSM_CallerGroupLogo:
1076 if (!MultiBitmap.Bitmap[0].DefaultBitmap) GSM_PrintBitmap(stdout,&MultiBitmap.Bitmap[0]);
1077 printf(LISTFORMAT "\"%s\"", _("Group name"),DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Text));
1078 if (MultiBitmap.Bitmap[0].DefaultName) printf(" (%s)", _("default"));
1079 printf("\n");
1080 if (MultiBitmap.Bitmap[0].DefaultRingtone) {
1081 printf(LISTFORMAT "%s\n", _("Ringtone"), _("default"));
1082 } else if (GSM_IsPhoneFeatureAvailable(GSM_GetModelInfo(gsm), F_6230iCALLER)) {
1083 printf(LISTFORMAT "%i\n", _("Ringtone"),MultiBitmap.Bitmap[0].RingtoneID);
1084 } else if (MultiBitmap.Bitmap[0].FileSystemRingtone) {
1085 sprintf(buffer,"%i",MultiBitmap.Bitmap[0].RingtoneID);
1086 EncodeUnicode(File.ID_FullName,buffer,strlen(buffer));
1088 File.Buffer = NULL;
1089 File.Used = 0;
1091 error = GSM_GetFilePart(gsm,&File,&Handle,&Size);
1093 if (error != ERR_EMPTY && error != ERR_WRONGCRC) Print_Error(error);
1094 error = ERR_NONE;
1096 printf(LISTFORMAT "\"%s\" ", _("Ringtone"), DecodeUnicodeString(File.Name));
1097 printf(_("(file with ID %i)\n"), MultiBitmap.Bitmap[0].RingtoneID);
1098 } else {
1099 error = GSM_GetRingtonesInfo(gsm,&Info);
1100 if (error != ERR_NONE) Info.Number = 0;
1101 error = ERR_NONE;
1103 printf(LISTFORMAT, _("Ringtone"));
1104 ringtonename = GSM_GetRingtoneName(&Info, MultiBitmap.Bitmap[0].RingtoneID);
1105 if (ringtonename != NULL) {
1106 /* l10n: Ringtone name and ID format */
1107 printf(_("\"%s\" (ID %i)\n"), DecodeUnicodeConsole(ringtonename), MultiBitmap.Bitmap[0].RingtoneID);
1108 } else {
1109 /* l10n: Ringtone ID format */
1110 printf(_("ID %i\n"), MultiBitmap.Bitmap[0].RingtoneID);
1113 if (Info.Ringtone) free(Info.Ringtone);
1115 if (MultiBitmap.Bitmap[0].BitmapEnabled) {
1116 printf(LISTFORMAT "%s\n", _("Bitmap"), _("enabled"));
1117 } else {
1118 printf(LISTFORMAT "%s\n", _("Bitmap"), _("disabled"));
1120 if (MultiBitmap.Bitmap[0].FileSystemPicture) {
1121 printf(LISTFORMAT "%i\n", _("Bitmap ID"),MultiBitmap.Bitmap[0].PictureID);
1123 if (argc>4 && !MultiBitmap.Bitmap[0].DefaultBitmap) error=GSM_SaveBitmapFile(argv[4],&MultiBitmap);
1124 break;
1125 case GSM_StartupLogo:
1126 GSM_PrintBitmap(stdout,&MultiBitmap.Bitmap[0]);
1127 if (argc>3) error=GSM_SaveBitmapFile(argv[3],&MultiBitmap);
1128 break;
1129 case GSM_OperatorLogo:
1130 if (strcmp(MultiBitmap.Bitmap[0].NetworkCode,"000 00")!=0) {
1131 GSM_PrintBitmap(stdout,&MultiBitmap.Bitmap[0]);
1132 if (argc>3) error=GSM_SaveBitmapFile(argv[3],&MultiBitmap);
1133 } else {
1134 printf("%s\n", _("No operator logo in phone"));
1136 break;
1137 case GSM_PictureImage:
1138 GSM_PrintBitmap(stdout,&MultiBitmap.Bitmap[0]);
1139 printf(LISTFORMAT "\"%s\"\n", _("Text"),DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Text));
1140 printf(LISTFORMAT "\"%s\"\n", _("Sender"),DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Sender));
1141 if (MultiBitmap.Bitmap[0].Name)
1142 printf(LISTFORMAT "\"%s\"\n", _("Name"),DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Name));
1143 if (argc>4) error=GSM_SaveBitmapFile(argv[4],&MultiBitmap);
1144 break;
1145 case GSM_WelcomeNote_Text:
1146 printf(_("Welcome note text is \"%s\"\n"),DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Text));
1147 break;
1148 case GSM_DealerNote_Text:
1149 printf(_("Dealer note text is \"%s\"\n"),DecodeUnicodeConsole(MultiBitmap.Bitmap[0].Text));
1150 break;
1151 default:
1152 break;
1154 Print_Error(error);
1156 GSM_Terminate();
1159 void SetBitmap(int argc, char *argv[])
1161 GSM_Bitmap Bitmap, NewBitmap;
1162 GSM_MultiBitmap MultiBitmap;
1163 GSM_NetworkInfo NetInfo;
1164 gboolean init = TRUE;
1165 int i;
1166 GSM_Error error;
1168 if (strcasecmp(argv[2],"STARTUP") == 0) {
1169 if (argc<4) {
1170 printf("%s\n", _("More parameters required!"));
1171 Terminate(2);
1173 MultiBitmap.Bitmap[0].Type=GSM_StartupLogo;
1174 MultiBitmap.Bitmap[0].Location=1;
1175 if (!strcmp(argv[3],"1")) MultiBitmap.Bitmap[0].Location = 2;
1176 if (!strcmp(argv[3],"2")) MultiBitmap.Bitmap[0].Location = 3;
1177 if (!strcmp(argv[3],"3")) MultiBitmap.Bitmap[0].Location = 4;
1178 if (MultiBitmap.Bitmap[0].Location == 1) {
1179 error=GSM_ReadBitmapFile(argv[3],&MultiBitmap);
1180 Print_Error(error);
1182 memcpy(&Bitmap,&MultiBitmap.Bitmap[0],sizeof(GSM_Bitmap));
1183 } else if (strcasecmp(argv[2],"TEXT") == 0) {
1184 if (argc<4) {
1185 printf("%s\n", _("More parameters required!"));
1186 Terminate(2);
1188 Bitmap.Type=GSM_WelcomeNote_Text;
1189 EncodeUnicode(Bitmap.Text,argv[3],strlen(argv[3]));
1190 } else if (strcasecmp(argv[2],"DEALER") == 0) {
1191 if (argc<4) {
1192 printf("%s\n", _("More parameters required!"));
1193 Terminate(2);
1195 Bitmap.Type=GSM_DealerNote_Text;
1196 EncodeUnicode(Bitmap.Text,argv[3],strlen(argv[3]));
1197 } else if (strcasecmp(argv[2],"CALLER") == 0) {
1198 if (argc<4) {
1199 printf("%s\n", _("More parameters required!"));
1200 Terminate(2);
1202 GetStartStop(&i, NULL, 3, argc, argv);
1203 if (i>5 && i!=255) {
1204 printf("%s\n", _("Maximal location for caller logo can be 5"));
1205 Terminate(1);
1207 MultiBitmap.Bitmap[0].Type = GSM_CallerGroupLogo;
1208 MultiBitmap.Bitmap[0].Location = i;
1209 if (argc>4) {
1210 error=GSM_ReadBitmapFile(argv[4],&MultiBitmap);
1211 Print_Error(error);
1213 memcpy(&Bitmap,&MultiBitmap.Bitmap[0],sizeof(GSM_Bitmap));
1214 if (i!=255) {
1215 GSM_Init(TRUE);
1216 init = FALSE;
1217 NewBitmap.Type = GSM_CallerGroupLogo;
1218 NewBitmap.Location = i;
1219 error=GSM_GetBitmap(gsm,&NewBitmap);
1220 Print_Error(error);
1221 Bitmap.RingtoneID = NewBitmap.RingtoneID;
1222 Bitmap.DefaultRingtone = NewBitmap.DefaultRingtone;
1223 Bitmap.FileSystemRingtone = FALSE;
1224 CopyUnicodeString(Bitmap.Text, NewBitmap.Text);
1225 Bitmap.DefaultName = NewBitmap.DefaultName;
1227 } else if (strcasecmp(argv[2],"PICTURE") == 0) {
1228 if (argc<5) {
1229 printf("%s\n", _("More parameters required!"));
1230 Terminate(2);
1232 MultiBitmap.Bitmap[0].Type = GSM_PictureImage;
1233 MultiBitmap.Bitmap[0].Location = GetInt(argv[4]);
1234 error=GSM_ReadBitmapFile(argv[3],&MultiBitmap);
1235 Print_Error(error);
1236 memcpy(&Bitmap,&MultiBitmap.Bitmap[0],sizeof(GSM_Bitmap));
1237 Bitmap.Text[0]=0;
1238 Bitmap.Text[1]=0;
1239 if (argc == 6) EncodeUnicode(Bitmap.Text,argv[5],strlen(argv[5]));
1240 Bitmap.Sender[0]=0;
1241 Bitmap.Sender[1]=0;
1242 } else if (strcasecmp(argv[2],"COLOUROPERATOR") == 0) {
1243 Bitmap.Type = GSM_ColourOperatorLogo_ID;
1244 strcpy(Bitmap.NetworkCode,"000 00");
1245 if (argc > 3) {
1246 Bitmap.ID = GetInt(argv[3]);
1247 if (argc>4) {
1248 strncpy(Bitmap.NetworkCode,argv[4],6);
1249 } else {
1250 GSM_Init(TRUE);
1251 init = FALSE;
1252 error=GSM_GetNetworkInfo(gsm,&NetInfo);
1253 Print_Error(error);
1254 strcpy(Bitmap.NetworkCode,NetInfo.NetworkCode);
1257 } else if (strcasecmp(argv[2],"COLOURSTARTUP") == 0) {
1258 Bitmap.Type = GSM_ColourStartupLogo_ID;
1259 Bitmap.Location = 0;
1260 if (argc > 3) {
1261 Bitmap.Location = 1;
1262 Bitmap.ID = GetInt(argv[3]);
1264 } else if (strcasecmp(argv[2],"WALLPAPER") == 0) {
1265 Bitmap.Type = GSM_ColourWallPaper_ID;
1266 Bitmap.ID = 0;
1267 if (argc > 3) Bitmap.ID = GetInt(argv[3]);
1268 } else if (strcasecmp(argv[2],"OPERATOR") == 0) {
1269 MultiBitmap.Bitmap[0].Type = GSM_OperatorLogo;
1270 MultiBitmap.Bitmap[0].Location = 1;
1271 strcpy(MultiBitmap.Bitmap[0].NetworkCode,"000 00");
1272 if (argc>3) {
1273 error=GSM_ReadBitmapFile(argv[3],&MultiBitmap);
1274 Print_Error(error);
1275 if (argc>4) {
1276 strncpy(MultiBitmap.Bitmap[0].NetworkCode,argv[4],6);
1277 } else {
1278 GSM_Init(TRUE);
1279 init = FALSE;
1280 error=GSM_GetNetworkInfo(gsm,&NetInfo);
1281 Print_Error(error);
1282 strcpy(MultiBitmap.Bitmap[0].NetworkCode,NetInfo.NetworkCode);
1285 memcpy(&Bitmap,&MultiBitmap.Bitmap[0],sizeof(GSM_Bitmap));
1286 } else {
1287 printf(_("What type of logo do you want to set (\"%s\") ?\n"),argv[2]);
1288 Terminate(2);
1291 if (init) GSM_Init(TRUE);
1293 error=GSM_SetBitmap(gsm,&Bitmap);
1294 Print_Error(error);
1296 GSM_Terminate();
1299 void SetRingtone(int argc, char *argv[])
1301 GSM_Error error;
1302 GSM_Ringtone ringtone;
1303 int i,nextlong=0;
1305 ringtone.Format = 0;
1306 error=GSM_ReadRingtoneFile(argv[2],&ringtone);
1307 Print_Error(error);
1308 ringtone.Location = 255;
1309 for (i=3;i<argc;i++) {
1310 switch (nextlong) {
1311 case 0:
1312 if (strcasecmp(argv[i],"-scale") == 0) {
1313 ringtone.NoteTone.AllNotesScale = TRUE;
1314 break;
1316 if (strcasecmp(argv[i],"-location") == 0) {
1317 nextlong = 1;
1318 break;
1320 if (strcasecmp(argv[i],"-name") == 0) {
1321 nextlong = 2;
1322 break;
1324 printf(_("Unknown parameter (\"%s\")"),argv[i]);
1325 Terminate(2);
1326 case 1:
1327 ringtone.Location=GetInt(argv[i]);
1328 nextlong = 0;
1329 break;
1330 case 2:
1331 EncodeUnicode(ringtone.Name,argv[i],strlen(argv[i]));
1332 nextlong = 0;
1333 break;
1336 if (nextlong!=0) {
1337 printf_err("%s\n", _("Parameter missing!"));
1338 Terminate(2);
1340 if (ringtone.Location==0) {
1341 printf_err("%s\n", _("Please enumerate locations from 1"));
1342 Terminate(1);
1345 GSM_Init(TRUE);
1346 error=GSM_SetRingtone(gsm, &ringtone, &i);
1347 Print_Error(error);
1348 GSM_Terminate();
1351 void ClearMemory(GSM_MemoryType type, const char *question)
1353 GSM_Error error;
1354 GSM_MemoryStatus MemStatus;
1355 GSM_MemoryEntry Pbk;
1356 gboolean DoClear;
1357 int i;
1359 DoClear = FALSE;
1360 MemStatus.MemoryType = type;
1361 error = GSM_GetMemoryStatus(gsm, &MemStatus);
1362 if (error == ERR_NONE && MemStatus.MemoryUsed !=0) {
1363 if (answer_yes("%s", question)) DoClear = TRUE;
1365 if (DoClear) {
1366 error = GSM_DeleteAllMemory(gsm, type);
1367 if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) {
1368 for (i = 0; i < MemStatus.MemoryUsed + MemStatus.MemoryFree; i++) {
1369 Pbk.MemoryType = type;
1370 Pbk.Location = i + 1;
1371 Pbk.EntriesNum = 0;
1372 error=GSM_DeleteMemory(gsm, &Pbk);
1373 Print_Error(error);
1374 fprintf(stderr, "\r");
1375 fprintf(stderr, "%s ", _("Deleting:"));
1376 fprintf(stderr, _("%i percent"),
1377 (i + 1) * 100 / (MemStatus.MemoryUsed + MemStatus.MemoryFree));
1378 if (gshutdown) {
1379 GSM_Terminate();
1380 Terminate(4);
1383 fprintf(stderr, "\n");
1384 } else {
1385 fprintf(stderr, "%s\n", _("Done"));
1386 Print_Error(error);
1392 void ClearAll(int argc UNUSED, char *argv[] UNUSED)
1394 GSM_ToDoStatus ToDoStatus;
1395 GSM_CalendarEntry Calendar;
1396 GSM_ToDoEntry ToDo;
1397 GSM_NoteEntry Note;
1398 GSM_WAPBookmark Bookmark;
1399 GSM_FMStation Station;
1400 gboolean DoClear;
1401 GSM_Error error;
1403 GSM_Init(TRUE);
1405 ClearMemory(MEM_ME, _("Delete phone phonebook?"));
1406 ClearMemory(MEM_SM, _("Delete SIM phonebook?"));
1407 ClearMemory(MEM_MC, _("Delete missed calls?"));
1408 ClearMemory(MEM_DC, _("Delete dialled calls?"));
1409 ClearMemory(MEM_RC, _("Delete received calls?"));
1411 DoClear = FALSE;
1412 error = GSM_GetNextCalendar(gsm,&Calendar,TRUE);
1413 if (error == ERR_NONE) {
1414 if (answer_yes("%s", _("Delete phone calendar notes?"))) DoClear = TRUE;
1416 if (DoClear) {
1417 fprintf(stderr, LISTFORMAT, _("Deleting"));
1418 error=GSM_DeleteAllCalendar(gsm);
1419 if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) {
1420 while (1) {
1421 error = GSM_GetNextCalendar(gsm,&Calendar,TRUE);
1422 if (error != ERR_NONE) break;
1423 error = GSM_DeleteCalendar(gsm,&Calendar);
1424 Print_Error(error);
1425 fprintf(stderr, "*");
1427 fprintf(stderr, "\n");
1428 fflush(stderr);
1429 } else {
1430 fprintf(stderr, "%s\n", _("Done"));
1431 Print_Error(error);
1435 DoClear = FALSE;
1436 error = GSM_GetToDoStatus(gsm,&ToDoStatus);
1437 if (error == ERR_NONE && ToDoStatus.Used != 0) {
1438 if (answer_yes("%s", _("Delete phone todos?"))) DoClear = TRUE;
1440 if (DoClear) {
1441 fprintf(stderr, LISTFORMAT, _("Deleting"));
1442 error=GSM_DeleteAllToDo(gsm);
1443 if (error == ERR_NOTSUPPORTED || error == ERR_NOTIMPLEMENTED) {
1444 while (1) {
1445 error = GSM_GetNextToDo(gsm,&ToDo,TRUE);
1446 if (error != ERR_NONE) break;
1447 error = GSM_DeleteToDo(gsm,&ToDo);
1448 Print_Error(error);
1449 fprintf(stderr, "*");
1451 fprintf(stderr, "\n");
1452 fflush(stderr);
1453 } else {
1454 fprintf(stderr, "%s\n", _("Done"));
1455 Print_Error(error);
1459 DoClear = FALSE;
1460 error = GSM_GetNotesStatus(gsm,&ToDoStatus);
1461 if (error == ERR_NONE && ToDoStatus.Used != 0) {
1462 if (answer_yes("%s", _("Delete phone notes?"))) DoClear = TRUE;
1464 if (DoClear) {
1465 fprintf(stderr, LISTFORMAT, _("Deleting"));
1466 while (1) {
1467 error = GSM_GetNextNote(gsm,&Note,TRUE);
1468 if (error != ERR_NONE) break;
1469 error = GSM_DeleteNote(gsm,&Note);
1470 Print_Error(error);
1471 fprintf(stderr, "*");
1473 fprintf(stderr, "\n");
1474 fflush(stderr);
1477 Bookmark.Location = 1;
1478 error = GSM_GetWAPBookmark(gsm,&Bookmark);
1479 if (error == ERR_NONE || error == ERR_INVALIDLOCATION) {
1480 if (answer_yes("%s", _("Delete phone WAP bookmarks?"))) {
1481 fprintf(stderr, LISTFORMAT, _("Deleting"));
1482 /* One thing to explain: DCT4 phones seems to have bug here.
1483 * When delete for example first bookmark, phone change
1484 * numeration for getting frame, not for deleting. So, we try to
1485 * get 1'st bookmark. Inside frame is "correct" location. We use
1486 * it later
1488 while (error==ERR_NONE) {
1489 error = GSM_DeleteWAPBookmark(gsm,&Bookmark);
1490 Bookmark.Location = 1;
1491 error = GSM_GetWAPBookmark(gsm,&Bookmark);
1492 fprintf(stderr, "*");
1494 fprintf(stderr, "\n");
1495 fflush(stderr);
1498 if (answer_yes("%s", _("Delete all phone user ringtones?"))) {
1499 fprintf(stderr, LISTFORMAT, _("Deleting"));
1500 error=GSM_DeleteUserRingtones(gsm);
1501 Print_Error(error);
1502 fprintf(stderr, "%s\n", _("Done"));
1504 Station.Location = 1;
1505 error=GSM_GetFMStation(gsm,&Station);
1506 if (error == ERR_NONE || error == ERR_EMPTY) {
1507 if (answer_yes("%s", _("Delete all phone FM radio stations?"))) {
1508 error=GSM_ClearFMStations(gsm);
1509 Print_Error(error);
1513 GSM_Terminate();
1516 void DisplayConnectionSettings(GSM_MultiWAPSettings *settings,int j)
1518 if (settings->Settings[j].IsContinuous) {
1519 printf(LISTFORMAT "%s\n", _("Connection type"), _("Continuous"));
1520 } else {
1521 printf(LISTFORMAT "%s\n", _("Connection type"), _("Temporary"));
1523 if (settings->Settings[j].IsSecurity) {
1524 printf(LISTFORMAT "%s\n", _("Connection security"), _("On"));
1525 } else {
1526 printf(LISTFORMAT "%s\n", _("Connection security"), _("Off"));
1528 printf(LISTFORMAT, _("Proxy"));
1529 printf(_("address \"%s\", port %i"), DecodeUnicodeConsole(settings->Proxy), settings->ProxyPort);
1530 printf("\n");
1531 printf(LISTFORMAT, _("Second proxy"));
1532 printf(_("address \"%s\", port %i"), DecodeUnicodeConsole(settings->Proxy2), settings->Proxy2Port);
1533 printf("\n");
1534 switch (settings->Settings[j].Bearer) {
1535 case WAPSETTINGS_BEARER_SMS:
1536 printf(LISTFORMAT "%s", _("Bearer"), _("SMS"));
1537 if (settings->ActiveBearer == WAPSETTINGS_BEARER_SMS) printf("%s", _(" (active)"));
1538 printf("\n");
1539 printf(LISTFORMAT "\"%s\"\n", _("Server number"),DecodeUnicodeConsole(settings->Settings[j].Server));
1540 printf(LISTFORMAT "\"%s\"\n", _("Service number"),DecodeUnicodeConsole(settings->Settings[j].Service));
1541 break;
1542 case WAPSETTINGS_BEARER_DATA:
1543 printf(LISTFORMAT "%s", _("Bearer"), _("Data (CSD)"));
1544 if (settings->ActiveBearer == WAPSETTINGS_BEARER_DATA) printf("%s", _(" (active)"));
1545 printf("\n");
1546 printf(LISTFORMAT "\"%s\"\n", _("Dial-up number"),DecodeUnicodeConsole(settings->Settings[j].DialUp));
1547 printf(LISTFORMAT "\"%s\"\n", _("IP address"),DecodeUnicodeConsole(settings->Settings[j].IPAddress));
1548 if (settings->Settings[j].ManualLogin) {
1549 printf(LISTFORMAT "%s\n", _("Login type"), _("Manual"));
1550 } else {
1551 printf(LISTFORMAT "%s\n", _("Login type"), _("Automatic"));
1553 if (settings->Settings[j].IsNormalAuthentication) {
1554 printf(LISTFORMAT "%s\n", _("Authentication type"), _("Normal"));
1555 } else {
1556 printf(LISTFORMAT "%s\n", _("Authentication type"), _("Secure"));
1558 if (settings->Settings[j].IsISDNCall) {
1559 printf(LISTFORMAT "%s\n", _("Data call type"), _("ISDN"));
1560 } else {
1561 printf(LISTFORMAT "%s\n", _("Data call type"), _("Analogue"));
1563 switch (settings->Settings[j].Speed) {
1564 case WAPSETTINGS_SPEED_9600 :
1565 printf(LISTFORMAT "%s\n", _("Data call speed"), "9600");
1566 break;
1567 case WAPSETTINGS_SPEED_14400 :
1568 printf(LISTFORMAT "%s\n", _("Data call speed"), "14400");
1569 break;
1570 case WAPSETTINGS_SPEED_AUTO :
1571 printf(LISTFORMAT "%s\n", _("Data call speed"), _("Auto"));
1572 break;
1574 printf(LISTFORMAT "\"%s\"\n", _("User name"),DecodeUnicodeConsole(settings->Settings[j].User));
1575 printf(LISTFORMAT "\"%s\"\n", _("Password"),DecodeUnicodeConsole(settings->Settings[j].Password));
1576 break;
1577 case WAPSETTINGS_BEARER_USSD:
1578 printf(LISTFORMAT "%s", _("Bearer"), _("USSD"));
1579 if (settings->ActiveBearer == WAPSETTINGS_BEARER_USSD) printf("%s", _(" (active)"));
1580 printf("\n");
1581 printf(LISTFORMAT "\"%s\"\n", _("Service code"),DecodeUnicodeConsole(settings->Settings[j].Code));
1582 if (settings->Settings[j].IsIP) {
1583 printf(LISTFORMAT "%s\n", _("Address type"), _("IP address"));
1584 printf(LISTFORMAT "%s\n", _("IP address"), DecodeUnicodeConsole(settings->Settings[j].Service));
1585 } else {
1586 printf(LISTFORMAT "%s\n", _("Address type"), _("Service number"));
1587 printf(LISTFORMAT "%s\n", _("Service number"), DecodeUnicodeConsole(settings->Settings[j].Service));
1589 break;
1590 case WAPSETTINGS_BEARER_GPRS:
1591 printf(LISTFORMAT "%s", _("Bearer"), _("GPRS"));
1592 if (settings->ActiveBearer == WAPSETTINGS_BEARER_GPRS) printf("%s", _(" (active)"));
1593 printf("\n");
1594 if (settings->Settings[j].ManualLogin) {
1595 printf(LISTFORMAT "%s\n", _("Login type"), _("Manual"));
1596 } else {
1597 printf(LISTFORMAT "%s\n", _("Login type"), _("Automatic"));
1599 if (settings->Settings[j].IsNormalAuthentication) {
1600 printf(LISTFORMAT "%s\n", _("Authentication type"), _("Normal"));
1601 } else {
1602 printf(LISTFORMAT "%s\n", _("Authentication type"), _("Secure"));
1604 printf(LISTFORMAT "\"%s\"\n", _("Access point"),DecodeUnicodeConsole(settings->Settings[j].DialUp));
1605 printf(LISTFORMAT "\"%s\"\n", _("IP address"),DecodeUnicodeConsole(settings->Settings[j].IPAddress));
1606 printf(LISTFORMAT "\"%s\"\n", _("User name"),DecodeUnicodeConsole(settings->Settings[j].User));
1607 printf(LISTFORMAT "\"%s\"\n", _("Password"),DecodeUnicodeConsole(settings->Settings[j].Password));
1611 void GetSyncMLSettings(int argc, char *argv[])
1613 GSM_SyncMLSettings settings;
1614 int start,stop,j,i;
1615 GSM_Error error;
1617 GetStartStop(&start, &stop, 2, argc, argv);
1619 GSM_Init(TRUE);
1621 for (i=start;i<=stop;i++) {
1622 settings.Location=i;
1623 error=GSM_GetSyncMLSettings(gsm,&settings);
1624 Print_Error(error);
1625 printf("%i. ", i);
1626 if (settings.Name[0]==0 && settings.Name[1]==0) {
1627 printf(_("Set %i"),i);
1628 } else {
1629 printf("%s", DecodeUnicodeConsole(settings.Name));
1631 if (settings.Active) printf("%s", _(" (active)"));
1632 printf("\n");
1633 printf(LISTFORMAT "\"%s\"\n", _("User"),DecodeUnicodeConsole(settings.User));
1634 printf(LISTFORMAT "\"%s\"\n", _("Password"),DecodeUnicodeConsole(settings.Password));
1635 printf(LISTFORMAT "\"%s\"\n", _("Phonebook database"),DecodeUnicodeConsole(settings.PhonebookDataBase));
1636 printf(LISTFORMAT "\"%s\"\n", _("Calendar database"),DecodeUnicodeConsole(settings.CalendarDataBase));
1637 printf(LISTFORMAT "\"%s\"\n", _("Server"),DecodeUnicodeConsole(settings.Server));
1638 printf(LISTFORMAT, _("Sync. phonebook"));
1639 if (settings.SyncPhonebook) printf("%s\n", _("enabled"));
1640 if (!settings.SyncPhonebook) printf("%s\n", _("disabled"));
1641 printf(LISTFORMAT, _("Sync. calendar"));
1642 if (settings.SyncCalendar) printf("%s\n", _("enabled"));
1643 if (!settings.SyncCalendar) printf("%s\n", _("disabled"));
1644 printf("\n");
1645 for (j=0;j<settings.Connection.Number;j++) {
1646 printf(LISTFORMAT, _("Connection set name"));
1647 if (settings.Connection.Settings[j].Title[0]==0 && settings.Connection.Settings[j].Title[1]==0) {
1648 printf(_("Set %i"),i);
1649 } else {
1650 printf("%s",DecodeUnicodeConsole(settings.Connection.Settings[j].Title));
1652 printf("\n");
1653 DisplayConnectionSettings(&settings.Connection,j);
1654 printf("\n");
1657 GSM_Terminate();
1660 void GetChatSettings(int argc, char *argv[])
1662 GSM_ChatSettings settings;
1663 int start,stop,j,i;
1664 GSM_Error error;
1666 GetStartStop(&start, &stop, 2, argc, argv);
1668 GSM_Init(TRUE);
1670 for (i=start;i<=stop;i++) {
1671 settings.Location=i;
1672 error=GSM_GetChatSettings(gsm,&settings);
1673 Print_Error(error);
1674 printf("%i. ",i);
1675 if (settings.Name[0]==0 && settings.Name[1]==0) {
1676 printf(_("Set %i"),i);
1677 } else {
1678 printf("%s", DecodeUnicodeConsole(settings.Name));
1680 if (settings.Active) printf("%s", _(" (active)"));
1681 printf("\n");
1682 printf(LISTFORMAT "\"%s\"\n", _("Homepage"),DecodeUnicodeConsole(settings.HomePage));
1683 printf(LISTFORMAT "\"%s\"\n", _("User"),DecodeUnicodeConsole(settings.User));
1684 printf(LISTFORMAT "\"%s\"\n", _("Password"),DecodeUnicodeConsole(settings.Password));
1685 printf("\n");
1686 for (j=0;j<settings.Connection.Number;j++) {
1687 printf(LISTFORMAT, _("Connection set name"));
1688 if (settings.Connection.Settings[j].Title[0]==0 && settings.Connection.Settings[j].Title[1]==0) {
1689 printf(_("Set %i"),i);
1690 } else {
1691 printf("%s",DecodeUnicodeConsole(settings.Connection.Settings[j].Title));
1693 DisplayConnectionSettings(&settings.Connection,j);
1694 printf("\n");
1697 GSM_Terminate();
1700 void GetWAPMMSSettings(int argc, char *argv[])
1702 GSM_MultiWAPSettings settings;
1703 int start,stop,j, i;
1704 GSM_Error error;
1706 GetStartStop(&start, &stop, 2, argc, argv);
1708 GSM_Init(TRUE);
1710 for (i=start;i<=stop;i++) {
1711 settings.Location=i;
1712 if (strcasestr(argv[1], "getwapsettings") != NULL) {
1713 error=GSM_GetWAPSettings(gsm,&settings);
1714 } else {
1715 error=GSM_GetMMSSettings(gsm,&settings);
1717 Print_Error(error);
1718 for (j=0;j<settings.Number;j++) {
1719 printf("%i. ", i);
1720 if (settings.Settings[j].Title[0]==0 && settings.Settings[j].Title[1]==0) {
1721 printf(_("Set %i"),i);
1722 } else {
1723 printf("%s", DecodeUnicodeConsole(settings.Settings[j].Title));
1725 if (settings.Active) {
1726 printf(" (%s)", _("active"));
1728 printf("\n");
1729 if (settings.ReadOnly) {
1730 printf(LISTFORMAT "%s\n", _("Read only"), _("yes"));
1732 printf(LISTFORMAT "\"%s\"\n", _("Homepage"),
1733 DecodeUnicodeConsole(settings.Settings[j].HomePage));
1734 DisplayConnectionSettings(&settings,j);
1735 printf("\n");
1738 GSM_Terminate();
1741 void CopyBitmap(int argc, char *argv[])
1743 GSM_MultiBitmap Bitmap;
1744 int i;
1745 GSM_Error error;
1747 Bitmap.Bitmap[0].Type = GSM_None;
1749 error=GSM_ReadBitmapFile(argv[2],&Bitmap);
1750 Print_Error(error);
1752 if (argc==3) {
1753 for (i=0;i<Bitmap.Number;i++) {
1754 switch (Bitmap.Bitmap[i].Type) {
1755 case GSM_StartupLogo : printf("%s", _("Startup logo")); break;
1756 case GSM_OperatorLogo: printf("%s", _("Operator logo")); break;
1757 case GSM_PictureImage: printf("%s", _("Picture")); break;
1758 case GSM_CallerGroupLogo : printf("%s", _("Caller group logo")); break;
1759 default : break;
1761 printf(_(", width %i, height %i\n"),
1762 (int)Bitmap.Bitmap[i].BitmapWidth,
1763 (int)Bitmap.Bitmap[i].BitmapHeight);
1764 GSM_PrintBitmap(stdout,&Bitmap.Bitmap[i]);
1766 } else {
1767 if (argc == 5) {
1768 for (i=0;i<Bitmap.Number;i++) {
1769 if (strcasecmp(argv[4],"PICTURE") == 0) {
1770 Bitmap.Bitmap[i].Type = GSM_PictureImage;
1771 } else if (strcasecmp(argv[4],"STARTUP") == 0) {
1772 Bitmap.Bitmap[i].Type = GSM_StartupLogo;
1773 } else if (strcasecmp(argv[4],"CALLER") == 0) {
1774 Bitmap.Bitmap[i].Type = GSM_CallerGroupLogo;
1775 } else if (strcasecmp(argv[4],"OPERATOR") == 0) {
1776 Bitmap.Bitmap[i].Type = GSM_OperatorLogo;
1777 } else {
1778 printf(_("What format of output file logo (\"%s\") ?\n"),argv[4]);
1779 Terminate(2);
1783 error=GSM_SaveBitmapFile(argv[3],&Bitmap);
1784 Print_Error(error);
1788 void CopyRingtone(int argc, char *argv[])
1790 GSM_Ringtone ringtone, ringtone2;
1791 GSM_RingtoneFormat Format;
1792 GSM_Error error;
1794 ringtone.Format = 0;
1795 error=GSM_ReadRingtoneFile(argv[2],&ringtone);
1796 Print_Error(error);
1798 Format = ringtone.Format;
1799 if (argc == 5) {
1800 if (strcasecmp(argv[4],"RTTL") == 0) { Format = RING_NOTETONE;
1801 } else if (strcasecmp(argv[4],"BINARY") == 0) { Format = RING_NOKIABINARY;
1802 } else {
1803 printf(_("What format of output ringtone file (\"%s\") ?\n"),argv[4]);
1804 Terminate(2);
1808 error=GSM_RingtoneConvert(&ringtone2,&ringtone,Format);
1809 Print_Error(error);
1811 error=GSM_SaveRingtoneFile(argv[3],&ringtone2);
1812 Print_Error(error);
1815 void PressKeySequence(int argc UNUSED, char *argv[])
1817 size_t i,Length;
1818 GSM_KeyCode KeyCode[500];
1819 GSM_Error error;
1821 error = MakeKeySequence(argv[2], KeyCode, &Length);
1822 if (error == ERR_NOTSUPPORTED) {
1823 printf(_("Unknown key/function name: \"%c\"\n"),argv[2][Length]);
1824 Terminate(2);
1827 GSM_Init(TRUE);
1829 for (i=0;i<Length;i++) {
1830 error=GSM_PressKey(gsm, KeyCode[i], TRUE);
1831 Print_Error(error);
1832 error=GSM_PressKey(gsm, KeyCode[i], FALSE);
1833 Print_Error(error);
1836 GSM_Terminate();
1839 void GetAllCategories(int argc UNUSED, char *argv[])
1841 GSM_Category Category;
1842 GSM_CategoryStatus Status;
1843 int j, count;
1844 GSM_Error error;
1846 if (strcasecmp(argv[2],"TODO") == 0) {
1847 Category.Type = Category_ToDo;
1848 Status.Type = Category_ToDo;
1849 } else if (strcasecmp(argv[2],"PHONEBOOK") == 0) {
1850 Category.Type = Category_Phonebook;
1851 Status.Type = Category_Phonebook;
1852 } else {
1853 printf(_("What type of categories do you want to get (\"%s\") ?\n"),argv[2]);
1854 Terminate(2);
1857 GSM_Init(TRUE);
1859 error=GSM_GetCategoryStatus(gsm, &Status);
1860 Print_Error(error);
1862 for (count=0,j=1;count<Status.Used;j++)
1864 Category.Location=j;
1865 error=GSM_GetCategory(gsm, &Category);
1867 if (error != ERR_EMPTY) {
1868 printf(LISTFORMAT "%i\n", _("Location"),j);
1870 Print_Error(error);
1872 printf(LISTFORMAT "\"%s\"\n\n", _("Name"),DecodeUnicodeConsole(Category.Name));
1873 count++;
1877 GSM_Terminate();
1880 void GetCategory(int argc, char *argv[])
1882 GSM_Category Category;
1883 int start,stop,j;
1884 GSM_Error error;
1886 if (strcasecmp(argv[2],"TODO") == 0) {
1887 Category.Type = Category_ToDo;
1888 } else if (strcasecmp(argv[2],"PHONEBOOK") == 0) {
1889 Category.Type = Category_Phonebook;
1890 } else {
1891 printf(_("What type of categories do you want to get (\"%s\") ?\n"),argv[2]);
1892 Terminate(2);
1895 GetStartStop(&start, &stop, 2, argc - 1, argv + 1);
1897 GSM_Init(TRUE);
1899 for (j=start;j<=stop;j++)
1901 printf(LISTFORMAT "%i\n", _("Location"),j);
1903 Category.Location=j;
1905 error=GSM_GetCategory(gsm, &Category);
1906 if (error != ERR_EMPTY) Print_Error(error);
1908 if (error == ERR_EMPTY) {
1909 printf("%s\n", _("Entry is empty"));
1910 } else {
1911 printf(LISTFORMAT "\"%s\"\n\n", _("Name"),DecodeUnicodeConsole(Category.Name));
1915 GSM_Terminate();
1918 void AddCategory(int argc UNUSED, char *argv[])
1920 GSM_Category Category;
1921 int Length;
1922 GSM_Error error;
1924 if (strcasecmp(argv[2],"TODO") == 0) {
1925 Category.Type = Category_ToDo;
1926 } else if (strcasecmp(argv[2],"PHONEBOOK") == 0) {
1927 Category.Type = Category_Phonebook;
1928 } else {
1929 printf(_("What type of category do you want to add (\"%s\") ?\n"),argv[2]);
1930 Terminate(2);
1933 GSM_Init(TRUE);
1935 Length = strlen(argv[3]);
1936 if (Length > GSM_MAX_CATEGORY_NAME_LENGTH) {
1937 printf(_("Text too long, truncating to %d chars!\n"), GSM_MAX_CATEGORY_NAME_LENGTH);
1938 Length = GSM_MAX_CATEGORY_NAME_LENGTH;
1940 EncodeUnicode(Category.Name, argv[3], Length);
1942 Category.Location = 0;
1944 error = GSM_AddCategory(gsm, &Category);
1946 Print_Error(error);
1948 GSM_Terminate();
1951 void GetSecurityStatus(int argc UNUSED, char *argv[] UNUSED)
1953 GSM_Init(TRUE);
1955 PrintSecurityStatus();
1957 GSM_Terminate();
1960 void EnterSecurityCode(int argc UNUSED, char *argv[])
1962 GSM_SecurityCode Code;
1963 GSM_Error error;
1964 char message[200];
1965 #ifdef HAVE_GETPASS
1966 char *pass;
1967 #endif
1969 if (strcasecmp(argv[2],"PIN") == 0) { Code.Type = SEC_Pin;
1970 } else if (strcasecmp(argv[2],"PUK") == 0) { Code.Type = SEC_Puk;
1971 } else if (strcasecmp(argv[2],"PIN2") == 0) { Code.Type = SEC_Pin2;
1972 } else if (strcasecmp(argv[2],"PUK2") == 0) { Code.Type = SEC_Puk2;
1973 } else if (strcasecmp(argv[2],"PHONE") == 0) { Code.Type = SEC_Phone;
1974 } else if (strcasecmp(argv[2],"NETWORK") == 0) { Code.Type = SEC_Network;
1975 } else {
1976 printf_err("%s: %s\n", _("Invalid security code type"), argv[2]);
1977 Terminate(2);
1980 if (strcmp(argv[3], "-") == 0) {
1981 sprintf(message, _("Enter %s code: "), argv[2]);
1982 #ifdef HAVE_GETPASS
1983 pass = getpass(message);
1984 strcpy(Code.Code, pass);
1985 #else
1986 /* Read code from stdin */
1987 #ifdef HAVE_UNISTD_H
1988 if (isatty(fileno(stdin))) {
1989 printf("%s", message);
1991 #endif
1992 if (fscanf(stdin, "%15s", Code.Code) != 1) {
1993 printf_err("%s\n", _("No PIN code entered!"));
1994 Terminate(2);
1996 #endif
1997 } else {
1998 strcpy(Code.Code,argv[3]);
2001 if (argc >= 5) {
2002 if (strcmp(argv[4], "-") == 0) {
2003 sprintf(message, _("Enter new PIN code: "));
2004 #ifdef HAVE_GETPASS
2005 pass = getpass(message);
2006 strcpy(Code.Code, pass);
2007 #else
2008 /* Read code from stdin */
2009 #ifdef HAVE_UNISTD_H
2010 if (isatty(fileno(stdin))) {
2011 printf("%s", message);
2013 #endif
2014 if (fscanf(stdin, "%15s", Code.Code) != 1) {
2015 printf_err("%s\n", _("No PIN code entered!"));
2016 Terminate(2);
2018 #endif
2019 } else {
2020 strcpy(Code.NewPIN, argv[4]);
2022 } else {
2023 Code.NewPIN[0] = 0;
2026 GSM_Init(TRUE);
2028 error=GSM_EnterSecurityCode(gsm, &Code);
2029 Print_Error(error);
2031 GSM_Terminate();
2034 void GetProfile(int argc, char *argv[])
2036 GSM_Profile Profile;
2037 int start,stop,i,j,k;
2038 GSM_Bitmap caller[5];
2039 gboolean callerinit[5],special;
2040 GSM_AllRingtonesInfo Info = {0, NULL};
2041 const unsigned char *ringtonename;
2042 GSM_Error error;
2044 GetStartStop(&start, &stop, 2, argc, argv);
2046 for (i=0;i<5;i++) callerinit[i] = FALSE;
2048 GSM_Init(TRUE);
2050 error=GSM_GetRingtonesInfo(gsm,&Info);
2051 if (error != ERR_NONE) Info.Number = 0;
2053 for (i=start;i<=stop;i++) {
2054 Profile.Location=i;
2055 error=GSM_GetProfile(gsm,&Profile);
2056 if (error != ERR_NONE && Info.Ringtone) free(Info.Ringtone);
2057 Print_Error(error);
2059 printf("%i. \"%s\"",i,DecodeUnicodeConsole(Profile.Name));
2060 if (Profile.Active) printf("%s", _(" (active)"));
2061 if (Profile.DefaultName) printf("%s", _(" (default name)"));
2062 if (Profile.HeadSetProfile) printf("%s", _(" (Head set profile)"));
2063 if (Profile.CarKitProfile) printf("%s", _(" (Car kit profile)"));
2064 printf("\n");
2065 for (j=0;j<Profile.FeaturesNumber;j++) {
2066 special = FALSE;
2067 switch (Profile.FeatureID[j]) {
2068 case Profile_MessageToneID:
2069 case Profile_RingtoneID:
2070 special = TRUE;
2071 if (Profile.FeatureID[j] == Profile_RingtoneID) {
2072 printf(LISTFORMAT, _("Ringtone ID"));
2073 } else {
2074 printf(LISTFORMAT, _("Message alert tone ID"));
2076 ringtonename = GSM_GetRingtoneName(&Info, Profile.FeatureValue[j]);
2077 if (ringtonename != NULL) {
2078 /* l10n: Ringtone name and ID format */
2079 printf(_("\"%s\" (ID %i)\n"), DecodeUnicodeConsole(ringtonename), Profile.FeatureValue[j]);
2080 } else {
2081 /* l10n: Ringtone ID format */
2082 printf(_("ID %i\n"), Profile.FeatureValue[j]);
2084 break;
2085 case Profile_CallerGroups:
2086 special = TRUE;
2087 printf(LISTFORMAT, _("Call alert for"));
2088 for (k=0;k<5;k++) {
2089 if (Profile.CallerGroups[k]) {
2090 if (!callerinit[k]) {
2091 caller[k].Type = GSM_CallerGroupLogo;
2092 caller[k].Location = k + 1;
2093 error=GSM_GetBitmap(gsm,&caller[k]);
2094 if (error == ERR_SECURITYERROR) {
2095 NOKIA_GetDefaultCallerGroupName(&caller[k]);
2096 } else {
2097 Print_Error(error);
2099 callerinit[k] = TRUE;
2101 printf(" \"%s\"",DecodeUnicodeConsole(caller[k].Text));
2104 printf("\n");
2105 break;
2106 case Profile_ScreenSaverNumber:
2107 special = TRUE;
2108 printf(LISTFORMAT, _("Screen saver number"));
2109 printf("%i\n",Profile.FeatureValue[j]);
2110 break;
2111 case Profile_CallAlert : printf(LISTFORMAT, _("Incoming call alert")); break;
2112 case Profile_RingtoneVolume : printf(LISTFORMAT, _("Ringtone volume")); break;
2113 case Profile_Vibration : printf(LISTFORMAT, _("Vibrating alert")); break;
2114 case Profile_MessageTone : printf(LISTFORMAT, _("Message alert tone")); break;
2115 case Profile_KeypadTone : printf(LISTFORMAT, _("Keypad tones")); break;
2116 case Profile_WarningTone : printf(LISTFORMAT, _("Warning (games) tones")); break;
2117 case Profile_ScreenSaver : printf(LISTFORMAT, _("Screen saver")); break;
2118 case Profile_ScreenSaverTime : printf(LISTFORMAT, _("Screen saver timeout")); break;
2119 case Profile_AutoAnswer : printf(LISTFORMAT, _("Automatic answer")); break;
2120 case Profile_Lights : printf(LISTFORMAT, _("Lights")); break;
2121 default:
2122 printf("%s\n", _("Unknown"));
2123 special = TRUE;
2125 if (!special) {
2126 switch (Profile.FeatureValue[j]) {
2127 case PROFILE_VOLUME_LEVEL1 :
2128 case PROFILE_KEYPAD_LEVEL1 : printf("%s\n", _("Level 1")); break;
2129 case PROFILE_VOLUME_LEVEL2 :
2130 case PROFILE_KEYPAD_LEVEL2 : printf("%s\n", _("Level 2")); break;
2131 case PROFILE_VOLUME_LEVEL3 :
2132 case PROFILE_KEYPAD_LEVEL3 : printf("%s\n", _("Level 3")); break;
2133 case PROFILE_VOLUME_LEVEL4 : printf("%s\n", _("Level 4")); break;
2134 case PROFILE_VOLUME_LEVEL5 : printf("%s\n", _("Level 5")); break;
2135 case PROFILE_MESSAGE_NOTONE :
2136 case PROFILE_AUTOANSWER_OFF :
2137 case PROFILE_LIGHTS_OFF :
2138 case PROFILE_SAVER_OFF :
2139 case PROFILE_WARNING_OFF :
2140 case PROFILE_CALLALERT_OFF :
2141 case PROFILE_VIBRATION_OFF :
2142 case PROFILE_KEYPAD_OFF : printf("%s\n", _("Off")); break;
2143 case PROFILE_CALLALERT_RINGING : printf("%s\n", _("Ringing")); break;
2144 case PROFILE_CALLALERT_BEEPONCE :
2145 case PROFILE_MESSAGE_BEEPONCE : printf("%s\n", _("Beep once")); break;
2146 case PROFILE_CALLALERT_RINGONCE : printf("%s\n", _("Ring once")); break;
2147 case PROFILE_CALLALERT_ASCENDING : printf("%s\n", _("Ascending")); break;
2148 case PROFILE_CALLALERT_CALLERGROUPS : printf("%s\n", _("Caller groups")); break;
2149 case PROFILE_MESSAGE_STANDARD : printf("%s\n", _("Standard")); break;
2150 case PROFILE_MESSAGE_SPECIAL : printf("%s\n", _("Special")); break;
2151 case PROFILE_MESSAGE_ASCENDING : printf("%s\n", _("Ascending")); break;
2152 case PROFILE_MESSAGE_PERSONAL : printf("%s\n", _("Personal")); break;
2153 case PROFILE_AUTOANSWER_ON :
2154 case PROFILE_WARNING_ON :
2155 case PROFILE_SAVER_ON :
2156 case PROFILE_VIBRATION_ON : printf("%s\n", _("On")); break;
2157 case PROFILE_VIBRATION_FIRST : printf("%s\n", _("Vibrate first")); break;
2158 case PROFILE_LIGHTS_AUTO : printf("%s\n", _("Auto")); break;
2159 case PROFILE_SAVER_TIMEOUT_5SEC : PRINTSECONDS(5); printf("\n"); break;
2160 case PROFILE_SAVER_TIMEOUT_20SEC : PRINTSECONDS(20); printf("\n"); break;
2161 case PROFILE_SAVER_TIMEOUT_1MIN : PRINTMINUTES(1); printf("\n"); break;
2162 case PROFILE_SAVER_TIMEOUT_2MIN : PRINTMINUTES(2); printf("\n"); break;
2163 case PROFILE_SAVER_TIMEOUT_5MIN : PRINTMINUTES(5); printf("\n"); break;
2164 case PROFILE_SAVER_TIMEOUT_10MIN : PRINTMINUTES(10); printf("\n"); break;
2165 default : printf("%s\n", _("Unknown"));
2169 printf("\n");
2172 GSM_Terminate();
2174 if (Info.Ringtone) free(Info.Ringtone);
2177 void GetSpeedDial(int argc, char *argv[])
2179 GSM_SpeedDial SpeedDial;
2180 GSM_MemoryEntry Phonebook;
2181 int start,stop,Name,Number,Group,i;
2182 GSM_Error error;
2184 GetStartStop(&start, &stop, 2, argc, argv);
2186 GSM_Init(TRUE);
2188 for (i=start;i<=stop;i++) {
2189 SpeedDial.Location=i;
2190 error=GSM_GetSpeedDial(gsm,&SpeedDial);
2191 printf(LISTFORMAT "%i\n", _("Location"), i);
2192 switch (error) {
2193 case ERR_EMPTY:
2194 printf("%s\n", _(" speed dial not assigned"));
2195 break;
2196 default:
2197 Print_Error(error);
2199 Phonebook.Location = SpeedDial.MemoryLocation;
2200 Phonebook.MemoryType = SpeedDial.MemoryType;
2201 error = GSM_GetMemory(gsm,&Phonebook);
2202 Print_Error(error);
2204 GSM_PhonebookFindDefaultNameNumberGroup(&Phonebook, &Name, &Number, &Group);
2206 if (Name != -1) printf(LISTFORMAT "\"%s\"\n", _("Name"), DecodeUnicodeConsole(Phonebook.Entries[Name].Text));
2207 printf(LISTFORMAT "\"%s\"\"", _("Number"), DecodeUnicodeConsole(Phonebook.Entries[SpeedDial.MemoryNumberID-1].Text));
2209 printf("\n");
2212 GSM_Terminate();
2215 void ResetPhoneSettings(int argc UNUSED, char *argv[])
2217 GSM_ResetSettingsType Type;
2218 GSM_Error error;
2220 if (strcasecmp(argv[2],"PHONE") == 0) { Type = GSM_RESET_PHONESETTINGS;
2221 } else if (strcasecmp(argv[2],"UIF") == 0) { Type = GSM_RESET_USERINTERFACE;
2222 } else if (strcasecmp(argv[2],"ALL") == 0) { Type = GSM_RESET_USERINTERFACE_PHONESETTINGS;
2223 } else if (strcasecmp(argv[2],"DEV") == 0) { Type = GSM_RESET_DEVICE;
2224 } else if (strcasecmp(argv[2],"FACTORY") == 0) { Type = GSM_RESET_FULLFACTORY;
2225 } else {
2226 printf(_("What type of reset phone settings (\"%s\") ?\n"),argv[2]);
2227 Terminate(2);
2230 GSM_Init(TRUE);
2232 error=GSM_ResetPhoneSettings(gsm,Type);
2233 Print_Error(error);
2235 GSM_Terminate();
2238 void SendDTMF(int argc UNUSED, char *argv[])
2240 GSM_Error error;
2241 GSM_Init(TRUE);
2243 error=GSM_SendDTMF(gsm,argv[2]);
2244 Print_Error(error);
2246 GSM_Terminate();
2249 void GetDisplayStatus(int argc UNUSED, char *argv[] UNUSED)
2251 GSM_Error error;
2252 GSM_DisplayFeatures Features;
2253 int i;
2255 GSM_Init(TRUE);
2257 error=GSM_GetDisplayStatus(gsm,&Features);
2258 Print_Error(error);
2260 printf(LISTFORMAT "\n", _("Currently shown on the display"));
2262 for (i = 0; i < Features.Number; i++) {
2263 switch(Features.Feature[i]) {
2264 case GSM_CallActive:
2265 printf("%s\n", _("Call active"));
2266 break;
2267 case GSM_UnreadSMS:
2268 printf("%s\n", _("Unread SMS"));
2269 break;
2270 case GSM_VoiceCall:
2271 printf("%s\n", _("Voice call"));
2272 break;
2273 case GSM_FaxCall:
2274 printf("%s\n", _("Fax call"));
2275 break;
2276 case GSM_DataCall:
2277 printf("%s\n", _("Data call"));
2278 break;
2279 case GSM_KeypadLocked:
2280 printf("%s\n", _("Keypad locked"));
2281 break;
2282 case GSM_SMSMemoryFull:
2283 printf("%s\n", _("SMS memory full"));
2284 break;
2288 GSM_Terminate();
2291 void SetAutoNetworkLogin(int argc UNUSED, char *argv[] UNUSED)
2293 GSM_Error error;
2294 GSM_Init(TRUE);
2296 error=GSM_SetAutoNetworkLogin(gsm);
2297 Print_Error(error);
2299 GSM_Terminate();
2302 void GetFMStation(int argc, char *argv[])
2304 GSM_FMStation Station;
2305 int start,stop,i;
2306 GSM_Error error;
2308 GetStartStop(&start, &stop, 2, argc, argv);
2310 GSM_Init(TRUE);
2312 for (i=start;i<=stop;i++) {
2313 Station.Location=i;
2314 error=GSM_GetFMStation(gsm,&Station);
2315 printf(LISTFORMAT "%i\n", _("Location"), i);
2316 switch (error) {
2317 case ERR_EMPTY:
2318 printf("%s\n", _("Entry is empty"));
2319 break;
2320 case ERR_NONE:
2321 printf(LISTFORMAT "\"%s\"\n", _("Station name"), DecodeUnicodeConsole(Station.StationName));
2322 printf(LISTFORMAT "%.1f MHz\n", _("Frequency"), Station.Frequency);
2323 break;
2324 default:
2325 Print_Error(error);
2328 GSM_Terminate();
2331 void CallDivert(int argc, char *argv[])
2333 GSM_Error error;
2334 GSM_MultiCallDivert cd;
2335 gboolean get = FALSE;
2336 int i;
2338 if (strcasecmp("get", argv[2]) == 0) {
2339 get = TRUE;
2340 } else if (strcasecmp("set", argv[2]) == 0) {
2341 get = FALSE;
2342 } else {
2343 printf(_("Unknown divert action (\"%s\")\n"), argv[2]);
2344 Terminate(2);
2347 if (strcasecmp("all", argv[3]) == 0) {
2348 cd.Request.DivertType = GSM_DIVERT_AllTypes;
2349 } else if (strcasecmp("busy", argv[3]) == 0) {
2350 cd.Request.DivertType = GSM_DIVERT_Busy;
2351 } else if (strcasecmp("noans", argv[3]) == 0) {
2352 cd.Request.DivertType = GSM_DIVERT_NoAnswer;
2353 } else if (strcasecmp("outofreach", argv[3]) == 0) {
2354 cd.Request.DivertType = GSM_DIVERT_OutOfReach;
2355 } else {
2356 printf(_("Unknown divert type (\"%s\")\n"), argv[3]);
2357 Terminate(2);
2360 if (strcasecmp("all", argv[4]) == 0) {
2361 cd.Request.CallType = GSM_DIVERT_AllCalls;
2362 } else if (strcasecmp("voice", argv[4]) == 0) {
2363 cd.Request.CallType = GSM_DIVERT_VoiceCalls;
2364 } else if (strcasecmp("fax", argv[4]) == 0) {
2365 cd.Request.CallType = GSM_DIVERT_FaxCalls;
2366 } else if (strcasecmp("data", argv[4]) == 0) {
2367 cd.Request.CallType = GSM_DIVERT_DataCalls;
2368 } else {
2369 printf(_("Unknown call type (\"%s\")\n"), argv[4]);
2370 Terminate(2);
2373 GSM_Init(TRUE);
2375 if (get) {
2376 error = GSM_GetCallDivert(gsm,&cd);
2377 Print_Error(error);
2378 printf("%s", _("Query:"));
2379 printf("\n");
2380 printf(" " LISTFORMAT, _("Divert type"));
2381 } else {
2382 cd.Request.Number[0] = 0;
2383 cd.Request.Number[1] = 0;
2384 if (argc > 5) {
2385 EncodeUnicode(cd.Request.Number,argv[5],strlen(argv[5]));
2388 cd.Request.Timeout = 0;
2389 if (argc > 6) {
2390 cd.Request.Timeout = GetInt(argv[6]);
2393 error = GSM_SetCallDivert(gsm,&cd);
2394 Print_Error(error);
2395 printf("%s", _("Changed:"));
2396 printf("\n");
2397 printf(" " LISTFORMAT, _("Divert type"));
2400 switch (cd.Request.DivertType) {
2401 case GSM_DIVERT_Busy:
2402 printf("%s", _("when busy"));
2403 break;
2404 case GSM_DIVERT_NoAnswer:
2405 printf("%s", _("when not answered"));
2406 break;
2407 case GSM_DIVERT_OutOfReach:
2408 printf("%s", _("when phone off or no coverage"));
2409 break;
2410 case GSM_DIVERT_AllTypes:
2411 printf("%s", _("all types of diverts"));
2412 break;
2413 default:
2414 printf(_("unknown %i"),cd.Request.DivertType);
2415 break;
2417 printf("\n");
2419 printf(" " LISTFORMAT, _("Call type"));
2420 switch (cd.Request.CallType) {
2421 case GSM_DIVERT_VoiceCalls:
2422 printf("%s", _("voice"));
2423 break;
2424 case GSM_DIVERT_FaxCalls:
2425 printf("%s", _("fax"));
2426 break;
2427 case GSM_DIVERT_DataCalls:
2428 printf("%s", _("data"));
2429 break;
2430 case GSM_DIVERT_AllCalls:
2431 printf("%s", _("data & fax & voice"));
2432 break;
2433 default:
2434 printf(_("unknown %i"),cd.Request.CallType);
2435 break;
2437 printf("\n");
2439 printf("%s", _("Response:"));
2440 printf("\n");
2442 for (i = 0; i < cd.Response.EntriesNum; i++) {
2443 printf("\n");
2444 printf(" " LISTFORMAT, _("Call type"));
2445 switch (cd.Response.Entries[i].CallType) {
2446 case GSM_DIVERT_VoiceCalls:
2447 printf("%s", _("voice"));
2448 break;
2449 case GSM_DIVERT_FaxCalls:
2450 printf("%s", _("fax"));
2451 break;
2452 case GSM_DIVERT_DataCalls:
2453 printf("%s", _("data"));
2454 break;
2455 default:
2456 printf(_("unknown %i"),cd.Response.Entries[i].CallType);
2457 break;
2459 printf("\n");
2461 printf(" " LISTFORMAT, _("Timeout"));
2462 PRINTSECONDS(cd.Response.Entries[i].Timeout);
2463 printf("\n");
2465 printf(" " LISTFORMAT "%s\n", _("Number"), DecodeUnicodeString(cd.Response.Entries[i].Number));
2467 printf("\n");
2469 GSM_Terminate();
2472 void CancelAllDiverts(int argc UNUSED, char *argv[] UNUSED)
2474 GSM_Error error;
2475 GSM_Init(TRUE);
2477 error = GSM_CancelAllDiverts(gsm);
2478 Print_Error(error);
2480 GSM_Terminate();
2483 void Install(int argc UNUSED, char *argv[] UNUSED)
2485 GSM_Error error;
2487 GSM_Init(FALSE);
2489 /* TODO: make search path configurable */
2490 error = GSM_Install(gsm, INI_GetValue(cfg, "gammu", "datapath", FALSE));
2491 Print_Error(error);
2493 printf("%s\n", _("The application has been successfully sent to the phone."));
2494 printf("%s\n", _("Please find received files in Inbox and install them."));
2496 GSM_Terminate();
2499 /* How should editor hadle tabs in this file? Add editor commands here.
2500 * vim: noexpandtab sw=8 ts=8 sts=8: