Gammu internals  1.38.0
Dummy phone driver
Collaboration diagram for Dummy phone driver:

Data Structures

struct  GSM_Phone_DUMMYData
 

Macros

#define MKDIR(dir)   mkdir(dir, 0755)
 
#define PATH_MAX   (4069)
 
#define DUMMY_MAX_LOCATION   (10000)
 
#define DUMMY_MAX_SMS   (10000)
 
#define DUMMY_MAX_MEM   (10000)
 
#define DUMMY_MAX_TODO   (10000)
 
#define DUMMY_MAX_FS_DEPTH   (20)
 

Functions

GSM_Error DUMMY_Error (GSM_StateMachine *s, const char *message, const char *path)
 
char * DUMMY_GetFilePath (GSM_StateMachine *s, const char *filename)
 
char * DUMMY_GetFSFilePath (GSM_StateMachine *s, const unsigned char *fullname)
 
char * DUMMY_GetFSPath (GSM_StateMachine *s, const char *filename, int depth)
 
int DUMMY_GetCount (GSM_StateMachine *s, const char *dirname)
 
GSM_Error DUMMY_DeleteAll (GSM_StateMachine *s, const char *dirname)
 
int DUMMY_GetFirstFree (GSM_StateMachine *s, const char *dirname)
 
int DUMMY_GetNext (GSM_StateMachine *s, const char *dirname, int current)
 
char * DUMMY_GetSMSPath (GSM_StateMachine *s, GSM_SMSMessage *sms)
 
char * DUMMY_MemoryPath (GSM_StateMachine *s, GSM_MemoryEntry *entry)
 
char * DUMMY_ToDoPath (GSM_StateMachine *s, GSM_ToDoEntry *entry)
 
char * DUMMY_NotePath (GSM_StateMachine *s, GSM_NoteEntry *entry)
 
char * DUMMY_CalendarPath (GSM_StateMachine *s, GSM_CalendarEntry *entry)
 
char * DUMMY_AlarmPath (GSM_StateMachine *s, GSM_Alarm *entry)
 
GSM_Error DUMMY_Initialise (GSM_StateMachine *s)
 
GSM_Error DUMMY_Terminate (GSM_StateMachine *s)
 
GSM_Error DUMMY_DispatchMessage (GSM_StateMachine *s)
 
GSM_Error DUMMY_GetProductCode (GSM_StateMachine *s, char *value)
 
GSM_Error DUMMY_GetIMEI (GSM_StateMachine *s)
 
GSM_Error DUMMY_GetOriginalIMEI (GSM_StateMachine *s, char *value)
 
GSM_Error DUMMY_GetManufactureMonth (GSM_StateMachine *s, char *value)
 
GSM_Error DUMMY_GetHardware (GSM_StateMachine *s, char *value)
 
GSM_Error DUMMY_GetPPM (GSM_StateMachine *s, char *value)
 
GSM_Error DUMMY_GetFirmware (GSM_StateMachine *s)
 
GSM_Error DUMMY_GetModel (GSM_StateMachine *s)
 
GSM_Error DUMMY_GetDateTime (GSM_StateMachine *s, GSM_DateTime *date_time)
 
GSM_Error DUMMY_GetSMS (GSM_StateMachine *s, GSM_MultiSMSMessage *sms)
 
GSM_Error DUMMY_DeleteSMS (GSM_StateMachine *s, GSM_SMSMessage *sms)
 
GSM_Error DUMMY_SetSMS (GSM_StateMachine *s, GSM_SMSMessage *sms)
 
GSM_Error DUMMY_AddSMS (GSM_StateMachine *s, GSM_SMSMessage *sms)
 
GSM_Error DUMMY_GetSignalStrength (GSM_StateMachine *s, GSM_SignalQuality *sig)
 
GSM_Error DUMMY_GetSMSFolders (GSM_StateMachine *s, GSM_SMSFolders *folders)
 
GSM_Error DUMMY_GetNextSMS (GSM_StateMachine *s, GSM_MultiSMSMessage *sms, gboolean start)
 
GSM_Error DUMMY_GetSMSStatus (GSM_StateMachine *s, GSM_SMSMemoryStatus *status)
 
GSM_Error DUMMY_DialVoice (GSM_StateMachine *s, char *number, GSM_CallShowNumber ShowNumber)
 
GSM_Error DUMMY_DialService (GSM_StateMachine *s, char *number)
 
GSM_Error DUMMY_AnswerCall (GSM_StateMachine *s, int ID, gboolean all)
 
GSM_Error DUMMY_GetNetworkInfo (GSM_StateMachine *s, GSM_NetworkInfo *netinfo)
 
GSM_Error DUMMY_GetDisplayStatus (GSM_StateMachine *s, GSM_DisplayFeatures *features)
 
GSM_Error DUMMY_SetAutoNetworkLogin (GSM_StateMachine *s)
 
GSM_Error DUMMY_PressKey (GSM_StateMachine *s, GSM_KeyCode Key, gboolean Press)
 
GSM_Error DUMMY_Reset (GSM_StateMachine *s, gboolean hard)
 
GSM_Error DUMMY_CancelCall (GSM_StateMachine *s, int ID, gboolean all)
 
GSM_Error DUMMY_SendSavedSMS (GSM_StateMachine *s, int Folder, int Location)
 
GSM_Error DUMMY_SendSMS (GSM_StateMachine *s, GSM_SMSMessage *sms)
 
GSM_Error DUMMY_SetDateTime (GSM_StateMachine *s, GSM_DateTime *date_time)
 
GSM_Error DUMMY_SetSMSC (GSM_StateMachine *s, GSM_SMSC *smsc)
 
GSM_Error DUMMY_GetSMSC (GSM_StateMachine *s, GSM_SMSC *smsc)
 
GSM_Error DUMMY_EnterSecurityCode (GSM_StateMachine *s, GSM_SecurityCode *Code)
 
GSM_Error DUMMY_GetSecurityStatus (GSM_StateMachine *s, GSM_SecurityCodeType *Status)
 
GSM_Error DUMMY_ResetPhoneSettings (GSM_StateMachine *s, GSM_ResetSettingsType Type)
 
GSM_Error DUMMY_SendDTMF (GSM_StateMachine *s, char *sequence)
 
GSM_Error DUMMY_GetSIMIMSI (GSM_StateMachine *s, char *IMSI)
 
GSM_Error DUMMY_GetCallDivert (GSM_StateMachine *s, GSM_CallDivert *request, GSM_MultiCallDivert *response)
 
GSM_Error DUMMY_SetCallDivert (GSM_StateMachine *s, GSM_CallDivert *request)
 
GSM_Error DUMMY_CancelAllDiverts (GSM_StateMachine *s)
 
GSM_Error DUMMY_SetIncomingCall (GSM_StateMachine *s, gboolean enable)
 
GSM_Error DUMMY_SetIncomingCB (GSM_StateMachine *s, gboolean enable)
 
GSM_Error DUMMY_SetIncomingSMS (GSM_StateMachine *s, gboolean enable)
 
GSM_Error DUMMY_SetFastSMSSending (GSM_StateMachine *s, gboolean enable)
 
GSM_Error DUMMY_GetManufacturer (GSM_StateMachine *s)
 
GSM_Error DUMMY_GetAlarm (GSM_StateMachine *s, GSM_Alarm *entry)
 
GSM_Error DUMMY_DeleteAlarm (GSM_StateMachine *s, GSM_Alarm *entry)
 
GSM_Error DUMMY_SetAlarm (GSM_StateMachine *s, GSM_Alarm *entry)
 
GSM_Error DUMMY_SetIncomingUSSD (GSM_StateMachine *s, gboolean enable)
 
GSM_Error DUMMY_GetRingtone (GSM_StateMachine *s, GSM_Ringtone *Ringtone, gboolean PhoneRingtone)
 
GSM_Error DUMMY_SetRingtone (GSM_StateMachine *s, GSM_Ringtone *Ringtone, int *maxlength)
 
GSM_Error DUMMY_GetWAPBookmark (GSM_StateMachine *s, GSM_WAPBookmark *bookmark)
 
GSM_Error DUMMY_GetBitmap (GSM_StateMachine *s, GSM_Bitmap *Bitmap)
 
GSM_Error DUMMY_SetBitmap (GSM_StateMachine *s, GSM_Bitmap *Bitmap)
 
GSM_Error DUMMY_SetFileAttributes (GSM_StateMachine *s, GSM_File *File)
 
GSM_Error DUMMY_AddFilePart (GSM_StateMachine *s, GSM_File *File, size_t *Pos, int *Handle)
 
GSM_Error DUMMY_SendFilePart (GSM_StateMachine *s, GSM_File *File, size_t *Pos, int *Handle)
 
GSM_Error DUMMY_GetFilePart (GSM_StateMachine *s, GSM_File *File, int *Handle, size_t *Size)
 
GSM_Error DUMMY_GetFolderListing (GSM_StateMachine *s, GSM_File *File, gboolean start)
 
GSM_Error DUMMY_GetNextFileFolder (GSM_StateMachine *s, GSM_File *File, gboolean start)
 
GSM_Error DUMMY_DeleteFile (GSM_StateMachine *s, unsigned char *ID)
 
GSM_Error DUMMY_DeleteFolder (GSM_StateMachine *s, unsigned char *ID)
 
GSM_Error DUMMY_AddFolder (GSM_StateMachine *s, GSM_File *File)
 
GSM_Error DUMMY_GetMemoryStatus (GSM_StateMachine *s, GSM_MemoryStatus *Status)
 
GSM_Error DUMMY_GetMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry)
 
GSM_Error DUMMY_GetNextMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry, gboolean start)
 
GSM_Error DUMMY_DeleteMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry)
 
GSM_Error DUMMY_SetMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry)
 
GSM_Error DUMMY_AddMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry)
 
GSM_Error DUMMY_DeleteAllMemory (GSM_StateMachine *s, GSM_MemoryType type)
 
GSM_Error DUMMY_GetToDoStatus (GSM_StateMachine *s, GSM_ToDoStatus *Status)
 
GSM_Error DUMMY_GetToDo (GSM_StateMachine *s, GSM_ToDoEntry *entry)
 
GSM_Error DUMMY_GetNextToDo (GSM_StateMachine *s, GSM_ToDoEntry *entry, gboolean start)
 
GSM_Error DUMMY_DeleteToDo (GSM_StateMachine *s, GSM_ToDoEntry *entry)
 
GSM_Error DUMMY_SetToDo (GSM_StateMachine *s, GSM_ToDoEntry *entry)
 
GSM_Error DUMMY_AddToDo (GSM_StateMachine *s, GSM_ToDoEntry *entry)
 
GSM_Error DUMMY_DeleteAllToDo (GSM_StateMachine *s)
 
GSM_Error DUMMY_GetCalendarStatus (GSM_StateMachine *s, GSM_CalendarStatus *Status)
 
GSM_Error DUMMY_GetCalendar (GSM_StateMachine *s, GSM_CalendarEntry *entry)
 
GSM_Error DUMMY_GetNextCalendar (GSM_StateMachine *s, GSM_CalendarEntry *entry, gboolean start)
 
GSM_Error DUMMY_DeleteCalendar (GSM_StateMachine *s, GSM_CalendarEntry *entry)
 
GSM_Error DUMMY_SetCalendar (GSM_StateMachine *s, GSM_CalendarEntry *entry)
 
GSM_Error DUMMY_AddCalendar (GSM_StateMachine *s, GSM_CalendarEntry *entry)
 
GSM_Error DUMMY_DeleteAllCalendar (GSM_StateMachine *s)
 
GSM_Error DUMMY_GetCalendarSettings (GSM_StateMachine *s, GSM_CalendarSettings *settings)
 
GSM_Error DUMMY_SetCalendarSettings (GSM_StateMachine *s, GSM_CalendarSettings *settings)
 
GSM_Error DUMMY_GetNoteStatus (GSM_StateMachine *s, GSM_ToDoStatus *Status)
 
GSM_Error DUMMY_GetNote (GSM_StateMachine *s, GSM_NoteEntry *entry)
 
GSM_Error DUMMY_GetNextNote (GSM_StateMachine *s, GSM_NoteEntry *entry, gboolean start)
 
GSM_Error DUMMY_DeleteNote (GSM_StateMachine *s, GSM_NoteEntry *entry)
 
GSM_Error DUMMY_SetNote (GSM_StateMachine *s, GSM_NoteEntry *entry)
 
GSM_Error DUMMY_AddNote (GSM_StateMachine *s, GSM_NoteEntry *entry)
 
GSM_Error DUMMY_DeleteAllNote (GSM_StateMachine *s)
 
GSM_Error DUMMY_GetLocale (GSM_StateMachine *s, GSM_Locale *locale)
 
GSM_Error DUMMY_SetLocale (GSM_StateMachine *s, GSM_Locale *locale)
 
GSM_Error DUMMY_GetFileSystemStatus (GSM_StateMachine *s, GSM_FileSystemStatus *Status)
 
GSM_Error DUMMY_GetBatteryCharge (GSM_StateMachine *s, GSM_BatteryCharge *bat)
 
GSM_Error DUMMY_PreAPICall (GSM_StateMachine *s)
 

Detailed Description

This driver emulates phone operations on storage on filesystem.

Device name defines folder, then following files and directories are used:

Macro Definition Documentation

§ DUMMY_MAX_FS_DEPTH

#define DUMMY_MAX_FS_DEPTH   (20)

§ DUMMY_MAX_LOCATION

#define DUMMY_MAX_LOCATION   (10000)

Definition at line 35 of file dummy.h.

Referenced by DUMMY_DeleteAll(), DUMMY_GetCount(), DUMMY_GetFirstFree(), and DUMMY_GetNext().

§ DUMMY_MAX_MEM

#define DUMMY_MAX_MEM   (10000)

Definition at line 37 of file dummy.h.

Referenced by DUMMY_GetMemoryStatus().

§ DUMMY_MAX_SMS

#define DUMMY_MAX_SMS   (10000)

Definition at line 36 of file dummy.h.

Referenced by DUMMY_GetSMS(), DUMMY_GetSMSPath(), and DUMMY_GetSMSStatus().

