# Memory

GSM_MemoryType GSM_StringToMemoryType(const char *s)

  Converts memory type from string.

  Parameters:

    - s – String with memory type.

  Returns:

    Parsed memory type or 0 on failure.

GSM_Error GSM_GetMemoryStatus(GSM_StateMachine *s, GSM_MemoryStatus *status)

  Gets memory (phonebooks or calls) status (eg. number of used and free entries).

  Parameters:

    - s – State machine pointer.

    - status – Storage for status information, MemoryType has to be set.

  Returns:

    Error code.

GSM_Error GSM_GetMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)

  Reads entry from memory (phonebooks or calls). Which entry should be read is defined in entry.

  Parameters:

    - s – State machine pointer.

    - entry – Storage for retrieved entry, MemoryType and Location has to be set.

  Returns:

    Error code.

GSM_Error GSM_GetNextMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry, gboolean start)

  Reads entry from memory (phonebooks or calls). Which entry should be read is defined in entry. This can be easily used for reading all entries.

  Parameters:

    - s – State machine pointer.

    - entry – Storage for retrieved entry. MemoryType has to be set for first call (with start set to TRUE), for subsequent calls Location has to stay intact from previous reading.

    - start – Whether we should start from beginning.

  Returns:

    Error code.

GSM_Error GSM_SetMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)

  Sets memory (phonebooks or calls) entry.

  Parameters:

    - s – State machine pointer.

    - entry – Entry to set, Location and MemoryType has to be set.

  Returns:

    Error code.

GSM_Error GSM_AddMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)

  Adds memory (phonebooks or calls) entry.

  Parameters:

    - s – State machine pointer.

    - entry – Entry to add, Location is ignored, MemoryType has to be set.

  Returns:

    Error code.

GSM_Error GSM_DeleteMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)

  Deletes memory (phonebooks or calls) entry.

  Parameters:

    - s – State machine pointer.

    - entry – Entry to delete, Location and MemoryType has to be set.

  Returns:

    Error code.

GSM_Error GSM_DeleteAllMemory(GSM_StateMachine *s, GSM_MemoryType MemoryType)

  Deletes all memory (phonebooks or calls) entries of specified type.

  Parameters:

    - s – State machine pointer.

    - MemoryType – Where to delete all entries.

  Returns:

    Error code.

GSM_Error GSM_GetSpeedDial(GSM_StateMachine *s, GSM_SpeedDial *Speed)

  Gets speed dial.

  Parameters:

    - s – State machine pointer.

    - Speed – Storage for speed dial, Location has to be set.

  Returns:

    Error code.

GSM_Error GSM_SetSpeedDial(GSM_StateMachine *s, GSM_SpeedDial *Speed)

  Sets speed dial.

  Parameters:

    - s – State machine pointer.

    - Speed – Sspeed dial to set.

  Returns:

    Error code.

unsigned char *GSM_PhonebookGetEntryName(const GSM_MemoryEntry *entry)

  Returns name of entry. It might be possibly concatenated from first and last names.

  Parameters:

    - entry – Entry to process.

  Returns:

    Static unicode string containing name.

void GSM_PhonebookFindDefaultNameNumberGroup(const GSM_MemoryEntry *entry, int *Name, int *Number, int *Group)

  Finds default name, number and group for entry.

  Parameters:

    - entry – Entry to process.

    - Name – Output index of name.

    - Number – Output index of number.

    - Group – Output index of 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)

  Encodes memory entry to vCard.

  Parameters:

    - di – Pointer to debugging description.

    - Buffer – [out] Buffer to store vCard text.

    - buff_len – [in] Size of output buffer.

    - Pos – [inout] Position in output buffer.

    - pbk – [inout] Phonebook data, AddError will be set on non converted entries.

    - header – [in] Whether to include vCard header in output.

    - Version – [in] What vCard version to create.

  Returns:

    Error code.

