Gammu internals  1.38.0
dummy.c
Go to the documentation of this file.
1 /* Copyright (c) 2009 by Michal Čihař */
2 
30 #include "../../gsmstate.h"
31 
32 #include <string.h>
33 #include <time.h>
34 #include <errno.h>
35 #include <sys/types.h>
36 #include <sys/stat.h>
37 #ifdef WIN32
38 #include <direct.h>
39 #endif
40 
41 #include "../../gsmcomon.h"
42 #include "../../misc/coding/coding.h"
43 #include "../../misc/locales.h"
44 #include "../../misc/misc.h"
45 #include "../pfunc.h"
46 #include "dummy.h"
47 #include "../../../helper/string.h"
48 
49 #ifdef WIN32
50 #define MKDIR(dir) _mkdir(dir)
51 #ifndef S_ISDIR
52 #define S_ISDIR(mode) ((mode & _S_IFDIR) == _S_IFDIR)
53 #endif
54 #include "../../../helper/win32-dirent.h"
55 #else
56 #define MKDIR(dir) mkdir(dir, 0755)
57 #include <dirent.h>
58 #endif
59 
60 GSM_Error DUMMY_Error(GSM_StateMachine *s, const char *message, const char *path)
61 {
62  int tmp_errno;
63  tmp_errno = errno;
64  smprintf(s, "Filesystem path: %s\n", path);
65  GSM_OSErrorInfo(s, message);
66  if (tmp_errno == ENOENT) {
67  return ERR_EMPTY;
68  } else if (tmp_errno == EACCES) {
69  return ERR_PERMISSION;
70  } else if (tmp_errno == EEXIST) {
71  return ERR_FILEALREADYEXIST;
72  } else {
73  return ERR_UNKNOWN;
74  }
75 }
76 
77 char * DUMMY_GetFilePath(GSM_StateMachine *s, const char *filename)
78 {
79  char *log_file=NULL;
81 
82  log_file = (char *)malloc(strlen(filename) + Priv->devlen + 2);
83 
84  strcpy(log_file, s->CurrentConfig->Device);
85  strcat(log_file, "/");
86  strcat(log_file, filename);
87 
88  return log_file;
89 }
90 
91 char * DUMMY_GetFSFilePath(GSM_StateMachine *s, const unsigned char *fullname)
92 {
93  char *path=NULL;
94  char *filename=NULL;
96 
97  filename = DecodeUnicodeString(fullname);
98 
99  path = (char *)malloc(strlen(filename) + Priv->devlen + 5);
100 
101  strcpy(path, s->CurrentConfig->Device);
102  strcat(path, "/fs/");
103  strcat(path, filename);
104 
105  return path;
106 }
107 
108 char * DUMMY_GetFSPath(GSM_StateMachine *s, const char *filename, int depth)
109 {
110  char *path=NULL;
112 
113  path = (char *)malloc(strlen(filename) + strlen(Priv->dirnames[depth]) + 2);
114 
115  strcpy(path, Priv->dirnames[depth]);
116  strcat(path, "/");
117  strcat(path, filename);
118 
119  return path;
120 }
121 
122 int DUMMY_GetCount(GSM_StateMachine *s, const char *dirname)
123 {
124  char *full_name=NULL;
125  int i=0;
126  FILE *f;
127  int count = 0;
128 
130  full_name = (char *)malloc(strlen(dirname) + Priv->devlen + 20);
131 
132  for (i = 1; i <= DUMMY_MAX_LOCATION; i++) {
133  sprintf(full_name, "%s/%s/%d", s->CurrentConfig->Device, dirname, i);
134  f = fopen(full_name, "r");
135  if (f == NULL) continue;
136  count++;
137  fclose(f);
138  }
139  free(full_name);
140  full_name=NULL;
141  return count;
142 }
143 
145 {
146  char *full_name=NULL;
147  int i=0;
148 
150  full_name = (char *)malloc(strlen(dirname) + Priv->devlen + 20);
151 
152  for (i = 1; i <= DUMMY_MAX_LOCATION; i++) {
153  sprintf(full_name, "%s/%s/%d", s->CurrentConfig->Device, dirname, i);
154  /* @todo TODO: Maybe we should check error code here? */
155  unlink(full_name);
156  }
157  free(full_name);
158  full_name=NULL;
159  return ERR_NONE;
160 }
161 
162 int DUMMY_GetFirstFree(GSM_StateMachine *s, const char *dirname)
163 {
164  char *full_name=NULL;
165  int i=0;
166  FILE *f;
167 
169  full_name = (char *)malloc(strlen(dirname) + Priv->devlen + 20);
170 
171  for (i = 1; i <= DUMMY_MAX_LOCATION; i++) {
172  sprintf(full_name, "%s/%s/%d", s->CurrentConfig->Device, dirname, i);
173  f = fopen(full_name, "r");
174 
175  if (f == NULL) {
176  free(full_name);
177  full_name=NULL;
178  return i;
179  }
180  fclose(f);
181  }
182  free(full_name);
183  full_name=NULL;
184  return -1;
185 }
186 
187 int DUMMY_GetNext(GSM_StateMachine *s, const char *dirname, int current)
188 {
189  char *full_name=NULL;
190  int i=0;
191  FILE *f;
192 
194  full_name = (char *)malloc(strlen(dirname) + Priv->devlen + 20);
195 
196  for (i = current + 1; i <= DUMMY_MAX_LOCATION; i++) {
197  sprintf(full_name, "%s/%s/%d", s->CurrentConfig->Device, dirname, i);
198  f = fopen(full_name, "r");
199  if (f != NULL) {
200  fclose(f);
201  free(full_name);
202  full_name=NULL;
203  return i;
204  }
205  }
206  free(full_name);
207  full_name=NULL;
208  return -1;
209 }
210 
212 {
213  char smspath[100]={0};
214 
215  gboolean setfolder = (sms->Folder == 0);
216 
217  while (sms->Location >= DUMMY_MAX_SMS) {
218  sms->Location -= DUMMY_MAX_SMS;
219  if (setfolder) {
220  sms->Folder++;
221  }
222  }
223 
224  sprintf(smspath, "sms/%d/%d", sms->Folder, sms->Location);
225  return DUMMY_GetFilePath(s, smspath);
226 }
227 
229 {
230  char path[100];
231  sprintf(path, "pbk/%s/%d", GSM_MemoryTypeToString(entry->MemoryType), entry->Location);
232  return DUMMY_GetFilePath(s, path);
233 }
234 
236 {
237  char path[100];
238  sprintf(path, "todo/%d", entry->Location);
239  return DUMMY_GetFilePath(s, path);
240 }
241 
243 {
244  char path[100];
245  sprintf(path, "note/%d", entry->Location);
246  return DUMMY_GetFilePath(s, path);
247 }
248 
250 {
251  char path[100];
252  sprintf(path, "calendar/%d", entry->Location);
253  return DUMMY_GetFilePath(s, path);
254 }
255 
257 {
258  char path[100];
259  sprintf(path, "alarm/%d", entry->Location);
260  return DUMMY_GetFilePath(s, path);
261 }
262 
267 {
269  char *log_file, *path;
270  const char * const paths[] = {
271  "fs",
272  "fs/incoming",
273  "sms",
274  "sms/1",
275  "sms/2",
276  "sms/3",
277  "sms/4",
278  "sms/5",
279  "pbk",
280  "pbk/ME",
281  "pbk/SM",
282  "pbk/MC",
283  "pbk/RC",
284  "pbk/DC",
285  "note",
286  "todo",
287  "calendar",
288  "alarm",
289  };
290  size_t i;
291 
292  Priv->devlen = strlen(s->CurrentConfig->Device);
293 
294  log_file = DUMMY_GetFilePath(s, "operations.log");
295 
296  smprintf(s, "Log file %s\n", log_file);
297 
298  /* Create some directories we might need */
299  for (i = 0; i < sizeof(paths) / sizeof(char *); i++) {
300  path = DUMMY_GetFilePath(s, paths[i]);
301  if (MKDIR(path) != 0 && errno != EEXIST) {
302  smprintf(s, "Failed to create directory: %s\n", path);
303  free(path);
304  free(log_file);
305  return ERR_DEVICENOPERMISSION;
306  }
307  free(path);
308  }
309 
310  for (i = 0; i <= DUMMY_MAX_FS_DEPTH; i++) {
311  Priv->dir[i] = NULL;
312  }
313  Priv->fs_depth = 0;
314  Priv->log_file = fopen(log_file, "w");
315  free(log_file);
316  log_file=NULL;
317 
318  if (Priv->log_file == NULL) {
319  i = errno;
320  GSM_OSErrorInfo(s, "Failed to open log");
321  if (i == ENOENT) return ERR_DEVICENOTEXIST; /* no such file or directory */
322  if (i == EACCES) return ERR_DEVICENOPERMISSION; /* permission denied */
323  return ERR_DEVICEOPENERROR;
324  }
325 
326  strcpy(s->Phone.Data.IMEI, "999999999999999");
327  strcpy(s->Phone.Data.Manufacturer, "Gammu");
328  strcpy(s->Phone.Data.Model, "Dummy");
329  strcpy(s->Phone.Data.Version, GAMMU_VERSION);
330  strcpy(s->Phone.Data.VerDate, "20150101");
331 
332  EncodeUnicode(Priv->SMSC.Number, "123456", 6);
333  EncodeUnicode(Priv->SMSC.Name, "Default", 7);
336  Priv->SMSC.DefaultNumber[0] = 0;
337  Priv->SMSC.DefaultNumber[1] = 0;
338  Priv->SMSC.Format = SMS_FORMAT_Text;
339  Priv->SMSC.Location = 1;
340 
342 
343  Priv->locale.AMPMTime = FALSE;
345  Priv->locale.DateSeparator = '.';
346 
347  Priv->diverts.EntriesNum = 5;
348 
351  Priv->diverts.Entries[0].Timeout = 10;
352  EncodeUnicode(Priv->diverts.Entries[0].Number, "", 0);
353 
356  Priv->diverts.Entries[1].Timeout = 20;
357  EncodeUnicode(Priv->diverts.Entries[1].Number, "123", 3);
358 
361  Priv->diverts.Entries[2].Timeout = 30;
362  EncodeUnicode(Priv->diverts.Entries[2].Number, "123", 3);
363 
366  Priv->diverts.Entries[3].Timeout = 40;
367  EncodeUnicode(Priv->diverts.Entries[3].Number, "123", 3);
368 
371  Priv->diverts.Entries[4].Timeout = 0;
372  EncodeUnicode(Priv->diverts.Entries[4].Number, "", 0);
373 
374  return ERR_NONE;
375 }
376 
381 {
382  int i;
384 
385  for (i = 0; i <= DUMMY_MAX_FS_DEPTH; i++) {
386  if (Priv->dir[i] != NULL) {
387  closedir(Priv->dir[i]);
388  Priv->dir[i] = NULL;
389  }
390  }
391  if (Priv->log_file != NULL) {
392  fclose(Priv->log_file);
393  }
394  return ERR_NONE;
395 }
396 
397 
402 {
403  return ERR_UNKNOWN;
404 }
405 
407 {
408  strcpy(value, "DUMMY-001");
409  return ERR_NONE;
410 }
411 
413 {
414  strcpy(s->Phone.Data.IMEI, "999999999999999");
415  return ERR_NONE;
416 }
417 
419 {
420  strcpy(value, "666666666666666");
421  return ERR_NONE;
422 }
423 
425 {
426  strcpy(value, "April");
427  return ERR_NONE;
428 }
429 
431 {
432  strcpy(value, "FOO DUMMY BAR");
433  return ERR_NONE;
434 }
435 
437 {
438  strcpy(value, "EN CS");
439  return ERR_NONE;
440 }
441 
443 {
444  strcpy(s->Phone.Data.Version, GAMMU_VERSION);
445  strcpy(s->Phone.Data.VerDate, "20150101");
447  return ERR_NONE;
448 }
449 
451 {
452  strcpy(s->Phone.Data.Model, "Dummy");
453  return ERR_NONE;
454 }
455 
457 {
458  GSM_GetCurrentDateTime(date_time);
459  return ERR_NONE;
460 }
461 
463 {
464  GSM_SMS_Backup *Backup;
465  char *filename;
466  GSM_Error error;
467  GSM_SMSMessage *SMS;
468  int location, folder;
469  int i = 0;
470 
471  location = sms->SMS[0].Location;
472  folder = sms->SMS[0].Folder;
473  Backup = malloc(sizeof(GSM_SMS_Backup));
474  if (Backup == NULL) {
475  return ERR_MOREMEMORY;
476  }
477 
478  filename = DUMMY_GetSMSPath(s, &(sms->SMS[0]));
479 
480  error = GSM_ReadSMSBackupFile(filename, Backup);
481 
482  free(filename);
483  filename=NULL;
484 
485  if (error != ERR_NONE) {
486  free(Backup);
487  if (error == ERR_CANTOPENFILE) return ERR_EMPTY;
488  return error;
489  }
490 
491  sms->Number = 0;
492 
493  for (SMS = Backup->SMS[i]; SMS != NULL; SMS = Backup->SMS[++i]) {
494  sms->Number++;
495  sms->SMS[i] = *(Backup->SMS[i]);
496  sms->SMS[i].Location = location + (folder * DUMMY_MAX_SMS);
497  sms->SMS[i].Folder = folder;
498  switch (folder) {
499  case 1:
500  sms->SMS[i].InboxFolder = TRUE;
501  sms->SMS[i].Memory = MEM_SM;
502  break;
503  case 2:
504  sms->SMS[i].InboxFolder = FALSE;
505  sms->SMS[i].Memory = MEM_SM;
506  break;
507  case 3:
508  sms->SMS[i].InboxFolder = TRUE;
509  sms->SMS[i].Memory = MEM_ME;
510  break;
511  case 4:
512  sms->SMS[i].InboxFolder = FALSE;
513  sms->SMS[i].Memory = MEM_ME;
514  break;
515  case 5:
516  sms->SMS[i].InboxFolder = FALSE;
517  sms->SMS[i].Memory = MEM_ME;
518  break;
519  }
520  }
521  GSM_FreeSMSBackup(Backup);
522  free(Backup);
523 
524  return ERR_NONE;
525 }
526 
528 {
529  char *filename=NULL;
530  GSM_Error error;
531 
532  filename = DUMMY_GetSMSPath(s, sms);
533 
534  if (unlink(filename) == 0) {
535  error = ERR_NONE;
536  } else {
537  error = DUMMY_Error(s, "SMS unlink failed", filename);
538  }
539  free(filename);
540  filename=NULL;
541  return error;
542 }
543 
545 {
546  char *filename=NULL;
547  GSM_Error error;
548  GSM_SMS_Backup *Backup;
549 
550  Backup = malloc(sizeof(GSM_SMS_Backup));
551  if (Backup == NULL) {
552  return ERR_MOREMEMORY;
553  }
554 
555  error = DUMMY_DeleteSMS(s, sms);
556 
557  if (error != ERR_EMPTY && error != ERR_NONE) {
558  free(Backup);
559  return error;
560  }
561 
562  filename = DUMMY_GetSMSPath(s, sms);
563 
564  Backup->SMS[0] = sms;
565  Backup->SMS[1] = NULL;
566 
567  error = GSM_AddSMSBackupFile(filename, Backup);
568  free(filename);
569  free(Backup);
570  filename=NULL;
571  return error;
572 }
573 
575 {
576  char dirname[20]={0};
577 
578  sprintf(dirname, "sms/%d", sms->Folder);
579  sms->Location = DUMMY_GetFirstFree(s, dirname);
580 
581  if (sms->Location == -1) {
582  return ERR_FULL;
583  }
584  return DUMMY_SetSMS(s, sms);
585 }
586 
588 {
589  sig->SignalStrength = 42;
590  sig->SignalPercent = 42;
591  sig->BitErrorRate = 0;
592  return ERR_NONE;
593 }
594 
596 {
597  PHONE_GetSMSFolders(s,folders);
598  folders->Number = 5;
599 
600  CopyUnicodeString(folders->Folder[2].Name,folders->Folder[0].Name);
601  folders->Folder[2].InboxFolder = folders->Folder[0].InboxFolder;
602  folders->Folder[2].OutboxFolder = folders->Folder[0].OutboxFolder;
603  folders->Folder[2].Memory = MEM_ME;
604 
605  CopyUnicodeString(folders->Folder[3].Name,folders->Folder[1].Name);
606  folders->Folder[3].InboxFolder = folders->Folder[1].InboxFolder;
607  folders->Folder[3].OutboxFolder = folders->Folder[1].OutboxFolder;
608  folders->Folder[3].Memory = MEM_ME;
609 
610  EncodeUnicode(folders->Folder[4].Name,_("Templates"),strlen(_("Templates")));
611  folders->Folder[4].InboxFolder = FALSE;
612  folders->Folder[4].OutboxFolder = FALSE;
613  folders->Folder[4].Memory = MEM_ME;
614  return ERR_NONE;
615 }
616 
618 {
619  char dirname[20]={0};
620 
622  return ERR_NOTSUPPORTED;
623  }
624 
625  if (start) {
626  sms->SMS[0].Folder = 1;
627  sms->SMS[0].Location = 0;
628  }
629 
630 folder:
631  /* Convert location */
632  free(DUMMY_GetSMSPath(s, &(sms->SMS[0])));
633 
634  sprintf(dirname, "sms/%d", sms->SMS[0].Folder);
635 
636  sms->SMS[0].Location = DUMMY_GetNext(s, dirname, sms->SMS[0].Location);
637 
638  if (sms->SMS[0].Location == -1) {
639  if (sms->SMS[0].Folder >= 5) return ERR_EMPTY;
640  sms->SMS[0].Folder++;
641  goto folder;
642  }
643 
644  return DUMMY_GetSMS(s, sms);
645 }
646 
648 {
649  char dirname[20];
650  sprintf(dirname, "sms/%d", 5);
651  status->TemplatesUsed = DUMMY_GetCount(s, dirname);
652 
653  sprintf(dirname, "sms/%d", 1);
654  status->SIMUsed = DUMMY_GetCount(s, dirname);
655  sprintf(dirname, "sms/%d", 2);
656  status->SIMUsed += DUMMY_GetCount(s, dirname);
657  status->SIMUnRead = 0;
658  status->SIMSize = DUMMY_MAX_SMS;
659 
660  sprintf(dirname, "sms/%d", 3);
661  status->PhoneUsed = DUMMY_GetCount(s, dirname);
662  sprintf(dirname, "sms/%d", 4);
663  status->PhoneUsed += DUMMY_GetCount(s, dirname);
664  status->PhoneUsed += status->TemplatesUsed;
665  status->PhoneUnRead = 0;
666  status->PhoneSize = DUMMY_MAX_SMS;
667  return ERR_NONE;
668 }
669 
671 {
673 
674  fprintf(Priv->log_file, "Dialling %s\n", number);
675 
676  return ERR_NONE;
677 }
678 
680 {
682  GSM_USSDMessage ussd;
683  char ussd_text[GSM_MAX_USSD_LENGTH + 1];
684  size_t len;
685 
686 
687  fprintf(Priv->log_file, "Dialling service %s\n", number);
688 
689  if (s->Phone.Data.EnableIncomingUSSD && s->User.IncomingUSSD != NULL) {
691  len = snprintf(ussd_text, GSM_MAX_USSD_LENGTH, "Reply for %s", number);
692  EncodeUnicode(ussd.Text, ussd_text, len);
693 
694  /* Notify application */
695  s->User.IncomingUSSD(s, &ussd, s->User.IncomingUSSDUserData);
696  }
697 
698  return ERR_NONE;
699 }
700 
702 {
704 
705  fprintf(Priv->log_file, "Answering call %d (%d)\n", ID, all);
706 
707  return ERR_NONE;
708 }
709 
711 {
712  strcpy(netinfo->CID, "FACE");
713  strcpy(netinfo->PacketCID, "DEAD");
714  strcpy(netinfo->NetworkCode, "999 99");
715  netinfo->State = GSM_HomeNetwork;
716  strcpy(netinfo->LAC, "B00B");
717  strcpy(netinfo->PacketLAC, "BEEF");
718  netinfo->PacketState = GSM_HomeNetwork;
719  EncodeUnicode(netinfo->NetworkName, "GammuT3l", 8);
720  netinfo->GPRS = GSM_GPRS_Attached;
721 
722  return ERR_NONE;
723 }
724 
726 {
727  features->Number = 1;
728  features->Feature[0] = GSM_KeypadLocked;
729  return ERR_NONE;
730 }
731 
733 {
734  return ERR_NOTIMPLEMENTED;
735 }
736 
738 {
740 
741  if (Press) {
742  fprintf(Priv->log_file, "Pressing key %d\n", Key);
743  } else {
744  fprintf(Priv->log_file, "Releasing key %d\n", Key);
745  }
746 
747  return ERR_NONE;
748 }
749 
751 {
753 
754  if (hard) {
755  fprintf(Priv->log_file, "Performing hard reset!\n");
756  } else {
757  fprintf(Priv->log_file, "Performing soft reset!\n");
758  }
759 
760  return ERR_NONE;
761 }
762 
764 {
766 
767  fprintf(Priv->log_file, "Canceling call %d (%d)\n", ID, all);
768 
769  return ERR_NONE;
770 }
771 
772 GSM_Error DUMMY_SendSavedSMS(GSM_StateMachine *s, int Folder, int Location)
773 {
774  return ERR_NOTIMPLEMENTED;
775 }
776 
778 {
779  unsigned char buffer[1000] = {'\0'};
780  int length = 0;
781  GSM_Error error;
782 
783  if (sms->PDU == SMS_Deliver) {
784  smprintf(s, "SMS Deliver\n");
785 
786  error = PHONE_EncodeSMSFrame(s, sms, buffer, PHONE_SMSDeliver, &length, TRUE);
787 
788  if (error != ERR_NONE) {
789  return error;
790  }
791  } else {
792  smprintf(s, "SMS Submit\n");
793 
794  error = PHONE_EncodeSMSFrame(s, sms, buffer, PHONE_SMSSubmit, &length, TRUE);
795 
796  if (error != ERR_NONE) {
797  return error;
798  }
799  }
800  s->User.SendSMSStatus(s, 0, 0xff, s->User.SendSMSStatusUserData);
801  return ERR_NONE;
802 }
803 
805 {
806  return ERR_NONE;
807 }
808 
810 {
812 
813  if (smsc->Location != 1) return ERR_NOTSUPPORTED;
814 
815  Priv->SMSC = *smsc;
816 
817  return ERR_NONE;
818 }
819 
821 {
823 
824  if (smsc->Location != 1) return ERR_EMPTY;
825 
826  *smsc = Priv->SMSC;
827 
828  return ERR_NONE;
829 }
830 
832 {
834 
835  fprintf(Priv->log_file, "Security code %d: %s\n", Code->Type, Code->Code);
836 
837  return ERR_NONE;
838 }
839 
841 {
842  *Status = SEC_None;
843  return ERR_NONE;
844 }
845 
847 {
848  if (Type == GSM_RESET_PHONESETTINGS) {
849  return ERR_NONE;
850  }
851  return ERR_NOTIMPLEMENTED;
852 }
853 
855 {
857 
858  fprintf(Priv->log_file, "DTMF: %s\n", sequence);
859  return ERR_NONE;
860 }
861 
863 {
864  strcpy(IMSI, "994299429942994");
865  return ERR_NONE;
866 }
867 
869 {
870  int i;
872 
873  response->EntriesNum = 0;
874 
875  for (i = 0; i < Priv->diverts.EntriesNum; i++) {
876  if (request->DivertType == Priv->diverts.Entries[i].DivertType && request->CallType == Priv->diverts.Entries[i].CallType) {
877  response->Entries[response->EntriesNum] = Priv->diverts.Entries[i];
878  response->EntriesNum++;
879  }
880  }
881 
882  return ERR_NONE;
883 }
884 
886 {
887  int i;
889 
890  for (i = 0; i < Priv->diverts.EntriesNum; i++) {
891  if ((request->DivertType == Priv->diverts.Entries[i].DivertType) &&
892  (request->CallType == Priv->diverts.Entries[i].CallType)) {
893  break;
894  }
895  }
896  Priv->diverts.Entries[i] = *request;
897  Priv->diverts.EntriesNum = i + 1;
898 
899  return ERR_NONE;
900 }
901 
903 {
905 
906  Priv->diverts.EntriesNum = 0;
907 
908  return ERR_NONE;
909 }
910 
912 {
913  s->Phone.Data.EnableIncomingCall = enable;
914  return ERR_NONE;
915 }
916 
918 {
919  s->Phone.Data.EnableIncomingCB = enable;
920  return ERR_NONE;
921 }
922 
924 {
925  s->Phone.Data.EnableIncomingSMS = enable;
926  return ERR_NONE;
927 }
928 
930 {
931  return ERR_NONE;
932 }
933 
935 {
936  strcpy(s->Phone.Data.Manufacturer, "Gammu");
937  return ERR_NONE;
938 }
939 
941 {
942  GSM_Backup Backup;
943  char *filename=NULL;
944  GSM_Error error;
945  int i;
946 
947  filename = DUMMY_AlarmPath(s, entry);
948 
949  error = GSM_ReadBackupFile(filename, &Backup, GSM_Backup_VCalendar);
950 
951  free(filename);
952  filename=NULL;
953 
954  if (error != ERR_NONE) {
955  if (error == ERR_CANTOPENFILE) return ERR_EMPTY;
956  return error;
957  }
958  if (Backup.Calendar[0] == NULL) return ERR_EMPTY;
959 
960  entry->Repeating = FALSE;
961  entry->Text[0] = 0;
962  entry->Text[1] = 0;
964 
965  for (i = 0; i < Backup.Calendar[0]->EntriesNum; i++) {
966  switch (Backup.Calendar[0]->Entries[i].EntryType) {
968  entry->DateTime = Backup.Calendar[0]->Entries[i].Date;
969  break;
970  case CAL_TEXT:
971  CopyUnicodeString(entry->Text, Backup.Calendar[0]->Entries[i].Text);
972  break;
974  if (Backup.Calendar[0]->Entries[i].Number) {
975  entry->Repeating = TRUE;
976  }
977  break;
978  default:
979  break;
980  }
981  }
982 
983  GSM_FreeBackup(&Backup);
984 
985  return ERR_NONE;
986 }
987 
989 {
990  char *filename=NULL;
991  GSM_Error error;
992 
993  filename = DUMMY_AlarmPath(s, entry);
994 
995  if (unlink(filename) == 0) {
996  error = ERR_NONE;
997  } else {
998  error = DUMMY_Error(s, "calendar unlink failed", filename);
999  }
1000 
1001  free(filename);
1002  filename=NULL;
1003  return error;
1004 }
1005 
1006 
1008 {
1009  char *filename=NULL;
1010  GSM_Error error;
1011  GSM_Backup backup;
1012  GSM_CalendarEntry cal;
1013 
1014  GSM_ClearBackup(&backup);
1015 
1016  error = DUMMY_DeleteAlarm(s, entry);
1017  if (error != ERR_EMPTY && error != ERR_NONE) return error;
1018 
1019  filename = DUMMY_AlarmPath(s, entry);
1020 
1021  cal.EntriesNum = 3;
1022  cal.Type = GSM_CAL_ALARM;
1023  cal.Location = entry->Location;
1025  cal.Entries[0].Date = entry->DateTime;
1026  cal.Entries[0].Date.Year = 1970;
1027  cal.Entries[0].Date.Month = 1;
1028  cal.Entries[0].Date.Day = 1;
1029  cal.Entries[0].Date.Timezone = 0;
1031  cal.Entries[1].Date = entry->DateTime;
1032  cal.Entries[1].Date.Year = 1970;
1033  cal.Entries[1].Date.Month = 1;
1034  cal.Entries[1].Date.Day = 1;
1035  cal.Entries[1].Date.Timezone = 0;
1036  cal.Entries[2].EntryType = CAL_TEXT;
1037  CopyUnicodeString(cal.Entries[2].Text, entry->Text);
1038  if (entry->Repeating) {
1040  cal.Entries[3].Number = 1;
1041  }
1042 
1043  backup.Calendar[0] = &cal;
1044  backup.Calendar[1] = NULL;
1045 
1046  error = GSM_SaveBackupFile(filename, &backup, GSM_Backup_VCalendar);
1047  free(filename);
1048  filename=NULL;
1049  return error;
1050 }
1051 
1053 {
1054  s->Phone.Data.EnableIncomingUSSD = enable;
1055  return ERR_NONE;
1056 }
1057 
1059 {
1060  return ERR_NOTIMPLEMENTED;
1061 }
1062 
1064 {
1065  return ERR_NOTIMPLEMENTED;
1066 }
1067 
1069 {
1070  switch (bookmark->Location) {
1071  case 1:
1072  EncodeUnicode(bookmark->Address, "https://blog.cihar.com/", 23);
1073  EncodeUnicode(bookmark->Title, "Michals weblog", 14);
1074  return ERR_NONE;
1075  case 2:
1076  EncodeUnicode(bookmark->Address, "https://wammu.eu/", 17);
1077  EncodeUnicode(bookmark->Title, "Wammu website", 13);
1078  return ERR_NONE;
1079  default:
1080  return ERR_EMPTY;
1081 
1082  }
1083 }
1084 
1086 {
1087  return ERR_NOTIMPLEMENTED;
1088 }
1089 
1091 {
1092  return ERR_NOTIMPLEMENTED;
1093 }
1094 
1096 {
1097  /* We just ignore attributes */
1098  return ERR_NONE;
1099 }
1100 
1101 GSM_Error DUMMY_AddFilePart(GSM_StateMachine *s, GSM_File *File, size_t *Pos, int *Handle)
1102 {
1103  char *path;
1104  FILE *file;
1105  size_t pos;
1106  GSM_Error error;
1107 
1108  *Handle = 0;
1109 
1110  pos = UnicodeLength(File->ID_FullName);
1111  if (pos > 0 && (File->ID_FullName[2*pos - 2] != 0 || File->ID_FullName[2*pos - 1] != '/')) {
1112  File->ID_FullName[2*pos + 1] = '/';
1113  File->ID_FullName[2*pos + 0] = 0;
1114  pos++;
1115  }
1116  CopyUnicodeString(File->ID_FullName + 2 * pos, File->Name);
1117 
1118  path = DUMMY_GetFSFilePath(s, File->ID_FullName);
1119 
1120  file = fopen(path, "w");
1121  if (file == NULL) {
1122  error = DUMMY_Error(s, "fopen(w) failed", path);
1123  free(path);
1124  if (error == ERR_EMPTY) return ERR_PERMISSION;
1125  return error;
1126  }
1127  if (fwrite(File->Buffer, 1, File->Used, file) != File->Used) {
1128  error = DUMMY_Error(s, "fwrite failed", path);
1129  free(path);
1130  fclose(file);
1131  if (error == ERR_EMPTY) return ERR_PERMISSION;
1132  return error;
1133  }
1134  if (fclose(file) != 0) {
1135  error = DUMMY_Error(s, "fclose failed", path);
1136  free(path);
1137  if (error == ERR_EMPTY) return ERR_PERMISSION;
1138  return error;
1139  }
1140 
1141  free(path);
1142  path=NULL;
1143  *Pos = File->Used;
1144 
1145  return ERR_EMPTY;
1146 }
1147 
1148 GSM_Error DUMMY_SendFilePart(GSM_StateMachine *s, GSM_File *File, size_t *Pos, int *Handle)
1149 {
1150  EncodeUnicode(File->ID_FullName, "incoming/", 9);
1151  return DUMMY_AddFilePart(s, File, Pos, Handle);
1152 }
1153 
1154 GSM_Error DUMMY_GetFilePart(GSM_StateMachine *s, GSM_File *File, int *Handle, size_t *Size)
1155 {
1156  char *path, *name, *pos;
1157  GSM_Error error;
1158 
1159  *Handle = 0;
1160 
1161  path = DUMMY_GetFSFilePath(s, File->ID_FullName);
1162 
1163  error = GSM_ReadFile(path, File);
1164  *Size = File->Used;
1165 
1166  name = strrchr(path, '/');
1167  if (name == NULL) name = path;
1168  else name++;
1169  EncodeUnicode(File->Name, name, strlen(name));
1170  pos = path;
1171  while (*pos != 0 && (pos = strchr(pos + 1, '/')) != NULL) File->Level++;
1172 
1173  free(path);
1174  path=NULL;
1175 
1176  if (error == ERR_NONE) return ERR_EMPTY;
1177  return error;
1178 }
1179 
1181 {
1182  GSM_Phone_DUMMYData *Priv = &s->Phone.Data.Priv.DUMMY;
1183  GSM_Error error;
1184  char *path;
1185  struct dirent *dp;
1186  struct stat sb;
1187 
1188  if (start) {
1189  if (Priv->dir[DUMMY_MAX_FS_DEPTH] != NULL) {
1190  closedir(Priv->dir[DUMMY_MAX_FS_DEPTH]);
1191  }
1192  path = DUMMY_GetFSFilePath(s, File->ID_FullName);
1193  smprintf(s, "listing %s\n", path);
1194  strcpy(Priv->dirnames[DUMMY_MAX_FS_DEPTH], path);
1195  Priv->dir[DUMMY_MAX_FS_DEPTH] = opendir(path);
1196 
1197  if (Priv->dir[DUMMY_MAX_FS_DEPTH] == NULL) {
1198  error = DUMMY_Error(s, "opendir failed", path);
1199  free(path);
1200  path=NULL;
1201  return error;
1202  }
1203  free(path);
1204  path=NULL;
1205  }
1206 
1207 read_next_entry:
1208  dp = readdir(Priv->dir[DUMMY_MAX_FS_DEPTH]);
1209 
1210  if (dp == NULL) {
1211  closedir(Priv->dir[DUMMY_MAX_FS_DEPTH]);
1212  Priv->dir[DUMMY_MAX_FS_DEPTH] = NULL;
1213  return ERR_EMPTY;
1214  }
1215 
1216  if (strcmp(dp->d_name, "..") == 0 || strcmp(dp->d_name, ".") == 0)
1217  goto read_next_entry;
1218 
1219  /* Stat file */
1220  path = DUMMY_GetFSPath(s, dp->d_name, DUMMY_MAX_FS_DEPTH);
1221  if (stat(path, &sb) < 0) {
1222  error = DUMMY_Error(s, "stat failed", path);
1223  free(path);
1224  path=NULL;
1225  return error;
1226  }
1227 
1228  /* Fill file structure */
1229  File->Used = sb.st_size;
1230  EncodeUnicode(File->Name, dp->d_name, strlen(dp->d_name));
1231  File->Folder = FALSE;
1232  File->Level = 0; /*Priv->fs_depth + 1;*/
1233  File->Type = GSM_File_Other; /* @todo TODO we should somehow detect this? */
1234  /* We need to skip device prefix and /fs/ prefix */
1235  EncodeUnicode(File->ID_FullName, path + Priv->devlen + 4, strlen(path + Priv->devlen + 4));
1236  File->Buffer = NULL;
1237  Fill_GSM_DateTime(&(File->Modified), sb.st_mtime);
1238  File->ModifiedEmpty = FALSE;
1239  File->Protected = FALSE;
1240  File->Hidden = FALSE;
1241  File->System = FALSE;
1242  File->ReadOnly = FALSE; /* @todo TODO get this from permissions? */
1243 
1244  /* Open nested directory for next loop if needed */
1245  if (S_ISDIR(sb.st_mode)) {
1246  File->Folder = TRUE;
1247  if (Priv->fs_depth == DUMMY_MAX_FS_DEPTH - 1) {
1248  smprintf(s, "We hit DUMMY_MAX_FS_DEPTH limit!\n");
1249  free(path);
1250  path=NULL;
1251  return ERR_MOREMEMORY;
1252  }
1253  Priv->fs_depth++;
1254  Priv->dir[Priv->fs_depth] = opendir(path);
1255  if (Priv->dir[Priv->fs_depth] == NULL) {
1256  error = DUMMY_Error(s, "nested opendir failed", path);
1257  free(path);
1258  path=NULL;
1259  return error;
1260  }
1261  strcpy(Priv->dirnames[Priv->fs_depth], path);
1262  }
1263  free(path);
1264  path=NULL;
1265  return ERR_NONE;
1266 }
1267 
1269 {
1270  GSM_Phone_DUMMYData *Priv = &s->Phone.Data.Priv.DUMMY;
1271  GSM_Error error;
1272  char *path;
1273  struct dirent *dp;
1274  struct stat sb;
1275  int i;
1276 
1277  if (start) {
1278  for (i = 0; i < DUMMY_MAX_FS_DEPTH; i++) {
1279  if (Priv->dir[i] != NULL) {
1280  closedir(Priv->dir[i]);
1281  Priv->dir[i] = NULL;
1282  }
1283  }
1284  path = DUMMY_GetFilePath(s, "fs");
1285  strcpy(Priv->dirnames[0], path);
1286  Priv->dir[0] = opendir(path);
1287 
1288  if (Priv->dir[0] == NULL) {
1289  error = DUMMY_Error(s, "opendir failed", path);
1290  free(path);
1291  path = NULL;
1292  return error;
1293  }
1294  free(path);
1295  path=NULL;
1296  Priv->fs_depth = 0;
1297  }
1298 
1299 read_next_entry:
1300  dp = readdir(Priv->dir[Priv->fs_depth]);
1301 
1302  if (dp == NULL) {
1303  closedir(Priv->dir[Priv->fs_depth]);
1304  Priv->dir[Priv->fs_depth] = NULL;
1305  if (Priv->fs_depth == 0) return ERR_EMPTY;
1306  Priv->fs_depth--;
1307  goto read_next_entry;
1308  }
1309 
1310  if (strcmp(dp->d_name, "..") == 0 || strcmp(dp->d_name, ".") == 0)
1311  goto read_next_entry;
1312 
1313  /* Stat file */
1314  path = DUMMY_GetFSPath(s, dp->d_name, Priv->fs_depth);
1315  if (stat(path, &sb) < 0) {
1316  error = DUMMY_Error(s, "stat failed", path);
1317  free(path);
1318  path = NULL;
1319  return error;
1320  }
1321 
1322  /* Fill file structure */
1323  File->Used = 0;
1324  EncodeUnicode(File->Name, dp->d_name, strlen(dp->d_name));
1325  File->Folder = FALSE;
1326  File->Level = Priv->fs_depth + 1;
1327  File->Type = GSM_File_Other; /* @todo TODO we should somehow detect this? */
1328  /* We need to skip device prefix and /fs/ prefix */
1329  EncodeUnicode(File->ID_FullName, path + Priv->devlen + 4, strlen(path + Priv->devlen + 4));
1330  File->Buffer = NULL;
1331  Fill_GSM_DateTime(&(File->Modified), sb.st_mtime);
1332  File->ModifiedEmpty = FALSE;
1333  File->Protected = FALSE;
1334  File->Hidden = FALSE;
1335  File->System = FALSE;
1336  File->ReadOnly = FALSE; /* @todo TODO get this from permissions? */
1337 
1338  /* Open nested directory for next loop if needed */
1339  if (S_ISDIR(sb.st_mode)) {
1340  File->Folder = TRUE;
1341  if (Priv->fs_depth == DUMMY_MAX_FS_DEPTH - 1) {
1342  smprintf(s, "We hit DUMMY_MAX_FS_DEPTH limit!\n");
1343  free(path);
1344  path=NULL;
1345  return ERR_MOREMEMORY;
1346  }
1347  Priv->fs_depth++;
1348  Priv->dir[Priv->fs_depth] = opendir(path);
1349  if (Priv->dir[Priv->fs_depth] == NULL) {
1350  error = DUMMY_Error(s, "nested opendir failed", path);
1351  free(path);
1352  path=NULL;
1353  return error;
1354  }
1355  strcpy(Priv->dirnames[Priv->fs_depth], path);
1356  }
1357  free(path);
1358  path=NULL;
1359  return ERR_NONE;
1360 }
1361 
1363 {
1364  char *path;
1365  GSM_Error error;
1366 
1367  path = DUMMY_GetFSFilePath(s, ID);
1368  if (unlink(path) != 0) {
1369  error = DUMMY_Error(s, "unlink failed", path);
1370  free(path);
1371  path = NULL;
1372  if (error == ERR_EMPTY) return ERR_FILENOTEXIST;
1373  return error;
1374  }
1375  free(path);
1376  path=NULL;
1377  return ERR_NONE;
1378 }
1379 
1381 {
1382  char *path;
1383  GSM_Error error;
1384 
1385  path = DUMMY_GetFSFilePath(s, ID);
1386  smprintf(s, "Deleting directory %s\n", path);
1387  if (rmdir(path) != 0) {
1388  error = DUMMY_Error(s, "rmdir failed", path);
1389  free(path);
1390  path = NULL;
1391  if (error == ERR_EMPTY) return ERR_FILENOTEXIST;
1392  return error;
1393  }
1394  free(path);
1395  path=NULL;
1396  return ERR_NONE;
1397 }
1398 
1400 {
1401  char *path;
1402  size_t pos;
1403  GSM_Error error;
1404 
1405  pos = UnicodeLength(File->ID_FullName);
1406  if (pos > 0 && (File->ID_FullName[2*pos - 2] != 0 || File->ID_FullName[2*pos - 1] != '/')) {
1407  File->ID_FullName[2*pos + 1] = '/';
1408  File->ID_FullName[2*pos + 0] = 0;
1409  pos++;
1410  }
1411  CopyUnicodeString(File->ID_FullName + 2 * pos, File->Name);
1412 
1413  path = DUMMY_GetFSFilePath(s, File->ID_FullName);
1414  if (MKDIR(path) != 0) {
1415  error = DUMMY_Error(s, "mkdir failed", path);
1416  free(path);
1417  path=NULL;
1418  return error;
1419  }
1420  free(path);
1421  path=NULL;
1422  return ERR_NONE;
1423 }
1424 
1426 {
1427  char dirname[20];
1428  sprintf(dirname, "pbk/%s", GSM_MemoryTypeToString(Status->MemoryType));
1429  Status->MemoryUsed = DUMMY_GetCount(s, dirname);
1430  Status->MemoryFree = DUMMY_MAX_MEM - Status->MemoryUsed;
1431  return ERR_NONE;
1432 }
1433 
1435 {
1436  GSM_Backup Backup;
1437  char *filename=NULL;
1438  GSM_Error error;
1439  int location=0,i=0;
1440  GSM_MemoryType type;
1441 
1442  type = entry->MemoryType;
1443  location = entry->Location;
1444  filename = DUMMY_MemoryPath(s, entry);
1445 
1446  error = GSM_ReadBackupFile(filename, &Backup, GSM_Backup_VCard);
1447 
1448  free(filename);
1449  filename=NULL;
1450 
1451  if (error != ERR_NONE) {
1452  if (error == ERR_CANTOPENFILE) return ERR_EMPTY;
1453  return error;
1454  }
1455  if (Backup.PhonePhonebook[0] == NULL && Backup.SIMPhonebook[0] == NULL) return ERR_EMPTY;
1456 
1457 
1458  if (Backup.PhonePhonebook[0] != NULL) {
1459  *entry = *(Backup.PhonePhonebook[0]);
1460  } else {
1461  *entry = *(Backup.SIMPhonebook[0]);
1462  }
1463 
1464  for (i = 0; i < entry->EntriesNum; i++) {
1465  if (entry->Entries[i].EntryType == PBK_Photo) {
1466  entry->Entries[i].Picture.Buffer = (unsigned char *)malloc(entry->Entries[i].Picture.Length);
1467  if (Backup.PhonePhonebook[0] != NULL) {
1468  memcpy(entry->Entries[i].Picture.Buffer, Backup.PhonePhonebook[0]->Entries[i].Picture.Buffer, entry->Entries[i].Picture.Length);
1469  } else {
1470  memcpy(entry->Entries[i].Picture.Buffer, Backup.SIMPhonebook[0]->Entries[i].Picture.Buffer, entry->Entries[i].Picture.Length);
1471  }
1472  }
1473  }
1474  entry->Location = location;
1475  entry->MemoryType = type;
1476  GSM_FreeBackup(&Backup);
1477 
1478  return ERR_NONE;
1479 }
1480 
1482 {
1483  char dirname[20]={0};
1484 
1486  return ERR_NOTSUPPORTED;
1487  }
1488 
1489  if (start) {
1490  entry->Location = 0;
1491  }
1492 
1493  sprintf(dirname, "pbk/%s", GSM_MemoryTypeToString(entry->MemoryType));
1494 
1495  entry->Location = DUMMY_GetNext(s, dirname, entry->Location);
1496 
1497  return DUMMY_GetMemory(s, entry);
1498 }
1499 
1501 {
1502  char *filename=NULL;
1503  GSM_Error error;
1504 
1505  filename = DUMMY_MemoryPath(s, entry);
1506 
1507  if (unlink(filename) == 0) {
1508  error = ERR_NONE;
1509  } else {
1510  error = DUMMY_Error(s, "memory unlink failed", filename);
1511  }
1512 
1513  free(filename);
1514  filename=NULL;
1515  return error;
1516 }
1517 
1519 {
1520  char *filename=NULL;
1521  GSM_Error error;
1522  GSM_Backup backup;
1523 
1524  GSM_ClearBackup(&backup);
1525 
1526  error = DUMMY_DeleteMemory(s, entry);
1527  if (error != ERR_EMPTY && error != ERR_NONE) return error;
1528 
1529  filename = DUMMY_MemoryPath(s, entry);
1530 
1531  backup.PhonePhonebook[0] = entry;
1532  backup.PhonePhonebook[1] = NULL;
1533 
1534  error = GSM_SaveBackupFile(filename, &backup, GSM_Backup_VCard);
1535  free(filename);
1536  filename=NULL;
1537  return error;
1538 }
1539 
1541 {
1542  char dirname[20]={0};
1543 
1544  sprintf(dirname, "pbk/%s", GSM_MemoryTypeToString(entry->MemoryType));
1545  entry->Location = DUMMY_GetFirstFree(s, dirname);
1546 
1547  if (entry->Location == -1) return ERR_FULL;
1548 
1549  return DUMMY_SetMemory(s, entry);
1550 }
1551 
1553 {
1554  char dirname[20];
1555 
1556  sprintf(dirname, "pbk/%s", GSM_MemoryTypeToString(type));
1557 
1558  return DUMMY_DeleteAll(s, dirname);
1559 }
1560 
1562 {
1563  Status->Used = DUMMY_GetCount(s, "todo");
1564  Status->Free = DUMMY_MAX_TODO - Status->Used;
1565  return ERR_NONE;
1566 }
1567 
1569 {
1570  GSM_Backup Backup;
1571  char *filename=NULL;
1572  GSM_Error error;
1573  int location=0;
1574 
1575  location = entry->Location;
1576  filename = DUMMY_ToDoPath(s, entry);
1577 
1578  error = GSM_ReadBackupFile(filename, &Backup, GSM_Backup_VCalendar);
1579 
1580  free(filename);
1581  filename=NULL;
1582 
1583  if (error != ERR_NONE) {
1584  if (error == ERR_CANTOPENFILE) return ERR_EMPTY;
1585  return error;
1586  }
1587  if (Backup.ToDo[0] == NULL) return ERR_EMPTY;
1588 
1589  *entry = *(Backup.ToDo[0]);
1590  entry->Location = location;
1591  GSM_FreeBackup(&Backup);
1592 
1593  return ERR_NONE;
1594 }
1595 
1597 {
1599  return ERR_NOTSUPPORTED;
1600  }
1601 
1602  if (start) {
1603  entry->Location = 0;
1604  }
1605 
1606  entry->Location = DUMMY_GetNext(s, "todo", entry->Location);
1607 
1608  return DUMMY_GetToDo(s, entry);
1609 }
1610 
1612 {
1613  char *filename=NULL;
1614  GSM_Error error;
1615 
1616  filename = DUMMY_ToDoPath(s, entry);
1617 
1618  if (unlink(filename) == 0) {
1619  error = ERR_NONE;
1620  } else {
1621  error = DUMMY_Error(s, "todo unlink failed", filename);
1622  }
1623 
1624  free(filename);
1625  filename=NULL;
1626  return error;
1627 }
1628 
1630 {
1631  char *filename=NULL;
1632  GSM_Error error;
1633  GSM_Backup backup;
1634 
1635  GSM_ClearBackup(&backup);
1636 
1637  error = DUMMY_DeleteToDo(s, entry);
1638  if (error != ERR_EMPTY && error != ERR_NONE) return error;
1639 
1640  filename = DUMMY_ToDoPath(s, entry);
1641 
1642  backup.ToDo[0] = entry;
1643  backup.ToDo[1] = NULL;
1644 
1645  error = GSM_SaveBackupFile(filename, &backup, GSM_Backup_VCalendar);
1646  free(filename);
1647  filename=NULL;
1648  return error;
1649 }
1650 
1652 {
1653  entry->Location = DUMMY_GetFirstFree(s, "todo");
1654 
1655  if (entry->Location == -1) return ERR_FULL;
1656 
1657  return DUMMY_SetToDo(s, entry);
1658 }
1659 
1661 {
1662  return DUMMY_DeleteAll(s, "todo");
1663 }
1664 
1666 {
1667  Status->Used = DUMMY_GetCount(s, "calendar");
1668  Status->Free = DUMMY_MAX_TODO - Status->Used;
1669  return ERR_NONE;
1670 }
1671 
1673 {
1674  GSM_Backup Backup;
1675  char *filename=NULL;
1676  GSM_Error error;
1677  int location=0;
1678 
1679  location = entry->Location;
1680  filename = DUMMY_CalendarPath(s, entry);
1681 
1682  error = GSM_ReadBackupFile(filename, &Backup, GSM_Backup_VCalendar);
1683 
1684  free(filename);
1685  filename=NULL;
1686 
1687  if (error != ERR_NONE) {
1688  if (error == ERR_CANTOPENFILE) return ERR_EMPTY;
1689  return error;
1690  }
1691  if (Backup.Calendar[0] == NULL) return ERR_EMPTY;
1692 
1693  *entry = *(Backup.Calendar[0]);
1694  entry->Location = location;
1695  GSM_FreeBackup(&Backup);
1696 
1697  return ERR_NONE;
1698 }
1699 
1701 {
1703  return ERR_NOTSUPPORTED;
1704  }
1705 
1706  if (start) {
1707  entry->Location = 0;
1708  }
1709 
1710  entry->Location = DUMMY_GetNext(s, "calendar", entry->Location);
1711 
1712  return DUMMY_GetCalendar(s, entry);
1713 }
1714 
1716 {
1717  char *filename=NULL;
1718  GSM_Error error;
1719 
1720  filename = DUMMY_CalendarPath(s, entry);
1721 
1722  if (unlink(filename) == 0) {
1723  error = ERR_NONE;
1724  } else {
1725  error = DUMMY_Error(s, "calendar unlink failed", filename);
1726  }
1727 
1728  free(filename);
1729  filename=NULL;
1730  return error;
1731 }
1732 
1734 {
1735  char *filename=NULL;
1736  GSM_Error error;
1737  GSM_Backup backup;
1738 
1739  GSM_ClearBackup(&backup);
1740 
1741  error = DUMMY_DeleteCalendar(s, entry);
1742  if (error != ERR_EMPTY && error != ERR_NONE) return error;
1743 
1744  filename = DUMMY_CalendarPath(s, entry);
1745 
1746  backup.Calendar[0] = entry;
1747  backup.Calendar[1] = NULL;
1748 
1749  error = GSM_SaveBackupFile(filename, &backup, GSM_Backup_VCalendar);
1750  free(filename);
1751  filename=NULL;
1752  return error;
1753 }
1754 
1756 {
1757  entry->Location = DUMMY_GetFirstFree(s, "calendar");
1758 
1759  if (entry->Location == -1) return ERR_FULL;
1760 
1761  return DUMMY_SetCalendar(s, entry);
1762 }
1763 
1765 {
1766  return DUMMY_DeleteAll(s, "calendar");
1767 }
1768 
1770 {
1771  settings->StartDay = 1;
1772  settings->AutoDelete = 0;
1773  return ERR_NONE;
1774 }
1775 
1777 {
1778  return ERR_NONE;
1779 }
1780 
1782 {
1783  Status->Used = DUMMY_GetCount(s, "note");
1784  Status->Free = DUMMY_MAX_TODO - Status->Used;
1785  return ERR_NONE;
1786 }
1787 
1789 {
1790  GSM_Backup Backup;
1791  char *filename=NULL;
1792  GSM_Error error;
1793  int location=0;
1794 
1795  location = entry->Location;
1796  filename = DUMMY_NotePath(s, entry);
1797 
1798  error = GSM_ReadBackupFile(filename, &Backup, GSM_Backup_VNote);
1799 
1800  free(filename);
1801  filename=NULL;
1802 
1803  if (error != ERR_NONE) {
1804  if (error == ERR_CANTOPENFILE) return ERR_EMPTY;
1805  return error;
1806  }
1807  if (Backup.Note[0] == NULL) return ERR_EMPTY;
1808 
1809  *entry = *(Backup.Note[0]);
1810  entry->Location = location;
1811  GSM_FreeBackup(&Backup);
1812 
1813  return ERR_NONE;
1814 }
1815 
1817 {
1819  return ERR_NOTSUPPORTED;
1820  }
1821 
1822  if (start) {
1823  entry->Location = 0;
1824  }
1825 
1826  entry->Location = DUMMY_GetNext(s, "note", entry->Location);
1827 
1828  return DUMMY_GetNote(s, entry);
1829 }
1830 
1832 {
1833  char *filename=NULL;
1834  GSM_Error error;
1835 
1836  filename = DUMMY_NotePath(s, entry);
1837 
1838  if (unlink(filename) == 0) {
1839  error = ERR_NONE;
1840  } else {
1841  error = DUMMY_Error(s, "note unlink failed", filename);
1842  }
1843  free(filename);
1844  filename=NULL;
1845  return error;
1846 }
1847 
1849 {
1850  char *filename=NULL;
1851  GSM_Error error;
1852  GSM_Backup backup;
1853 
1854  GSM_ClearBackup(&backup);
1855 
1856  error = DUMMY_DeleteNote(s, entry);
1857  if (error != ERR_EMPTY && error != ERR_NONE) return error;
1858 
1859  filename = DUMMY_NotePath(s, entry);
1860 
1861  backup.Note[0] = entry;
1862  backup.Note[1] = NULL;
1863 
1864  error = GSM_SaveBackupFile(filename, &backup, GSM_Backup_VNote);
1865  free(filename);
1866  filename=NULL;
1867  return error;
1868 }
1869 
1871 {
1872  entry->Location = DUMMY_GetFirstFree(s, "note");
1873 
1874  if (entry->Location == -1) return ERR_FULL;
1875 
1876  return DUMMY_SetNote(s, entry);
1877 }
1878 
1880 {
1881  return DUMMY_DeleteAll(s, "note");
1882 }
1883 
1884 
1886 {
1887  GSM_Phone_DUMMYData *Priv = &s->Phone.Data.Priv.DUMMY;
1888  *locale = Priv->locale;
1889  return ERR_NONE;
1890 }
1891 
1893 {
1894  GSM_Phone_DUMMYData *Priv = &s->Phone.Data.Priv.DUMMY;
1895  Priv->locale = *locale;
1896  return ERR_NONE;
1897 }
1898 
1900 {
1901  Status->Free = 10101;
1902  Status->Used = 1000000;
1903  Status->UsedImages = 0;
1904  Status->UsedSounds = 0;
1905  Status->UsedThemes = 0;
1906  return ERR_NONE;
1907 }
1908 
1910 {
1911  bat->BatteryPercent = 100;
1913  bat->BatteryVoltage = 4200;
1914  bat->ChargeVoltage = 4200;
1915  bat->ChargeCurrent = 0;
1916  bat->PhoneCurrent = 500;
1917  bat->BatteryTemperature = 22;
1918  bat->PhoneTemperature = 22;
1919  bat->BatteryCapacity = 2000;
1921  return ERR_NONE;
1922 }
1923 
1925 {
1926  char *path;
1927  struct stat sb;
1928  GSM_Error error = ERR_NONE;
1929  GSM_Call call;
1930 
1931  /* Check for incoming call trigger */
1932  if (s->Phone.Data.EnableIncomingCall && s->User.IncomingCall != NULL) {
1933  path = DUMMY_GetFilePath(s, "incoming-call");
1934  if (path == NULL) {
1935  return ERR_MOREMEMORY;
1936  }
1937  if (stat(path, &sb) == 0) {
1938  smprintf(s, "Incoming call!\n");
1939 
1940  memset(&call, 0, sizeof(call));
1941 
1942  call.Status = 0;
1943  call.StatusCode = 0;
1944  call.CallIDAvailable = FALSE;
1946  call.CallIDAvailable = TRUE;
1947  EncodeUnicode(call.PhoneNumber, "+800123456", 11);
1948 
1949  s->User.IncomingCall(s, &call, s->User.IncomingCallUserData);
1950 
1951  unlink(path);
1952  }
1953  free(path);
1954  }
1955  return error;
1956 }
1957 
1961 {NULL, "\x00" ,0x00,0x00,ID_None }
1962 };
1963 
1965  "dummy",
1967  NOTSUPPORTED, /* Install */
1971  NOTSUPPORTED, /* ShowStartInfo */
1975  DUMMY_GetIMEI,
1980  DUMMY_GetPPM,
1989  DUMMY_Reset,
1998  NOTSUPPORTED, /* GetCategory */
1999  NOTSUPPORTED, /* AddCategory */
2000  NOTSUPPORTED, /* GetCategoryStatus */
2008  NOTSUPPORTED, /* GetSpeedDial */
2009  NOTSUPPORTED, /* SetSpeedDial */
2010  DUMMY_GetSMSC,
2011  DUMMY_SetSMSC,
2013  DUMMY_GetSMS,
2015  DUMMY_SetSMS,
2016  DUMMY_AddSMS,
2018  DUMMY_SendSMS,
2024  NOTSUPPORTED, /* AddSMSFolder */
2025  NOTSUPPORTED, /* DeleteSMSFolder */
2030  NOTSUPPORTED, /* HoldCall */
2031  NOTSUPPORTED, /* UnholdCall */
2032  NOTSUPPORTED, /* ConferenceCall */
2033  NOTSUPPORTED, /* SplitCall */
2034  NOTSUPPORTED, /* TransferCall */
2035  NOTSUPPORTED, /* SwitchCall */
2044  NOTSUPPORTED, /* GetRingtonesInfo */
2045  NOTSUPPORTED, /* DeleteUserRingtones */
2046  NOTSUPPORTED, /* PlayTone */
2048  NOTSUPPORTED, /* SetWAPBookmark */
2049  NOTSUPPORTED, /* DeleteWAPBookmark */
2050  NOTSUPPORTED, /* GetWAPSettings */
2051  NOTSUPPORTED, /* SetWAPSettings */
2052  NOTSUPPORTED, /* GetSyncMLSettings */
2053  NOTSUPPORTED, /* SetSyncMLSettings */
2054  NOTSUPPORTED, /* GetChatSettings */
2055  NOTSUPPORTED, /* SetChatSettings */
2056  NOTSUPPORTED, /* GetMMSSettings */
2057  NOTSUPPORTED, /* SetMMSSettings */
2058  NOTSUPPORTED, /* GetMMSFolders */
2059  NOTSUPPORTED, /* GetNextMMSFileInfo */
2063  DUMMY_GetToDo,
2065  DUMMY_SetToDo,
2066  DUMMY_AddToDo,
2079  DUMMY_GetNote,
2081  DUMMY_SetNote,
2082  DUMMY_AddNote,
2085  NOTSUPPORTED, /* GetProfile */
2086  NOTSUPPORTED, /* SetProfile */
2087  NOTSUPPORTED, /* GetFMStation */
2088  NOTSUPPORTED, /* SetFMStation */
2089  NOTSUPPORTED, /* ClearFMStations */
2092  NOTSUPPORTED, /* GetNextRootFolder */
2101  NOTSUPPORTED, /* GetGPRSAccessPoint */
2102  NOTSUPPORTED, /* SetGPRSAccessPoint */
2103  NOTSUPPORTED, /* GetScreenshot */
2104  NOTSUPPORTED, /* SetPower */
2105  NOTSUPPORTED, /* PostConnect */
2107 };
2108 
2111 
2112 /* How should editor hadle tabs in this file? Add editor commands here.
2113  * vim: noexpandtab sw=8 ts=8 sts=8:
2114  */
GSM_SMSMessageType PDU
GSM_Error DUMMY_GetToDoStatus(GSM_StateMachine *s, GSM_ToDoStatus *Status)
Definition: dummy.c:1561
GSM_Config * CurrentConfig
Definition: gsmstate.h:1415
gboolean EnableIncomingUSSD
Definition: gsmstate.h:671
char * DUMMY_GetFSPath(GSM_StateMachine *s, const char *filename, int depth)
Definition: dummy.c:108
GSM_Error DUMMY_GetModel(GSM_StateMachine *s)
Definition: dummy.c:450
GSM_Error DUMMY_GetSignalStrength(GSM_StateMachine *s, GSM_SignalQuality *sig)
Definition: dummy.c:587
unsigned char Name[2 *(GSM_MAX_FILENAME_LENGTH+1)]
Definition: gammu-file.h:74
GSM_ChargeState ChargeState
Definition: gammu-info.h:244
GSM_Error DUMMY_SetFileAttributes(GSM_StateMachine *s, GSM_File *File)
Definition: dummy.c:1095
GSM_Error DUMMY_AnswerCall(GSM_StateMachine *s, int ID, gboolean all)
Definition: dummy.c:701
GSM_Error DUMMY_DeleteAllMemory(GSM_StateMachine *s, GSM_MemoryType type)
Definition: dummy.c:1552
GSM_Error DUMMY_SetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap)
Definition: dummy.c:1090
GSM_Error DUMMY_SetIncomingSMS(GSM_StateMachine *s, gboolean enable)
Definition: dummy.c:923
IncomingUSSDCallback IncomingUSSD
Definition: gsmstate.h:1384
unsigned char ID_FullName[2 *(GSM_MAX_FILENAME_ID_LENGTH+1)]
Definition: gammu-file.h:90
char * DecodeUnicodeString(const unsigned char *src)
Definition: coding.c:245
#define GAMMU_VERSION
Definition: gammu-config.h:7
GSM_Error DUMMY_GetNextFileFolder(GSM_StateMachine *s, GSM_File *File, gboolean start)
Definition: dummy.c:1268
GSM_Error DUMMY_GetSMS(GSM_StateMachine *s, GSM_MultiSMSMessage *sms)
Definition: dummy.c:462
void CopyUnicodeString(unsigned char *Dest, const unsigned char *Source)
Definition: coding.c:1192
GSM_CallStatus Status
Definition: gammu-call.h:86
char dirnames[DUMMY_MAX_FS_DEPTH+1][PATH_MAX]
Definition: dummy.h:47
GSM_Error DUMMY_GetFilePart(GSM_StateMachine *s, GSM_File *File, int *Handle, size_t *Size)
Definition: dummy.c:1154
GSM_Error DUMMY_SetIncomingCB(GSM_StateMachine *s, gboolean enable)
Definition: dummy.c:917
int Level
Definition: gammu-file.h:82
GSM_Error DUMMY_GetMemoryStatus(GSM_StateMachine *s, GSM_MemoryStatus *Status)
Definition: dummy.c:1425
void * IncomingCallUserData
Definition: gsmstate.h:1386
GSM_Error DUMMY_GetWAPBookmark(GSM_StateMachine *s, GSM_WAPBookmark *bookmark)
Definition: dummy.c:1068
char * DUMMY_GetSMSPath(GSM_StateMachine *s, GSM_SMSMessage *sms)
Definition: dummy.c:211
GSM_MemoryType MemoryType
Definition: gammu-memory.h:415
void * IncomingUSSDUserData
Definition: gsmstate.h:1389
GSM_Error DUMMY_ResetPhoneSettings(GSM_StateMachine *s, GSM_ResetSettingsType Type)
Definition: dummy.c:846
char Code[GSM_SECURITY_CODE_LEN+1]
GSM_Error DUMMY_DeleteToDo(GSM_StateMachine *s, GSM_ToDoEntry *entry)
Definition: dummy.c:1611
GSM_Error DUMMY_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus *Status)
Definition: dummy.c:1665
#define NOTSUPPORTED
Definition: gsmcomon.h:14
GSM_Error DUMMY_SetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc)
Definition: dummy.c:809
GSM_Error DUMMY_SetAutoNetworkLogin(GSM_StateMachine *s)
Definition: dummy.c:732
unsigned char NetworkName[15 *2]
Definition: gammu-info.h:135
GSM_Error DUMMY_SetAlarm(GSM_StateMachine *s, GSM_Alarm *entry)
Definition: dummy.c:1007
GSM_Error DUMMY_DeleteAllToDo(GSM_StateMachine *s)
Definition: dummy.c:1660
char * DUMMY_GetFSFilePath(GSM_StateMachine *s, const unsigned char *fullname)
Definition: dummy.c:91
GSM_Error DUMMY_GetMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
Definition: dummy.c:1434
char VerDate[GSM_MAX_VERSION_DATE_LENGTH+1]
Definition: gsmstate.h:458
GSM_DateTime DateTime
GSM_Error DUMMY_GetLocale(GSM_StateMachine *s, GSM_Locale *locale)
Definition: dummy.c:1885
GSM_SMSC SMSC
Definition: dummy.h:43
GSM_Error DUMMY_GetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc)
Definition: dummy.c:820
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
FILE * log_file
Definition: dummy.h:42
GSM_Error DUMMY_GetManufacturer(GSM_StateMachine *s)
Definition: dummy.c:934
SendSMSStatusCallback SendSMSStatus
Definition: gsmstate.h:1385
GSM_Error DUMMY_SetSMS(GSM_StateMachine *s, GSM_SMSMessage *sms)
Definition: dummy.c:544
GSM_Phone_Functions DUMMYPhone
Definition: dummy.c:1964
gboolean EnableIncomingCB
Definition: gsmstate.h:667
GSM_Error DUMMY_GetCallDivert(GSM_StateMachine *s, GSM_CallDivert *request, GSM_MultiCallDivert *response)
Definition: dummy.c:868
GSM_Error
Definition: gammu-error.h:23
GSM_Error DUMMY_DeleteCalendar(GSM_StateMachine *s, GSM_CalendarEntry *entry)
Definition: dummy.c:1715
GSM_CallShowNumber
Definition: gammu-call.h:192
unsigned char * Buffer
Definition: gammu-bitmap.h:45
GSM_OneSMSFolder Folder[GSM_MAX_SMS_FOLDERS]
#define GSM_MemoryTypeToString(x)
Definition: gammu-memory.h:95
char LAC[10]
Definition: gammu-info.h:131
void * SendSMSStatusUserData
Definition: gsmstate.h:1390
size_t UnicodeLength(const unsigned char *str)
Definition: coding.c:186
GSM_Error DUMMY_GetManufactureMonth(GSM_StateMachine *s, char *value)
Definition: dummy.c:424
GSM_SMSMessageLayout PHONE_SMSDeliver
Definition: pfunc.c:16
char * DUMMY_ToDoPath(GSM_StateMachine *s, GSM_ToDoEntry *entry)
Definition: dummy.c:235
gboolean EnableIncomingCall
Definition: gsmstate.h:659
GSM_DateFormat DateFormat
char PacketCID[10]
Definition: gammu-info.h:143
GSM_Error DUMMY_SetLocale(GSM_StateMachine *s, GSM_Locale *locale)
Definition: dummy.c:1892
GSM_Error DUMMY_GetSIMIMSI(GSM_StateMachine *s, char *IMSI)
Definition: dummy.c:862
#define DUMMY_MAX_SMS
Definition: dummy.h:36
const char features[]
Definition: feature_tests.c:2
gboolean Folder
Definition: gammu-file.h:78
gboolean ReadOnly
Definition: gammu-file.h:111
#define DUMMY_MAX_LOCATION
Definition: dummy.h:35
GSM_Error DUMMY_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, gboolean PhoneRingtone)
Definition: dummy.c:1058
GSM_Error DUMMY_DeleteAll(GSM_StateMachine *s, const char *dirname)
Definition: dummy.c:144
char IMEI[GSM_MAX_IMEI_LENGTH+1]
Definition: gsmstate.h:437
unsigned char * Buffer
Definition: gammu-file.h:94
char Version[GSM_MAX_VERSION_LENGTH+1]
Definition: gsmstate.h:454
GSM_BinaryPicture Picture
Definition: gammu-memory.h:403
unsigned int Timeout
Definition: gammu-call.h:170
GSM_Error DUMMY_GetPPM(GSM_StateMachine *s, char *value)
Definition: dummy.c:436
char * DUMMY_MemoryPath(GSM_StateMachine *s, GSM_MemoryEntry *entry)
Definition: dummy.c:228
GSM_Error DUMMY_GetHardware(GSM_StateMachine *s, char *value)
Definition: dummy.c:430
char Manufacturer[GSM_MAX_MANUFACTURER_LENGTH+1]
Definition: gsmstate.h:441
GSM_SMSFormat Format
GSM_FileType Type
Definition: gammu-file.h:86
size_t devlen
Definition: dummy.h:49
GSM_PhoneModel * ModelInfo
Definition: gsmstate.h:449
char NetworkCode[10]
Definition: gammu-info.h:122
GSM_Error DUMMY_SetCalendarSettings(GSM_StateMachine *s, GSM_CalendarSettings *settings)
Definition: dummy.c:1776
GSM_Error DUMMY_AddNote(GSM_StateMachine *s, GSM_NoteEntry *entry)
Definition: dummy.c:1870
char CID[10]
Definition: gammu-info.h:118
GSM_Error DUMMY_AddFolder(GSM_StateMachine *s, GSM_File *File)
Definition: dummy.c:1399
unsigned char Text[(GSM_MAX_CALENDAR_TEXT_LENGTH+1) *2]
GSM_Error DUMMY_SetMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
Definition: dummy.c:1518
GSM_EntryType EntryType
Definition: gammu-memory.h:372
GSM_Error DUMMY_SetIncomingUSSD(GSM_StateMachine *s, gboolean enable)
Definition: dummy.c:1052
int DUMMY_GetNext(GSM_StateMachine *s, const char *dirname, int current)
Definition: dummy.c:187
int DUMMY_GetCount(GSM_StateMachine *s, const char *dirname)
Definition: dummy.c:122
gboolean Protected
Definition: gammu-file.h:107
size_t Used
Definition: gammu-file.h:70
gboolean System
Definition: gammu-file.h:119
#define GSM_MAX_USSD_LENGTH
Definition: gammu-limits.h:309
GSM_Error DUMMY_GetNextSMS(GSM_StateMachine *s, GSM_MultiSMSMessage *sms, gboolean start)
Definition: dummy.c:617
int StatusCode
Definition: gammu-call.h:98
GSM_Error DUMMY_PressKey(GSM_StateMachine *s, GSM_KeyCode Key, gboolean Press)
Definition: dummy.c:737
GSM_Error DUMMY_GetFirmware(GSM_StateMachine *s)
Definition: dummy.c:442
GSM_Error DUMMY_GetNextNote(GSM_StateMachine *s, GSM_NoteEntry *entry, gboolean start)
Definition: dummy.c:1816
GSM_Error DUMMY_SetFastSMSSending(GSM_StateMachine *s, gboolean enable)
Definition: dummy.c:929
unsigned char DefaultNumber[(GSM_MAX_NUMBER_LENGTH+1) *2]
void Fill_GSM_DateTime(GSM_DateTime *Date, time_t timet)
Definition: misc.c:170
int DUMMY_GetFirstFree(GSM_StateMachine *s, const char *dirname)
Definition: dummy.c:162
GSM_Error DUMMY_GetAlarm(GSM_StateMachine *s, GSM_Alarm *entry)
Definition: dummy.c:940
GSM_Error DUMMY_AddToDo(GSM_StateMachine *s, GSM_ToDoEntry *entry)
Definition: dummy.c:1651
GSM_Error DUMMY_DeleteAllNote(GSM_StateMachine *s)
Definition: dummy.c:1879
int gboolean
Definition: gammu-types.h:23
GSM_ValidityPeriodFormat Format
GSM_MemoryType
Definition: gammu-memory.h:31
GSM_Error DUMMY_GetNetworkInfo(GSM_StateMachine *s, GSM_NetworkInfo *netinfo)
Definition: dummy.c:710
GSM_Error DUMMY_DeleteAllCalendar(GSM_StateMachine *s)
Definition: dummy.c:1764
GSM_CalendarNoteType Type
GSM_Error DUMMY_GetNextToDo(GSM_StateMachine *s, GSM_ToDoEntry *entry, gboolean start)
Definition: dummy.c:1596
GSM_Error DUMMY_GetSMSFolders(GSM_StateMachine *s, GSM_SMSFolders *folders)
Definition: dummy.c:595
void EncodeUnicode(unsigned char *dest, const char *src, size_t len)
Definition: coding.c:301
gboolean InboxFolder
GSM_Phone Phone
Definition: gsmstate.h:1431
#define FALSE
Definition: gammu-types.h:25
GSM_SMSValidity Validity
struct GSM_Phone_Data::@2 Priv
GSM_Error DUMMY_EnterSecurityCode(GSM_StateMachine *s, GSM_SecurityCode *Code)
Definition: dummy.c:831
GSM_SecurityCodeType
GSM_Error DUMMY_Reset(GSM_StateMachine *s, gboolean hard)
Definition: dummy.c:750
#define DUMMY_MAX_TODO
Definition: dummy.h:38
GSM_Error DUMMY_Initialise(GSM_StateMachine *s)
Definition: dummy.c:266
GSM_Error DUMMY_GetFolderListing(GSM_StateMachine *s, GSM_File *File, gboolean start)
Definition: dummy.c:1180
GSM_Reply_Function DUMMYReplyFunctions[]
Definition: dummy.c:1960
unsigned char Number[(GSM_MAX_NUMBER_LENGTH+1) *2]
Definition: gammu-call.h:174
GSM_GPRS_State GPRS
Definition: gammu-info.h:139
unsigned char Text[2 *(GSM_MAX_USSD_LENGTH+1)]
GSM_Error DUMMY_SetCalendar(GSM_StateMachine *s, GSM_CalendarEntry *entry)
Definition: dummy.c:1733
GSM_Error DUMMY_CancelCall(GSM_StateMachine *s, int ID, gboolean all)
Definition: dummy.c:763
GSM_Error DUMMY_GetIMEI(GSM_StateMachine *s)
Definition: dummy.c:412
GSM_Error DUMMY_GetDisplayStatus(GSM_StateMachine *s, GSM_DisplayFeatures *features)
Definition: dummy.c:725
GSM_DateTime Modified
Definition: gammu-file.h:98
GSM_Error DUMMY_GetNote(GSM_StateMachine *s, GSM_NoteEntry *entry)
Definition: dummy.c:1788
GSM_Error DUMMY_GetFileSystemStatus(GSM_StateMachine *s, GSM_FileSystemStatus *Status)
Definition: dummy.c:1899
GSM_Error DUMMY_SendDTMF(GSM_StateMachine *s, char *sequence)
Definition: dummy.c:854
char * DUMMY_AlarmPath(GSM_StateMachine *s, GSM_Alarm *entry)
Definition: dummy.c:256
char * DUMMY_CalendarPath(GSM_StateMachine *s, GSM_CalendarEntry *entry)
Definition: dummy.c:249
GSM_Divert_CallTypes CallType
Definition: gammu-call.h:166
unsigned char Name[(GSM_MAX_SMS_FOLDER_NAME_LEN+1) *2]
GSM_Error DUMMY_SendFilePart(GSM_StateMachine *s, GSM_File *File, size_t *Pos, int *Handle)
Definition: dummy.c:1148
GSM_Error DUMMY_DeleteSMS(GSM_StateMachine *s, GSM_SMSMessage *sms)
Definition: dummy.c:527
GSM_Error DUMMY_CancelAllDiverts(GSM_StateMachine *s)
Definition: dummy.c:902
void GSM_OSErrorInfo(GSM_StateMachine *s, const char *description)
Definition: gsmstate.c:1593
GSM_Error DUMMY_GetBatteryCharge(GSM_StateMachine *s, GSM_BatteryCharge *bat)
Definition: dummy.c:1909
GSM_MemoryType Memory
gboolean OutboxFolder
GSM_Error DUMMY_SendSMS(GSM_StateMachine *s, GSM_SMSMessage *sms)
Definition: dummy.c:777
GSM_SMSMessage SMS[GSM_MAX_MULTI_SMS]
GSM_CalendarType EntryType
gboolean ModifiedEmpty
Definition: gammu-file.h:102
GSM_Error DUMMY_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *entry, gboolean start)
Definition: dummy.c:1700
GSM_Error DUMMY_DialVoice(GSM_StateMachine *s, char *number, GSM_CallShowNumber ShowNumber)
Definition: dummy.c:670
GSM_Error DUMMY_GetOriginalIMEI(GSM_StateMachine *s, char *value)
Definition: dummy.c:418
IncomingCallCallback IncomingCall
Definition: gsmstate.h:1381
#define DUMMY_MAX_FS_DEPTH
Definition: dummy.h:39
GSM_Divert_DivertTypes DivertType
Definition: gammu-call.h:162
char * DUMMY_NotePath(GSM_StateMachine *s, GSM_NoteEntry *entry)
Definition: dummy.c:242
gboolean InboxFolder
GSM_Error DUMMY_AddFilePart(GSM_StateMachine *s, GSM_File *File, size_t *Pos, int *Handle)
Definition: dummy.c:1101
GSM_CallDivert Entries[GSM_MAX_CALL_DIVERTS]
Definition: gammu-call.h:184
unsigned char PhoneNumber[(GSM_MAX_NUMBER_LENGTH+1) *2]
Definition: gammu-call.h:102
GSM_Error PHONE_GetSMSFolders(GSM_StateMachine *s UNUSED, GSM_SMSFolders *folders)
Definition: pfunc.c:38
GSM_NetworkInfo_State State
Definition: gammu-info.h:127
GSM_Error DUMMY_Error(GSM_StateMachine *s, const char *message, const char *path)
Definition: dummy.c:60
unsigned char Number[(GSM_MAX_NUMBER_LENGTH+1) *2]
DIR * dir[DUMMY_MAX_FS_DEPTH+1]
Definition: dummy.h:46
GSM_Error GSM_ReadFile(const char *FileName, GSM_File *File)
Definition: gsmmisc.c:74
gboolean CallIDAvailable
Definition: gammu-call.h:94
GSM_Error DUMMY_AddCalendar(GSM_StateMachine *s, GSM_CalendarEntry *entry)
Definition: dummy.c:1755
unsigned char Title[(50+1) *2]
Definition: gammu-wap.h:42
GSM_Error DUMMY_SetToDo(GSM_StateMachine *s, GSM_ToDoEntry *entry)
Definition: dummy.c:1629
GSM_Phone_Data Data
Definition: gsmstate.h:1369
GSM_KeyCode
Definition: gammu-keys.h:30
GSM_SubCalendarEntry Entries[GSM_CALENDAR_ENTRIES]
GSM_MemoryType MemoryType
Definition: gammu-memory.h:131
void GSM_GetCurrentDateTime(GSM_DateTime *Date)
Definition: misc.c:184
GSM_Error DUMMY_SetNote(GSM_StateMachine *s, GSM_NoteEntry *entry)
Definition: dummy.c:1848
GSM_Error DUMMY_GetNextMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry, gboolean start)
Definition: dummy.c:1481
double VerNum
Definition: gsmstate.h:462
gboolean GSM_IsPhoneFeatureAvailable(GSM_PhoneModel *model, GSM_Feature feature)
Definition: gsmphones.c:1026
GSM_Error DUMMY_SendSavedSMS(GSM_StateMachine *s, int Folder, int Location)
Definition: dummy.c:772
char * DUMMY_GetFilePath(GSM_StateMachine *s, const char *filename)
Definition: dummy.c:77
GSM_SMSMessageLayout PHONE_SMSSubmit
Definition: pfunc.c:23
GSM_MultiCallDivert diverts
Definition: dummy.h:45
GSM_Error DUMMY_DeleteFolder(GSM_StateMachine *s, unsigned char *ID)
Definition: dummy.c:1380
GSM_Error DUMMY_GetToDo(GSM_StateMachine *s, GSM_ToDoEntry *entry)
Definition: dummy.c:1568
#define DUMMY_MAX_MEM
Definition: dummy.h:37
GSM_Error DUMMY_AddMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
Definition: dummy.c:1540
void GSM_CreateFirmwareNumber(GSM_StateMachine *s)
Definition: pfunc.c:52
GSM_Error DUMMY_DeleteNote(GSM_StateMachine *s, GSM_NoteEntry *entry)
Definition: dummy.c:1831
#define MKDIR(dir)
Definition: dummy.c:56
GSM_Error DUMMY_GetCalendarSettings(GSM_StateMachine *s, GSM_CalendarSettings *settings)
Definition: dummy.c:1769
#define _(x)
Definition: locales.h:21
GSM_Locale locale
Definition: dummy.h:44
GSM_NetworkInfo_State PacketState
Definition: gammu-info.h:148
GSM_Error DUMMY_GetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap)
Definition: dummy.c:1085
char PacketLAC[10]
Definition: gammu-info.h:152
GSM_Error DUMMY_GetProductCode(GSM_StateMachine *s, char *value)
Definition: dummy.c:406
GSM_Error DUMMY_SetIncomingCall(GSM_StateMachine *s, gboolean enable)
Definition: dummy.c:911
GSM_Error DUMMY_AddSMS(GSM_StateMachine *s, GSM_SMSMessage *sms)
Definition: dummy.c:574
char DateSeparator
GSM_Error DUMMY_Terminate(GSM_StateMachine *s)
Definition: dummy.c:380
unsigned char Address[(255+1) *2]
Definition: gammu-wap.h:38
#define TRUE
Definition: gammu-types.h:28
GSM_SecurityCodeType Type
GSM_Error DUMMY_GetCalendar(GSM_StateMachine *s, GSM_CalendarEntry *entry)
Definition: dummy.c:1672
gboolean EnableIncomingSMS
Definition: gsmstate.h:663
GSM_Error PHONE_EncodeSMSFrame(GSM_StateMachine *s, GSM_SMSMessage *SMS, unsigned char *buffer, GSM_SMSMessageLayout Layout, int *length, gboolean clear)
Definition: pfunc.c:58
GSM_Error DUMMY_GetNoteStatus(GSM_StateMachine *s, GSM_ToDoStatus *Status)
Definition: dummy.c:1781
GSM_Error DUMMY_DeleteMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
Definition: dummy.c:1500
GSM_Error DUMMY_GetSMSStatus(GSM_StateMachine *s, GSM_SMSMemoryStatus *status)
Definition: dummy.c:647
GSM_DisplayFeature Feature[7]
Definition: gammu-info.h:304
GSM_Error DUMMY_PreAPICall(GSM_StateMachine *s)
Definition: dummy.c:1924
GSM_ValidityPeriod Relative
char Model[GSM_MAX_MODEL_LENGTH+1]
Definition: gsmstate.h:445
GSM_Error DUMMY_GetDateTime(GSM_StateMachine *s, GSM_DateTime *date_time)
Definition: dummy.c:456
GSM_Error DUMMY_DispatchMessage(GSM_StateMachine *s)
Definition: dummy.c:401
gboolean Repeating
GSM_MemoryType Memory
GSM_Error DUMMY_DeleteFile(GSM_StateMachine *s, unsigned char *ID)
Definition: dummy.c:1362
GSM_Error DUMMY_DialService(GSM_StateMachine *s, char *number)
Definition: dummy.c:679
#define GAMMU_VERSION_NUM
Definition: gammu-config.h:8
GSM_Error DUMMY_SetDateTime(GSM_StateMachine *s, GSM_DateTime *date_time)
Definition: dummy.c:804
GSM_Error DUMMY_SetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, int *maxlength)
Definition: dummy.c:1063
GSM_USSDStatus Status
unsigned char Text[(GSM_MAX_CALENDAR_TEXT_LENGTH+1) *2]
gboolean AMPMTime
GSM_ResetSettingsType
int smprintf(GSM_StateMachine *s, const char *format,...)
Definition: debug.c:261
GSM_Error DUMMY_DeleteAlarm(GSM_StateMachine *s, GSM_Alarm *entry)
Definition: dummy.c:988
GSM_Error DUMMY_SetCallDivert(GSM_StateMachine *s, GSM_CallDivert *request)
Definition: dummy.c:885
gboolean Hidden
Definition: gammu-file.h:115
GSM_BatteryType BatteryType
Definition: gammu-info.h:276
GSM_Error DUMMY_GetSecurityStatus(GSM_StateMachine *s, GSM_SecurityCodeType *Status)
Definition: dummy.c:840
unsigned char Name[(GSM_MAX_SMSC_NAME_LENGTH+1) *2]
GSM_SubMemoryEntry Entries[GSM_PHONEBOOK_ENTRIES]
Definition: gammu-memory.h:427