§ DUMMY_MAX_TODO

#define DUMMY_MAX_TODO   (10000)

Definition at line 38 of file dummy.h.

Referenced by DUMMY_GetCalendarStatus(), DUMMY_GetNoteStatus(), and DUMMY_GetToDoStatus().

§ MKDIR

#define MKDIR (   dir)    mkdir(dir, 0755)

Definition at line 56 of file dummy.c.

Referenced by DUMMY_AddFolder(), and DUMMY_Initialise().

§ PATH_MAX

#define PATH_MAX   (4069)

Definition at line 31 of file dummy.h.

Referenced by GSM_FindGammuRC().

Function Documentation

§ DUMMY_AddCalendar()

GSM_Error DUMMY_AddCalendar ( GSM_StateMachine s,
GSM_CalendarEntry entry 
)

Definition at line 1755 of file dummy.c.

References DUMMY_GetFirstFree(), DUMMY_SetCalendar(), ERR_FULL, and GSM_CalendarEntry::Location.

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 }
int DUMMY_GetFirstFree(GSM_StateMachine *s, const char *dirname)
Definition: dummy.c:162
GSM_Error DUMMY_SetCalendar(GSM_StateMachine *s, GSM_CalendarEntry *entry)
Definition: dummy.c:1733

§ DUMMY_AddFilePart()

GSM_Error DUMMY_AddFilePart ( GSM_StateMachine s,
GSM_File File,
size_t *  Pos,
int *  Handle 
)

Definition at line 1101 of file dummy.c.

References GSM_File::Buffer, CopyUnicodeString(), DUMMY_Error(), DUMMY_GetFSFilePath(), ERR_EMPTY, ERR_PERMISSION, GSM_File::ID_FullName, GSM_File::Name, UnicodeLength(), and GSM_File::Used.

Referenced by DUMMY_SendFilePart().

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 }
unsigned char Name[2 *(GSM_MAX_FILENAME_LENGTH+1)]
Definition: gammu-file.h:74
unsigned char ID_FullName[2 *(GSM_MAX_FILENAME_ID_LENGTH+1)]
Definition: gammu-file.h:90
void CopyUnicodeString(unsigned char *Dest, const unsigned char *Source)
Definition: coding.c:1192
char * DUMMY_GetFSFilePath(GSM_StateMachine *s, const unsigned char *fullname)
Definition: dummy.c:91
GSM_Error
Definition: gammu-error.h:23
size_t UnicodeLength(const unsigned char *str)
Definition: coding.c:186
unsigned char * Buffer
Definition: gammu-file.h:94
size_t Used
Definition: gammu-file.h:70
GSM_Error DUMMY_Error(GSM_StateMachine *s, const char *message, const char *path)
Definition: dummy.c:60

§ DUMMY_AddFolder()

GSM_Error DUMMY_AddFolder ( GSM_StateMachine s,
GSM_File File 
)

Definition at line 1399 of file dummy.c.

References CopyUnicodeString(), DUMMY_Error(), DUMMY_GetFSFilePath(), ERR_NONE, GSM_File::ID_FullName, MKDIR, GSM_File::Name, and UnicodeLength().

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 }
unsigned char Name[2 *(GSM_MAX_FILENAME_LENGTH+1)]
Definition: gammu-file.h:74
unsigned char ID_FullName[2 *(GSM_MAX_FILENAME_ID_LENGTH+1)]
Definition: gammu-file.h:90
void CopyUnicodeString(unsigned char *Dest, const unsigned char *Source)
Definition: coding.c:1192
char * DUMMY_GetFSFilePath(GSM_StateMachine *s, const unsigned char *fullname)
Definition: dummy.c:91
GSM_Error
Definition: gammu-error.h:23
size_t UnicodeLength(const unsigned char *str)
Definition: coding.c:186
GSM_Error DUMMY_Error(GSM_StateMachine *s, const char *message, const char *path)
Definition: dummy.c:60
#define MKDIR(dir)
Definition: dummy.c:56

§ DUMMY_AddMemory()

GSM_Error DUMMY_AddMemory ( GSM_StateMachine s,
GSM_MemoryEntry entry 
)

Definition at line 1540 of file dummy.c.

References DUMMY_GetFirstFree(), DUMMY_SetMemory(), ERR_FULL, GSM_MemoryTypeToString, GSM_MemoryEntry::Location, and GSM_MemoryEntry::MemoryType.

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 }
GSM_MemoryType MemoryType
Definition: gammu-memory.h:415
#define GSM_MemoryTypeToString(x)
Definition: gammu-memory.h:95
GSM_Error DUMMY_SetMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
Definition: dummy.c:1518
int DUMMY_GetFirstFree(GSM_StateMachine *s, const char *dirname)
Definition: dummy.c:162

§ DUMMY_AddNote()

GSM_Error DUMMY_AddNote ( GSM_StateMachine s,
GSM_NoteEntry entry 
)

Definition at line 1870 of file dummy.c.

References DUMMY_GetFirstFree(), DUMMY_SetNote(), ERR_FULL, and GSM_NoteEntry::Location.

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 }
int DUMMY_GetFirstFree(GSM_StateMachine *s, const char *dirname)
Definition: dummy.c:162
GSM_Error DUMMY_SetNote(GSM_StateMachine *s, GSM_NoteEntry *entry)
Definition: dummy.c:1848

§ DUMMY_AddSMS()

GSM_Error DUMMY_AddSMS ( GSM_StateMachine s,
GSM_SMSMessage sms 
)

Definition at line 574 of file dummy.c.

References DUMMY_GetFirstFree(), DUMMY_SetSMS(), ERR_FULL, GSM_SMSMessage::Folder, and GSM_SMSMessage::Location.

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 }
GSM_Error DUMMY_SetSMS(GSM_StateMachine *s, GSM_SMSMessage *sms)
Definition: dummy.c:544
int DUMMY_GetFirstFree(GSM_StateMachine *s, const char *dirname)
Definition: dummy.c:162

§ DUMMY_AddToDo()

GSM_Error DUMMY_AddToDo ( GSM_StateMachine s,
GSM_ToDoEntry entry 
)

Definition at line 1651 of file dummy.c.

References DUMMY_GetFirstFree(), DUMMY_SetToDo(), ERR_FULL, and GSM_ToDoEntry::Location.

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 }
int DUMMY_GetFirstFree(GSM_StateMachine *s, const char *dirname)
Definition: dummy.c:162
GSM_Error DUMMY_SetToDo(GSM_StateMachine *s, GSM_ToDoEntry *entry)
Definition: dummy.c:1629

§ DUMMY_AlarmPath()

char* DUMMY_AlarmPath ( GSM_StateMachine s,
GSM_Alarm entry 
)

Definition at line 256 of file dummy.c.

References DUMMY_GetFilePath(), and GSM_Alarm::Location.

Referenced by DUMMY_DeleteAlarm(), DUMMY_GetAlarm(), and DUMMY_SetAlarm().

257 {
258  char path[100];
259  sprintf(path, "alarm/%d", entry->Location);
260  return DUMMY_GetFilePath(s, path);
261 }
char * DUMMY_GetFilePath(GSM_StateMachine *s, const char *filename)
Definition: dummy.c:77

§ DUMMY_AnswerCall()

GSM_Error DUMMY_AnswerCall ( GSM_StateMachine s,
int  ID,
gboolean  all 
)

Definition at line 701 of file dummy.c.

References GSM_Phone::Data, GSM_Phone_Data::DUMMY, ERR_NONE, GSM_Phone_DUMMYData::log_file, _GSM_StateMachine::Phone, and GSM_Phone_Data::Priv.

702 {
704 
705  fprintf(Priv->log_file, "Answering call %d (%d)\n", ID, all);
706 
707  return ERR_NONE;
708 }
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
FILE * log_file
Definition: dummy.h:42
GSM_Phone Phone
Definition: gsmstate.h:1431
struct GSM_Phone_Data::@2 Priv
GSM_Phone_Data Data
Definition: gsmstate.h:1369

§ DUMMY_CalendarPath()

char* DUMMY_CalendarPath ( GSM_StateMachine s,
GSM_CalendarEntry entry 
)

Definition at line 249 of file dummy.c.

References DUMMY_GetFilePath(), and GSM_CalendarEntry::Location.

Referenced by DUMMY_DeleteCalendar(), DUMMY_GetCalendar(), and DUMMY_SetCalendar().

250 {
251  char path[100];
252  sprintf(path, "calendar/%d", entry->Location);
253  return DUMMY_GetFilePath(s, path);
254 }
char * DUMMY_GetFilePath(GSM_StateMachine *s, const char *filename)
Definition: dummy.c:77

§ DUMMY_CancelAllDiverts()

GSM_Error DUMMY_CancelAllDiverts ( GSM_StateMachine s)

Definition at line 902 of file dummy.c.

References GSM_Phone::Data, GSM_Phone_DUMMYData::diverts, GSM_Phone_Data::DUMMY, GSM_MultiCallDivert::EntriesNum, ERR_NONE, _GSM_StateMachine::Phone, and GSM_Phone_Data::Priv.

903 {
905 
906  Priv->diverts.EntriesNum = 0;
907 
908  return ERR_NONE;
909 }
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
GSM_Phone Phone
Definition: gsmstate.h:1431
struct GSM_Phone_Data::@2 Priv
GSM_Phone_Data Data
Definition: gsmstate.h:1369
GSM_MultiCallDivert diverts
Definition: dummy.h:45

§ DUMMY_CancelCall()

GSM_Error DUMMY_CancelCall ( GSM_StateMachine s,
int  ID,
gboolean  all 
)

Definition at line 763 of file dummy.c.

References GSM_Phone::Data, GSM_Phone_Data::DUMMY, ERR_NONE, GSM_Phone_DUMMYData::log_file, _GSM_StateMachine::Phone, and GSM_Phone_Data::Priv.

764 {
766 
767  fprintf(Priv->log_file, "Canceling call %d (%d)\n", ID, all);
768 
769  return ERR_NONE;
770 }
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
FILE * log_file
Definition: dummy.h:42
GSM_Phone Phone
Definition: gsmstate.h:1431
struct GSM_Phone_Data::@2 Priv
GSM_Phone_Data Data
Definition: gsmstate.h:1369

§ DUMMY_DeleteAlarm()

GSM_Error DUMMY_DeleteAlarm ( GSM_StateMachine s,
GSM_Alarm entry 
)

Definition at line 988 of file dummy.c.

References DUMMY_AlarmPath(), DUMMY_Error(), and ERR_NONE.

Referenced by DUMMY_SetAlarm().

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 }
GSM_Error
Definition: gammu-error.h:23
char * DUMMY_AlarmPath(GSM_StateMachine *s, GSM_Alarm *entry)
Definition: dummy.c:256
GSM_Error DUMMY_Error(GSM_StateMachine *s, const char *message, const char *path)
Definition: dummy.c:60

§ DUMMY_DeleteAll()

GSM_Error DUMMY_DeleteAll ( GSM_StateMachine s,
const char *  dirname 
)

Definition at line 144 of file dummy.c.

References _GSM_StateMachine::CurrentConfig, GSM_Phone::Data, GSM_Config::Device, GSM_Phone_DUMMYData::devlen, GSM_Phone_Data::DUMMY, DUMMY_MAX_LOCATION, ERR_NONE, _GSM_StateMachine::Phone, and GSM_Phone_Data::Priv.

Referenced by DUMMY_DeleteAllCalendar(), DUMMY_DeleteAllMemory(), DUMMY_DeleteAllNote(), and DUMMY_DeleteAllToDo().

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 }
GSM_Config * CurrentConfig
Definition: gsmstate.h:1415
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
#define DUMMY_MAX_LOCATION
Definition: dummy.h:35
size_t devlen
Definition: dummy.h:49
GSM_Phone Phone
Definition: gsmstate.h:1431
struct GSM_Phone_Data::@2 Priv
GSM_Phone_Data Data
Definition: gsmstate.h:1369

§ DUMMY_DeleteAllCalendar()

GSM_Error DUMMY_DeleteAllCalendar ( GSM_StateMachine s)

Definition at line 1764 of file dummy.c.

References DUMMY_DeleteAll().

1765 {
1766  return DUMMY_DeleteAll(s, "calendar");
1767 }
GSM_Error DUMMY_DeleteAll(GSM_StateMachine *s, const char *dirname)
Definition: dummy.c:144

§ DUMMY_DeleteAllMemory()

GSM_Error DUMMY_DeleteAllMemory ( GSM_StateMachine s,
GSM_MemoryType  type 
)

Definition at line 1552 of file dummy.c.

References DUMMY_DeleteAll(), and GSM_MemoryTypeToString.

1553 {
1554  char dirname[20];
1555 
1556  sprintf(dirname, "pbk/%s", GSM_MemoryTypeToString(type));
1557 
1558  return DUMMY_DeleteAll(s, dirname);
1559 }
#define GSM_MemoryTypeToString(x)
Definition: gammu-memory.h:95
GSM_Error DUMMY_DeleteAll(GSM_StateMachine *s, const char *dirname)
Definition: dummy.c:144

§ DUMMY_DeleteAllNote()

GSM_Error DUMMY_DeleteAllNote ( GSM_StateMachine s)

Definition at line 1879 of file dummy.c.

References DUMMY_DeleteAll().

1880 {
1881  return DUMMY_DeleteAll(s, "note");
1882 }
GSM_Error DUMMY_DeleteAll(GSM_StateMachine *s, const char *dirname)
Definition: dummy.c:144

§ DUMMY_DeleteAllToDo()

GSM_Error DUMMY_DeleteAllToDo ( GSM_StateMachine s)

Definition at line 1660 of file dummy.c.

References DUMMY_DeleteAll().

1661 {
1662  return DUMMY_DeleteAll(s, "todo");
1663 }
GSM_Error DUMMY_DeleteAll(GSM_StateMachine *s, const char *dirname)
Definition: dummy.c:144

§ DUMMY_DeleteCalendar()

GSM_Error DUMMY_DeleteCalendar ( GSM_StateMachine s,
GSM_CalendarEntry entry 
)

Definition at line 1715 of file dummy.c.

