32 #include "../../gsmstate.h" 34 #ifdef GSM_ENABLE_ALCATEL 35 #ifdef GSM_ENABLE_ATGEN 40 #include "../../gsmcomon.h" 41 #include "../../misc/coding/coding.h" 42 #include "../../misc/misc.h" 44 #include "../at/atfunc.h" 50 #define ALCATEL_TIMEOUT 64 58 #define ALCATEL_SYNC_TYPE_CALENDAR 0x64 59 #define ALCATEL_SYNC_TYPE_TODO 0x68 60 #define ALCATEL_SYNC_TYPE_CONTACTS 0x6C 63 #define ALCATEL_BEGIN_SYNC_CALENDAR 0x00 64 #define ALCATEL_BEGIN_SYNC_TODO 0x02 65 #define ALCATEL_BEGIN_SYNC_CONTACTS 0x01 68 #define ALCATEL_LIST_TODO_CAT 0x9B 69 #define ALCATEL_LIST_CONTACTS_CAT 0x96 72 #define ALCATEL_UNICODE_FLAG 0x80 85 unsigned char GSM_AlcatelAlphabet[] =
267 str = strstr(msg->
Buffer,
"\"V");
270 while((str2 = strstr(str,
"\"V")) != NULL) str = str2 + 2;
271 if (strncmp(str,
"1.0", 3) == 0) {
273 }
else if (strncmp(str,
"1.1", 3) == 0) {
276 smprintf(s,
"Unknown protocol version. Please send debug log and phone info to author.\n");
301 smprintf(s,
"Changing to binary mode\n");
304 if (error !=
ERR_NONE)
return error;
307 if (error !=
ERR_NONE)
return error;
316 smprintf(s,
"HINT: Try changing speed to 19200, it is sometimes needed for Alcatel binary mode.\n");
319 if (error !=
ERR_NONE)
return error;
321 smprintf(s,
"Changing protocol to Alcabus\n");
343 unsigned char attach_buffer[] = {0x00, 0x00, 0x7C ,0x20};
344 unsigned char detach_buffer[] = {0x00, 0x01, 0x7C ,0x00};
345 unsigned char start_buffer[] =
346 {0x00, 0x04, 0x7C, 0x80,
347 0x12, 0x34, 0x56, 0x78};
348 unsigned char end_buffer[] =
349 {0x00, 0x04, 0x7C, 0x82,
351 0x00, 0x00, 0x00, 0x00};
352 unsigned char close_buffer[] =
356 unsigned char select1_buffer[] =
360 unsigned char select2_buffer[] =
364 unsigned char begin_buffer[] =
365 {0x00, 0x04, 0x7C, 0x81,
368 unsigned char commit_buffer[] =
374 error = ALCATEL_SetBinaryMode(s);
375 if (error !=
ERR_NONE)
return error;
386 commit_buffer[2] = ALCATEL_SYNC_TYPE_CALENDAR;
389 commit_buffer[2] = ALCATEL_SYNC_TYPE_CONTACTS;
392 commit_buffer[2] = ALCATEL_SYNC_TYPE_TODO;
395 smprintf(s,
"Committing edited record\n");
397 if (error !=
ERR_NONE)
return error;
399 if (error !=
ERR_NONE)
return error;
425 end_buffer[4] = ALCATEL_BEGIN_SYNC_CALENDAR;
428 end_buffer[4] = ALCATEL_BEGIN_SYNC_CONTACTS;
431 end_buffer[4] = ALCATEL_BEGIN_SYNC_TODO;
435 if (error !=
ERR_NONE)
return error;
439 close_buffer[2] = ALCATEL_SYNC_TYPE_CALENDAR;
442 close_buffer[2] = ALCATEL_SYNC_TYPE_CONTACTS;
445 close_buffer[2] = ALCATEL_SYNC_TYPE_TODO;
450 if (error !=
ERR_NONE)
return error;
452 smprintf(s,
"Detaching binary mode\n");
454 if (error !=
ERR_NONE)
return error;
462 smprintf(s,
"Starting session for %s\n",
470 select1_buffer[2] = ALCATEL_SYNC_TYPE_CALENDAR;
471 select2_buffer[2] = ALCATEL_SYNC_TYPE_CALENDAR;
472 begin_buffer[4] = ALCATEL_BEGIN_SYNC_CALENDAR;
475 select1_buffer[2] = ALCATEL_SYNC_TYPE_CONTACTS;
476 select2_buffer[2] = ALCATEL_SYNC_TYPE_CONTACTS;
477 begin_buffer[4] = ALCATEL_BEGIN_SYNC_CONTACTS;
480 select1_buffer[2] = ALCATEL_SYNC_TYPE_TODO;
481 select2_buffer[2] = ALCATEL_SYNC_TYPE_TODO;
482 begin_buffer[4] = ALCATEL_BEGIN_SYNC_TODO;
485 smprintf(s,
"Attaching in binary mode\n");
489 if (error !=
ERR_NONE)
return error;
493 if (error !=
ERR_NONE)
return error;
497 if (error !=
ERR_NONE)
return error;
499 if (error !=
ERR_NONE)
return error;
501 if (error !=
ERR_NONE)
return error;
505 if (error !=
ERR_NONE)
return error;
507 if (error !=
ERR_NONE)
return error;
532 if (error !=
ERR_NONE)
return error;
535 if (error !=
ERR_NONE)
return error;
537 smprintf(s,
"Changing protocol to AT\n");
587 smprintf(s,
"AT initialisation failed, trying to stop binary mode...\n");
593 if (error !=
ERR_NONE)
return error;
610 error = ALCATEL_SetATMode(s);
696 for (i = 0; i < count; i++) {
699 (msg->
Buffer[pos + 2] << 8) +
700 (msg->
Buffer[pos + 1] << 16) +
718 unsigned char buffer[] =
727 buffer[2] = ALCATEL_SYNC_TYPE_CALENDAR;
732 buffer[2] = ALCATEL_SYNC_TYPE_CONTACTS;
737 buffer[2] = ALCATEL_SYNC_TYPE_TODO;
756 if (error !=
ERR_NONE)
return error;
760 if (error !=
ERR_NONE)
return error;
778 smprintf(s,
"WARNING: Field list truncated, you should increase GSM_PHONEBOOK_ENTRIES to at least %d\n", msg->
Buffer[14]);
797 unsigned char buffer[] =
801 0x00, 0x00, 0x00, 0x00};
806 smprintf(s,
"Reading item fields (%d)\n",
id);
808 buffer[5] = (
id >> 24);
809 buffer[6] = ((
id >> 16) & 0xff);
810 buffer[7] = ((
id >> 8) & 0xff);
811 buffer[8] = (
id & 0xff);
815 buffer[2] = ALCATEL_SYNC_TYPE_CALENDAR;
818 buffer[2] = ALCATEL_SYNC_TYPE_CONTACTS;
821 buffer[2] = ALCATEL_SYNC_TYPE_TODO;
829 if (error !=
ERR_NONE)
return error;
831 if (error !=
ERR_NONE)
return error;
842 static void ALCATEL_DecodeString(
GSM_StateMachine *s,
unsigned const char *buffer,
unsigned char *target,
int maxlen)
851 smprintf(s,
"WARNING: Text truncated, to %d from %d\n", maxlen, len/2 + 1);
854 memcpy(target, buffer + 2, len);
860 smprintf(s,
"WARNING: Text truncated, to %d from %d\n", maxlen, len + 1);
890 }
else if (type == 0) {
903 unicode = ((len * 2) < maxlen);
909 target[0] = len * 2 + 3;
910 target[1] = ALCATEL_UNICODE_FLAG;
911 memcpy(target + 2, buffer, len * 2 + 2);
930 unsigned char *buffer = &(msg->
Buffer[16]);
932 if (buffer[1] == 0x05 && buffer[2] == 0x67) {
943 }
else if (buffer[1] == 0x06 && buffer[2] == 0x68) {
954 }
else if (buffer[1] == 0x08 && buffer[2] == 0x3C) {
958 }
else if (buffer[1] == 0x07 && buffer[2] == 0x3C) {
962 }
else if (buffer[1] == 0x03 && buffer[2] == 0x3B) {
966 }
else if (buffer[1] == 0x02 && buffer[2] == 0x3A) {
969 Priv->
ReturnInt = buffer[6] + (buffer[5] << 8) + (buffer[4] << 16) + (buffer[3] << 24);
970 }
else if (buffer[1] == 0x04 && buffer[2] == 0x38) {
974 }
else if (buffer[1] == 0x00 && buffer[2] == 0x38) {
979 smprintf(s,
"WARNING: Uknown data type received (%02X,%02X)\n", buffer[1], buffer[2]);
989 unsigned char buffer[] =
993 0x00, 0x00, 0x00, 0x00,
996 smprintf(s,
"Reading item value (%08x.%02x)\n",
id, field);
1000 buffer[2] = ALCATEL_SYNC_TYPE_CALENDAR;
1003 buffer[2] = ALCATEL_SYNC_TYPE_CONTACTS;
1006 buffer[2] = ALCATEL_SYNC_TYPE_TODO;
1010 buffer[5] = (
id >> 24);
1011 buffer[6] = ((
id >> 16) & 0xff);
1012 buffer[7] = ((
id >> 8) & 0xff);
1013 buffer[8] = (
id & 0xff);
1014 buffer[9] = (field & 0xff);
1017 if (error !=
ERR_NONE)
return error;
1019 if (error !=
ERR_NONE)
return error;
1030 if (msg->
Buffer[4] == 6) {
1035 smprintf(s,
"WARNING: Field list truncated, you should increase ALCATEL_MAX_CATEGORIES to at least %d\n", msg->
Buffer[12]);
1054 unsigned char buffer[] =
1064 buffer[2] = ALCATEL_SYNC_TYPE_CONTACTS;
1065 buffer[4] = ALCATEL_LIST_CONTACTS_CAT;
1068 buffer[2] = ALCATEL_SYNC_TYPE_TODO;
1069 buffer[4] = ALCATEL_LIST_TODO_CAT;
1077 smprintf(s,
"Reading category list\n");
1080 if (error !=
ERR_NONE)
return error;
1083 if (error !=
ERR_NONE)
return error;
1116 unsigned char buffer[200] = {0x00, 0x04, 0x00 , 0x0d, 0x00 , 0x0b };
1122 ALCATEL_EncodeString(s, str, buffer + 7, 0);
1123 buffer[6] = buffer[7] + 1;
1127 buffer[2] = ALCATEL_SYNC_TYPE_CONTACTS;
1128 buffer[4] = ALCATEL_LIST_CONTACTS_CAT;
1131 buffer[2] = ALCATEL_SYNC_TYPE_TODO;
1132 buffer[4] = ALCATEL_LIST_TODO_CAT;
1139 if (error !=
ERR_NONE)
return error;
1141 if (error !=
ERR_NONE)
return error;
1145 return ALCATEL_GetAvailableCategoryIds(s);
1158 unsigned char buffer[] = {0x00, 0x04, 0x00 , 0x0c, 0x00 , 0x0A, 0x01, 0x00 };
1167 smprintf(s,
"Reading category %d\n",
id);
1171 buffer[2] = ALCATEL_SYNC_TYPE_CONTACTS;
1172 buffer[4] = ALCATEL_LIST_CONTACTS_CAT;
1175 buffer[2] = ALCATEL_SYNC_TYPE_TODO;
1176 buffer[4] = ALCATEL_LIST_TODO_CAT;
1182 buffer[7] = (
id & 0xff);
1185 if (error !=
ERR_NONE)
return error;
1187 if (error !=
ERR_NONE)
return error;
1197 unsigned char buffer[] =
1201 0x00, 0x00, 0x00, 0x00,
1206 smprintf(s,
"Deleting field (%08x.%02x)\n",
id, field);
1210 buffer[2] = ALCATEL_SYNC_TYPE_CALENDAR;
1213 buffer[2] = ALCATEL_SYNC_TYPE_CONTACTS;
1216 buffer[2] = ALCATEL_SYNC_TYPE_TODO;
1220 buffer[5] = (
id >> 24);
1221 buffer[6] = ((
id >> 16) & 0xff);
1222 buffer[7] = ((
id >> 8) & 0xff);
1223 buffer[8] = (
id & 0xff);
1224 buffer[11] = (field & 0xff);
1227 if (error !=
ERR_NONE)
return error;
1235 unsigned char buffer[] =
1239 0x00, 0x00, 0x00, 0x00,
1242 smprintf(s,
"Deleting item (%08x)\n",
id);
1246 buffer[2] = ALCATEL_SYNC_TYPE_CALENDAR;
1249 buffer[2] = ALCATEL_SYNC_TYPE_CONTACTS;
1252 buffer[2] = ALCATEL_SYNC_TYPE_TODO;
1256 buffer[5] = (
id >> 24);
1257 buffer[6] = ((
id >> 16) & 0xff);
1258 buffer[7] = ((
id >> 8) & 0xff);
1259 buffer[8] = (
id & 0xff);
1262 if (error !=
ERR_NONE)
return error;
1265 if (error !=
ERR_NONE)
return error;
1279 buffer[1] = field & 0xff;
1313 error = ALCATEL_EncodeString(s, (
char *)data, buffer + 5,
Alcatel_string);
1314 if (error !=
ERR_NONE)
return error;
1315 buffer[0] = 5 + buffer[5];
1321 error = ALCATEL_EncodeString(s, (
char *)data, buffer + 5,
Alcatel_phone);
1322 if (error !=
ERR_NONE)
return error;
1323 buffer[0] = 5 + buffer[5];
1330 buffer[5] = *(
int *)data & 0xff;
1338 buffer[5] = *(
int *)data & 0xff;
1346 buffer[5] = *(
unsigned int *)data >> 24;
1347 buffer[6] = (*(
unsigned int *)data >> 16) & 0xff;
1348 buffer[7] = (*(
unsigned int *)data >> 8) & 0xff;
1349 buffer[8] = *(
unsigned int *)data & 0xff;
1357 buffer[5] = *(
int *)data & 0xff;
1367 unsigned char buffer[200] =
1375 smprintf(s,
"Creating field (%02x)\n", field);
1379 buffer[2] = ALCATEL_SYNC_TYPE_CALENDAR;
1382 buffer[2] = ALCATEL_SYNC_TYPE_CONTACTS;
1385 buffer[2] = ALCATEL_SYNC_TYPE_TODO;
1388 error = ALCATEL_BuildWriteBuffer(s, buffer + 6, type, field, data);
1389 if (error !=
ERR_NONE)
return error;
1392 if (error !=
ERR_NONE)
return error;
1404 0x00, 0x00, 0x00, 0x00,
1410 smprintf(s,
"Updating field (%08x.%02x)\n",
id, field);
1412 buffer[5] = (
id >> 24);
1413 buffer[6] = ((
id >> 16) & 0xff);
1414 buffer[7] = ((
id >> 8) & 0xff);
1415 buffer[8] = (
id & 0xff);
1419 buffer[2] = ALCATEL_SYNC_TYPE_CALENDAR;
1422 buffer[2] = ALCATEL_SYNC_TYPE_CONTACTS;
1425 buffer[2] = ALCATEL_SYNC_TYPE_TODO;
1428 error = ALCATEL_BuildWriteBuffer(s, buffer + 10, type, field, data);
1429 if (error !=
ERR_NONE)
return error;
1432 if (error !=
ERR_NONE)
return error;
1447 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
1455 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
1463 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
1471 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
1484 if ((error = ALCATEL_GetAvailableIds(s,
FALSE))!=
ERR_NONE)
return error;
1489 if ((error = ALCATEL_GetFields(s, entry->
Location))!=
ERR_NONE)
return error;
1500 smprintf(s,
"WARNING: Received unexpected type %02X for field 0, ignoring\n", Priv->
ReturnType);
1511 smprintf(s,
"WARNING: Received unexpected type %02X for field 1, ignoring\n", Priv->
ReturnType);
1522 smprintf(s,
"WARNING: Received unexpected type %02X for field 2, ignoring\n", Priv->
ReturnType);
1533 smprintf(s,
"WARNING: Received unexpected type %02X for field 3, ignoring\n", Priv->
ReturnType);
1544 smprintf(s,
"WARNING: Received unexpected type %02X for field 4, ignoring\n", Priv->
ReturnType);
1555 smprintf(s,
"WARNING: Received unexpected type %02X for field 5, ignoring\n", Priv->
ReturnType);
1566 smprintf(s,
"WARNING: Received unexpected type %02X for field 6, ignoring\n", Priv->
ReturnType);
1577 smprintf(s,
"WARNING: Received unexpected type %02X for field 7, ignoring\n", Priv->
ReturnType);
1588 smprintf(s,
"WARNING: Received unexpected type %02X for field 8, ignoring\n", Priv->
ReturnType);
1598 smprintf(s,
"WARNING: Received unexpected type %02X for field 9, ignoring\n", Priv->
ReturnType);
1609 smprintf(s,
"WARNING: Received unexpected type %02X for field 10, ignoring\n", Priv->
ReturnType);
1620 smprintf(s,
"WARNING: Received unexpected type %02X for field 11, ignoring\n", Priv->
ReturnType);
1631 smprintf(s,
"WARNING: Received unexpected type %02X for field 12, ignoring\n", Priv->
ReturnType);
1642 smprintf(s,
"WARNING: Received unexpected type %02X for field 13, ignoring\n", Priv->
ReturnType);
1653 smprintf(s,
"WARNING: Received unexpected type %02X for field 14, ignoring\n", Priv->
ReturnType);
1664 smprintf(s,
"WARNING: Received unexpected type %02X for field 15, ignoring\n", Priv->
ReturnType);
1675 smprintf(s,
"WARNING: Received unexpected type %02X for field 16, ignoring\n", Priv->
ReturnType);
1686 smprintf(s,
"WARNING: Received unexpected type %02X for field 17, ignoring\n", Priv->
ReturnType);
1697 smprintf(s,
"WARNING: Received unexpected type %02X for field 18, ignoring\n", Priv->
ReturnType);
1708 smprintf(s,
"WARNING: Received unexpected type %02X for field 19, ignoring\n", Priv->
ReturnType);
1719 smprintf(s,
"WARNING: Received unexpected type %02X for field 20, ignoring\n", Priv->
ReturnType);
1730 smprintf(s,
"WARNING: Received unexpected type %02X for field 21, ignoring\n", Priv->
ReturnType);
1741 smprintf(s,
"WARNING: Received unexpected type %02X for field 22, ignoring\n", Priv->
ReturnType);
1752 smprintf(s,
"WARNING: Received unexpected type %02X for field 23, ignoring\n", Priv->
ReturnType);
1763 smprintf(s,
"WARNING: Received unexpected type %02X for field 24, ignoring\n", Priv->
ReturnType);
1774 smprintf(s,
"WARNING: Received unexpected type %02X for field 25, ignoring\n", Priv->
ReturnType);
1815 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
1827 if ((error = ALCATEL_GetAvailableIds(s,
FALSE))!=
ERR_NONE)
return error;
1831 if ((error = ALCATEL_GetNextId(s, &(entry->
Location))) !=
ERR_NONE)
return error;
1833 return ALCATEL_GetMemory(s, entry);
1835 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
1844 int NamePosition = -1;
1976 if (NamePosition != -1) {
1979 smprintf(s,
"WARNING: Ignoring name, not supported by phone\n");
1987 if ((error = ALCATEL_GetAvailableIds(s,
TRUE))!=
ERR_NONE)
return error;
1990 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
1999 int NamePosition = -1;
2009 if ((error = ALCATEL_GetAvailableIds(s,
FALSE))!=
ERR_NONE)
return error;
2012 return ALCATEL_AddMemory(s, entry);
2015 if ((error = ALCATEL_GetFields(s, entry->
Location))!=
ERR_NONE)
return error;
2017 for (i = 0; i < 26; i++) { UpdatedFields[i] =
FALSE; }
2026 UpdatedFields[8] =
TRUE;
2030 UpdatedFields[7] =
TRUE;
2034 UpdatedFields[13] =
TRUE;
2040 UpdatedFields[12] =
TRUE;
2044 UpdatedFields[9] =
TRUE;
2048 UpdatedFields[11] =
TRUE;
2052 UpdatedFields[10] =
TRUE;
2056 UpdatedFields[4] =
TRUE;
2060 UpdatedFields[14] =
TRUE;
2064 UpdatedFields[15] =
TRUE;
2068 UpdatedFields[0] =
TRUE;
2073 UpdatedFields[1] =
TRUE;
2078 UpdatedFields[2] =
TRUE;
2082 UpdatedFields[3] =
TRUE;
2086 UpdatedFields[5] =
TRUE;
2090 UpdatedFields[6] =
TRUE;
2094 UpdatedFields[16] =
TRUE;
2098 UpdatedFields[17] =
TRUE;
2102 UpdatedFields[18] =
TRUE;
2106 UpdatedFields[19] =
TRUE;
2110 UpdatedFields[20] =
TRUE;
2114 UpdatedFields[21] =
TRUE;
2118 UpdatedFields[22] =
TRUE;
2122 UpdatedFields[23] =
TRUE;
2126 UpdatedFields[24] =
TRUE;
2131 UpdatedFields[25] =
TRUE;
2169 if (NamePosition != -1) {
2172 smprintf(s,
"WARNING: Ignoring name, not supported by phone\n");
2175 UpdatedFields[1] =
TRUE;
2187 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2198 if ((error = ALCATEL_GetAvailableIds(s,
FALSE))!=
ERR_NONE)
return error;
2204 error = ALCATEL_DeleteItem(s, entry->
Location);
2205 if (error !=
ERR_NONE)
return error;
2209 if ((error = ALCATEL_GetAvailableIds(s,
TRUE))!=
ERR_NONE)
return error;
2213 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2226 if ((error = ALCATEL_GetAvailableIds(s,
FALSE))!=
ERR_NONE)
return error;
2230 if (error !=
ERR_NONE)
return error;
2235 if ((error = ALCATEL_GetAvailableIds(s,
TRUE))!=
ERR_NONE)
return error;
2239 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2248 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2260 if ((error = ALCATEL_GetAvailableIds(s,
TRUE))!=
ERR_NONE)
return error;
2265 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2274 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2282 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2290 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2298 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2306 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2314 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2322 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2330 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2338 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2346 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2354 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2362 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2370 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2378 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2386 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2394 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2402 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2410 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2418 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2426 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2434 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2442 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2450 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2458 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2466 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2474 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
2487 if ((error = ALCATEL_GetAvailableIds(s,
TRUE))!=
ERR_NONE)
return error;
2508 if ((error = ALCATEL_GetAvailableIds(s,
FALSE))!=
ERR_NONE)
return error;
2513 if ((error = ALCATEL_GetFields(s, Note->
Location))!=
ERR_NONE)
return error;
2528 smprintf(s,
"WARNING: Invalid date in phone, ignoring\n");
2537 EventDateSet =
TRUE;
2547 smprintf(s,
"WARNING: Invalid time in phone, ignoring\n");
2556 EventStartSet =
TRUE;
2566 smprintf(s,
"WARNING: Invalid time in phone, ignoring\n");
2585 smprintf(s,
"WARNING: Invalid date in phone, ignoring\n");
2612 smprintf(s,
"WARNING: Invalid time in phone, ignoring\n");
2774 smprintf(s,
"WARNING: Invalid date in phone, ignoring\n");
2790 smprintf(s,
"WARNING: Invalid date in phone, ignoring\n");
2806 smprintf(s,
"WARNING: Invalid date in phone, ignoring\n");
2823 smprintf(s,
"WARNING: Invalid time in phone, ignoring\n");
2859 if (EventStartSet) {
2879 if (!EventStartSet && !EventEndSet) {
2895 if ((error = ALCATEL_GetAvailableIds(s,
FALSE))!=
ERR_NONE)
return error;
2899 if ((error = ALCATEL_GetNextId(s, &(Note->
Location))) !=
ERR_NONE)
return error;
2901 return ALCATEL_GetCalendar(s, Note);
2911 if ((error = ALCATEL_GetAvailableIds(s,
FALSE))!=
ERR_NONE)
return error;
2916 error = ALCATEL_DeleteItem(s, Note->
Location);
2917 if (error !=
ERR_NONE)
return error;
2920 if ((error = ALCATEL_GetAvailableIds(s,
TRUE))!=
ERR_NONE)
return error;
3017 switch (Note->
Type) {
3050 if ((error = ALCATEL_GetAvailableIds(s,
TRUE))!=
ERR_NONE)
return error;
3067 if ((error = ALCATEL_GetAvailableIds(s,
FALSE))!=
ERR_NONE)
return error;
3070 return ALCATEL_AddCalendar(s, Note);
3073 if ((error = ALCATEL_GetFields(s, Note->
Location))!=
ERR_NONE)
return error;
3075 for (i = 0; i < 22; i++) { UpdatedFields[i] =
FALSE; }
3083 UpdatedFields[0] =
TRUE;
3087 UpdatedFields[1] =
TRUE;
3092 UpdatedFields[0] =
TRUE;
3099 UpdatedFields[3] =
TRUE;
3101 UpdatedFields[4] =
TRUE;
3104 UpdatedFields[20] =
TRUE;
3106 UpdatedFields[21] =
TRUE;
3111 UpdatedFields[5] =
TRUE;
3115 UpdatedFields[6] =
TRUE;
3119 UpdatedFields[8] =
TRUE;
3124 UpdatedFields[9] =
TRUE;
3129 UpdatedFields[10] =
TRUE;
3134 UpdatedFields[11] =
TRUE;
3139 UpdatedFields[12] =
TRUE;
3144 UpdatedFields[13] =
TRUE;
3149 UpdatedFields[17] =
TRUE;
3154 UpdatedFields[18] =
TRUE;
3159 UpdatedFields[19] =
TRUE;
3175 switch (Note->
Type) {
3195 UpdatedFields[7] =
TRUE;
3204 UpdatedFields[8] =
TRUE;
3222 if ((error = ALCATEL_GetAvailableIds(s,
FALSE))!=
ERR_NONE)
return error;
3226 if (error !=
ERR_NONE)
return error;
3231 if ((error = ALCATEL_GetAvailableIds(s,
TRUE))!=
ERR_NONE)
return error;
3245 int alarm_number = Alarm->
Location;
3249 if ((error = ALCATEL_GetAvailableIds(s,
FALSE))!=
ERR_NONE)
return error;
3259 if (alarm_number == 0) {
3271 if ((error = ALCATEL_GetCalendar(s, &Note))!=
ERR_NONE)
return error;
3279 Alarm->
Text[0] = 0; Alarm->
Text[1] = 0;
3306 int alarm_number = Alarm->
Location;
3309 if ((error = ALCATEL_GetAvailableIds(s,
FALSE))!=
ERR_NONE)
return error;
3319 if (alarm_number == 0) {
3345 if (Alarm->
Text[0] != 0 || Alarm->
Text[1] != 0) {
3352 return ALCATEL_SetCalendar(s, &Note);
3354 return ALCATEL_AddCalendar(s, &Note);
3368 if ((error = ALCATEL_GetAvailableIds(s,
TRUE))!=
ERR_NONE)
return error;
3383 if ((error = ALCATEL_GetAvailableIds(s,
FALSE))!=
ERR_NONE)
return error;
3388 if ((error = ALCATEL_GetFields(s, ToDo->
Location))!=
ERR_NONE)
return error;
3405 smprintf(s,
"WARNING: Invalid date in phone, ignoring\n");
3431 smprintf(s,
"WARNING: Invalid date in phone, ignoring\n");
3458 smprintf(s,
"WARNING: Invalid time in phone, ignoring\n");
3531 smprintf(s,
"WARNING: Received unexpected priority %02X, ignoring\n", Priv->
ReturnInt);
3572 smprintf(s,
"WARNING: Invalid date in phone, ignoring\n");
3589 smprintf(s,
"WARNING: Invalid time in phone, ignoring\n");
3632 if ((error = ALCATEL_GetAvailableIds(s,
FALSE))!=
ERR_NONE)
return error;
3636 if ((error = ALCATEL_GetNextId(s, &(ToDo->
Location))) !=
ERR_NONE)
return error;
3638 return ALCATEL_GetToDo(s, ToDo);
3648 if ((error = ALCATEL_GetAvailableIds(s,
FALSE))!=
ERR_NONE)
return error;
3651 error = ALCATEL_DeleteItem(s, Priv->
ToDoItems[i]);
3652 if (error !=
ERR_NONE)
return error;
3657 if ((error = ALCATEL_GetAvailableIds(s,
TRUE))!=
ERR_NONE)
return error;
3746 if ((error = ALCATEL_GetAvailableIds(s,
TRUE))!=
ERR_NONE)
return error;
3762 if ((error = ALCATEL_GetAvailableIds(s,
FALSE))!=
ERR_NONE)
return error;
3765 return ALCATEL_AddToDo(s, ToDo);
3768 if ((error = ALCATEL_GetFields(s, ToDo->
Location))!=
ERR_NONE)
return error;
3770 for (i = 0; i < 12; i++) { UpdatedFields[i] =
FALSE; }
3798 UpdatedFields[7] =
TRUE;
3805 UpdatedFields[0] =
TRUE;
3809 UpdatedFields[1] =
TRUE;
3813 UpdatedFields[2] =
TRUE;
3815 UpdatedFields[3] =
TRUE;
3817 UpdatedFields[10] =
TRUE;
3819 UpdatedFields[11] =
TRUE;
3823 UpdatedFields[4] =
TRUE;
3827 UpdatedFields[5] =
TRUE;
3831 UpdatedFields[6] =
TRUE;
3835 UpdatedFields[8] =
TRUE;
3840 UpdatedFields[9] =
TRUE;
3854 UpdatedFields[8] =
TRUE;
3872 if ((error = ALCATEL_GetAvailableIds(s,
FALSE))!=
ERR_NONE)
return error;
3877 error = ALCATEL_DeleteItem(s, ToDo->
Location);
3878 if (error !=
ERR_NONE)
return error;
3881 if ((error = ALCATEL_GetAvailableIds(s,
TRUE))!=
ERR_NONE)
return error;
3891 switch (Status->
Type) {
3897 if ((error = ALCATEL_GetAvailableCategoryIds(s))!=
ERR_NONE)
return error;
3910 switch (Category->
Type) {
3916 if ((error = ALCATEL_GetAvailableCategoryIds(s))!=
ERR_NONE)
return error;
3917 if ((error = ALCATEL_IsCategoryIdAvailable(s, Category->
Location))!=
ERR_NONE)
return error;
3918 if ((error = ALCATEL_GetCategoryText(s, Category->
Location))!=
ERR_NONE)
return error;
3931 switch (Category->
Type) {
3937 if ((error = ALCATEL_AddCategoryText(s, Category->
Name))!=
ERR_NONE)
return error;
3964 switch (msg->
Buffer[8]) {
3994 smprintf(s,
"WARNING: Packet seems to indicate some status by %02X, ignoring!\n", msg->
Buffer[8]);
4010 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
4018 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
4026 if ((error = ALCATEL_SetATMode(s))!=
ERR_NONE)
return error;
4060 {NULL,
"\x00",0x00,0x00,
ID_None }
4067 "alcatel|OT501|OT701|OT715|OT535|OT735|BE5|BF5|BH4",
4068 ALCATELReplyFunctions,
4072 ALCATEL_DispatchMessage,
4074 ALCATEL_GetManufacturer,
4076 ALCATEL_GetFirmware,
4080 ALCATEL_GetProductCode,
4084 ALCATEL_GetDateTime,
4085 ALCATEL_SetDateTime,
4092 ALCATEL_ResetPhoneSettings,
4093 ALCATEL_EnterSecurityCode,
4094 ALCATEL_GetSecurityStatus,
4095 ALCATEL_GetDisplayStatus,
4096 ALCATEL_SetAutoNetworkLogin,
4097 ALCATEL_GetBatteryCharge,
4098 ALCATEL_GetSignalStrength,
4099 ALCATEL_GetNetworkInfo,
4100 ALCATEL_GetCategory,
4101 ALCATEL_AddCategory,
4102 ALCATEL_GetCategoryStatus,
4103 ALCATEL_GetMemoryStatus,
4105 ALCATEL_GetNextMemory,
4108 ALCATEL_DeleteMemory,
4109 ALCATEL_DeleteAllMemory,
4114 ALCATEL_GetSMSStatus,
4121 ALCATEL_SendSavedSMS,
4122 ALCATEL_SetFastSMSSending,
4123 ALCATEL_SetIncomingSMS,
4124 ALCATEL_SetIncomingCB,
4125 ALCATEL_GetSMSFolders,
4129 ALCATEL_DialService,
4164 ALCATEL_GetToDoStatus,
4166 ALCATEL_GetNextToDo,
4170 ALCATEL_DeleteAllToDo,
4171 ALCATEL_GetCalendarStatus,
4172 ALCATEL_GetCalendar,
4173 ALCATEL_GetNextCalendar,
4174 ALCATEL_SetCalendar,
4175 ALCATEL_AddCalendar,
4176 ALCATEL_DeleteCalendar,
4177 ALCATEL_DeleteAllCalendar,
#define ALCATEL_FREE_MEMORY
GSM_Error ATGEN_GetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc)
GSM_Error ATGEN_AnswerCall(GSM_StateMachine *s, int ID, gboolean all)
GSM_Error ATGEN_GetBatteryCharge(GSM_StateMachine *s, GSM_BatteryCharge *bat)
char * DecodeUnicodeString(const unsigned char *src)
GSM_Alcatel_BinaryType BinaryType
void CopyUnicodeString(unsigned char *Dest, const unsigned char *Source)
void DecodeDefault(unsigned char *dest, const unsigned char *src, size_t len, gboolean UseExtensions, unsigned char *ExtraAlphabet)
GSM_ToDo_Priority Priority
GSM_Error ATGEN_GetMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
GSM_Error ATGEN_HandleCMEError(GSM_StateMachine *s)
GSM_Error ATGEN_DialService(GSM_StateMachine *s, char *number)
GSM_MemoryType MemoryType
#define GSM_PHONEBOOK_TEXT_LENGTH
GSM_Alcatel_BinaryState BinaryState
GSM_Error ATGEN_ResetPhoneSettings(GSM_StateMachine *s, GSM_ResetSettingsType Type)
GSM_CalendarNoteType Type
int CurrentFields[GSM_PHONEBOOK_ENTRIES+1]
#define GSM_MAX_CATEGORY_NAME_LENGTH
GSM_Error ATGEN_Reset(GSM_StateMachine *s, gboolean hard)
#define GSM_PHONEBOOK_ENTRIES
int CurrentCategories[ALCATEL_MAX_CATEGORIES+1]
GSM_Error ATGEN_GetSMSFolders(GSM_StateMachine *s, GSM_SMSFolders *folders)
unsigned char ReturnString[(GSM_PHONEBOOK_TEXT_LENGTH+1) *2]
GSM_Error ATGEN_SendDTMF(GSM_StateMachine *s, char *sequence)
GSM_Error ATGEN_GetModel(GSM_StateMachine *s)
GSM_Error ATGEN_AddMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
GSM_Error ATGEN_DeleteSMS(GSM_StateMachine *s, GSM_SMSMessage *sms)
GSM_Error ATGEN_Terminate(GSM_StateMachine *s)
GSM_Error ATGEN_HandleCMSError(GSM_StateMachine *s)
GSM_DateTime ReturnDateTime
GSM_Error GSM_DispatchMessage(GSM_StateMachine *s)
GSM_Error ATGEN_GetDisplayStatus(GSM_StateMachine *s, GSM_DisplayFeatures *features)
#define ALCATEL_MAX_LOCATION
GSM_Error ATGEN_GetMemoryStatus(GSM_StateMachine *s, GSM_MemoryStatus *Status)
GSM_Error ATGEN_Initialise(GSM_StateMachine *s)
GSM_Alcatel_BinaryType CurrentFieldsType
size_t UnicodeLength(const unsigned char *str)
unsigned char Name[(GSM_MAX_CATEGORY_NAME_LENGTH+1) *2]
GSM_Error ATGEN_SetMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
GSM_Error ATGEN_CancelCall(GSM_StateMachine *s, int ID, gboolean all)
GSM_Error ATGEN_SetFastSMSSending(GSM_StateMachine *s, gboolean enable)
GSM_Error ATGEN_SetDateTime(GSM_StateMachine *s, GSM_DateTime *date_time)
GSM_Error ATGEN_GetSMSStatus(GSM_StateMachine *s, GSM_SMSMemoryStatus *status)
GSM_Error ATGEN_GetNetworkInfo(GSM_StateMachine *s, GSM_NetworkInfo *netinfo)
GSM_Error ATGEN_DialVoice(GSM_StateMachine *s, char *number, GSM_CallShowNumber ShowNumber)
char Manufacturer[GSM_MAX_MANUFACTURER_LENGTH+1]
GSM_PhoneModel * ModelInfo
GSM_Alcatel_ProtocolVersion ProtocolVersion
unsigned char Text[(GSM_MAX_CALENDAR_TEXT_LENGTH+1) *2]
gboolean TransferCompleted
GSM_Error(* Initialise)(GSM_StateMachine *s)
GSM_Error ATGEN_AddSMS(GSM_StateMachine *s, GSM_SMSMessage *sms)
unsigned char Text[(GSM_PHONEBOOK_TEXT_LENGTH+1) *2]
GSM_Error ATGEN_GetDateTime(GSM_StateMachine *s, GSM_DateTime *date_time)
GSM_Error ATGEN_GetSMS(GSM_StateMachine *s, GSM_MultiSMSMessage *sms)
GSM_CalendarNoteType Type
struct GSM_Phone_Data::@2 Priv
GSM_SubToDoEntry Entries[GSM_TODO_ENTRIES]
GSM_Reply_Function ATGENReplyFunctions[]
GSM_Error GSM_WaitFor(GSM_StateMachine *s, unsigned const char *buffer, size_t length, int type, int timeout, GSM_Phone_RequestID request)
GSM_Error ATGEN_DeleteAllMemory(GSM_StateMachine *s, GSM_MemoryType type)
GSM_Error ATGEN_SendSavedSMS(GSM_StateMachine *s, int Folder, int Location)
int CurrentCategoriesCount
GSM_Error ATGEN_SendSMS(GSM_StateMachine *s, GSM_SMSMessage *sms)
gboolean CheckTime(GSM_DateTime *date)
GSM_Error ATGEN_PressKey(GSM_StateMachine *s, GSM_KeyCode Key, gboolean Press)
GSM_Error ATGEN_GetNextSMS(GSM_StateMachine *s, GSM_MultiSMSMessage *sms, gboolean start)
GSM_CalendarType EntryType
GSM_Error ATGEN_GetSecurityStatus(GSM_StateMachine *s, GSM_SecurityCodeType *Status)
gboolean mywstrncmp(unsigned const char *a, unsigned const char *b, int num)
GSM_Error ATGEN_DeleteMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
GSM_Error ATGEN_SetAutoNetworkLogin(GSM_StateMachine *s)
GSM_SubCalendarEntry Entries[GSM_CALENDAR_ENTRIES]
GSM_MemoryType MemoryType
void GSM_GetCurrentDateTime(GSM_DateTime *Date)
GSM_Error(* Terminate)(GSM_StateMachine *s)
GSM_Phone_Functions * Functions
GSM_Alcatel_FieldType ReturnType
GSM_EntryLocation Location
GSM_Error ATGEN_SetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc)
GSM_Error ATGEN_GetNextMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry, gboolean start)
char CurrentCategoriesCache[ALCATEL_MAX_CATEGORIES+1][(GSM_MAX_CATEGORY_NAME_LENGTH+1) *2]
GSM_Error ATGEN_GetIMEI(GSM_StateMachine *s)
GSM_Alcatel_BinaryType CurrentCategoriesType
GSM_Reply_Function * ReplyFunctions
GSM_Protocol_Functions * Functions
GSM_Error ATGEN_DispatchMessage(GSM_StateMachine *s)
unsigned char Text[(GSM_MAX_TODO_TEXT_LENGTH+1) *2]
void EncodeDefault(unsigned char *dest, const unsigned char *src, size_t *len, gboolean UseExtensions, unsigned char *ExtraAlphabet)
gboolean CheckDate(GSM_DateTime *date)
GSM_Error ATGEN_SetIncomingCB(GSM_StateMachine *s, gboolean enable)
GSM_Error ATGEN_GetSIMIMSI(GSM_StateMachine *s, char *IMSI)
GSM_Error ATGEN_GetSignalQuality(GSM_StateMachine *s, GSM_SignalQuality *sig)
unsigned char Text[(GSM_MAX_CALENDAR_TEXT_LENGTH+1) *2]
GSM_Error ATGEN_SetIncomingSMS(GSM_StateMachine *s, gboolean enable)
GSM_Error ATGEN_EnterSecurityCode(GSM_StateMachine *s, GSM_SecurityCode *Code)
#define ALCATEL_MAX_CATEGORIES
GSM_Error ATGEN_GetFirmware(GSM_StateMachine *s)
int smprintf(GSM_StateMachine *s, const char *format,...)
GSM_SubMemoryEntry Entries[GSM_PHONEBOOK_ENTRIES]