summaryrefslogtreecommitdiffabout
path: root/gammu/emb/common/phone/at/atgen.c
Side-by-side diff
Diffstat (limited to 'gammu/emb/common/phone/at/atgen.c') (more/less context) (ignore whitespace changes)
-rw-r--r--gammu/emb/common/phone/at/atgen.c295
1 files changed, 244 insertions, 51 deletions
diff --git a/gammu/emb/common/phone/at/atgen.c b/gammu/emb/common/phone/at/atgen.c
index 1834f15..ba23eb2 100644
--- a/gammu/emb/common/phone/at/atgen.c
+++ b/gammu/emb/common/phone/at/atgen.c
@@ -12,37 +12,17 @@
#include "../../misc/coding/coding.h"
#include "../../service/sms/gsmsms.h"
#include "../pfunc.h"
+
#include "atgen.h"
+#include "samsung.h"
+#include "siemens.h"
+#include "sonyeric.h"
+
#ifdef GSM_ENABLE_ALCATEL
-extern GSM_Error ALCATEL_ProtocolVersionReply (GSM_Protocol_Message msg, GSM_StateMachine *s);
+GSM_Error ALCATEL_ProtocolVersionReply (GSM_Protocol_Message, GSM_StateMachine *);
#endif
-extern GSM_Error ATGEN_CMS35ReplyGetBitmap (GSM_Protocol_Message msg, GSM_StateMachine *s);
-extern GSM_Error ATGEN_CMS35ReplySetBitmap (GSM_Protocol_Message msg, GSM_StateMachine *s);
-extern GSM_Error ATGEN_CMS35ReplyGetRingtone (GSM_Protocol_Message msg, GSM_StateMachine *s);
-extern GSM_Error ATGEN_CMS35ReplySetRingtone (GSM_Protocol_Message msg, GSM_StateMachine *s);
-extern GSM_Error ATGEN_CMS35ReplyGetNextCal (GSM_Protocol_Message msg, GSM_StateMachine *s);
-extern GSM_Error ATGEN_CMS35ReplySetCalendar (GSM_Protocol_Message msg, GSM_StateMachine *s);
-extern GSM_Error ATGEN_CMS35ReplyDeleteCalendar (GSM_Protocol_Message msg, GSM_StateMachine *s);
-extern GSM_Error ATGEN_SL45ReplyGetMemory (GSM_Protocol_Message msg, GSM_StateMachine *s);
-
-extern GSM_Error ATGEN_GetRingtone (GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone);
-extern GSM_Error ATGEN_SetRingtone (GSM_StateMachine *s, GSM_Ringtone *Ringtone, int *maxlength);
-extern GSM_Error ATGEN_GetBitmap (GSM_StateMachine *s, GSM_Bitmap *Bitmap);
-extern GSM_Error ATGEN_SetBitmap (GSM_StateMachine *s, GSM_Bitmap *Bitmap);
-extern GSM_Error SIEMENS_GetNextCalendar (GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start);
-extern GSM_Error SIEMENS_AddCalendarNote (GSM_StateMachine *s, GSM_CalendarEntry *Note);
-extern GSM_Error SIEMENS_DelCalendarNote (GSM_StateMachine *s, GSM_CalendarEntry *Note);
-
-extern GSM_Error SONYERIC_GetNextCalendar (GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start);
-extern GSM_Error SONYERIC_GetNextToDo (GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool start);
-extern GSM_Error SONYERIC_GetToDoStatus (GSM_StateMachine *s, GSM_ToDoStatus *status);
-extern GSM_Error SONYERIC_AddCalendarNote (GSM_StateMachine *s, GSM_CalendarEntry *Note);
-extern GSM_Error SONYERIC_AddToDo (GSM_StateMachine *s, GSM_ToDoEntry *ToDo);
-extern GSM_Error SONYERIC_DeleteAllToDo (GSM_StateMachine *s);
-extern GSM_Error SONYERIC_DelCalendarNote (GSM_StateMachine *s, GSM_CalendarEntry *Note);
-extern GSM_Error SONYERIC_GetCalendarStatus (GSM_StateMachine *s, GSM_CalendarStatus *Status);
typedef struct {
int Number;
@@ -175,6 +155,8 @@ GSM_Error ATGEN_HandleCMEError(GSM_StateMachine *s)
}
/* For error codes descriptions see table a bit above */
switch (Priv->ErrorCode) {
+ case -1:
+ return ERR_EMPTY;
case 3:
return ERR_PERMISSION;
case 4:
@@ -256,8 +238,16 @@ int ATGEN_ExtractOneParameter(unsigned char *input, unsigned char *output)
void ATGEN_DecodeDateTime(GSM_DateTime *dt, unsigned char *input)
{
- dt->Year=2000+(*input-'0')*10; input++;
+ /* Samsung phones report year as %d instead of %02d */
+ if (input[2] == '/') {
+ dt->Year=(*input-'0')*10;
+ input++;
+ } else {
+ dt->Year=0;
+ }
+
dt->Year=dt->Year+(*input-'0'); input++;
+ dt->Year+=2000;
input++;
dt->Month=(*input-'0')*10; input++;
@@ -322,6 +312,18 @@ GSM_Error ATGEN_DispatchMessage(GSM_StateMachine *s)
Priv->ReplyState = AT_Reply_CMSError;
ErrorCodes = CMSErrorCodes;
}
+
+ /* FIXME: Samsung phones can answer +CME ERROR:-1 meaning empty location */
+ if (Priv->ReplyState == AT_Reply_CMEError && Priv->Manufacturer == AT_Samsung) {
+ err = line + 11;
+ Priv->ErrorCode = atoi(err);
+
+ if (Priv->ErrorCode == -1) {
+ Priv->ErrorText = "[Samsung] Empty location";
+ return GSM_DispatchMessage(s);
+ }
+ }
+
if (Priv->ReplyState == AT_Reply_CMEError || Priv->ReplyState == AT_Reply_CMSError) {
j = 0;
/* One char behind +CM[SE] ERROR */
@@ -370,6 +372,42 @@ GSM_Error ATGEN_GenericReply(GSM_Protocol_Message msg, GSM_StateMachine *s)
return ERR_UNKNOWNRESPONSE;
}
+GSM_Error ATGEN_ReplyGetUSSD(GSM_Protocol_Message msg, GSM_StateMachine *s)
+{
+ unsigned char buffer[2000],buffer2[4000];
+ int i = 10;
+
+ /* Ugly hack */
+ while (msg.Buffer[i]!=13) i++;
+ i = i - 6;
+ memcpy(buffer,msg.Buffer+10,i-11);
+ buffer[i-11] = 0x00;
+
+ smprintf(s, "USSD reply: \"%s\"\n",buffer);
+
+ if (s->Phone.Data.EnableIncomingUSSD && s->User.IncomingUSSD!=NULL) {
+ EncodeUnicode(buffer2,buffer,strlen(buffer));
+ s->User.IncomingUSSD(s->CurrentConfig->Device, buffer2);
+ }
+
+ return ERR_NONE;
+}
+
+GSM_Error ATGEN_SetIncomingUSSD(GSM_StateMachine *s, bool enable)
+{
+ GSM_Error error;
+
+ if (enable) {
+ smprintf(s, "Enabling incoming USSD\n");
+ error=GSM_WaitFor (s, "AT+CUSD=1\r", 10, 0x00, 3, ID_SetUSSD);
+ } else {
+ smprintf(s, "Disabling incoming USSD\n");
+ error=GSM_WaitFor (s, "AT+CUSD=0\r", 10, 0x00, 3, ID_SetUSSD);
+ }
+ if (error==ERR_NONE) s->Phone.Data.EnableIncomingUSSD = enable;
+ return error;
+}
+
GSM_Error ATGEN_ReplyGetModel(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN;
@@ -394,10 +432,12 @@ GSM_Error ATGEN_ReplyGetModel(GSM_Protocol_Message msg, GSM_StateMachine *s)
if (strstr(msg.Buffer,"Nokia")) Priv->Manufacturer = AT_Nokia;
else if (strstr(msg.Buffer,"M20")) Priv->Manufacturer = AT_Siemens;
else if (strstr(msg.Buffer,"MC35")) Priv->Manufacturer = AT_Siemens;
+ else if (strstr(msg.Buffer,"TC35")) Priv->Manufacturer = AT_Siemens;
else if (strstr(msg.Buffer, "iPAQ")) Priv->Manufacturer = AT_HP;
if (strstr(msg.Buffer,"M20")) strcpy(Data->Model,"M20");
else if (strstr(msg.Buffer,"MC35")) strcpy(Data->Model,"MC35");
+ else if (strstr(msg.Buffer,"TC35")) strcpy(Data->Model,"TC35");
else if (strstr(msg.Buffer, "iPAQ")) strcpy(Data->Model,"iPAQ");
} else {
smprintf(s, "WARNING: Model name too long, increase MAX_MODEL_LENGTH to at least %zd\n", strlen(GetLineString(msg.Buffer, Priv->Lines, 2)));
@@ -481,6 +521,11 @@ GSM_Error ATGEN_ReplyGetManufacturer(GSM_Protocol_Message msg, GSM_StateMachine
strcpy(s->Phone.Data.Manufacturer,"Sagem");
Priv->Manufacturer = AT_Sagem;
}
+ if (strstr(msg.Buffer,"Samsung")) {
+ smprintf(s, "Samsung\n");
+ strcpy(s->Phone.Data.Manufacturer,"Samsung");
+ Priv->Manufacturer = AT_Samsung;
+ }
return ERR_NONE;
case AT_Reply_CMSError:
return ATGEN_HandleCMSError(s);
@@ -674,16 +719,26 @@ GSM_Error ATGEN_ReplyGetSMSMemories(GSM_Protocol_Message msg, GSM_StateMachine *
* phone supports writing to memory. This is done by searching
* for "), (", which will appear between lists.
*/
- s->Phone.Data.Priv.ATGEN.CanSaveSMS = (strstr(msg.Buffer, "), (") != NULL);
+ s->Phone.Data.Priv.ATGEN.CanSaveSMS = false;
+ if (strstr(msg.Buffer, "), (") != NULL || strstr(msg.Buffer, "),(") != NULL) {
+ s->Phone.Data.Priv.ATGEN.CanSaveSMS = true;
+ }
+
if (strstr(msg.Buffer, "\"SM\"") != NULL) s->Phone.Data.Priv.ATGEN.SIMSMSMemory = AT_AVAILABLE;
else s->Phone.Data.Priv.ATGEN.SIMSMSMemory = AT_NOTAVAILABLE;
+
if (strstr(msg.Buffer, "\"ME\"") != NULL) s->Phone.Data.Priv.ATGEN.PhoneSMSMemory = AT_AVAILABLE;
else s->Phone.Data.Priv.ATGEN.PhoneSMSMemory = AT_NOTAVAILABLE;
- smprintf(s, "Available SMS memories received, ME = %d, SM = %d\n", s->Phone.Data.Priv.ATGEN.PhoneSMSMemory, s->Phone.Data.Priv.ATGEN.SIMSMSMemory);
+
+ smprintf(s, "Available SMS memories received, ME = %d, SM = %d, cansavesms =", s->Phone.Data.Priv.ATGEN.PhoneSMSMemory, s->Phone.Data.Priv.ATGEN.SIMSMSMemory);
+ if (s->Phone.Data.Priv.ATGEN.CanSaveSMS) smprintf(s, "true");
+ smprintf(s, "\n");
return ERR_NONE;
case AT_Reply_Error:
case AT_Reply_CMSError:
return ATGEN_HandleCMSError(s);
+ case AT_Reply_CMEError:
+ return ATGEN_HandleCMEError(s);
default:
return ERR_UNKNOWNRESPONSE;
}
@@ -858,8 +913,9 @@ GSM_Error ATGEN_ReplyGetSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s
if (strstr(msg.Buffer,"+CMGR: 0,,0")!=NULL) return ERR_EMPTY;
/* Siemens M20 */
if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_M20SMS)) {
- if (buffer[1]!=NUMBER_UNKNOWN && buffer[1]!=NUMBER_INTERNATIONAL &&
- buffer[1]!=NUMBER_ALPHANUMERIC) {
+ /* we check for the most often visible */
+ if (buffer[1]!=NUMBER_UNKNOWN_NUMBERING_PLAN_ISDN && buffer[1]!=NUMBER_INTERNATIONAL_NUMBERING_PLAN_ISDN &&
+ buffer[1]!=NUMBER_ALPHANUMERIC_NUMBERING_PLAN_UNKNOWN) {
/* Seems to be Delivery Report */
smprintf(s, "SMS type - status report (M20 style)\n");
sms->PDU = SMS_Status_Report;
@@ -894,7 +950,7 @@ GSM_Error ATGEN_ReplyGetSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s
sms->InboxFolder = true;
current2=((buffer[current])+1)/2+1;
if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_M20SMS)) {
- if (buffer[current+1]==NUMBER_ALPHANUMERIC) {
+ if (buffer[current+1]==NUMBER_ALPHANUMERIC_NUMBERING_PLAN_UNKNOWN) {
smprintf(s, "Trying to read alphanumeric number\n");
for(i=0;i<4;i++) smsframe[PHONE_SMSDeliver.Number+i]=buffer[current++];
current+=6;
@@ -925,7 +981,7 @@ GSM_Error ATGEN_ReplyGetSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s
smsframe[PHONE_SMSSubmit.TPMR] = buffer[current++];
current2=((buffer[current])+1)/2+1;
if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_M20SMS)) {
- if (buffer[current+1]==NUMBER_ALPHANUMERIC) {
+ if (buffer[current+1]==NUMBER_ALPHANUMERIC_NUMBERING_PLAN_UNKNOWN) {
smprintf(s, "Trying to read alphanumeric number\n");
for(i=0;i<4;i++) smsframe[PHONE_SMSSubmit.Number+i]=buffer[current++];
current+=6;
@@ -949,7 +1005,7 @@ GSM_Error ATGEN_ReplyGetSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s
sms->PDU = SMS_Status_Report;
sms->Folder = 1; /*INBOX SIM*/
sms->InboxFolder = true;
- smprintf(s, "TPMR is %02x\n",buffer[current]);
+ smprintf(s, "TPMR is %d\n",buffer[current]);
smsframe[PHONE_SMSStatusReport.TPMR] = buffer[current++];
current2=((buffer[current])+1)/2+1;
for(i=0;i<current2+1;i++) smsframe[PHONE_SMSStatusReport.Number+i]=buffer[current++];
@@ -1640,17 +1696,17 @@ GSM_Error ATGEN_ReplySendSMS(GSM_Protocol_Message msg, GSM_StateMachine *s)
case AT_Reply_OK:
smprintf(s, "SMS sent OK\n");
if (s->User.SendSMSStatus!=NULL) {
- start = strstr(msg.Buffer, "+CMGW: ");
+ start = strstr(msg.Buffer, "+CMGS: ");
if (start != NULL) {
s->User.SendSMSStatus(s->CurrentConfig->Device,0,atoi(start+7));
} else {
- s->User.SendSMSStatus(s->CurrentConfig->Device,0,0);
+ s->User.SendSMSStatus(s->CurrentConfig->Device,0,-1);
}
}
return ERR_NONE;
case AT_Reply_CMSError:
smprintf(s, "Error %i\n",Priv->ErrorCode);
- if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,Priv->ErrorCode,0);
+ if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,Priv->ErrorCode,-1);
return ATGEN_HandleCMSError(s);
case AT_Reply_Error:
return ERR_UNKNOWN;
@@ -1787,6 +1843,19 @@ GSM_Error ATGEN_GetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm)
return GSM_WaitFor (s, "AT+CALA?\r", 9, 0x00, 4, ID_GetAlarm);
}
+/* R320 only takes HH:MM. Do other phones understand full date? */
+GSM_Error ATGEN_SetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm)
+{
+ char req[20];
+
+ if (alarm->Location != 1) return ERR_INVALIDLOCATION;
+
+ sprintf(req, "AT+CALA=\"%02i:%02i\"\r",alarm->DateTime.Hour,alarm->DateTime.Minute);
+
+ smprintf(s, "Setting Alarm\n");
+ return GSM_WaitFor (s, req, strlen(req), 0x00, 3, ID_SetAlarm);
+}
+
GSM_Error ATGEN_ReplyGetSMSC(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
GSM_SMSC *SMSC = s->Phone.Data.SMSC;
@@ -2202,6 +2271,8 @@ GSM_Error ATGEN_GetMemoryInfo(GSM_StateMachine *s, GSM_MemoryStatus *Status, GSM
Priv->NumberLength = 0;
error = GSM_WaitFor (s, "AT+CPBR=?\r", 10, 0x00, 4, ID_GetMemoryStatus);
+ if (Priv->Manufacturer == AT_Samsung)
+ error = GSM_WaitFor (s, "", 0, 0x00, 4, ID_GetMemoryStatus);
if (error != ERR_NONE) return error;
if (NeededInfo == AT_Total || NeededInfo == AT_Sizes || NeededInfo == AT_First) return ERR_NONE;
@@ -2268,6 +2339,12 @@ GSM_Error ATGEN_SetPBKCharset(GSM_StateMachine *s, bool PreferUnicode)
error=ATGEN_GetManufacturer(s);
if (error != ERR_NONE) return error;
+ /* Samsung (and Sagem?) phones use only PCCP437? */
+ if (Priv->Manufacturer == AT_Samsung) {
+ Priv->PBKCharset = AT_PBK_PCCP437;
+ return ERR_NONE;
+ }
+
if (PreferUnicode && !Priv->UCS2CharsetFailed) {
smprintf(s, "Setting charset to UCS2\n");
error=GSM_WaitFor (s, "AT+CSCS=\"UCS2\"\r", 15, 0x00, 3, ID_SetMemoryCharset);
@@ -2385,7 +2462,37 @@ GSM_Error ATGEN_ReplyGetMemory(GSM_Protocol_Message msg, GSM_StateMachine *s)
case AT_PBK_UCS2:
DecodeHexUnicode(Memory->Entries[1].Text,buffer+1,strlen(buffer+1) - 1);
break;
+ case AT_PBK_PCCP437:
+ /* FIXME: correctly decode PCCP437 */
+ DecodeDefault(Memory->Entries[1].Text,buffer+1,strlen(buffer)-2,false,NULL);
+ break;
+ }
+
+ /* Samsung number type */
+ if (Priv->Manufacturer == AT_Samsung) {
+ int type;
+
+ pos += ATGEN_ExtractOneParameter(pos, buffer);
+ smprintf(s, "Number type: %s\n",buffer);
+ type = strtoul(buffer, NULL, 0);
+ switch (type) {
+ case 0:
+ Memory->Entries[0].EntryType = PBK_Number_Mobile;
+ break;
+ case 1:
+ Memory->Entries[0].EntryType = PBK_Number_Work;
+ break;
+ case 2:
+ Memory->Entries[0].EntryType = PBK_Number_Home;
+ break;
+ case 3:
+ Memory->Entries[0].EntryType = PBK_Text_Email;
+ break;
+ default:
+ Memory->Entries[0].EntryType = PBK_Number_General;
+ }
}
+
return ERR_NONE;
case AT_Reply_CMEError:
return ATGEN_HandleCMEError(s);
@@ -2562,6 +2669,8 @@ GSM_Error ATGEN_ReplyEnterSecurityCode(GSM_Protocol_Message msg, GSM_StateMachin
return ERR_SECURITYERROR;
case AT_Reply_CMSError:
return ATGEN_HandleCMSError(s);
+ case AT_Reply_CMEError:
+ return ATGEN_HandleCMEError(s);
default:
break;
}
@@ -2924,6 +3033,12 @@ GSM_Error ATGEN_PrivSetMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
EncodeHexUnicode(name, entry->Entries[Name].Text, UnicodeLength(entry->Entries[Name].Text));
len = strlen(name);
break;
+ case AT_PBK_PCCP437:
+ /* FIXME: correctly decode PCCP437 */
+ smprintf(s, "str: %s\n", DecodeUnicodeString(entry->Entries[Name].Text));
+ len = UnicodeLength(entry->Entries[Name].Text);
+ EncodeDefault(name, entry->Entries[Name].Text, &len, true, NULL);
+ break;
}
} else {
smprintf(s, "WARNING: No usable name found!\n");
@@ -3252,6 +3367,43 @@ GSM_Error ATGEN_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note)
return ERR_NOTSUPPORTED;
}
+
+GSM_Error ATGEN_GetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap)
+{
+ GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN;
+
+ if (Priv->Manufacturer==AT_Siemens) return SIEMENS_GetBitmap(s, Bitmap);
+ if (Priv->Manufacturer==AT_Samsung) return SAMSUNG_GetBitmap(s, Bitmap);
+ return ERR_NOTSUPPORTED;
+}
+
+GSM_Error ATGEN_SetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap)
+{
+ GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN;
+
+ if (Priv->Manufacturer==AT_Siemens) return SIEMENS_SetBitmap(s, Bitmap);
+ if (Priv->Manufacturer==AT_Samsung) return SAMSUNG_SetBitmap(s, Bitmap);
+ return ERR_NOTSUPPORTED;
+}
+
+GSM_Error ATGEN_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone)
+{
+ GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN;
+
+ if (Priv->Manufacturer==AT_Siemens) return SIEMENS_GetRingtone(s, Ringtone, PhoneRingtone);
+ if (Priv->Manufacturer==AT_Samsung) return SAMSUNG_GetRingtone(s, Ringtone, PhoneRingtone);
+ return ERR_NOTSUPPORTED;
+}
+
+GSM_Error ATGEN_SetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, int *maxlength)
+{
+ GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN;
+
+ if (Priv->Manufacturer==AT_Siemens) return SIEMENS_SetRingtone(s, Ringtone, maxlength);
+ if (Priv->Manufacturer==AT_Samsung) return SAMSUNG_SetRingtone(s, Ringtone, maxlength);
+ return ERR_NOTSUPPORTED;
+}
+
GSM_Error ATGEN_PressKey(GSM_StateMachine *s, GSM_KeyCode Key, bool Press)
{
GSM_Error error;
@@ -3346,6 +3498,17 @@ GSM_Error ATGEN_SetIncomingCB(GSM_StateMachine *s, bool enable)
#endif
}
+GSM_Error ATGEN_SetFastSMSSending(GSM_StateMachine *s, bool enable)
+{
+ if (enable) {
+ smprintf(s, "Enabling fast SMS sending\n");
+ return GSM_WaitFor(s, "AT+CMMS=2\r", 10, 0x00, 4, ID_SetFastSMSSending);
+ } else {
+ smprintf(s, "Disabling fast SMS sending\n");
+ return GSM_WaitFor(s, "AT+CMMS=0\r", 10, 0x00, 4, ID_SetFastSMSSending);
+ }
+}
+
GSM_Error ATGEN_IncomingSMSInfo(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
smprintf(s, "Incoming SMS\n");
@@ -3424,6 +3587,18 @@ GSM_Error ATGEN_SetIncomingSMS(GSM_StateMachine *s, bool enable)
return ERR_NONE;
}
+GSM_Error ATGEN_GetLocale(GSM_StateMachine *s, GSM_Locale *locale)
+{
+ if (s->Phone.Data.Priv.ATGEN.Manufacturer==AT_Ericsson) return ERICSSON_GetLocale(s,locale);
+ return ERR_NOTSUPPORTED;
+}
+
+GSM_Error ATGEN_SetLocale(GSM_StateMachine *s, GSM_Locale *locale)
+{
+ if (s->Phone.Data.Priv.ATGEN.Manufacturer==AT_Ericsson) return ERICSSON_SetLocale(s,locale);
+ return ERR_NOTSUPPORTED;
+}
+
GSM_Reply_Function ATGENReplyFunctions[] = {
{ATGEN_GenericReply, "AT\r" ,0x00,0x00,ID_IncomingFrame },
{ATGEN_GenericReply, "ATE1" ,0x00,0x00,ID_EnableEcho },
@@ -3432,6 +3607,11 @@ GSM_Reply_Function ATGENReplyFunctions[] = {
{ATGEN_ReplyGetSIMIMSI, "AT+CIMI" ,0x00,0x00,ID_GetSIMIMSI },
{ATGEN_GenericReply, "AT*EOBEX" ,0x00,0x00,ID_SetOBEX },
+{ERICSSON_ReplyGetDateLocale, "*ESDF:" ,0x00,0x00,ID_GetLocale },
+{ERICSSON_ReplyGetTimeLocale, "*ESTF:" ,0x00,0x00,ID_GetLocale },
+{ATGEN_GenericReply, "AT*ESDF=" ,0x00,0x00,ID_SetLocale },
+{ATGEN_GenericReply, "AT*ESTF=" ,0x00,0x00,ID_SetLocale },
+
#ifdef GSM_ENABLE_CELLBROADCAST
{ATGEN_ReplyIncomingCB, "+CBM:" ,0x00,0x00,ID_IncomingFrame },
{ATGEN_GenericReply, "AT+CNMI" ,0x00,0x00,ID_SetIncomingCB },
@@ -3462,6 +3642,7 @@ GSM_Reply_Function ATGENReplyFunctions[] = {
{ATGEN_ReplyDeleteSMSMessage, "AT+CMGD" ,0x00,0x00,ID_DeleteSMSMessage },
{ATGEN_GenericReply, "ATE1" ,0x00,0x00,ID_SetSMSParameters },
{ATGEN_GenericReply, "\x1b\x0D" ,0x00,0x00,ID_SetSMSParameters },
+{ATGEN_GenericReply, "AT+CMMS" ,0x00,0x00,ID_SetFastSMSSending },
{ATGEN_IncomingSMSInfo, "+CMTI:" ,0x00,0x00,ID_IncomingFrame },
{ATGEN_IncomingSMSDeliver, "+CMT:" ,0x00,0x00,ID_IncomingFrame },
{ATGEN_IncomingSMSReport, "+CDS:" ,0x00,0x00,ID_IncomingFrame },
@@ -3469,6 +3650,7 @@ GSM_Reply_Function ATGENReplyFunctions[] = {
{ATGEN_ReplyGetDateTime_Alarm, "AT+CCLK?" ,0x00,0x00,ID_GetDateTime },
{ATGEN_GenericReply, "AT+CCLK=" ,0x00,0x00,ID_SetDateTime },
+{ATGEN_GenericReply, "AT+CALA=" ,0x00,0x00,ID_SetAlarm },
{ATGEN_ReplyGetDateTime_Alarm, "AT+CALA?" ,0x00,0x00,ID_GetAlarm },
{ATGEN_ReplyGetNetworkLAC_CID, "AT+CREG?" ,0x00,0x00,ID_GetNetworkInfo },
@@ -3484,23 +3666,25 @@ GSM_Reply_Function ATGENReplyFunctions[] = {
{ATGEN_ReplyGetPBKMemories, "AT+CPBS=?" ,0x00,0x00,ID_SetMemoryType },
{ATGEN_GenericReply, "AT+CPBS=" ,0x00,0x00,ID_SetMemoryType },
{ATGEN_ReplyGetCPBSMemoryStatus,"AT+CPBS?" ,0x00,0x00,ID_GetMemoryStatus },
+// /* Samsung phones reply +CPBR: after OK --claudio*/
{ATGEN_ReplyGetCPBRMemoryInfo, "AT+CPBR=?" ,0x00,0x00,ID_GetMemoryStatus },
+{ATGEN_ReplyGetCPBRMemoryInfo, "+CPBR:" ,0x00,0x00,ID_GetMemoryStatus },
{ATGEN_ReplyGetCPBRMemoryStatus,"AT+CPBR=" ,0x00,0x00,ID_GetMemoryStatus },
{ATGEN_GenericReply, "AT+CSCS=" ,0x00,0x00,ID_SetMemoryCharset },
{ATGEN_ReplyGetMemory, "AT+CPBR=" ,0x00,0x00,ID_GetMemory },
{ATGEN_GenericReply, "AT^SBNR=?" ,0x00,0x00,ID_GetMemory },
-{ATGEN_SL45ReplyGetMemory, "AT^SBNR" ,0x00,0x00,ID_GetMemory },
+{SIEMENS_ReplyGetMemory, "AT^SBNR" ,0x00,0x00,ID_GetMemory },
{ATGEN_ReplySetMemory, "AT+CPBW" ,0x00,0x00,ID_SetMemory },
-{ATGEN_CMS35ReplyGetBitmap, "AT^SBNR=\"bmp\"" ,0x00,0x00,ID_GetBitmap },
-{ATGEN_CMS35ReplySetBitmap, "AT^SBNW=\"bmp\"" ,0x00,0x00,ID_SetBitmap },
+{SIEMENS_ReplyGetBitmap, "AT^SBNR=\"bmp\"" ,0x00,0x00,ID_GetBitmap },
+{SIEMENS_ReplySetBitmap, "AT^SBNW=\"bmp\"" ,0x00,0x00,ID_SetBitmap },
-{ATGEN_CMS35ReplyGetRingtone, "AT^SBNR=\"mid\"" ,0x00,0x00,ID_GetRingtone },
-{ATGEN_CMS35ReplySetRingtone, "AT^SBNW=\"mid\"" ,0x00,0x00,ID_SetRingtone },
+{SIEMENS_ReplyGetRingtone, "AT^SBNR=\"mid\"" ,0x00,0x00,ID_GetRingtone },
+{SIEMENS_ReplySetRingtone, "AT^SBNW=\"mid\"" ,0x00,0x00,ID_SetRingtone },
-{ATGEN_CMS35ReplyGetNextCal, "AT^SBNR=\"vcs\"" ,0x00,0x00,ID_GetCalendarNote },
-{ATGEN_CMS35ReplySetCalendar, "AT^SBNW=\"vcs\"" ,0x00,0x00,ID_SetCalendarNote },
-{ATGEN_CMS35ReplyDeleteCalendar,"AT^SBNW=\"vcs\"" ,0x00,0x00,ID_DeleteCalendarNote },
+{SIEMENS_ReplyGetNextCalendar, "AT^SBNR=\"vcs\"" ,0x00,0x00,ID_GetCalendarNote },
+{SIEMENS_ReplyAddCalendarNote, "AT^SBNW=\"vcs\"" ,0x00,0x00,ID_SetCalendarNote },
+{SIEMENS_ReplyDelCalendarNote, "AT^SBNW=\"vcs\"" ,0x00,0x00,ID_DeleteCalendarNote },
{ATGEN_ReplyEnterSecurityCode, "AT+CPIN=" ,0x00,0x00,ID_EnterSecurityCode },
{ATGEN_ReplyEnterSecurityCode, "AT+CPIN2=" ,0x00,0x00,ID_EnterSecurityCode },
@@ -3511,6 +3695,8 @@ GSM_Reply_Function ATGENReplyFunctions[] = {
{ATGEN_ReplyCancelCall, "AT+CHUP" ,0x00,0x00,ID_CancelCall },
{ATGEN_ReplyDialVoice, "ATDT" ,0x00,0x00,ID_DialVoice },
{ATGEN_ReplyCancelCall, "ATH" ,0x00,0x00,ID_CancelCall },
+{ATGEN_GenericReply, "AT+CUSD" ,0x00,0x00,ID_SetUSSD },
+{ATGEN_ReplyGetUSSD, "+CUSD" ,0x00,0x00,ID_IncomingFrame },
{ATGEN_GenericReply, "AT+CLIP=1" ,0x00,0x00,ID_IncomingFrame },
{ATGEN_ReplyIncomingCallInfo, "+CLIP" ,0x00,0x00,ID_IncomingFrame },
{ATGEN_ReplyIncomingCallInfo, "+COLP" ,0x00,0x00,ID_IncomingFrame },
@@ -3521,6 +3707,12 @@ GSM_Reply_Function ATGENReplyFunctions[] = {
{ATGEN_ReplyReset, "AT+CFUN=1,1" ,0x00,0x00,ID_Reset },
{ATGEN_ReplyResetPhoneSettings, "AT&F" ,0x00,0x00,ID_ResetPhoneSettings },
+{SAMSUNG_ReplyGetBitmap, "AT+IMGR=" ,0x00,0x00,ID_GetBitmap },
+{SAMSUNG_ReplySetBitmap, "SDNDCRC =" ,0x00,0x00,ID_SetBitmap },
+
+{SAMSUNG_ReplyGetRingtone, "AT+MELR=" ,0x00,0x00,ID_GetRingtone },
+{SAMSUNG_ReplySetRingtone, "SDNDCRC =" ,0x00,0x00,ID_SetRingtone },
+
#ifdef GSM_ENABLE_ALCATEL
/* Why do I give Alcatel specific things here? It's simple, Alcatel needs
* some AT commands to start it's binary mode, so this needs to be in AT
@@ -3538,7 +3730,7 @@ GSM_Reply_Function ATGENReplyFunctions[] = {
};
GSM_Phone_Functions ATGENPhone = {
- "A2D|iPAQ|at|M20|S25|MC35|C35i|5110|5130|5190|5210|6110|6130|6150|6190|6210|6250|6310|6310i|6510|7110|8210|8250|8290|8310|8390|8850|8855|8890|8910|9110|9210",
+ "A2D|iPAQ|at|M20|S25|MC35|TC35|C35i|S300|5110|5130|5190|5210|6110|6130|6150|6190|6210|6250|6310|6310i|6510|7110|8210|8250|8290|8310|8390|8850|8855|8890|8910|9110|9210",
ATGENReplyFunctions,
ATGEN_Initialise,
ATGEN_Terminate,
@@ -3557,9 +3749,9 @@ GSM_Phone_Functions ATGENPhone = {
ATGEN_GetDateTime,
ATGEN_SetDateTime,
ATGEN_GetAlarm,
- NOTIMPLEMENTED, /* SetAlarm */
- NOTSUPPORTED, /* GetLocale */
- NOTSUPPORTED, /* SetLocale */
+ ATGEN_SetAlarm,
+ ATGEN_GetLocale,
+ ATGEN_SetLocale,
ATGEN_PressKey,
ATGEN_Reset,
ATGEN_ResetPhoneSettings,
@@ -3592,6 +3784,7 @@ GSM_Phone_Functions ATGENPhone = {
ATGEN_DeleteSMS,
ATGEN_SendSMS,
ATGEN_SendSavedSMS,
+ ATGEN_SetFastSMSSending,
ATGEN_SetIncomingSMS,
ATGEN_SetIncomingCB,
ATGEN_GetSMSFolders,
@@ -3610,7 +3803,7 @@ GSM_Phone_Functions ATGENPhone = {
NOTSUPPORTED, /* SetCallDivert */
NOTSUPPORTED, /* CancelAllDiverts */
NONEFUNCTION, /* SetIncomingCall */
- NOTSUPPORTED, /* SetIncomingUSSD */
+ ATGEN_SetIncomingUSSD,
ATGEN_SendDTMF,
ATGEN_GetRingtone,
ATGEN_SetRingtone,
@@ -3646,7 +3839,7 @@ GSM_Phone_Functions ATGENPhone = {
NOTIMPLEMENTED, /* DeleteAllCalendar */
NOTSUPPORTED, /* GetCalendarSettings */
NOTSUPPORTED, /* SetCalendarSettings */
- NOTSUPPORTED, /* GetNote */
+ NOTSUPPORTED, /* GetNextNote */
NOTSUPPORTED, /* GetProfile */
NOTSUPPORTED, /* SetProfile */
NOTSUPPORTED, /* GetFMStation */