References DUMMY_CalendarPath(), DUMMY_Error(), and ERR_NONE.

Referenced by DUMMY_SetCalendar().

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 }
GSM_Error
Definition: gammu-error.h:23
char * DUMMY_CalendarPath(GSM_StateMachine *s, GSM_CalendarEntry *entry)
Definition: dummy.c:249
GSM_Error DUMMY_Error(GSM_StateMachine *s, const char *message, const char *path)
Definition: dummy.c:60

§ DUMMY_DeleteFile()

GSM_Error DUMMY_DeleteFile ( GSM_StateMachine s,
unsigned char *  ID 
)

Definition at line 1362 of file dummy.c.

References DUMMY_Error(), DUMMY_GetFSFilePath(), ERR_EMPTY, ERR_FILENOTEXIST, and ERR_NONE.

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 }
char * DUMMY_GetFSFilePath(GSM_StateMachine *s, const unsigned char *fullname)
Definition: dummy.c:91
GSM_Error
Definition: gammu-error.h:23
GSM_Error DUMMY_Error(GSM_StateMachine *s, const char *message, const char *path)
Definition: dummy.c:60

§ DUMMY_DeleteFolder()

GSM_Error DUMMY_DeleteFolder ( GSM_StateMachine s,
unsigned char *  ID 
)

Definition at line 1380 of file dummy.c.

References DUMMY_Error(), DUMMY_GetFSFilePath(), ERR_EMPTY, ERR_FILENOTEXIST, ERR_NONE, and smprintf().

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 }
char * DUMMY_GetFSFilePath(GSM_StateMachine *s, const unsigned char *fullname)
Definition: dummy.c:91
GSM_Error
Definition: gammu-error.h:23
GSM_Error DUMMY_Error(GSM_StateMachine *s, const char *message, const char *path)
Definition: dummy.c:60
int smprintf(GSM_StateMachine *s, const char *format,...)
Definition: debug.c:261

§ DUMMY_DeleteMemory()

GSM_Error DUMMY_DeleteMemory ( GSM_StateMachine s,
GSM_MemoryEntry entry 
)

Definition at line 1500 of file dummy.c.

References DUMMY_Error(), DUMMY_MemoryPath(), and ERR_NONE.

Referenced by DUMMY_SetMemory().

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 }
GSM_Error
Definition: gammu-error.h:23
char * DUMMY_MemoryPath(GSM_StateMachine *s, GSM_MemoryEntry *entry)
Definition: dummy.c:228
GSM_Error DUMMY_Error(GSM_StateMachine *s, const char *message, const char *path)
Definition: dummy.c:60

§ DUMMY_DeleteNote()

GSM_Error DUMMY_DeleteNote ( GSM_StateMachine s,
GSM_NoteEntry entry 
)

Definition at line 1831 of file dummy.c.

References DUMMY_Error(), DUMMY_NotePath(), and ERR_NONE.

Referenced by DUMMY_SetNote().

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 }
GSM_Error
Definition: gammu-error.h:23
char * DUMMY_NotePath(GSM_StateMachine *s, GSM_NoteEntry *entry)
Definition: dummy.c:242
GSM_Error DUMMY_Error(GSM_StateMachine *s, const char *message, const char *path)
Definition: dummy.c:60

§ DUMMY_DeleteSMS()

GSM_Error DUMMY_DeleteSMS ( GSM_StateMachine s,
GSM_SMSMessage sms 
)

Definition at line 527 of file dummy.c.

References DUMMY_Error(), DUMMY_GetSMSPath(), and ERR_NONE.

Referenced by DUMMY_SetSMS().

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 }
char * DUMMY_GetSMSPath(GSM_StateMachine *s, GSM_SMSMessage *sms)
Definition: dummy.c:211
GSM_Error
Definition: gammu-error.h:23
GSM_Error DUMMY_Error(GSM_StateMachine *s, const char *message, const char *path)
Definition: dummy.c:60

§ DUMMY_DeleteToDo()

GSM_Error DUMMY_DeleteToDo ( GSM_StateMachine s,
GSM_ToDoEntry entry 
)

Definition at line 1611 of file dummy.c.

References DUMMY_Error(), DUMMY_ToDoPath(), and ERR_NONE.

Referenced by DUMMY_SetToDo().

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 }
GSM_Error
Definition: gammu-error.h:23
char * DUMMY_ToDoPath(GSM_StateMachine *s, GSM_ToDoEntry *entry)
Definition: dummy.c:235
GSM_Error DUMMY_Error(GSM_StateMachine *s, const char *message, const char *path)
Definition: dummy.c:60

§ DUMMY_DialService()

GSM_Error DUMMY_DialService ( GSM_StateMachine s,
char *  number 
)

Definition at line 679 of file dummy.c.

References GSM_Phone::Data, GSM_Phone_Data::DUMMY, GSM_Phone_Data::EnableIncomingUSSD, EncodeUnicode(), ERR_NONE, GSM_MAX_USSD_LENGTH, _GSM_User::IncomingUSSD, _GSM_User::IncomingUSSDUserData, GSM_Phone_DUMMYData::log_file, _GSM_StateMachine::Phone, GSM_Phone_Data::Priv, GSM_USSDMessage::Status, GSM_USSDMessage::Text, _GSM_StateMachine::User, and USSD_NoActionNeeded.

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 }
gboolean EnableIncomingUSSD
Definition: gsmstate.h:671
IncomingUSSDCallback IncomingUSSD
Definition: gsmstate.h:1384
void * IncomingUSSDUserData
Definition: gsmstate.h:1389
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
FILE * log_file
Definition: dummy.h:42
#define GSM_MAX_USSD_LENGTH
Definition: gammu-limits.h:309
void EncodeUnicode(unsigned char *dest, const char *src, size_t len)
Definition: coding.c:301
GSM_Phone Phone
Definition: gsmstate.h:1431
struct GSM_Phone_Data::@2 Priv
unsigned char Text[2 *(GSM_MAX_USSD_LENGTH+1)]
GSM_Phone_Data Data
Definition: gsmstate.h:1369
GSM_USSDStatus Status

§ DUMMY_DialVoice()

GSM_Error DUMMY_DialVoice ( GSM_StateMachine s,
char *  number,
GSM_CallShowNumber  ShowNumber 
)

Definition at line 670 of file dummy.c.

References GSM_Phone::Data, GSM_Phone_Data::DUMMY, ERR_NONE, GSM_Phone_DUMMYData::log_file, _GSM_StateMachine::Phone, and GSM_Phone_Data::Priv.

671 {
673 
674  fprintf(Priv->log_file, "Dialling %s\n", number);
675 
676  return ERR_NONE;
677 }
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
FILE * log_file
Definition: dummy.h:42
GSM_Phone Phone
Definition: gsmstate.h:1431
struct GSM_Phone_Data::@2 Priv
GSM_Phone_Data Data
Definition: gsmstate.h:1369

§ DUMMY_DispatchMessage()

GSM_Error DUMMY_DispatchMessage ( GSM_StateMachine s)

We should not dispatch any messages.

Definition at line 401 of file dummy.c.

References ERR_UNKNOWN.

402 {
403  return ERR_UNKNOWN;
404 }

§ DUMMY_EnterSecurityCode()

GSM_Error DUMMY_EnterSecurityCode ( GSM_StateMachine s,
GSM_SecurityCode Code 
)

Definition at line 831 of file dummy.c.

References GSM_SecurityCode::Code, GSM_Phone::Data, GSM_Phone_Data::DUMMY, ERR_NONE, GSM_Phone_DUMMYData::log_file, _GSM_StateMachine::Phone, GSM_Phone_Data::Priv, and GSM_SecurityCode::Type.

832 {
834 
835  fprintf(Priv->log_file, "Security code %d: %s\n", Code->Type, Code->Code);
836 
837  return ERR_NONE;
838 }
char Code[GSM_SECURITY_CODE_LEN+1]
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
FILE * log_file
Definition: dummy.h:42
GSM_Phone Phone
Definition: gsmstate.h:1431
struct GSM_Phone_Data::@2 Priv
GSM_Phone_Data Data
Definition: gsmstate.h:1369
GSM_SecurityCodeType Type

§ DUMMY_Error()

GSM_Error DUMMY_Error ( GSM_StateMachine s,
const char *  message,
const char *  path 
)

Definition at line 60 of file dummy.c.

References ERR_EMPTY, ERR_FILEALREADYEXIST, ERR_PERMISSION, ERR_UNKNOWN, GSM_OSErrorInfo(), and smprintf().

Referenced by DUMMY_AddFilePart(), DUMMY_AddFolder(), DUMMY_DeleteAlarm(), DUMMY_DeleteCalendar(), DUMMY_DeleteFile(), DUMMY_DeleteFolder(), DUMMY_DeleteMemory(), DUMMY_DeleteNote(), DUMMY_DeleteSMS(), DUMMY_DeleteToDo(), DUMMY_GetFolderListing(), and DUMMY_GetNextFileFolder().

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 }
void GSM_OSErrorInfo(GSM_StateMachine *s, const char *description)
Definition: gsmstate.c:1593
int smprintf(GSM_StateMachine *s, const char *format,...)
Definition: debug.c:261

§ DUMMY_GetAlarm()

GSM_Error DUMMY_GetAlarm ( GSM_StateMachine s,
GSM_Alarm entry 
)

Definition at line 940 of file dummy.c.

References CAL_REPEAT_FREQUENCY, CAL_TEXT, CAL_TONE_ALARM_DATETIME, CopyUnicodeString(), GSM_Alarm::DateTime, DUMMY_AlarmPath(), ERR_CANTOPENFILE, ERR_EMPTY, ERR_NONE, FALSE, GSM_GetCurrentDateTime(), GSM_Alarm::Repeating, GSM_Alarm::Text, and TRUE.

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 }
void CopyUnicodeString(unsigned char *Dest, const unsigned char *Source)
Definition: coding.c:1192
GSM_DateTime DateTime
GSM_Error
Definition: gammu-error.h:23
unsigned char Text[(GSM_MAX_CALENDAR_TEXT_LENGTH+1) *2]
#define FALSE
Definition: gammu-types.h:25
char * DUMMY_AlarmPath(GSM_StateMachine *s, GSM_Alarm *entry)
Definition: dummy.c:256
void GSM_GetCurrentDateTime(GSM_DateTime *Date)
Definition: misc.c:184
#define TRUE
Definition: gammu-types.h:28
gboolean Repeating

§ DUMMY_GetBatteryCharge()

GSM_Error DUMMY_GetBatteryCharge ( GSM_StateMachine s,
GSM_BatteryCharge bat 
)

Definition at line 1909 of file dummy.c.

References GSM_BatteryCharge::BatteryCapacity, GSM_BatteryCharge::BatteryPercent, GSM_BatteryCharge::BatteryTemperature, GSM_BatteryCharge::BatteryType, GSM_BatteryCharge::BatteryVoltage, GSM_BatteryCharge::ChargeCurrent, GSM_BatteryCharge::ChargeState, GSM_BatteryCharge::ChargeVoltage, ERR_NONE, GSM_BatteryConnected, GSM_BatteryLiPol, GSM_BatteryCharge::PhoneCurrent, and GSM_BatteryCharge::PhoneTemperature.

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 }
GSM_ChargeState ChargeState
Definition: gammu-info.h:244
GSM_BatteryType BatteryType
Definition: gammu-info.h:276

§ DUMMY_GetBitmap()

GSM_Error DUMMY_GetBitmap ( GSM_StateMachine s,
GSM_Bitmap Bitmap 
)

Definition at line 1085 of file dummy.c.

References ERR_NOTIMPLEMENTED.

1086 {
1087  return ERR_NOTIMPLEMENTED;
1088 }

§ DUMMY_GetCalendar()

GSM_Error DUMMY_GetCalendar ( GSM_StateMachine s,
GSM_CalendarEntry entry 
)

Definition at line 1672 of file dummy.c.

References DUMMY_CalendarPath(), ERR_CANTOPENFILE, ERR_EMPTY, ERR_NONE, and GSM_CalendarEntry::Location.

Referenced by DUMMY_GetNextCalendar().

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 }
GSM_Error
Definition: gammu-error.h:23
char * DUMMY_CalendarPath(GSM_StateMachine *s, GSM_CalendarEntry *entry)
Definition: dummy.c:249

§ DUMMY_GetCalendarSettings()

GSM_Error DUMMY_GetCalendarSettings ( GSM_StateMachine s,
GSM_CalendarSettings settings 
)

Definition at line 1769 of file dummy.c.

References GSM_CalendarSettings::AutoDelete, ERR_NONE, and GSM_CalendarSettings::StartDay.

1770 {
1771  settings->StartDay = 1;
1772  settings->AutoDelete = 0;
1773  return ERR_NONE;
1774 }

§ DUMMY_GetCalendarStatus()

GSM_Error DUMMY_GetCalendarStatus ( GSM_StateMachine s,
GSM_CalendarStatus Status 
)

Definition at line 1665 of file dummy.c.

References DUMMY_GetCount(), DUMMY_MAX_TODO, ERR_NONE, GSM_CalendarStatus::Free, and GSM_CalendarStatus::Used.

1666 {
1667  Status->Used = DUMMY_GetCount(s, "calendar");
1668  Status->Free = DUMMY_MAX_TODO - Status->Used;
1669  return ERR_NONE;
1670 }
int DUMMY_GetCount(GSM_StateMachine *s, const char *dirname)
Definition: dummy.c:122
#define DUMMY_MAX_TODO
Definition: dummy.h:38

§ DUMMY_GetCallDivert()

GSM_Error DUMMY_GetCallDivert ( GSM_StateMachine s,
GSM_CallDivert request,
GSM_MultiCallDivert response 
)

Definition at line 868 of file dummy.c.

