Diffstat (limited to 'gammu/emb/common/phone/at/atgen.c') (more/less context) (show whitespace changes)
-rw-r--r-- | gammu/emb/common/phone/at/atgen.c | 295 |
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 | |||
@@ -3,55 +3,35 @@ | |||
3 | #include "../../gsmstate.h" | 3 | #include "../../gsmstate.h" |
4 | 4 | ||
5 | #ifdef GSM_ENABLE_ATGEN | 5 | #ifdef GSM_ENABLE_ATGEN |
6 | 6 | ||
7 | #include <string.h> | 7 | #include <string.h> |
8 | #include <time.h> | 8 | #include <time.h> |
9 | #include <ctype.h> | 9 | #include <ctype.h> |
10 | 10 | ||
11 | #include "../../gsmcomon.h" | 11 | #include "../../gsmcomon.h" |
12 | #include "../../misc/coding/coding.h" | 12 | #include "../../misc/coding/coding.h" |
13 | #include "../../service/sms/gsmsms.h" | 13 | #include "../../service/sms/gsmsms.h" |
14 | #include "../pfunc.h" | 14 | #include "../pfunc.h" |
15 | |||
15 | #include "atgen.h" | 16 | #include "atgen.h" |
16 | 17 | ||
18 | #include "samsung.h" | ||
19 | #include "siemens.h" | ||
20 | #include "sonyeric.h" | ||
21 | |||
17 | #ifdef GSM_ENABLE_ALCATEL | 22 | #ifdef GSM_ENABLE_ALCATEL |
18 | extern GSM_Error ALCATEL_ProtocolVersionReply(GSM_Protocol_Message msg, GSM_StateMachine *s); | 23 | GSM_Error ALCATEL_ProtocolVersionReply (GSM_Protocol_Message, GSM_StateMachine *); |
19 | #endif | 24 | #endif |
20 | 25 | ||
21 | extern GSM_Error ATGEN_CMS35ReplyGetBitmap(GSM_Protocol_Message msg, GSM_StateMachine *s); | ||
22 | extern GSM_Error ATGEN_CMS35ReplySetBitmap(GSM_Protocol_Message msg, GSM_StateMachine *s); | ||
23 | extern GSM_Error ATGEN_CMS35ReplyGetRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s); | ||
24 | extern GSM_Error ATGEN_CMS35ReplySetRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s); | ||
25 | extern GSM_Error ATGEN_CMS35ReplyGetNextCal(GSM_Protocol_Message msg, GSM_StateMachine *s); | ||
26 | extern GSM_Error ATGEN_CMS35ReplySetCalendar(GSM_Protocol_Message msg, GSM_StateMachine *s); | ||
27 | extern GSM_Error ATGEN_CMS35ReplyDeleteCalendar(GSM_Protocol_Message msg, GSM_StateMachine *s); | ||
28 | extern GSM_Error ATGEN_SL45ReplyGetMemory(GSM_Protocol_Message msg, GSM_StateMachine *s); | ||
29 | |||
30 | extern GSM_Error ATGEN_GetRingtone (GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone); | ||
31 | extern GSM_Error ATGEN_SetRingtone (GSM_StateMachine *s, GSM_Ringtone *Ringtone, int *maxlength); | ||
32 | extern GSM_Error ATGEN_GetBitmap (GSM_StateMachine *s, GSM_Bitmap *Bitmap); | ||
33 | extern GSM_Error ATGEN_SetBitmap (GSM_StateMachine *s, GSM_Bitmap *Bitmap); | ||
34 | extern GSM_Error SIEMENS_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start); | ||
35 | extern GSM_Error SIEMENS_AddCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note); | ||
36 | extern GSM_Error SIEMENS_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note); | ||
37 | |||
38 | extern GSM_Error SONYERIC_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start); | ||
39 | extern GSM_Error SONYERIC_GetNextToDo (GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool start); | ||
40 | extern GSM_Error SONYERIC_GetToDoStatus (GSM_StateMachine *s, GSM_ToDoStatus *status); | ||
41 | extern GSM_Error SONYERIC_AddCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note); | ||
42 | extern GSM_Error SONYERIC_AddToDo (GSM_StateMachine *s, GSM_ToDoEntry *ToDo); | ||
43 | extern GSM_Error SONYERIC_DeleteAllToDo (GSM_StateMachine *s); | ||
44 | extern GSM_Error SONYERIC_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note); | ||
45 | extern GSM_Error SONYERIC_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus *Status); | ||
46 | 26 | ||
47 | typedef struct { | 27 | typedef struct { |
48 | int Number; | 28 | int Number; |
49 | char Text[60]; | 29 | char Text[60]; |
50 | } ATErrorCode; | 30 | } ATErrorCode; |
51 | 31 | ||
52 | static ATErrorCode CMSErrorCodes[] = { | 32 | static ATErrorCode CMSErrorCodes[] = { |
53 | /* | 33 | /* |
54 | * Error codes not specified here were either undefined or reserved in my | 34 | * Error codes not specified here were either undefined or reserved in my |
55 | * copy of specifications, if you have newer one, please fill in the gaps. | 35 | * copy of specifications, if you have newer one, please fill in the gaps. |
56 | */ | 36 | */ |
57 | /* 0...127 from GSM 04.11 Annex E-2 */ | 37 | /* 0...127 from GSM 04.11 Annex E-2 */ |
@@ -166,24 +146,26 @@ GSM_Error ATGEN_HandleCMEError(GSM_StateMachine *s) | |||
166 | { | 146 | { |
167 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; | 147 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; |
168 | 148 | ||
169 | if (Priv->ErrorCode == 0) { | 149 | if (Priv->ErrorCode == 0) { |
170 | smprintf(s, "CME Error occured, but it's type not detected\n"); | 150 | smprintf(s, "CME Error occured, but it's type not detected\n"); |
171 | } else if (Priv->ErrorText == NULL) { | 151 | } else if (Priv->ErrorText == NULL) { |
172 | smprintf(s, "CME Error %i, no description available\n", Priv->ErrorCode); | 152 | smprintf(s, "CME Error %i, no description available\n", Priv->ErrorCode); |
173 | } else { | 153 | } else { |
174 | smprintf(s, "CME Error %i: \"%s\"\n", Priv->ErrorCode, Priv->ErrorText); | 154 | smprintf(s, "CME Error %i: \"%s\"\n", Priv->ErrorCode, Priv->ErrorText); |
175 | } | 155 | } |
176 | /* For error codes descriptions see table a bit above */ | 156 | /* For error codes descriptions see table a bit above */ |
177 | switch (Priv->ErrorCode) { | 157 | switch (Priv->ErrorCode) { |
158 | case -1: | ||
159 | return ERR_EMPTY; | ||
178 | case 3: | 160 | case 3: |
179 | return ERR_PERMISSION; | 161 | return ERR_PERMISSION; |
180 | case 4: | 162 | case 4: |
181 | return ERR_NOTSUPPORTED; | 163 | return ERR_NOTSUPPORTED; |
182 | case 5: | 164 | case 5: |
183 | case 11: | 165 | case 11: |
184 | case 12: | 166 | case 12: |
185 | case 16: | 167 | case 16: |
186 | case 17: | 168 | case 17: |
187 | case 18: | 169 | case 18: |
188 | return ERR_SECURITYERROR; | 170 | return ERR_SECURITYERROR; |
189 | case 20: | 171 | case 20: |
@@ -247,26 +229,34 @@ int ATGEN_ExtractOneParameter(unsigned char *input, unsigned char *output) | |||
247 | *output=*input; | 229 | *output=*input; |
248 | input++; | 230 | input++; |
249 | output++; | 231 | output++; |
250 | position++; | 232 | position++; |
251 | } | 233 | } |
252 | *output=0; | 234 | *output=0; |
253 | position++; | 235 | position++; |
254 | return position; | 236 | return position; |
255 | } | 237 | } |
256 | 238 | ||
257 | void ATGEN_DecodeDateTime(GSM_DateTime *dt, unsigned char *input) | 239 | void ATGEN_DecodeDateTime(GSM_DateTime *dt, unsigned char *input) |
258 | { | 240 | { |
259 | dt->Year=2000+(*input-'0')*10; input++; | 241 | /* Samsung phones report year as %d instead of %02d */ |
242 | if (input[2] == '/') { | ||
243 | dt->Year=(*input-'0')*10; | ||
244 | input++; | ||
245 | } else { | ||
246 | dt->Year=0; | ||
247 | } | ||
248 | |||
260 | dt->Year=dt->Year+(*input-'0'); input++; | 249 | dt->Year=dt->Year+(*input-'0'); input++; |
250 | dt->Year+=2000; | ||
261 | 251 | ||
262 | input++; | 252 | input++; |
263 | dt->Month=(*input-'0')*10; input++; | 253 | dt->Month=(*input-'0')*10; input++; |
264 | dt->Month=dt->Month+(*input-'0'); input++; | 254 | dt->Month=dt->Month+(*input-'0'); input++; |
265 | 255 | ||
266 | input++; | 256 | input++; |
267 | dt->Day=(*input-'0')*10; input++; | 257 | dt->Day=(*input-'0')*10; input++; |
268 | dt->Day=dt->Day+(*input-'0'); input++; | 258 | dt->Day=dt->Day+(*input-'0'); input++; |
269 | 259 | ||
270 | input++; | 260 | input++; |
271 | dt->Hour=(*input-'0')*10; input++; | 261 | dt->Hour=(*input-'0')*10; input++; |
272 | dt->Hour=dt->Hour+(*input-'0'); input++; | 262 | dt->Hour=dt->Hour+(*input-'0'); input++; |
@@ -313,24 +303,36 @@ GSM_Error ATGEN_DispatchMessage(GSM_StateMachine *s) | |||
313 | if (!strcmp(line,"OK")) Priv->ReplyState = AT_Reply_OK; | 303 | if (!strcmp(line,"OK")) Priv->ReplyState = AT_Reply_OK; |
314 | if (!strcmp(line,"> ")) Priv->ReplyState = AT_Reply_SMSEdit; | 304 | if (!strcmp(line,"> ")) Priv->ReplyState = AT_Reply_SMSEdit; |
315 | if (!strcmp(line,"CONNECT"))Priv->ReplyState = AT_Reply_Connect; | 305 | if (!strcmp(line,"CONNECT"))Priv->ReplyState = AT_Reply_Connect; |
316 | if (!strcmp(line,"ERROR" ))Priv->ReplyState = AT_Reply_Error; | 306 | if (!strcmp(line,"ERROR" ))Priv->ReplyState = AT_Reply_Error; |
317 | if (!strncmp(line,"+CME ERROR:",11)) { | 307 | if (!strncmp(line,"+CME ERROR:",11)) { |
318 | Priv->ReplyState = AT_Reply_CMEError; | 308 | Priv->ReplyState = AT_Reply_CMEError; |
319 | ErrorCodes = CMEErrorCodes; | 309 | ErrorCodes = CMEErrorCodes; |
320 | } | 310 | } |
321 | if (!strncmp(line,"+CMS ERROR:",11)) { | 311 | if (!strncmp(line,"+CMS ERROR:",11)) { |
322 | Priv->ReplyState = AT_Reply_CMSError; | 312 | Priv->ReplyState = AT_Reply_CMSError; |
323 | ErrorCodes = CMSErrorCodes; | 313 | ErrorCodes = CMSErrorCodes; |
324 | } | 314 | } |
315 | |||
316 | /* FIXME: Samsung phones can answer +CME ERROR:-1 meaning empty location */ | ||
317 | if (Priv->ReplyState == AT_Reply_CMEError && Priv->Manufacturer == AT_Samsung) { | ||
318 | err = line + 11; | ||
319 | Priv->ErrorCode = atoi(err); | ||
320 | |||
321 | if (Priv->ErrorCode == -1) { | ||
322 | Priv->ErrorText = "[Samsung] Empty location"; | ||
323 | return GSM_DispatchMessage(s); | ||
324 | } | ||
325 | } | ||
326 | |||
325 | if (Priv->ReplyState == AT_Reply_CMEError || Priv->ReplyState == AT_Reply_CMSError) { | 327 | if (Priv->ReplyState == AT_Reply_CMEError || Priv->ReplyState == AT_Reply_CMSError) { |
326 | j = 0; | 328 | j = 0; |
327 | /* One char behind +CM[SE] ERROR */ | 329 | /* One char behind +CM[SE] ERROR */ |
328 | err = line + 12; | 330 | err = line + 12; |
329 | while (err[j] && !isalnum(err[j])) j++; | 331 | while (err[j] && !isalnum(err[j])) j++; |
330 | if (isdigit(err[j])) { | 332 | if (isdigit(err[j])) { |
331 | Priv->ErrorCode = atoi(&(err[j])); | 333 | Priv->ErrorCode = atoi(&(err[j])); |
332 | k = 0; | 334 | k = 0; |
333 | while (ErrorCodes[k].Number != -1) { | 335 | while (ErrorCodes[k].Number != -1) { |
334 | if (ErrorCodes[k].Number == Priv->ErrorCode) { | 336 | if (ErrorCodes[k].Number == Priv->ErrorCode) { |
335 | Priv->ErrorText = (char *)&(ErrorCodes[k].Text); | 337 | Priv->ErrorText = (char *)&(ErrorCodes[k].Text); |
336 | break; | 338 | break; |
@@ -361,52 +363,90 @@ GSM_Error ATGEN_GenericReply(GSM_Protocol_Message msg, GSM_StateMachine *s) | |||
361 | case AT_Reply_Error: | 363 | case AT_Reply_Error: |
362 | return ERR_UNKNOWN; | 364 | return ERR_UNKNOWN; |
363 | case AT_Reply_CMSError: | 365 | case AT_Reply_CMSError: |
364 | return ATGEN_HandleCMSError(s); | 366 | return ATGEN_HandleCMSError(s); |
365 | case AT_Reply_CMEError: | 367 | case AT_Reply_CMEError: |
366 | return ATGEN_HandleCMEError(s); | 368 | return ATGEN_HandleCMEError(s); |
367 | default: | 369 | default: |
368 | break; | 370 | break; |
369 | } | 371 | } |
370 | return ERR_UNKNOWNRESPONSE; | 372 | return ERR_UNKNOWNRESPONSE; |
371 | } | 373 | } |
372 | 374 | ||
375 | GSM_Error ATGEN_ReplyGetUSSD(GSM_Protocol_Message msg, GSM_StateMachine *s) | ||
376 | { | ||
377 | unsigned char buffer[2000],buffer2[4000]; | ||
378 | int i = 10; | ||
379 | |||
380 | /* Ugly hack */ | ||
381 | while (msg.Buffer[i]!=13) i++; | ||
382 | i = i - 6; | ||
383 | memcpy(buffer,msg.Buffer+10,i-11); | ||
384 | buffer[i-11] = 0x00; | ||
385 | |||
386 | smprintf(s, "USSD reply: \"%s\"\n",buffer); | ||
387 | |||
388 | if (s->Phone.Data.EnableIncomingUSSD && s->User.IncomingUSSD!=NULL) { | ||
389 | EncodeUnicode(buffer2,buffer,strlen(buffer)); | ||
390 | s->User.IncomingUSSD(s->CurrentConfig->Device, buffer2); | ||
391 | } | ||
392 | |||
393 | return ERR_NONE; | ||
394 | } | ||
395 | |||
396 | GSM_Error ATGEN_SetIncomingUSSD(GSM_StateMachine *s, bool enable) | ||
397 | { | ||
398 | GSM_Error error; | ||
399 | |||
400 | if (enable) { | ||
401 | smprintf(s, "Enabling incoming USSD\n"); | ||
402 | error=GSM_WaitFor (s, "AT+CUSD=1\r", 10, 0x00, 3, ID_SetUSSD); | ||
403 | } else { | ||
404 | smprintf(s, "Disabling incoming USSD\n"); | ||
405 | error=GSM_WaitFor (s, "AT+CUSD=0\r", 10, 0x00, 3, ID_SetUSSD); | ||
406 | } | ||
407 | if (error==ERR_NONE) s->Phone.Data.EnableIncomingUSSD = enable; | ||
408 | return error; | ||
409 | } | ||
410 | |||
373 | GSM_Error ATGEN_ReplyGetModel(GSM_Protocol_Message msg, GSM_StateMachine *s) | 411 | GSM_Error ATGEN_ReplyGetModel(GSM_Protocol_Message msg, GSM_StateMachine *s) |
374 | { | 412 | { |
375 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; | 413 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; |
376 | GSM_Phone_Data *Data = &s->Phone.Data; | 414 | GSM_Phone_Data *Data = &s->Phone.Data; |
377 | 415 | ||
378 | if (s->Phone.Data.Priv.ATGEN.ReplyState != AT_Reply_OK) return ERR_NOTSUPPORTED; | 416 | if (s->Phone.Data.Priv.ATGEN.ReplyState != AT_Reply_OK) return ERR_NOTSUPPORTED; |
379 | 417 | ||
380 | if (strlen(GetLineString(msg.Buffer, Priv->Lines, 2)) <= MAX_MODEL_LENGTH) { | 418 | if (strlen(GetLineString(msg.Buffer, Priv->Lines, 2)) <= MAX_MODEL_LENGTH) { |
381 | CopyLineString(Data->Model, msg.Buffer, Priv->Lines, 2); | 419 | CopyLineString(Data->Model, msg.Buffer, Priv->Lines, 2); |
382 | 420 | ||
383 | /* Sometimes phone adds this before manufacturer (Sagem) */ | 421 | /* Sometimes phone adds this before manufacturer (Sagem) */ |
384 | if (strncmp("+CGMM: ", Data->Model, 7) == 0) { | 422 | if (strncmp("+CGMM: ", Data->Model, 7) == 0) { |
385 | memmove(Data->Model, Data->Model + 7, strlen(Data->Model + 7) + 1); | 423 | memmove(Data->Model, Data->Model + 7, strlen(Data->Model + 7) + 1); |
386 | } | 424 | } |
387 | 425 | ||
388 | Data->ModelInfo = GetModelData(NULL,Data->Model,NULL); | 426 | Data->ModelInfo = GetModelData(NULL,Data->Model,NULL); |
389 | if (Data->ModelInfo->number[0] == 0) Data->ModelInfo = GetModelData(NULL,NULL,Data->Model); | 427 | if (Data->ModelInfo->number[0] == 0) Data->ModelInfo = GetModelData(NULL,NULL,Data->Model); |
390 | if (Data->ModelInfo->number[0] == 0) Data->ModelInfo = GetModelData(Data->Model,NULL,NULL); | 428 | if (Data->ModelInfo->number[0] == 0) Data->ModelInfo = GetModelData(Data->Model,NULL,NULL); |
391 | 429 | ||
392 | if (Data->ModelInfo->number[0] != 0) strcpy(Data->Model,Data->ModelInfo->number); | 430 | if (Data->ModelInfo->number[0] != 0) strcpy(Data->Model,Data->ModelInfo->number); |
393 | 431 | ||
394 | if (strstr(msg.Buffer,"Nokia")) Priv->Manufacturer = AT_Nokia; | 432 | if (strstr(msg.Buffer,"Nokia")) Priv->Manufacturer = AT_Nokia; |
395 | else if (strstr(msg.Buffer,"M20")) Priv->Manufacturer = AT_Siemens; | 433 | else if (strstr(msg.Buffer,"M20")) Priv->Manufacturer = AT_Siemens; |
396 | else if (strstr(msg.Buffer,"MC35")) Priv->Manufacturer = AT_Siemens; | 434 | else if (strstr(msg.Buffer,"MC35")) Priv->Manufacturer = AT_Siemens; |
435 | else if (strstr(msg.Buffer,"TC35")) Priv->Manufacturer = AT_Siemens; | ||
397 | else if (strstr(msg.Buffer, "iPAQ")) Priv->Manufacturer = AT_HP; | 436 | else if (strstr(msg.Buffer, "iPAQ")) Priv->Manufacturer = AT_HP; |
398 | 437 | ||
399 | if (strstr(msg.Buffer,"M20")) strcpy(Data->Model,"M20"); | 438 | if (strstr(msg.Buffer,"M20")) strcpy(Data->Model,"M20"); |
400 | else if (strstr(msg.Buffer,"MC35")) strcpy(Data->Model,"MC35"); | 439 | else if (strstr(msg.Buffer,"MC35")) strcpy(Data->Model,"MC35"); |
440 | else if (strstr(msg.Buffer,"TC35")) strcpy(Data->Model,"TC35"); | ||
401 | else if (strstr(msg.Buffer, "iPAQ")) strcpy(Data->Model,"iPAQ"); | 441 | else if (strstr(msg.Buffer, "iPAQ")) strcpy(Data->Model,"iPAQ"); |
402 | } else { | 442 | } else { |
403 | smprintf(s, "WARNING: Model name too long, increase MAX_MODEL_LENGTH to at least %zd\n", strlen(GetLineString(msg.Buffer, Priv->Lines, 2))); | 443 | smprintf(s, "WARNING: Model name too long, increase MAX_MODEL_LENGTH to at least %zd\n", strlen(GetLineString(msg.Buffer, Priv->Lines, 2))); |
404 | } | 444 | } |
405 | 445 | ||
406 | return ERR_NONE; | 446 | return ERR_NONE; |
407 | } | 447 | } |
408 | 448 | ||
409 | GSM_Error ATGEN_GetModel(GSM_StateMachine *s) | 449 | GSM_Error ATGEN_GetModel(GSM_StateMachine *s) |
410 | { | 450 | { |
411 | GSM_Error error; | 451 | GSM_Error error; |
412 | 452 | ||
@@ -472,24 +512,29 @@ GSM_Error ATGEN_ReplyGetManufacturer(GSM_Protocol_Message msg, GSM_StateMachine | |||
472 | Priv->Manufacturer = AT_HP; | 512 | Priv->Manufacturer = AT_HP; |
473 | } | 513 | } |
474 | if (strstr(msg.Buffer,"ALCATEL")) { | 514 | if (strstr(msg.Buffer,"ALCATEL")) { |
475 | smprintf(s, "Alcatel\n"); | 515 | smprintf(s, "Alcatel\n"); |
476 | strcpy(s->Phone.Data.Manufacturer,"Alcatel"); | 516 | strcpy(s->Phone.Data.Manufacturer,"Alcatel"); |
477 | Priv->Manufacturer = AT_Alcatel; | 517 | Priv->Manufacturer = AT_Alcatel; |
478 | } | 518 | } |
479 | if (strstr(msg.Buffer,"SAGEM")) { | 519 | if (strstr(msg.Buffer,"SAGEM")) { |
480 | smprintf(s, "Sagem\n"); | 520 | smprintf(s, "Sagem\n"); |
481 | strcpy(s->Phone.Data.Manufacturer,"Sagem"); | 521 | strcpy(s->Phone.Data.Manufacturer,"Sagem"); |
482 | Priv->Manufacturer = AT_Sagem; | 522 | Priv->Manufacturer = AT_Sagem; |
483 | } | 523 | } |
524 | if (strstr(msg.Buffer,"Samsung")) { | ||
525 | smprintf(s, "Samsung\n"); | ||
526 | strcpy(s->Phone.Data.Manufacturer,"Samsung"); | ||
527 | Priv->Manufacturer = AT_Samsung; | ||
528 | } | ||
484 | return ERR_NONE; | 529 | return ERR_NONE; |
485 | case AT_Reply_CMSError: | 530 | case AT_Reply_CMSError: |
486 | return ATGEN_HandleCMSError(s); | 531 | return ATGEN_HandleCMSError(s); |
487 | default: | 532 | default: |
488 | break; | 533 | break; |
489 | } | 534 | } |
490 | return ERR_UNKNOWNRESPONSE; | 535 | return ERR_UNKNOWNRESPONSE; |
491 | } | 536 | } |
492 | 537 | ||
493 | GSM_Error ATGEN_GetManufacturer(GSM_StateMachine *s) | 538 | GSM_Error ATGEN_GetManufacturer(GSM_StateMachine *s) |
494 | { | 539 | { |
495 | if (s->Phone.Data.Manufacturer[0] != 0) return ERR_NONE; | 540 | if (s->Phone.Data.Manufacturer[0] != 0) return ERR_NONE; |
@@ -665,34 +710,44 @@ GSM_Error ATGEN_ReplyGetSMSMemories(GSM_Protocol_Message msg, GSM_StateMachine * | |||
665 | case AT_Reply_OK: | 710 | case AT_Reply_OK: |
666 | /* Reply here is: | 711 | /* Reply here is: |
667 | * (memories for reading)[, (memories for writing)[, (memories for storing received messages)]] | 712 | * (memories for reading)[, (memories for writing)[, (memories for storing received messages)]] |
668 | * each memory is in quotes, | 713 | * each memory is in quotes, |
669 | * Example: ("SM"), ("SM"), ("SM") | 714 | * Example: ("SM"), ("SM"), ("SM") |
670 | * | 715 | * |
671 | * We need to get from this supported memories. For this case | 716 | * We need to get from this supported memories. For this case |
672 | * we assume, that just appearence of memory makes it | 717 | * we assume, that just appearence of memory makes it |
673 | * available for everything. Then we need to find out whether | 718 | * available for everything. Then we need to find out whether |
674 | * phone supports writing to memory. This is done by searching | 719 | * phone supports writing to memory. This is done by searching |
675 | * for "), (", which will appear between lists. | 720 | * for "), (", which will appear between lists. |
676 | */ | 721 | */ |
677 | s->Phone.Data.Priv.ATGEN.CanSaveSMS = (strstr(msg.Buffer, "), (") != NULL); | 722 | s->Phone.Data.Priv.ATGEN.CanSaveSMS = false; |
723 | if (strstr(msg.Buffer, "), (") != NULL || strstr(msg.Buffer, "),(") != NULL) { | ||
724 | s->Phone.Data.Priv.ATGEN.CanSaveSMS = true; | ||
725 | } | ||
726 | |||
678 | if (strstr(msg.Buffer, "\"SM\"") != NULL) s->Phone.Data.Priv.ATGEN.SIMSMSMemory = AT_AVAILABLE; | 727 | if (strstr(msg.Buffer, "\"SM\"") != NULL) s->Phone.Data.Priv.ATGEN.SIMSMSMemory = AT_AVAILABLE; |
679 | else s->Phone.Data.Priv.ATGEN.SIMSMSMemory = AT_NOTAVAILABLE; | 728 | else s->Phone.Data.Priv.ATGEN.SIMSMSMemory = AT_NOTAVAILABLE; |
729 | |||
680 | if (strstr(msg.Buffer, "\"ME\"") != NULL) s->Phone.Data.Priv.ATGEN.PhoneSMSMemory = AT_AVAILABLE; | 730 | if (strstr(msg.Buffer, "\"ME\"") != NULL) s->Phone.Data.Priv.ATGEN.PhoneSMSMemory = AT_AVAILABLE; |
681 | else s->Phone.Data.Priv.ATGEN.PhoneSMSMemory = AT_NOTAVAILABLE; | 731 | else s->Phone.Data.Priv.ATGEN.PhoneSMSMemory = AT_NOTAVAILABLE; |
682 | smprintf(s, "Available SMS memories received, ME = %d, SM = %d\n", s->Phone.Data.Priv.ATGEN.PhoneSMSMemory, s->Phone.Data.Priv.ATGEN.SIMSMSMemory); | 732 | |
733 | smprintf(s, "Available SMS memories received, ME = %d, SM = %d, cansavesms =", s->Phone.Data.Priv.ATGEN.PhoneSMSMemory, s->Phone.Data.Priv.ATGEN.SIMSMSMemory); | ||
734 | if (s->Phone.Data.Priv.ATGEN.CanSaveSMS) smprintf(s, "true"); | ||
735 | smprintf(s, "\n"); | ||
683 | return ERR_NONE; | 736 | return ERR_NONE; |
684 | case AT_Reply_Error: | 737 | case AT_Reply_Error: |
685 | case AT_Reply_CMSError: | 738 | case AT_Reply_CMSError: |
686 | return ATGEN_HandleCMSError(s); | 739 | return ATGEN_HandleCMSError(s); |
740 | case AT_Reply_CMEError: | ||
741 | return ATGEN_HandleCMEError(s); | ||
687 | default: | 742 | default: |
688 | return ERR_UNKNOWNRESPONSE; | 743 | return ERR_UNKNOWNRESPONSE; |
689 | } | 744 | } |
690 | } | 745 | } |
691 | 746 | ||
692 | GSM_Error ATGEN_GetSMSMemories(GSM_StateMachine *s) | 747 | GSM_Error ATGEN_GetSMSMemories(GSM_StateMachine *s) |
693 | { | 748 | { |
694 | smprintf(s, "Getting available SMS memories\n"); | 749 | smprintf(s, "Getting available SMS memories\n"); |
695 | return GSM_WaitFor (s, "AT+CPMS=?\r", 10, 0x00, 4, ID_GetSMSMemories); | 750 | return GSM_WaitFor (s, "AT+CPMS=?\r", 10, 0x00, 4, ID_GetSMSMemories); |
696 | } | 751 | } |
697 | 752 | ||
698 | GSM_Error ATGEN_SetSMSMemory(GSM_StateMachine *s, bool SIM) | 753 | GSM_Error ATGEN_SetSMSMemory(GSM_StateMachine *s, bool SIM) |
@@ -849,26 +904,27 @@ GSM_Error ATGEN_ReplyGetSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s | |||
849 | CopyLineString(buffer, msg.Buffer, Priv->Lines, 2); | 904 | CopyLineString(buffer, msg.Buffer, Priv->Lines, 2); |
850 | switch (buffer[7]) { | 905 | switch (buffer[7]) { |
851 | case '0': sms->State = SMS_UnRead; break; | 906 | case '0': sms->State = SMS_UnRead; break; |
852 | case '1': sms->State = SMS_Read;break; | 907 | case '1': sms->State = SMS_Read;break; |
853 | case '2': sms->State = SMS_UnSent;break; | 908 | case '2': sms->State = SMS_UnSent;break; |
854 | default : sms->State = SMS_Sent;break;//case '3' | 909 | default : sms->State = SMS_Sent;break;//case '3' |
855 | } | 910 | } |
856 | DecodeHexBin (buffer, GetLineString(msg.Buffer,Priv->Lines,3), strlen(GetLineString(msg.Buffer,Priv->Lines,3))); | 911 | DecodeHexBin (buffer, GetLineString(msg.Buffer,Priv->Lines,3), strlen(GetLineString(msg.Buffer,Priv->Lines,3))); |
857 | /* Siemens MC35 (only ?) */ | 912 | /* Siemens MC35 (only ?) */ |
858 | if (strstr(msg.Buffer,"+CMGR: 0,,0")!=NULL) return ERR_EMPTY; | 913 | if (strstr(msg.Buffer,"+CMGR: 0,,0")!=NULL) return ERR_EMPTY; |
859 | /* Siemens M20 */ | 914 | /* Siemens M20 */ |
860 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_M20SMS)) { | 915 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_M20SMS)) { |
861 | if (buffer[1]!=NUMBER_UNKNOWN && buffer[1]!=NUMBER_INTERNATIONAL && | 916 | /* we check for the most often visible */ |
862 | buffer[1]!=NUMBER_ALPHANUMERIC) { | 917 | if (buffer[1]!=NUMBER_UNKNOWN_NUMBERING_PLAN_ISDN && buffer[1]!=NUMBER_INTERNATIONAL_NUMBERING_PLAN_ISDN && |
918 | buffer[1]!=NUMBER_ALPHANUMERIC_NUMBERING_PLAN_UNKNOWN) { | ||
863 | /* Seems to be Delivery Report */ | 919 | /* Seems to be Delivery Report */ |
864 | smprintf(s, "SMS type - status report (M20 style)\n"); | 920 | smprintf(s, "SMS type - status report (M20 style)\n"); |
865 | sms->PDU = SMS_Status_Report; | 921 | sms->PDU = SMS_Status_Report; |
866 | sms->Folder = 1;/*INBOX SIM*/ | 922 | sms->Folder = 1;/*INBOX SIM*/ |
867 | sms->InboxFolder = true; | 923 | sms->InboxFolder = true; |
868 | 924 | ||
869 | smsframe[12]=buffer[current++]; | 925 | smsframe[12]=buffer[current++]; |
870 | smsframe[PHONE_SMSStatusReport.TPMR]=buffer[current++]; | 926 | smsframe[PHONE_SMSStatusReport.TPMR]=buffer[current++]; |
871 | current2=((buffer[current])+1)/2+1; | 927 | current2=((buffer[current])+1)/2+1; |
872 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSStatusReport.Number+i]=buffer[current++]; | 928 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSStatusReport.Number+i]=buffer[current++]; |
873 | for(i=0;i<7;i++) smsframe[PHONE_SMSStatusReport.DateTime+i]=buffer[current++]; | 929 | for(i=0;i<7;i++) smsframe[PHONE_SMSStatusReport.DateTime+i]=buffer[current++]; |
874 | smsframe[0] = 0; | 930 | smsframe[0] = 0; |
@@ -885,25 +941,25 @@ GSM_Error ATGEN_ReplyGetSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s | |||
885 | switch (smsframe[12] & 0x03) { | 941 | switch (smsframe[12] & 0x03) { |
886 | case 0x00: | 942 | case 0x00: |
887 | smprintf(s, "SMS type - deliver\n"); | 943 | smprintf(s, "SMS type - deliver\n"); |
888 | sms->PDU = SMS_Deliver; | 944 | sms->PDU = SMS_Deliver; |
889 | if (Priv->SMSMemory == MEM_SM) { | 945 | if (Priv->SMSMemory == MEM_SM) { |
890 | sms->Folder = 1; /*INBOX SIM*/ | 946 | sms->Folder = 1; /*INBOX SIM*/ |
891 | } else { | 947 | } else { |
892 | sms->Folder = 3; /*INBOX ME*/ | 948 | sms->Folder = 3; /*INBOX ME*/ |
893 | } | 949 | } |
894 | sms->InboxFolder = true; | 950 | sms->InboxFolder = true; |
895 | current2=((buffer[current])+1)/2+1; | 951 | current2=((buffer[current])+1)/2+1; |
896 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_M20SMS)) { | 952 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_M20SMS)) { |
897 | if (buffer[current+1]==NUMBER_ALPHANUMERIC) { | 953 | if (buffer[current+1]==NUMBER_ALPHANUMERIC_NUMBERING_PLAN_UNKNOWN) { |
898 | smprintf(s, "Trying to read alphanumeric number\n"); | 954 | smprintf(s, "Trying to read alphanumeric number\n"); |
899 | for(i=0;i<4;i++) smsframe[PHONE_SMSDeliver.Number+i]=buffer[current++]; | 955 | for(i=0;i<4;i++) smsframe[PHONE_SMSDeliver.Number+i]=buffer[current++]; |
900 | current+=6; | 956 | current+=6; |
901 | for(i=0;i<current2-3;i++) smsframe[PHONE_SMSDeliver.Number+i+4]=buffer[current++]; | 957 | for(i=0;i<current2-3;i++) smsframe[PHONE_SMSDeliver.Number+i+4]=buffer[current++]; |
902 | } else { | 958 | } else { |
903 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSDeliver.Number+i]=buffer[current++]; | 959 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSDeliver.Number+i]=buffer[current++]; |
904 | } | 960 | } |
905 | } else { | 961 | } else { |
906 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSDeliver.Number+i]=buffer[current++]; | 962 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSDeliver.Number+i]=buffer[current++]; |
907 | } | 963 | } |
908 | smsframe[PHONE_SMSDeliver.TPPID] = buffer[current++]; | 964 | smsframe[PHONE_SMSDeliver.TPPID] = buffer[current++]; |
909 | smsframe[PHONE_SMSDeliver.TPDCS] = buffer[current++]; | 965 | smsframe[PHONE_SMSDeliver.TPDCS] = buffer[current++]; |
@@ -916,49 +972,49 @@ GSM_Error ATGEN_ReplyGetSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s | |||
916 | smprintf(s, "SMS type - submit\n"); | 972 | smprintf(s, "SMS type - submit\n"); |
917 | sms->PDU = SMS_Submit; | 973 | sms->PDU = SMS_Submit; |
918 | if (Priv->SMSMemory == MEM_SM) { | 974 | if (Priv->SMSMemory == MEM_SM) { |
919 | sms->Folder = 2; /*OUTBOX SIM*/ | 975 | sms->Folder = 2; /*OUTBOX SIM*/ |
920 | smprintf(s, "Outbox SIM\n"); | 976 | smprintf(s, "Outbox SIM\n"); |
921 | } else { | 977 | } else { |
922 | sms->Folder = 4; /*OUTBOX ME*/ | 978 | sms->Folder = 4; /*OUTBOX ME*/ |
923 | } | 979 | } |
924 | sms->InboxFolder = false; | 980 | sms->InboxFolder = false; |
925 | smsframe[PHONE_SMSSubmit.TPMR] = buffer[current++]; | 981 | smsframe[PHONE_SMSSubmit.TPMR] = buffer[current++]; |
926 | current2=((buffer[current])+1)/2+1; | 982 | current2=((buffer[current])+1)/2+1; |
927 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_M20SMS)) { | 983 | if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_M20SMS)) { |
928 | if (buffer[current+1]==NUMBER_ALPHANUMERIC) { | 984 | if (buffer[current+1]==NUMBER_ALPHANUMERIC_NUMBERING_PLAN_UNKNOWN) { |
929 | smprintf(s, "Trying to read alphanumeric number\n"); | 985 | smprintf(s, "Trying to read alphanumeric number\n"); |
930 | for(i=0;i<4;i++) smsframe[PHONE_SMSSubmit.Number+i]=buffer[current++]; | 986 | for(i=0;i<4;i++) smsframe[PHONE_SMSSubmit.Number+i]=buffer[current++]; |
931 | current+=6; | 987 | current+=6; |
932 | for(i=0;i<current2-3;i++) smsframe[PHONE_SMSSubmit.Number+i+4]=buffer[current++]; | 988 | for(i=0;i<current2-3;i++) smsframe[PHONE_SMSSubmit.Number+i+4]=buffer[current++]; |
933 | } else { | 989 | } else { |
934 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSSubmit.Number+i]=buffer[current++]; | 990 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSSubmit.Number+i]=buffer[current++]; |
935 | } | 991 | } |
936 | } else { | 992 | } else { |
937 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSSubmit.Number+i]=buffer[current++]; | 993 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSSubmit.Number+i]=buffer[current++]; |
938 | } | 994 | } |
939 | smsframe[PHONE_SMSSubmit.TPPID] = buffer[current++]; | 995 | smsframe[PHONE_SMSSubmit.TPPID] = buffer[current++]; |
940 | smsframe[PHONE_SMSSubmit.TPDCS] = buffer[current++]; | 996 | smsframe[PHONE_SMSSubmit.TPDCS] = buffer[current++]; |
941 | /* See GSM 03.40 9.2.3.3 - TPVP can not exist in frame */ | 997 | /* See GSM 03.40 9.2.3.3 - TPVP can not exist in frame */ |
942 | if ((smsframe[12] & 0x18)!=0) current++; //TPVP is ignored now | 998 | if ((smsframe[12] & 0x18)!=0) current++; //TPVP is ignored now |
943 | smsframe[PHONE_SMSSubmit.TPUDL] = buffer[current++]; | 999 | smsframe[PHONE_SMSSubmit.TPUDL] = buffer[current++]; |
944 | for(i=0;i<smsframe[PHONE_SMSSubmit.TPUDL];i++) smsframe[i+PHONE_SMSSubmit.Text]=buffer[current++]; | 1000 | for(i=0;i<smsframe[PHONE_SMSSubmit.TPUDL];i++) smsframe[i+PHONE_SMSSubmit.Text]=buffer[current++]; |
945 | GSM_DecodeSMSFrame(sms,smsframe,PHONE_SMSSubmit); | 1001 | GSM_DecodeSMSFrame(sms,smsframe,PHONE_SMSSubmit); |
946 | return ERR_NONE; | 1002 | return ERR_NONE; |
947 | case 0x02: | 1003 | case 0x02: |
948 | smprintf(s, "SMS type - status report\n"); | 1004 | smprintf(s, "SMS type - status report\n"); |
949 | sms->PDU = SMS_Status_Report; | 1005 | sms->PDU = SMS_Status_Report; |
950 | sms->Folder = 1;/*INBOX SIM*/ | 1006 | sms->Folder = 1;/*INBOX SIM*/ |
951 | sms->InboxFolder = true; | 1007 | sms->InboxFolder = true; |
952 | smprintf(s, "TPMR is %02x\n",buffer[current]); | 1008 | smprintf(s, "TPMR is %d\n",buffer[current]); |
953 | smsframe[PHONE_SMSStatusReport.TPMR] = buffer[current++]; | 1009 | smsframe[PHONE_SMSStatusReport.TPMR] = buffer[current++]; |
954 | current2=((buffer[current])+1)/2+1; | 1010 | current2=((buffer[current])+1)/2+1; |
955 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSStatusReport.Number+i]=buffer[current++]; | 1011 | for(i=0;i<current2+1;i++) smsframe[PHONE_SMSStatusReport.Number+i]=buffer[current++]; |
956 | for(i=0;i<7;i++) smsframe[PHONE_SMSStatusReport.DateTime+i]=buffer[current++]; | 1012 | for(i=0;i<7;i++) smsframe[PHONE_SMSStatusReport.DateTime+i]=buffer[current++]; |
957 | for(i=0;i<7;i++) smsframe[PHONE_SMSStatusReport.SMSCTime+i]=buffer[current++]; | 1013 | for(i=0;i<7;i++) smsframe[PHONE_SMSStatusReport.SMSCTime+i]=buffer[current++]; |
958 | smsframe[PHONE_SMSStatusReport.TPStatus]=buffer[current]; | 1014 | smsframe[PHONE_SMSStatusReport.TPStatus]=buffer[current]; |
959 | GSM_DecodeSMSFrame(sms,smsframe,PHONE_SMSStatusReport); | 1015 | GSM_DecodeSMSFrame(sms,smsframe,PHONE_SMSStatusReport); |
960 | return ERR_NONE; | 1016 | return ERR_NONE; |
961 | } | 1017 | } |
962 | break; | 1018 | break; |
963 | case SMS_AT_TXT: | 1019 | case SMS_AT_TXT: |
964 | current = 0; | 1020 | current = 0; |
@@ -1631,35 +1687,35 @@ GSM_Error ATGEN_ReplySendSMS(GSM_Protocol_Message msg, GSM_StateMachine *s) | |||
1631 | if (s->Protocol.Data.AT.EditMode) { | 1687 | if (s->Protocol.Data.AT.EditMode) { |
1632 | if (s->Phone.Data.Priv.ATGEN.ReplyState != AT_Reply_SMSEdit) { | 1688 | if (s->Phone.Data.Priv.ATGEN.ReplyState != AT_Reply_SMSEdit) { |
1633 | return ERR_UNKNOWN; | 1689 | return ERR_UNKNOWN; |
1634 | } | 1690 | } |
1635 | s->Protocol.Data.AT.EditMode = false; | 1691 | s->Protocol.Data.AT.EditMode = false; |
1636 | return ERR_NONE; | 1692 | return ERR_NONE; |
1637 | } | 1693 | } |
1638 | 1694 | ||
1639 | switch (Priv->ReplyState) { | 1695 | switch (Priv->ReplyState) { |
1640 | case AT_Reply_OK: | 1696 | case AT_Reply_OK: |
1641 | smprintf(s, "SMS sent OK\n"); | 1697 | smprintf(s, "SMS sent OK\n"); |
1642 | if (s->User.SendSMSStatus!=NULL) { | 1698 | if (s->User.SendSMSStatus!=NULL) { |
1643 | start = strstr(msg.Buffer, "+CMGW: "); | 1699 | start = strstr(msg.Buffer, "+CMGS: "); |
1644 | if (start != NULL) { | 1700 | if (start != NULL) { |
1645 | s->User.SendSMSStatus(s->CurrentConfig->Device,0,atoi(start+7)); | 1701 | s->User.SendSMSStatus(s->CurrentConfig->Device,0,atoi(start+7)); |
1646 | } else { | 1702 | } else { |
1647 | s->User.SendSMSStatus(s->CurrentConfig->Device,0,0); | 1703 | s->User.SendSMSStatus(s->CurrentConfig->Device,0,-1); |
1648 | } | 1704 | } |
1649 | } | 1705 | } |
1650 | return ERR_NONE; | 1706 | return ERR_NONE; |
1651 | case AT_Reply_CMSError: | 1707 | case AT_Reply_CMSError: |
1652 | smprintf(s, "Error %i\n",Priv->ErrorCode); | 1708 | smprintf(s, "Error %i\n",Priv->ErrorCode); |
1653 | if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,Priv->ErrorCode,0); | 1709 | if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,Priv->ErrorCode,-1); |
1654 | return ATGEN_HandleCMSError(s); | 1710 | return ATGEN_HandleCMSError(s); |
1655 | case AT_Reply_Error: | 1711 | case AT_Reply_Error: |
1656 | return ERR_UNKNOWN; | 1712 | return ERR_UNKNOWN; |
1657 | default: | 1713 | default: |
1658 | return ERR_UNKNOWNRESPONSE; | 1714 | return ERR_UNKNOWNRESPONSE; |
1659 | } | 1715 | } |
1660 | } | 1716 | } |
1661 | 1717 | ||
1662 | GSM_Error ATGEN_SendSMS(GSM_StateMachine *s, GSM_SMSMessage *sms) | 1718 | GSM_Error ATGEN_SendSMS(GSM_StateMachine *s, GSM_SMSMessage *sms) |
1663 | { | 1719 | { |
1664 | GSM_Error error,error2; | 1720 | GSM_Error error,error2; |
1665 | int current, current2, Replies; | 1721 | int current, current2, Replies; |
@@ -1778,24 +1834,37 @@ GSM_Error ATGEN_SetDateTime(GSM_StateMachine *s, GSM_DateTime *date_time) | |||
1778 | GSM_Error ATGEN_GetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm) | 1834 | GSM_Error ATGEN_GetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm) |
1779 | { | 1835 | { |
1780 | if (alarm->Location != 1) return ERR_NOTSUPPORTED; | 1836 | if (alarm->Location != 1) return ERR_NOTSUPPORTED; |
1781 | 1837 | ||
1782 | alarm->Repeating = true; | 1838 | alarm->Repeating = true; |
1783 | alarm->Text[0] = 0; alarm->Text[1] = 0; | 1839 | alarm->Text[0] = 0; alarm->Text[1] = 0; |
1784 | 1840 | ||
1785 | s->Phone.Data.Alarm = alarm; | 1841 | s->Phone.Data.Alarm = alarm; |
1786 | smprintf(s, "Getting alarm\n"); | 1842 | smprintf(s, "Getting alarm\n"); |
1787 | return GSM_WaitFor (s, "AT+CALA?\r", 9, 0x00, 4, ID_GetAlarm); | 1843 | return GSM_WaitFor (s, "AT+CALA?\r", 9, 0x00, 4, ID_GetAlarm); |
1788 | } | 1844 | } |
1789 | 1845 | ||
1846 | /* R320 only takes HH:MM. Do other phones understand full date? */ | ||
1847 | GSM_Error ATGEN_SetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm) | ||
1848 | { | ||
1849 | char req[20]; | ||
1850 | |||
1851 | if (alarm->Location != 1) return ERR_INVALIDLOCATION; | ||
1852 | |||
1853 | sprintf(req, "AT+CALA=\"%02i:%02i\"\r",alarm->DateTime.Hour,alarm->DateTime.Minute); | ||
1854 | |||
1855 | smprintf(s, "Setting Alarm\n"); | ||
1856 | return GSM_WaitFor (s, req, strlen(req), 0x00, 3, ID_SetAlarm); | ||
1857 | } | ||
1858 | |||
1790 | GSM_Error ATGEN_ReplyGetSMSC(GSM_Protocol_Message msg, GSM_StateMachine *s) | 1859 | GSM_Error ATGEN_ReplyGetSMSC(GSM_Protocol_Message msg, GSM_StateMachine *s) |
1791 | { | 1860 | { |
1792 | GSM_SMSC *SMSC = s->Phone.Data.SMSC; | 1861 | GSM_SMSC *SMSC = s->Phone.Data.SMSC; |
1793 | int current; | 1862 | int current; |
1794 | int len; | 1863 | int len; |
1795 | unsigned char buffer[100]; | 1864 | unsigned char buffer[100]; |
1796 | 1865 | ||
1797 | switch (s->Phone.Data.Priv.ATGEN.ReplyState) { | 1866 | switch (s->Phone.Data.Priv.ATGEN.ReplyState) { |
1798 | case AT_Reply_OK: | 1867 | case AT_Reply_OK: |
1799 | smprintf(s, "SMSC info received\n"); | 1868 | smprintf(s, "SMSC info received\n"); |
1800 | 1869 | ||
1801 | current = 0; | 1870 | current = 0; |
@@ -2193,24 +2262,26 @@ GSM_Error ATGEN_GetMemoryInfo(GSM_StateMachine *s, GSM_MemoryStatus *Status, GSM | |||
2193 | char req[20]; | 2262 | char req[20]; |
2194 | int start; | 2263 | int start; |
2195 | int end; | 2264 | int end; |
2196 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; | 2265 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; |
2197 | 2266 | ||
2198 | smprintf(s, "Getting memory information\n"); | 2267 | smprintf(s, "Getting memory information\n"); |
2199 | 2268 | ||
2200 | Priv->MemorySize = 0; | 2269 | Priv->MemorySize = 0; |
2201 | Priv->TextLength = 0; | 2270 | Priv->TextLength = 0; |
2202 | Priv->NumberLength = 0; | 2271 | Priv->NumberLength = 0; |
2203 | 2272 | ||
2204 | error = GSM_WaitFor (s, "AT+CPBR=?\r", 10, 0x00, 4, ID_GetMemoryStatus); | 2273 | error = GSM_WaitFor (s, "AT+CPBR=?\r", 10, 0x00, 4, ID_GetMemoryStatus); |
2274 | if (Priv->Manufacturer == AT_Samsung) | ||
2275 | error = GSM_WaitFor (s, "", 0, 0x00, 4, ID_GetMemoryStatus); | ||
2205 | if (error != ERR_NONE) return error; | 2276 | if (error != ERR_NONE) return error; |
2206 | if (NeededInfo == AT_Total || NeededInfo == AT_Sizes || NeededInfo == AT_First) return ERR_NONE; | 2277 | if (NeededInfo == AT_Total || NeededInfo == AT_Sizes || NeededInfo == AT_First) return ERR_NONE; |
2207 | 2278 | ||
2208 | smprintf(s, "Getting memory status by reading values\n"); | 2279 | smprintf(s, "Getting memory status by reading values\n"); |
2209 | 2280 | ||
2210 | s->Phone.Data.MemoryStatus= Status; | 2281 | s->Phone.Data.MemoryStatus= Status; |
2211 | Status->MemoryUsed = 0; | 2282 | Status->MemoryUsed = 0; |
2212 | Status->MemoryFree = 0; | 2283 | Status->MemoryFree = 0; |
2213 | start = Priv->FirstMemoryEntry; | 2284 | start = Priv->FirstMemoryEntry; |
2214 | Priv->NextMemoryEntry = 0; | 2285 | Priv->NextMemoryEntry = 0; |
2215 | while (1) { | 2286 | while (1) { |
2216 | end= start + 20; | 2287 | end= start + 20; |
@@ -2259,24 +2330,30 @@ GSM_Error ATGEN_SetPBKCharset(GSM_StateMachine *s, bool PreferUnicode) | |||
2259 | /* If we want unicode charset and we have it already or setting of it | 2330 | /* If we want unicode charset and we have it already or setting of it |
2260 | * failed, we have nothing to do. */ | 2331 | * failed, we have nothing to do. */ |
2261 | if (PreferUnicode && (Priv->PBKCharset==AT_PBK_UCS2 || Priv->UCS2CharsetFailed)) return ERR_NONE; | 2332 | if (PreferUnicode && (Priv->PBKCharset==AT_PBK_UCS2 || Priv->UCS2CharsetFailed)) return ERR_NONE; |
2262 | 2333 | ||
2263 | /* If we don't need unicode charset and we have some (or have unicode | 2334 | /* If we don't need unicode charset and we have some (or have unicode |
2264 | * charset when other failed), we have nothing to do. */ | 2335 | * charset when other failed), we have nothing to do. */ |
2265 | if (!PreferUnicode && (Priv->PBKCharset!=AT_PBK_UCS2 || Priv->NonUCS2CharsetFailed)) return ERR_NONE; | 2336 | if (!PreferUnicode && (Priv->PBKCharset!=AT_PBK_UCS2 || Priv->NonUCS2CharsetFailed)) return ERR_NONE; |
2266 | } | 2337 | } |
2267 | 2338 | ||
2268 | error=ATGEN_GetManufacturer(s); | 2339 | error=ATGEN_GetManufacturer(s); |
2269 | if (error != ERR_NONE) return error; | 2340 | if (error != ERR_NONE) return error; |
2270 | 2341 | ||
2342 | /* Samsung (and Sagem?) phones use only PCCP437? */ | ||
2343 | if (Priv->Manufacturer == AT_Samsung) { | ||
2344 | Priv->PBKCharset = AT_PBK_PCCP437; | ||
2345 | return ERR_NONE; | ||
2346 | } | ||
2347 | |||
2271 | if (PreferUnicode && !Priv->UCS2CharsetFailed) { | 2348 | if (PreferUnicode && !Priv->UCS2CharsetFailed) { |
2272 | smprintf(s, "Setting charset to UCS2\n"); | 2349 | smprintf(s, "Setting charset to UCS2\n"); |
2273 | error=GSM_WaitFor (s, "AT+CSCS=\"UCS2\"\r", 15, 0x00, 3, ID_SetMemoryCharset); | 2350 | error=GSM_WaitFor (s, "AT+CSCS=\"UCS2\"\r", 15, 0x00, 3, ID_SetMemoryCharset); |
2274 | if (error == ERR_NONE) { | 2351 | if (error == ERR_NONE) { |
2275 | Priv->PBKCharset = AT_PBK_UCS2; | 2352 | Priv->PBKCharset = AT_PBK_UCS2; |
2276 | return ERR_NONE; | 2353 | return ERR_NONE; |
2277 | } else { | 2354 | } else { |
2278 | Priv->UCS2CharsetFailed = true; | 2355 | Priv->UCS2CharsetFailed = true; |
2279 | } | 2356 | } |
2280 | } | 2357 | } |
2281 | 2358 | ||
2282 | smprintf(s, "Setting charset to HEX\n"); | 2359 | smprintf(s, "Setting charset to HEX\n"); |
@@ -2376,25 +2453,55 @@ GSM_Error ATGEN_ReplyGetMemory(GSM_Protocol_Message msg, GSM_StateMachine *s) | |||
2376 | Memory->Entries[1].EntryType=PBK_Text_Name; | 2453 | Memory->Entries[1].EntryType=PBK_Text_Name; |
2377 | switch (Priv->PBKCharset) { | 2454 | switch (Priv->PBKCharset) { |
2378 | case AT_PBK_HEX: | 2455 | case AT_PBK_HEX: |
2379 | DecodeHexBin(buffer2,buffer+1,strlen(buffer)-2); | 2456 | DecodeHexBin(buffer2,buffer+1,strlen(buffer)-2); |
2380 | DecodeDefault(Memory->Entries[1].Text,buffer2,strlen(buffer2),false,NULL); | 2457 | DecodeDefault(Memory->Entries[1].Text,buffer2,strlen(buffer2),false,NULL); |
2381 | break; | 2458 | break; |
2382 | case AT_PBK_GSM: | 2459 | case AT_PBK_GSM: |
2383 | DecodeDefault(Memory->Entries[1].Text,buffer+1,strlen(buffer)-2,false,NULL); | 2460 | DecodeDefault(Memory->Entries[1].Text,buffer+1,strlen(buffer)-2,false,NULL); |
2384 | break; | 2461 | break; |
2385 | case AT_PBK_UCS2: | 2462 | case AT_PBK_UCS2: |
2386 | DecodeHexUnicode(Memory->Entries[1].Text,buffer+1,strlen(buffer+1) - 1); | 2463 | DecodeHexUnicode(Memory->Entries[1].Text,buffer+1,strlen(buffer+1) - 1); |
2387 | break; | 2464 | break; |
2465 | case AT_PBK_PCCP437: | ||
2466 | /* FIXME: correctly decode PCCP437 */ | ||
2467 | DecodeDefault(Memory->Entries[1].Text,buffer+1,strlen(buffer)-2,false,NULL); | ||
2468 | break; | ||
2469 | } | ||
2470 | |||
2471 | /* Samsung number type */ | ||
2472 | if (Priv->Manufacturer == AT_Samsung) { | ||
2473 | int type; | ||
2474 | |||
2475 | pos += ATGEN_ExtractOneParameter(pos, buffer); | ||
2476 | smprintf(s, "Number type: %s\n",buffer); | ||
2477 | type = strtoul(buffer, NULL, 0); | ||
2478 | switch (type) { | ||
2479 | case 0: | ||
2480 | Memory->Entries[0].EntryType = PBK_Number_Mobile; | ||
2481 | break; | ||
2482 | case 1: | ||
2483 | Memory->Entries[0].EntryType = PBK_Number_Work; | ||
2484 | break; | ||
2485 | case 2: | ||
2486 | Memory->Entries[0].EntryType = PBK_Number_Home; | ||
2487 | break; | ||
2488 | case 3: | ||
2489 | Memory->Entries[0].EntryType = PBK_Text_Email; | ||
2490 | break; | ||
2491 | default: | ||
2492 | Memory->Entries[0].EntryType = PBK_Number_General; | ||
2493 | } | ||
2388 | } | 2494 | } |
2495 | |||
2389 | return ERR_NONE; | 2496 | return ERR_NONE; |
2390 | case AT_Reply_CMEError: | 2497 | case AT_Reply_CMEError: |
2391 | return ATGEN_HandleCMEError(s); | 2498 | return ATGEN_HandleCMEError(s); |
2392 | case AT_Reply_Error: | 2499 | case AT_Reply_Error: |
2393 | smprintf(s, "Error - too high location ?\n"); | 2500 | smprintf(s, "Error - too high location ?\n"); |
2394 | return ERR_INVALIDLOCATION; | 2501 | return ERR_INVALIDLOCATION; |
2395 | case AT_Reply_CMSError: | 2502 | case AT_Reply_CMSError: |
2396 | return ATGEN_HandleCMSError(s); | 2503 | return ATGEN_HandleCMSError(s); |
2397 | default: | 2504 | default: |
2398 | break; | 2505 | break; |
2399 | } | 2506 | } |
2400 | return ERR_UNKNOWNRESPONSE; | 2507 | return ERR_UNKNOWNRESPONSE; |
@@ -2553,24 +2660,26 @@ GSM_Error ATGEN_DialVoice(GSM_StateMachine *s, char *number, GSM_CallShowNumber | |||
2553 | 2660 | ||
2554 | GSM_Error ATGEN_ReplyEnterSecurityCode(GSM_Protocol_Message msg, GSM_StateMachine *s) | 2661 | GSM_Error ATGEN_ReplyEnterSecurityCode(GSM_Protocol_Message msg, GSM_StateMachine *s) |
2555 | { | 2662 | { |
2556 | switch (s->Phone.Data.Priv.ATGEN.ReplyState) { | 2663 | switch (s->Phone.Data.Priv.ATGEN.ReplyState) { |
2557 | case AT_Reply_OK: | 2664 | case AT_Reply_OK: |
2558 | smprintf(s, "Security code was OK\n"); | 2665 | smprintf(s, "Security code was OK\n"); |
2559 | return ERR_NONE; | 2666 | return ERR_NONE; |
2560 | case AT_Reply_Error: | 2667 | case AT_Reply_Error: |
2561 | smprintf(s, "Incorrect security code\n"); | 2668 | smprintf(s, "Incorrect security code\n"); |
2562 | return ERR_SECURITYERROR; | 2669 | return ERR_SECURITYERROR; |
2563 | case AT_Reply_CMSError: | 2670 | case AT_Reply_CMSError: |
2564 | return ATGEN_HandleCMSError(s); | 2671 | return ATGEN_HandleCMSError(s); |
2672 | case AT_Reply_CMEError: | ||
2673 | return ATGEN_HandleCMEError(s); | ||
2565 | default: | 2674 | default: |
2566 | break; | 2675 | break; |
2567 | } | 2676 | } |
2568 | return ERR_UNKNOWNRESPONSE; | 2677 | return ERR_UNKNOWNRESPONSE; |
2569 | } | 2678 | } |
2570 | 2679 | ||
2571 | GSM_Error ATGEN_EnterSecurityCode(GSM_StateMachine *s, GSM_SecurityCode Code) | 2680 | GSM_Error ATGEN_EnterSecurityCode(GSM_StateMachine *s, GSM_SecurityCode Code) |
2572 | { | 2681 | { |
2573 | unsigned char req[50]; | 2682 | unsigned char req[50]; |
2574 | 2683 | ||
2575 | switch (Code.Type) { | 2684 | switch (Code.Type) { |
2576 | case SEC_Pin : | 2685 | case SEC_Pin : |
@@ -2915,24 +3024,30 @@ GSM_Error ATGEN_PrivSetMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry) | |||
2915 | EncodeHexBin(name, DecodeUnicodeString(entry->Entries[Name].Text), UnicodeLength(entry->Entries[Name].Text)); | 3024 | EncodeHexBin(name, DecodeUnicodeString(entry->Entries[Name].Text), UnicodeLength(entry->Entries[Name].Text)); |
2916 | len = strlen(name); | 3025 | len = strlen(name); |
2917 | break; | 3026 | break; |
2918 | case AT_PBK_GSM: | 3027 | case AT_PBK_GSM: |
2919 | smprintf(s, "str: %s\n", DecodeUnicodeString(entry->Entries[Name].Text)); | 3028 | smprintf(s, "str: %s\n", DecodeUnicodeString(entry->Entries[Name].Text)); |
2920 | len = UnicodeLength(entry->Entries[Name].Text); | 3029 | len = UnicodeLength(entry->Entries[Name].Text); |
2921 | EncodeDefault(name, entry->Entries[Name].Text, &len, true, NULL); | 3030 | EncodeDefault(name, entry->Entries[Name].Text, &len, true, NULL); |
2922 | break; | 3031 | break; |
2923 | case AT_PBK_UCS2: | 3032 | case AT_PBK_UCS2: |
2924 | EncodeHexUnicode(name, entry->Entries[Name].Text, UnicodeLength(entry->Entries[Name].Text)); | 3033 | EncodeHexUnicode(name, entry->Entries[Name].Text, UnicodeLength(entry->Entries[Name].Text)); |
2925 | len = strlen(name); | 3034 | len = strlen(name); |
2926 | break; | 3035 | break; |
3036 | case AT_PBK_PCCP437: | ||
3037 | /* FIXME: correctly decode PCCP437 */ | ||
3038 | smprintf(s, "str: %s\n", DecodeUnicodeString(entry->Entries[Name].Text)); | ||
3039 | len = UnicodeLength(entry->Entries[Name].Text); | ||
3040 | EncodeDefault(name, entry->Entries[Name].Text, &len, true, NULL); | ||
3041 | break; | ||
2927 | } | 3042 | } |
2928 | } else { | 3043 | } else { |
2929 | smprintf(s, "WARNING: No usable name found!\n"); | 3044 | smprintf(s, "WARNING: No usable name found!\n"); |
2930 | len = 0; | 3045 | len = 0; |
2931 | } | 3046 | } |
2932 | 3047 | ||
2933 | if (Number != -1) { | 3048 | if (Number != -1) { |
2934 | GSM_PackSemiOctetNumber(entry->Entries[Number].Text, number, false); | 3049 | GSM_PackSemiOctetNumber(entry->Entries[Number].Text, number, false); |
2935 | NumberType = number[0]; | 3050 | NumberType = number[0]; |
2936 | sprintf(number,"%s",DecodeUnicodeString(entry->Entries[Number].Text)); | 3051 | sprintf(number,"%s",DecodeUnicodeString(entry->Entries[Number].Text)); |
2937 | } else { | 3052 | } else { |
2938 | smprintf(s, "WARNING: No usable number found!\n"); | 3053 | smprintf(s, "WARNING: No usable number found!\n"); |
@@ -3243,24 +3358,61 @@ GSM_Error ATGEN_AddCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) | |||
3243 | return ERR_NOTSUPPORTED; | 3358 | return ERR_NOTSUPPORTED; |
3244 | } | 3359 | } |
3245 | 3360 | ||
3246 | GSM_Error ATGEN_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) | 3361 | GSM_Error ATGEN_DelCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note) |
3247 | { | 3362 | { |
3248 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; | 3363 | GSM_Phone_ATGENData *Priv = &s->Phone.Data.Priv.ATGEN; |
3249 | 3364 | ||
3250 | if (Priv->Manufacturer==AT_Siemens) return SIEMENS_DelCalendarNote(s, Note); | 3365 | if (Priv->Manufacturer==AT_Siemens) return SIEMENS_DelCalendarNote(s, Note); |
3251 | if (Priv->Manufacturer==AT_Ericsson) return SONYERIC_DelCalendarNote(s, Note); | 3366 | if (Priv->Manufacturer==AT_Ericsson) return SONYERIC_DelCalendarNote(s, Note); |
3252 | return ERR_NOTSUPPORTED; | 3367 | return ERR_NOTSUPPORTED; |
3253 | } | 3368 | } |
3254 | 3369 | ||
3370 | |||
3371 | GSM_Error ATGEN_GetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap) | ||
3372 | { | ||
3373 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | ||
3374 | |||
3375 | if (Priv->Manufacturer==AT_Siemens) return SIEMENS_GetBitmap(s, Bitmap); | ||
3376 | if (Priv->Manufacturer==AT_Samsung) return SAMSUNG_GetBitmap(s, Bitmap); | ||
3377 | return ERR_NOTSUPPORTED; | ||
3378 | } | ||
3379 | |||
3380 | GSM_Error ATGEN_SetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap) | ||
3381 | { | ||
3382 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | ||
3383 | |||
3384 | if (Priv->Manufacturer==AT_Siemens) return SIEMENS_SetBitmap(s, Bitmap); | ||
3385 | if (Priv->Manufacturer==AT_Samsung) return SAMSUNG_SetBitmap(s, Bitmap); | ||
3386 | return ERR_NOTSUPPORTED; | ||
3387 | } | ||
3388 | |||
3389 | GSM_Error ATGEN_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone) | ||
3390 | { | ||
3391 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | ||
3392 | |||
3393 | if (Priv->Manufacturer==AT_Siemens) return SIEMENS_GetRingtone(s, Ringtone, PhoneRingtone); | ||
3394 | if (Priv->Manufacturer==AT_Samsung) return SAMSUNG_GetRingtone(s, Ringtone, PhoneRingtone); | ||
3395 | return ERR_NOTSUPPORTED; | ||
3396 | } | ||
3397 | |||
3398 | GSM_Error ATGEN_SetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, int *maxlength) | ||
3399 | { | ||
3400 | GSM_Phone_ATGENData*Priv = &s->Phone.Data.Priv.ATGEN; | ||
3401 | |||
3402 | if (Priv->Manufacturer==AT_Siemens) return SIEMENS_SetRingtone(s, Ringtone, maxlength); | ||
3403 | if (Priv->Manufacturer==AT_Samsung) return SAMSUNG_SetRingtone(s, Ringtone, maxlength); | ||
3404 | return ERR_NOTSUPPORTED; | ||
3405 | } | ||
3406 | |||
3255 | GSM_Error ATGEN_PressKey(GSM_StateMachine *s, GSM_KeyCode Key, bool Press) | 3407 | GSM_Error ATGEN_PressKey(GSM_StateMachine *s, GSM_KeyCode Key, bool Press) |
3256 | { | 3408 | { |
3257 | GSM_Errorerror; | 3409 | GSM_Errorerror; |
3258 | unsigned char Frame[] = "AT+CKPD=\"?\"\r"; | 3410 | unsigned char Frame[] = "AT+CKPD=\"?\"\r"; |
3259 | 3411 | ||
3260 | if (Press) { | 3412 | if (Press) { |
3261 | switch (Key) { | 3413 | switch (Key) { |
3262 | case GSM_KEY_1 : Frame[9] = '1'; break; | 3414 | case GSM_KEY_1 : Frame[9] = '1'; break; |
3263 | case GSM_KEY_2 : Frame[9] = '2'; break; | 3415 | case GSM_KEY_2 : Frame[9] = '2'; break; |
3264 | case GSM_KEY_3 : Frame[9] = '3'; break; | 3416 | case GSM_KEY_3 : Frame[9] = '3'; break; |
3265 | case GSM_KEY_4 : Frame[9] = '4'; break; | 3417 | case GSM_KEY_4 : Frame[9] = '4'; break; |
3266 | case GSM_KEY_5 : Frame[9] = '5'; break; | 3418 | case GSM_KEY_5 : Frame[9] = '5'; break; |
@@ -3337,24 +3489,35 @@ GSM_Error ATGEN_SetIncomingCB(GSM_StateMachine *s, bool enable) | |||
3337 | return GSM_WaitFor(s, "AT+CNMI=3,,2\r", 13, 0x00, 4, ID_SetIncomingCB); | 3489 | return GSM_WaitFor(s, "AT+CNMI=3,,2\r", 13, 0x00, 4, ID_SetIncomingCB); |
3338 | } else { | 3490 | } else { |
3339 | smprintf(s, "Disabling incoming CB\n"); | 3491 | smprintf(s, "Disabling incoming CB\n"); |
3340 | return GSM_WaitFor(s, "AT+CNMI=3,,0\r", 13, 0x00, 4, ID_SetIncomingCB); | 3492 | return GSM_WaitFor(s, "AT+CNMI=3,,0\r", 13, 0x00, 4, ID_SetIncomingCB); |
3341 | } | 3493 | } |
3342 | } | 3494 | } |
3343 | return ERR_NONE; | 3495 | return ERR_NONE; |
3344 | #else | 3496 | #else |
3345 | return ERR_SOURCENOTAVAILABLE; | 3497 | return ERR_SOURCENOTAVAILABLE; |
3346 | #endif | 3498 | #endif |
3347 | } | 3499 | } |
3348 | 3500 | ||
3501 | GSM_Error ATGEN_SetFastSMSSending(GSM_StateMachine *s, bool enable) | ||
3502 | { | ||
3503 | if (enable) { | ||
3504 | smprintf(s, "Enabling fast SMS sending\n"); | ||
3505 | return GSM_WaitFor(s, "AT+CMMS=2\r", 10, 0x00, 4, ID_SetFastSMSSending); | ||
3506 | } else { | ||
3507 | smprintf(s, "Disabling fast SMS sending\n"); | ||
3508 | return GSM_WaitFor(s, "AT+CMMS=0\r", 10, 0x00, 4, ID_SetFastSMSSending); | ||
3509 | } | ||
3510 | } | ||
3511 | |||
3349 | GSM_Error ATGEN_IncomingSMSInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) | 3512 | GSM_Error ATGEN_IncomingSMSInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) |
3350 | { | 3513 | { |
3351 | smprintf(s, "Incoming SMS\n"); | 3514 | smprintf(s, "Incoming SMS\n"); |
3352 | return ERR_NONE; | 3515 | return ERR_NONE; |
3353 | } | 3516 | } |
3354 | 3517 | ||
3355 | GSM_Error ATGEN_IncomingSMSDeliver(GSM_Protocol_Message msg, GSM_StateMachine *s) | 3518 | GSM_Error ATGEN_IncomingSMSDeliver(GSM_Protocol_Message msg, GSM_StateMachine *s) |
3356 | { | 3519 | { |
3357 | GSM_Phone_Data *Data = &s->Phone.Data; | 3520 | GSM_Phone_Data *Data = &s->Phone.Data; |
3358 | GSM_SMSMessage sms; | 3521 | GSM_SMSMessage sms; |
3359 | int current = 0, current2, i=0; | 3522 | int current = 0, current2, i=0; |
3360 | unsigned char buffer[300],smsframe[800]; | 3523 | unsigned char buffer[300],smsframe[800]; |
@@ -3415,32 +3578,49 @@ GSM_Error ATGEN_SetIncomingSMS(GSM_StateMachine *s, bool enable) | |||
3415 | GSM_WaitFor(s, "AT+CNMI=3,,,1\r", 14, 0x00, 4, ID_SetIncomingSMS); | 3578 | GSM_WaitFor(s, "AT+CNMI=3,,,1\r", 14, 0x00, 4, ID_SetIncomingSMS); |
3416 | 3579 | ||
3417 | /* SMS deliver */ | 3580 | /* SMS deliver */ |
3418 | return GSM_WaitFor(s, "AT+CNMI=3,3\r", 12, 0x00, 4, ID_SetIncomingSMS); | 3581 | return GSM_WaitFor(s, "AT+CNMI=3,3\r", 12, 0x00, 4, ID_SetIncomingSMS); |
3419 | } else { | 3582 | } else { |
3420 | smprintf(s, "Disabling incoming SMS\n"); | 3583 | smprintf(s, "Disabling incoming SMS\n"); |
3421 | return GSM_WaitFor(s, "AT+CNMI=3,0\r", 12, 0x00, 4, ID_SetIncomingSMS); | 3584 | return GSM_WaitFor(s, "AT+CNMI=3,0\r", 12, 0x00, 4, ID_SetIncomingSMS); |
3422 | } | 3585 | } |
3423 | } | 3586 | } |
3424 | return ERR_NONE; | 3587 | return ERR_NONE; |
3425 | } | 3588 | } |
3426 | 3589 | ||
3590 | GSM_Error ATGEN_GetLocale(GSM_StateMachine *s, GSM_Locale *locale) | ||
3591 | { | ||
3592 | if (s->Phone.Data.Priv.ATGEN.Manufacturer==AT_Ericsson) return ERICSSON_GetLocale(s,locale); | ||
3593 | return ERR_NOTSUPPORTED; | ||
3594 | } | ||
3595 | |||
3596 | GSM_Error ATGEN_SetLocale(GSM_StateMachine *s, GSM_Locale *locale) | ||
3597 | { | ||
3598 | if (s->Phone.Data.Priv.ATGEN.Manufacturer==AT_Ericsson) return ERICSSON_SetLocale(s,locale); | ||
3599 | return ERR_NOTSUPPORTED; | ||
3600 | } | ||
3601 | |||
3427 | GSM_Reply_Function ATGENReplyFunctions[] = { | 3602 | GSM_Reply_Function ATGENReplyFunctions[] = { |
3428 | {ATGEN_GenericReply, "AT\r" ,0x00,0x00,ID_IncomingFrame }, | 3603 | {ATGEN_GenericReply, "AT\r" ,0x00,0x00,ID_IncomingFrame }, |
3429 | {ATGEN_GenericReply, "ATE1" ,0x00,0x00,ID_EnableEcho }, | 3604 | {ATGEN_GenericReply, "ATE1" ,0x00,0x00,ID_EnableEcho }, |
3430 | {ATGEN_GenericReply, "AT+CMEE=" ,0x00,0x00,ID_EnableErrorInfo }, | 3605 | {ATGEN_GenericReply, "AT+CMEE=" ,0x00,0x00,ID_EnableErrorInfo }, |
3431 | {ATGEN_GenericReply, "AT+CKPD=" ,0x00,0x00,ID_PressKey }, | 3606 | {ATGEN_GenericReply, "AT+CKPD=" ,0x00,0x00,ID_PressKey }, |
3432 | {ATGEN_ReplyGetSIMIMSI, "AT+CIMI" ,0x00,0x00,ID_GetSIMIMSI }, | 3607 | {ATGEN_ReplyGetSIMIMSI, "AT+CIMI" ,0x00,0x00,ID_GetSIMIMSI }, |
3433 | {ATGEN_GenericReply, "AT*EOBEX" ,0x00,0x00,ID_SetOBEX }, | 3608 | {ATGEN_GenericReply, "AT*EOBEX" ,0x00,0x00,ID_SetOBEX }, |
3434 | 3609 | ||
3610 | {ERICSSON_ReplyGetDateLocale, "*ESDF:" ,0x00,0x00,ID_GetLocale }, | ||
3611 | {ERICSSON_ReplyGetTimeLocale, "*ESTF:" ,0x00,0x00,ID_GetLocale }, | ||
3612 | {ATGEN_GenericReply, "AT*ESDF=" ,0x00,0x00,ID_SetLocale }, | ||
3613 | {ATGEN_GenericReply, "AT*ESTF=" ,0x00,0x00,ID_SetLocale }, | ||
3614 | |||
3435 | #ifdef GSM_ENABLE_CELLBROADCAST | 3615 | #ifdef GSM_ENABLE_CELLBROADCAST |
3436 | {ATGEN_ReplyIncomingCB, "+CBM:" ,0x00,0x00,ID_IncomingFrame }, | 3616 | {ATGEN_ReplyIncomingCB, "+CBM:" ,0x00,0x00,ID_IncomingFrame }, |
3437 | {ATGEN_GenericReply, "AT+CNMI" ,0x00,0x00,ID_SetIncomingCB }, | 3617 | {ATGEN_GenericReply, "AT+CNMI" ,0x00,0x00,ID_SetIncomingCB }, |
3438 | #endif | 3618 | #endif |
3439 | 3619 | ||
3440 | {ATGEN_IncomingBattery, "_OBS:" ,0x00,0x00,ID_IncomingFrame }, | 3620 | {ATGEN_IncomingBattery, "_OBS:" ,0x00,0x00,ID_IncomingFrame }, |
3441 | {ATGEN_ReplyGetBatteryCharge, "AT+CBC" ,0x00,0x00,ID_GetBatteryCharge }, | 3621 | {ATGEN_ReplyGetBatteryCharge, "AT+CBC" ,0x00,0x00,ID_GetBatteryCharge }, |
3442 | 3622 | ||
3443 | {ATGEN_ReplyGetModel, "AT+CGMM" ,0x00,0x00,ID_GetModel }, | 3623 | {ATGEN_ReplyGetModel, "AT+CGMM" ,0x00,0x00,ID_GetModel }, |
3444 | {ATGEN_ReplyGetManufacturer, "AT+CGMI" ,0x00,0x00,ID_GetManufacturer }, | 3624 | {ATGEN_ReplyGetManufacturer, "AT+CGMI" ,0x00,0x00,ID_GetManufacturer }, |
3445 | {ATGEN_ReplyGetFirmwareCGMR, "AT+CGMR" ,0x00,0x00,ID_GetFirmware }, | 3625 | {ATGEN_ReplyGetFirmwareCGMR, "AT+CGMR" ,0x00,0x00,ID_GetFirmware }, |
3446 | {ATGEN_ReplyGetFirmwareATI, "ATI" ,0x00,0x00,ID_GetFirmware }, | 3626 | {ATGEN_ReplyGetFirmwareATI, "ATI" ,0x00,0x00,ID_GetFirmware }, |
@@ -3453,122 +3633,134 @@ GSM_Reply_Function ATGENReplyFunctions[] = { | |||
3453 | {ATGEN_GenericReply, "AT+CSDH" ,0x00,0x00,ID_GetSMSMode }, | 3633 | {ATGEN_GenericReply, "AT+CSDH" ,0x00,0x00,ID_GetSMSMode }, |
3454 | {ATGEN_ReplyGetSMSMessage, "AT+CMGR" ,0x00,0x00,ID_GetSMSMessage }, | 3634 | {ATGEN_ReplyGetSMSMessage, "AT+CMGR" ,0x00,0x00,ID_GetSMSMessage }, |
3455 | {ATGEN_GenericReply, "AT+CPMS" ,0x00,0x00,ID_SetMemoryType }, | 3635 | {ATGEN_GenericReply, "AT+CPMS" ,0x00,0x00,ID_SetMemoryType }, |
3456 | {ATGEN_ReplyGetSMSStatus, "AT+CPMS" ,0x00,0x00,ID_GetSMSStatus }, | 3636 | {ATGEN_ReplyGetSMSStatus, "AT+CPMS" ,0x00,0x00,ID_GetSMSStatus }, |
3457 | {ATGEN_ReplyGetSMSMemories, "AT+CPMS=?" ,0x00,0x00,ID_GetSMSMemories }, | 3637 | {ATGEN_ReplyGetSMSMemories, "AT+CPMS=?" ,0x00,0x00,ID_GetSMSMemories }, |
3458 | {ATGEN_ReplyAddSMSMessage, "AT+CMGW" ,0x00,0x00,ID_SaveSMSMessage }, | 3638 | {ATGEN_ReplyAddSMSMessage, "AT+CMGW" ,0x00,0x00,ID_SaveSMSMessage }, |
3459 | {ATGEN_GenericReply, "AT+CSMP" ,0x00,0x00,ID_SetSMSParameters }, | 3639 | {ATGEN_GenericReply, "AT+CSMP" ,0x00,0x00,ID_SetSMSParameters }, |
3460 | {ATGEN_GenericReply, "AT+CSCA" ,0x00,0x00,ID_SetSMSC }, | 3640 | {ATGEN_GenericReply, "AT+CSCA" ,0x00,0x00,ID_SetSMSC }, |
3461 | {ATGEN_ReplyGetSMSC, "AT+CSCA?" ,0x00,0x00,ID_GetSMSC }, | 3641 | {ATGEN_ReplyGetSMSC, "AT+CSCA?" ,0x00,0x00,ID_GetSMSC }, |
3462 | {ATGEN_ReplyDeleteSMSMessage, "AT+CMGD" ,0x00,0x00,ID_DeleteSMSMessage }, | 3642 | {ATGEN_ReplyDeleteSMSMessage, "AT+CMGD" ,0x00,0x00,ID_DeleteSMSMessage }, |
3463 | {ATGEN_GenericReply, "ATE1" ,0x00,0x00,ID_SetSMSParameters }, | 3643 | {ATGEN_GenericReply, "ATE1" ,0x00,0x00,ID_SetSMSParameters }, |
3464 | {ATGEN_GenericReply, "\x1b\x0D" ,0x00,0x00,ID_SetSMSParameters }, | 3644 | {ATGEN_GenericReply, "\x1b\x0D" ,0x00,0x00,ID_SetSMSParameters }, |
3645 | {ATGEN_GenericReply, "AT+CMMS" ,0x00,0x00,ID_SetFastSMSSending }, | ||
3465 | {ATGEN_IncomingSMSInfo, "+CMTI:" ,0x00,0x00,ID_IncomingFrame }, | 3646 | {ATGEN_IncomingSMSInfo, "+CMTI:" ,0x00,0x00,ID_IncomingFrame }, |
3466 | {ATGEN_IncomingSMSDeliver, "+CMT:" ,0x00,0x00,ID_IncomingFrame }, | 3647 | {ATGEN_IncomingSMSDeliver, "+CMT:" ,0x00,0x00,ID_IncomingFrame }, |
3467 | {ATGEN_IncomingSMSReport, "+CDS:" ,0x00,0x00,ID_IncomingFrame }, | 3648 | {ATGEN_IncomingSMSReport, "+CDS:" ,0x00,0x00,ID_IncomingFrame }, |
3468 | {ATGEN_IncomingSMSCInfo, "^SCN:" ,0x00,0x00,ID_IncomingFrame }, | 3649 | {ATGEN_IncomingSMSCInfo, "^SCN:" ,0x00,0x00,ID_IncomingFrame }, |
3469 | 3650 | ||
3470 | {ATGEN_ReplyGetDateTime_Alarm, "AT+CCLK?" ,0x00,0x00,ID_GetDateTime }, | 3651 | {ATGEN_ReplyGetDateTime_Alarm, "AT+CCLK?" ,0x00,0x00,ID_GetDateTime }, |
3471 | {ATGEN_GenericReply, "AT+CCLK=" ,0x00,0x00,ID_SetDateTime }, | 3652 | {ATGEN_GenericReply, "AT+CCLK=" ,0x00,0x00,ID_SetDateTime }, |
3653 | {ATGEN_GenericReply, "AT+CALA=" ,0x00,0x00,ID_SetAlarm }, | ||
3472 | {ATGEN_ReplyGetDateTime_Alarm, "AT+CALA?" ,0x00,0x00,ID_GetAlarm }, | 3654 | {ATGEN_ReplyGetDateTime_Alarm, "AT+CALA?" ,0x00,0x00,ID_GetAlarm }, |
3473 | 3655 | ||
3474 | {ATGEN_ReplyGetNetworkLAC_CID, "AT+CREG?" ,0x00,0x00,ID_GetNetworkInfo }, | 3656 | {ATGEN_ReplyGetNetworkLAC_CID, "AT+CREG?" ,0x00,0x00,ID_GetNetworkInfo }, |
3475 | {ATGEN_GenericReply, "AT+CREG=2" ,0x00,0x00,ID_GetNetworkInfo }, | 3657 | {ATGEN_GenericReply, "AT+CREG=2" ,0x00,0x00,ID_GetNetworkInfo }, |
3476 | {ATGEN_GenericReply, "AT+COPS=" ,0x00,0x00,ID_GetNetworkInfo }, | 3658 | {ATGEN_GenericReply, "AT+COPS=" ,0x00,0x00,ID_GetNetworkInfo }, |
3477 | {ATGEN_GenericReply, "AT+COPS=" ,0x00,0x00,ID_SetAutoNetworkLogin}, | 3659 | {ATGEN_GenericReply, "AT+COPS=" ,0x00,0x00,ID_SetAutoNetworkLogin}, |
3478 | {ATGEN_ReplyGetNetworkCode, "AT+COPS" ,0x00,0x00,ID_GetNetworkInfo }, | 3660 | {ATGEN_ReplyGetNetworkCode, "AT+COPS" ,0x00,0x00,ID_GetNetworkInfo }, |
3479 | {ATGEN_ReplyGetSignalQuality, "AT+CSQ" ,0x00,0x00,ID_GetSignalQuality }, | 3661 | {ATGEN_ReplyGetSignalQuality, "AT+CSQ" ,0x00,0x00,ID_GetSignalQuality }, |
3480 | {ATGEN_IncomingNetworkLevel, "_OSIGQ:" ,0x00,0x00,ID_IncomingFrame }, | 3662 | {ATGEN_IncomingNetworkLevel, "_OSIGQ:" ,0x00,0x00,ID_IncomingFrame }, |
3481 | {ATGEN_IncomingGPRS, "+CGREG:" ,0x00,0x00,ID_IncomingFrame }, | 3663 | {ATGEN_IncomingGPRS, "+CGREG:" ,0x00,0x00,ID_IncomingFrame }, |
3482 | {ATGEN_ReplyGetNetworkLAC_CID, "+CREG:" ,0x00,0x00,ID_IncomingFrame }, | 3664 | {ATGEN_ReplyGetNetworkLAC_CID, "+CREG:" ,0x00,0x00,ID_IncomingFrame }, |
3483 | 3665 | ||
3484 | {ATGEN_ReplyGetPBKMemories, "AT+CPBS=?" ,0x00,0x00,ID_SetMemoryType }, | 3666 | {ATGEN_ReplyGetPBKMemories, "AT+CPBS=?" ,0x00,0x00,ID_SetMemoryType }, |
3485 | {ATGEN_GenericReply, "AT+CPBS=" ,0x00,0x00,ID_SetMemoryType }, | 3667 | {ATGEN_GenericReply, "AT+CPBS=" ,0x00,0x00,ID_SetMemoryType }, |
3486 | {ATGEN_ReplyGetCPBSMemoryStatus,"AT+CPBS?" ,0x00,0x00,ID_GetMemoryStatus }, | 3668 | {ATGEN_ReplyGetCPBSMemoryStatus,"AT+CPBS?" ,0x00,0x00,ID_GetMemoryStatus }, |
3669 | // /* Samsung phones reply +CPBR: after OK --claudio*/ | ||
3487 | {ATGEN_ReplyGetCPBRMemoryInfo, "AT+CPBR=?" ,0x00,0x00,ID_GetMemoryStatus }, | 3670 | {ATGEN_ReplyGetCPBRMemoryInfo, "AT+CPBR=?" ,0x00,0x00,ID_GetMemoryStatus }, |
3671 | {ATGEN_ReplyGetCPBRMemoryInfo, "+CPBR:" ,0x00,0x00,ID_GetMemoryStatus }, | ||
3488 | {ATGEN_ReplyGetCPBRMemoryStatus,"AT+CPBR=" ,0x00,0x00,ID_GetMemoryStatus }, | 3672 | {ATGEN_ReplyGetCPBRMemoryStatus,"AT+CPBR=" ,0x00,0x00,ID_GetMemoryStatus }, |
3489 | {ATGEN_GenericReply, "AT+CSCS=" ,0x00,0x00,ID_SetMemoryCharset }, | 3673 | {ATGEN_GenericReply, "AT+CSCS=" ,0x00,0x00,ID_SetMemoryCharset }, |
3490 | {ATGEN_ReplyGetMemory, "AT+CPBR=" ,0x00,0x00,ID_GetMemory }, | 3674 | {ATGEN_ReplyGetMemory, "AT+CPBR=" ,0x00,0x00,ID_GetMemory }, |
3491 | {ATGEN_GenericReply, "AT^SBNR=?" ,0x00,0x00,ID_GetMemory }, | 3675 | {ATGEN_GenericReply, "AT^SBNR=?" ,0x00,0x00,ID_GetMemory }, |
3492 | {ATGEN_SL45ReplyGetMemory, "AT^SBNR" ,0x00,0x00,ID_GetMemory }, | 3676 | {SIEMENS_ReplyGetMemory, "AT^SBNR" ,0x00,0x00,ID_GetMemory }, |
3493 | {ATGEN_ReplySetMemory, "AT+CPBW" ,0x00,0x00,ID_SetMemory }, | 3677 | {ATGEN_ReplySetMemory, "AT+CPBW" ,0x00,0x00,ID_SetMemory }, |
3494 | 3678 | ||
3495 | {ATGEN_CMS35ReplyGetBitmap, "AT^SBNR=\"bmp\"" ,0x00,0x00,ID_GetBitmap }, | 3679 | {SIEMENS_ReplyGetBitmap, "AT^SBNR=\"bmp\"" ,0x00,0x00,ID_GetBitmap }, |
3496 | {ATGEN_CMS35ReplySetBitmap, "AT^SBNW=\"bmp\"" ,0x00,0x00,ID_SetBitmap }, | 3680 | {SIEMENS_ReplySetBitmap, "AT^SBNW=\"bmp\"" ,0x00,0x00,ID_SetBitmap }, |
3497 | 3681 | ||
3498 | {ATGEN_CMS35ReplyGetRingtone, "AT^SBNR=\"mid\"" ,0x00,0x00,ID_GetRingtone }, | 3682 | {SIEMENS_ReplyGetRingtone, "AT^SBNR=\"mid\"" ,0x00,0x00,ID_GetRingtone }, |
3499 | {ATGEN_CMS35ReplySetRingtone, "AT^SBNW=\"mid\"" ,0x00,0x00,ID_SetRingtone }, | 3683 | {SIEMENS_ReplySetRingtone, "AT^SBNW=\"mid\"" ,0x00,0x00,ID_SetRingtone }, |
3500 | 3684 | ||
3501 | {ATGEN_CMS35ReplyGetNextCal, "AT^SBNR=\"vcs\"" ,0x00,0x00,ID_GetCalendarNote }, | 3685 | {SIEMENS_ReplyGetNextCalendar, "AT^SBNR=\"vcs\"" ,0x00,0x00,ID_GetCalendarNote }, |
3502 | {ATGEN_CMS35ReplySetCalendar, "AT^SBNW=\"vcs\"" ,0x00,0x00,ID_SetCalendarNote }, | 3686 | {SIEMENS_ReplyAddCalendarNote, "AT^SBNW=\"vcs\"" ,0x00,0x00,ID_SetCalendarNote }, |
3503 | {ATGEN_CMS35ReplyDeleteCalendar,"AT^SBNW=\"vcs\"",0x00,0x00,ID_DeleteCalendarNote }, | 3687 | {SIEMENS_ReplyDelCalendarNote, "AT^SBNW=\"vcs\"",0x00,0x00,ID_DeleteCalendarNote }, |
3504 | 3688 | ||
3505 | {ATGEN_ReplyEnterSecurityCode, "AT+CPIN=" ,0x00,0x00,ID_EnterSecurityCode }, | 3689 | {ATGEN_ReplyEnterSecurityCode, "AT+CPIN=" ,0x00,0x00,ID_EnterSecurityCode }, |
3506 | {ATGEN_ReplyEnterSecurityCode, "AT+CPIN2=" ,0x00,0x00,ID_EnterSecurityCode }, | 3690 | {ATGEN_ReplyEnterSecurityCode, "AT+CPIN2=" ,0x00,0x00,ID_EnterSecurityCode }, |
3507 | {ATGEN_ReplyGetSecurityStatus, "AT+CPIN?" ,0x00,0x00,ID_GetSecurityStatus }, | 3691 | {ATGEN_ReplyGetSecurityStatus, "AT+CPIN?" ,0x00,0x00,ID_GetSecurityStatus }, |
3508 | {ATGEN_ReplyOK, "OK" ,0x00,0x00,ID_IncomingFrame }, | 3692 | {ATGEN_ReplyOK, "OK" ,0x00,0x00,ID_IncomingFrame }, |
3509 | 3693 | ||
3510 | {ATGEN_GenericReply, "AT+VTS" ,0x00,0x00,ID_SendDTMF }, | 3694 | {ATGEN_GenericReply, "AT+VTS" ,0x00,0x00,ID_SendDTMF }, |
3511 | {ATGEN_ReplyCancelCall, "AT+CHUP" ,0x00,0x00,ID_CancelCall }, | 3695 | {ATGEN_ReplyCancelCall, "AT+CHUP" ,0x00,0x00,ID_CancelCall }, |
3512 | {ATGEN_ReplyDialVoice, "ATDT" ,0x00,0x00,ID_DialVoice }, | 3696 | {ATGEN_ReplyDialVoice, "ATDT" ,0x00,0x00,ID_DialVoice }, |
3513 | {ATGEN_ReplyCancelCall, "ATH" ,0x00,0x00,ID_CancelCall }, | 3697 | {ATGEN_ReplyCancelCall, "ATH" ,0x00,0x00,ID_CancelCall }, |
3698 | {ATGEN_GenericReply, "AT+CUSD" ,0x00,0x00,ID_SetUSSD }, | ||
3699 | {ATGEN_ReplyGetUSSD, "+CUSD" ,0x00,0x00,ID_IncomingFrame }, | ||
3514 | {ATGEN_GenericReply, "AT+CLIP=1" ,0x00,0x00,ID_IncomingFrame }, | 3700 | {ATGEN_GenericReply, "AT+CLIP=1" ,0x00,0x00,ID_IncomingFrame }, |
3515 | {ATGEN_ReplyIncomingCallInfo, "+CLIP" ,0x00,0x00,ID_IncomingFrame }, | 3701 | {ATGEN_ReplyIncomingCallInfo, "+CLIP" ,0x00,0x00,ID_IncomingFrame }, |
3516 | {ATGEN_ReplyIncomingCallInfo, "+COLP" ,0x00,0x00,ID_IncomingFrame }, | 3702 | {ATGEN_ReplyIncomingCallInfo, "+COLP" ,0x00,0x00,ID_IncomingFrame }, |
3517 | {ATGEN_ReplyIncomingCallInfo, "RING" ,0x00,0x00,ID_IncomingFrame }, | 3703 | {ATGEN_ReplyIncomingCallInfo, "RING" ,0x00,0x00,ID_IncomingFrame }, |
3518 | {ATGEN_ReplyIncomingCallInfo, "NO CARRIER" ,0x00,0x00,ID_IncomingFrame }, | 3704 | {ATGEN_ReplyIncomingCallInfo, "NO CARRIER" ,0x00,0x00,ID_IncomingFrame }, |
3519 | 3705 | ||
3520 | {ATGEN_ReplyReset, "AT^SRESET" ,0x00,0x00,ID_Reset }, | 3706 | {ATGEN_ReplyReset, "AT^SRESET" ,0x00,0x00,ID_Reset }, |
3521 | {ATGEN_ReplyReset, "AT+CFUN=1,1" ,0x00,0x00,ID_Reset }, | 3707 | {ATGEN_ReplyReset, "AT+CFUN=1,1" ,0x00,0x00,ID_Reset }, |
3522 | {ATGEN_ReplyResetPhoneSettings, "AT&F" ,0x00,0x00,ID_ResetPhoneSettings }, | 3708 | {ATGEN_ReplyResetPhoneSettings, "AT&F" ,0x00,0x00,ID_ResetPhoneSettings }, |
3523 | 3709 | ||
3710 | {SAMSUNG_ReplyGetBitmap, "AT+IMGR=" ,0x00,0x00,ID_GetBitmap }, | ||
3711 | {SAMSUNG_ReplySetBitmap, "SDNDCRC =" ,0x00,0x00,ID_SetBitmap }, | ||
3712 | |||
3713 | {SAMSUNG_ReplyGetRingtone, "AT+MELR=" ,0x00,0x00,ID_GetRingtone }, | ||
3714 | {SAMSUNG_ReplySetRingtone, "SDNDCRC =" ,0x00,0x00,ID_SetRingtone }, | ||
3715 | |||
3524 | #ifdef GSM_ENABLE_ALCATEL | 3716 | #ifdef GSM_ENABLE_ALCATEL |
3525 | /* Why do I give Alcatel specific things here? It's simple, Alcatel needs | 3717 | /* Why do I give Alcatel specific things here? It's simple, Alcatel needs |
3526 | * some AT commands to start it's binary mode, so this needs to be in AT | 3718 | * some AT commands to start it's binary mode, so this needs to be in AT |
3527 | * related stuff. | 3719 | * related stuff. |
3528 | * | 3720 | * |
3529 | * XXX: AT+IFC could later move outside this ifdef, because it is not Alcatel | 3721 | * XXX: AT+IFC could later move outside this ifdef, because it is not Alcatel |
3530 | * specific and it's part of ETSI specifications | 3722 | * specific and it's part of ETSI specifications |
3531 | */ | 3723 | */ |
3532 | {ATGEN_GenericReply, "AT+IFC" ,0x00,0x00,ID_SetFlowControl }, | 3724 | {ATGEN_GenericReply, "AT+IFC" ,0x00,0x00,ID_SetFlowControl }, |
3533 | {ALCATEL_ProtocolVersionReply, "AT+CPROT=?" ,0x00,0x00,ID_AlcatelProtocol }, | 3725 | {ALCATEL_ProtocolVersionReply, "AT+CPROT=?" ,0x00,0x00,ID_AlcatelProtocol }, |
3534 | {ATGEN_GenericReply, "AT+CPROT" ,0x00,0x00,ID_AlcatelConnect }, | 3726 | {ATGEN_GenericReply, "AT+CPROT" ,0x00,0x00,ID_AlcatelConnect }, |
3535 | #endif | 3727 | #endif |
3536 | 3728 | ||
3537 | {NULL, "\x00" ,0x00,0x00,ID_None } | 3729 | {NULL, "\x00" ,0x00,0x00,ID_None } |
3538 | }; | 3730 | }; |
3539 | 3731 | ||
3540 | GSM_Phone_Functions ATGENPhone = { | 3732 | GSM_Phone_Functions ATGENPhone = { |
3541 | "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", | 3733 | "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", |
3542 | ATGENReplyFunctions, | 3734 | ATGENReplyFunctions, |
3543 | ATGEN_Initialise, | 3735 | ATGEN_Initialise, |
3544 | ATGEN_Terminate, | 3736 | ATGEN_Terminate, |
3545 | ATGEN_DispatchMessage, | 3737 | ATGEN_DispatchMessage, |
3546 | NOTSUPPORTED, /* ShowStartInfo */ | 3738 | NOTSUPPORTED, /* ShowStartInfo */ |
3547 | ATGEN_GetManufacturer, | 3739 | ATGEN_GetManufacturer, |
3548 | ATGEN_GetModel, | 3740 | ATGEN_GetModel, |
3549 | ATGEN_GetFirmware, | 3741 | ATGEN_GetFirmware, |
3550 | ATGEN_GetIMEI, | 3742 | ATGEN_GetIMEI, |
3551 | NOTSUPPORTED, /* GetOriginalIMEI */ | 3743 | NOTSUPPORTED, /* GetOriginalIMEI */ |
3552 | NOTSUPPORTED, /* GetManufactureMonth*/ | 3744 | NOTSUPPORTED, /* GetManufactureMonth*/ |
3553 | NOTSUPPORTED, /* GetProductCode */ | 3745 | NOTSUPPORTED, /* GetProductCode */ |
3554 | NOTSUPPORTED, /* GetHardware */ | 3746 | NOTSUPPORTED, /* GetHardware */ |
3555 | NOTSUPPORTED, /* GetPPM */ | 3747 | NOTSUPPORTED, /* GetPPM */ |
3556 | ATGEN_GetSIMIMSI, | 3748 | ATGEN_GetSIMIMSI, |
3557 | ATGEN_GetDateTime, | 3749 | ATGEN_GetDateTime, |
3558 | ATGEN_SetDateTime, | 3750 | ATGEN_SetDateTime, |
3559 | ATGEN_GetAlarm, | 3751 | ATGEN_GetAlarm, |
3560 | NOTIMPLEMENTED, /* SetAlarm */ | 3752 | ATGEN_SetAlarm, |
3561 | NOTSUPPORTED, /* GetLocale */ | 3753 | ATGEN_GetLocale, |
3562 | NOTSUPPORTED, /* SetLocale */ | 3754 | ATGEN_SetLocale, |
3563 | ATGEN_PressKey, | 3755 | ATGEN_PressKey, |
3564 | ATGEN_Reset, | 3756 | ATGEN_Reset, |
3565 | ATGEN_ResetPhoneSettings, | 3757 | ATGEN_ResetPhoneSettings, |
3566 | ATGEN_EnterSecurityCode, | 3758 | ATGEN_EnterSecurityCode, |
3567 | ATGEN_GetSecurityStatus, | 3759 | ATGEN_GetSecurityStatus, |
3568 | ATGEN_GetDisplayStatus, | 3760 | ATGEN_GetDisplayStatus, |
3569 | ATGEN_SetAutoNetworkLogin, | 3761 | ATGEN_SetAutoNetworkLogin, |
3570 | ATGEN_GetBatteryCharge, | 3762 | ATGEN_GetBatteryCharge, |
3571 | ATGEN_GetSignalQuality, | 3763 | ATGEN_GetSignalQuality, |
3572 | ATGEN_GetNetworkInfo, | 3764 | ATGEN_GetNetworkInfo, |
3573 | NOTSUPPORTED, /* GetCategory */ | 3765 | NOTSUPPORTED, /* GetCategory */ |
3574 | NOTSUPPORTED, /* AddCategory */ | 3766 | NOTSUPPORTED, /* AddCategory */ |
@@ -3583,43 +3775,44 @@ GSM_Phone_Functions ATGENPhone = { | |||
3583 | NOTSUPPORTED, /* GetSpeedDial */ | 3775 | NOTSUPPORTED, /* GetSpeedDial */ |
3584 | NOTSUPPORTED, /* SetSpeedDial */ | 3776 | NOTSUPPORTED, /* SetSpeedDial */ |
3585 | ATGEN_GetSMSC, | 3777 | ATGEN_GetSMSC, |
3586 | ATGEN_SetSMSC, | 3778 | ATGEN_SetSMSC, |
3587 | ATGEN_GetSMSStatus, | 3779 | ATGEN_GetSMSStatus, |
3588 | ATGEN_GetSMS, | 3780 | ATGEN_GetSMS, |
3589 | ATGEN_GetNextSMS, | 3781 | ATGEN_GetNextSMS, |
3590 | NOTSUPPORTED, /* SetSMS */ | 3782 | NOTSUPPORTED, /* SetSMS */ |
3591 | ATGEN_AddSMS, | 3783 | ATGEN_AddSMS, |
3592 | ATGEN_DeleteSMS, | 3784 | ATGEN_DeleteSMS, |
3593 | ATGEN_SendSMS, | 3785 | ATGEN_SendSMS, |
3594 | ATGEN_SendSavedSMS, | 3786 | ATGEN_SendSavedSMS, |
3787 | ATGEN_SetFastSMSSending, | ||
3595 | ATGEN_SetIncomingSMS, | 3788 | ATGEN_SetIncomingSMS, |
3596 | ATGEN_SetIncomingCB, | 3789 | ATGEN_SetIncomingCB, |
3597 | ATGEN_GetSMSFolders, | 3790 | ATGEN_GetSMSFolders, |
3598 | NOTSUPPORTED, /* AddSMSFolder */ | 3791 | NOTSUPPORTED, /* AddSMSFolder */ |
3599 | NOTSUPPORTED, /* DeleteSMSFolder */ | 3792 | NOTSUPPORTED, /* DeleteSMSFolder */ |
3600 | ATGEN_DialVoice, | 3793 | ATGEN_DialVoice, |
3601 | ATGEN_AnswerCall, | 3794 | ATGEN_AnswerCall, |
3602 | ATGEN_CancelCall, | 3795 | ATGEN_CancelCall, |
3603 | NOTSUPPORTED, /* HoldCall */ | 3796 | NOTSUPPORTED, /* HoldCall */ |
3604 | NOTSUPPORTED, /* UnholdCall */ | 3797 | NOTSUPPORTED, /* UnholdCall */ |
3605 | NOTSUPPORTED, /* ConferenceCall */ | 3798 | NOTSUPPORTED, /* ConferenceCall */ |
3606 | NOTSUPPORTED, /* SplitCall */ | 3799 | NOTSUPPORTED, /* SplitCall */ |
3607 | NOTSUPPORTED, /* TransferCall */ | 3800 | NOTSUPPORTED, /* TransferCall */ |
3608 | NOTSUPPORTED, /* SwitchCall */ | 3801 | NOTSUPPORTED, /* SwitchCall */ |
3609 | NOTSUPPORTED, /* GetCallDivert */ | 3802 | NOTSUPPORTED, /* GetCallDivert */ |
3610 | NOTSUPPORTED, /* SetCallDivert */ | 3803 | NOTSUPPORTED, /* SetCallDivert */ |
3611 | NOTSUPPORTED, /* CancelAllDiverts*/ | 3804 | NOTSUPPORTED, /* CancelAllDiverts*/ |
3612 | NONEFUNCTION, /* SetIncomingCall */ | 3805 | NONEFUNCTION, /* SetIncomingCall */ |
3613 | NOTSUPPORTED, /* SetIncomingUSSD */ | 3806 | ATGEN_SetIncomingUSSD, |
3614 | ATGEN_SendDTMF, | 3807 | ATGEN_SendDTMF, |
3615 | ATGEN_GetRingtone, | 3808 | ATGEN_GetRingtone, |
3616 | ATGEN_SetRingtone, | 3809 | ATGEN_SetRingtone, |
3617 | NOTSUPPORTED, /* GetRingtonesInfo*/ | 3810 | NOTSUPPORTED, /* GetRingtonesInfo*/ |
3618 | NOTSUPPORTED, /* DeleteUserRingtones*/ | 3811 | NOTSUPPORTED, /* DeleteUserRingtones*/ |
3619 | NOTSUPPORTED, /* PlayTone */ | 3812 | NOTSUPPORTED, /* PlayTone */ |
3620 | NOTSUPPORTED, /* GetWAPBookmark */ | 3813 | NOTSUPPORTED, /* GetWAPBookmark */ |
3621 | NOTSUPPORTED, /* SetWAPBookmark */ | 3814 | NOTSUPPORTED, /* SetWAPBookmark */ |
3622 | NOTSUPPORTED, /* DeleteWAPBookmark */ | 3815 | NOTSUPPORTED, /* DeleteWAPBookmark */ |
3623 | NOTSUPPORTED, /* GetWAPSettings */ | 3816 | NOTSUPPORTED, /* GetWAPSettings */ |
3624 | NOTSUPPORTED, /* SetWAPSettings */ | 3817 | NOTSUPPORTED, /* SetWAPSettings */ |
3625 | NOTSUPPORTED, /* GetMMSSettings */ | 3818 | NOTSUPPORTED, /* GetMMSSettings */ |
@@ -3637,25 +3830,25 @@ GSM_Phone_Functions ATGENPhone = { | |||
3637 | SONYERIC_AddToDo, | 3830 | SONYERIC_AddToDo, |
3638 | NOTSUPPORTED, /* DeleteToDo */ | 3831 | NOTSUPPORTED, /* DeleteToDo */ |
3639 | SONYERIC_DeleteAllToDo, | 3832 | SONYERIC_DeleteAllToDo, |
3640 | SONYERIC_GetCalendarStatus, | 3833 | SONYERIC_GetCalendarStatus, |
3641 | NOTIMPLEMENTED, /* GetCalendar */ | 3834 | NOTIMPLEMENTED, /* GetCalendar */ |
3642 | ATGEN_GetNextCalendar, | 3835 | ATGEN_GetNextCalendar, |
3643 | NOTIMPLEMENTED, /* SetCalendar */ | 3836 | NOTIMPLEMENTED, /* SetCalendar */ |
3644 | ATGEN_AddCalendarNote, | 3837 | ATGEN_AddCalendarNote, |
3645 | ATGEN_DelCalendarNote, | 3838 | ATGEN_DelCalendarNote, |
3646 | NOTIMPLEMENTED, /* DeleteAllCalendar*/ | 3839 | NOTIMPLEMENTED, /* DeleteAllCalendar*/ |
3647 | NOTSUPPORTED, /* GetCalendarSettings*/ | 3840 | NOTSUPPORTED, /* GetCalendarSettings*/ |
3648 | NOTSUPPORTED, /* SetCalendarSettings*/ | 3841 | NOTSUPPORTED, /* SetCalendarSettings*/ |
3649 | NOTSUPPORTED, /* GetNote */ | 3842 | NOTSUPPORTED, /* GetNextNote */ |
3650 | NOTSUPPORTED, /* GetProfile */ | 3843 | NOTSUPPORTED, /* GetProfile */ |
3651 | NOTSUPPORTED, /* SetProfile */ | 3844 | NOTSUPPORTED, /* SetProfile */ |
3652 | NOTSUPPORTED, /* GetFMStation */ | 3845 | NOTSUPPORTED, /* GetFMStation */ |
3653 | NOTSUPPORTED, /* SetFMStation */ | 3846 | NOTSUPPORTED, /* SetFMStation */ |
3654 | NOTSUPPORTED, /* ClearFMStations */ | 3847 | NOTSUPPORTED, /* ClearFMStations */ |
3655 | NOTSUPPORTED, /* GetNextFileFolder*/ | 3848 | NOTSUPPORTED, /* GetNextFileFolder*/ |
3656 | NOTSUPPORTED, /* GetFilePart */ | 3849 | NOTSUPPORTED, /* GetFilePart */ |
3657 | NOTSUPPORTED, /* AddFile */ | 3850 | NOTSUPPORTED, /* AddFile */ |
3658 | NOTSUPPORTED, /* GetFileSystemStatus*/ | 3851 | NOTSUPPORTED, /* GetFileSystemStatus*/ |
3659 | NOTSUPPORTED, /* DeleteFile */ | 3852 | NOTSUPPORTED, /* DeleteFile */ |
3660 | NOTSUPPORTED, /* AddFolder */ | 3853 | NOTSUPPORTED, /* AddFolder */ |
3661 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ | 3854 | NOTSUPPORTED, /* GetGPRSAccessPoint*/ |