GSM_Error GSM_DecodeVCARD(GSM_Debug_Info *di, char *Buffer, size_t *Pos, GSM_MemoryEntry *Pbk, const GSM_VCardVersion Version)

  Decodes memory entry from vCard.

  Parameters:

    - di – Pointer to debugging description.

    - Buffer – [in] Buffer to readCard text.

    - Pos – [inout] Position in output buffer.

    - Pbk – [out] Phonebook data read from vCard.

    - Version – [in] What vCard version to parse.

  Returns:

    Error code.

void GSM_FreeMemoryEntry(GSM_MemoryEntry *Entry)

  Frees any dynamically allocated memory inside memory entry structure.

  Parameters:

    - Entry – [in] Pointer to memory entry to process.

enum GSM_MemoryType

  Enum defines ID for various phone and SIM memories. Phone modules can translate them to values specific for concrete models. Two letter codes (excluding VM and SL) are from GSM 07.07.

  Values:

  enumerator MEM_ME

    Internal memory of the mobile equipment

  enumerator MEM_SM

    SIM card memory

  enumerator MEM_ON

    Own numbers

  enumerator MEM_DC

    Dialled calls

  enumerator MEM_RC

    Received calls

  enumerator MEM_MC

    Missed calls

  enumerator MEM_MT

    Combined ME and SIM phonebook

  enumerator MEM_FD

    Fixed dial

  enumerator MEM_VM

    Voice mailbox

  enumerator MEM_SL

    Sent SMS logs

  enumerator MEM_QD

    Quick dialing choices.

  enumerator MEM_SR

    Status report memory

  enumerator MEM_INVALID

    Invalid memory type.

struct GSM_MemoryStatus

  Structure contains info about number of used/free entries in phonebook memory.

  Public Members

  int MemoryUsed

    Number of used entries

  GSM_MemoryType MemoryType

    Memory type

  int MemoryFree

    Number of free entries

enum GSM_EntryType

  Type of specific phonebook entry. In parenthesis is specified in which member of GSM_SubMemoryEntry value is stored.

  Values:

  enumerator PBK_Number_General

    General number. (Text)

  enumerator PBK_Number_Mobile

    Mobile number. (Text)

  enumerator PBK_Number_Fax

    Fax number. (Text)

  enumerator PBK_Number_Pager

    Pager number. (Text)

  enumerator PBK_Number_Other

    Other number. (Text)

  enumerator PBK_Text_Note

    Note. (Text)

  enumerator PBK_Text_Postal

    Complete postal address. (Text)

  enumerator PBK_Text_Email

    Email. (Text)

  enumerator PBK_Text_Email2
  enumerator PBK_Text_URL

    URL (Text)

  enumerator PBK_Date

    Date and time of last call. (Date)

  enumerator PBK_Caller_Group

    Caller group. (Number)

  enumerator PBK_Text_Name

    Name (Text)

  enumerator PBK_Text_LastName

    Last name. (Text)

  enumerator PBK_Text_FirstName

    First name. (Text)

  enumerator PBK_Text_Company

    Company. (Text)

  enumerator PBK_Text_JobTitle

    Job title. (Text)

  enumerator PBK_Category

    Category. (Number, if -1 then text)

  enumerator PBK_Private

    Whether entry is private. (Number)

  enumerator PBK_Text_StreetAddress

    Street address. (Text)

  enumerator PBK_Text_City

    City. (Text)

  enumerator PBK_Text_State

    State. (Text)

  enumerator PBK_Text_Zip

    Zip code. (Text)

  enumerator PBK_Text_Country

    Country. (Text)

  enumerator PBK_Text_Custom1

    Custom information 1. (Text)

  enumerator PBK_Text_Custom2

    Custom information 2. (Text)

  enumerator PBK_Text_Custom3

    Custom information 3. (Text)

  enumerator PBK_Text_Custom4

    Custom information 4. (Text)

  enumerator PBK_RingtoneID

    Ringtone ID. (Number)

  enumerator PBK_PictureID

    Picture ID. (Number)

  enumerator PBK_Text_UserID

    User ID. (Text)

  enumerator PBK_CallLength

    Length of call (Number)

  enumerator PBK_Text_LUID

    LUID - Unique Identifier used for synchronisation (Text)

  enumerator PBK_LastModified

    Date of last modification (Date)

  enumerator PBK_Text_NickName

    Nick name (Text)

  enumerator PBK_Text_FormalName

    Formal name (Text)

  enumerator PBK_Text_PictureName

    Picture name (on phone filesystem). (Text)

  enumerator PBK_PushToTalkID

    Push-to-talk ID (Text)

  enumerator PBK_Number_Messaging

    Favorite messaging number. (Text)

  enumerator PBK_Photo

    Photo (Picture).

  enumerator PBK_Text_SecondName

    Second name. (Text)

  enumerator PBK_Text_VOIP

    VOIP address (Text).

  enumerator PBK_Text_SIP

    SIP address (Text).

  enumerator PBK_Text_DTMF

    DTMF (Text).

  enumerator PBK_Number_Video

    Video number. (Text)

  enumerator PBK_Text_SWIS

    See What I See address. (Text)

  enumerator PBK_Text_WVID

    Wireless Village user ID. (Text)

  enumerator PBK_Text_NamePrefix

    Name prefix (Text)

  enumerator PBK_Text_NameSuffix

    Name suffix (Text)