References GSM_CallDivert::CallType, GSM_Phone::Data, GSM_Phone_DUMMYData::diverts, GSM_CallDivert::DivertType, GSM_Phone_Data::DUMMY, GSM_MultiCallDivert::Entries, GSM_MultiCallDivert::EntriesNum, ERR_NONE, _GSM_StateMachine::Phone, and GSM_Phone_Data::Priv.

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 }
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
GSM_Phone Phone
Definition: gsmstate.h:1431
struct GSM_Phone_Data::@2 Priv
GSM_Divert_CallTypes CallType
Definition: gammu-call.h:166
GSM_Divert_DivertTypes DivertType
Definition: gammu-call.h:162
GSM_CallDivert Entries[GSM_MAX_CALL_DIVERTS]
Definition: gammu-call.h:184
GSM_Phone_Data Data
Definition: gsmstate.h:1369
GSM_MultiCallDivert diverts
Definition: dummy.h:45

§ DUMMY_GetCount()

int DUMMY_GetCount ( GSM_StateMachine s,
const char *  dirname 
)

Definition at line 122 of file dummy.c.

References _GSM_StateMachine::CurrentConfig, GSM_Phone::Data, GSM_Config::Device, GSM_Phone_DUMMYData::devlen, GSM_Phone_Data::DUMMY, DUMMY_MAX_LOCATION, _GSM_StateMachine::Phone, and GSM_Phone_Data::Priv.

Referenced by DUMMY_GetCalendarStatus(), DUMMY_GetMemoryStatus(), DUMMY_GetNoteStatus(), DUMMY_GetSMSStatus(), and DUMMY_GetToDoStatus().

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 }
GSM_Config * CurrentConfig
Definition: gsmstate.h:1415
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
#define DUMMY_MAX_LOCATION
Definition: dummy.h:35
size_t devlen
Definition: dummy.h:49
GSM_Phone Phone
Definition: gsmstate.h:1431
struct GSM_Phone_Data::@2 Priv
GSM_Phone_Data Data
Definition: gsmstate.h:1369

§ DUMMY_GetDateTime()

GSM_Error DUMMY_GetDateTime ( GSM_StateMachine s,
GSM_DateTime date_time 
)

Definition at line 456 of file dummy.c.

References ERR_NONE, and GSM_GetCurrentDateTime().

457 {
458  GSM_GetCurrentDateTime(date_time);
459  return ERR_NONE;
460 }
void GSM_GetCurrentDateTime(GSM_DateTime *Date)
Definition: misc.c:184

§ DUMMY_GetDisplayStatus()

GSM_Error DUMMY_GetDisplayStatus ( GSM_StateMachine s,
GSM_DisplayFeatures features 
)

Definition at line 725 of file dummy.c.

References ERR_NONE, GSM_DisplayFeatures::Feature, GSM_KeypadLocked, and GSM_DisplayFeatures::Number.

726 {
727  features->Number = 1;
728  features->Feature[0] = GSM_KeypadLocked;
729  return ERR_NONE;
730 }
GSM_DisplayFeature Feature[7]
Definition: gammu-info.h:304

§ DUMMY_GetFilePart()

GSM_Error DUMMY_GetFilePart ( GSM_StateMachine s,
GSM_File File,
int *  Handle,
size_t *  Size 
)

Definition at line 1154 of file dummy.c.

References DUMMY_GetFSFilePath(), EncodeUnicode(), ERR_EMPTY, ERR_NONE, GSM_ReadFile(), GSM_File::ID_FullName, GSM_File::Level, GSM_File::Name, and GSM_File::Used.

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 }
unsigned char Name[2 *(GSM_MAX_FILENAME_LENGTH+1)]
Definition: gammu-file.h:74
unsigned char ID_FullName[2 *(GSM_MAX_FILENAME_ID_LENGTH+1)]
Definition: gammu-file.h:90
int Level
Definition: gammu-file.h:82
char * DUMMY_GetFSFilePath(GSM_StateMachine *s, const unsigned char *fullname)
Definition: dummy.c:91
GSM_Error
Definition: gammu-error.h:23
size_t Used
Definition: gammu-file.h:70
void EncodeUnicode(unsigned char *dest, const char *src, size_t len)
Definition: coding.c:301
GSM_Error GSM_ReadFile(const char *FileName, GSM_File *File)
Definition: gsmmisc.c:74

§ DUMMY_GetFilePath()

char* DUMMY_GetFilePath ( GSM_StateMachine s,
const char *  filename 
)

Definition at line 77 of file dummy.c.

References _GSM_StateMachine::CurrentConfig, GSM_Phone::Data, GSM_Config::Device, GSM_Phone_DUMMYData::devlen, GSM_Phone_Data::DUMMY, _GSM_StateMachine::Phone, and GSM_Phone_Data::Priv.

Referenced by DUMMY_AlarmPath(), DUMMY_CalendarPath(), DUMMY_GetNextFileFolder(), DUMMY_GetSMSPath(), DUMMY_Initialise(), DUMMY_MemoryPath(), DUMMY_NotePath(), DUMMY_PreAPICall(), and DUMMY_ToDoPath().

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 }
GSM_Config * CurrentConfig
Definition: gsmstate.h:1415
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
size_t devlen
Definition: dummy.h:49
GSM_Phone Phone
Definition: gsmstate.h:1431
struct GSM_Phone_Data::@2 Priv
GSM_Phone_Data Data
Definition: gsmstate.h:1369

§ DUMMY_GetFileSystemStatus()

GSM_Error DUMMY_GetFileSystemStatus ( GSM_StateMachine s,
GSM_FileSystemStatus Status 
)

Definition at line 1899 of file dummy.c.

References ERR_NONE, GSM_FileSystemStatus::Free, GSM_FileSystemStatus::Used, GSM_FileSystemStatus::UsedImages, GSM_FileSystemStatus::UsedSounds, and GSM_FileSystemStatus::UsedThemes.

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 }

§ DUMMY_GetFirmware()

GSM_Error DUMMY_GetFirmware ( GSM_StateMachine s)

Definition at line 442 of file dummy.c.

References GSM_Phone::Data, ERR_NONE, GAMMU_VERSION, GSM_CreateFirmwareNumber(), _GSM_StateMachine::Phone, GSM_Phone_Data::VerDate, and GSM_Phone_Data::Version.

443 {
444  strcpy(s->Phone.Data.Version, GAMMU_VERSION);
445  strcpy(s->Phone.Data.VerDate, "20150101");
447  return ERR_NONE;
448 }
#define GAMMU_VERSION
Definition: gammu-config.h:7
char VerDate[GSM_MAX_VERSION_DATE_LENGTH+1]
Definition: gsmstate.h:458
char Version[GSM_MAX_VERSION_LENGTH+1]
Definition: gsmstate.h:454
GSM_Phone Phone
Definition: gsmstate.h:1431
GSM_Phone_Data Data
Definition: gsmstate.h:1369
void GSM_CreateFirmwareNumber(GSM_StateMachine *s)
Definition: pfunc.c:52

§ DUMMY_GetFirstFree()

int DUMMY_GetFirstFree ( GSM_StateMachine s,
const char *  dirname 
)

Definition at line 162 of file dummy.c.

References _GSM_StateMachine::CurrentConfig, GSM_Phone::Data, GSM_Config::Device, GSM_Phone_DUMMYData::devlen, GSM_Phone_Data::DUMMY, DUMMY_MAX_LOCATION, _GSM_StateMachine::Phone, and GSM_Phone_Data::Priv.

Referenced by DUMMY_AddCalendar(), DUMMY_AddMemory(), DUMMY_AddNote(), DUMMY_AddSMS(), and DUMMY_AddToDo().

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 }
GSM_Config * CurrentConfig
Definition: gsmstate.h:1415
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
#define DUMMY_MAX_LOCATION
Definition: dummy.h:35
size_t devlen
Definition: dummy.h:49
GSM_Phone Phone
Definition: gsmstate.h:1431
struct GSM_Phone_Data::@2 Priv
GSM_Phone_Data Data
Definition: gsmstate.h:1369

§ DUMMY_GetFolderListing()

GSM_Error DUMMY_GetFolderListing ( GSM_StateMachine s,
GSM_File File,
gboolean  start 
)

Definition at line 1180 of file dummy.c.

References GSM_File::Buffer, GSM_Phone::Data, GSM_Phone_DUMMYData::devlen, GSM_Phone_DUMMYData::dir, GSM_Phone_DUMMYData::dirnames, GSM_Phone_Data::DUMMY, DUMMY_Error(), DUMMY_GetFSFilePath(), DUMMY_GetFSPath(), DUMMY_MAX_FS_DEPTH, EncodeUnicode(), ERR_EMPTY, ERR_MOREMEMORY, ERR_NONE, FALSE, Fill_GSM_DateTime(), GSM_File::Folder, GSM_Phone_DUMMYData::fs_depth, GSM_File_Other, GSM_File::Hidden, GSM_File::ID_FullName, GSM_File::Level, GSM_File::Modified, GSM_File::ModifiedEmpty, GSM_File::Name, _GSM_StateMachine::Phone, GSM_Phone_Data::Priv, GSM_File::Protected, GSM_File::ReadOnly, smprintf(), GSM_File::System, TRUE, GSM_File::Type, and GSM_File::Used.

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 }
char * DUMMY_GetFSPath(GSM_StateMachine *s, const char *filename, int depth)
Definition: dummy.c:108
unsigned char Name[2 *(GSM_MAX_FILENAME_LENGTH+1)]
Definition: gammu-file.h:74
unsigned char ID_FullName[2 *(GSM_MAX_FILENAME_ID_LENGTH+1)]
Definition: gammu-file.h:90
char dirnames[DUMMY_MAX_FS_DEPTH+1][PATH_MAX]
Definition: dummy.h:47
int Level
Definition: gammu-file.h:82
char * DUMMY_GetFSFilePath(GSM_StateMachine *s, const unsigned char *fullname)
Definition: dummy.c:91
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
GSM_Error
Definition: gammu-error.h:23
gboolean Folder
Definition: gammu-file.h:78
gboolean ReadOnly
Definition: gammu-file.h:111
unsigned char * Buffer
Definition: gammu-file.h:94
GSM_FileType Type
Definition: gammu-file.h:86
size_t devlen
Definition: dummy.h:49
gboolean Protected
Definition: gammu-file.h:107
size_t Used
Definition: gammu-file.h:70
gboolean System
Definition: gammu-file.h:119
void Fill_GSM_DateTime(GSM_DateTime *Date, time_t timet)
Definition: misc.c:170
void EncodeUnicode(unsigned char *dest, const char *src, size_t len)
Definition: coding.c:301
GSM_Phone Phone
Definition: gsmstate.h:1431
#define FALSE
Definition: gammu-types.h:25
struct GSM_Phone_Data::@2 Priv
GSM_DateTime Modified
Definition: gammu-file.h:98
gboolean ModifiedEmpty
Definition: gammu-file.h:102
#define DUMMY_MAX_FS_DEPTH
Definition: dummy.h:39
GSM_Error DUMMY_Error(GSM_StateMachine *s, const char *message, const char *path)
Definition: dummy.c:60
DIR * dir[DUMMY_MAX_FS_DEPTH+1]
Definition: dummy.h:46
GSM_Phone_Data Data
Definition: gsmstate.h:1369
#define TRUE
Definition: gammu-types.h:28
int smprintf(GSM_StateMachine *s, const char *format,...)
Definition: debug.c:261
gboolean Hidden
Definition: gammu-file.h:115

§ DUMMY_GetFSFilePath()

char* DUMMY_GetFSFilePath ( GSM_StateMachine s,
const unsigned char *  fullname 
)

Definition at line 91 of file dummy.c.

References _GSM_StateMachine::CurrentConfig, GSM_Phone::Data, DecodeUnicodeString(), GSM_Config::Device, GSM_Phone_DUMMYData::devlen, GSM_Phone_Data::DUMMY, _GSM_StateMachine::Phone, and GSM_Phone_Data::Priv.

Referenced by DUMMY_AddFilePart(), DUMMY_AddFolder(), DUMMY_DeleteFile(), DUMMY_DeleteFolder(), DUMMY_GetFilePart(), and DUMMY_GetFolderListing().

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 }
GSM_Config * CurrentConfig
Definition: gsmstate.h:1415
char * DecodeUnicodeString(const unsigned char *src)
Definition: coding.c:245
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
size_t devlen
Definition: dummy.h:49
GSM_Phone Phone
Definition: gsmstate.h:1431
struct GSM_Phone_Data::@2 Priv
GSM_Phone_Data Data
Definition: gsmstate.h:1369

§ DUMMY_GetFSPath()

char* DUMMY_GetFSPath ( GSM_StateMachine s,
const char *  filename,
int  depth 
)

Definition at line 108 of file dummy.c.

References GSM_Phone::Data, GSM_Phone_DUMMYData::dirnames, GSM_Phone_Data::DUMMY, _GSM_StateMachine::Phone, and GSM_Phone_Data::Priv.

Referenced by DUMMY_GetFolderListing(), and DUMMY_GetNextFileFolder().

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 }
char dirnames[DUMMY_MAX_FS_DEPTH+1][PATH_MAX]
Definition: dummy.h:47
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
GSM_Phone Phone
Definition: gsmstate.h:1431
struct GSM_Phone_Data::@2 Priv
GSM_Phone_Data Data
Definition: gsmstate.h:1369

§ DUMMY_GetHardware()

GSM_Error DUMMY_GetHardware ( GSM_StateMachine s,
char *  value 
)

Definition at line 430 of file dummy.c.

References ERR_NONE.

431 {
432  strcpy(value, "FOO DUMMY BAR");
433  return ERR_NONE;
434 }

§ DUMMY_GetIMEI()

GSM_Error DUMMY_GetIMEI ( GSM_StateMachine s)

Definition at line 412 of file dummy.c.

References GSM_Phone::Data, ERR_NONE, GSM_Phone_Data::IMEI, and _GSM_StateMachine::Phone.

413 {
414  strcpy(s->Phone.Data.IMEI, "999999999999999");
415  return ERR_NONE;
416 }
char IMEI[GSM_MAX_IMEI_LENGTH+1]
Definition: gsmstate.h:437
GSM_Phone Phone
Definition: gsmstate.h:1431
GSM_Phone_Data Data
Definition: gsmstate.h:1369

§ DUMMY_GetLocale()

GSM_Error DUMMY_GetLocale ( GSM_StateMachine s,
GSM_Locale locale 
)

Definition at line 1885 of file dummy.c.

