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) (show whitespace changes)
-rw-r--r--gammu/emb/common/phone/alcatel/alcatel.c14
1 files changed, 13 insertions, 1 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
@@ -56,96 +56,97 @@
/* We need lot of ATGEN functions, because Alcatel is an AT device. */
extern GSM_Reply_Function ALCATELReplyFunctions[];
extern GSM_Reply_Function ATGENReplyFunctions[];
extern GSM_Error ATGEN_Initialise (GSM_StateMachine *s);
extern GSM_Error ATGEN_Terminate (GSM_StateMachine *s);
extern GSM_Error ATGEN_GetIMEI (GSM_StateMachine *s);
extern GSM_Error ATGEN_GetFirmware (GSM_StateMachine *s);
extern GSM_Error ATGEN_GetModel (GSM_StateMachine *s);
extern GSM_Error ATGEN_GetDateTime (GSM_StateMachine *s, GSM_DateTime *date_time);
extern GSM_Error ATGEN_GetMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry);
extern GSM_Error ATGEN_GetNextMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry, bool start);
extern GSM_Error ATGEN_SetMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry);
extern GSM_Error ATGEN_AddMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry);
extern GSM_Error ATGEN_DeleteMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry);
extern GSM_Error ATGEN_GetMemoryStatus (GSM_StateMachine *s, GSM_MemoryStatus *Status);
extern GSM_Error ATGEN_GetSMSC (GSM_StateMachine *s, GSM_SMSC *smsc);
extern GSM_Error ATGEN_SetSMSC (GSM_StateMachine *s, GSM_SMSC *smsc);
extern GSM_Error ATGEN_GetSMSFolders (GSM_StateMachine *s, GSM_SMSFolders *folders);
extern GSM_Error ATGEN_GetSMSStatus (GSM_StateMachine *s, GSM_SMSMemoryStatus *status);
extern GSM_Error ATGEN_GetSMS (GSM_StateMachine *s, GSM_MultiSMSMessage *sms);
extern GSM_Error ATGEN_GetNextSMS (GSM_StateMachine *s, GSM_MultiSMSMessage *sms, bool start);
extern GSM_Error ATGEN_SendSavedSMS (GSM_StateMachine *s, int Folder, int Location);
extern GSM_Error ATGEN_SendSMS (GSM_StateMachine *s, GSM_SMSMessage *sms);
extern GSM_Error ATGEN_DeleteSMS (GSM_StateMachine *s, GSM_SMSMessage *sms);
extern GSM_Error ATGEN_AddSMS (GSM_StateMachine *s, GSM_SMSMessage *sms);
extern GSM_Error ATGEN_GetBatteryCharge (GSM_StateMachine *s, GSM_BatteryCharge *bat);
extern GSM_Error ATGEN_GetSignalQuality (GSM_StateMachine *s, GSM_SignalQuality *sig);
extern GSM_Error ATGEN_DialVoice (GSM_StateMachine *s, char *number, GSM_CallShowNumber ShowNumber);
extern GSM_Error ATGEN_AnswerCall (GSM_StateMachine *s, int ID, bool all);
extern GSM_Error ATGEN_CancelCall (GSM_StateMachine *s, int ID, bool all);
extern GSM_Error ATGEN_SetDateTime (GSM_StateMachine *s, GSM_DateTime *date_time);
extern GSM_Error ATGEN_EnterSecurityCode (GSM_StateMachine *s, GSM_SecurityCode Code);
extern GSM_Error ATGEN_GetSecurityStatus (GSM_StateMachine *s, GSM_SecurityCodeType *Status);
extern GSM_Error ATGEN_ResetPhoneSettings (GSM_StateMachine *s, GSM_ResetSettingsType Type);
extern GSM_Error ATGEN_SendDTMF (GSM_StateMachine *s, char *sequence);
extern GSM_Error ATGEN_GetSIMIMSI (GSM_StateMachine *s, char *IMSI);
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 */
0x8c, 0x00,0xc8, /* E grave */
0x8d, 0x00,0xca, /* E circumflex */
0x8e, 0x00,0xcb, /* E diaresis */
0x8f, 0x00,0xcc, /* I grave */
0x90, 0x00,0xcd, /* I acute */
0x91, 0x00,0xd0, /* ETH */
0x92, 0x00,0xd2, /* O grave */
0x93, 0x00,0xd3, /* O acute */
0x94, 0x00,0xd4, /* O circumflex */
0x95, 0x00,0xd5, /* O tilde */
0x96, 0x00,0xd9, /* U grave */
0x97, 0x00,0xda, /* U acute */
0x98, 0x00,0xe1, /* a acute */
0x99, 0x00,0xe2, /* a circumflex */
0x9a, 0x00,0xe3, /* a tilde */
0x9b, 0x00,0xea, /* e circumflex */
0x9c, 0x00,0xeb, /* e diaresis */
0x9d, 0x00,0xed, /* i acute */
0x9e, 0x00,0xee, /* i circumflex */
0x9f, 0x00,0xef, /* i diaresis */
0xa0, 0x00,0xf3, /* o acute */
0xa1, 0x00,0xf4, /* o circumflex */
0xa2, 0x00,0xf5, /* o tilde */
0xa3, 0x00,0xfa, /* u acute */
@@ -499,96 +500,98 @@ static GSM_Error ALCATEL_GoToBinaryState(GSM_StateMachine *s, GSM_Alcatel_Binary
smprintf(s,"Start session\n");
error=GSM_WaitFor (s, start_buffer, 8, 0x02, ALCATEL_TIMEOUT, ID_AlcatelStart);
if (error != ERR_NONE) return error;
smprintf(s,"Select type\n");
error=GSM_WaitFor (s, select1_buffer, 4, 0x02, ALCATEL_TIMEOUT, ID_AlcatelSelect1);
if (error != ERR_NONE) return error;
error=GSM_WaitFor (s, select2_buffer, 6, 0x02, ALCATEL_TIMEOUT, ID_AlcatelSelect2);
if (error != ERR_NONE) return error;
error=GSM_WaitFor (s, 0, 0, 0x00, ALCATEL_TIMEOUT, ID_AlcatelSelect3);
if (error != ERR_NONE) return error;
smprintf(s,"Begin transfer\n");
error=GSM_WaitFor (s, begin_buffer, 8, 0x02, ALCATEL_TIMEOUT, ID_AlcatelBegin1);
if (error != ERR_NONE) return error;
error=GSM_WaitFor (s, 0, 0, 0x00, ALCATEL_TIMEOUT, ID_AlcatelBegin2);
if (error != ERR_NONE) return error;
Priv->BinaryState = StateSession;
Priv->BinaryType = type;
/* Do we want to edit something of same type? */
if ((state == StateEdit) && (type == Priv->BinaryType)) {
Priv->BinaryState = StateEdit;
Priv->BinaryItem = item;
return ERR_NONE;
}
}
return ERR_NONE;
}
static GSM_Error ALCATEL_SetATMode(GSM_StateMachine *s)
{
GSM_Phone_ALCATELData *Priv = &s->Phone.Data.Priv.ALCATEL;
GSM_Error error;
if (Priv->Mode == ModeAT) return ERR_NONE;
error = ALCATEL_GoToBinaryState(s, StateAttached, 0, 0);
if (error != ERR_NONE) return error;
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);
return ERR_NONE;
}
static GSM_Error ALCATEL_Initialise(GSM_StateMachine *s)
{
GSM_Phone_ALCATELData *Priv = &s->Phone.Data.Priv.ALCATEL;
GSM_Error error;
Priv->Mode = ModeAT;
Priv->CalendarItems = NULL;
Priv->ContactsItems = NULL;
Priv->ToDoItems = NULL;
Priv->CalendarItemsCount = 0;
Priv->ToDoItemsCount = 0;
Priv->ContactsItemsCount = 0;
Priv->CurrentFields[0] = 0;
Priv->CurrentFieldsCount = 0;
Priv->CurrentFieldsItem = 0;
Priv->CurrentFieldsType = 0;
Priv->ProtocolVersion = V_1_0;
Priv->CurrentFieldsItem = -1;
Priv->CurrentCategoriesCount = 0;
Priv->CurrentCategoriesType = 0;
s->Protocol.Functions = &ATProtocol;
s->Phone.Functions->ReplyFunctions = ATGENReplyFunctions;
if (ATGEN_Initialise(s) != ERR_NONE || GSM_WaitFor (s, "AT\r", 3, 0x00, 2, ID_IncomingFrame) != ERR_NONE) {
smprintf(s,"AT initialisation failed, trying to stop binary mode...\n");
s->Protocol.Functions = &ALCABUSProtocol;
error = s->Protocol.Functions->Terminate(s);
s->Protocol.Functions = &ATProtocol;
error = ATGEN_Initialise(s);
if (error != ERR_NONE) return error;
}
@@ -3777,215 +3780,224 @@ static GSM_Error ALCATEL_ReplyGeneric(GSM_Protocol_Message msg, GSM_StateMachine
* - phone needs PIN code
* - we want to close not opened session
* For normal users the second case shouldn't occur...
*/
return ERR_SECURITYERROR;
case 0x14: /* Bad data */
case 0x2f: /* Closing session when not opened */
case 0x1f: /* Bad in/out counter in packet/ack */
case 0x0e: /* Openning session when not closed */
case 0x0C: /* Bad id (item/database) */
case 0x11: /* Bad list id */
case 0x2A: /* Nonexistant field/item id */
case 0x35: /* Too long text */
return ERR_BUG;
case 0x23: /* Session opened */
case 0x80: /* Transfer started */
return ERR_NONE;
case 0x82: /* Transfer canceled */
return ERR_CANCELED;
default:
smprintf(s, "WARNING: Packet seems to indicate some status by %02X, ignoring!\n", msg.Buffer[8]);
return ERR_NONE;
}
}
static GSM_Error ALCATEL_ReplyCommit(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
s->Phone.Data.Priv.ALCATEL.CommitedRecord = msg.Buffer[12] + (msg.Buffer[11] << 8) + (msg.Buffer[10] << 16) + (msg.Buffer[9] << 24);
smprintf(s, "Created record %08x\n", s->Phone.Data.Priv.ALCATEL.CommitedRecord);
return ERR_NONE;
}
static GSM_Error ALCATEL_SetIncomingCB (GSM_StateMachine *s, bool enable)
{
GSM_Error error;
if ((error = ALCATEL_SetATMode(s))!= ERR_NONE) return error;
return ATGEN_SetIncomingCB(s, 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 },
{ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelSelect1 },
{ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelSelect2 },
{ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelSelect3 },
{ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelBegin1 },
{ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelBegin2 },
{ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelGetIds1 },
{ALCATEL_ReplyGetIds, "\x02",0x00,0x00, ID_AlcatelGetIds2 },
{ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelGetCategories1 },
{ALCATEL_ReplyGetCategories, "\x02",0x00,0x00, ID_AlcatelGetCategories2 },
{ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelGetCategoryText1 },
{ALCATEL_ReplyGetCategoryText, "\x02",0x00,0x00, ID_AlcatelGetCategoryText2 },
{ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelAddCategoryText1 },
{ALCATEL_ReplyAddCategoryText, "\x02",0x00,0x00, ID_AlcatelAddCategoryText2 },
{ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelGetFields1 },
{ALCATEL_ReplyGetFields, "\x02",0x00,0x00, ID_AlcatelGetFields2 },
{ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelGetFieldValue1 },
{ALCATEL_ReplyGetFieldValue, "\x02",0x00,0x00, ID_AlcatelGetFieldValue2 },
{ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelDeleteField },
{ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelDeleteItem1 },
{ALCATEL_ReplyDeleteItem, "\x02",0x00,0x00, ID_AlcatelDeleteItem2 },
{ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelCreateField },
{ALCATEL_ReplyGeneric, "\x02",0x00,0x00, ID_AlcatelUpdateField },
{NULL, "\x00",0x00,0x00, ID_None }
};
GSM_Phone_Functions ALCATELPhone = {
/* AFAIK, any 50[0123] phone should work, but I'm not sure whether all
* they were ever really released, if yes add them here also.
*/
"alcatel|OT501|OT701|OT715|OT535|OT735|BE5|BF5|BH4",
ALCATELReplyFunctions,
ALCATEL_Initialise,
ALCATEL_Terminate,
ALCATEL_DispatchMessage,
NOTSUPPORTED, /* ShowStartInfo */
ALCATEL_GetManufacturer,
ALCATEL_GetModel,
ALCATEL_GetFirmware,
ALCATEL_GetIMEI,
NOTSUPPORTED, /* GetOriginalIMEI */
NOTSUPPORTED, /* GetManufactureMonth */
ALCATEL_GetProductCode,
NOTSUPPORTED, /* GetHardware */
NOTSUPPORTED, /* GetPPM */
ALCATEL_GetSIMIMSI,
ALCATEL_GetDateTime,
ALCATEL_SetDateTime,
ALCATEL_GetAlarm,
ALCATEL_SetAlarm,
NOTSUPPORTED, /* GetLocale */
NOTSUPPORTED, /* SetLocale */
ALCATEL_PressKey,
ALCATEL_Reset,
ALCATEL_ResetPhoneSettings,
ALCATEL_EnterSecurityCode,
ALCATEL_GetSecurityStatus,
ALCATEL_GetDisplayStatus,
ALCATEL_SetAutoNetworkLogin,
ALCATEL_GetBatteryCharge,
ALCATEL_GetSignalStrength,
ALCATEL_GetNetworkInfo,
ALCATEL_GetCategory,
ALCATEL_AddCategory,
ALCATEL_GetCategoryStatus,
ALCATEL_GetMemoryStatus,
ALCATEL_GetMemory,
ALCATEL_GetNextMemory,
ALCATEL_SetMemory,
ALCATEL_AddMemory,
ALCATEL_DeleteMemory,
ALCATEL_DeleteAllMemory,
NOTSUPPORTED, /* GetSpeedDial */
NOTSUPPORTED, /* SetSpeedDial */
ALCATEL_GetSMSC,
ALCATEL_SetSMSC,
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,
NOTSUPPORTED, /* HoldCall */
NOTSUPPORTED, /* UnholdCall */
NOTSUPPORTED, /* ConferenceCall */
NOTSUPPORTED, /* SplitCall */
NOTSUPPORTED, /* TransferCall */
NOTSUPPORTED, /* SwitchCall */
NOTSUPPORTED, /* GetCallDivert */
NOTSUPPORTED, /* SetCallDivert */
NOTSUPPORTED, /* CancelAllDiverts */
NONEFUNCTION, /* SetIncomingCall */
NOTSUPPORTED, /* SetIncomingUSSD */
ALCATEL_SendDTMF,
NOTSUPPORTED, /* GetRingtone */
NOTSUPPORTED, /* SetRingtone */
NOTSUPPORTED, /* GetRingtonesInfo */
NOTSUPPORTED, /* DeleteUserRingtones */
NOTSUPPORTED, /* PlayTone */
NOTSUPPORTED, /* GetWAPBookmark */
NOTSUPPORTED, /* SetWAPBookmark */
NOTSUPPORTED, /* DeleteWAPBookmark */
NOTSUPPORTED, /* GetWAPSettings */
NOTSUPPORTED, /* SetWAPSettings */
NOTSUPPORTED, /* GetMMSSettings */
NOTSUPPORTED, /* SetMMSSettings */
NOTSUPPORTED, /* GetSyncMLSettings */
NOTSUPPORTED, /* SetSyncMLSettings */
NOTSUPPORTED, /* GetChatSettings */
NOTSUPPORTED, /* SetChatSettings */
NOTSUPPORTED, /* GetBitmap */
NOTSUPPORTED, /* SetBitmap */
ALCATEL_GetToDoStatus,
ALCATEL_GetToDo,
ALCATEL_GetNextToDo,
ALCATEL_SetToDo,
ALCATEL_AddToDo,
ALCATEL_DeleteToDo,
ALCATEL_DeleteAllToDo,
ALCATEL_GetCalendarStatus,
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 */
NOTSUPPORTED, /* GetFileSystemStatus */
NOTSUPPORTED, /* DeleteFile */
NOTSUPPORTED, /* AddFolder */
NOTSUPPORTED, /* GetGPRSAccessPoint */
NOTSUPPORTED /* SetGPRSAccessPoint */
};
#endif
#endif
/* How should editor hadle tabs in this file? Add editor commands here.
* vim: noexpandtab sw=8 ts=8 sts=8:
*/