summaryrefslogtreecommitdiffabout
path: root/gammu/emb/common/phone/alcatel
Unidiff
Diffstat (limited to 'gammu/emb/common/phone/alcatel') (more/less context) (ignore whitespace changes)
-rw-r--r--gammu/emb/common/phone/alcatel/alcatel.c298
1 files changed, 155 insertions, 143 deletions
diff --git a/gammu/emb/common/phone/alcatel/alcatel.c b/gammu/emb/common/phone/alcatel/alcatel.c
index f004ad4..3821f13 100644
--- a/gammu/emb/common/phone/alcatel/alcatel.c
+++ b/gammu/emb/common/phone/alcatel/alcatel.c
@@ -8,11 +8,11 @@
8 * currently seem to work: 8 * currently seem to work:
9 * - BE5 series (501/701) 9 * - BE5 series (501/701)
10 * - BF5 series (715) 10 * - BF5 series (715)
11 * - BH4 series (535/735) 11 * - BH4 series (535/735)
12 * For some functions it uses normal AT mode (not implemented here, look at 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 13 * ../at/atgen.[ch]) for others it switches into binary mode and initialises
14 * underlaying protocol (see ../../protocol/alcatel/alcabus.[ch]) and 14 * underlaying protocol (see ../../protocol/alcatel/alcabus.[ch]) and
15 * communicates over it. Don't ask me why Alcatel uses such silly thing... 15 * communicates over it. Don't ask me why Alcatel uses such silly thing...
16 * 16 *
17 * Notes for future features: 17 * Notes for future features:
18 * - max phone number length is 61 (BE5) 18 * - max phone number length is 61 (BE5)
@@ -100,8 +100,9 @@ extern GSM_Error ATGEN_GetDisplayStatus (GSM_StateMachine *s, GSM_DisplayFeatur
100 extern GSM_Error ATGEN_SetAutoNetworkLogin(GSM_StateMachine *s); 100 extern GSM_Error ATGEN_SetAutoNetworkLogin(GSM_StateMachine *s);
101 extern GSM_Error ATGEN_DeleteAllMemory (GSM_StateMachine *s, GSM_MemoryType type); 101 extern GSM_Error ATGEN_DeleteAllMemory (GSM_StateMachine *s, GSM_MemoryType type);
102 102
103 extern GSM_Error ATGEN_DispatchMessage (GSM_StateMachine *s); 103 extern GSM_Error ATGEN_DispatchMessage (GSM_StateMachine *s);
104 extern GSM_Error ATGEN_SetFastSMSSending(GSM_StateMachine *s, bool enable);
104 extern GSM_Error ATGEN_SetIncomingCB (GSM_StateMachine *s, bool enable); 105 extern GSM_Error ATGEN_SetIncomingCB (GSM_StateMachine *s, bool enable);
105 extern GSM_Error ATGEN_SetIncomingSMS (GSM_StateMachine *s, bool enable); 106 extern GSM_Error ATGEN_SetIncomingSMS (GSM_StateMachine *s, bool enable);
106 107
107/** 108/**
@@ -115,9 +116,9 @@ unsigned char GSM_AlcatelAlphabet[] =
115 0x80, 0x00,0x20, /* empty */ 116 0x80, 0x00,0x20, /* empty */
116 0x81, 0x00,0x20, /* empty*/ 117 0x81, 0x00,0x20, /* empty*/
117 0x82, 0x00,0x20, /* empty*/ 118 0x82, 0x00,0x20, /* empty*/
118 0x83, 0x00,0x20, /* empty*/ 119 0x83, 0x00,0x20, /* empty*/
119 120
120 0x84, 0x00,0xe7, /* c cedilla*/ 121 0x84, 0x00,0xe7, /* c cedilla*/
121 0x85, 0x20,0x26, /* ... */ 122 0x85, 0x20,0x26, /* ... */
122 0x86, 0x03,0xc0, /* pi */ 123 0x86, 0x03,0xc0, /* pi */
123 0x87, 0x01,0x3e, /* l caron*/ 124 0x87, 0x01,0x3e, /* l caron*/
@@ -167,20 +168,20 @@ unsigned char GSM_AlcatelAlphabet[] =
167 0xb3, 0x01,0x44, /* n acute*/ 168 0xb3, 0x01,0x44, /* n acute*/
168 0xb4, 0x01,0x42, /* l stroke*/ 169 0xb4, 0x01,0x42, /* l stroke*/
169 170
170 0xb5, 0x00,0x20, /* empty*/ 171 0xb5, 0x00,0x20, /* empty*/
171 172
172 0xb6, 0x01,0x48, /* n caron*/ 173 0xb6, 0x01,0x48, /* n caron*/
173 0xb7, 0x01,0x65, /* t caron*/ 174 0xb7, 0x01,0x65, /* t caron*/
174 175
175 0xb8, 0x00,0x20, /* empty*/ 176 0xb8, 0x00,0x20, /* empty*/
176 177
177 0xb9, 0x01,0x7e, /* z caron*/ 178 0xb9, 0x01,0x7e, /* z caron*/
178 0xba, 0x01,0xe7, /* g caron*/ 179 0xba, 0x01,0xe7, /* g caron*/
179 180
180 0xbb, 0x00,0x20, /* empty*/ 181 0xbb, 0x00,0x20, /* empty*/
181 0xbc, 0x00,0x20, /* empty*/ 182 0xbc, 0x00,0x20, /* empty*/
182 183
183 0xbd, 0x1e,0x20, /* G macron*/ 184 0xbd, 0x1e,0x20, /* G macron*/
184 0xbe, 0x1e,0x21, /* g macron*/ 185 0xbe, 0x1e,0x21, /* g macron*/
185 0xbf, 0x01,0x5e, /* S cedilla*/ 186 0xbf, 0x01,0x5e, /* S cedilla*/
186 0xc0, 0x01,0x5f, /* s cedilla*/ 187 0xc0, 0x01,0x5f, /* s cedilla*/
@@ -195,25 +196,25 @@ unsigned char GSM_AlcatelAlphabet[] =
195 0xc9, 0x00,0xd7, /* x */ 196 0xc9, 0x00,0xd7, /* x */
196 0xca, 0x00,0x5d, /* ] */ 197 0xca, 0x00,0x5d, /* ] */
197 0xcb, 0x26,0x0f, /* phone*/ 198 0xcb, 0x26,0x0f, /* phone*/
198 0xcc, 0x01,0x0f, /* d caron*/ 199 0xcc, 0x01,0x0f, /* d caron*/
199 200
200 0xcd, 0x00,0x20, /* empty*/ 201 0xcd, 0x00,0x20, /* empty*/
201 202
202 0xce, 0x00,0x7e, /* ~ */ 203 0xce, 0x00,0x7e, /* ~ */
203 0xcf, 0x00,0x5c, /* \ */ 204 0xcf, 0x00,0x5c, /* \ */
204 0xd0, 0x00,0x5e, /* ^ */ 205 0xd0, 0x00,0x5e, /* ^ */
205 206
206 0xd1, 0x00,0x20, /* empty*/ 207 0xd1, 0x00,0x20, /* empty*/
207 208
208 0xd2, 0x00,0x7b, /* { */ 209 0xd2, 0x00,0x7b, /* { */
209 0xd3, 0x00,0x7c, /* | */ 210 0xd3, 0x00,0x7c, /* | */
210 0xd4, 0x00,0x7d, /* } */ 211 0xd4, 0x00,0x7d, /* } */
211 212
212 0xd5, 0x00,0x20, /* empty*/ 213 0xd5, 0x00,0x20, /* empty*/
213 214
214 0xd6, 0x01,0x63, /* t cedilla*/ 215 0xd6, 0x01,0x63, /* t cedilla*/
215 216
216 0xd7, 0x00,0x20, /* empty*/ 217 0xd7, 0x00,0x20, /* empty*/
217 0xd8, 0x00,0x20, /* empty*/ 218 0xd8, 0x00,0x20, /* empty*/
218 0xd9, 0x00,0x20, /* empty*/ 219 0xd9, 0x00,0x20, /* empty*/
219 0xda, 0x00,0x20, /* empty*/ 220 0xda, 0x00,0x20, /* empty*/
@@ -222,15 +223,15 @@ unsigned char GSM_AlcatelAlphabet[] =
222 0xdd, 0x00,0x20, /* empty*/ 223 0xdd, 0x00,0x20, /* empty*/
223 0xde, 0x00,0x20, /* empty*/ 224 0xde, 0x00,0x20, /* empty*/
224 0xdf, 0x00,0x20, /* empty*/ 225 0xdf, 0x00,0x20, /* empty*/
225 0xe0, 0x00,0x20, /* empty*/ 226 0xe0, 0x00,0x20, /* empty*/
226 227
227 0xe1, 0x00,0x20, /* two candles*/ /* FIXME */ 228 0xe1, 0x00,0x20, /* two candles*/ /* FIXME */
228 229
229 0xe2, 0x00,0x20, /* empty*/ 230 0xe2, 0x00,0x20, /* empty*/
230 0xe3, 0x00,0x20, /* empty*/ 231 0xe3, 0x00,0x20, /* empty*/
231 0xe4, 0x00,0x20, /* empty*/ 232 0xe4, 0x00,0x20, /* empty*/
232 233
233 0xe5, 0x01,0xce, /* a caron*/ 234 0xe5, 0x01,0xce, /* a caron*/
234 0xe6, 0x01,0x01, /* a macron*/ 235 0xe6, 0x01,0x01, /* a macron*/
235 0xe7, 0x01,0x13, /* e macron*/ 236 0xe7, 0x01,0x13, /* e macron*/
236 0xe8, 0x01,0x2b, /* i macron*/ 237 0xe8, 0x01,0x2b, /* i macron*/
@@ -238,36 +239,36 @@ unsigned char GSM_AlcatelAlphabet[] =
238 0xea, 0x01,0x6b, /* u macron*/ 239 0xea, 0x01,0x6b, /* u macron*/
239 0xeb, 0x00,0x41, /* A */ 240 0xeb, 0x00,0x41, /* A */
240 0xec, 0x00,0x40, /* @ */ 241 0xec, 0x00,0x40, /* @ */
241 0xed, 0x00,0x20,/* some strange char :-) */ /* FIXME */ 242 0xed, 0x00,0x20,/* some strange char :-) */ /* FIXME */
242 243
243 0xee, 0x00,0x20, /* big key stroken*/ /* FIXME */ 244 0xee, 0x00,0x20, /* big key stroken*/ /* FIXME */
244 0xef, 0x00,0x20, /* big key*/ /* FIXME */ 245 0xef, 0x00,0x20, /* big key*/ /* FIXME */
245 246
246 0xf0, 0x00,0x20, /* empty*/ 247 0xf0, 0x00,0x20, /* empty*/
247 248
248 0xf1, 0x00,0x31, /* 1 */ 249 0xf1, 0x00,0x31, /* 1 */
249 0xf2, 0x00,0x21, /* bold !*/ 250 0xf2, 0x00,0x21, /* bold !*/
250 0xf3, 0x26,0x0e, /* black phone*/ 251 0xf3, 0x26,0x0e, /* black phone*/
251 0xf4, 0x00,0x26, /* & */ 252 0xf4, 0x00,0x26, /* & */
252 0xf5, 0x23,0x7e, /* bell */ 253 0xf5, 0x23,0x7e, /* bell */
253 0xf6, 0x26,0x6a, /* note */ 254 0xf6, 0x26,0x6a, /* note */
254 255
255 0xf7, 0x27,0x13, /* okay inv*/ /* FIXME */ 256 0xf7, 0x27,0x13, /* okay inv*/ /* FIXME */
256 0xf8, 0x27,0x13, /* okay */ 257 0xf8, 0x27,0x13, /* okay */
257 258
258 0xf9, 0x00,0x20, /* empty*/ 259 0xf9, 0x00,0x20, /* empty*/
259 260
260 0xfa, 0x00,0x20, /* key */ /* FIXME */ 261 0xfa, 0x00,0x20, /* key */ /* FIXME */
261 262
262 0xfb, 0x00,0x20, /* empty*/ 263 0xfb, 0x00,0x20, /* empty*/
263 264
264 0xfc, 0x20,0xac, /* Euro */ 265 0xfc, 0x20,0xac, /* Euro */
265 0xfd, 0x21,0x97, /* NE arrow*/ 266 0xfd, 0x21,0x97, /* NE arrow*/
266 0xfe, 0x21,0x98, /* SE arrow*/ 267 0xfe, 0x21,0x98, /* SE arrow*/
267 268
268 0xff, 0x00,0x20, /* empty*/ 269 0xff, 0x00,0x20, /* empty*/
269 270
270 0x00, 0x00,0x00 271 0x00, 0x00,0x00
271}; 272};
272 273
273/* This is being called from atgen */ 274/* This is being called from atgen */
@@ -314,22 +315,22 @@ static GSM_Error ALCATEL_SetBinaryMode(GSM_StateMachine *s)
314 dbgprintf ("Changing to binary mode\n"); 315 dbgprintf ("Changing to binary mode\n");
315 316
316 error=GSM_WaitFor (s, "AT+IFC=2,2\r", 11, 0x02, 4, ID_SetFlowControl); 317 error=GSM_WaitFor (s, "AT+IFC=2,2\r", 11, 0x02, 4, ID_SetFlowControl);
317 if (error != ERR_NONE) return error; 318 if (error != ERR_NONE) return error;
318 319
319 error=GSM_WaitFor (s, "AT+CPROT=?\r", 11, 0x02, 4, ID_AlcatelProtocol); 320 error=GSM_WaitFor (s, "AT+CPROT=?\r", 11, 0x02, 4, ID_AlcatelProtocol);
320 if (error != ERR_NONE) return error; 321 if (error != ERR_NONE) return error;
321 322
322 if (Priv->ProtocolVersion == V_1_0) { 323 if (Priv->ProtocolVersion == V_1_0) {
323 error=GSM_WaitFor (s, "AT+CPROT=16,\"V1.0\",16\r", 22, 0x00, 4, ID_AlcatelConnect); 324 error=GSM_WaitFor (s, "AT+CPROT=16,\"V1.0\",16\r", 22, 0x00, 4, ID_AlcatelConnect);
324 } else { 325 } else {
325 error=GSM_WaitFor (s, "AT+CPROT=16,\"V1.1\",16\r", 22, 0x00, 4, ID_AlcatelConnect); 326 error=GSM_WaitFor (s, "AT+CPROT=16,\"V1.1\",16\r", 22, 0x00, 4, ID_AlcatelConnect);
326 } 327 }
327 328
328 if (error == ERR_TIMEOUT && s->Speed != 19200) { 329 if (error == ERR_TIMEOUT && s->Speed != 19200) {
329 smprintf(s, "HINT: Try changing speed to 19200, it is sometimes needed for Alcatel binary mode.\n"); 330 smprintf(s, "HINT: Try changing speed to 19200, it is sometimes needed for Alcatel binary mode.\n");
330 } 331 }
331 332
332 if (error != ERR_NONE) return error; 333 if (error != ERR_NONE) return error;
333 334
334 dbgprintf ("Changing protocol to Alcabus\n"); 335 dbgprintf ("Changing protocol to Alcabus\n");
335 336
@@ -375,9 +376,9 @@ static GSM_Error ALCATEL_GoToBinaryState(GSM_StateMachine *s, GSM_Alcatel_Binary
375 {0x00, 0x04, 0x7C, 0x81, 376 {0x00, 0x04, 0x7C, 0x81,
376 0x00, /*type */ 377 0x00, /*type */
377 0x00, 0x85, 0x00}; 378 0x00, 0x85, 0x00};
378 unsigned char commit_buffer[] = 379 unsigned char commit_buffer[] =
379 {0x00, 0x04, 380 {0x00, 0x04,
380 0x00, /*type */ 381 0x00, /*type */
381 0x20, 0x01}; 382 0x20, 0x01};
382 383
383 smprintf(s, "Alcatel state switcher: %d -> %d, %d -> %d, %d -> %d\n", Priv->BinaryState, state, Priv->BinaryType, type, Priv->BinaryItem, item); 384 smprintf(s, "Alcatel state switcher: %d -> %d, %d -> %d, %d -> %d\n", Priv->BinaryState, state, Priv->BinaryType, type, Priv->BinaryItem, item);
@@ -442,9 +443,9 @@ static GSM_Error ALCATEL_GoToBinaryState(GSM_StateMachine *s, GSM_Alcatel_Binary
442 break; 443 break;
443 } 444 }
444 error=GSM_WaitFor (s, end_buffer, 9, 0x02, ALCATEL_TIMEOUT, ID_AlcatelEnd); 445 error=GSM_WaitFor (s, end_buffer, 9, 0x02, ALCATEL_TIMEOUT, ID_AlcatelEnd);
445 if (error != ERR_NONE) return error; 446 if (error != ERR_NONE) return error;
446 447
447 switch (Priv->BinaryType) { 448 switch (Priv->BinaryType) {
448 case TypeCalendar: 449 case TypeCalendar:
449 close_buffer[2] = ALCATEL_SYNC_TYPE_CALENDAR; 450 close_buffer[2] = ALCATEL_SYNC_TYPE_CALENDAR;
450 break; 451 break;
@@ -543,8 +544,10 @@ static GSM_Error ALCATEL_SetATMode(GSM_StateMachine *s)
543 dbgprintf ("Changing protocol to AT\n"); 544 dbgprintf ("Changing protocol to AT\n");
544 s->Protocol.Functions = &ATProtocol; 545 s->Protocol.Functions = &ATProtocol;
545 s->Phone.Functions->ReplyFunctions= ATGENReplyFunctions; 546 s->Phone.Functions->ReplyFunctions= ATGENReplyFunctions;
546 Priv->Mode = ModeAT; 547 Priv->Mode = ModeAT;
548 s->Phone.Data.Priv.ATGEN.PBKCharset= 0;
549 s->Phone.Data.Priv.ATGEN.PBKMemory= 0;
547 550
548 my_sleep(100); 551 my_sleep(100);
549 552
550 /* In case we don't send AT command short after closing binary mode, 553 /* In case we don't send AT command short after closing binary mode,
@@ -627,13 +630,13 @@ static GSM_Error ALCATEL_IsIdAvailable(GSM_StateMachine *s, int id) {
627 Priv->CurrentList = &(Priv->ToDoItems); 630 Priv->CurrentList = &(Priv->ToDoItems);
628 Priv->CurrentCount = &(Priv->ToDoItemsCount); 631 Priv->CurrentCount = &(Priv->ToDoItemsCount);
629 break; 632 break;
630 } 633 }
631 634
632 for (i=0; i<*Priv->CurrentCount; i++) { 635 for (i=0; i<*Priv->CurrentCount; i++) {
633 if ((*Priv->CurrentList)[i] == id) return ERR_NONE; 636 if ((*Priv->CurrentList)[i] == id) return ERR_NONE;
634 } 637 }
635 638
636 return ERR_EMPTY; 639 return ERR_EMPTY;
637} 640}
638 641
639/* finds next id that is available in the phone */ 642/* finds next id that is available in the phone */
@@ -845,9 +848,9 @@ static GSM_Error ALCATEL_ReplyGetFieldValue(GSM_Protocol_Message msg, GSM_StateM
845 Priv->ReturnType = Alcatel_time; 848 Priv->ReturnType = Alcatel_time;
846 Priv->ReturnDateTime.Hour= buffer[4]; 849 Priv->ReturnDateTime.Hour= buffer[4];
847 Priv->ReturnDateTime.Minute= buffer[5]; 850 Priv->ReturnDateTime.Minute= buffer[5];
848 Priv->ReturnDateTime.Second= buffer[6]; 851 Priv->ReturnDateTime.Second= buffer[6];
849 852
850 Priv->ReturnDateTime.Day= 0; 853 Priv->ReturnDateTime.Day= 0;
851 Priv->ReturnDateTime.Month= 0; 854 Priv->ReturnDateTime.Month= 0;
852 Priv->ReturnDateTime.Year= 0; 855 Priv->ReturnDateTime.Year= 0;
853 Priv->ReturnDateTime.Timezone= 0; 856 Priv->ReturnDateTime.Timezone= 0;
@@ -1095,14 +1098,14 @@ static GSM_Error ALCATEL_ReplyGetCategoryText(GSM_Protocol_Message msg, GSM_Stat
1095static GSM_Error ALCATEL_GetCategoryText(GSM_StateMachine *s, int id) { 1098static GSM_Error ALCATEL_GetCategoryText(GSM_StateMachine *s, int id) {
1096 unsigned char buffer[] = {0x00, 0x04, 0x00 /*type*/, 0x0c, 0x00 /*list*/, 0x0A, 0x01, 0x00 /*item*/ }; 1099 unsigned char buffer[] = {0x00, 0x04, 0x00 /*type*/, 0x0c, 0x00 /*list*/, 0x0A, 0x01, 0x00 /*item*/ };
1097 GSM_Phone_ALCATELData*Priv = &s->Phone.Data.Priv.ALCATEL; 1100 GSM_Phone_ALCATELData*Priv = &s->Phone.Data.Priv.ALCATEL;
1098 GSM_Error error; 1101 GSM_Error error;
1099 1102
1100 if (Priv->CurrentCategoriesCache[id][0] != '\000' || Priv->CurrentCategoriesCache[id][1] != '\000') { 1103 if (Priv->CurrentCategoriesCache[id][0] != '\000' || Priv->CurrentCategoriesCache[id][1] != '\000') {
1101 CopyUnicodeString(Priv->ReturnString, Priv->CurrentCategoriesCache[id]); 1104 CopyUnicodeString(Priv->ReturnString, Priv->CurrentCategoriesCache[id]);
1102 return ERR_NONE; 1105 return ERR_NONE;
1103 } 1106 }
1104 1107
1105 smprintf(s,"Reading category %d\n", id); 1108 smprintf(s,"Reading category %d\n", id);
1106 1109
1107 switch (Priv->BinaryType) { 1110 switch (Priv->BinaryType) {
1108 case TypeContacts: 1111 case TypeContacts:
@@ -1122,9 +1125,9 @@ static GSM_Error ALCATEL_GetCategoryText(GSM_StateMachine *s, int id) {
1122 error=GSM_WaitFor (s, buffer, 8, 0x02, ALCATEL_TIMEOUT, ID_AlcatelGetCategoryText1); 1125 error=GSM_WaitFor (s, buffer, 8, 0x02, ALCATEL_TIMEOUT, ID_AlcatelGetCategoryText1);
1123 if (error != ERR_NONE) return error; 1126 if (error != ERR_NONE) return error;
1124 error=GSM_WaitFor (s, 0, 0, 0x00, ALCATEL_TIMEOUT, ID_AlcatelGetCategoryText2); 1127 error=GSM_WaitFor (s, 0, 0, 0x00, ALCATEL_TIMEOUT, ID_AlcatelGetCategoryText2);
1125 if (error != ERR_NONE) return error; 1128 if (error != ERR_NONE) return error;
1126 1129
1127 CopyUnicodeString(Priv->CurrentCategoriesCache[id], Priv->ReturnString); 1130 CopyUnicodeString(Priv->CurrentCategoriesCache[id], Priv->ReturnString);
1128 1131
1129 return ERR_NONE; 1132 return ERR_NONE;
1130} 1133}
@@ -1212,11 +1215,11 @@ static GSM_Error ALCATEL_ReplyDeleteItem(GSM_Protocol_Message msg, GSM_StateMach
1212} 1215}
1213 1216
1214static GSM_Error ALCATEL_BuildWriteBuffer(unsigned char * buffer, GSM_Alcatel_FieldType type, int field, void *data) { 1217static GSM_Error ALCATEL_BuildWriteBuffer(unsigned char * buffer, GSM_Alcatel_FieldType type, int field, void *data) {
1215 int len; 1218 int len;
1216 1219
1217 buffer[1] = field & 0xff; 1220 buffer[1] = field & 0xff;
1218 1221
1219 switch(type) { 1222 switch(type) {
1220 case Alcatel_date: 1223 case Alcatel_date:
1221 if (!CheckDate((GSM_DateTime *)data)) return ERR_INVALIDDATETIME; 1224 if (!CheckDate((GSM_DateTime *)data)) return ERR_INVALIDDATETIME;
1222 1225
@@ -1328,12 +1331,12 @@ static GSM_Error ALCATEL_CreateField(GSM_StateMachine *s, GSM_Alcatel_FieldType
1328 break; 1331 break;
1329 } 1332 }
1330 error = ALCATEL_BuildWriteBuffer(buffer + 6, type, field, data); 1333 error = ALCATEL_BuildWriteBuffer(buffer + 6, type, field, data);
1331 if (error != ERR_NONE) return error; 1334 if (error != ERR_NONE) return error;
1332 1335
1333 error = GSM_WaitFor (s, buffer, 8 + buffer[6], 0x02, ALCATEL_TIMEOUT, ID_AlcatelCreateField); 1336 error = GSM_WaitFor (s, buffer, 8 + buffer[6], 0x02, ALCATEL_TIMEOUT, ID_AlcatelCreateField);
1334 if (error != ERR_NONE) return error; 1337 if (error != ERR_NONE) return error;
1335 1338
1336 return ERR_NONE; 1339 return ERR_NONE;
1337} 1340}
1338 1341
1339static GSM_Error ALCATEL_UpdateField(GSM_StateMachine *s, GSM_Alcatel_FieldType type, int id, int field, void *data) { 1342static GSM_Error ALCATEL_UpdateField(GSM_StateMachine *s, GSM_Alcatel_FieldType type, int id, int field, void *data) {
@@ -1341,17 +1344,17 @@ static GSM_Error ALCATEL_UpdateField(GSM_StateMachine *s, GSM_Alcatel_FieldType
1341 GSM_Error error; 1344 GSM_Error error;
1342 unsigned char buffer[200] = 1345 unsigned char buffer[200] =
1343 {0x00, 0x04, 1346 {0x00, 0x04,
1344 0x00, /* type */ 1347 0x00, /* type */
1345 0x26, 0x01, 1348 0x26, 0x01,
1346 0x00, 0x00, 0x00, 0x00,/* id */ 1349 0x00, 0x00, 0x00, 0x00,/* id */
1347 0x65, 1350 0x65,
1348 0x00, /* length of remaining part */ 1351 0x00, /* length of remaining part */
1349 0x00, /* field */ 1352 0x00, /* field */
1350 0x37}; /* data follows here */ 1353 0x37}; /* data follows here */
1351 1354
1352 smprintf(s,"Updating field (%08x.%02x)\n", id, field); 1355 smprintf(s,"Updating field (%08x.%02x)\n", id, field);
1353 1356
1354 buffer[5] = (id >> 24); 1357 buffer[5] = (id >> 24);
1355 buffer[6] = ((id >> 16) & 0xff); 1358 buffer[6] = ((id >> 16) & 0xff);
1356 buffer[7] = ((id >> 8) & 0xff); 1359 buffer[7] = ((id >> 8) & 0xff);
1357 buffer[8] = (id & 0xff); 1360 buffer[8] = (id & 0xff);
@@ -1368,12 +1371,12 @@ static GSM_Error ALCATEL_UpdateField(GSM_StateMachine *s, GSM_Alcatel_FieldType
1368 break; 1371 break;
1369 } 1372 }
1370 error = ALCATEL_BuildWriteBuffer(buffer + 10, type, field, data); 1373 error = ALCATEL_BuildWriteBuffer(buffer + 10, type, field, data);
1371 if (error != ERR_NONE) return error; 1374 if (error != ERR_NONE) return error;
1372 1375
1373 error = GSM_WaitFor (s, buffer, 12 + buffer[10], 0x02, ALCATEL_TIMEOUT, ID_AlcatelUpdateField); 1376 error = GSM_WaitFor (s, buffer, 12 + buffer[10], 0x02, ALCATEL_TIMEOUT, ID_AlcatelUpdateField);
1374 if (error != ERR_NONE) return error; 1377 if (error != ERR_NONE) return error;
1375 1378
1376 return ERR_NONE; 1379 return ERR_NONE;
1377} 1380}
1378 1381
1379static GSM_Error ALCATEL_GetManufacturer(GSM_StateMachine *s) 1382static GSM_Error ALCATEL_GetManufacturer(GSM_StateMachine *s)
@@ -1742,9 +1745,9 @@ static GSM_Error ALCATEL_GetNextMemory(GSM_StateMachine *s, GSM_MemoryEntry *ent
1742 if (entry->MemoryType == MEM_ME) { 1745 if (entry->MemoryType == MEM_ME) {
1743 if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeContacts, 0))!= ERR_NONE) return error; 1746 if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeContacts, 0))!= ERR_NONE) return error;
1744 if ((error = ALCATEL_GetAvailableIds(s, false))!= ERR_NONE) return error; 1747 if ((error = ALCATEL_GetAvailableIds(s, false))!= ERR_NONE) return error;
1745 if (Priv->ContactsItemsCount == 0) return ERR_EMPTY; 1748 if (Priv->ContactsItemsCount == 0) return ERR_EMPTY;
1746 1749
1747 if (start) entry->Location = 0; 1750 if (start) entry->Location = 0;
1748 if ((error = ALCATEL_GetNextId(s, &(entry->Location))) != ERR_NONE) return error; 1751 if ((error = ALCATEL_GetNextId(s, &(entry->Location))) != ERR_NONE) return error;
1749 1752
1750 return ALCATEL_GetMemory(s, entry); 1753 return ALCATEL_GetMemory(s, entry);
@@ -1767,18 +1770,18 @@ static GSM_Error ALCATEL_AddMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
1767 if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeContacts, 0))!= ERR_NONE) return error; 1770 if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeContacts, 0))!= ERR_NONE) return error;
1768 if ((error = ALCATEL_GoToBinaryState(s, StateEdit, TypeContacts, 0))!= ERR_NONE) return error; 1771 if ((error = ALCATEL_GoToBinaryState(s, StateEdit, TypeContacts, 0))!= ERR_NONE) return error;
1769 for (i = 0; i < entry->EntriesNum; i++) { 1772 for (i = 0; i < entry->EntriesNum; i++) {
1770 switch (entry->Entries[i].EntryType) { 1773 switch (entry->Entries[i].EntryType) {
1771 case PBK_Number_General: 1774 case PBK_Number_General:
1772 if ((error = ALCATEL_CreateField(s, Alcatel_phone, 8, entry->Entries[i].Text)) != ERR_NONE) return error; 1775 if ((error = ALCATEL_CreateField(s, Alcatel_phone, 8, entry->Entries[i].Text)) != ERR_NONE) return error;
1773 break; 1776 break;
1774 case PBK_Number_Mobile: 1777 case PBK_Number_Mobile:
1775 if ((error = ALCATEL_CreateField(s, Alcatel_phone, 12, entry->Entries[i].Text)) != ERR_NONE) return error; 1778 if ((error = ALCATEL_CreateField(s, Alcatel_phone, 12, entry->Entries[i].Text)) != ERR_NONE) return error;
1776 break; 1779 break;
1777 case PBK_Number_Work: 1780 case PBK_Number_Work:
1778 if ((error = ALCATEL_CreateField(s, Alcatel_phone, 7, entry->Entries[i].Text)) != ERR_NONE) return error; 1781 if ((error = ALCATEL_CreateField(s, Alcatel_phone, 7, entry->Entries[i].Text)) != ERR_NONE) return error;
1779 break; 1782 break;
1780 case PBK_Number_Fax: 1783 case PBK_Number_Fax:
1781 if ((error = ALCATEL_CreateField(s, Alcatel_phone, 9, entry->Entries[i].Text)) != ERR_NONE) return error; 1784 if ((error = ALCATEL_CreateField(s, Alcatel_phone, 9, entry->Entries[i].Text)) != ERR_NONE) return error;
1782 break; 1785 break;
1783 case PBK_Number_Home: 1786 case PBK_Number_Home:
1784 if ((error = ALCATEL_CreateField(s, Alcatel_phone, 13, entry->Entries[i].Text)) != ERR_NONE) return error; 1787 if ((error = ALCATEL_CreateField(s, Alcatel_phone, 13, entry->Entries[i].Text)) != ERR_NONE) return error;
@@ -1808,15 +1811,15 @@ static GSM_Error ALCATEL_AddMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
1808 break; 1811 break;
1809 case PBK_Text_Company: 1812 case PBK_Text_Company:
1810 if ((error = ALCATEL_CreateField(s, Alcatel_string, 2, entry->Entries[i].Text)) != ERR_NONE) return error; 1813 if ((error = ALCATEL_CreateField(s, Alcatel_string, 2, entry->Entries[i].Text)) != ERR_NONE) return error;
1811 break; 1814 break;
1812 case PBK_Text_JobTitle: 1815 case PBK_Text_JobTitle:
1813 if ((error = ALCATEL_CreateField(s, Alcatel_string, 3, entry->Entries[i].Text)) != ERR_NONE) return error; 1816 if ((error = ALCATEL_CreateField(s, Alcatel_string, 3, entry->Entries[i].Text)) != ERR_NONE) return error;
1814 break; 1817 break;
1815 case PBK_Category: 1818 case PBK_Category:
1816 if ((error = ALCATEL_CreateField(s, Alcatel_byte, 5, &(entry->Entries[i].Number))) != ERR_NONE) return error; 1819 if ((error = ALCATEL_CreateField(s, Alcatel_byte, 5, &(entry->Entries[i].Number))) != ERR_NONE) return error;
1817 break; 1820 break;
1818 case PBK_Private: 1821 case PBK_Private:
1819 if ((error = ALCATEL_CreateField(s, Alcatel_bool, 6, &(entry->Entries[i].Number))) != ERR_NONE) return error; 1822 if ((error = ALCATEL_CreateField(s, Alcatel_bool, 6, &(entry->Entries[i].Number))) != ERR_NONE) return error;
1820 break; 1823 break;
1821 case PBK_Text_StreetAddress: 1824 case PBK_Text_StreetAddress:
1822 if ((error = ALCATEL_CreateField(s, Alcatel_string, 16, entry->Entries[i].Text)) != ERR_NONE) return error; 1825 if ((error = ALCATEL_CreateField(s, Alcatel_string, 16, entry->Entries[i].Text)) != ERR_NONE) return error;
@@ -1839,14 +1842,14 @@ static GSM_Error ALCATEL_AddMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
1839 case PBK_Text_Custom2: 1842 case PBK_Text_Custom2:
1840 if ((error = ALCATEL_CreateField(s, Alcatel_string, 22, entry->Entries[i].Text)) != ERR_NONE) return error; 1843 if ((error = ALCATEL_CreateField(s, Alcatel_string, 22, entry->Entries[i].Text)) != ERR_NONE) return error;
1841 break; 1844 break;
1842 case PBK_Text_Custom3: 1845 case PBK_Text_Custom3:
1843 if ((error = ALCATEL_CreateField(s, Alcatel_string, 23, entry->Entries[i].Text)) != ERR_NONE) return error; 1846 if ((error = ALCATEL_CreateField(s, Alcatel_string, 23, entry->Entries[i].Text)) != ERR_NONE) return error;
1844 break; 1847 break;
1845 case PBK_Text_Custom4: 1848 case PBK_Text_Custom4:
1846 if ((error = ALCATEL_CreateField(s, Alcatel_string, 24, entry->Entries[i].Text)) != ERR_NONE) return error; 1849 if ((error = ALCATEL_CreateField(s, Alcatel_string, 24, entry->Entries[i].Text)) != ERR_NONE) return error;
1847 break; 1850 break;
1848 case PBK_PictureID: 1851 case PBK_PictureID:
1849 if (s->Phone.Data.Priv.ALCATEL.ProtocolVersion == V_1_1) { 1852 if (s->Phone.Data.Priv.ALCATEL.ProtocolVersion == V_1_1) {
1850 if ((error = ALCATEL_CreateField(s, Alcatel_int, 25, &(entry->Entries[i].Number))) != ERR_NONE) return error; 1853 if ((error = ALCATEL_CreateField(s, Alcatel_int, 25, &(entry->Entries[i].Number))) != ERR_NONE) return error;
1851 } else { 1854 } else {
1852 smprintf(s,"WARNING: Ignoring entry %d, not supported by phone\n", entry->Entries[i].EntryType); 1855 smprintf(s,"WARNING: Ignoring entry %d, not supported by phone\n", entry->Entries[i].EntryType);
@@ -1905,93 +1908,93 @@ static GSM_Error ALCATEL_SetMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
1905 return ALCATEL_AddMemory(s, entry); 1908 return ALCATEL_AddMemory(s, entry);
1906 } 1909 }
1907 /* Get fields for current item */ 1910 /* Get fields for current item */
1908 if ((error = ALCATEL_GetFields(s, entry->Location))!= ERR_NONE) return error; 1911 if ((error = ALCATEL_GetFields(s, entry->Location))!= ERR_NONE) return error;
1909 1912
1910 for (i = 0; i < 26; i++) { UpdatedFields[i] = false; } 1913 for (i = 0; i < 26; i++) { UpdatedFields[i] = false; }
1911 1914
1912 if ((error = ALCATEL_GoToBinaryState(s, StateEdit, TypeContacts, entry->Location))!= ERR_NONE) return error; 1915 if ((error = ALCATEL_GoToBinaryState(s, StateEdit, TypeContacts, entry->Location))!= ERR_NONE) return error;
1913 for (i = 0; i < entry->EntriesNum; i++) { 1916 for (i = 0; i < entry->EntriesNum; i++) {
1914 switch (entry->Entries[i].EntryType) { 1917 switch (entry->Entries[i].EntryType) {
1915 case PBK_Number_General: 1918 case PBK_Number_General:
1916 UpdatedFields[8] = true; 1919 UpdatedFields[8] = true;
1917 if ((error = ALCATEL_UpdateField(s, Alcatel_phone, entry->Location, 8, entry->Entries[i].Text)) != ERR_NONE) return error; 1920 if ((error = ALCATEL_UpdateField(s, Alcatel_phone, entry->Location, 8, entry->Entries[i].Text)) != ERR_NONE) return error;
1918 break; 1921 break;
1919 case PBK_Number_Mobile: 1922 case PBK_Number_Mobile:
1920 UpdatedFields[12] = true; 1923 UpdatedFields[12] = true;
1921 if ((error = ALCATEL_UpdateField(s, Alcatel_phone, entry->Location, 12, entry->Entries[i].Text)) != ERR_NONE) return error; 1924 if ((error = ALCATEL_UpdateField(s, Alcatel_phone, entry->Location, 12, entry->Entries[i].Text)) != ERR_NONE) return error;
1922 break; 1925 break;
1923 case PBK_Number_Work: 1926 case PBK_Number_Work:
1924 UpdatedFields[7] = true; 1927 UpdatedFields[7] = true;
1925 if ((error = ALCATEL_UpdateField(s, Alcatel_phone, entry->Location, 7, entry->Entries[i].Text)) != ERR_NONE) return error; 1928 if ((error = ALCATEL_UpdateField(s, Alcatel_phone, entry->Location, 7, entry->Entries[i].Text)) != ERR_NONE) return error;
1926 break; 1929 break;
1927 case PBK_Number_Fax: 1930 case PBK_Number_Fax:
1928 UpdatedFields[9] = true; 1931 UpdatedFields[9] = true;
1929 if ((error = ALCATEL_UpdateField(s, Alcatel_phone, entry->Location, 9, entry->Entries[i].Text)) != ERR_NONE) return error; 1932 if ((error = ALCATEL_UpdateField(s, Alcatel_phone, entry->Location, 9, entry->Entries[i].Text)) != ERR_NONE) return error;
1930 break; 1933 break;
1931 case PBK_Number_Home: 1934 case PBK_Number_Home:
1932 UpdatedFields[13] = true; 1935 UpdatedFields[13] = true;
1933 if ((error = ALCATEL_UpdateField(s, Alcatel_phone, entry->Location, 13, entry->Entries[i].Text)) != ERR_NONE) return error; 1936 if ((error = ALCATEL_UpdateField(s, Alcatel_phone, entry->Location, 13, entry->Entries[i].Text)) != ERR_NONE) return error;
1934 break; 1937 break;
1935 case PBK_Number_Pager: 1938 case PBK_Number_Pager:
1936 UpdatedFields[11] = true; 1939 UpdatedFields[11] = true;
1937 if ((error = ALCATEL_UpdateField(s, Alcatel_phone, entry->Location, 11, entry->Entries[i].Text)) != ERR_NONE) return error; 1940 if ((error = ALCATEL_UpdateField(s, Alcatel_phone, entry->Location, 11, entry->Entries[i].Text)) != ERR_NONE) return error;
1938 break; 1941 break;
1939 case PBK_Number_Other: 1942 case PBK_Number_Other:
1940 UpdatedFields[10] = true; 1943 UpdatedFields[10] = true;
1941 if ((error = ALCATEL_UpdateField(s, Alcatel_phone, entry->Location, 10, entry->Entries[i].Text)) != ERR_NONE) return error; 1944 if ((error = ALCATEL_UpdateField(s, Alcatel_phone, entry->Location, 10, entry->Entries[i].Text)) != ERR_NONE) return error;
1942 break; 1945 break;
1943 case PBK_Text_Note: 1946 case PBK_Text_Note:
1944 UpdatedFields[4] = true; 1947 UpdatedFields[4] = true;
1945 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 4, entry->Entries[i].Text)) != ERR_NONE) return error; 1948 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 4, entry->Entries[i].Text)) != ERR_NONE) return error;
1946 break; 1949 break;
1947 case PBK_Text_Email: 1950 case PBK_Text_Email:
1948 UpdatedFields[14] = true; 1951 UpdatedFields[14] = true;
1949 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 14, entry->Entries[i].Text)) != ERR_NONE) return error; 1952 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 14, entry->Entries[i].Text)) != ERR_NONE) return error;
1950 break; 1953 break;
1951 case PBK_Text_Email2: 1954 case PBK_Text_Email2:
1952 UpdatedFields[15] = true; 1955 UpdatedFields[15] = true;
1953 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 15, entry->Entries[i].Text)) != ERR_NONE) return error; 1956 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 15, entry->Entries[i].Text)) != ERR_NONE) return error;
1954 break; 1957 break;
1955 case PBK_Text_LastName: 1958 case PBK_Text_LastName:
1956 UpdatedFields[0] = true; 1959 UpdatedFields[0] = true;
1957 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 0, entry->Entries[i].Text)) != ERR_NONE) return error; NameSet = true; 1960 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 0, entry->Entries[i].Text)) != ERR_NONE) return error; NameSet = true;
1958 break; 1961 break;
1959 case PBK_Text_FirstName: 1962 case PBK_Text_FirstName:
1960 UpdatedFields[1] = true; 1963 UpdatedFields[1] = true;
1961 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 1, entry->Entries[i].Text)) != ERR_NONE) return error; NameSet = true; 1964 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 1, entry->Entries[i].Text)) != ERR_NONE) return error; NameSet = true;
1962 break; 1965 break;
1963 case PBK_Text_Company: 1966 case PBK_Text_Company:
1964 UpdatedFields[2] = true; 1967 UpdatedFields[2] = true;
1965 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 2, entry->Entries[i].Text)) != ERR_NONE) return error; 1968 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 2, entry->Entries[i].Text)) != ERR_NONE) return error;
1966 break; 1969 break;
1967 case PBK_Text_JobTitle: 1970 case PBK_Text_JobTitle:
1968 UpdatedFields[3] = true; 1971 UpdatedFields[3] = true;
1969 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 3, entry->Entries[i].Text)) != ERR_NONE) return error; 1972 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 3, entry->Entries[i].Text)) != ERR_NONE) return error;
1970 break; 1973 break;
1971 case PBK_Category: 1974 case PBK_Category:
1972 UpdatedFields[5] = true; 1975 UpdatedFields[5] = true;
1973 if ((error = ALCATEL_UpdateField(s, Alcatel_byte, entry->Location, 5, &(entry->Entries[i].Number))) != ERR_NONE) return error; 1976 if ((error = ALCATEL_UpdateField(s, Alcatel_byte, entry->Location, 5, &(entry->Entries[i].Number))) != ERR_NONE) return error;
1974 break; 1977 break;
1975 case PBK_Private: 1978 case PBK_Private:
1976 UpdatedFields[6] = true; 1979 UpdatedFields[6] = true;
1977 if ((error = ALCATEL_UpdateField(s, Alcatel_bool, entry->Location, 6, &(entry->Entries[i].Number))) != ERR_NONE) return error; 1980 if ((error = ALCATEL_UpdateField(s, Alcatel_bool, entry->Location, 6, &(entry->Entries[i].Number))) != ERR_NONE) return error;
1978 break; 1981 break;
1979 case PBK_Text_StreetAddress: 1982 case PBK_Text_StreetAddress:
1980 UpdatedFields[16] = true; 1983 UpdatedFields[16] = true;
1981 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 16, entry->Entries[i].Text)) != ERR_NONE) return error; 1984 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 16, entry->Entries[i].Text)) != ERR_NONE) return error;
1982 break; 1985 break;
1983 case PBK_Text_City: 1986 case PBK_Text_City:
1984 UpdatedFields[17] = true; 1987 UpdatedFields[17] = true;
1985 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 17, entry->Entries[i].Text)) != ERR_NONE) return error; 1988 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 17, entry->Entries[i].Text)) != ERR_NONE) return error;
1986 break; 1989 break;
1987 case PBK_Text_State: 1990 case PBK_Text_State:
1988 UpdatedFields[18] = true; 1991 UpdatedFields[18] = true;
1989 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 18, entry->Entries[i].Text)) != ERR_NONE) return error; 1992 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 18, entry->Entries[i].Text)) != ERR_NONE) return error;
1990 break; 1993 break;
1991 case PBK_Text_Zip: 1994 case PBK_Text_Zip:
1992 UpdatedFields[19] = true; 1995 UpdatedFields[19] = true;
1993 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 19, entry->Entries[i].Text)) != ERR_NONE) return error; 1996 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 19, entry->Entries[i].Text)) != ERR_NONE) return error;
1994 break; 1997 break;
1995 case PBK_Text_Country: 1998 case PBK_Text_Country:
1996 UpdatedFields[20] = true; 1999 UpdatedFields[20] = true;
1997 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 20, entry->Entries[i].Text)) != ERR_NONE) return error; 2000 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 20, entry->Entries[i].Text)) != ERR_NONE) return error;
@@ -1999,21 +2002,21 @@ static GSM_Error ALCATEL_SetMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
1999 case PBK_Text_Custom1: 2002 case PBK_Text_Custom1:
2000 UpdatedFields[21] = true; 2003 UpdatedFields[21] = true;
2001 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 21, entry->Entries[i].Text)) != ERR_NONE) return error; 2004 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 21, entry->Entries[i].Text)) != ERR_NONE) return error;
2002 break; 2005 break;
2003 case PBK_Text_Custom2: 2006 case PBK_Text_Custom2:
2004 UpdatedFields[22] = true; 2007 UpdatedFields[22] = true;
2005 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 22, entry->Entries[i].Text)) != ERR_NONE) return error; 2008 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 22, entry->Entries[i].Text)) != ERR_NONE) return error;
2006 break; 2009 break;
2007 case PBK_Text_Custom3: 2010 case PBK_Text_Custom3:
2008 UpdatedFields[23] = true; 2011 UpdatedFields[23] = true;
2009 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 23, entry->Entries[i].Text)) != ERR_NONE) return error; 2012 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 23, entry->Entries[i].Text)) != ERR_NONE) return error;
2010 break; 2013 break;
2011 case PBK_Text_Custom4: 2014 case PBK_Text_Custom4:
2012 UpdatedFields[24] = true; 2015 UpdatedFields[24] = true;
2013 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 24, entry->Entries[i].Text)) != ERR_NONE) return error 2016 if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 24, entry->Entries[i].Text)) != ERR_NONE) return error
2014 ; break; 2017 ; break;
2015 case PBK_PictureID: 2018 case PBK_PictureID:
2016 if (s->Phone.Data.Priv.ALCATEL.ProtocolVersion == V_1_1) { 2019 if (s->Phone.Data.Priv.ALCATEL.ProtocolVersion == V_1_1) {
2017 UpdatedFields[25] = true; 2020 UpdatedFields[25] = true;
2018 if ((error = ALCATEL_UpdateField(s, Alcatel_int, entry->Location, 25, &(entry->Entries[i].Number))) != ERR_NONE) return error; 2021 if ((error = ALCATEL_UpdateField(s, Alcatel_int, entry->Location, 25, &(entry->Entries[i].Number))) != ERR_NONE) return error;
2019 } else { 2022 } else {
@@ -2068,13 +2071,13 @@ static GSM_Error ALCATEL_DeleteMemory(GSM_StateMachine *s, GSM_MemoryEntry *entr
2068 } 2071 }
2069 /* Do real delete */ 2072 /* Do real delete */
2070 error = ALCATEL_DeleteItem(s, entry->Location); 2073 error = ALCATEL_DeleteItem(s, entry->Location);
2071 if (error != ERR_NONE) return error; 2074 if (error != ERR_NONE) return error;
2072 2075
2073 /* Refresh list */ 2076 /* Refresh list */
2074 if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeContacts, 0))!= ERR_NONE) return error; 2077 if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeContacts, 0))!= ERR_NONE) return error;
2075 if ((error = ALCATEL_GetAvailableIds(s, true))!= ERR_NONE) return error; 2078 if ((error = ALCATEL_GetAvailableIds(s, true))!= ERR_NONE) return error;
2076 2079
2077 return ERR_NONE; 2080 return ERR_NONE;
2078 } else { 2081 } else {
2079 if ((error = ALCATEL_SetATMode(s))!= ERR_NONE) return error; 2082 if ((error = ALCATEL_SetATMode(s))!= ERR_NONE) return error;
2080 return ATGEN_DeleteMemory(s, entry); 2083 return ATGEN_DeleteMemory(s, entry);
@@ -2227,9 +2230,9 @@ static GSM_Error ALCATEL_GetDisplayStatus(GSM_StateMachine *s, GSM_DisplayFeatur
2227 2230
2228 if ((error = ALCATEL_SetATMode(s))!= ERR_NONE) return error; 2231 if ((error = ALCATEL_SetATMode(s))!= ERR_NONE) return error;
2229 return ATGEN_GetDisplayStatus(s, features); 2232 return ATGEN_GetDisplayStatus(s, features);
2230} 2233}
2231 2234
2232static GSM_Error ALCATEL_SetAutoNetworkLogin(GSM_StateMachine *s) 2235static GSM_Error ALCATEL_SetAutoNetworkLogin(GSM_StateMachine *s)
2233{ 2236{
2234 GSM_Error error; 2237 GSM_Error error;
2235 2238
@@ -2336,11 +2339,11 @@ static GSM_Error ALCATEL_GetSIMIMSI(GSM_StateMachine *s, char *IMSI)
2336static GSM_Error ALCATEL_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus *status) 2339static GSM_Error ALCATEL_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus *status)
2337{ 2340{
2338 GSM_Error error; 2341 GSM_Error error;
2339 GSM_Phone_ALCATELData*Priv = &s->Phone.Data.Priv.ALCATEL; 2342 GSM_Phone_ALCATELData*Priv = &s->Phone.Data.Priv.ALCATEL;
2340 2343
2341 status->Used = 0; 2344 status->Used = 0;
2342 2345
2343 if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeCalendar, 0))!= ERR_NONE) return error; 2346 if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeCalendar, 0))!= ERR_NONE) return error;
2344 if ((error = ALCATEL_GetAvailableIds(s, true))!= ERR_NONE) return error; 2347 if ((error = ALCATEL_GetAvailableIds(s, true))!= ERR_NONE) return error;
2345 2348
2346 status->Used = Priv->CalendarItemsCount; 2349 status->Used = Priv->CalendarItemsCount;
@@ -2726,9 +2729,9 @@ static GSM_Error ALCATEL_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry
2726 2729
2727 if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeCalendar, 0))!= ERR_NONE) return error; 2730 if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeCalendar, 0))!= ERR_NONE) return error;
2728 if ((error = ALCATEL_GetAvailableIds(s, false))!= ERR_NONE) return error; 2731 if ((error = ALCATEL_GetAvailableIds(s, false))!= ERR_NONE) return error;
2729 if (Priv->CalendarItemsCount == 0) return ERR_EMPTY; 2732 if (Priv->CalendarItemsCount == 0) return ERR_EMPTY;
2730 2733
2731 if (start) Note->Location = 0; 2734 if (start) Note->Location = 0;
2732 if ((error = ALCATEL_GetNextId(s, &(Note->Location))) != ERR_NONE) return error; 2735 if ((error = ALCATEL_GetNextId(s, &(Note->Location))) != ERR_NONE) return error;
2733 2736
2734 return ALCATEL_GetCalendar(s, Note); 2737 return ALCATEL_GetCalendar(s, Note);
@@ -2767,9 +2770,9 @@ static GSM_Error ALCATEL_AddCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Not
2767 GSM_Phone_ALCATELData*Priv = &s->Phone.Data.Priv.ALCATEL; 2770 GSM_Phone_ALCATELData*Priv = &s->Phone.Data.Priv.ALCATEL;
2768 2771
2769 if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeCalendar, 0))!= ERR_NONE) return error; 2772 if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeCalendar, 0))!= ERR_NONE) return error;
2770 if ((error = ALCATEL_GoToBinaryState(s, StateEdit, TypeCalendar, 0))!= ERR_NONE) return error; 2773 if ((error = ALCATEL_GoToBinaryState(s, StateEdit, TypeCalendar, 0))!= ERR_NONE) return error;
2771 2774
2772 for (i = 0; i < Note->EntriesNum; i++) { 2775 for (i = 0; i < Note->EntriesNum; i++) {
2773 switch (Note->Entries[i].EntryType) { 2776 switch (Note->Entries[i].EntryType) {
2774 case CAL_START_DATETIME: 2777 case CAL_START_DATETIME:
2775 if (!date_set) { 2778 if (!date_set) {
@@ -2805,9 +2808,9 @@ static GSM_Error ALCATEL_AddCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Not
2805 break; 2808 break;
2806 case CAL_PHONE: 2809 case CAL_PHONE:
2807 if ((error = ALCATEL_CreateField(s, Alcatel_phone, 9, Note->Entries[i].Text)) != ERR_NONE) return error; 2810 if ((error = ALCATEL_CreateField(s, Alcatel_phone, 9, Note->Entries[i].Text)) != ERR_NONE) return error;
2808 phone_set = true; 2811 phone_set = true;
2809 break; 2812 break;
2810 case CAL_REPEAT_DAYOFWEEK: 2813 case CAL_REPEAT_DAYOFWEEK:
2811 if ((error = ALCATEL_CreateField(s, Alcatel_byte, 10, &(Note->Entries[i].Number))) != ERR_NONE) return error; 2814 if ((error = ALCATEL_CreateField(s, Alcatel_byte, 10, &(Note->Entries[i].Number))) != ERR_NONE) return error;
2812 repeating = true; 2815 repeating = true;
2813 break; 2816 break;
@@ -2841,9 +2844,9 @@ static GSM_Error ALCATEL_AddCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Not
2841 smprintf(s,"WARNING: Ignoring entry %d, not supported by phone\n", Note->Entries[i].EntryType); 2844 smprintf(s,"WARNING: Ignoring entry %d, not supported by phone\n", Note->Entries[i].EntryType);
2842 break; 2845 break;
2843 } 2846 }
2844 } 2847 }
2845 2848
2846 switch (Note->Type) { 2849 switch (Note->Type) {
2847 case GSM_CAL_CALL: 2850 case GSM_CAL_CALL:
2848 val = 3; 2851 val = 3;
2849 break; 2852 break;
@@ -2899,18 +2902,18 @@ static GSM_Error ALCATEL_SetCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Not
2899 return ALCATEL_AddCalendar(s, Note); 2902 return ALCATEL_AddCalendar(s, Note);
2900 } 2903 }
2901 /* Get fields for current item */ 2904 /* Get fields for current item */
2902 if ((error = ALCATEL_GetFields(s, Note->Location))!= ERR_NONE) return error; 2905 if ((error = ALCATEL_GetFields(s, Note->Location))!= ERR_NONE) return error;
2903 2906
2904 for (i = 0; i < 22; i++) { UpdatedFields[i] = false; } 2907 for (i = 0; i < 22; i++) { UpdatedFields[i] = false; }
2905 2908
2906 if ((error = ALCATEL_GoToBinaryState(s, StateEdit, TypeCalendar, Note->Location))!= ERR_NONE) return error; 2909 if ((error = ALCATEL_GoToBinaryState(s, StateEdit, TypeCalendar, Note->Location))!= ERR_NONE) return error;
2907 2910
2908 for (i = 0; i < Note->EntriesNum; i++) { 2911 for (i = 0; i < Note->EntriesNum; i++) {
2909 switch (Note->Entries[i].EntryType) { 2912 switch (Note->Entries[i].EntryType) {
2910 case CAL_START_DATETIME: 2913 case CAL_START_DATETIME:
2911 if (!date_set) { 2914 if (!date_set) {
2912 UpdatedFields[0] = true; 2915 UpdatedFields[0] = true;
2913 if ((error = ALCATEL_UpdateField(s, Alcatel_date, Note->Location, 0, &(Note->Entries[i].Date))) != ERR_NONE) return error; 2916 if ((error = ALCATEL_UpdateField(s, Alcatel_date, Note->Location, 0, &(Note->Entries[i].Date))) != ERR_NONE) return error;
2914 date_set = true; 2917 date_set = true;
2915 } 2918 }
2916 UpdatedFields[1] = true; 2919 UpdatedFields[1] = true;
@@ -2952,9 +2955,9 @@ static GSM_Error ALCATEL_SetCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Not
2952 case CAL_PHONE: 2955 case CAL_PHONE:
2953 UpdatedFields[9] = true; 2956 UpdatedFields[9] = true;
2954 if ((error = ALCATEL_UpdateField(s, Alcatel_phone, Note->Location, 9, Note->Entries[i].Text)) != ERR_NONE) return error; 2957 if ((error = ALCATEL_UpdateField(s, Alcatel_phone, Note->Location, 9, Note->Entries[i].Text)) != ERR_NONE) return error;
2955 phone_set = true; 2958 phone_set = true;
2956 break; 2959 break;
2957 case CAL_REPEAT_DAYOFWEEK: 2960 case CAL_REPEAT_DAYOFWEEK:
2958 UpdatedFields[10] = true; 2961 UpdatedFields[10] = true;
2959 if ((error = ALCATEL_UpdateField(s, Alcatel_byte, Note->Location, 10, &(Note->Entries[i].Number))) != ERR_NONE) return error; 2962 if ((error = ALCATEL_UpdateField(s, Alcatel_byte, Note->Location, 10, &(Note->Entries[i].Number))) != ERR_NONE) return error;
2960 repeating = true; 2963 repeating = true;
@@ -2995,9 +2998,9 @@ static GSM_Error ALCATEL_SetCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Not
2995 smprintf(s,"WARNING: Ignoring entry %d, not supported by phone\n", Note->Entries[i].EntryType); 2998 smprintf(s,"WARNING: Ignoring entry %d, not supported by phone\n", Note->Entries[i].EntryType);
2996 break; 2999 break;
2997 } 3000 }
2998 } 3001 }
2999 3002
3000 switch (Note->Type) { 3003 switch (Note->Type) {
3001 case GSM_CAL_CALL: 3004 case GSM_CAL_CALL:
3002 val = 3; 3005 val = 3;
3003 break; 3006 break;
@@ -3071,9 +3074,9 @@ static GSM_Error ALCATEL_GetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm)
3071 static GSM_DateTimenulldt = {0,0,0,0,0,0,0}; 3074 static GSM_DateTimenulldt = {0,0,0,0,0,0,0};
3072 3075
3073 if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeCalendar, 0))!= ERR_NONE) return error; 3076 if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeCalendar, 0))!= ERR_NONE) return error;
3074 if ((error = ALCATEL_GetAvailableIds(s, false))!= ERR_NONE) return error; 3077 if ((error = ALCATEL_GetAvailableIds(s, false))!= ERR_NONE) return error;
3075 3078
3076 for (i=0; i<Priv->CalendarItemsCount; i++) { 3079 for (i=0; i<Priv->CalendarItemsCount; i++) {
3077 if ((error = ALCATEL_GetFieldValue(s, Priv->CalendarItems[i], 7))!= ERR_NONE) return error; 3080 if ((error = ALCATEL_GetFieldValue(s, Priv->CalendarItems[i], 7))!= ERR_NONE) return error;
3078 if (Priv->ReturnType != Alcatel_enum) { 3081 if (Priv->ReturnType != Alcatel_enum) {
3079 smprintf(s,"WARNING: Received unexpected type %02X, ignoring\n", Priv->ReturnType); 3082 smprintf(s,"WARNING: Received unexpected type %02X, ignoring\n", Priv->ReturnType);
@@ -3090,17 +3093,17 @@ static GSM_Error ALCATEL_GetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm)
3090 3093
3091 if (!Found) return ERR_EMPTY; 3094 if (!Found) return ERR_EMPTY;
3092 3095
3093 Note.Location = Priv->CalendarItems[i]; 3096 Note.Location = Priv->CalendarItems[i];
3094 3097
3095 if ((error = ALCATEL_GetCalendar(s, &Note))!= ERR_NONE) return error; 3098 if ((error = ALCATEL_GetCalendar(s, &Note))!= ERR_NONE) return error;
3096 3099
3097 if (Note.Type == GSM_CAL_ALARM) { 3100 if (Note.Type == GSM_CAL_ALARM) {
3098 alarm->Repeating = false; 3101 alarm->Repeating = false;
3099 } else { 3102 } else {
3100 alarm->Repeating = true; 3103 alarm->Repeating = true;
3101 } 3104 }
3102 3105
3103 alarm->Text[0] = 0; alarm->Text[1] = 0; 3106 alarm->Text[0] = 0; alarm->Text[1] = 0;
3104 3107
3105 3108
3106 for (i = 0; i < Note.EntriesNum; i++) { 3109 for (i = 0; i < Note.EntriesNum; i++) {
@@ -3145,9 +3148,9 @@ static GSM_Error ALCATEL_SetAlarm (GSM_StateMachine *s, GSM_Alarm *alarm)
3145 break; 3148 break;
3146 } 3149 }
3147 } 3150 }
3148 } 3151 }
3149 3152
3150 if (Found) { 3153 if (Found) {
3151 Note.Location = Priv->CalendarItems[i]; 3154 Note.Location = Priv->CalendarItems[i];
3152 } 3155 }
3153 3156
@@ -3183,11 +3186,11 @@ static GSM_Error ALCATEL_SetAlarm (GSM_StateMachine *s, GSM_Alarm *alarm)
3183static GSM_Error ALCATEL_GetToDoStatus(GSM_StateMachine *s, GSM_ToDoStatus *status) 3186static GSM_Error ALCATEL_GetToDoStatus(GSM_StateMachine *s, GSM_ToDoStatus *status)
3184{ 3187{
3185 GSM_Error error; 3188 GSM_Error error;
3186 GSM_Phone_ALCATELData*Priv = &s->Phone.Data.Priv.ALCATEL; 3189 GSM_Phone_ALCATELData*Priv = &s->Phone.Data.Priv.ALCATEL;
3187 3190
3188 status->Used = 0; 3191 status->Used = 0;
3189 3192
3190 if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeToDo, 0))!= ERR_NONE) return error; 3193 if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeToDo, 0))!= ERR_NONE) return error;
3191 if ((error = ALCATEL_GetAvailableIds(s, true))!= ERR_NONE) return error; 3194 if ((error = ALCATEL_GetAvailableIds(s, true))!= ERR_NONE) return error;
3192 3195
3193 status->Used = Priv->ToDoItemsCount; 3196 status->Used = Priv->ToDoItemsCount;
@@ -3450,9 +3453,9 @@ static GSM_Error ALCATEL_GetNextToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, b
3450 3453
3451 if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeToDo, 0))!= ERR_NONE) return error; 3454 if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeToDo, 0))!= ERR_NONE) return error;
3452 if ((error = ALCATEL_GetAvailableIds(s, false))!= ERR_NONE) return error; 3455 if ((error = ALCATEL_GetAvailableIds(s, false))!= ERR_NONE) return error;
3453 if (Priv->ToDoItemsCount == 0) return ERR_EMPTY; 3456 if (Priv->ToDoItemsCount == 0) return ERR_EMPTY;
3454 3457
3455 if (start) ToDo->Location = 0; 3458 if (start) ToDo->Location = 0;
3456 if ((error = ALCATEL_GetNextId(s, &(ToDo->Location))) != ERR_NONE) return error; 3459 if ((error = ALCATEL_GetNextId(s, &(ToDo->Location))) != ERR_NONE) return error;
3457 3460
3458 return ALCATEL_GetToDo(s, ToDo); 3461 return ALCATEL_GetToDo(s, ToDo);
@@ -3489,9 +3492,9 @@ static GSM_Error ALCATEL_AddToDo (GSM_StateMachine *s, GSM_ToDoEntry *ToDo)
3489 GSM_Phone_ALCATELData*Priv = &s->Phone.Data.Priv.ALCATEL; 3492 GSM_Phone_ALCATELData*Priv = &s->Phone.Data.Priv.ALCATEL;
3490 3493
3491 if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeToDo, 0))!= ERR_NONE) return error; 3494 if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeToDo, 0))!= ERR_NONE) return error;
3492 if ((error = ALCATEL_GoToBinaryState(s, StateEdit, TypeToDo, 0))!= ERR_NONE) return error; 3495 if ((error = ALCATEL_GoToBinaryState(s, StateEdit, TypeToDo, 0))!= ERR_NONE) return error;
3493 3496
3494 switch (ToDo->Priority) { 3497 switch (ToDo->Priority) {
3495 case GSM_Priority_High: 3498 case GSM_Priority_High:
3496 val = 0; 3499 val = 0;
3497 break; 3500 break;
@@ -3517,9 +3520,9 @@ static GSM_Error ALCATEL_AddToDo (GSM_StateMachine *s, GSM_ToDoEntry *ToDo)
3517 break; 3520 break;
3518 case TODO_COMPLETED: 3521 case TODO_COMPLETED:
3519 if ((error = ALCATEL_CreateField(s, Alcatel_bool, 1, &(ToDo->Entries[i].Number))) != ERR_NONE) return error; 3522 if ((error = ALCATEL_CreateField(s, Alcatel_bool, 1, &(ToDo->Entries[i].Number))) != ERR_NONE) return error;
3520 break; 3523 break;
3521 case TODO_ALARM_DATETIME: 3524 case TODO_ALARM_DATETIME:
3522 if ((error = ALCATEL_CreateField(s, Alcatel_date, 2, &(ToDo->Entries[i].Date))) != ERR_NONE) return error; 3525 if ((error = ALCATEL_CreateField(s, Alcatel_date, 2, &(ToDo->Entries[i].Date))) != ERR_NONE) return error;
3523 if ((error = ALCATEL_CreateField(s, Alcatel_time, 3, &(ToDo->Entries[i].Date))) != ERR_NONE) return error; 3526 if ((error = ALCATEL_CreateField(s, Alcatel_time, 3, &(ToDo->Entries[i].Date))) != ERR_NONE) return error;
3524 if ((error = ALCATEL_CreateField(s, Alcatel_date, 10, &(ToDo->Entries[i].Date))) != ERR_NONE) return error; 3527 if ((error = ALCATEL_CreateField(s, Alcatel_date, 10, &(ToDo->Entries[i].Date))) != ERR_NONE) return error;
3525 if ((error = ALCATEL_CreateField(s, Alcatel_time, 11, &(ToDo->Entries[i].Date))) != ERR_NONE) return error; 3528 if ((error = ALCATEL_CreateField(s, Alcatel_time, 11, &(ToDo->Entries[i].Date))) != ERR_NONE) return error;
@@ -3578,11 +3581,11 @@ static GSM_Error ALCATEL_SetToDo (GSM_StateMachine *s, GSM_ToDoEntry *ToDo)
3578 return ALCATEL_AddToDo(s, ToDo); 3581 return ALCATEL_AddToDo(s, ToDo);
3579 } 3582 }
3580 /* Get fields for current item */ 3583 /* Get fields for current item */
3581 if ((error = ALCATEL_GetFields(s, ToDo->Location))!= ERR_NONE) return error; 3584 if ((error = ALCATEL_GetFields(s, ToDo->Location))!= ERR_NONE) return error;
3582 3585
3583 for (i = 0; i < 12; i++) { UpdatedFields[i] = false; } 3586 for (i = 0; i < 12; i++) { UpdatedFields[i] = false; }
3584 3587
3585 if ((error = ALCATEL_GoToBinaryState(s, StateEdit, TypeToDo, ToDo->Location))!= ERR_NONE) return error; 3588 if ((error = ALCATEL_GoToBinaryState(s, StateEdit, TypeToDo, ToDo->Location))!= ERR_NONE) return error;
3586 3589
3587 switch (ToDo->Priority) { 3590 switch (ToDo->Priority) {
3588 case GSM_Priority_High: 3591 case GSM_Priority_High:
@@ -3607,44 +3610,44 @@ static GSM_Error ALCATEL_SetToDo (GSM_StateMachine *s, GSM_ToDoEntry *ToDo)
3607 for (i = 0; i < ToDo->EntriesNum; i++) { 3610 for (i = 0; i < ToDo->EntriesNum; i++) {
3608 switch (ToDo->Entries[i].EntryType) { 3611 switch (ToDo->Entries[i].EntryType) {
3609 case TODO_END_DATETIME: 3612 case TODO_END_DATETIME:
3610 if ((error = ALCATEL_UpdateField(s, Alcatel_date, ToDo->Location, 0, &(ToDo->Entries[i].Date))) != ERR_NONE) return error; 3613 if ((error = ALCATEL_UpdateField(s, Alcatel_date, ToDo->Location, 0, &(ToDo->Entries[i].Date))) != ERR_NONE) return error;
3611 UpdatedFields[0] = true; 3614 UpdatedFields[0] = true;
3612 break; 3615 break;
3613 case TODO_COMPLETED: 3616 case TODO_COMPLETED:
3614 if ((error = ALCATEL_UpdateField(s, Alcatel_bool, ToDo->Location, 1, &(ToDo->Entries[i].Number))) != ERR_NONE) return error; 3617 if ((error = ALCATEL_UpdateField(s, Alcatel_bool, ToDo->Location, 1, &(ToDo->Entries[i].Number))) != ERR_NONE) return error;
3615 UpdatedFields[1] = true; 3618 UpdatedFields[1] = true;
3616 break; 3619 break;
3617 case TODO_ALARM_DATETIME: 3620 case TODO_ALARM_DATETIME:
3618 if ((error = ALCATEL_UpdateField(s, Alcatel_date, ToDo->Location, 2, &(ToDo->Entries[i].Date))) != ERR_NONE) return error; 3621 if ((error = ALCATEL_UpdateField(s, Alcatel_date, ToDo->Location, 2, &(ToDo->Entries[i].Date))) != ERR_NONE) return error;
3619 UpdatedFields[2] = true; 3622 UpdatedFields[2] = true;
3620 if ((error = ALCATEL_UpdateField(s, Alcatel_time, ToDo->Location, 3, &(ToDo->Entries[i].Date))) != ERR_NONE) return error; 3623 if ((error = ALCATEL_UpdateField(s, Alcatel_time, ToDo->Location, 3, &(ToDo->Entries[i].Date))) != ERR_NONE) return error;
3621 UpdatedFields[3] = true; 3624 UpdatedFields[3] = true;
3622 if ((error = ALCATEL_UpdateField(s, Alcatel_date, ToDo->Location, 10, &(ToDo->Entries[i].Date))) != ERR_NONE) return error; 3625 if ((error = ALCATEL_UpdateField(s, Alcatel_date, ToDo->Location, 10, &(ToDo->Entries[i].Date))) != ERR_NONE) return error;
3623 UpdatedFields[10] = true; 3626 UpdatedFields[10] = true;
3624 if ((error = ALCATEL_UpdateField(s, Alcatel_time, ToDo->Location, 11, &(ToDo->Entries[i].Date))) != ERR_NONE) return error; 3627 if ((error = ALCATEL_UpdateField(s, Alcatel_time, ToDo->Location, 11, &(ToDo->Entries[i].Date))) != ERR_NONE) return error;
3625 UpdatedFields[11] = true; 3628 UpdatedFields[11] = true;
3626 break; 3629 break;
3627 case TODO_TEXT: 3630 case TODO_TEXT:
3628 if ((error = ALCATEL_UpdateField(s, Alcatel_string, ToDo->Location, 4, ToDo->Entries[i].Text)) != ERR_NONE) return error; 3631 if ((error = ALCATEL_UpdateField(s, Alcatel_string, ToDo->Location, 4, ToDo->Entries[i].Text)) != ERR_NONE) return error;
3629 UpdatedFields[4] = true; 3632 UpdatedFields[4] = true;
3630 break; 3633 break;
3631 case TODO_PRIVATE: 3634 case TODO_PRIVATE:
3632 if ((error = ALCATEL_UpdateField(s, Alcatel_bool, ToDo->Location, 5, &(ToDo->Entries[i].Number))) != ERR_NONE) return error; 3635 if ((error = ALCATEL_UpdateField(s, Alcatel_bool, ToDo->Location, 5, &(ToDo->Entries[i].Number))) != ERR_NONE) return error;
3633 UpdatedFields[5] = true; 3636 UpdatedFields[5] = true;
3634 break; 3637 break;
3635 case TODO_CATEGORY: 3638 case TODO_CATEGORY:
3636 if ((error = ALCATEL_UpdateField(s, Alcatel_byte, ToDo->Location, 6, &(ToDo->Entries[i].Number))) != ERR_NONE) return error; 3639 if ((error = ALCATEL_UpdateField(s, Alcatel_byte, ToDo->Location, 6, &(ToDo->Entries[i].Number))) != ERR_NONE) return error;
3637 UpdatedFields[6] = true; 3640 UpdatedFields[6] = true;
3638 break; 3641 break;
3639 case TODO_CONTACTID: 3642 case TODO_CONTACTID:
3640 if ((error = ALCATEL_UpdateField(s, Alcatel_int, ToDo->Location, 8, &(ToDo->Entries[i].Number))) != ERR_NONE) return error; 3643 if ((error = ALCATEL_UpdateField(s, Alcatel_int, ToDo->Location, 8, &(ToDo->Entries[i].Number))) != ERR_NONE) return error;
3641 UpdatedFields[8] = true; 3644 UpdatedFields[8] = true;
3642 contact_set = true; 3645 contact_set = true;
3643 break; 3646 break;
3644 case TODO_PHONE: 3647 case TODO_PHONE:
3645 if ((error = ALCATEL_UpdateField(s, Alcatel_phone, ToDo->Location, 9, ToDo->Entries[i].Text)) != ERR_NONE) return error; 3648 if ((error = ALCATEL_UpdateField(s, Alcatel_phone, ToDo->Location, 9, ToDo->Entries[i].Text)) != ERR_NONE) return error;
3646 UpdatedFields[9] = true; 3649 UpdatedFields[9] = true;
3647 phone_set = true; 3650 phone_set = true;
3648 break; 3651 break;
3649 default: 3652 default:
3650 break; 3653 break;
@@ -3821,8 +3824,16 @@ static GSM_Error ALCATEL_SetIncomingSMS (GSM_StateMachine *s, bool enable)
3821 if ((error = ALCATEL_SetATMode(s))!= ERR_NONE) return error; 3824 if ((error = ALCATEL_SetATMode(s))!= ERR_NONE) return error;
3822 return ATGEN_SetIncomingSMS(s, enable); 3825 return ATGEN_SetIncomingSMS(s, enable);
3823} 3826}
3824 3827
3828static GSM_Error ALCATEL_SetFastSMSSending(GSM_StateMachine *s, bool enable)
3829{
3830 GSM_Error error;
3831
3832 if ((error = ALCATEL_SetATMode(s))!= ERR_NONE) return error;
3833 return ATGEN_SetFastSMSSending(s, enable);
3834}
3835
3825static GSM_Reply_Function ALCATELReplyFunctions[] = { 3836static GSM_Reply_Function ALCATELReplyFunctions[] = {
3826 {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelAttach }, 3837 {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelAttach },
3827 {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelDetach }, 3838 {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelDetach },
3828 {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelCommit }, 3839 {ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelCommit },
@@ -3912,8 +3923,9 @@ GSM_Phone_Functions ALCATELPhone = {
3912 ALCATEL_AddSMS, 3923 ALCATEL_AddSMS,
3913 ALCATEL_DeleteSMS, 3924 ALCATEL_DeleteSMS,
3914 ALCATEL_SendSMS, 3925 ALCATEL_SendSMS,
3915 ALCATEL_SendSavedSMS, 3926 ALCATEL_SendSavedSMS,
3927 ALCATEL_SetFastSMSSending,
3916 ALCATEL_SetIncomingSMS, 3928 ALCATEL_SetIncomingSMS,
3917 ALCATEL_SetIncomingCB, 3929 ALCATEL_SetIncomingCB,
3918 ALCATEL_GetSMSFolders, 3930 ALCATEL_GetSMSFolders,
3919 NOTSUPPORTED, /* AddSMSFolder */ 3931 NOTSUPPORTED, /* AddSMSFolder */
@@ -3966,9 +3978,9 @@ GSM_Phone_Functions ALCATELPhone = {
3966 ALCATEL_DeleteCalendar, 3978 ALCATEL_DeleteCalendar,
3967 ALCATEL_DeleteAllCalendar, 3979 ALCATEL_DeleteAllCalendar,
3968 NOTSUPPORTED, /* GetCalendarSettings*/ 3980 NOTSUPPORTED, /* GetCalendarSettings*/
3969 NOTSUPPORTED, /* SetCalendarSettings*/ 3981 NOTSUPPORTED, /* SetCalendarSettings*/
3970 NOTSUPPORTED, /* GetNote */ 3982 NOTSUPPORTED, /* GetNextNote */
3971 NOTSUPPORTED, /* GetProfile */ 3983 NOTSUPPORTED, /* GetProfile */
3972 NOTSUPPORTED, /* SetProfile */ 3984 NOTSUPPORTED, /* SetProfile */
3973 NOTSUPPORTED, /* GetFMStation */ 3985 NOTSUPPORTED, /* GetFMStation */
3974 NOTSUPPORTED, /* SetFMStation */ 3986 NOTSUPPORTED, /* SetFMStation */