References GSM_Phone::Data, GSM_Phone_Data::DUMMY, ERR_NONE, GSM_Phone_DUMMYData::locale, _GSM_StateMachine::Phone, and GSM_Phone_Data::Priv.

1886 {
1887  GSM_Phone_DUMMYData *Priv = &s->Phone.Data.Priv.DUMMY;
1888  *locale = Priv->locale;
1889  return ERR_NONE;
1890 }
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
GSM_Phone Phone
Definition: gsmstate.h:1431
struct GSM_Phone_Data::@2 Priv
GSM_Phone_Data Data
Definition: gsmstate.h:1369
GSM_Locale locale
Definition: dummy.h:44

§ DUMMY_GetManufactureMonth()

GSM_Error DUMMY_GetManufactureMonth ( GSM_StateMachine s,
char *  value 
)

Definition at line 424 of file dummy.c.

References ERR_NONE.

425 {
426  strcpy(value, "April");
427  return ERR_NONE;
428 }

§ DUMMY_GetManufacturer()

GSM_Error DUMMY_GetManufacturer ( GSM_StateMachine s)

Definition at line 934 of file dummy.c.

References GSM_Phone::Data, ERR_NONE, GSM_Phone_Data::Manufacturer, and _GSM_StateMachine::Phone.

935 {
936  strcpy(s->Phone.Data.Manufacturer, "Gammu");
937  return ERR_NONE;
938 }
char Manufacturer[GSM_MAX_MANUFACTURER_LENGTH+1]
Definition: gsmstate.h:441
GSM_Phone Phone
Definition: gsmstate.h:1431
GSM_Phone_Data Data
Definition: gsmstate.h:1369

§ DUMMY_GetMemory()

GSM_Error DUMMY_GetMemory ( GSM_StateMachine s,
GSM_MemoryEntry entry 
)

Definition at line 1434 of file dummy.c.

References GSM_BinaryPicture::Buffer, DUMMY_MemoryPath(), GSM_MemoryEntry::Entries, GSM_MemoryEntry::EntriesNum, GSM_SubMemoryEntry::EntryType, ERR_CANTOPENFILE, ERR_EMPTY, ERR_NONE, GSM_BinaryPicture::Length, GSM_MemoryEntry::Location, GSM_MemoryEntry::MemoryType, PBK_Photo, and GSM_SubMemoryEntry::Picture.

Referenced by DUMMY_GetNextMemory().

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 }
GSM_MemoryType MemoryType
Definition: gammu-memory.h:415
GSM_Error
Definition: gammu-error.h:23
unsigned char * Buffer
Definition: gammu-bitmap.h:45
GSM_BinaryPicture Picture
Definition: gammu-memory.h:403
char * DUMMY_MemoryPath(GSM_StateMachine *s, GSM_MemoryEntry *entry)
Definition: dummy.c:228
GSM_EntryType EntryType
Definition: gammu-memory.h:372
GSM_MemoryType
Definition: gammu-memory.h:31
GSM_SubMemoryEntry Entries[GSM_PHONEBOOK_ENTRIES]
Definition: gammu-memory.h:427

§ DUMMY_GetMemoryStatus()

GSM_Error DUMMY_GetMemoryStatus ( GSM_StateMachine s,
GSM_MemoryStatus Status 
)

Definition at line 1425 of file dummy.c.

References DUMMY_GetCount(), DUMMY_MAX_MEM, ERR_NONE, GSM_MemoryTypeToString, GSM_MemoryStatus::MemoryFree, GSM_MemoryStatus::MemoryType, and GSM_MemoryStatus::MemoryUsed.

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 }
#define GSM_MemoryTypeToString(x)
Definition: gammu-memory.h:95
int DUMMY_GetCount(GSM_StateMachine *s, const char *dirname)
Definition: dummy.c:122
GSM_MemoryType MemoryType
Definition: gammu-memory.h:131
#define DUMMY_MAX_MEM
Definition: dummy.h:37

§ DUMMY_GetModel()

GSM_Error DUMMY_GetModel ( GSM_StateMachine s)

Definition at line 450 of file dummy.c.

References GSM_Phone::Data, ERR_NONE, GSM_Phone_Data::Model, and _GSM_StateMachine::Phone.

451 {
452  strcpy(s->Phone.Data.Model, "Dummy");
453  return ERR_NONE;
454 }
GSM_Phone Phone
Definition: gsmstate.h:1431
GSM_Phone_Data Data
Definition: gsmstate.h:1369
char Model[GSM_MAX_MODEL_LENGTH+1]
Definition: gsmstate.h:445

§ DUMMY_GetNetworkInfo()

GSM_Error DUMMY_GetNetworkInfo ( GSM_StateMachine s,
GSM_NetworkInfo netinfo 
)

Definition at line 710 of file dummy.c.

References GSM_NetworkInfo::CID, EncodeUnicode(), ERR_NONE, GSM_NetworkInfo::GPRS, GSM_GPRS_Attached, GSM_HomeNetwork, GSM_NetworkInfo::LAC, GSM_NetworkInfo::NetworkCode, GSM_NetworkInfo::NetworkName, GSM_NetworkInfo::PacketCID, GSM_NetworkInfo::PacketLAC, GSM_NetworkInfo::PacketState, and GSM_NetworkInfo::State.

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 }
unsigned char NetworkName[15 *2]
Definition: gammu-info.h:135
char LAC[10]
Definition: gammu-info.h:131
char PacketCID[10]
Definition: gammu-info.h:143
char NetworkCode[10]
Definition: gammu-info.h:122
char CID[10]
Definition: gammu-info.h:118
void EncodeUnicode(unsigned char *dest, const char *src, size_t len)
Definition: coding.c:301
GSM_GPRS_State GPRS
Definition: gammu-info.h:139
GSM_NetworkInfo_State State
Definition: gammu-info.h:127
GSM_NetworkInfo_State PacketState
Definition: gammu-info.h:148
char PacketLAC[10]
Definition: gammu-info.h:152

§ DUMMY_GetNext()

int DUMMY_GetNext ( GSM_StateMachine s,
const char *  dirname,
int  current 
)

Definition at line 187 of file dummy.c.

References _GSM_StateMachine::CurrentConfig, GSM_Phone::Data, GSM_Config::Device, GSM_Phone_DUMMYData::devlen, GSM_Phone_Data::DUMMY, DUMMY_MAX_LOCATION, _GSM_StateMachine::Phone, and GSM_Phone_Data::Priv.

Referenced by DUMMY_GetNextCalendar(), DUMMY_GetNextMemory(), DUMMY_GetNextNote(), DUMMY_GetNextSMS(), and DUMMY_GetNextToDo().

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 }
GSM_Config * CurrentConfig
Definition: gsmstate.h:1415
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
#define DUMMY_MAX_LOCATION
Definition: dummy.h:35
size_t devlen
Definition: dummy.h:49
GSM_Phone Phone
Definition: gsmstate.h:1431
struct GSM_Phone_Data::@2 Priv
GSM_Phone_Data Data
Definition: gsmstate.h:1369

§ DUMMY_GetNextCalendar()

GSM_Error DUMMY_GetNextCalendar ( GSM_StateMachine s,
GSM_CalendarEntry entry,
gboolean  start 
)

Definition at line 1700 of file dummy.c.

References GSM_Phone::Data, DUMMY_GetCalendar(), DUMMY_GetNext(), ERR_NOTSUPPORTED, F_DISABLE_GETNEXT, GSM_IsPhoneFeatureAvailable(), GSM_CalendarEntry::Location, GSM_Phone_Data::ModelInfo, and _GSM_StateMachine::Phone.

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 }
GSM_PhoneModel * ModelInfo
Definition: gsmstate.h:449
int DUMMY_GetNext(GSM_StateMachine *s, const char *dirname, int current)
Definition: dummy.c:187
GSM_Phone Phone
Definition: gsmstate.h:1431
GSM_Phone_Data Data
Definition: gsmstate.h:1369
gboolean GSM_IsPhoneFeatureAvailable(GSM_PhoneModel *model, GSM_Feature feature)
Definition: gsmphones.c:1026
GSM_Error DUMMY_GetCalendar(GSM_StateMachine *s, GSM_CalendarEntry *entry)
Definition: dummy.c:1672

§ DUMMY_GetNextFileFolder()

GSM_Error DUMMY_GetNextFileFolder ( GSM_StateMachine s,
GSM_File File,
gboolean  start 
)

Definition at line 1268 of file dummy.c.

References GSM_File::Buffer, GSM_Phone::Data, GSM_Phone_DUMMYData::devlen, GSM_Phone_DUMMYData::dir, GSM_Phone_DUMMYData::dirnames, GSM_Phone_Data::DUMMY, DUMMY_Error(), DUMMY_GetFilePath(), DUMMY_GetFSPath(), DUMMY_MAX_FS_DEPTH, EncodeUnicode(), ERR_EMPTY, ERR_MOREMEMORY, ERR_NONE, FALSE, Fill_GSM_DateTime(), GSM_File::Folder, GSM_Phone_DUMMYData::fs_depth, GSM_File_Other, GSM_File::Hidden, GSM_File::ID_FullName, GSM_File::Level, GSM_File::Modified, GSM_File::ModifiedEmpty, GSM_File::Name, _GSM_StateMachine::Phone, GSM_Phone_Data::Priv, GSM_File::Protected, GSM_File::ReadOnly, smprintf(), GSM_File::System, TRUE, GSM_File::Type, and GSM_File::Used.

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 }
char * DUMMY_GetFSPath(GSM_StateMachine *s, const char *filename, int depth)
Definition: dummy.c:108
unsigned char Name[2 *(GSM_MAX_FILENAME_LENGTH+1)]
Definition: gammu-file.h:74
unsigned char ID_FullName[2 *(GSM_MAX_FILENAME_ID_LENGTH+1)]
Definition: gammu-file.h:90
char dirnames[DUMMY_MAX_FS_DEPTH+1][PATH_MAX]
Definition: dummy.h:47
int Level
Definition: gammu-file.h:82
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
GSM_Error
Definition: gammu-error.h:23
gboolean Folder
Definition: gammu-file.h:78
gboolean ReadOnly
Definition: gammu-file.h:111
unsigned char * Buffer
Definition: gammu-file.h:94
GSM_FileType Type
Definition: gammu-file.h:86
size_t devlen
Definition: dummy.h:49
gboolean Protected
Definition: gammu-file.h:107
size_t Used
Definition: gammu-file.h:70
gboolean System
Definition: gammu-file.h:119
void Fill_GSM_DateTime(GSM_DateTime *Date, time_t timet)
Definition: misc.c:170
void EncodeUnicode(unsigned char *dest, const char *src, size_t len)
Definition: coding.c:301
GSM_Phone Phone
Definition: gsmstate.h:1431
#define FALSE
Definition: gammu-types.h:25
struct GSM_Phone_Data::@2 Priv
GSM_DateTime Modified
Definition: gammu-file.h:98
gboolean ModifiedEmpty
Definition: gammu-file.h:102
#define DUMMY_MAX_FS_DEPTH
Definition: dummy.h:39
GSM_Error DUMMY_Error(GSM_StateMachine *s, const char *message, const char *path)
Definition: dummy.c:60
DIR * dir[DUMMY_MAX_FS_DEPTH+1]
Definition: dummy.h:46
GSM_Phone_Data Data
Definition: gsmstate.h:1369
char * DUMMY_GetFilePath(GSM_StateMachine *s, const char *filename)
Definition: dummy.c:77
#define TRUE
Definition: gammu-types.h:28
int smprintf(GSM_StateMachine *s, const char *format,...)
Definition: debug.c:261
gboolean Hidden
Definition: gammu-file.h:115

§ DUMMY_GetNextMemory()

GSM_Error DUMMY_GetNextMemory ( GSM_StateMachine s,
GSM_MemoryEntry entry,
gboolean  start 
)

Definition at line 1481 of file dummy.c.

References GSM_Phone::Data, DUMMY_GetMemory(), DUMMY_GetNext(), ERR_NOTSUPPORTED, F_DISABLE_GETNEXT, GSM_IsPhoneFeatureAvailable(), GSM_MemoryTypeToString, GSM_MemoryEntry::Location, GSM_MemoryEntry::MemoryType, GSM_Phone_Data::ModelInfo, and _GSM_StateMachine::Phone.

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 }
GSM_MemoryType MemoryType
Definition: gammu-memory.h:415
GSM_Error DUMMY_GetMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
Definition: dummy.c:1434
#define GSM_MemoryTypeToString(x)
Definition: gammu-memory.h:95
GSM_PhoneModel * ModelInfo
Definition: gsmstate.h:449
int DUMMY_GetNext(GSM_StateMachine *s, const char *dirname, int current)
Definition: dummy.c:187
GSM_Phone Phone
Definition: gsmstate.h:1431
GSM_Phone_Data Data
Definition: gsmstate.h:1369
gboolean GSM_IsPhoneFeatureAvailable(GSM_PhoneModel *model, GSM_Feature feature)
Definition: gsmphones.c:1026

§ DUMMY_GetNextNote()

GSM_Error DUMMY_GetNextNote ( GSM_StateMachine s,
GSM_NoteEntry entry,
gboolean  start 
)

Definition at line 1816 of file dummy.c.

References GSM_Phone::Data, DUMMY_GetNext(), DUMMY_GetNote(), ERR_NOTSUPPORTED, F_DISABLE_GETNEXT, GSM_IsPhoneFeatureAvailable(), GSM_NoteEntry::Location, GSM_Phone_Data::ModelInfo, and _GSM_StateMachine::Phone.

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 }
GSM_PhoneModel * ModelInfo
Definition: gsmstate.h:449
int DUMMY_GetNext(GSM_StateMachine *s, const char *dirname, int current)
Definition: dummy.c:187
GSM_Phone Phone
Definition: gsmstate.h:1431
GSM_Error DUMMY_GetNote(GSM_StateMachine *s, GSM_NoteEntry *entry)
Definition: dummy.c:1788
GSM_Phone_Data Data
Definition: gsmstate.h:1369
gboolean GSM_IsPhoneFeatureAvailable(GSM_PhoneModel *model, GSM_Feature feature)
Definition: gsmphones.c:1026

