summaryrefslogtreecommitdiffabout
path: root/gammu/emb/common/phone/alcatel/alcatel.c
Side-by-side diff
Diffstat (limited to 'gammu/emb/common/phone/alcatel/alcatel.c') (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
@@ -4,19 +4,19 @@
* High level functions for communication with Alcatel One Touch 501 and
* compatible mobile phone.
*
* This code implements functions to communicate with Alcatel phones,
* currently seem to work:
* - BE5 series (501/701)
* - BF5 series (715)
* - BH4 series (535/735)
- * For some functions it uses normal AT mode (not implemented here, look at
- * ../at/atgen.[ch]) for others it switches into binary mode and initialises
- * underlaying protocol (see ../../protocol/alcatel/alcabus.[ch]) and
+ * For some functions it uses normal AT mode (not implemented here, look at
+ * ../at/atgen.[ch]) for others it switches into binary mode and initialises
+ * underlaying protocol (see ../../protocol/alcatel/alcabus.[ch]) and
* communicates over it. Don't ask me why Alcatel uses such silly thing...
*
* Notes for future features:
* - max phone number length is 61 (BE5)
* - max name length is 50 (BE5)
*/
#include "../../gsmstate.h"
@@ -96,32 +96,33 @@ extern GSM_Error ATGEN_HandleCMSError (GSM_StateMachine *s);
extern GSM_Error ATGEN_GetNetworkInfo (GSM_StateMachine *s, GSM_NetworkInfo *netinfo);
extern GSM_Error ATGEN_Reset (GSM_StateMachine *s, bool hard);
extern GSM_Error ATGEN_PressKey (GSM_StateMachine *s, GSM_KeyCode Key, bool Press);
extern GSM_Error ATGEN_GetDisplayStatus (GSM_StateMachine *s, GSM_DisplayFeatures *features);
extern GSM_Error ATGEN_SetAutoNetworkLogin (GSM_StateMachine *s);
extern GSM_Error ATGEN_DeleteAllMemory (GSM_StateMachine *s, GSM_MemoryType type);
extern GSM_Error ATGEN_DispatchMessage (GSM_StateMachine *s);
+extern GSM_Error ATGEN_SetFastSMSSending (GSM_StateMachine *s, bool enable);
extern GSM_Error ATGEN_SetIncomingCB (GSM_StateMachine *s, bool enable);
extern GSM_Error ATGEN_SetIncomingSMS (GSM_StateMachine *s, bool enable);
/**
* Alcatel uses some 8-bit characters in contacts, calendar etc.. This table
* attempts to decode it, it is probably not complete, here are just chars
* that I found...
*/
unsigned char GSM_AlcatelAlphabet[] =
{
/* in phone unicode description */
0x80, 0x00,0x20, /* empty */
0x81, 0x00,0x20, /* empty */
0x82, 0x00,0x20, /* empty */
0x83, 0x00,0x20, /* empty */
-
+
0x84, 0x00,0xe7, /* c cedilla */
0x85, 0x20,0x26, /* ... */
0x86, 0x03,0xc0, /* pi */
0x87, 0x01,0x3e, /* l caron */
0x88, 0x00,0xc0, /* A grave */
0x89, 0x00,0xc1, /* A acute */
0x8a, 0x00,0xc2, /* A circumflex */
0x8b, 0x00,0xc3, /* A tilde */
@@ -163,115 +164,115 @@ unsigned char GSM_AlcatelAlphabet[] =
0xaf, 0x01,0x05, /* a ogonek */
0xb0, 0x01,0x7c, /* z dot */
0xb1, 0x01,0x7a, /* z acute */
0xb2, 0x01,0x5b, /* s acute */
0xb3, 0x01,0x44, /* n acute */
0xb4, 0x01,0x42, /* l stroke */
0xb5, 0x00,0x20, /* empty */
-
+
0xb6, 0x01,0x48, /* n caron */
0xb7, 0x01,0x65, /* t caron */
-
+
0xb8, 0x00,0x20, /* empty */
-
+
0xb9, 0x01,0x7e, /* z caron */
0xba, 0x01,0xe7, /* g caron */
-
+
0xbb, 0x00,0x20, /* empty */
0xbc, 0x00,0x20, /* empty */
-
+
0xbd, 0x1e,0x20, /* G macron */
0xbe, 0x1e,0x21, /* g macron */
0xbf, 0x01,0x5e, /* S cedilla */
0xc0, 0x01,0x5f, /* s cedilla */
0xc1, 0x01,0x2f, /* i ogonek */ /* FIXME: not sure with this, it look like normal i */
0xc2, 0x01,0x31, /* i dotless */
0xc3, 0x01,0x68, /* U tilde */
0xc4, 0x01,0x50, /* O dbl acute */
0xc5, 0x01,0x69, /* u tilde */
0xc6, 0x01,0x51, /* o dbl acute */
0xc7, 0x27,0xa9, /* => */
0xc8, 0x27,0xa8, /* filled => */
0xc9, 0x00,0xd7, /* x */
0xca, 0x00,0x5d, /* ] */
0xcb, 0x26,0x0f, /* phone */
0xcc, 0x01,0x0f, /* d caron */
-
+
0xcd, 0x00,0x20, /* empty */
0xce, 0x00,0x7e, /* ~ */
0xcf, 0x00,0x5c, /* \ */
0xd0, 0x00,0x5e, /* ^ */
-
+
0xd1, 0x00,0x20, /* empty */
-
+
0xd2, 0x00,0x7b, /* { */
0xd3, 0x00,0x7c, /* | */
0xd4, 0x00,0x7d, /* } */
-
+
0xd5, 0x00,0x20, /* empty */
-
+
0xd6, 0x01,0x63, /* t cedilla */
-
+
0xd7, 0x00,0x20, /* empty */
0xd8, 0x00,0x20, /* empty */
0xd9, 0x00,0x20, /* empty */
0xda, 0x00,0x20, /* empty */
0xdb, 0x00,0x20, /* empty */
0xdc, 0x00,0x20, /* empty */
0xdd, 0x00,0x20, /* empty */
0xde, 0x00,0x20, /* empty */
0xdf, 0x00,0x20, /* empty */
0xe0, 0x00,0x20, /* empty */
-
+
0xe1, 0x00,0x20, /* two candles */ /* FIXME */
-
+
0xe2, 0x00,0x20, /* empty */
0xe3, 0x00,0x20, /* empty */
0xe4, 0x00,0x20, /* empty */
-
+
0xe5, 0x01,0xce, /* a caron */
0xe6, 0x01,0x01, /* a macron */
0xe7, 0x01,0x13, /* e macron */
0xe8, 0x01,0x2b, /* i macron */
0xe9, 0x01,0x4d, /* o macron */
0xea, 0x01,0x6b, /* u macron */
0xeb, 0x00,0x41, /* A */
0xec, 0x00,0x40, /* @ */
0xed, 0x00,0x20, /* some strange char :-) */ /* FIXME */
-
+
0xee, 0x00,0x20, /* big key stroken */ /* FIXME */
0xef, 0x00,0x20, /* big key */ /* FIXME */
-
+
0xf0, 0x00,0x20, /* empty */
-
+
0xf1, 0x00,0x31, /* 1 */
0xf2, 0x00,0x21, /* bold ! */
0xf3, 0x26,0x0e, /* black phone */
0xf4, 0x00,0x26, /* & */
0xf5, 0x23,0x7e, /* bell */
0xf6, 0x26,0x6a, /* note */
-
+
0xf7, 0x27,0x13, /* okay inv */ /* FIXME */
0xf8, 0x27,0x13, /* okay */
-
+
0xf9, 0x00,0x20, /* empty */
-
+
0xfa, 0x00,0x20, /* key */ /* FIXME */
-
+
0xfb, 0x00,0x20, /* empty */
-
+
0xfc, 0x20,0xac, /* Euro */
0xfd, 0x21,0x97, /* NE arrow */
0xfe, 0x21,0x98, /* SE arrow */
0xff, 0x00,0x20, /* empty */
-
+
0x00, 0x00,0x00
};
/* This is being called from atgen */
GSM_Error ALCATEL_ProtocolVersionReply (GSM_Protocol_Message msg, GSM_StateMachine *s)
{
char *str, *str2;
/*
@@ -310,30 +311,30 @@ static GSM_Error ALCATEL_SetBinaryMode(GSM_StateMachine *s)
GSM_Error error;
if (Priv->Mode == ModeBinary) return ERR_NONE;
dbgprintf ("Changing to binary mode\n");
error=GSM_WaitFor (s, "AT+IFC=2,2\r", 11, 0x02, 4, ID_SetFlowControl);
if (error != ERR_NONE) return error;
-
+
error=GSM_WaitFor (s, "AT+CPROT=?\r", 11, 0x02, 4, ID_AlcatelProtocol);
if (error != ERR_NONE) return error;
if (Priv->ProtocolVersion == V_1_0) {
error=GSM_WaitFor (s, "AT+CPROT=16,\"V1.0\",16\r", 22, 0x00, 4, ID_AlcatelConnect);
} else {
error=GSM_WaitFor (s, "AT+CPROT=16,\"V1.1\",16\r", 22, 0x00, 4, ID_AlcatelConnect);
}
-
+
if (error == ERR_TIMEOUT && s->Speed != 19200) {
smprintf(s, "HINT: Try changing speed to 19200, it is sometimes needed for Alcatel binary mode.\n");
}
-
+
if (error != ERR_NONE) return error;
dbgprintf ("Changing protocol to Alcabus\n");
s->Protocol.Functions = &ALCABUSProtocol;
error = s->Protocol.Functions->Initialise(s);
if (error != ERR_NONE) {
s->Protocol.Functions = &ATProtocol;
@@ -371,17 +372,17 @@ static GSM_Error ALCATEL_GoToBinaryState(GSM_StateMachine *s, GSM_Alcatel_Binary
{0x00, 0x04,
0x00, /*type */
0x22, 0x01, 0x00};
unsigned char begin_buffer[] =
{0x00, 0x04, 0x7C, 0x81,
0x00, /*type */
0x00, 0x85, 0x00};
unsigned char commit_buffer[] =
- {0x00, 0x04,
+ {0x00, 0x04,
0x00, /*type */
0x20, 0x01};
smprintf(s, "Alcatel state switcher: %d -> %d, %d -> %d, %d -> %d\n", Priv->BinaryState, state, Priv->BinaryType, type, Priv->BinaryItem, item);
error = ALCATEL_SetBinaryMode(s);
if (error != ERR_NONE) return error;
/* Do we need to do anything? */
@@ -438,17 +439,17 @@ static GSM_Error ALCATEL_GoToBinaryState(GSM_StateMachine *s, GSM_Alcatel_Binary
end_buffer[4] = ALCATEL_BEGIN_SYNC_CONTACTS;
break;
case TypeToDo:
end_buffer[4] = ALCATEL_BEGIN_SYNC_TODO;
break;
}
error=GSM_WaitFor (s, end_buffer, 9, 0x02, ALCATEL_TIMEOUT, ID_AlcatelEnd);
if (error != ERR_NONE) return error;
-
+
switch (Priv->BinaryType) {
case TypeCalendar:
close_buffer[2] = ALCATEL_SYNC_TYPE_CALENDAR;
break;
case TypeContacts:
close_buffer[2] = ALCATEL_SYNC_TYPE_CONTACTS;
break;
case TypeToDo:
@@ -539,16 +540,18 @@ static GSM_Error ALCATEL_SetATMode(GSM_StateMachine *s)
error = s->Protocol.Functions->Terminate(s);
if (error != ERR_NONE) return error;
dbgprintf ("Changing protocol to AT\n");
s->Protocol.Functions = &ATProtocol;
s->Phone.Functions->ReplyFunctions = ATGENReplyFunctions;
Priv->Mode = ModeAT;
+ s->Phone.Data.Priv.ATGEN.PBKCharset = 0;
+ s->Phone.Data.Priv.ATGEN.PBKMemory = 0;
my_sleep(100);
/* In case we don't send AT command short after closing binary mode,
* phone takes VERY long to react next time. The error code in
* intetionally ignored.
*/
GSM_WaitFor (s, "AT\r", 3, 0x00, 0, ID_IncomingFrame);
@@ -623,21 +626,21 @@ static GSM_Error ALCATEL_IsIdAvailable(GSM_StateMachine *s, int id) {
Priv->CurrentList = &(Priv->ContactsItems);
Priv->CurrentCount = &(Priv->ContactsItemsCount);
break;
case TypeToDo:
Priv->CurrentList = &(Priv->ToDoItems);
Priv->CurrentCount = &(Priv->ToDoItemsCount);
break;
}
-
+
for (i=0; i<*Priv->CurrentCount; i++) {
if ((*Priv->CurrentList)[i] == id) return ERR_NONE;
}
-
+
return ERR_EMPTY;
}
/* finds next id that is available in the phone */
static GSM_Error ALCATEL_GetNextId(GSM_StateMachine *s, int *id) {
GSM_Phone_ALCATELData *Priv = &s->Phone.Data.Priv.ALCATEL;
int i = 0;
int next = ALCATEL_MAX_LOCATION;
@@ -841,17 +844,17 @@ static GSM_Error ALCATEL_ReplyGetFieldValue(GSM_Protocol_Message msg, GSM_StateM
Priv->ReturnDateTime.Minute = 0;
Priv->ReturnDateTime.Second = 0;
} else if (buffer[1] == 0x06 && buffer[2] == 0x68) {
/* time */
Priv->ReturnType = Alcatel_time;
Priv->ReturnDateTime.Hour = buffer[4];
Priv->ReturnDateTime.Minute = buffer[5];
Priv->ReturnDateTime.Second = buffer[6];
-
+
Priv->ReturnDateTime.Day = 0;
Priv->ReturnDateTime.Month = 0;
Priv->ReturnDateTime.Year = 0;
Priv->ReturnDateTime.Timezone = 0;
} else if (buffer[1] == 0x08 && buffer[2] == 0x3C) {
/* string */
Priv->ReturnType = Alcatel_string;
if (GSM_PHONEBOOK_TEXT_LENGTH < buffer[3])
@@ -1091,22 +1094,22 @@ static GSM_Error ALCATEL_ReplyGetCategoryText(GSM_Protocol_Message msg, GSM_Stat
}
return ERR_NONE;
}
static GSM_Error ALCATEL_GetCategoryText(GSM_StateMachine *s, int id) {
unsigned char buffer[] = {0x00, 0x04, 0x00 /*type*/, 0x0c, 0x00 /*list*/, 0x0A, 0x01, 0x00 /*item*/ };
GSM_Phone_ALCATELData *Priv = &s->Phone.Data.Priv.ALCATEL;
GSM_Error error;
-
+
if (Priv->CurrentCategoriesCache[id][0] != '\000' || Priv->CurrentCategoriesCache[id][1] != '\000') {
CopyUnicodeString(Priv->ReturnString, Priv->CurrentCategoriesCache[id]);
return ERR_NONE;
}
-
+
smprintf(s,"Reading category %d\n", id);
switch (Priv->BinaryType) {
case TypeContacts:
buffer[2] = ALCATEL_SYNC_TYPE_CONTACTS;
buffer[4] = ALCATEL_LIST_CONTACTS_CAT;
break;
case TypeToDo:
@@ -1118,17 +1121,17 @@ static GSM_Error ALCATEL_GetCategoryText(GSM_StateMachine *s, int id) {
}
buffer[7] = (id & 0xff);
error=GSM_WaitFor (s, buffer, 8, 0x02, ALCATEL_TIMEOUT, ID_AlcatelGetCategoryText1);
if (error != ERR_NONE) return error;
error=GSM_WaitFor (s, 0, 0, 0x00, ALCATEL_TIMEOUT, ID_AlcatelGetCategoryText2);
if (error != ERR_NONE) return error;
-
+
CopyUnicodeString(Priv->CurrentCategoriesCache[id], Priv->ReturnString);
return ERR_NONE;
}
static GSM_Error ALCATEL_DeleteField(GSM_StateMachine *s, int id, int field) {
GSM_Phone_ALCATELData *Priv = &s->Phone.Data.Priv.ALCATEL;
GSM_Error error;
@@ -1208,19 +1211,19 @@ static GSM_Error ALCATEL_DeleteItem(GSM_StateMachine *s, int id) {
static GSM_Error ALCATEL_ReplyDeleteItem(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
if (msg.Buffer[8] != 0x25) return ERR_UNKNOWNRESPONSE;
return ERR_NONE;
}
static GSM_Error ALCATEL_BuildWriteBuffer(unsigned char * buffer, GSM_Alcatel_FieldType type, int field, void *data) {
int len;
-
+
buffer[1] = field & 0xff;
-
+
switch(type) {
case Alcatel_date:
if (!CheckDate((GSM_DateTime *)data)) return ERR_INVALIDDATETIME;
buffer[3] = 0x05;
buffer[4] = 0x67;
buffer[0] = 0x09;
@@ -1324,38 +1327,38 @@ static GSM_Error ALCATEL_CreateField(GSM_StateMachine *s, GSM_Alcatel_FieldType
buffer[2] = ALCATEL_SYNC_TYPE_CONTACTS;
break;
case TypeToDo:
buffer[2] = ALCATEL_SYNC_TYPE_TODO;
break;
}
error = ALCATEL_BuildWriteBuffer(buffer + 6, type, field, data);
if (error != ERR_NONE) return error;
-
+
error = GSM_WaitFor (s, buffer, 8 + buffer[6], 0x02, ALCATEL_TIMEOUT, ID_AlcatelCreateField);
if (error != ERR_NONE) return error;
-
+
return ERR_NONE;
}
static GSM_Error ALCATEL_UpdateField(GSM_StateMachine *s, GSM_Alcatel_FieldType type, int id, int field, void *data) {
GSM_Phone_ALCATELData *Priv = &s->Phone.Data.Priv.ALCATEL;
GSM_Error error;
unsigned char buffer[200] =
{0x00, 0x04,
0x00, /* type */
- 0x26, 0x01,
+ 0x26, 0x01,
0x00, 0x00, 0x00, 0x00, /* id */
0x65,
0x00, /* length of remaining part */
0x00, /* field */
0x37}; /* data follows here */
smprintf(s,"Updating field (%08x.%02x)\n", id, field);
-
+
buffer[5] = (id >> 24);
buffer[6] = ((id >> 16) & 0xff);
buffer[7] = ((id >> 8) & 0xff);
buffer[8] = (id & 0xff);
switch (Priv->BinaryType) {
case TypeCalendar:
buffer[2] = ALCATEL_SYNC_TYPE_CALENDAR;
@@ -1364,20 +1367,20 @@ static GSM_Error ALCATEL_UpdateField(GSM_StateMachine *s, GSM_Alcatel_FieldType
buffer[2] = ALCATEL_SYNC_TYPE_CONTACTS;
break;
case TypeToDo:
buffer[2] = ALCATEL_SYNC_TYPE_TODO;
break;
}
error = ALCATEL_BuildWriteBuffer(buffer + 10, type, field, data);
if (error != ERR_NONE) return error;
-
+
error = GSM_WaitFor (s, buffer, 12 + buffer[10], 0x02, ALCATEL_TIMEOUT, ID_AlcatelUpdateField);
if (error != ERR_NONE) return error;
-
+
return ERR_NONE;
}
static GSM_Error ALCATEL_GetManufacturer(GSM_StateMachine *s)
{
strcpy(s->Phone.Data.Manufacturer, "Alcatel");
return ERR_NONE;
}
@@ -1738,17 +1741,17 @@ static GSM_Error ALCATEL_GetNextMemory(GSM_StateMachine *s, GSM_MemoryEntry *ent
{
GSM_Error error;
GSM_Phone_ALCATELData *Priv = &s->Phone.Data.Priv.ALCATEL;
if (entry->MemoryType == MEM_ME) {
if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeContacts, 0))!= ERR_NONE) return error;
if ((error = ALCATEL_GetAvailableIds(s, false))!= ERR_NONE) return error;
if (Priv->ContactsItemsCount == 0) return ERR_EMPTY;
-
+
if (start) entry->Location = 0;
if ((error = ALCATEL_GetNextId(s, &(entry->Location))) != ERR_NONE) return error;
return ALCATEL_GetMemory(s, entry);
} else {
if ((error = ALCATEL_SetATMode(s))!= ERR_NONE) return error;
return ATGEN_GetNextMemory(s, entry, start);
}
@@ -1763,26 +1766,26 @@ static GSM_Error ALCATEL_AddMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
int i;
if (entry->MemoryType == MEM_ME) {
if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeContacts, 0))!= ERR_NONE) return error;
if ((error = ALCATEL_GoToBinaryState(s, StateEdit, TypeContacts, 0))!= ERR_NONE) return error;
for (i = 0; i < entry->EntriesNum; i++) {
switch (entry->Entries[i].EntryType) {
- case PBK_Number_General:
+ case PBK_Number_General:
if ((error = ALCATEL_CreateField(s, Alcatel_phone, 8, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
case PBK_Number_Mobile:
if ((error = ALCATEL_CreateField(s, Alcatel_phone, 12, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
case PBK_Number_Work:
if ((error = ALCATEL_CreateField(s, Alcatel_phone, 7, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
- case PBK_Number_Fax:
+ case PBK_Number_Fax:
if ((error = ALCATEL_CreateField(s, Alcatel_phone, 9, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
case PBK_Number_Home:
if ((error = ALCATEL_CreateField(s, Alcatel_phone, 13, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
case PBK_Number_Pager:
if ((error = ALCATEL_CreateField(s, Alcatel_phone, 11, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
@@ -1804,23 +1807,23 @@ static GSM_Error ALCATEL_AddMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
break;
case PBK_Text_FirstName:
if ((error = ALCATEL_CreateField(s, Alcatel_string, 1, entry->Entries[i].Text)) != ERR_NONE) return error;
NameSet = true;
break;
case PBK_Text_Company:
if ((error = ALCATEL_CreateField(s, Alcatel_string, 2, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
- case PBK_Text_JobTitle:
+ case PBK_Text_JobTitle:
if ((error = ALCATEL_CreateField(s, Alcatel_string, 3, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
- case PBK_Category:
+ case PBK_Category:
if ((error = ALCATEL_CreateField(s, Alcatel_byte, 5, &(entry->Entries[i].Number))) != ERR_NONE) return error;
break;
- case PBK_Private:
+ case PBK_Private:
if ((error = ALCATEL_CreateField(s, Alcatel_bool, 6, &(entry->Entries[i].Number))) != ERR_NONE) return error;
break;
case PBK_Text_StreetAddress:
if ((error = ALCATEL_CreateField(s, Alcatel_string, 16, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
case PBK_Text_City:
if ((error = ALCATEL_CreateField(s, Alcatel_string, 17, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
@@ -1835,22 +1838,22 @@ static GSM_Error ALCATEL_AddMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
break;
case PBK_Text_Custom1:
if ((error = ALCATEL_CreateField(s, Alcatel_string, 21, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
case PBK_Text_Custom2:
if ((error = ALCATEL_CreateField(s, Alcatel_string, 22, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
case PBK_Text_Custom3:
- if ((error = ALCATEL_CreateField(s, Alcatel_string, 23, entry->Entries[i].Text)) != ERR_NONE) return error;
+ if ((error = ALCATEL_CreateField(s, Alcatel_string, 23, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
case PBK_Text_Custom4:
if ((error = ALCATEL_CreateField(s, Alcatel_string, 24, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
- case PBK_PictureID:
+ case PBK_PictureID:
if (s->Phone.Data.Priv.ALCATEL.ProtocolVersion == V_1_1) {
if ((error = ALCATEL_CreateField(s, Alcatel_int, 25, &(entry->Entries[i].Number))) != ERR_NONE) return error;
} else {
smprintf(s,"WARNING: Ignoring entry %d, not supported by phone\n", entry->Entries[i].EntryType);
}
break;
case PBK_Text_Name: NamePosition = i; break;
@@ -1901,123 +1904,123 @@ static GSM_Error ALCATEL_SetMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
/* Save modified entry */
if ((error = ALCATEL_GetAvailableIds(s, false))!= ERR_NONE) return error;
if ((error = ALCATEL_IsIdAvailable(s, entry->Location))!= ERR_NONE) {
/* Entry doesn't exist, we will create new one */
return ALCATEL_AddMemory(s, entry);
}
/* Get fields for current item */
if ((error = ALCATEL_GetFields(s, entry->Location))!= ERR_NONE) return error;
-
+
for (i = 0; i < 26; i++) { UpdatedFields[i] = false; }
-
+
if ((error = ALCATEL_GoToBinaryState(s, StateEdit, TypeContacts, entry->Location))!= ERR_NONE) return error;
for (i = 0; i < entry->EntriesNum; i++) {
switch (entry->Entries[i].EntryType) {
- case PBK_Number_General:
- UpdatedFields[8] = true;
- if ((error = ALCATEL_UpdateField(s, Alcatel_phone, entry->Location, 8, entry->Entries[i].Text)) != ERR_NONE) return error;
+ case PBK_Number_General:
+ UpdatedFields[8] = true;
+ if ((error = ALCATEL_UpdateField(s, Alcatel_phone, entry->Location, 8, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
- case PBK_Number_Mobile:
- UpdatedFields[12] = true;
- if ((error = ALCATEL_UpdateField(s, Alcatel_phone, entry->Location, 12, entry->Entries[i].Text)) != ERR_NONE) return error;
+ case PBK_Number_Mobile:
+ UpdatedFields[12] = true;
+ if ((error = ALCATEL_UpdateField(s, Alcatel_phone, entry->Location, 12, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
- case PBK_Number_Work:
- UpdatedFields[7] = true;
- if ((error = ALCATEL_UpdateField(s, Alcatel_phone, entry->Location, 7, entry->Entries[i].Text)) != ERR_NONE) return error;
+ case PBK_Number_Work:
+ UpdatedFields[7] = true;
+ if ((error = ALCATEL_UpdateField(s, Alcatel_phone, entry->Location, 7, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
- case PBK_Number_Fax:
- UpdatedFields[9] = true;
- if ((error = ALCATEL_UpdateField(s, Alcatel_phone, entry->Location, 9, entry->Entries[i].Text)) != ERR_NONE) return error;
+ case PBK_Number_Fax:
+ UpdatedFields[9] = true;
+ if ((error = ALCATEL_UpdateField(s, Alcatel_phone, entry->Location, 9, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
- case PBK_Number_Home:
- UpdatedFields[13] = true;
- if ((error = ALCATEL_UpdateField(s, Alcatel_phone, entry->Location, 13, entry->Entries[i].Text)) != ERR_NONE) return error;
+ case PBK_Number_Home:
+ UpdatedFields[13] = true;
+ if ((error = ALCATEL_UpdateField(s, Alcatel_phone, entry->Location, 13, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
- case PBK_Number_Pager:
- UpdatedFields[11] = true;
+ case PBK_Number_Pager:
+ UpdatedFields[11] = true;
if ((error = ALCATEL_UpdateField(s, Alcatel_phone, entry->Location, 11, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
case PBK_Number_Other:
UpdatedFields[10] = true;
- if ((error = ALCATEL_UpdateField(s, Alcatel_phone, entry->Location, 10, entry->Entries[i].Text)) != ERR_NONE) return error;
+ if ((error = ALCATEL_UpdateField(s, Alcatel_phone, entry->Location, 10, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
- case PBK_Text_Note:
+ case PBK_Text_Note:
UpdatedFields[4] = true;
- if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 4, entry->Entries[i].Text)) != ERR_NONE) return error;
+ if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 4, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
- case PBK_Text_Email:
- UpdatedFields[14] = true;
+ case PBK_Text_Email:
+ UpdatedFields[14] = true;
if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 14, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
- case PBK_Text_Email2:
- UpdatedFields[15] = true;
- if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 15, entry->Entries[i].Text)) != ERR_NONE) return error;
+ case PBK_Text_Email2:
+ UpdatedFields[15] = true;
+ if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 15, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
- case PBK_Text_LastName:
- UpdatedFields[0] = true;
- if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 0, entry->Entries[i].Text)) != ERR_NONE) return error; NameSet = true;
+ case PBK_Text_LastName:
+ UpdatedFields[0] = true;
+ if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 0, entry->Entries[i].Text)) != ERR_NONE) return error; NameSet = true;
break;
- case PBK_Text_FirstName:
- UpdatedFields[1] = true;
- if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 1, entry->Entries[i].Text)) != ERR_NONE) return error; NameSet = true;
+ case PBK_Text_FirstName:
+ UpdatedFields[1] = true;
+ if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 1, entry->Entries[i].Text)) != ERR_NONE) return error; NameSet = true;
break;
case PBK_Text_Company:
- UpdatedFields[2] = true;
- if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 2, entry->Entries[i].Text)) != ERR_NONE) return error;
+ UpdatedFields[2] = true;
+ if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 2, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
- case PBK_Text_JobTitle:
+ case PBK_Text_JobTitle:
UpdatedFields[3] = true;
if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 3, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
case PBK_Category:
- UpdatedFields[5] = true;
+ UpdatedFields[5] = true;
if ((error = ALCATEL_UpdateField(s, Alcatel_byte, entry->Location, 5, &(entry->Entries[i].Number))) != ERR_NONE) return error;
break;
case PBK_Private:
UpdatedFields[6] = true;
if ((error = ALCATEL_UpdateField(s, Alcatel_bool, entry->Location, 6, &(entry->Entries[i].Number))) != ERR_NONE) return error;
break;
- case PBK_Text_StreetAddress:
+ case PBK_Text_StreetAddress:
UpdatedFields[16] = true;
- if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 16, entry->Entries[i].Text)) != ERR_NONE) return error;
+ if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 16, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
- case PBK_Text_City:
- UpdatedFields[17] = true;
- if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 17, entry->Entries[i].Text)) != ERR_NONE) return error;
+ case PBK_Text_City:
+ UpdatedFields[17] = true;
+ if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 17, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
- case PBK_Text_State:
- UpdatedFields[18] = true;
- if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 18, entry->Entries[i].Text)) != ERR_NONE) return error;
+ case PBK_Text_State:
+ UpdatedFields[18] = true;
+ if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 18, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
- case PBK_Text_Zip:
- UpdatedFields[19] = true;
- if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 19, entry->Entries[i].Text)) != ERR_NONE) return error;
+ case PBK_Text_Zip:
+ UpdatedFields[19] = true;
+ if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 19, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
case PBK_Text_Country:
UpdatedFields[20] = true;
if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 20, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
case PBK_Text_Custom1:
UpdatedFields[21] = true;
if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 21, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
- case PBK_Text_Custom2:
+ case PBK_Text_Custom2:
UpdatedFields[22] = true;
if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 22, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
case PBK_Text_Custom3:
UpdatedFields[23] = true;
if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 23, entry->Entries[i].Text)) != ERR_NONE) return error;
break;
case PBK_Text_Custom4:
- UpdatedFields[24] = true;
+ UpdatedFields[24] = true;
if ((error = ALCATEL_UpdateField(s, Alcatel_string, entry->Location, 24, entry->Entries[i].Text)) != ERR_NONE) return error
; break;
- case PBK_PictureID:
+ case PBK_PictureID:
if (s->Phone.Data.Priv.ALCATEL.ProtocolVersion == V_1_1) {
UpdatedFields[25] = true;
if ((error = ALCATEL_UpdateField(s, Alcatel_int, entry->Location, 25, &(entry->Entries[i].Number))) != ERR_NONE) return error;
} else {
smprintf(s,"WARNING: Ignoring entry %d, not supported by phone\n", entry->Entries[i].EntryType);
}
break;
@@ -2064,21 +2067,21 @@ static GSM_Error ALCATEL_DeleteMemory(GSM_StateMachine *s, GSM_MemoryEntry *entr
if ((error = ALCATEL_GetAvailableIds(s, false))!= ERR_NONE) return error;
if ((error = ALCATEL_IsIdAvailable(s, entry->Location))!= ERR_NONE) {
/* Entry was empty => no error */
return ERR_NONE;
}
/* Do real delete */
error = ALCATEL_DeleteItem(s, entry->Location);
if (error != ERR_NONE) return error;
-
+
/* Refresh list */
if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeContacts, 0))!= ERR_NONE) return error;
if ((error = ALCATEL_GetAvailableIds(s, true))!= ERR_NONE) return error;
-
+
return ERR_NONE;
} else {
if ((error = ALCATEL_SetATMode(s))!= ERR_NONE) return error;
return ATGEN_DeleteMemory(s, entry);
}
}
static GSM_Error ALCATEL_DeleteAllMemory(GSM_StateMachine *s, GSM_MemoryType type)
@@ -2223,17 +2226,17 @@ static GSM_Error ALCATEL_GetNetworkInfo(GSM_StateMachine *s, GSM_NetworkInfo *ne
static GSM_Error ALCATEL_GetDisplayStatus(GSM_StateMachine *s, GSM_DisplayFeatures *features)
{
GSM_Error error;
if ((error = ALCATEL_SetATMode(s))!= ERR_NONE) return error;
return ATGEN_GetDisplayStatus(s, features);
}
-
+
static GSM_Error ALCATEL_SetAutoNetworkLogin(GSM_StateMachine *s)
{
GSM_Error error;
if ((error = ALCATEL_SetATMode(s))!= ERR_NONE) return error;
return ATGEN_SetAutoNetworkLogin(s);
}
@@ -2332,19 +2335,19 @@ static GSM_Error ALCATEL_GetSIMIMSI(GSM_StateMachine *s, char *IMSI)
if ((error = ALCATEL_SetATMode(s))!= ERR_NONE) return error;
return ATGEN_GetSIMIMSI(s, IMSI);
}
static GSM_Error ALCATEL_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus *status)
{
GSM_Error error;
GSM_Phone_ALCATELData *Priv = &s->Phone.Data.Priv.ALCATEL;
-
+
status->Used = 0;
-
+
if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeCalendar, 0))!= ERR_NONE) return error;
if ((error = ALCATEL_GetAvailableIds(s, true))!= ERR_NONE) return error;
status->Used = Priv->CalendarItemsCount;
return ERR_NONE;
}
static GSM_Error ALCATEL_GetCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note)
@@ -2722,17 +2725,17 @@ static GSM_Error ALCATEL_GetCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Not
static GSM_Error ALCATEL_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start)
{
GSM_Error error;
GSM_Phone_ALCATELData *Priv = &s->Phone.Data.Priv.ALCATEL;
if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeCalendar, 0))!= ERR_NONE) return error;
if ((error = ALCATEL_GetAvailableIds(s, false))!= ERR_NONE) return error;
if (Priv->CalendarItemsCount == 0) return ERR_EMPTY;
-
+
if (start) Note->Location = 0;
if ((error = ALCATEL_GetNextId(s, &(Note->Location))) != ERR_NONE) return error;
return ALCATEL_GetCalendar(s, Note);
}
static GSM_Error ALCATEL_DeleteCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note)
@@ -2763,17 +2766,17 @@ static GSM_Error ALCATEL_AddCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Not
bool phone_set = false;
bool date_set = false;
bool repeating = false;
int i;
GSM_Phone_ALCATELData *Priv = &s->Phone.Data.Priv.ALCATEL;
if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeCalendar, 0))!= ERR_NONE) return error;
if ((error = ALCATEL_GoToBinaryState(s, StateEdit, TypeCalendar, 0))!= ERR_NONE) return error;
-
+
for (i = 0; i < Note->EntriesNum; i++) {
switch (Note->Entries[i].EntryType) {
case CAL_START_DATETIME:
if (!date_set) {
if ((error = ALCATEL_CreateField(s, Alcatel_date, 0, &(Note->Entries[i].Date))) != ERR_NONE) return error;
date_set = true;
}
if ((error = ALCATEL_CreateField(s, Alcatel_time, 1, &(Note->Entries[i].Date))) != ERR_NONE) return error;
@@ -2801,17 +2804,17 @@ static GSM_Error ALCATEL_AddCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Not
break;
case CAL_CONTACTID:
if ((error = ALCATEL_CreateField(s, Alcatel_int, 8, &(Note->Entries[i].Number))) != ERR_NONE) return error;
contact_set = true;
break;
case CAL_PHONE:
if ((error = ALCATEL_CreateField(s, Alcatel_phone, 9, Note->Entries[i].Text)) != ERR_NONE) return error;
phone_set = true;
- break;
+ break;
case CAL_REPEAT_DAYOFWEEK:
if ((error = ALCATEL_CreateField(s, Alcatel_byte, 10, &(Note->Entries[i].Number))) != ERR_NONE) return error;
repeating = true;
break;
case CAL_REPEAT_DAY:
if ((error = ALCATEL_CreateField(s, Alcatel_byte, 11, &(Note->Entries[i].Number))) != ERR_NONE) return error;
repeating = true;
break;
@@ -2837,17 +2840,17 @@ static GSM_Error ALCATEL_AddCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Not
break;
case CAL_SILENT_ALARM_DATETIME:
case CAL_RECURRANCE:
case CAL_LOCATION:
smprintf(s,"WARNING: Ignoring entry %d, not supported by phone\n", Note->Entries[i].EntryType);
break;
}
}
-
+
switch (Note->Type) {
case GSM_CAL_CALL:
val = 3;
break;
case GSM_CAL_BIRTHDAY:
val = 2;
break;
case GSM_CAL_ALARM:
@@ -2895,26 +2898,26 @@ static GSM_Error ALCATEL_SetCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Not
if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeCalendar, 0))!= ERR_NONE) return error;
if ((error = ALCATEL_GetAvailableIds(s, false))!= ERR_NONE) return error;
if ((error = ALCATEL_IsIdAvailable(s, Note->Location))!= ERR_NONE) {
/* Entry doesn't exist, we will create new one */
return ALCATEL_AddCalendar(s, Note);
}
/* Get fields for current item */
if ((error = ALCATEL_GetFields(s, Note->Location))!= ERR_NONE) return error;
-
+
for (i = 0; i < 22; i++) { UpdatedFields[i] = false; }
if ((error = ALCATEL_GoToBinaryState(s, StateEdit, TypeCalendar, Note->Location))!= ERR_NONE) return error;
-
+
for (i = 0; i < Note->EntriesNum; i++) {
switch (Note->Entries[i].EntryType) {
case CAL_START_DATETIME:
if (!date_set) {
- UpdatedFields[0] = true;
+ UpdatedFields[0] = true;
if ((error = ALCATEL_UpdateField(s, Alcatel_date, Note->Location, 0, &(Note->Entries[i].Date))) != ERR_NONE) return error;
date_set = true;
}
UpdatedFields[1] = true;
if ((error = ALCATEL_UpdateField(s, Alcatel_time, Note->Location, 1, &(Note->Entries[i].Date))) != ERR_NONE) return error;
break;
case CAL_END_DATETIME:
if (!date_set) {
@@ -2948,17 +2951,17 @@ static GSM_Error ALCATEL_SetCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Not
UpdatedFields[8] = true;
if ((error = ALCATEL_UpdateField(s, Alcatel_int, Note->Location, 8, &(Note->Entries[i].Number))) != ERR_NONE) return error;
contact_set = true;
break;
case CAL_PHONE:
UpdatedFields[9] = true;
if ((error = ALCATEL_UpdateField(s, Alcatel_phone, Note->Location, 9, Note->Entries[i].Text)) != ERR_NONE) return error;
phone_set = true;
- break;
+ break;
case CAL_REPEAT_DAYOFWEEK:
UpdatedFields[10] = true;
if ((error = ALCATEL_UpdateField(s, Alcatel_byte, Note->Location, 10, &(Note->Entries[i].Number))) != ERR_NONE) return error;
repeating = true;
break;
case CAL_REPEAT_DAY:
UpdatedFields[11] = true;
if ((error = ALCATEL_UpdateField(s, Alcatel_byte, Note->Location, 11, &(Note->Entries[i].Number))) != ERR_NONE) return error;
@@ -2991,17 +2994,17 @@ static GSM_Error ALCATEL_SetCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Not
break;
case CAL_SILENT_ALARM_DATETIME:
case CAL_RECURRANCE:
case CAL_LOCATION:
smprintf(s,"WARNING: Ignoring entry %d, not supported by phone\n", Note->Entries[i].EntryType);
break;
}
}
-
+
switch (Note->Type) {
case GSM_CAL_CALL:
val = 3;
break;
case GSM_CAL_BIRTHDAY:
val = 2;
break;
case GSM_CAL_ALARM:
@@ -3067,17 +3070,17 @@ static GSM_Error ALCATEL_GetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm)
int i;
bool Found = false;
bool DateSet = false;
int alarm_number = alarm->Location;
static GSM_DateTime nulldt = {0,0,0,0,0,0,0};
if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeCalendar, 0))!= ERR_NONE) return error;
if ((error = ALCATEL_GetAvailableIds(s, false))!= ERR_NONE) return error;
-
+
for (i=0; i<Priv->CalendarItemsCount; i++) {
if ((error = ALCATEL_GetFieldValue(s, Priv->CalendarItems[i], 7))!= ERR_NONE) return error;
if (Priv->ReturnType != Alcatel_enum) {
smprintf(s,"WARNING: Received unexpected type %02X, ignoring\n", Priv->ReturnType);
continue;
}
if (Priv->ReturnInt == 4 || Priv->ReturnInt == 5) {
alarm_number--;
@@ -3086,25 +3089,25 @@ static GSM_Error ALCATEL_GetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm)
break;
}
}
}
if (!Found) return ERR_EMPTY;
Note.Location = Priv->CalendarItems[i];
-
+
if ((error = ALCATEL_GetCalendar(s, &Note))!= ERR_NONE) return error;
if (Note.Type == GSM_CAL_ALARM) {
alarm->Repeating = false;
} else {
alarm->Repeating = true;
}
-
+
alarm->Text[0] = 0; alarm->Text[1] = 0;
for (i = 0; i < Note.EntriesNum; i++) {
if (Note.Entries[i].EntryType == CAL_TEXT) {
CopyUnicodeString(alarm->Text, Note.Entries[i].Text);
} else if (Note.Entries[i].EntryType == CAL_ALARM_DATETIME) {
alarm->DateTime = Note.Entries[i].Date;
@@ -3141,17 +3144,17 @@ static GSM_Error ALCATEL_SetAlarm (GSM_StateMachine *s, GSM_Alarm *alarm)
if (Priv->ReturnInt == 4 || Priv->ReturnInt == 5) {
alarm_number--;
if (alarm_number == 0) {
Found = true;
break;
}
}
}
-
+
if (Found) {
Note.Location = Priv->CalendarItems[i];
}
Note.EntriesNum = 1;
Note.Entries[0].EntryType = CAL_ALARM_DATETIME;
Note.Entries[0].Date = alarm->DateTime;
@@ -3179,19 +3182,19 @@ static GSM_Error ALCATEL_SetAlarm (GSM_StateMachine *s, GSM_Alarm *alarm)
}
}
static GSM_Error ALCATEL_GetToDoStatus(GSM_StateMachine *s, GSM_ToDoStatus *status)
{
GSM_Error error;
GSM_Phone_ALCATELData *Priv = &s->Phone.Data.Priv.ALCATEL;
-
+
status->Used = 0;
-
+
if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeToDo, 0))!= ERR_NONE) return error;
if ((error = ALCATEL_GetAvailableIds(s, true))!= ERR_NONE) return error;
status->Used = Priv->ToDoItemsCount;
return ERR_NONE;
}
static GSM_Error ALCATEL_GetToDo (GSM_StateMachine *s, GSM_ToDoEntry *ToDo)
@@ -3446,17 +3449,17 @@ static GSM_Error ALCATEL_GetToDo (GSM_StateMachine *s, GSM_ToDoEntry *ToDo)
static GSM_Error ALCATEL_GetNextToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool start)
{
GSM_Error error;
GSM_Phone_ALCATELData *Priv = &s->Phone.Data.Priv.ALCATEL;
if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeToDo, 0))!= ERR_NONE) return error;
if ((error = ALCATEL_GetAvailableIds(s, false))!= ERR_NONE) return error;
if (Priv->ToDoItemsCount == 0) return ERR_EMPTY;
-
+
if (start) ToDo->Location = 0;
if ((error = ALCATEL_GetNextId(s, &(ToDo->Location))) != ERR_NONE) return error;
return ALCATEL_GetToDo(s, ToDo);
}
static GSM_Error ALCATEL_DeleteAllToDo (GSM_StateMachine *s)
{
@@ -3485,17 +3488,17 @@ static GSM_Error ALCATEL_AddToDo (GSM_StateMachine *s, GSM_ToDoEntry *ToDo)
unsigned int val;
bool contact_set = false;
bool phone_set = false;
int i;
GSM_Phone_ALCATELData *Priv = &s->Phone.Data.Priv.ALCATEL;
if ((error = ALCATEL_GoToBinaryState(s, StateSession, TypeToDo, 0))!= ERR_NONE) return error;
if ((error = ALCATEL_GoToBinaryState(s, StateEdit, TypeToDo, 0))!= ERR_NONE) return error;
-
+
switch (ToDo->Priority) {
case GSM_Priority_High:
val = 0;
break;
case GSM_Priority_Low:
val = 2;
break;
case GSM_Priority_Medium:
@@ -3513,17 +3516,17 @@ static GSM_Error ALCATEL_AddToDo (GSM_StateMachine *s, GSM_ToDoEntry *ToDo)
for (i = 0; i < ToDo->EntriesNum; i++) {
switch (ToDo->Entries[i].EntryType) {
case TODO_END_DATETIME:
if ((error = ALCATEL_CreateField(s, Alcatel_date, 0, &(ToDo->Entries[i].Date))) != ERR_NONE) return error;
break;
case TODO_COMPLETED:
if ((error = ALCATEL_CreateField(s, Alcatel_bool, 1, &(ToDo->Entries[i].Number))) != ERR_NONE) return error;
break;
- case TODO_ALARM_DATETIME:
+ case TODO_ALARM_DATETIME:
if ((error = ALCATEL_CreateField(s, Alcatel_date, 2, &(ToDo->Entries[i].Date))) != ERR_NONE) return error;
if ((error = ALCATEL_CreateField(s, Alcatel_time, 3, &(ToDo->Entries[i].Date))) != ERR_NONE) return error;
if ((error = ALCATEL_CreateField(s, Alcatel_date, 10, &(ToDo->Entries[i].Date))) != ERR_NONE) return error;
if ((error = ALCATEL_CreateField(s, Alcatel_time, 11, &(ToDo->Entries[i].Date))) != ERR_NONE) return error;
break;
case TODO_TEXT:
if ((error = ALCATEL_CreateField(s, Alcatel_string, 4, ToDo->Entries[i].Text)) != ERR_NONE) return error;
break;
@@ -3574,19 +3577,19 @@ static GSM_Error ALCATEL_SetToDo (GSM_StateMachine *s, GSM_ToDoEntry *ToDo)
/* Save modified ToDo */
if ((error = ALCATEL_GetAvailableIds(s, false))!= ERR_NONE) return error;
if ((error = ALCATEL_IsIdAvailable(s, ToDo->Location))!= ERR_NONE) {
/* Entry doesn't exist, we will create new one */
return ALCATEL_AddToDo(s, ToDo);
}
/* Get fields for current item */
if ((error = ALCATEL_GetFields(s, ToDo->Location))!= ERR_NONE) return error;
-
+
for (i = 0; i < 12; i++) { UpdatedFields[i] = false; }
-
+
if ((error = ALCATEL_GoToBinaryState(s, StateEdit, TypeToDo, ToDo->Location))!= ERR_NONE) return error;
switch (ToDo->Priority) {
case GSM_Priority_High:
val = 0;
break;
case GSM_Priority_Low:
val = 2;
@@ -3603,52 +3606,52 @@ static GSM_Error ALCATEL_SetToDo (GSM_StateMachine *s, GSM_ToDoEntry *ToDo)
if ((error = ALCATEL_UpdateField(s, Alcatel_enum, ToDo->Location, 7, &val)) != ERR_NONE) return error;
}
UpdatedFields[7] = true;
for (i = 0; i < ToDo->EntriesNum; i++) {
switch (ToDo->Entries[i].EntryType) {
case TODO_END_DATETIME:
if ((error = ALCATEL_UpdateField(s, Alcatel_date, ToDo->Location, 0, &(ToDo->Entries[i].Date))) != ERR_NONE) return error;
- UpdatedFields[0] = true;
+ UpdatedFields[0] = true;
break;
case TODO_COMPLETED:
if ((error = ALCATEL_UpdateField(s, Alcatel_bool, ToDo->Location, 1, &(ToDo->Entries[i].Number))) != ERR_NONE) return error;
- UpdatedFields[1] = true;
+ UpdatedFields[1] = true;
break;
- case TODO_ALARM_DATETIME:
+ case TODO_ALARM_DATETIME:
if ((error = ALCATEL_UpdateField(s, Alcatel_date, ToDo->Location, 2, &(ToDo->Entries[i].Date))) != ERR_NONE) return error;
- UpdatedFields[2] = true;
+ UpdatedFields[2] = true;
if ((error = ALCATEL_UpdateField(s, Alcatel_time, ToDo->Location, 3, &(ToDo->Entries[i].Date))) != ERR_NONE) return error;
- UpdatedFields[3] = true;
+ UpdatedFields[3] = true;
if ((error = ALCATEL_UpdateField(s, Alcatel_date, ToDo->Location, 10, &(ToDo->Entries[i].Date))) != ERR_NONE) return error;
- UpdatedFields[10] = true;
+ UpdatedFields[10] = true;
if ((error = ALCATEL_UpdateField(s, Alcatel_time, ToDo->Location, 11, &(ToDo->Entries[i].Date))) != ERR_NONE) return error;
- UpdatedFields[11] = true;
+ UpdatedFields[11] = true;
break;
case TODO_TEXT:
if ((error = ALCATEL_UpdateField(s, Alcatel_string, ToDo->Location, 4, ToDo->Entries[i].Text)) != ERR_NONE) return error;
- UpdatedFields[4] = true;
+ UpdatedFields[4] = true;
break;
case TODO_PRIVATE:
if ((error = ALCATEL_UpdateField(s, Alcatel_bool, ToDo->Location, 5, &(ToDo->Entries[i].Number))) != ERR_NONE) return error;
- UpdatedFields[5] = true;
+ UpdatedFields[5] = true;
break;
case TODO_CATEGORY:
if ((error = ALCATEL_UpdateField(s, Alcatel_byte, ToDo->Location, 6, &(ToDo->Entries[i].Number))) != ERR_NONE) return error;
- UpdatedFields[6] = true;
+ UpdatedFields[6] = true;
break;
case TODO_CONTACTID:
if ((error = ALCATEL_UpdateField(s, Alcatel_int, ToDo->Location, 8, &(ToDo->Entries[i].Number))) != ERR_NONE) return error;
- UpdatedFields[8] = true;
+ UpdatedFields[8] = true;
contact_set = true;
break;
case TODO_PHONE:
if ((error = ALCATEL_UpdateField(s, Alcatel_phone, ToDo->Location, 9, ToDo->Entries[i].Text)) != ERR_NONE) return error;
- UpdatedFields[9] = true;
+ UpdatedFields[9] = true;
phone_set = true;
break;
default:
break;
}
}
if (!contact_set) {
if (phone_set) {
@@ -3817,16 +3820,24 @@ static GSM_Error ALCATEL_SetIncomingCB (GSM_StateMachine *s, bool enable)
static GSM_Error ALCATEL_SetIncomingSMS (GSM_StateMachine *s, bool enable)
{
GSM_Error error;
if ((error = ALCATEL_SetATMode(s))!= ERR_NONE) return error;
return ATGEN_SetIncomingSMS(s, enable);
}
+static GSM_Error ALCATEL_SetFastSMSSending(GSM_StateMachine *s, bool enable)
+{
+ GSM_Error error;
+
+ if ((error = ALCATEL_SetATMode(s))!= ERR_NONE) return error;
+ return ATGEN_SetFastSMSSending(s, enable);
+}
+
static GSM_Reply_Function ALCATELReplyFunctions[] = {
{ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelAttach },
{ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelDetach },
{ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelCommit },
{ALCATEL_ReplyCommit, "\x02",0x00,0x00, ID_AlcatelCommit2 },
{ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelEnd },
{ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelClose },
{ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelStart },
@@ -3908,16 +3919,17 @@ GSM_Phone_Functions ALCATELPhone = {
ALCATEL_GetSMSStatus,
ALCATEL_GetSMS,
ALCATEL_GetNextSMS,
NOTSUPPORTED, /* SetSMS */
ALCATEL_AddSMS,
ALCATEL_DeleteSMS,
ALCATEL_SendSMS,
ALCATEL_SendSavedSMS,
+ ALCATEL_SetFastSMSSending,
ALCATEL_SetIncomingSMS,
ALCATEL_SetIncomingCB,
ALCATEL_GetSMSFolders,
NOTSUPPORTED, /* AddSMSFolder */
NOTSUPPORTED, /* DeleteSMSFolder */
ALCATEL_DialVoice,
ALCATEL_AnswerCall,
ALCATEL_CancelCall,
@@ -3962,17 +3974,17 @@ GSM_Phone_Functions ALCATELPhone = {
ALCATEL_GetCalendar,
ALCATEL_GetNextCalendar,
ALCATEL_SetCalendar,
ALCATEL_AddCalendar,
ALCATEL_DeleteCalendar,
ALCATEL_DeleteAllCalendar,
NOTSUPPORTED, /* GetCalendarSettings */
NOTSUPPORTED, /* SetCalendarSettings */
- NOTSUPPORTED, /* GetNote */
+ NOTSUPPORTED, /* GetNextNote */
NOTSUPPORTED, /* GetProfile */
NOTSUPPORTED, /* SetProfile */
NOTSUPPORTED, /* GetFMStation */
NOTSUPPORTED, /* SetFMStation */
NOTSUPPORTED, /* ClearFMStations */
NOTSUPPORTED, /* GetNextFileFolder */
NOTSUPPORTED, /* GetFilePart */
NOTSUPPORTED, /* AddFilePart */