Gammu internals  1.38.0
gammu-memory.h File Reference
#include <gammu-datetime.h>
#include <gammu-limits.h>
#include <gammu-bitmap.h>
#include <gammu-debug.h>
Include dependency graph for gammu-memory.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  GSM_MemoryStatus
 
struct  GSM_SubMemoryEntry
 
struct  GSM_MemoryEntry
 
struct  GSM_SpeedDial
 

Macros

#define GSM_MemoryTypeToString(x)
 

Enumerations

enum  GSM_MemoryType {
  MEM_ME = 1, MEM_SM, MEM_ON, MEM_DC,
  MEM_RC, MEM_MC, MEM_MT, MEM_FD,
  MEM_VM, MEM_SL, MEM_QD, MEM_INVALID
}
 
enum  GSM_EntryType {
  PBK_Number_General = 1, PBK_Number_Mobile, PBK_Number_Fax, PBK_Number_Pager,
  PBK_Number_Other, PBK_Text_Note, PBK_Text_Postal, PBK_Text_Email,
  PBK_Text_Email2, PBK_Text_URL, PBK_Date, PBK_Caller_Group,
  PBK_Text_Name, PBK_Text_LastName, PBK_Text_FirstName, PBK_Text_Company,
  PBK_Text_JobTitle, PBK_Category, PBK_Private, PBK_Text_StreetAddress,
  PBK_Text_City, PBK_Text_State, PBK_Text_Zip, PBK_Text_Country,
  PBK_Text_Custom1, PBK_Text_Custom2, PBK_Text_Custom3, PBK_Text_Custom4,
  PBK_RingtoneID, PBK_PictureID, PBK_Text_UserID, PBK_CallLength,
  PBK_Text_LUID, PBK_LastModified, PBK_Text_NickName, PBK_Text_FormalName,
  PBK_Text_PictureName, PBK_PushToTalkID, PBK_Number_Messaging, PBK_Photo,
  PBK_Text_SecondName, PBK_Text_VOIP, PBK_Text_SIP, PBK_Text_DTMF,
  PBK_Number_Video, PBK_Text_SWIS, PBK_Text_WVID, PBK_Text_NamePrefix,
  PBK_Text_NameSuffix
}
 
enum  GSM_EntryLocation { PBK_Location_Unknown = 0, PBK_Location_Home, PBK_Location_Work }
 
enum  GSM_VCardVersion {
  Nokia_VCard10 = 1, Nokia_VCard21, SonyEricsson_VCard10, SonyEricsson_VCard21,
  SonyEricsson_VCard21_Phone
}
 

Functions

GSM_MemoryType GSM_StringToMemoryType (const char *s)
 
GSM_Error GSM_GetMemoryStatus (GSM_StateMachine *s, GSM_MemoryStatus *status)
 
GSM_Error GSM_GetMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry)
 
GSM_Error GSM_GetNextMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry, gboolean start)
 
GSM_Error GSM_SetMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry)
 
GSM_Error GSM_AddMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry)
 
GSM_Error GSM_DeleteMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry)
 
GSM_Error GSM_DeleteAllMemory (GSM_StateMachine *s, GSM_MemoryType MemoryType)
 
GSM_Error GSM_GetSpeedDial (GSM_StateMachine *s, GSM_SpeedDial *Speed)
 
GSM_Error GSM_SetSpeedDial (GSM_StateMachine *s, GSM_SpeedDial *Speed)
 
unsigned char * GSM_PhonebookGetEntryName (const GSM_MemoryEntry *entry)
 
void GSM_PhonebookFindDefaultNameNumberGroup (const GSM_MemoryEntry *entry, int *Name, int *Number, int *Group)
 
GSM_Error GSM_EncodeVCARD (GSM_Debug_Info *di, char *Buffer, const size_t buff_len, size_t *Pos, GSM_MemoryEntry *pbk, const gboolean header, const GSM_VCardVersion Version)
 
GSM_Error GSM_DecodeVCARD (GSM_Debug_Info *di, char *Buffer, size_t *Pos, GSM_MemoryEntry *Pbk, const GSM_VCardVersion Version)
 
void GSM_FreeMemoryEntry (GSM_MemoryEntry *Entry)
 

Detailed Description

Author
Michal Čihař

Memory data and functions.

Definition in file gammu-memory.h.

Function Documentation

§ GSM_FreeMemoryEntry()

void GSM_FreeMemoryEntry ( GSM_MemoryEntry Entry)

Frees any dynamically allocated memory inside memory entry structure.

Parameters
[in]EntryPointer to memory entry to process.

Definition at line 1089 of file gsmpbk.c.

References GSM_BinaryPicture::Buffer, GSM_MemoryEntry::Entries, GSM_MemoryEntry::EntriesNum, GSM_SubMemoryEntry::EntryType, GSM_BinaryPicture::Length, PBK_Photo, and GSM_SubMemoryEntry::Picture.

1090 {
1091  int i;
1092 
1093  for (i = 0; i < Entry->EntriesNum; i++) {
1094  switch (Entry->Entries[i].EntryType) {
1095  case PBK_Photo:
1096  free(Entry->Entries[i].Picture.Buffer);
1097  Entry->Entries[i].Picture.Buffer = NULL;
1098  Entry->Entries[i].Picture.Length = 0;
1099  break;
1100  default:
1101  break;
1102  }
1103  }
1104 }
unsigned char * Buffer
Definition: gammu-bitmap.h:45
GSM_BinaryPicture Picture
Definition: gammu-memory.h:403
GSM_EntryType EntryType
Definition: gammu-memory.h:372
GSM_SubMemoryEntry Entries[GSM_PHONEBOOK_ENTRIES]
Definition: gammu-memory.h:427

§ GSM_StringToMemoryType()

GSM_MemoryType GSM_StringToMemoryType ( const char *  s)

Converts memory type from string.

Parameters
sString with memory type.
Returns
Parsed memory type or 0 on failure.

Definition at line 16 of file gsmpbk.c.

References MEM_DC, MEM_FD, MEM_MC, MEM_ME, MEM_MT, MEM_ON, MEM_QD, MEM_RC, MEM_SL, MEM_SM, and MEM_VM.

Referenced by GSM_DecodeVCARD().

16  {
17  if (strcmp(s, "ME") == 0) return MEM_ME;
18  else if (strcmp(s, "SM") == 0) return MEM_SM;
19  else if (strcmp(s, "ON") == 0) return MEM_ON;
20  else if (strcmp(s, "DC") == 0) return MEM_DC;
21  else if (strcmp(s, "RC") == 0) return MEM_RC;
22  else if (strcmp(s, "MC") == 0) return MEM_MC;
23  else if (strcmp(s, "MT") == 0) return MEM_MT;
24  else if (strcmp(s, "FD") == 0) return MEM_FD;
25  else if (strcmp(s, "VM") == 0) return MEM_VM;
26  else if (strcmp(s, "SL") == 0) return MEM_SL;
27  else if (strcmp(s, "QD") == 0) return MEM_QD;
28  else {
29  return 0;
30  }
31 }