§ DUMMY_GetNextSMS()

GSM_Error DUMMY_GetNextSMS ( GSM_StateMachine s,
GSM_MultiSMSMessage sms,
gboolean  start 
)

Definition at line 617 of file dummy.c.

References GSM_Phone::Data, DUMMY_GetNext(), DUMMY_GetSMS(), DUMMY_GetSMSPath(), ERR_EMPTY, ERR_NOTSUPPORTED, F_DISABLE_GETNEXTSMS, GSM_SMSMessage::Folder, GSM_IsPhoneFeatureAvailable(), GSM_SMSMessage::Location, GSM_Phone_Data::ModelInfo, _GSM_StateMachine::Phone, and GSM_MultiSMSMessage::SMS.

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 }
GSM_Error DUMMY_GetSMS(GSM_StateMachine *s, GSM_MultiSMSMessage *sms)
Definition: dummy.c:462
char * DUMMY_GetSMSPath(GSM_StateMachine *s, GSM_SMSMessage *sms)
Definition: dummy.c:211
GSM_PhoneModel * ModelInfo
Definition: gsmstate.h:449
int DUMMY_GetNext(GSM_StateMachine *s, const char *dirname, int current)
Definition: dummy.c:187
GSM_Phone Phone
Definition: gsmstate.h:1431
GSM_SMSMessage SMS[GSM_MAX_MULTI_SMS]
GSM_Phone_Data Data
Definition: gsmstate.h:1369
gboolean GSM_IsPhoneFeatureAvailable(GSM_PhoneModel *model, GSM_Feature feature)
Definition: gsmphones.c:1026

§ DUMMY_GetNextToDo()

GSM_Error DUMMY_GetNextToDo ( GSM_StateMachine s,
GSM_ToDoEntry entry,
gboolean  start 
)

Definition at line 1596 of file dummy.c.

References GSM_Phone::Data, DUMMY_GetNext(), DUMMY_GetToDo(), ERR_NOTSUPPORTED, F_DISABLE_GETNEXT, GSM_IsPhoneFeatureAvailable(), GSM_ToDoEntry::Location, GSM_Phone_Data::ModelInfo, and _GSM_StateMachine::Phone.

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 }
GSM_PhoneModel * ModelInfo
Definition: gsmstate.h:449
int DUMMY_GetNext(GSM_StateMachine *s, const char *dirname, int current)
Definition: dummy.c:187
GSM_Phone Phone
Definition: gsmstate.h:1431
GSM_Phone_Data Data
Definition: gsmstate.h:1369
gboolean GSM_IsPhoneFeatureAvailable(GSM_PhoneModel *model, GSM_Feature feature)
Definition: gsmphones.c:1026
GSM_Error DUMMY_GetToDo(GSM_StateMachine *s, GSM_ToDoEntry *entry)
Definition: dummy.c:1568

§ DUMMY_GetNote()

GSM_Error DUMMY_GetNote ( GSM_StateMachine s,
GSM_NoteEntry entry 
)

Definition at line 1788 of file dummy.c.

References DUMMY_NotePath(), ERR_CANTOPENFILE, ERR_EMPTY, ERR_NONE, and GSM_NoteEntry::Location.

Referenced by DUMMY_GetNextNote().

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 }
GSM_Error
Definition: gammu-error.h:23
char * DUMMY_NotePath(GSM_StateMachine *s, GSM_NoteEntry *entry)
Definition: dummy.c:242

§ DUMMY_GetNoteStatus()

GSM_Error DUMMY_GetNoteStatus ( GSM_StateMachine s,
GSM_ToDoStatus Status 
)

Definition at line 1781 of file dummy.c.

References DUMMY_GetCount(), DUMMY_MAX_TODO, ERR_NONE, GSM_ToDoStatus::Free, and GSM_ToDoStatus::Used.

1782 {
1783  Status->Used = DUMMY_GetCount(s, "note");
1784  Status->Free = DUMMY_MAX_TODO - Status->Used;
1785  return ERR_NONE;
1786 }
int DUMMY_GetCount(GSM_StateMachine *s, const char *dirname)
Definition: dummy.c:122
#define DUMMY_MAX_TODO
Definition: dummy.h:38

§ DUMMY_GetOriginalIMEI()

GSM_Error DUMMY_GetOriginalIMEI ( GSM_StateMachine s,
char *  value 
)

Definition at line 418 of file dummy.c.

References ERR_NONE.

419 {
420  strcpy(value, "666666666666666");
421  return ERR_NONE;
422 }

§ DUMMY_GetPPM()

GSM_Error DUMMY_GetPPM ( GSM_StateMachine s,
char *  value 
)

Definition at line 436 of file dummy.c.

References ERR_NONE.

437 {
438  strcpy(value, "EN CS");
439  return ERR_NONE;
440 }

§ DUMMY_GetProductCode()

GSM_Error DUMMY_GetProductCode ( GSM_StateMachine s,
char *  value 
)

Definition at line 406 of file dummy.c.

References ERR_NONE.

407 {
408  strcpy(value, "DUMMY-001");
409  return ERR_NONE;
410 }

§ DUMMY_GetRingtone()

GSM_Error DUMMY_GetRingtone ( GSM_StateMachine s,
GSM_Ringtone Ringtone,
gboolean  PhoneRingtone 
)

Definition at line 1058 of file dummy.c.

References ERR_NOTIMPLEMENTED.

1059 {
1060  return ERR_NOTIMPLEMENTED;
1061 }

§ DUMMY_GetSecurityStatus()

GSM_Error DUMMY_GetSecurityStatus ( GSM_StateMachine s,
GSM_SecurityCodeType Status 
)

Definition at line 840 of file dummy.c.

References ERR_NONE, and SEC_None.

841 {
842  *Status = SEC_None;
843  return ERR_NONE;
844 }

§ DUMMY_GetSignalStrength()

GSM_Error DUMMY_GetSignalStrength ( GSM_StateMachine s,
GSM_SignalQuality sig 
)

Definition at line 587 of file dummy.c.

References GSM_SignalQuality::BitErrorRate, ERR_NONE, GSM_SignalQuality::SignalPercent, and GSM_SignalQuality::SignalStrength.

588 {
589  sig->SignalStrength = 42;
590  sig->SignalPercent = 42;
591  sig->BitErrorRate = 0;
592  return ERR_NONE;
593 }

§ DUMMY_GetSIMIMSI()

GSM_Error DUMMY_GetSIMIMSI ( GSM_StateMachine s,
char *  IMSI 
)

Definition at line 862 of file dummy.c.

References ERR_NONE.

863 {
864  strcpy(IMSI, "994299429942994");
865  return ERR_NONE;
866 }

§ DUMMY_GetSMS()

GSM_Error DUMMY_GetSMS ( GSM_StateMachine s,
GSM_MultiSMSMessage sms 
)

Definition at line 462 of file dummy.c.

References DUMMY_GetSMSPath(), DUMMY_MAX_SMS, ERR_CANTOPENFILE, ERR_EMPTY, ERR_MOREMEMORY, ERR_NONE, FALSE, GSM_SMSMessage::Folder, GSM_SMSMessage::InboxFolder, GSM_SMSMessage::Location, MEM_ME, MEM_SM, GSM_SMSMessage::Memory, GSM_MultiSMSMessage::Number, GSM_MultiSMSMessage::SMS, and TRUE.

Referenced by DUMMY_GetNextSMS().

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 }
char * DUMMY_GetSMSPath(GSM_StateMachine *s, GSM_SMSMessage *sms)
Definition: dummy.c:211
GSM_Error
Definition: gammu-error.h:23
#define DUMMY_MAX_SMS
Definition: dummy.h:36
gboolean InboxFolder
#define FALSE
Definition: gammu-types.h:25
GSM_SMSMessage SMS[GSM_MAX_MULTI_SMS]
#define TRUE
Definition: gammu-types.h:28
GSM_MemoryType Memory

§ DUMMY_GetSMSC()

GSM_Error DUMMY_GetSMSC ( GSM_StateMachine s,
GSM_SMSC smsc 
)

Definition at line 820 of file dummy.c.

References GSM_Phone::Data, GSM_Phone_Data::DUMMY, ERR_EMPTY, ERR_NONE, GSM_SMSC::Location, _GSM_StateMachine::Phone, GSM_Phone_Data::Priv, and GSM_Phone_DUMMYData::SMSC.

821 {
823 
824  if (smsc->Location != 1) return ERR_EMPTY;
825 
826  *smsc = Priv->SMSC;
827 
828  return ERR_NONE;
829 }
GSM_SMSC SMSC
Definition: dummy.h:43
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
GSM_Phone Phone
Definition: gsmstate.h:1431
struct GSM_Phone_Data::@2 Priv
GSM_Phone_Data Data
Definition: gsmstate.h:1369

§ DUMMY_GetSMSFolders()

GSM_Error DUMMY_GetSMSFolders ( GSM_StateMachine s,
GSM_SMSFolders folders 
)

Definition at line 595 of file dummy.c.

References _, CopyUnicodeString(), EncodeUnicode(), ERR_NONE, FALSE, GSM_SMSFolders::Folder, GSM_OneSMSFolder::InboxFolder, MEM_ME, GSM_OneSMSFolder::Memory, GSM_OneSMSFolder::Name, GSM_SMSFolders::Number, GSM_OneSMSFolder::OutboxFolder, and PHONE_GetSMSFolders().

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 }
void CopyUnicodeString(unsigned char *Dest, const unsigned char *Source)
Definition: coding.c:1192
GSM_OneSMSFolder Folder[GSM_MAX_SMS_FOLDERS]
void EncodeUnicode(unsigned char *dest, const char *src, size_t len)
Definition: coding.c:301
#define FALSE
Definition: gammu-types.h:25
unsigned char Name[(GSM_MAX_SMS_FOLDER_NAME_LEN+1) *2]
GSM_MemoryType Memory
gboolean OutboxFolder
gboolean InboxFolder
GSM_Error PHONE_GetSMSFolders(GSM_StateMachine *s UNUSED, GSM_SMSFolders *folders)
Definition: pfunc.c:38
#define _(x)
Definition: locales.h:21

§ DUMMY_GetSMSPath()

char* DUMMY_GetSMSPath ( GSM_StateMachine s,
GSM_SMSMessage sms 
)

Definition at line 211 of file dummy.c.

References DUMMY_GetFilePath(), DUMMY_MAX_SMS, GSM_SMSMessage::Folder, and GSM_SMSMessage::Location.

Referenced by DUMMY_DeleteSMS(), DUMMY_GetNextSMS(), DUMMY_GetSMS(), and DUMMY_SetSMS().

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 }
#define DUMMY_MAX_SMS
Definition: dummy.h:36
int gboolean
Definition: gammu-types.h:23
char * DUMMY_GetFilePath(GSM_StateMachine *s, const char *filename)
Definition: dummy.c:77

§ DUMMY_GetSMSStatus()

GSM_Error DUMMY_GetSMSStatus ( GSM_StateMachine s,
GSM_SMSMemoryStatus status 
)

Definition at line 647 of file dummy.c.

References DUMMY_GetCount(), DUMMY_MAX_SMS, ERR_NONE, GSM_SMSMemoryStatus::PhoneSize, GSM_SMSMemoryStatus::PhoneUnRead, GSM_SMSMemoryStatus::PhoneUsed, GSM_SMSMemoryStatus::SIMSize, GSM_SMSMemoryStatus::SIMUnRead, GSM_SMSMemoryStatus::SIMUsed, and GSM_SMSMemoryStatus::TemplatesUsed.

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 }
#define DUMMY_MAX_SMS
Definition: dummy.h:36
int DUMMY_GetCount(GSM_StateMachine *s, const char *dirname)
Definition: dummy.c:122

§ DUMMY_GetToDo()

GSM_Error DUMMY_GetToDo ( GSM_StateMachine s,
GSM_ToDoEntry entry 
)

Definition at line 1568 of file dummy.c.

References DUMMY_ToDoPath(), ERR_CANTOPENFILE, ERR_EMPTY, ERR_NONE, and GSM_ToDoEntry::Location.

Referenced by DUMMY_GetNextToDo().

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 }
GSM_Error
Definition: gammu-error.h:23
char * DUMMY_ToDoPath(GSM_StateMachine *s, GSM_ToDoEntry *entry)
Definition: dummy.c:235

§ DUMMY_GetToDoStatus()

GSM_Error DUMMY_GetToDoStatus ( GSM_StateMachine s,
GSM_ToDoStatus Status 
)

Definition at line 1561 of file dummy.c.

References DUMMY_GetCount(), DUMMY_MAX_TODO, ERR_NONE, GSM_ToDoStatus::Free, and GSM_ToDoStatus::Used.

1562 {
1563  Status->Used = DUMMY_GetCount(s, "todo");
1564  Status->Free = DUMMY_MAX_TODO - Status->Used;
1565  return ERR_NONE;
1566 }
int DUMMY_GetCount(GSM_StateMachine *s, const char *dirname)
Definition: dummy.c:122
#define DUMMY_MAX_TODO
Definition: dummy.h:38

§ DUMMY_GetWAPBookmark()

GSM_Error DUMMY_GetWAPBookmark ( GSM_StateMachine s,
GSM_WAPBookmark bookmark 
)

Definition at line 1068 of file dummy.c.

References GSM_WAPBookmark::Address, EncodeUnicode(), ERR_EMPTY, ERR_NONE, GSM_WAPBookmark::Location, and GSM_WAPBookmark::Title.

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 }
void EncodeUnicode(unsigned char *dest, const char *src, size_t len)
Definition: coding.c:301
unsigned char Title[(50+1) *2]
Definition: gammu-wap.h:42
unsigned char Address[(255+1) *2]
Definition: gammu-wap.h:38

§ DUMMY_Initialise()

GSM_Error DUMMY_Initialise ( GSM_StateMachine s)

Initialises dummy module.

Definition at line 266 of file dummy.c.

References GSM_Locale::AMPMTime, GSM_CallDivert::CallType, _GSM_StateMachine::CurrentConfig, GSM_Phone::Data, GSM_Locale::DateFormat, GSM_Locale::DateSeparator, GSM_SMSC::DefaultNumber, GSM_Config::Device, GSM_Phone_DUMMYData::devlen, GSM_Phone_DUMMYData::dir, GSM_Phone_DUMMYData::diverts, GSM_CallDivert::DivertType, GSM_Phone_Data::DUMMY, DUMMY_GetFilePath(), DUMMY_MAX_FS_DEPTH, EncodeUnicode(), GSM_MultiCallDivert::Entries, GSM_MultiCallDivert::EntriesNum, ERR_DEVICENOPERMISSION, ERR_DEVICENOTEXIST, ERR_DEVICEOPENERROR, ERR_NONE, FALSE, GSM_SMSValidity::Format, GSM_SMSC::Format, GSM_Phone_DUMMYData::fs_depth, GAMMU_VERSION, GAMMU_VERSION_NUM, GSM_Date_DDMMYYYY, GSM_DIVERT_AllCalls, GSM_DIVERT_AllTypes, GSM_DIVERT_Busy, GSM_DIVERT_DataCalls, GSM_DIVERT_FaxCalls, GSM_DIVERT_NoAnswer, GSM_DIVERT_OutOfReach, GSM_DIVERT_VoiceCalls, GSM_OSErrorInfo(), GSM_Phone_Data::IMEI, GSM_Phone_DUMMYData::locale, GSM_SMSC::Location, GSM_Phone_DUMMYData::log_file, GSM_Phone_Data::Manufacturer, MKDIR, GSM_Phone_Data::Model, GSM_SMSC::Name, GSM_CallDivert::Number, GSM_SMSC::Number, _GSM_StateMachine::Phone, GSM_Phone_Data::Priv, GSM_SMSValidity::Relative, smprintf(), SMS_FORMAT_Text, SMS_VALID_Max_Time, SMS_Validity_NotAvailable, GSM_Phone_DUMMYData::SMSC, GSM_CallDivert::Timeout, GSM_SMSC::Validity, GSM_Phone_Data::VerDate, GSM_Phone_Data::VerNum, and GSM_Phone_Data::Version.

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 }
GSM_Config * CurrentConfig
Definition: gsmstate.h:1415
#define GAMMU_VERSION
Definition: gammu-config.h:7
char VerDate[GSM_MAX_VERSION_DATE_LENGTH+1]
Definition: gsmstate.h:458
GSM_SMSC SMSC
Definition: dummy.h:43
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
FILE * log_file
Definition: dummy.h:42
GSM_DateFormat DateFormat
char IMEI[GSM_MAX_IMEI_LENGTH+1]
Definition: gsmstate.h:437
char Version[GSM_MAX_VERSION_LENGTH+1]
Definition: gsmstate.h:454
unsigned int Timeout
Definition: gammu-call.h:170
char Manufacturer[GSM_MAX_MANUFACTURER_LENGTH+1]
Definition: gsmstate.h:441
GSM_SMSFormat Format
size_t devlen
Definition: dummy.h:49
unsigned char DefaultNumber[(GSM_MAX_NUMBER_LENGTH+1) *2]
GSM_ValidityPeriodFormat Format
void EncodeUnicode(unsigned char *dest, const char *src, size_t len)
Definition: coding.c:301
GSM_Phone Phone
Definition: gsmstate.h:1431
#define FALSE
Definition: gammu-types.h:25
GSM_SMSValidity Validity
struct GSM_Phone_Data::@2 Priv
unsigned char Number[(GSM_MAX_NUMBER_LENGTH+1) *2]
Definition: gammu-call.h:174
GSM_Divert_CallTypes CallType
Definition: gammu-call.h:166
void GSM_OSErrorInfo(GSM_StateMachine *s, const char *description)
Definition: gsmstate.c:1593
#define DUMMY_MAX_FS_DEPTH
Definition: dummy.h:39
GSM_Divert_DivertTypes DivertType
Definition: gammu-call.h:162
GSM_CallDivert Entries[GSM_MAX_CALL_DIVERTS]
Definition: gammu-call.h:184
unsigned char Number[(GSM_MAX_NUMBER_LENGTH+1) *2]
DIR * dir[DUMMY_MAX_FS_DEPTH+1]
Definition: dummy.h:46
GSM_Phone_Data Data
Definition: gsmstate.h:1369
double VerNum
Definition: gsmstate.h:462
char * DUMMY_GetFilePath(GSM_StateMachine *s, const char *filename)
Definition: dummy.c:77
GSM_MultiCallDivert diverts
Definition: dummy.h:45
#define MKDIR(dir)
Definition: dummy.c:56
GSM_Locale locale
Definition: dummy.h:44
char DateSeparator
GSM_ValidityPeriod Relative
char Model[GSM_MAX_MODEL_LENGTH+1]
Definition: gsmstate.h:445
#define GAMMU_VERSION_NUM
Definition: gammu-config.h:8
gboolean AMPMTime
int smprintf(GSM_StateMachine *s, const char *format,...)
Definition: debug.c:261
unsigned char Name[(GSM_MAX_SMSC_NAME_LENGTH+1) *2]

§ DUMMY_MemoryPath()

char* DUMMY_MemoryPath ( GSM_StateMachine s,
GSM_MemoryEntry entry 
)

Definition at line 228 of file dummy.c.

References DUMMY_GetFilePath(), GSM_MemoryTypeToString, GSM_MemoryEntry::Location, and GSM_MemoryEntry::MemoryType.

Referenced by DUMMY_DeleteMemory(), DUMMY_GetMemory(), and DUMMY_SetMemory().

229 {
230  char path[100];
231  sprintf(path, "pbk/%s/%d", GSM_MemoryTypeToString(entry->MemoryType), entry->Location);
232  return DUMMY_GetFilePath(s, path);
233 }
GSM_MemoryType MemoryType
Definition: gammu-memory.h:415
#define GSM_MemoryTypeToString(x)
Definition: gammu-memory.h:95
char * DUMMY_GetFilePath(GSM_StateMachine *s, const char *filename)
Definition: dummy.c:77

§ DUMMY_NotePath()

char* DUMMY_NotePath ( GSM_StateMachine s,
GSM_NoteEntry entry 
)

Definition at line 242 of file dummy.c.

References DUMMY_GetFilePath(), and GSM_NoteEntry::Location.

Referenced by DUMMY_DeleteNote(), DUMMY_GetNote(), and DUMMY_SetNote().

243 {
244  char path[100];
245  sprintf(path, "note/%d", entry->Location);
246  return DUMMY_GetFilePath(s, path);
247 }
char * DUMMY_GetFilePath(GSM_StateMachine *s, const char *filename)
Definition: dummy.c:77

§ DUMMY_PreAPICall()

GSM_Error DUMMY_PreAPICall ( GSM_StateMachine s)

Definition at line 1924 of file dummy.c.

References GSM_Call::CallIDAvailable, GSM_Phone::Data, DUMMY_GetFilePath(), GSM_Phone_Data::EnableIncomingCall, EncodeUnicode(), ERR_MOREMEMORY, ERR_NONE, FALSE, GSM_CALL_IncomingCall, _GSM_User::IncomingCall, _GSM_User::IncomingCallUserData, _GSM_StateMachine::Phone, GSM_Call::PhoneNumber, smprintf(), GSM_Call::Status, GSM_Call::StatusCode, TRUE, and _GSM_StateMachine::User.

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 }
GSM_CallStatus Status
Definition: gammu-call.h:86
void * IncomingCallUserData
Definition: gsmstate.h:1386
GSM_Error
Definition: gammu-error.h:23
gboolean EnableIncomingCall
Definition: gsmstate.h:659
int StatusCode
Definition: gammu-call.h:98
void EncodeUnicode(unsigned char *dest, const char *src, size_t len)
Definition: coding.c:301
GSM_Phone Phone
Definition: gsmstate.h:1431
#define FALSE
Definition: gammu-types.h:25
IncomingCallCallback IncomingCall
Definition: gsmstate.h:1381
unsigned char PhoneNumber[(GSM_MAX_NUMBER_LENGTH+1) *2]
Definition: gammu-call.h:102
gboolean CallIDAvailable
Definition: gammu-call.h:94
GSM_Phone_Data Data
Definition: gsmstate.h:1369
char * DUMMY_GetFilePath(GSM_StateMachine *s, const char *filename)
Definition: dummy.c:77
#define TRUE
Definition: gammu-types.h:28
int smprintf(GSM_StateMachine *s, const char *format,...)
Definition: debug.c:261

§ DUMMY_PressKey()

GSM_Error DUMMY_PressKey ( GSM_StateMachine s,
GSM_KeyCode  Key,
gboolean  Press 
)

Definition at line 737 of file dummy.c.

References GSM_Phone::Data, GSM_Phone_Data::DUMMY, ERR_NONE, GSM_Phone_DUMMYData::log_file, _GSM_StateMachine::Phone, and GSM_Phone_Data::Priv.

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 }
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
FILE * log_file
Definition: dummy.h:42
GSM_Phone Phone
Definition: gsmstate.h:1431
struct GSM_Phone_Data::@2 Priv
GSM_Phone_Data Data
Definition: gsmstate.h:1369

§ DUMMY_Reset()

GSM_Error DUMMY_Reset ( GSM_StateMachine s,
gboolean  hard 
)

Definition at line 750 of file dummy.c.

References GSM_Phone::Data, GSM_Phone_Data::DUMMY, ERR_NONE, GSM_Phone_DUMMYData::log_file, _GSM_StateMachine::Phone, and GSM_Phone_Data::Priv.

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 }
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
FILE * log_file
Definition: dummy.h:42
GSM_Phone Phone
Definition: gsmstate.h:1431
struct GSM_Phone_Data::@2 Priv
GSM_Phone_Data Data
Definition: gsmstate.h:1369

§ DUMMY_ResetPhoneSettings()

GSM_Error DUMMY_ResetPhoneSettings ( GSM_StateMachine s,
GSM_ResetSettingsType  Type 
)

Definition at line 846 of file dummy.c.

References ERR_NONE, ERR_NOTIMPLEMENTED, and GSM_RESET_PHONESETTINGS.

847 {
848  if (Type == GSM_RESET_PHONESETTINGS) {
849  return ERR_NONE;
850  }
851  return ERR_NOTIMPLEMENTED;
852 }

§ DUMMY_SendDTMF()

GSM_Error DUMMY_SendDTMF ( GSM_StateMachine s,
char *  sequence 
)

Definition at line 854 of file dummy.c.

References GSM_Phone::Data, GSM_Phone_Data::DUMMY, ERR_NONE, GSM_Phone_DUMMYData::log_file, _GSM_StateMachine::Phone, and GSM_Phone_Data::Priv.

855 {
857 
858  fprintf(Priv->log_file, "DTMF: %s\n", sequence);
859  return ERR_NONE;
860 }
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
FILE * log_file
Definition: dummy.h:42
GSM_Phone Phone
Definition: gsmstate.h:1431
struct GSM_Phone_Data::@2 Priv
GSM_Phone_Data Data
Definition: gsmstate.h:1369

§ DUMMY_SendFilePart()

GSM_Error DUMMY_SendFilePart ( GSM_StateMachine s,
GSM_File File,
size_t *  Pos,
int *  Handle 
)

Definition at line 1148 of file dummy.c.

References DUMMY_AddFilePart(), EncodeUnicode(), and GSM_File::ID_FullName.

1149 {
1150  EncodeUnicode(File->ID_FullName, "incoming/", 9);
1151  return DUMMY_AddFilePart(s, File, Pos, Handle);
1152 }
unsigned char ID_FullName[2 *(GSM_MAX_FILENAME_ID_LENGTH+1)]
Definition: gammu-file.h:90
void EncodeUnicode(unsigned char *dest, const char *src, size_t len)
Definition: coding.c:301
GSM_Error DUMMY_AddFilePart(GSM_StateMachine *s, GSM_File *File, size_t *Pos, int *Handle)
Definition: dummy.c:1101

§ DUMMY_SendSavedSMS()

GSM_Error DUMMY_SendSavedSMS ( GSM_StateMachine s,
int  Folder,
int  Location 
)

Definition at line 772 of file dummy.c.

References ERR_NOTIMPLEMENTED.

773 {
774  return ERR_NOTIMPLEMENTED;
775 }

§ DUMMY_SendSMS()

GSM_Error DUMMY_SendSMS ( GSM_StateMachine s,
GSM_SMSMessage sms 
)

Definition at line 777 of file dummy.c.

References ERR_NONE, GSM_SMSMessage::PDU, PHONE_EncodeSMSFrame(), PHONE_SMSDeliver, PHONE_SMSSubmit, _GSM_User::SendSMSStatus, _GSM_User::SendSMSStatusUserData, smprintf(), SMS_Deliver, TRUE, and _GSM_StateMachine::User.

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 }
GSM_SMSMessageType PDU
SendSMSStatusCallback SendSMSStatus
Definition: gsmstate.h:1385
GSM_Error
Definition: gammu-error.h:23
void * SendSMSStatusUserData
Definition: gsmstate.h:1390
GSM_SMSMessageLayout PHONE_SMSDeliver
Definition: pfunc.c:16
GSM_SMSMessageLayout PHONE_SMSSubmit
Definition: pfunc.c:23
#define TRUE
Definition: gammu-types.h:28
GSM_Error PHONE_EncodeSMSFrame(GSM_StateMachine *s, GSM_SMSMessage *SMS, unsigned char *buffer, GSM_SMSMessageLayout Layout, int *length, gboolean clear)
Definition: pfunc.c:58
int smprintf(GSM_StateMachine *s, const char *format,...)
Definition: debug.c:261

§ DUMMY_SetAlarm()

GSM_Error DUMMY_SetAlarm ( GSM_StateMachine s,
GSM_Alarm entry 
)

Definition at line 1007 of file dummy.c.

