Imported gammu 0.90.7
[gammu.git] / common / service / gsmpbk.h
blob8cd295b4ef51374d019d6f2d860c17d7f74fb21f
2 #ifndef __gsm_phonebook_h
3 #define __gsm_phonebook_h
5 #include <stdlib.h>
7 #include "../gsmcomon.h"
8 #include "gsmmisc.h"
10 /**
11 * This structure contains info about number of used/free entries in phonebook
12 * memory
14 typedef struct {
15 /**
16 * Memory type
18 GSM_MemoryType MemoryType;
19 /**
20 * Number of used entries
22 int Used;
23 /**
24 * Number of free entries
26 int Free;
27 } GSM_MemoryStatus;
29 /**
30 * Type of specific phonebook entry. In parenthesis is specified in which
31 * member of @ref GSM_SubMemoryEntry value is stored.
33 /* Originally created for MyGnokii */
34 typedef enum {
35 /**
36 * General number. (Text)
38 PBK_Number_General = 1,
39 /**
40 * Mobile number. (Text)
42 PBK_Number_Mobile,
43 /**
44 * Work number. (Text)
46 PBK_Number_Work,
47 /**
48 * Fax number. (Text)
50 PBK_Number_Fax,
51 /**
52 * Home number. (Text)
54 PBK_Number_Home,
55 /**
56 * Pager number. (Text)
58 PBK_Number_Pager,
59 /**
60 * Other number. (Text)
62 PBK_Number_Other,
63 /**
64 * Note. (Text)
66 PBK_Text_Note,
67 /**
68 * Complete postal address. (Text)
70 PBK_Text_Postal,
71 /**
72 * Email. (Text)
74 PBK_Text_Email,
75 /**
76 * Second email. (Text)
78 PBK_Text_Email2,
79 /**
80 * URL (Text)
82 PBK_Text_URL,
83 /**
84 * Date and time. FIXME: describe better (Date)
86 PBK_Date,
87 /**
88 * Caller group. (Text)
90 PBK_Caller_Group,
91 /**
92 * Name (Text)
94 PBK_Text_Name,
95 /**
96 * Last name. (Text)
98 PBK_Text_LastName,
99 /**
100 * First name. (Text)
102 PBK_Text_FirstName,
104 * Company. (Text)
106 PBK_Text_Company,
108 * Job title. (Text)
110 PBK_Text_JobTitle,
112 * Category. (Number)
114 PBK_Category,
116 * Whether entry is private. (Number)
118 PBK_Private,
120 * Street address. (Text)
122 PBK_Text_StreetAddress,
124 * City. (Text)
126 PBK_Text_City,
128 * State. (Text)
130 PBK_Text_State,
132 * Zip code. (Text)
134 PBK_Text_Zip,
136 * Country. (Text)
138 PBK_Text_Country,
140 * Custom information 1. (Text)
142 PBK_Text_Custom1,
144 * Custom information 2. (Text)
146 PBK_Text_Custom2,
148 * Custom information 3. (Text)
150 PBK_Text_Custom3,
152 * Custom information 4. (Text)
154 PBK_Text_Custom4,
156 * Ringtone ID. (Text)
158 PBK_RingtoneID,
160 * Picture ID. (Number)
162 PBK_PictureID
163 } GSM_EntryType;
165 #define GSM_PHONEBOOK_TEXT_LENGTH (200)
166 #define GSM_PHONEBOOK_ENTRIES (26)
169 * One value of memory entry.
171 typedef struct {
173 * Type of entry.
175 GSM_EntryType EntryType;
177 * Text of entry (if applicable, see @ref GSM_EntryType).
179 unsigned char Text[(GSM_PHONEBOOK_TEXT_LENGTH+1)*2];
181 * Text of entry (if applicable, see @ref GSM_EntryType).
183 GSM_DateTime Date;
185 * Number of entry (if applicable, see @ref GSM_EntryType).
187 int Number;
189 * Voice dialling tag.
191 int VoiceTag;
192 } GSM_SubMemoryEntry;
194 /* Define datatype for phonebook entry
195 * used for getting/writing phonebook entries.
197 typedef struct {
199 * Type of memory.
201 GSM_MemoryType MemoryType;
203 * Location.
205 int Location;
207 * Number of entries.
209 int EntriesNum;
211 * Whether to prefer unicode for storing this entry.
213 bool PreferUnicode;
215 * Values for this entry.
217 GSM_SubMemoryEntry Entries[GSM_PHONEBOOK_ENTRIES];
218 } GSM_MemoryEntry;
220 typedef enum {
221 Nokia_VCard10 = 1,
222 Nokia_VCard21,
223 SonyEricsson_VCard10,
224 SonyEricsson_VCard21
225 } GSM_VCardVersion;
227 void GSM_PhonebookFindDefaultNameNumberGroup(GSM_MemoryEntry *entry, int *Name, int *Number, int *Group);
228 unsigned char *GSM_PhonebookGetEntryName (GSM_MemoryEntry *entry);
230 void GSM_EncodeVCARD(char *Buffer, int *Length, GSM_MemoryEntry *pbk, bool header, GSM_VCardVersion Version);
231 GSM_Error GSM_DecodeVCARD(unsigned char *Buffer, int *Pos, GSM_MemoryEntry *Pbk, GSM_VCardVersion Version);
233 void DecodeVCARD21Text(char *VCard, GSM_MemoryEntry *pbk);
236 * Define datatype for saving speed dials
238 typedef struct {
240 * Specify number of speed dial
242 int Location;
244 * Memory, where is saved used phonebook entry
246 GSM_MemoryType MemoryType;
248 * Location in memory, where is saved used phonebook entry
250 int MemoryLocation;
252 * ID of phone number used in phonebook entry
254 int MemoryNumberID;
255 } GSM_SpeedDial;
257 #endif
259 /* How should editor hadle tabs in this file? Add editor commands here.
260 * vim: noexpandtab sw=8 ts=8 sts=8: