author | zautrix <zautrix> | 2004-08-07 17:24:40 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-08-07 17:24:40 (UTC) |
commit | 88b0d33b8b0b1f6ae320cfc863ca6a47fa8fec22 (patch) (unidiff) | |
tree | 6331418973714243beb674abc87692277b83869d /gammu/emb/common/phone/alcatel/alcatel.h | |
parent | ef8a09ce74ad3f0a51484d03fdf009bd5b3677bf (diff) | |
download | kdepimpi-88b0d33b8b0b1f6ae320cfc863ca6a47fa8fec22.zip kdepimpi-88b0d33b8b0b1f6ae320cfc863ca6a47fa8fec22.tar.gz kdepimpi-88b0d33b8b0b1f6ae320cfc863ca6a47fa8fec22.tar.bz2 |
Initial revision
Diffstat (limited to 'gammu/emb/common/phone/alcatel/alcatel.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | gammu/emb/common/phone/alcatel/alcatel.h | 286 |
1 files changed, 286 insertions, 0 deletions
diff --git a/gammu/emb/common/phone/alcatel/alcatel.h b/gammu/emb/common/phone/alcatel/alcatel.h new file mode 100644 index 0000000..718f436 --- a/dev/null +++ b/gammu/emb/common/phone/alcatel/alcatel.h | |||
@@ -0,0 +1,286 @@ | |||
1 | /* (c) 2002-2004 by Michal Cihar */ | ||
2 | |||
3 | /* | ||
4 | * High level functions for communication with Alcatel One Touch 501 and | ||
5 | * compatible mobile phone. | ||
6 | * | ||
7 | * This code implements functions to communicate with Alcatel phones, | ||
8 | * currently seem to work: | ||
9 | * - BE5 series (501/701) | ||
10 | * - BF5 series (715) | ||
11 | * - BH4 series (535/735) | ||
12 | * For some functions it uses normal AT mode (not implemented here, look at | ||
13 | * ../at/atgen.[ch]) for others it switches into binary mode and initialises | ||
14 | * underlaying protocol (see ../../protocol/alcatel/alcabus.[ch]) and | ||
15 | * communicates over it. Don't ask me why Alcatel uses such silly thing... | ||
16 | */ | ||
17 | |||
18 | #ifndef alcatel_h | ||
19 | #define alcatel_h | ||
20 | |||
21 | #include "../../gsmcomon.h" | ||
22 | |||
23 | #ifndef GSM_USED_AT | ||
24 | # define GSM_USED_AT | ||
25 | #endif | ||
26 | #ifndef GSM_USED_ALCABUS | ||
27 | # define GSM_USED_ALCABUS | ||
28 | #endif | ||
29 | |||
30 | /** | ||
31 | * Determines which mode is phone currently using. | ||
32 | */ | ||
33 | typedef enum { | ||
34 | /** | ||
35 | * Phone accepts normal AT commands. | ||
36 | */ | ||
37 | ModeAT = 1, | ||
38 | /** | ||
39 | * Binary mode using proprietary protocol. | ||
40 | */ | ||
41 | ModeBinary | ||
42 | } GSM_Alcatel_Mode; | ||
43 | |||
44 | /** | ||
45 | * Protocol version being used for binary mode. | ||
46 | */ | ||
47 | typedef enum { | ||
48 | /** | ||
49 | * Version 1.0 used in BE5 phones (501, 701). | ||
50 | */ | ||
51 | V_1_0 = 1, | ||
52 | /** | ||
53 | * Version 1.1 used in BF5 phones (715, 535, 735). | ||
54 | */ | ||
55 | V_1_1 | ||
56 | } GSM_Alcatel_ProtocolVersion; | ||
57 | |||
58 | /** | ||
59 | * State of binary mode. | ||
60 | */ | ||
61 | typedef enum { | ||
62 | /** | ||
63 | * Binary mode is active. No type selected. | ||
64 | */ | ||
65 | StateAttached = 1, | ||
66 | /** | ||
67 | * Opened session of some type. | ||
68 | */ | ||
69 | StateSession, | ||
70 | /** | ||
71 | * Some item is being edited. | ||
72 | */ | ||
73 | StateEdit | ||
74 | } GSM_Alcatel_BinaryState; | ||
75 | |||
76 | /** | ||
77 | * Type of active binary session. | ||
78 | */ | ||
79 | typedef enum { | ||
80 | /** | ||
81 | * Calendar events. | ||
82 | */ | ||
83 | TypeCalendar = 1, | ||
84 | /** | ||
85 | * Contacts. | ||
86 | */ | ||
87 | TypeContacts, | ||
88 | /** | ||
89 | * To do items. | ||
90 | */ | ||
91 | TypeToDo | ||
92 | } GSM_Alcatel_BinaryType; | ||
93 | |||
94 | /** | ||
95 | * Alcatel internal types. | ||
96 | */ | ||
97 | typedef enum { | ||
98 | /** | ||
99 | * Date, stored as @ref GSM_DateTime. | ||
100 | */ | ||
101 | Alcatel_date, | ||
102 | /** | ||
103 | * Time, stored as @ref GSM_DateTime. | ||
104 | */ | ||
105 | Alcatel_time, | ||
106 | /** | ||
107 | * String, strored as chars | ||
108 | */ | ||
109 | Alcatel_string, /* char*/ | ||
110 | /** | ||
111 | * Phone number (can contain anything, but dialling it then may cause | ||
112 | * strange problems to phone) strored as chars. | ||
113 | */ | ||
114 | Alcatel_phone, | ||
115 | /** | ||
116 | * Enumeration, usually used for user defined values (categories), | ||
117 | * stored as int. | ||
118 | */ | ||
119 | Alcatel_enum, | ||
120 | /** | ||
121 | * Boolean, stored as int. | ||
122 | */ | ||
123 | Alcatel_bool, | ||
124 | /** | ||
125 | * 32-bit unsigned integer, stored as int. | ||
126 | */ | ||
127 | Alcatel_int, | ||
128 | /** | ||
129 | * 8-bit usigned integer, stored as int. | ||
130 | */ | ||
131 | Alcatel_byte | ||
132 | } GSM_Alcatel_FieldType; | ||
133 | |||
134 | /** | ||
135 | * Return value for GetMemoryStatus. There is no way ho to determine free | ||
136 | * memory so we have to return some fixed value. | ||
137 | */ | ||
138 | #define ALCATEL_FREE_MEMORY 100 | ||
139 | /** | ||
140 | * Maximum location, that will driver attempt to read. Because phone can have | ||
141 | * up to 2^32 locations, we want to limit this a bit. | ||
142 | */ | ||
143 | /* There COULD be 0xffffffff on next line, but this is IMHO enough */ | ||
144 | #define ALCATEL_MAX_LOCATION 0xffff | ||
145 | /** | ||
146 | * Maximum category count. Used for static cache size. | ||
147 | */ | ||
148 | #define ALCATEL_MAX_CATEGORIES 100 | ||
149 | |||
150 | /** | ||
151 | * Alcatel driver private data. | ||
152 | */ | ||
153 | typedef struct { | ||
154 | /***********************************/ | ||
155 | /* Communication state information */ | ||
156 | /***********************************/ | ||
157 | /** | ||
158 | * Mode of current communication. | ||
159 | */ | ||
160 | GSM_Alcatel_ModeMode; | ||
161 | /** | ||
162 | * State of current communication if phone is in binary mode. | ||
163 | */ | ||
164 | GSM_Alcatel_BinaryStateBinaryState; | ||
165 | /** | ||
166 | * Type of current communication if phone is in session or edit state, | ||
167 | * zero otherwise. | ||
168 | */ | ||
169 | GSM_Alcatel_BinaryTypeBinaryType; | ||
170 | /** | ||
171 | * Currently edited item when phone is in edit state, zero otherwise. | ||
172 | */ | ||
173 | int BinaryItem; | ||
174 | /** | ||
175 | * Protocol version being used. | ||
176 | */ | ||
177 | GSM_Alcatel_ProtocolVersionProtocolVersion; | ||
178 | |||
179 | /*****************/ | ||
180 | /* Return values */ | ||
181 | /*****************/ | ||
182 | /** | ||
183 | * Return value for commited record position. | ||
184 | */ | ||
185 | int CommitedRecord; | ||
186 | /** | ||
187 | * Used for detecting end of large data data, that don't fit in one | ||
188 | * message. | ||
189 | */ | ||
190 | bool TransferCompleted; | ||
191 | /** | ||
192 | * Type of currently received field. | ||
193 | */ | ||
194 | GSM_Alcatel_FieldTypeReturnType; | ||
195 | /** | ||
196 | * Value of currently returned field (if it can be saved in DateTime). | ||
197 | */ | ||
198 | GSM_DateTime ReturnDateTime; | ||
199 | /** | ||
200 | * Value of currently returned field (if it can be saved in int). | ||
201 | */ | ||
202 | unsigned int ReturnInt; | ||
203 | /** | ||
204 | * Value of currently returned field (if it can be saved in string). | ||
205 | */ | ||
206 | unsigned char ReturnString[(GSM_PHONEBOOK_TEXT_LENGTH+1)*2]; | ||
207 | |||
208 | /***********/ | ||
209 | /* Caches: */ | ||
210 | /***********/ | ||
211 | /* Listings of available items for each type */ | ||
212 | /** | ||
213 | * Pointer to list of active items. | ||
214 | */ | ||
215 | int **CurrentList; | ||
216 | /** | ||
217 | * Pointer to currently count of active items. | ||
218 | */ | ||
219 | int *CurrentCount; | ||
220 | /** | ||
221 | * Items locations in calendar. | ||
222 | */ | ||
223 | int *CalendarItems; | ||
224 | /** | ||
225 | * Items locations in to do list. | ||
226 | */ | ||
227 | int *ToDoItems; | ||
228 | /** | ||
229 | * Items locations in contacts. | ||
230 | */ | ||
231 | int *ContactsItems; | ||
232 | /** | ||
233 | * Count of calendar items stored in @ref CalendarItems. | ||
234 | */ | ||
235 | int CalendarItemsCount; | ||
236 | /** | ||
237 | * Count of todo items stored in @ref ToDoItems. | ||
238 | */ | ||
239 | int ToDoItemsCount; | ||
240 | /** | ||
241 | * Count of contacts items stored in @ref ContactsItems. | ||
242 | */ | ||
243 | int ContactsItemsCount; | ||
244 | /** | ||
245 | * Fields of currently active item. | ||
246 | */ | ||
247 | int CurrentFields[GSM_PHONEBOOK_ENTRIES+1]; | ||
248 | /** | ||
249 | * Count of fields listed in @ref CurrentFields. | ||
250 | */ | ||
251 | int CurrentFieldsCount; | ||
252 | /** | ||
253 | * Location of current (eg. which identifies @ref CurrentFieldsCount | ||
254 | * and @ref CurrentFields) item. | ||
255 | */ | ||
256 | int CurrentFieldsItem; | ||
257 | /** | ||
258 | * Type of current (eg. which identifies @ref CurrentFieldsCount | ||
259 | * and @ref CurrentFields) item. | ||
260 | */ | ||
261 | GSM_Alcatel_BinaryTypeCurrentFieldsType; | ||
262 | |||
263 | /** | ||
264 | * Listing of categories of current type. | ||
265 | */ | ||
266 | int CurrentCategories[ALCATEL_MAX_CATEGORIES+1]; | ||
267 | /** | ||
268 | * Cache for category names of current type. The index here is not | ||
269 | * same as in @ref CurrentCategories, it is id of category here. | ||
270 | */ | ||
271 | char CurrentCategoriesCache[ALCATEL_MAX_CATEGORIES+1][(GSM_MAX_CATEGORY_NAME_LENGTH + 1)*2]; | ||
272 | /** | ||
273 | * Count of entries in @ref CurrentCategories. | ||
274 | */ | ||
275 | int CurrentCategoriesCount; | ||
276 | /** | ||
277 | * Type of current categories in @ref CurrentCategories etc. | ||
278 | */ | ||
279 | GSM_Alcatel_BinaryTypeCurrentCategoriesType; | ||
280 | |||
281 | } GSM_Phone_ALCATELData; | ||
282 | #endif | ||
283 | |||
284 | /* How should editor hadle tabs in this file? Add editor commands here. | ||
285 | * vim: noexpandtab sw=8 ts=8 sts=8: | ||
286 | */ | ||