References CAL_REPEAT_FREQUENCY, CAL_START_DATETIME, CAL_TEXT, CAL_TONE_ALARM_DATETIME, CopyUnicodeString(), GSM_SubCalendarEntry::Date, GSM_Alarm::DateTime, GSM_DateTime::Day, DUMMY_AlarmPath(), DUMMY_DeleteAlarm(), GSM_CalendarEntry::Entries, GSM_CalendarEntry::EntriesNum, GSM_SubCalendarEntry::EntryType, ERR_EMPTY, ERR_NONE, GSM_CAL_ALARM, GSM_CalendarEntry::Location, GSM_Alarm::Location, GSM_DateTime::Month, GSM_SubCalendarEntry::Number, GSM_Alarm::Repeating, GSM_SubCalendarEntry::Text, GSM_Alarm::Text, GSM_DateTime::Timezone, GSM_CalendarEntry::Type, and GSM_DateTime::Year.

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 }
void CopyUnicodeString(unsigned char *Dest, const unsigned char *Source)
Definition: coding.c:1192
GSM_DateTime DateTime
GSM_Error
Definition: gammu-error.h:23
unsigned char Text[(GSM_MAX_CALENDAR_TEXT_LENGTH+1) *2]
GSM_CalendarNoteType Type
char * DUMMY_AlarmPath(GSM_StateMachine *s, GSM_Alarm *entry)
Definition: dummy.c:256
GSM_CalendarType EntryType
GSM_SubCalendarEntry Entries[GSM_CALENDAR_ENTRIES]
gboolean Repeating
unsigned char Text[(GSM_MAX_CALENDAR_TEXT_LENGTH+1) *2]
GSM_Error DUMMY_DeleteAlarm(GSM_StateMachine *s, GSM_Alarm *entry)
Definition: dummy.c:988

§ DUMMY_SetAutoNetworkLogin()

GSM_Error DUMMY_SetAutoNetworkLogin ( GSM_StateMachine s)

Definition at line 732 of file dummy.c.

References ERR_NOTIMPLEMENTED.

733 {
734  return ERR_NOTIMPLEMENTED;
735 }

§ DUMMY_SetBitmap()

GSM_Error DUMMY_SetBitmap ( GSM_StateMachine s,
GSM_Bitmap Bitmap 
)

Definition at line 1090 of file dummy.c.

References ERR_NOTIMPLEMENTED.

1091 {
1092  return ERR_NOTIMPLEMENTED;
1093 }

§ DUMMY_SetCalendar()

GSM_Error DUMMY_SetCalendar ( GSM_StateMachine s,
GSM_CalendarEntry entry 
)

Definition at line 1733 of file dummy.c.

References DUMMY_CalendarPath(), DUMMY_DeleteCalendar(), ERR_EMPTY, and ERR_NONE.

Referenced by DUMMY_AddCalendar().

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 }
GSM_Error
Definition: gammu-error.h:23
GSM_Error DUMMY_DeleteCalendar(GSM_StateMachine *s, GSM_CalendarEntry *entry)
Definition: dummy.c:1715
char * DUMMY_CalendarPath(GSM_StateMachine *s, GSM_CalendarEntry *entry)
Definition: dummy.c:249

§ DUMMY_SetCalendarSettings()

GSM_Error DUMMY_SetCalendarSettings ( GSM_StateMachine s,
GSM_CalendarSettings settings 
)

Definition at line 1776 of file dummy.c.

References ERR_NONE.

1777 {
1778  return ERR_NONE;
1779 }

§ DUMMY_SetCallDivert()

GSM_Error DUMMY_SetCallDivert ( GSM_StateMachine s,
GSM_CallDivert request 
)

Definition at line 885 of file dummy.c.

References GSM_CallDivert::CallType, GSM_Phone::Data, GSM_Phone_DUMMYData::diverts, GSM_CallDivert::DivertType, GSM_Phone_Data::DUMMY, GSM_MultiCallDivert::Entries, GSM_MultiCallDivert::EntriesNum, ERR_NONE, _GSM_StateMachine::Phone, and GSM_Phone_Data::Priv.

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 }
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
GSM_Phone Phone
Definition: gsmstate.h:1431
struct GSM_Phone_Data::@2 Priv
GSM_Divert_CallTypes CallType
Definition: gammu-call.h:166
GSM_Divert_DivertTypes DivertType
Definition: gammu-call.h:162
GSM_CallDivert Entries[GSM_MAX_CALL_DIVERTS]
Definition: gammu-call.h:184
GSM_Phone_Data Data
Definition: gsmstate.h:1369
GSM_MultiCallDivert diverts
Definition: dummy.h:45

§ DUMMY_SetDateTime()

GSM_Error DUMMY_SetDateTime ( GSM_StateMachine s,
GSM_DateTime date_time 
)

Definition at line 804 of file dummy.c.

References ERR_NONE.

805 {
806  return ERR_NONE;
807 }

§ DUMMY_SetFastSMSSending()

GSM_Error DUMMY_SetFastSMSSending ( GSM_StateMachine s,
gboolean  enable 
)

Definition at line 929 of file dummy.c.

References ERR_NONE.

930 {
931  return ERR_NONE;
932 }

§ DUMMY_SetFileAttributes()

GSM_Error DUMMY_SetFileAttributes ( GSM_StateMachine s,
GSM_File File 
)

Definition at line 1095 of file dummy.c.

References ERR_NONE.

1096 {
1097  /* We just ignore attributes */
1098  return ERR_NONE;
1099 }

§ DUMMY_SetIncomingCall()

GSM_Error DUMMY_SetIncomingCall ( GSM_StateMachine s,
gboolean  enable 
)

Definition at line 911 of file dummy.c.

References GSM_Phone::Data, GSM_Phone_Data::EnableIncomingCall, ERR_NONE, and _GSM_StateMachine::Phone.

912 {
913  s->Phone.Data.EnableIncomingCall = enable;
914  return ERR_NONE;
915 }
gboolean EnableIncomingCall
Definition: gsmstate.h:659
GSM_Phone Phone
Definition: gsmstate.h:1431
GSM_Phone_Data Data
Definition: gsmstate.h:1369

§ DUMMY_SetIncomingCB()

GSM_Error DUMMY_SetIncomingCB ( GSM_StateMachine s,
gboolean  enable 
)

Definition at line 917 of file dummy.c.

References GSM_Phone::Data, GSM_Phone_Data::EnableIncomingCB, ERR_NONE, and _GSM_StateMachine::Phone.

918 {
919  s->Phone.Data.EnableIncomingCB = enable;
920  return ERR_NONE;
921 }
gboolean EnableIncomingCB
Definition: gsmstate.h:667
GSM_Phone Phone
Definition: gsmstate.h:1431
GSM_Phone_Data Data
Definition: gsmstate.h:1369

§ DUMMY_SetIncomingSMS()

GSM_Error DUMMY_SetIncomingSMS ( GSM_StateMachine s,
gboolean  enable 
)

Definition at line 923 of file dummy.c.

References GSM_Phone::Data, GSM_Phone_Data::EnableIncomingSMS, ERR_NONE, and _GSM_StateMachine::Phone.

924 {
925  s->Phone.Data.EnableIncomingSMS = enable;
926  return ERR_NONE;
927 }
GSM_Phone Phone
Definition: gsmstate.h:1431
GSM_Phone_Data Data
Definition: gsmstate.h:1369
gboolean EnableIncomingSMS
Definition: gsmstate.h:663

§ DUMMY_SetIncomingUSSD()

GSM_Error DUMMY_SetIncomingUSSD ( GSM_StateMachine s,
gboolean  enable 
)

Definition at line 1052 of file dummy.c.

References GSM_Phone::Data, GSM_Phone_Data::EnableIncomingUSSD, ERR_NONE, and _GSM_StateMachine::Phone.

1053 {
1054  s->Phone.Data.EnableIncomingUSSD = enable;
1055  return ERR_NONE;
1056 }
gboolean EnableIncomingUSSD
Definition: gsmstate.h:671
GSM_Phone Phone
Definition: gsmstate.h:1431
GSM_Phone_Data Data
Definition: gsmstate.h:1369

§ DUMMY_SetLocale()

GSM_Error DUMMY_SetLocale ( GSM_StateMachine s,
GSM_Locale locale 
)

Definition at line 1892 of file dummy.c.

References GSM_Phone::Data, GSM_Phone_Data::DUMMY, ERR_NONE, GSM_Phone_DUMMYData::locale, _GSM_StateMachine::Phone, and GSM_Phone_Data::Priv.

1893 {
1894  GSM_Phone_DUMMYData *Priv = &s->Phone.Data.Priv.DUMMY;
1895  Priv->locale = *locale;
1896  return ERR_NONE;
1897 }
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
GSM_Phone Phone
Definition: gsmstate.h:1431
struct GSM_Phone_Data::@2 Priv
GSM_Phone_Data Data
Definition: gsmstate.h:1369
GSM_Locale locale
Definition: dummy.h:44

§ DUMMY_SetMemory()

GSM_Error DUMMY_SetMemory ( GSM_StateMachine s,
GSM_MemoryEntry entry 
)

Definition at line 1518 of file dummy.c.

References DUMMY_DeleteMemory(), DUMMY_MemoryPath(), ERR_EMPTY, and ERR_NONE.

Referenced by DUMMY_AddMemory().

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 }
GSM_Error
Definition: gammu-error.h:23
char * DUMMY_MemoryPath(GSM_StateMachine *s, GSM_MemoryEntry *entry)
Definition: dummy.c:228
GSM_Error DUMMY_DeleteMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
Definition: dummy.c:1500

§ DUMMY_SetNote()

GSM_Error DUMMY_SetNote ( GSM_StateMachine s,
GSM_NoteEntry entry 
)

Definition at line 1848 of file dummy.c.

References DUMMY_DeleteNote(), DUMMY_NotePath(), ERR_EMPTY, and ERR_NONE.

Referenced by DUMMY_AddNote().

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 }
GSM_Error
Definition: gammu-error.h:23
char * DUMMY_NotePath(GSM_StateMachine *s, GSM_NoteEntry *entry)
Definition: dummy.c:242
GSM_Error DUMMY_DeleteNote(GSM_StateMachine *s, GSM_NoteEntry *entry)
Definition: dummy.c:1831

§ DUMMY_SetRingtone()

GSM_Error DUMMY_SetRingtone ( GSM_StateMachine s,
GSM_Ringtone Ringtone,
int *  maxlength 
)

Definition at line 1063 of file dummy.c.

References ERR_NOTIMPLEMENTED.

1064 {
1065  return ERR_NOTIMPLEMENTED;
1066 }

§ DUMMY_SetSMS()

GSM_Error DUMMY_SetSMS ( GSM_StateMachine s,
GSM_SMSMessage sms 
)

Definition at line 544 of file dummy.c.

References DUMMY_DeleteSMS(), DUMMY_GetSMSPath(), ERR_EMPTY, ERR_MOREMEMORY, and ERR_NONE.

Referenced by DUMMY_AddSMS().

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 }
char * DUMMY_GetSMSPath(GSM_StateMachine *s, GSM_SMSMessage *sms)
Definition: dummy.c:211
GSM_Error
Definition: gammu-error.h:23
GSM_Error DUMMY_DeleteSMS(GSM_StateMachine *s, GSM_SMSMessage *sms)
Definition: dummy.c:527

§ DUMMY_SetSMSC()

GSM_Error DUMMY_SetSMSC ( GSM_StateMachine s,
GSM_SMSC smsc 
)

Definition at line 809 of file dummy.c.

References GSM_Phone::Data, GSM_Phone_Data::DUMMY, ERR_NONE, ERR_NOTSUPPORTED, GSM_SMSC::Location, _GSM_StateMachine::Phone, GSM_Phone_Data::Priv, and GSM_Phone_DUMMYData::SMSC.

810 {
812 
813  if (smsc->Location != 1) return ERR_NOTSUPPORTED;
814 
815  Priv->SMSC = *smsc;
816 
817  return ERR_NONE;
818 }
GSM_SMSC SMSC
Definition: dummy.h:43
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
GSM_Phone Phone
Definition: gsmstate.h:1431
struct GSM_Phone_Data::@2 Priv
GSM_Phone_Data Data
Definition: gsmstate.h:1369

§ DUMMY_SetToDo()

GSM_Error DUMMY_SetToDo ( GSM_StateMachine s,
GSM_ToDoEntry entry 
)

Definition at line 1629 of file dummy.c.

References DUMMY_DeleteToDo(), DUMMY_ToDoPath(), ERR_EMPTY, and ERR_NONE.

Referenced by DUMMY_AddToDo().

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 }
GSM_Error DUMMY_DeleteToDo(GSM_StateMachine *s, GSM_ToDoEntry *entry)
Definition: dummy.c:1611
GSM_Error
Definition: gammu-error.h:23
char * DUMMY_ToDoPath(GSM_StateMachine *s, GSM_ToDoEntry *entry)
Definition: dummy.c:235

§ DUMMY_Terminate()

GSM_Error DUMMY_Terminate ( GSM_StateMachine s)

Terminates dummy module.

Definition at line 380 of file dummy.c.

References GSM_Phone::Data, GSM_Phone_DUMMYData::dir, GSM_Phone_Data::DUMMY, DUMMY_MAX_FS_DEPTH, ERR_NONE, GSM_Phone_DUMMYData::log_file, _GSM_StateMachine::Phone, and GSM_Phone_Data::Priv.

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 }
GSM_Phone_DUMMYData DUMMY
Definition: gsmstate.h:731
FILE * log_file
Definition: dummy.h:42
GSM_Phone Phone
Definition: gsmstate.h:1431
struct GSM_Phone_Data::@2 Priv
#define DUMMY_MAX_FS_DEPTH
Definition: dummy.h:39
DIR * dir[DUMMY_MAX_FS_DEPTH+1]
Definition: dummy.h:46
GSM_Phone_Data Data
Definition: gsmstate.h:1369

§ DUMMY_ToDoPath()

char* DUMMY_ToDoPath ( GSM_StateMachine s,
GSM_ToDoEntry entry 
)

Definition at line 235 of file dummy.c.

References DUMMY_GetFilePath(), and GSM_ToDoEntry::Location.

Referenced by DUMMY_DeleteToDo(), DUMMY_GetToDo(), and DUMMY_SetToDo().

236 {
237  char path[100];
238  sprintf(path, "todo/%d", entry->Location);
239  return DUMMY_GetFilePath(s, path);
240 }
char * DUMMY_GetFilePath(GSM_StateMachine *s, const char *filename)
Definition: dummy.c:77