enum GSM_EntryLocation

  Location of memory contact.

  Values:

  enumerator PBK_Location_Unknown

    No/Unknown location.

  enumerator PBK_Location_Home

    Home

  enumerator PBK_Location_Work

    Work

struct GSM_SubMemoryEntry

  One value of phonebook memory entry.

  Public Members

  GSM_EntryType EntryType

    Type of entry.

  GSM_EntryLocation Location

    Location for the entry.

  GSM_DateTime Date

    Text of entry (if applicable, see GSM_EntryType).

  int Number

    Number of entry (if applicable, see GSM_EntryType).

  int VoiceTag

    Voice dialling tag.

  GSM_Error AddError

    During adding SubEntry Gammu can return here info, if it was done OK

  unsigned char Text[(GSM_PHONEBOOK_TEXT_LENGTH + 1) * 2]

    Text of entry (if applicable, see GSM_EntryType).

  GSM_BinaryPicture Picture

    Picture data.

struct GSM_MemoryEntry

  Structure for saving phonebook entries.

  Public Members

  GSM_MemoryType MemoryType

    Used memory for phonebook entry

  int Location

    Used location for phonebook entry

  int EntriesNum

    Number of SubEntries in Entries table.

  GSM_SubMemoryEntry Entries[GSM_PHONEBOOK_ENTRIES]

    Values of SubEntries.

struct GSM_SpeedDial

  Structure for saving speed dials.

  Public Members

  int Location

    Number of speed dial: 2,3..,8,9

  int MemoryNumberID

    ID of phone number used in phonebook entry

  GSM_MemoryType MemoryType

    Memory, where is saved used phonebook entry

  int MemoryLocation

    Location in memory, where is saved used phonebook entry

enum GSM_VCardVersion

  Types of vCard.

  Values:

  enumerator Nokia_VCard10

    vCard 1.0 hacked for Nokia.

  enumerator Nokia_VCard21

    vCard 2.1 hacked for Nokia.

  enumerator SonyEricsson_VCard10

    vCard 1.0 hacked for Sony-Ericsson (should be standard vCard).

  enumerator SonyEricsson_VCard21

    vCard 2.1 hacked for Sony-Ericsson (should be standard vCard).

  enumerator SonyEricsson_VCard21_Phone

    vCard 2.1 hacked for Sony-Ericsson (should be standard vCard) from phone (no parsing of location and memory type).