summaryrefslogtreecommitdiffabout
path: root/gammu/emb/common/phone/nokia
authorzautrix <zautrix>2004-10-05 11:13:51 (UTC)
committer zautrix <zautrix>2004-10-05 11:13:51 (UTC)
commit50ab40e1e02ad7c65c17a78d08116a808b1257aa (patch) (unidiff)
tree0d1939e2297fa7bbd8e1f2030f154463854164c6 /gammu/emb/common/phone/nokia
parentcf8616f64f20e5448d4ff644f7cc15750cf3f85f (diff)
downloadkdepimpi-50ab40e1e02ad7c65c17a78d08116a808b1257aa.zip
kdepimpi-50ab40e1e02ad7c65c17a78d08116a808b1257aa.tar.gz
kdepimpi-50ab40e1e02ad7c65c17a78d08116a808b1257aa.tar.bz2
updated to latest gammu version
Diffstat (limited to 'gammu/emb/common/phone/nokia') (more/less context) (ignore whitespace changes)
-rw-r--r--gammu/emb/common/phone/nokia/dct3/dct3func.c16
-rw-r--r--gammu/emb/common/phone/nokia/dct3/dct3func.h2
-rw-r--r--gammu/emb/common/phone/nokia/dct3/n6110.c17
-rw-r--r--gammu/emb/common/phone/nokia/dct3/n7110.c9
-rw-r--r--gammu/emb/common/phone/nokia/dct3/n9210.c3
-rw-r--r--gammu/emb/common/phone/nokia/dct4/n3320.c3
-rw-r--r--gammu/emb/common/phone/nokia/dct4/n3650.c3
-rw-r--r--gammu/emb/common/phone/nokia/dct4/n6510.c168
-rw-r--r--gammu/emb/common/phone/nokia/dct4/n6510.h2
-rw-r--r--gammu/emb/common/phone/nokia/nauto.c2
-rw-r--r--gammu/emb/common/phone/nokia/nfunc.c14
11 files changed, 179 insertions, 60 deletions
diff --git a/gammu/emb/common/phone/nokia/dct3/dct3func.c b/gammu/emb/common/phone/nokia/dct3/dct3func.c
index beef33c..17cd0a4 100644
--- a/gammu/emb/common/phone/nokia/dct3/dct3func.c
+++ b/gammu/emb/common/phone/nokia/dct3/dct3func.c
@@ -1,15 +1,18 @@
1/* (c) 2001-2004 by Marcin Wiacek */ 1/* (c) 2001-2004 by Marcin Wiacek */
2/* based on some work from Markus Plail, Pavel Janik, others and Gnokii */
3/* resetting DCT4 phones settings (c) by Walek */ 2/* resetting DCT4 phones settings (c) by Walek */
3/* based on some Markus Plail, Pavel Janik & others work from Gnokii (www.gnokii.org)
4 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
5 * GNU GPL version 2 or later
6 */
4 7
5#include <string.h> /* memcpy only */ 8#include <string.h> /* memcpy only */
6#include <stdio.h> 9#include <stdio.h>
7#include <ctype.h> 10#include <ctype.h>
8 11
9#include "../../../gsmstate.h" 12#include "../../../gsmstate.h"
10#include "../../../misc/coding/coding.h" 13#include "../../../misc/coding/coding.h"
11#include "../../../service/sms/gsmsms.h" 14#include "../../../service/sms/gsmsms.h"
12#include "../../pfunc.h" 15#include "../../pfunc.h"
13#include "../nfunc.h" 16#include "../nfunc.h"
14#include "dct3func.h" 17#include "dct3func.h"
15 18
@@ -385,24 +388,25 @@ GSM_Error DCT3_ReplyGetSMSC(GSM_Protocol_Message msg, GSM_StateMachine *s)
385 switch (msg.Buffer[3]) { 388 switch (msg.Buffer[3]) {
386 case 0x34: 389 case 0x34:
387 smprintf(s, "SMSC received\n"); 390 smprintf(s, "SMSC received\n");
388 Data->SMSC->Format = SMS_FORMAT_Text; 391 Data->SMSC->Format = SMS_FORMAT_Text;
389 switch (msg.Buffer[6]) { 392 switch (msg.Buffer[6]) {
390 case 0x00: Data->SMSC->Format = SMS_FORMAT_Text; break; 393 case 0x00: Data->SMSC->Format = SMS_FORMAT_Text; break;
391 case 0x22: Data->SMSC->Format = SMS_FORMAT_Fax; break; 394 case 0x22: Data->SMSC->Format = SMS_FORMAT_Fax; break;
392 case 0x26: Data->SMSC->Format = SMS_FORMAT_Pager;break; 395 case 0x26: Data->SMSC->Format = SMS_FORMAT_Pager;break;
393 case 0x32: Data->SMSC->Format = SMS_FORMAT_Email;break; 396 case 0x32: Data->SMSC->Format = SMS_FORMAT_Email;break;
394 } 397 }
395 Data->SMSC->Validity.Format = SMS_Validity_RelativeFormat; 398 Data->SMSC->Validity.Format = SMS_Validity_RelativeFormat;
396 Data->SMSC->Validity.Relative= msg.Buffer[8]; 399 Data->SMSC->Validity.Relative= msg.Buffer[8];
400 if (msg.Buffer[8] == 0x00) Data->SMSC->Validity.Relative = SMS_VALID_Max_Time;
397 401
398 i=33; 402 i=33;
399 while (msg.Buffer[i]!=0) {i++;} 403 while (msg.Buffer[i]!=0) {i++;}
400 i=i-33; 404 i=i-33;
401 if (i>GSM_MAX_SMSC_NAME_LENGTH) { 405 if (i>GSM_MAX_SMSC_NAME_LENGTH) {
402 smprintf(s, "Too long name\n"); 406 smprintf(s, "Too long name\n");
403 return ERR_UNKNOWNRESPONSE; 407 return ERR_UNKNOWNRESPONSE;
404 } 408 }
405 EncodeUnicode(Data->SMSC->Name,msg.Buffer+33,i); 409 EncodeUnicode(Data->SMSC->Name,msg.Buffer+33,i);
406 smprintf(s, "Name \"%s\"\n", DecodeUnicodeString(Data->SMSC->Name)); 410 smprintf(s, "Name \"%s\"\n", DecodeUnicodeString(Data->SMSC->Name));
407 411
408 GSM_UnpackSemiOctetNumber(Data->SMSC->DefaultNumber,msg.Buffer+9,true); 412 GSM_UnpackSemiOctetNumber(Data->SMSC->DefaultNumber,msg.Buffer+9,true);
@@ -433,43 +437,43 @@ GSM_Error DCT3_GetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc)
433 return GSM_WaitFor (s, req, 6, 0x02, 4, ID_GetSMSC); 437 return GSM_WaitFor (s, req, 6, 0x02, 4, ID_GetSMSC);
434} 438}
435 439
436GSM_Error DCT3_ReplyGetNetworkInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) 440GSM_Error DCT3_ReplyGetNetworkInfo(GSM_Protocol_Message msg, GSM_StateMachine *s)
437{ 441{
438 int count; 442 int count;
439 GSM_Phone_Data*Data = &s->Phone.Data; 443 GSM_Phone_Data*Data = &s->Phone.Data;
440#ifdef DEBUG 444#ifdef DEBUG
441 GSM_NetworkInfo NetInfo; 445 GSM_NetworkInfo NetInfo;
442 char name[100]; 446 char name[100];
443 447
444 smprintf(s, "Network info received\n"); 448 smprintf(s, "Network info received\n");
445 smprintf(s, " Status : "); 449 smprintf(s, "Status : ");
446 switch (msg.Buffer[8]) { 450 switch (msg.Buffer[8]) {
447 case 0x01: smprintf(s, "home network"); break; 451 case 0x01: smprintf(s, "home network"); break;
448 case 0x02: smprintf(s, "roaming network"); break; 452 case 0x02: smprintf(s, "roaming network"); break;
449 case 0x03: smprintf(s, "requesting network"); break; 453 case 0x03: smprintf(s, "requesting network"); break;
450 case 0x04: smprintf(s, "not registered in the network");break; 454 case 0x04: smprintf(s, "not registered in the network");break;
451 default : smprintf(s, "unknown"); 455 default : smprintf(s, "unknown");
452 } 456 }
453 smprintf(s, "\n"); 457 smprintf(s, "\n");
454 smprintf(s, "Network selection : %s\n", msg.Buffer[9]==1?"manual":"automatic"); 458 smprintf(s, "Network selection : %s\n", msg.Buffer[9]==1?"manual":"automatic");
455 if (msg.Buffer[8]<0x03) { 459 if (msg.Buffer[8]<0x03) {
456 sprintf(NetInfo.CID, "%02x%02x", msg.Buffer[10], msg.Buffer[11]); 460 sprintf(NetInfo.CID, "%02x%02x", msg.Buffer[10], msg.Buffer[11]);
457 smprintf(s, "CID : %s\n", NetInfo.CID); 461 smprintf(s, "CID : %s\n", NetInfo.CID);
458 462
459 sprintf(NetInfo.LAC, "%02x%02x", msg.Buffer[12], msg.Buffer[13]); 463 sprintf(NetInfo.LAC, "%02x%02x", msg.Buffer[12], msg.Buffer[13]);
460 smprintf(s, "LAC : %s\n", NetInfo.LAC); 464 smprintf(s, "LAC : %s\n", NetInfo.LAC);
461 465
462 smprintf(s, "Network code : %s\n", NetInfo.NetworkCode);
463 NOKIA_DecodeNetworkCode(msg.Buffer+14,NetInfo.NetworkCode); 466 NOKIA_DecodeNetworkCode(msg.Buffer+14,NetInfo.NetworkCode);
467 smprintf(s, "Network code : %s\n", NetInfo.NetworkCode);
464 smprintf(s, "Network name for Gammu : %s ", 468 smprintf(s, "Network name for Gammu : %s ",
465 DecodeUnicodeString(GSM_GetNetworkName(NetInfo.NetworkCode))); 469 DecodeUnicodeString(GSM_GetNetworkName(NetInfo.NetworkCode)));
466 smprintf(s, "(%s)\n",DecodeUnicodeString(GSM_GetCountryName(NetInfo.NetworkCode))); 470 smprintf(s, "(%s)\n",DecodeUnicodeString(GSM_GetCountryName(NetInfo.NetworkCode)));
467 471
468 if (msg.Length>18) { 472 if (msg.Length>18) {
469 if (msg.Buffer[18]==0x00) { 473 if (msg.Buffer[18]==0x00) {
470 /* In 6210 name is in "normal" Unicode */ 474 /* In 6210 name is in "normal" Unicode */
471 memcpy(name,msg.Buffer+18,msg.Buffer[17]*2); 475 memcpy(name,msg.Buffer+18,msg.Buffer[17]*2);
472 name[msg.Buffer[17]*2]=0x00; 476 name[msg.Buffer[17]*2]=0x00;
473 name[msg.Buffer[17]*2+1]=0x00; 477 name[msg.Buffer[17]*2+1]=0x00;
474 smprintf(s, "Network name for phone : %s\n",DecodeUnicodeString(name)); 478 smprintf(s, "Network name for phone : %s\n",DecodeUnicodeString(name));
475 } else { 479 } else {
@@ -1199,29 +1203,29 @@ GSM_Error DCT3_SetWAPSettings(GSM_StateMachine *s, GSM_MultiWAPSettings *setting
1199 } 1203 }
1200 error = DCT3DCT4_SetActiveConnectSet(s, settings); 1204 error = DCT3DCT4_SetActiveConnectSet(s, settings);
1201 if (error != ERR_NONE) return error; 1205 if (error != ERR_NONE) return error;
1202 1206
1203 return DCT3DCT4_DisableConnectionFunctions(s); 1207 return DCT3DCT4_DisableConnectionFunctions(s);
1204} 1208}
1205 1209
1206GSM_Error DCT3_ReplySendSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s) 1210GSM_Error DCT3_ReplySendSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s)
1207{ 1211{
1208 switch (msg.Buffer[3]) { 1212 switch (msg.Buffer[3]) {
1209 case 0x02: 1213 case 0x02:
1210 smprintf(s, "SMS sent OK\n"); 1214 smprintf(s, "SMS sent OK\n");
1211 if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,0,0); 1215 if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,0,msg.Buffer[5]);
1212 return ERR_NONE; 1216 return ERR_NONE;
1213 case 0x03: 1217 case 0x03:
1214 smprintf(s, "Error %i\n",msg.Buffer[6]); 1218 smprintf(s, "Error %i\n",msg.Buffer[6]);
1215 if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,msg.Buffer[6],0); 1219 if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,msg.Buffer[6],-1);
1216 return ERR_NONE; 1220 return ERR_NONE;
1217 } 1221 }
1218 return ERR_UNKNOWNRESPONSE; 1222 return ERR_UNKNOWNRESPONSE;
1219} 1223}
1220 1224
1221GSM_Error DCT3_SendSMSMessage(GSM_StateMachine *s, GSM_SMSMessage *sms) 1225GSM_Error DCT3_SendSMSMessage(GSM_StateMachine *s, GSM_SMSMessage *sms)
1222{ 1226{
1223 int length; 1227 int length;
1224 GSM_Error error; 1228 GSM_Error error;
1225 unsigned char req[256] = {N6110_FRAME_HEADER, 0x01, 0x02, 0x00}; 1229 unsigned char req[256] = {N6110_FRAME_HEADER, 0x01, 0x02, 0x00};
1226 1230
1227 error=PHONE_EncodeSMSFrame(s,sms,req+6,PHONE_SMSSubmit,&length, true); 1231 error=PHONE_EncodeSMSFrame(s,sms,req+6,PHONE_SMSSubmit,&length, true);
diff --git a/gammu/emb/common/phone/nokia/dct3/dct3func.h b/gammu/emb/common/phone/nokia/dct3/dct3func.h
index 66b67ec..18b2026 100644
--- a/gammu/emb/common/phone/nokia/dct3/dct3func.h
+++ b/gammu/emb/common/phone/nokia/dct3/dct3func.h
@@ -1,17 +1,19 @@
1/* (c) 2002-2003 by Marcin Wiacek */ 1/* (c) 2002-2003 by Marcin Wiacek */
2 2
3#ifndef phone_nokia_dct3_h 3#ifndef phone_nokia_dct3_h
4#define phone_nokia_dct3_h 4#define phone_nokia_dct3_h
5 5
6#include "../ncommon.h"
7
6 GSM_Error DCT3_ReplyPressKey (GSM_Protocol_Message msg, GSM_StateMachine *s); 8 GSM_Error DCT3_ReplyPressKey (GSM_Protocol_Message msg, GSM_StateMachine *s);
7 GSM_Error DCT3_ReplyPlayTone (GSM_Protocol_Message msg, GSM_StateMachine *s); 9 GSM_Error DCT3_ReplyPlayTone (GSM_Protocol_Message msg, GSM_StateMachine *s);
8 GSM_Error DCT3_ReplyEnableSecurity(GSM_Protocol_Message msg, GSM_StateMachine *s); 10 GSM_Error DCT3_ReplyEnableSecurity(GSM_Protocol_Message msg, GSM_StateMachine *s);
9 GSM_Error DCT3_ReplyGetIMEI (GSM_Protocol_Message msg, GSM_StateMachine *s); 11 GSM_Error DCT3_ReplyGetIMEI (GSM_Protocol_Message msg, GSM_StateMachine *s);
10 GSM_Error DCT3_ReplyGetSMSC (GSM_Protocol_Message msg, GSM_StateMachine *s); 12 GSM_Error DCT3_ReplyGetSMSC (GSM_Protocol_Message msg, GSM_StateMachine *s);
11 GSM_Error DCT3_ReplySIMLogin (GSM_Protocol_Message msg, GSM_StateMachine *s); 13 GSM_Error DCT3_ReplySIMLogin (GSM_Protocol_Message msg, GSM_StateMachine *s);
12 GSM_Error DCT3_ReplySIMLogout (GSM_Protocol_Message msg, GSM_StateMachine *s); 14 GSM_Error DCT3_ReplySIMLogout (GSM_Protocol_Message msg, GSM_StateMachine *s);
13 GSM_Error DCT3_ReplyGetDateTime (GSM_Protocol_Message msg, GSM_StateMachine *s); 15 GSM_Error DCT3_ReplyGetDateTime (GSM_Protocol_Message msg, GSM_StateMachine *s);
14 GSM_Error DCT3_ReplyGetAlarm (GSM_Protocol_Message msg, GSM_StateMachine *s); 16 GSM_Error DCT3_ReplyGetAlarm (GSM_Protocol_Message msg, GSM_StateMachine *s);
15 GSM_Error DCT3_ReplySetDateTime (GSM_Protocol_Message msg, GSM_StateMachine *s); 17 GSM_Error DCT3_ReplySetDateTime (GSM_Protocol_Message msg, GSM_StateMachine *s);
16 GSM_Error DCT3_ReplySetAlarm (GSM_Protocol_Message msg, GSM_StateMachine *s); 18 GSM_Error DCT3_ReplySetAlarm (GSM_Protocol_Message msg, GSM_StateMachine *s);
17 GSM_Error DCT3_ReplyDialCommand (GSM_Protocol_Message msg, GSM_StateMachine *s); 19 GSM_Error DCT3_ReplyDialCommand (GSM_Protocol_Message msg, GSM_StateMachine *s);
diff --git a/gammu/emb/common/phone/nokia/dct3/n6110.c b/gammu/emb/common/phone/nokia/dct3/n6110.c
index 263d12b..dac6c12 100644
--- a/gammu/emb/common/phone/nokia/dct3/n6110.c
+++ b/gammu/emb/common/phone/nokia/dct3/n6110.c
@@ -1,16 +1,18 @@
1/* (c) 2001-2004 by Marcin Wiacek */ 1/* (c) 2001-2004 by Marcin Wiacek */
2/* based on some work from Markus Plail and Gnokii */
3/* Authentication function (c) 1999 or earlier by Pavel Janik */
4/* 5210 calendar IDs by Frederick Ros */ 2/* 5210 calendar IDs by Frederick Ros */
3/* based on some Markus Plail, Pavel Janik & others work from Gnokii (www.gnokii.org)
4 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
5 * GNU GPL version 2 or later
6 */
5 7
6#include "../../../gsmstate.h" 8#include "../../../gsmstate.h"
7 9
8#ifdef GSM_ENABLE_NOKIA6110 10#ifdef GSM_ENABLE_NOKIA6110
9 11
10#include <string.h> 12#include <string.h>
11 13
12#include "../../../../cfg/config.h" 14#include "../../../../cfg/config.h"
13#include "../../../misc/coding/coding.h" 15#include "../../../misc/coding/coding.h"
14#include "../../../service/sms/gsmsms.h" 16#include "../../../service/sms/gsmsms.h"
15#include "../../../gsmcomon.h" 17#include "../../../gsmcomon.h"
16#include "../../pfunc.h" 18#include "../../pfunc.h"
@@ -118,24 +120,25 @@ static void N6110_EncodeUnicode(GSM_StateMachine *s, unsigned char *dest, const
118 if (!found) { 120 if (!found) {
119 i_len += EncodeWithUnicodeAlphabet(&src[i_len], &wc); 121 i_len += EncodeWithUnicodeAlphabet(&src[i_len], &wc);
120 dest[o_len*2] = (wc >> 8) & 0xff; 122 dest[o_len*2] = (wc >> 8) & 0xff;
121 dest[(o_len*2)+1] = wc & 0xff; 123 dest[(o_len*2)+1] = wc & 0xff;
122 } 124 }
123 } 125 }
124 dest[o_len*2] = 0; 126 dest[o_len*2] = 0;
125 dest[(o_len*2)+1] = 0; 127 dest[(o_len*2)+1] = 0;
126} 128}
127 129
128#ifndef ENABLE_LGPL 130#ifndef ENABLE_LGPL
129 131
132/* Pavel Janik */
130/* This function provides Nokia authentication protocol. 133/* This function provides Nokia authentication protocol.
131 * Nokia authentication protocol is used in the communication between Nokia 134 * Nokia authentication protocol is used in the communication between Nokia
132 * mobile phones (e.g. Nokia 6110) and Nokia Cellular Data Suite software, 135 * mobile phones (e.g. Nokia 6110) and Nokia Cellular Data Suite software,
133 * commercially sold by Nokia Corp. 136 * commercially sold by Nokia Corp.
134 * The authentication scheme is based on the token send by the phone to the 137 * The authentication scheme is based on the token send by the phone to the
135 * software. The software does it's magic (see the function 138 * software. The software does it's magic (see the function
136 * N6110_GetNokiaAuthentication) and returns the result back to the phone. 139 * N6110_GetNokiaAuthentication) and returns the result back to the phone.
137 * If the result is correct the phone responds with the message "Accessory 140 * If the result is correct the phone responds with the message "Accessory
138 * connected!" displayed on the LCD. Otherwise it will display "Accessory not 141 * connected!" displayed on the LCD. Otherwise it will display "Accessory not
139 * supported" and some functions will not be available for use (?). 142 * supported" and some functions will not be available for use (?).
140 * The specification of the protocol is not publicly available, no comment. 143 * The specification of the protocol is not publicly available, no comment.
141 */ 144 */
@@ -815,24 +818,25 @@ static GSM_Error N6110_SetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone,
815 memcpy(reqBin+current,DecodeUnicodeString(Ringtone->Name),UnicodeLength(Ringtone->Name)); 818 memcpy(reqBin+current,DecodeUnicodeString(Ringtone->Name),UnicodeLength(Ringtone->Name));
816 current += UnicodeLength(Ringtone->Name); 819 current += UnicodeLength(Ringtone->Name);
817 reqBin[current++] = 0x00; 820 reqBin[current++] = 0x00;
818 reqBin[current++] = 0x00; 821 reqBin[current++] = 0x00;
819 reqBin[current++] = 0x00;/*xxx*/ 822 reqBin[current++] = 0x00;/*xxx*/
820 memcpy(reqBin+current,Ringtone->NokiaBinary.Frame,Ringtone->NokiaBinary.Length); 823 memcpy(reqBin+current,Ringtone->NokiaBinary.Frame,Ringtone->NokiaBinary.Length);
821 current=current+Ringtone->NokiaBinary.Length; 824 current=current+Ringtone->NokiaBinary.Length;
822 reqBin[3]=Ringtone->Location-1; 825 reqBin[3]=Ringtone->Location-1;
823 if (!strcmp(s->Phone.Data.ModelInfo->model,"3210")) reqBin[5]=0x10; 826 if (!strcmp(s->Phone.Data.ModelInfo->model,"3210")) reqBin[5]=0x10;
824 smprintf(s, "Setting binary ringtone\n"); 827 smprintf(s, "Setting binary ringtone\n");
825 return GSM_WaitFor (s, reqBin, current, 0x40, 4, ID_SetRingtone); 828 return GSM_WaitFor (s, reqBin, current, 0x40, 4, ID_SetRingtone);
826 case RING_MIDI: 829 case RING_MIDI:
830 case RING_MMF:
827 return ERR_NOTSUPPORTED; 831 return ERR_NOTSUPPORTED;
828 } 832 }
829 return ERR_NOTSUPPORTED; 833 return ERR_NOTSUPPORTED;
830} 834}
831 835
832static GSM_Error N6110_ReplyGetOpLogo(GSM_Protocol_Message msg, GSM_StateMachine *s) 836static GSM_Error N6110_ReplyGetOpLogo(GSM_Protocol_Message msg, GSM_StateMachine *s)
833{ 837{
834 int count=5; 838 int count=5;
835 GSM_Phone_Data *Data = &s->Phone.Data; 839 GSM_Phone_Data *Data = &s->Phone.Data;
836 840
837 smprintf(s, "Operator logo received\n"); 841 smprintf(s, "Operator logo received\n");
838 NOKIA_DecodeNetworkCode(msg.Buffer+count,Data->Bitmap->NetworkCode); 842 NOKIA_DecodeNetworkCode(msg.Buffer+count,Data->Bitmap->NetworkCode);
@@ -1515,24 +1519,25 @@ static GSM_Error N6110_ReplyGetRingtone(GSM_Protocol_Message msg, GSM_StateMachi
1515 } 1519 }
1516 i++; 1520 i++;
1517 if (i==msg.Length-3) return ERR_EMPTY; 1521 if (i==msg.Length-3) return ERR_EMPTY;
1518 } 1522 }
1519 /* Copying frame */ 1523 /* Copying frame */
1520 memcpy(Data->Ringtone->NokiaBinary.Frame,msg.Buffer+start,end-start); 1524 memcpy(Data->Ringtone->NokiaBinary.Frame,msg.Buffer+start,end-start);
1521 Data->Ringtone->NokiaBinary.Length=end-start; 1525 Data->Ringtone->NokiaBinary.Length=end-start;
1522#ifdef DEBUG 1526#ifdef DEBUG
1523 if (di.dl == DL_TEXTALL || di.dl == DL_TEXTALLDATE) DumpMessage(di.df, di.dl, Data->Ringtone->NokiaBinary.Frame, Data->Ringtone->NokiaBinary.Length); 1527 if (di.dl == DL_TEXTALL || di.dl == DL_TEXTALLDATE) DumpMessage(di.df, di.dl, Data->Ringtone->NokiaBinary.Frame, Data->Ringtone->NokiaBinary.Length);
1524#endif 1528#endif
1525 return ERR_NONE; 1529 return ERR_NONE;
1526 case RING_MIDI: 1530 case RING_MIDI:
1531 case RING_MMF:
1527 return ERR_NOTSUPPORTED; 1532 return ERR_NOTSUPPORTED;
1528 } 1533 }
1529 smprintf(s, "Ringtone format is %i\n",Data->Ringtone->Format); 1534 smprintf(s, "Ringtone format is %i\n",Data->Ringtone->Format);
1530 break; 1535 break;
1531 default: 1536 default:
1532 smprintf(s, "Invalid location. Too high ?\n"); 1537 smprintf(s, "Invalid location. Too high ?\n");
1533 return ERR_INVALIDLOCATION; 1538 return ERR_INVALIDLOCATION;
1534 } 1539 }
1535 return ERR_UNKNOWNRESPONSE; 1540 return ERR_UNKNOWNRESPONSE;
1536} 1541}
1537 1542
1538static GSM_Error N6110_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone) 1543static GSM_Error N6110_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone)
@@ -1552,24 +1557,25 @@ static GSM_Error N6110_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone,
1552 Ringtone->Format = RING_NOKIABINARY; 1557 Ringtone->Format = RING_NOKIABINARY;
1553 } 1558 }
1554 } 1559 }
1555 1560
1556 switch (Ringtone->Format) { 1561 switch (Ringtone->Format) {
1557 case RING_NOTETONE: 1562 case RING_NOTETONE:
1558 if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_RING_SM)) return ERR_NOTSUPPORTED; 1563 if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_RING_SM)) return ERR_NOTSUPPORTED;
1559 break; 1564 break;
1560 case RING_NOKIABINARY: 1565 case RING_NOKIABINARY:
1561 if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_RING_SM)) return ERR_NOTSUPPORTED; 1566 if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_RING_SM)) return ERR_NOTSUPPORTED;
1562 break; 1567 break;
1563 case RING_MIDI: 1568 case RING_MIDI:
1569 case RING_MMF:
1564 return ERR_NOTSUPPORTED; 1570 return ERR_NOTSUPPORTED;
1565 } 1571 }
1566 1572
1567 error=DCT3_EnableSecurity (s, 0x01); 1573 error=DCT3_EnableSecurity (s, 0x01);
1568 if (error!=ERR_NONE) return error; 1574 if (error!=ERR_NONE) return error;
1569 1575
1570 req[3]=Ringtone->Location-1; 1576 req[3]=Ringtone->Location-1;
1571 s->Phone.Data.Ringtone=Ringtone; 1577 s->Phone.Data.Ringtone=Ringtone;
1572 smprintf(s, "Getting (binary) ringtone\n"); 1578 smprintf(s, "Getting (binary) ringtone\n");
1573 return GSM_WaitFor (s, req, 4, 0x40, 4, ID_GetRingtone); 1579 return GSM_WaitFor (s, req, 4, 0x40, 4, ID_GetRingtone);
1574} 1580}
1575 1581
@@ -2434,26 +2440,26 @@ static GSM_Error N6110_GetNextCalendarNote(GSM_StateMachine *s, GSM_CalendarEntr
2434 if (error == ERR_NONE && Note->Entries[Time].Date.Year == 2090) { 2440 if (error == ERR_NONE && Note->Entries[Time].Date.Year == 2090) {
2435 error=N6110_GetDateTime(s, &date_time); 2441 error=N6110_GetDateTime(s, &date_time);
2436 if (error == ERR_NONE) Note->Entries[Time].Date.Year = date_time.Year; 2442 if (error == ERR_NONE) Note->Entries[Time].Date.Year = date_time.Year;
2437 } 2443 }
2438 return error; 2444 return error;
2439} 2445}
2440 2446
2441GSM_Error N6110_ReplyUSSDInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) 2447GSM_Error N6110_ReplyUSSDInfo(GSM_Protocol_Message msg, GSM_StateMachine *s)
2442{ 2448{
2443 unsigned char buffer[2000],buffer2[4000]; 2449 unsigned char buffer[2000],buffer2[4000];
2444 int tmp; 2450 int tmp;
2445 2451
2446 tmp=GSM_UnpackEightBitsToSeven(0, 82, 82, msg.Buffer+8, buffer); 2452 tmp=GSM_UnpackEightBitsToSeven(0, msg.Buffer[7], 82, msg.Buffer+8, buffer);
2447 msg.Buffer[tmp] = 0; 2453 buffer[tmp] = 0;
2448 2454
2449 smprintf(s, "USSD reply: \"%s\"\n",buffer); 2455 smprintf(s, "USSD reply: \"%s\"\n",buffer);
2450 2456
2451 if (s->Phone.Data.EnableIncomingUSSD && s->User.IncomingUSSD!=NULL) { 2457 if (s->Phone.Data.EnableIncomingUSSD && s->User.IncomingUSSD!=NULL) {
2452 EncodeUnicode(buffer2,buffer,strlen(buffer)); 2458 EncodeUnicode(buffer2,buffer,strlen(buffer));
2453 s->User.IncomingUSSD(s->CurrentConfig->Device, buffer2); 2459 s->User.IncomingUSSD(s->CurrentConfig->Device, buffer2);
2454 } 2460 }
2455 2461
2456 return ERR_NONE; 2462 return ERR_NONE;
2457} 2463}
2458 2464
2459GSM_Error N6110_AnswerCall(GSM_StateMachine *s, int ID, bool all) 2465GSM_Error N6110_AnswerCall(GSM_StateMachine *s, int ID, bool all)
@@ -2798,24 +2804,25 @@ GSM_Phone_Functions N6110Phone = {
2798 N6110_GetSpeedDial, 2804 N6110_GetSpeedDial,
2799 NOTIMPLEMENTED, /* SetSpeedDial */ 2805 NOTIMPLEMENTED, /* SetSpeedDial */
2800 DCT3_GetSMSC, 2806 DCT3_GetSMSC,
2801 DCT3_SetSMSC, 2807 DCT3_SetSMSC,
2802 DCT3_GetSMSStatus, 2808 DCT3_GetSMSStatus,
2803 N6110_GetSMSMessage, 2809 N6110_GetSMSMessage,
2804 N6110_GetNextSMSMessage, 2810 N6110_GetNextSMSMessage,
2805 N6110_SetSMS, 2811 N6110_SetSMS,
2806 N6110_AddSMS, 2812 N6110_AddSMS,
2807 N6110_DeleteSMSMessage, 2813 N6110_DeleteSMSMessage,
2808 DCT3_SendSMSMessage, 2814 DCT3_SendSMSMessage,
2809 NOTSUPPORTED, /* SendSavedSMS */ 2815 NOTSUPPORTED, /* SendSavedSMS */
2816 NOTSUPPORTED, /* SetFastSMSSending*/
2810 NOKIA_SetIncomingSMS, 2817 NOKIA_SetIncomingSMS,
2811 DCT3_SetIncomingCB, 2818 DCT3_SetIncomingCB,
2812 PHONE_GetSMSFolders, 2819 PHONE_GetSMSFolders,
2813 NOTSUPPORTED, /* AddSMSFolder */ 2820 NOTSUPPORTED, /* AddSMSFolder */
2814 NOTSUPPORTED, /* DeleteSMSFolder */ 2821 NOTSUPPORTED, /* DeleteSMSFolder */
2815 N6110_DialVoice, 2822 N6110_DialVoice,
2816 N6110_AnswerCall, 2823 N6110_AnswerCall,
2817 DCT3_CancelCall, 2824 DCT3_CancelCall,
2818 N6110_HoldCall, 2825 N6110_HoldCall,
2819 N6110_UnholdCall, 2826 N6110_UnholdCall,
2820 N6110_ConferenceCall, 2827 N6110_ConferenceCall,
2821 N6110_SplitCall, 2828 N6110_SplitCall,
@@ -2852,25 +2859,25 @@ GSM_Phone_Functions N6110Phone = {
2852 NOTSUPPORTED, /* AddToDo */ 2859 NOTSUPPORTED, /* AddToDo */
2853 NOTSUPPORTED, /* DeleteToDo */ 2860 NOTSUPPORTED, /* DeleteToDo */
2854 NOTSUPPORTED, /* DeleteAllToDo */ 2861 NOTSUPPORTED, /* DeleteAllToDo */
2855 NOTIMPLEMENTED, /* GetCalendarStatus */ 2862 NOTIMPLEMENTED, /* GetCalendarStatus */
2856 NOTIMPLEMENTED, /* GetCalendar */ 2863 NOTIMPLEMENTED, /* GetCalendar */
2857 N6110_GetNextCalendarNote, 2864 N6110_GetNextCalendarNote,
2858 NOTIMPLEMENTED, /* SetCalendar */ 2865 NOTIMPLEMENTED, /* SetCalendar */
2859 N6110_AddCalendarNote, 2866 N6110_AddCalendarNote,
2860 N6110_DeleteCalendarNote, 2867 N6110_DeleteCalendarNote,
2861 NOTIMPLEMENTED, /* DeleteAllCalendar */ 2868 NOTIMPLEMENTED, /* DeleteAllCalendar */
2862 NOTSUPPORTED, /* GetCalendarSettings */ 2869 NOTSUPPORTED, /* GetCalendarSettings */
2863 NOTSUPPORTED, /* SetCalendarSettings */ 2870 NOTSUPPORTED, /* SetCalendarSettings */
2864 NOTSUPPORTED, /* GetNote */ 2871 NOTSUPPORTED, /* GetNextNote */
2865 N6110_GetProfile, 2872 N6110_GetProfile,
2866 N6110_SetProfile, 2873 N6110_SetProfile,
2867 NOTSUPPORTED, /* GetFMStation */ 2874 NOTSUPPORTED, /* GetFMStation */
2868 NOTSUPPORTED, /* SetFMStation */ 2875 NOTSUPPORTED, /* SetFMStation */
2869 NOTSUPPORTED, /* ClearFMStations */ 2876 NOTSUPPORTED, /* ClearFMStations */
2870 NOTSUPPORTED, /* GetNextFileFolder */ 2877 NOTSUPPORTED, /* GetNextFileFolder */
2871 NOTSUPPORTED, /* GetFilePart */ 2878 NOTSUPPORTED, /* GetFilePart */
2872 NOTSUPPORTED, /* AddFile */ 2879 NOTSUPPORTED, /* AddFile */
2873 NOTSUPPORTED, /* GetFileSystemStatus */ 2880 NOTSUPPORTED, /* GetFileSystemStatus */
2874 NOTSUPPORTED, /* DeleteFile */ 2881 NOTSUPPORTED, /* DeleteFile */
2875 NOTSUPPORTED, /* AddFolder */ 2882 NOTSUPPORTED, /* AddFolder */
2876 NOTSUPPORTED, /* GetGPRSAccessPoint */ 2883 NOTSUPPORTED, /* GetGPRSAccessPoint */
diff --git a/gammu/emb/common/phone/nokia/dct3/n7110.c b/gammu/emb/common/phone/nokia/dct3/n7110.c
index 5a02c9c..b597f9b 100644
--- a/gammu/emb/common/phone/nokia/dct3/n7110.c
+++ b/gammu/emb/common/phone/nokia/dct3/n7110.c
@@ -1,14 +1,17 @@
1/* (c) 2001-2004 by Marcin Wiacek */ 1/* (c) 2001-2004 by Marcin Wiacek */
2/* based on some work from Markus Plail and Gnokii */ 2/* based on some Markus Plail work from Gnokii (www.gnokii.org)
3 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
4 * GNU GPL version 2 or later
5 */
3 6
4#include "../../../gsmstate.h" 7#include "../../../gsmstate.h"
5 8
6#ifdef GSM_ENABLE_NOKIA7110 9#ifdef GSM_ENABLE_NOKIA7110
7 10
8#include <string.h> 11#include <string.h>
9#include <time.h> 12#include <time.h>
10 13
11#include "../../../misc/coding/coding.h" 14#include "../../../misc/coding/coding.h"
12#include "../../../gsmcomon.h" 15#include "../../../gsmcomon.h"
13#include "../../../service/gsmlogo.h" 16#include "../../../service/gsmlogo.h"
14#include "../../pfunc.h" 17#include "../../pfunc.h"
@@ -517,24 +520,25 @@ static GSM_Error N7110_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone,
517 if (Ringtone->Format == 0x00) Ringtone->Format = RING_NOKIABINARY; 520 if (Ringtone->Format == 0x00) Ringtone->Format = RING_NOKIABINARY;
518 521
519 switch (Ringtone->Format) { 522 switch (Ringtone->Format) {
520 case RING_NOTETONE: 523 case RING_NOTETONE:
521 /* In the future get binary and convert */ 524 /* In the future get binary and convert */
522 return ERR_NOTSUPPORTED; 525 return ERR_NOTSUPPORTED;
523 case RING_NOKIABINARY: 526 case RING_NOKIABINARY:
524 req[5]=N7110_ReturnBinaryRingtoneLocation(s->Phone.Data.Model)+Ringtone->Location; 527 req[5]=N7110_ReturnBinaryRingtoneLocation(s->Phone.Data.Model)+Ringtone->Location;
525 s->Phone.Data.Ringtone=Ringtone; 528 s->Phone.Data.Ringtone=Ringtone;
526 smprintf(s, "Getting binary ringtone\n"); 529 smprintf(s, "Getting binary ringtone\n");
527 return GSM_WaitFor (s, req, 6, 0x1f, 4, ID_GetRingtone); 530 return GSM_WaitFor (s, req, 6, 0x1f, 4, ID_GetRingtone);
528 case RING_MIDI: 531 case RING_MIDI:
532 case RING_MMF:
529 return ERR_NOTSUPPORTED; 533 return ERR_NOTSUPPORTED;
530 } 534 }
531 return ERR_NOTSUPPORTED; 535 return ERR_NOTSUPPORTED;
532} 536}
533 537
534static GSM_Error N7110_ReplyGetPictureImageInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) 538static GSM_Error N7110_ReplyGetPictureImageInfo(GSM_Protocol_Message msg, GSM_StateMachine *s)
535{ 539{
536 int i; 540 int i;
537 GSM_Phone_N7110Data*Priv = &s->Phone.Data.Priv.N7110; 541 GSM_Phone_N7110Data*Priv = &s->Phone.Data.Priv.N7110;
538 542
539 smprintf(s, "Received info for Picture Images\n"); 543 smprintf(s, "Received info for Picture Images\n");
540 smprintf(s, "Number : %i\n",msg.Buffer[4]*256+msg.Buffer[5]); 544 smprintf(s, "Number : %i\n",msg.Buffer[4]*256+msg.Buffer[5]);
@@ -1638,24 +1642,25 @@ GSM_Phone_Functions N7110Phone = {
1638 N7110_GetSpeedDial, 1642 N7110_GetSpeedDial,
1639 NOTIMPLEMENTED, /* SetSpeedDial */ 1643 NOTIMPLEMENTED, /* SetSpeedDial */
1640 DCT3_GetSMSC, 1644 DCT3_GetSMSC,
1641 DCT3_SetSMSC, 1645 DCT3_SetSMSC,
1642 N7110_GetSMSStatus, 1646 N7110_GetSMSStatus,
1643 N7110_GetSMSMessage, 1647 N7110_GetSMSMessage,
1644 N7110_GetNextSMSMessage, 1648 N7110_GetNextSMSMessage,
1645 N7110_SetSMS, 1649 N7110_SetSMS,
1646 N7110_AddSMS, 1650 N7110_AddSMS,
1647 N7110_DeleteSMS, 1651 N7110_DeleteSMS,
1648 DCT3_SendSMSMessage, 1652 DCT3_SendSMSMessage,
1649 NOTSUPPORTED, /* SendSavedSMS */ 1653 NOTSUPPORTED, /* SendSavedSMS */
1654 NOTSUPPORTED, /* SetFastSMSSending*/
1650 N7110_SetIncomingSMS, 1655 N7110_SetIncomingSMS,
1651 DCT3_SetIncomingCB, 1656 DCT3_SetIncomingCB,
1652 N7110_GetSMSFolders, 1657 N7110_GetSMSFolders,
1653 NOTIMPLEMENTED, /* AddSMSFolder */ 1658 NOTIMPLEMENTED, /* AddSMSFolder */
1654 NOTIMPLEMENTED, /* DeleteSMSFolder */ 1659 NOTIMPLEMENTED, /* DeleteSMSFolder */
1655 DCT3_DialVoice, 1660 DCT3_DialVoice,
1656 N7110_AnswerCall, 1661 N7110_AnswerCall,
1657 DCT3_CancelCall, 1662 DCT3_CancelCall,
1658 NOTIMPLEMENTED, /* HoldCall */ 1663 NOTIMPLEMENTED, /* HoldCall */
1659 NOTIMPLEMENTED, /* UnholdCall */ 1664 NOTIMPLEMENTED, /* UnholdCall */
1660 NOTIMPLEMENTED, /* ConferenceCall */ 1665 NOTIMPLEMENTED, /* ConferenceCall */
1661 NOTIMPLEMENTED, /* SplitCall */ 1666 NOTIMPLEMENTED, /* SplitCall */
@@ -1692,25 +1697,25 @@ GSM_Phone_Functions N7110Phone = {
1692 NOTSUPPORTED, /* AddToDo */ 1697 NOTSUPPORTED, /* AddToDo */
1693 NOTSUPPORTED, /* DeleteToDo */ 1698 NOTSUPPORTED, /* DeleteToDo */
1694 NOTSUPPORTED, /* DeleteAllToDo */ 1699 NOTSUPPORTED, /* DeleteAllToDo */
1695 N7110_GetCalendarStatus, 1700 N7110_GetCalendarStatus,
1696 NOTIMPLEMENTED, /* GetCalendar */ 1701 NOTIMPLEMENTED, /* GetCalendar */
1697 N7110_GetNextCalendar, 1702 N7110_GetNextCalendar,
1698 NOTIMPLEMENTED, /* SetCalendar */ 1703 NOTIMPLEMENTED, /* SetCalendar */
1699 N7110_AddCalendar, 1704 N7110_AddCalendar,
1700 N71_65_DelCalendar, 1705 N71_65_DelCalendar,
1701 NOTIMPLEMENTED, /* DeleteAllCalendar*/ 1706 NOTIMPLEMENTED, /* DeleteAllCalendar*/
1702 NOTSUPPORTED, /* GetCalendarSettings*/ 1707 NOTSUPPORTED, /* GetCalendarSettings*/
1703 NOTSUPPORTED, /* SetCalendarSettings*/ 1708 NOTSUPPORTED, /* SetCalendarSettings*/
1704 NOTSUPPORTED, /* GetNote */ 1709 NOTSUPPORTED, /* GetNextNote */
1705 N7110_GetProfile, 1710 N7110_GetProfile,
1706 N7110_SetProfile, 1711 N7110_SetProfile,
1707 NOTSUPPORTED, /* GetFMStation */ 1712 NOTSUPPORTED, /* GetFMStation */
1708 NOTSUPPORTED, /* SetFMStation */ 1713 NOTSUPPORTED, /* SetFMStation */
1709 NOTSUPPORTED, /* ClearFMStations */ 1714 NOTSUPPORTED, /* ClearFMStations */
1710 NOTSUPPORTED, /* GetNextFileFolder*/ 1715 NOTSUPPORTED, /* GetNextFileFolder*/
1711 NOTSUPPORTED, /* GetFilePart */ 1716 NOTSUPPORTED, /* GetFilePart */
1712 NOTSUPPORTED, /* AddFile */ 1717 NOTSUPPORTED, /* AddFile */
1713 NOTSUPPORTED, /* GetFileSystemStatus*/ 1718 NOTSUPPORTED, /* GetFileSystemStatus*/
1714 NOTSUPPORTED, /* DeleteFile */ 1719 NOTSUPPORTED, /* DeleteFile */
1715 NOTSUPPORTED, /* AddFolder */ 1720 NOTSUPPORTED, /* AddFolder */
1716 NOTSUPPORTED, /* GetGPRSAccessPoint*/ 1721 NOTSUPPORTED, /* GetGPRSAccessPoint*/
diff --git a/gammu/emb/common/phone/nokia/dct3/n9210.c b/gammu/emb/common/phone/nokia/dct3/n9210.c
index e82d530..ff71ad3 100644
--- a/gammu/emb/common/phone/nokia/dct3/n9210.c
+++ b/gammu/emb/common/phone/nokia/dct3/n9210.c
@@ -310,24 +310,25 @@ GSM_Phone_Functions N9210Phone = {
310 NOTIMPLEMENTED, /* GetSpeedDial */ 310 NOTIMPLEMENTED, /* GetSpeedDial */
311 NOTIMPLEMENTED, /* SetSpeedDial */ 311 NOTIMPLEMENTED, /* SetSpeedDial */
312 DCT3_GetSMSC, 312 DCT3_GetSMSC,
313 DCT3_SetSMSC, /* FIXME: test it */ 313 DCT3_SetSMSC, /* FIXME: test it */
314 NOTIMPLEMENTED, /* GetSMSStatus */ 314 NOTIMPLEMENTED, /* GetSMSStatus */
315 NOTIMPLEMENTED, /* GetSMS */ 315 NOTIMPLEMENTED, /* GetSMS */
316 NOTIMPLEMENTED, /* GetNextSMS */ 316 NOTIMPLEMENTED, /* GetNextSMS */
317 NOTIMPLEMENTED, /* SetSMS */ 317 NOTIMPLEMENTED, /* SetSMS */
318 NOTIMPLEMENTED, /* AddSMS */ 318 NOTIMPLEMENTED, /* AddSMS */
319 NOTIMPLEMENTED, /* DeleteSMS */ 319 NOTIMPLEMENTED, /* DeleteSMS */
320 DCT3_SendSMSMessage, 320 DCT3_SendSMSMessage,
321 NOTSUPPORTED, /* SendSavedSMS */ 321 NOTSUPPORTED, /* SendSavedSMS */
322 NOTSUPPORTED, /* SetFastSMSSending*/
322 N9210_SetIncomingSMS, 323 N9210_SetIncomingSMS,
323 DCT3_SetIncomingCB, 324 DCT3_SetIncomingCB,
324 NOTIMPLEMENTED, /* GetSMSFolders */ 325 NOTIMPLEMENTED, /* GetSMSFolders */
325 NOTSUPPORTED, /* AddSMSFolder */ 326 NOTSUPPORTED, /* AddSMSFolder */
326 NOTSUPPORTED, /* DeleteSMSFolder */ 327 NOTSUPPORTED, /* DeleteSMSFolder */
327 DCT3_DialVoice, 328 DCT3_DialVoice,
328 N9210_AnswerCall, 329 N9210_AnswerCall,
329 DCT3_CancelCall, 330 DCT3_CancelCall,
330 NOTSUPPORTED, /* HoldCall */ 331 NOTSUPPORTED, /* HoldCall */
331 NOTSUPPORTED, /* UnholdCall */ 332 NOTSUPPORTED, /* UnholdCall */
332 NOTSUPPORTED, /* ConferenceCall */ 333 NOTSUPPORTED, /* ConferenceCall */
333 NOTSUPPORTED, /* SplitCall */ 334 NOTSUPPORTED, /* SplitCall */
@@ -364,25 +365,25 @@ GSM_Phone_Functions N9210Phone = {
364 NOTSUPPORTED, /* AddToDo */ 365 NOTSUPPORTED, /* AddToDo */
365 NOTSUPPORTED, /* DeleteToDo */ 366 NOTSUPPORTED, /* DeleteToDo */
366 NOTSUPPORTED, /* DeleteAllToDo */ 367 NOTSUPPORTED, /* DeleteAllToDo */
367 NOTSUPPORTED, /* GetCalendarStatus*/ 368 NOTSUPPORTED, /* GetCalendarStatus*/
368 NOTSUPPORTED, /* GetCalendar */ 369 NOTSUPPORTED, /* GetCalendar */
369 NOTSUPPORTED, /* GetNextCalendar */ 370 NOTSUPPORTED, /* GetNextCalendar */
370 NOTSUPPORTED, /* SetCalendar */ 371 NOTSUPPORTED, /* SetCalendar */
371 NOTSUPPORTED, /* AddCalendar */ 372 NOTSUPPORTED, /* AddCalendar */
372 NOTSUPPORTED, /* DeleteCalendar */ 373 NOTSUPPORTED, /* DeleteCalendar */
373 NOTSUPPORTED, /* DeleteAllCalendar*/ 374 NOTSUPPORTED, /* DeleteAllCalendar*/
374 NOTSUPPORTED, /* GetCalendarSettings*/ 375 NOTSUPPORTED, /* GetCalendarSettings*/
375 NOTSUPPORTED, /* SetCalendarSettings*/ 376 NOTSUPPORTED, /* SetCalendarSettings*/
376 NOTSUPPORTED, /* GetNote */ 377 NOTSUPPORTED, /* GetNextNote */
377 NOTIMPLEMENTED, /* GetProfile */ 378 NOTIMPLEMENTED, /* GetProfile */
378 NOTSUPPORTED, /* SetProfile */ 379 NOTSUPPORTED, /* SetProfile */
379 NOTSUPPORTED, /* GetFMStation */ 380 NOTSUPPORTED, /* GetFMStation */
380 NOTSUPPORTED, /* SetFMStation */ 381 NOTSUPPORTED, /* SetFMStation */
381 NOTSUPPORTED, /* ClearFMStations */ 382 NOTSUPPORTED, /* ClearFMStations */
382 NOTSUPPORTED, /* GetNextFileFolder*/ 383 NOTSUPPORTED, /* GetNextFileFolder*/
383 NOTSUPPORTED, /* GetFilePart */ 384 NOTSUPPORTED, /* GetFilePart */
384 NOTSUPPORTED, /* AddFile */ 385 NOTSUPPORTED, /* AddFile */
385 NOTSUPPORTED, /* GetFileSystemStatus*/ 386 NOTSUPPORTED, /* GetFileSystemStatus*/
386 NOTSUPPORTED, /* DeleteFile */ 387 NOTSUPPORTED, /* DeleteFile */
387 NOTSUPPORTED, /* AddFolder */ 388 NOTSUPPORTED, /* AddFolder */
388 NOTSUPPORTED, /* GetGPRSAccessPoint*/ 389 NOTSUPPORTED, /* GetGPRSAccessPoint*/
diff --git a/gammu/emb/common/phone/nokia/dct4/n3320.c b/gammu/emb/common/phone/nokia/dct4/n3320.c
index 51e6f18..9b1d6cd 100644
--- a/gammu/emb/common/phone/nokia/dct4/n3320.c
+++ b/gammu/emb/common/phone/nokia/dct4/n3320.c
@@ -185,24 +185,25 @@ GSM_Phone_Functions N3320Phone = {
185 NOTSUPPORTED, /* GetSpeedDial */ 185 NOTSUPPORTED, /* GetSpeedDial */
186 NOTSUPPORTED, /* SetSpeedDial */ 186 NOTSUPPORTED, /* SetSpeedDial */
187 NOTSUPPORTED, /* GetSMSC */ 187 NOTSUPPORTED, /* GetSMSC */
188 NOTSUPPORTED, /* SetSMSC */ 188 NOTSUPPORTED, /* SetSMSC */
189 NOTSUPPORTED, /* GetSMSStatus */ 189 NOTSUPPORTED, /* GetSMSStatus */
190 NOTSUPPORTED, /* GetSMS */ 190 NOTSUPPORTED, /* GetSMS */
191 NOTSUPPORTED, /* GetNextSMS */ 191 NOTSUPPORTED, /* GetNextSMS */
192 NOTSUPPORTED, /* SetSMS */ 192 NOTSUPPORTED, /* SetSMS */
193 NOTSUPPORTED, /* AddSMS */ 193 NOTSUPPORTED, /* AddSMS */
194 NOTSUPPORTED, /* DeleteSMS */ 194 NOTSUPPORTED, /* DeleteSMS */
195 NOTSUPPORTED, /* SendSMS */ 195 NOTSUPPORTED, /* SendSMS */
196 NOTSUPPORTED, /* SendSavedSMS */ 196 NOTSUPPORTED, /* SendSavedSMS */
197 NOTSUPPORTED, /* SetFastSMSSending*/
197 NOTSUPPORTED, /* SetIncomingSMS */ 198 NOTSUPPORTED, /* SetIncomingSMS */
198 NOTSUPPORTED, /* SetIncomingCB */ 199 NOTSUPPORTED, /* SetIncomingCB */
199 NOTSUPPORTED, /* GetSMSFolders */ 200 NOTSUPPORTED, /* GetSMSFolders */
200 NOTSUPPORTED, /* AddSMSFolder */ 201 NOTSUPPORTED, /* AddSMSFolder */
201 NOTSUPPORTED, /* DeleteSMSFolder */ 202 NOTSUPPORTED, /* DeleteSMSFolder */
202 NOTIMPLEMENTED, /* DialVoice */ 203 NOTIMPLEMENTED, /* DialVoice */
203 NOTIMPLEMENTED, /* AnswerCall */ 204 NOTIMPLEMENTED, /* AnswerCall */
204 NOTIMPLEMENTED, /* CancelCall */ 205 NOTIMPLEMENTED, /* CancelCall */
205 NOTIMPLEMENTED, /* HoldCall */ 206 NOTIMPLEMENTED, /* HoldCall */
206 NOTIMPLEMENTED, /* UnholdCall */ 207 NOTIMPLEMENTED, /* UnholdCall */
207 NOTIMPLEMENTED, /* ConferenceCall */ 208 NOTIMPLEMENTED, /* ConferenceCall */
208 NOTIMPLEMENTED, /* SplitCall */ 209 NOTIMPLEMENTED, /* SplitCall */
@@ -239,25 +240,25 @@ GSM_Phone_Functions N3320Phone = {
239 NOTSUPPORTED, /* AddToDo */ 240 NOTSUPPORTED, /* AddToDo */
240 NOTSUPPORTED, /* DeleteToDo */ 241 NOTSUPPORTED, /* DeleteToDo */
241 NOTSUPPORTED, /* DeleteAllToDo */ 242 NOTSUPPORTED, /* DeleteAllToDo */
242 N3320_GetCalendarStatus, 243 N3320_GetCalendarStatus,
243 NOTIMPLEMENTED, /* GetCalendar */ 244 NOTIMPLEMENTED, /* GetCalendar */
244 N3320_GetNextCalendar, 245 N3320_GetNextCalendar,
245 NOTIMPLEMENTED, /* SetCalendar */ 246 NOTIMPLEMENTED, /* SetCalendar */
246 NOTSUPPORTED, /* AddCalendar */ 247 NOTSUPPORTED, /* AddCalendar */
247 NOTSUPPORTED, /* DeleteCalendar */ 248 NOTSUPPORTED, /* DeleteCalendar */
248 NOTIMPLEMENTED, /* DeleteAllCalendar*/ 249 NOTIMPLEMENTED, /* DeleteAllCalendar*/
249 NOTSUPPORTED, /* GetCalendarSettings*/ 250 NOTSUPPORTED, /* GetCalendarSettings*/
250 NOTSUPPORTED, /* SetCalendarSettings*/ 251 NOTSUPPORTED, /* SetCalendarSettings*/
251 NOTSUPPORTED, /* GetNote */ 252 NOTSUPPORTED, /* GetNextNote */
252 NOTSUPPORTED, /* GetProfile */ 253 NOTSUPPORTED, /* GetProfile */
253 NOTSUPPORTED, /* SetProfile */ 254 NOTSUPPORTED, /* SetProfile */
254 NOTSUPPORTED, /* GetFMStation */ 255 NOTSUPPORTED, /* GetFMStation */
255 NOTSUPPORTED, /* SetFMStation */ 256 NOTSUPPORTED, /* SetFMStation */
256 NOTSUPPORTED, /* ClearFMStations */ 257 NOTSUPPORTED, /* ClearFMStations */
257 NOTSUPPORTED, /* GetNextFileFolder*/ 258 NOTSUPPORTED, /* GetNextFileFolder*/
258 NOTSUPPORTED, /* GetFilePart */ 259 NOTSUPPORTED, /* GetFilePart */
259 NOTIMPLEMENTED, /* AddFilePart */ 260 NOTIMPLEMENTED, /* AddFilePart */
260 NOTSUPPORTED, /* GetFileSystemStatus*/ 261 NOTSUPPORTED, /* GetFileSystemStatus*/
261 NOTIMPLEMENTED, /* DeleteFile */ 262 NOTIMPLEMENTED, /* DeleteFile */
262 NOTIMPLEMENTED, /* AddFolder */ 263 NOTIMPLEMENTED, /* AddFolder */
263 NOTSUPPORTED, /* GetGPRSAccessPoint*/ 264 NOTSUPPORTED, /* GetGPRSAccessPoint*/
diff --git a/gammu/emb/common/phone/nokia/dct4/n3650.c b/gammu/emb/common/phone/nokia/dct4/n3650.c
index 2da55bf..d4746a7 100644
--- a/gammu/emb/common/phone/nokia/dct4/n3650.c
+++ b/gammu/emb/common/phone/nokia/dct4/n3650.c
@@ -306,24 +306,25 @@ GSM_Phone_Functions N3650Phone = {
306 NOTSUPPORTED, /* GetSpeedDial */ 306 NOTSUPPORTED, /* GetSpeedDial */
307 NOTSUPPORTED, /* SetSpeedDial */ 307 NOTSUPPORTED, /* SetSpeedDial */
308 NOTSUPPORTED, /* GetSMSC */ 308 NOTSUPPORTED, /* GetSMSC */
309 NOTSUPPORTED, /* SetSMSC */ 309 NOTSUPPORTED, /* SetSMSC */
310 NOTSUPPORTED, /* GetSMSStatus */ 310 NOTSUPPORTED, /* GetSMSStatus */
311 NOTSUPPORTED, /* GetSMS */ 311 NOTSUPPORTED, /* GetSMS */
312 NOTSUPPORTED, /* GetNextSMS */ 312 NOTSUPPORTED, /* GetNextSMS */
313 NOTSUPPORTED, /* SetSMS */ 313 NOTSUPPORTED, /* SetSMS */
314 NOTSUPPORTED, /* AddSMS */ 314 NOTSUPPORTED, /* AddSMS */
315 NOTSUPPORTED, /* DeleteSMS */ 315 NOTSUPPORTED, /* DeleteSMS */
316 NOTSUPPORTED, /* SendSMS */ 316 NOTSUPPORTED, /* SendSMS */
317 NOTSUPPORTED, /* SendSavedSMS */ 317 NOTSUPPORTED, /* SendSavedSMS */
318 NOTSUPPORTED, /* SetFastSMSSending*/
318 NOTSUPPORTED, /* SetIncomingSMS */ 319 NOTSUPPORTED, /* SetIncomingSMS */
319 NOTSUPPORTED, /* SetIncomingCB */ 320 NOTSUPPORTED, /* SetIncomingCB */
320 NOTSUPPORTED, /* GetSMSFolders */ 321 NOTSUPPORTED, /* GetSMSFolders */
321 NOTSUPPORTED, /* AddSMSFolder */ 322 NOTSUPPORTED, /* AddSMSFolder */
322 NOTSUPPORTED, /* DeleteSMSFolder */ 323 NOTSUPPORTED, /* DeleteSMSFolder */
323 NOTIMPLEMENTED, /* DialVoice */ 324 NOTIMPLEMENTED, /* DialVoice */
324 NOTIMPLEMENTED, /* AnswerCall */ 325 NOTIMPLEMENTED, /* AnswerCall */
325 NOTIMPLEMENTED, /* CancelCall */ 326 NOTIMPLEMENTED, /* CancelCall */
326 NOTIMPLEMENTED, /* HoldCall */ 327 NOTIMPLEMENTED, /* HoldCall */
327 NOTIMPLEMENTED, /* UnholdCall */ 328 NOTIMPLEMENTED, /* UnholdCall */
328 NOTIMPLEMENTED, /* ConferenceCall */ 329 NOTIMPLEMENTED, /* ConferenceCall */
329 NOTIMPLEMENTED, /* SplitCall */ 330 NOTIMPLEMENTED, /* SplitCall */
@@ -360,25 +361,25 @@ GSM_Phone_Functions N3650Phone = {
360 NOTSUPPORTED, /* AddToDo */ 361 NOTSUPPORTED, /* AddToDo */
361 NOTSUPPORTED, /* DeleteToDo */ 362 NOTSUPPORTED, /* DeleteToDo */
362 NOTSUPPORTED, /* DeleteAllToDo */ 363 NOTSUPPORTED, /* DeleteAllToDo */
363 NOTIMPLEMENTED, /* GetCalendarStatus*/ 364 NOTIMPLEMENTED, /* GetCalendarStatus*/
364 NOTIMPLEMENTED, /* GetCalendar */ 365 NOTIMPLEMENTED, /* GetCalendar */
365 NOTSUPPORTED, /* GetNextCalendar */ 366 NOTSUPPORTED, /* GetNextCalendar */
366 NOTIMPLEMENTED, /* SetCalendar */ 367 NOTIMPLEMENTED, /* SetCalendar */
367 NOTSUPPORTED, /* AddCalendar */ 368 NOTSUPPORTED, /* AddCalendar */
368 NOTSUPPORTED, /* DeleteCalendar */ 369 NOTSUPPORTED, /* DeleteCalendar */
369 NOTIMPLEMENTED, /* DeleteAllCalendar*/ 370 NOTIMPLEMENTED, /* DeleteAllCalendar*/
370 NOTSUPPORTED, /* GetCalendarSettings*/ 371 NOTSUPPORTED, /* GetCalendarSettings*/
371 NOTSUPPORTED, /* SetCalendarSettings*/ 372 NOTSUPPORTED, /* SetCalendarSettings*/
372 NOTSUPPORTED, /* GetNote */ 373 NOTSUPPORTED, /* GetNextNote */
373 NOTSUPPORTED, /* GetProfile */ 374 NOTSUPPORTED, /* GetProfile */
374 NOTSUPPORTED, /* SetProfile */ 375 NOTSUPPORTED, /* SetProfile */
375 NOTSUPPORTED, /* GetFMStation */ 376 NOTSUPPORTED, /* GetFMStation */
376 NOTSUPPORTED, /* SetFMStation */ 377 NOTSUPPORTED, /* SetFMStation */
377 NOTSUPPORTED, /* ClearFMStations */ 378 NOTSUPPORTED, /* ClearFMStations */
378 N3650_GetNextFileFolder, 379 N3650_GetNextFileFolder,
379 N3650_GetFilePart, 380 N3650_GetFilePart,
380 NOTIMPLEMENTED, /* AddFilePart */ 381 NOTIMPLEMENTED, /* AddFilePart */
381 NOTSUPPORTED, /* GetFileSystemStatus*/ 382 NOTSUPPORTED, /* GetFileSystemStatus*/
382 NOTIMPLEMENTED, /* DeleteFile */ 383 NOTIMPLEMENTED, /* DeleteFile */
383 NOTIMPLEMENTED, /* AddFolder */ 384 NOTIMPLEMENTED, /* AddFolder */
384 NOTSUPPORTED, /* GetGPRSAccessPoint*/ 385 NOTSUPPORTED, /* GetGPRSAccessPoint*/
diff --git a/gammu/emb/common/phone/nokia/dct4/n6510.c b/gammu/emb/common/phone/nokia/dct4/n6510.c
index 67fe492..2208def 100644
--- a/gammu/emb/common/phone/nokia/dct4/n6510.c
+++ b/gammu/emb/common/phone/nokia/dct4/n6510.c
@@ -1,14 +1,17 @@
1/* (c) 2002-2004 by Marcin Wiacek */ 1/* (c) 2002-2004 by Marcin Wiacek */
2/* based on some work from Markus Plail, Pawel Kot and Gnokii */ 2/* based on some Markus Plail, Pawel Kot work from Gnokii (www.gnokii.org)
3 * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
4 * GNU GPL version 2 or later
5 */
3/* function for making CRC for filesystem (c) 2003 by Michael Schroeder */ 6/* function for making CRC for filesystem (c) 2003 by Michael Schroeder */
4 7
5#include "../../../gsmstate.h" 8#include "../../../gsmstate.h"
6 9
7#ifdef GSM_ENABLE_NOKIA6510 10#ifdef GSM_ENABLE_NOKIA6510
8 11
9#include <string.h> 12#include <string.h>
10#include <time.h> 13#include <time.h>
11 14
12#include "../../../misc/coding/coding.h" 15#include "../../../misc/coding/coding.h"
13#include "../../../gsmcomon.h" 16#include "../../../gsmcomon.h"
14#include "../../../service/gsmlogo.h" 17#include "../../../service/gsmlogo.h"
@@ -110,24 +113,26 @@ static GSM_Error N6510_ReplyGetSMSC(GSM_Protocol_Message msg, GSM_StateMachine *
110 } 113 }
111 memset(Data->SMSC,0,sizeof(GSM_SMSC)); 114 memset(Data->SMSC,0,sizeof(GSM_SMSC));
112 Data->SMSC->Location = msg.Buffer[8]; 115 Data->SMSC->Location = msg.Buffer[8];
113 Data->SMSC->Format = SMS_FORMAT_Text; 116 Data->SMSC->Format = SMS_FORMAT_Text;
114 switch (msg.Buffer[10]) { 117 switch (msg.Buffer[10]) {
115 case 0x00: Data->SMSC->Format = SMS_FORMAT_Text; break; 118 case 0x00: Data->SMSC->Format = SMS_FORMAT_Text; break;
116 case 0x22: Data->SMSC->Format = SMS_FORMAT_Fax; break; 119 case 0x22: Data->SMSC->Format = SMS_FORMAT_Fax; break;
117 case 0x26: Data->SMSC->Format = SMS_FORMAT_Pager;break; 120 case 0x26: Data->SMSC->Format = SMS_FORMAT_Pager;break;
118 case 0x32: Data->SMSC->Format = SMS_FORMAT_Email;break; 121 case 0x32: Data->SMSC->Format = SMS_FORMAT_Email;break;
119 } 122 }
120 Data->SMSC->Validity.Format= SMS_Validity_RelativeFormat; 123 Data->SMSC->Validity.Format= SMS_Validity_RelativeFormat;
121 Data->SMSC->Validity.Relative= msg.Buffer[12]; 124 Data->SMSC->Validity.Relative= msg.Buffer[12];
125 if (msg.Buffer[12] == 0x00) Data->SMSC->Validity.Relative = SMS_VALID_Max_Time;
126
122 current = 14; 127 current = 14;
123 for (i=0;i<msg.Buffer[13];i++) { 128 for (i=0;i<msg.Buffer[13];i++) {
124 switch (msg.Buffer[current]) { 129 switch (msg.Buffer[current]) {
125 case 0x81: 130 case 0x81:
126 j=current+4; 131 j=current+4;
127 while (msg.Buffer[j]!=0) {j++;} 132 while (msg.Buffer[j]!=0) {j++;}
128 j=j-33; 133 j=j-33;
129 if (j>GSM_MAX_SMSC_NAME_LENGTH) { 134 if (j>GSM_MAX_SMSC_NAME_LENGTH) {
130 smprintf(s, "Too long name\n"); 135 smprintf(s, "Too long name\n");
131 return ERR_UNKNOWNRESPONSE; 136 return ERR_UNKNOWNRESPONSE;
132 } 137 }
133 CopyUnicodeString(Data->SMSC->Name,msg.Buffer+current+4); 138 CopyUnicodeString(Data->SMSC->Name,msg.Buffer+current+4);
@@ -256,25 +261,25 @@ static GSM_Error N6510_SetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc)
256 smprintf(s, "Setting SMSC\n"); 261 smprintf(s, "Setting SMSC\n");
257 return GSM_WaitFor (s, req, count, 0x02, 4, ID_SetSMSC); 262 return GSM_WaitFor (s, req, count, 0x02, 4, ID_SetSMSC);
258} 263}
259 264
260static GSM_Error N6510_ReplyGetNetworkInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) 265static GSM_Error N6510_ReplyGetNetworkInfo(GSM_Protocol_Message msg, GSM_StateMachine *s)
261{ 266{
262 int current = msg.Buffer[7]+7, tmp; 267 int current = msg.Buffer[7]+7, tmp;
263 GSM_Phone_Data*Data = &s->Phone.Data; 268 GSM_Phone_Data*Data = &s->Phone.Data;
264#ifdef DEBUG 269#ifdef DEBUG
265 char name[100]; 270 char name[100];
266 GSM_NetworkInfo NetInfo; 271 GSM_NetworkInfo NetInfo;
267 272
268 smprintf(s, "Network status: "); 273 smprintf(s, "Network status : ");
269 switch (msg.Buffer[8]) { 274 switch (msg.Buffer[8]) {
270 case 0x00 : smprintf(s, "home network\n"); break; 275 case 0x00 : smprintf(s, "home network\n"); break;
271 case 0x01 : smprintf(s, "roaming network\n"); break; 276 case 0x01 : smprintf(s, "roaming network\n"); break;
272 case 0x04 : smprintf(s, "not logged"); break; 277 case 0x04 : smprintf(s, "not logged"); break;
273 case 0x06 : smprintf(s, "SIM card rejected\n"); break; 278 case 0x06 : smprintf(s, "SIM card rejected\n"); break;
274 case 0x09 : smprintf(s, "not logged"); break; 279 case 0x09 : smprintf(s, "not logged"); break;
275 default : smprintf(s, "unknown %i!\n",msg.Buffer[8]); break; 280 default : smprintf(s, "unknown %i!\n",msg.Buffer[8]); break;
276 } 281 }
277 if (msg.Buffer[8]==0x00 || msg.Buffer[8] == 0x01) { 282 if (msg.Buffer[8]==0x00 || msg.Buffer[8] == 0x01) {
278 NOKIA_DecodeNetworkCode(msg.Buffer + (current + 7),NetInfo.NetworkCode); 283 NOKIA_DecodeNetworkCode(msg.Buffer + (current + 7),NetInfo.NetworkCode);
279 smprintf(s, "Network code : %s\n", NetInfo.NetworkCode); 284 smprintf(s, "Network code : %s\n", NetInfo.NetworkCode);
280 smprintf(s, "Network name for Gammu : %s ", 285 smprintf(s, "Network name for Gammu : %s ",
@@ -976,29 +981,29 @@ static GSM_Error N6510_GetBatteryCharge(GSM_StateMachine *s, GSM_BatteryCharge *
976} 981}
977 982
978static GSM_Error N6510_ReplyGetWAPBookmark(GSM_Protocol_Message msg, GSM_StateMachine *s) 983static GSM_Error N6510_ReplyGetWAPBookmark(GSM_Protocol_Message msg, GSM_StateMachine *s)
979{ 984{
980 return DCT3DCT4_ReplyGetWAPBookmark (msg, s, true); 985 return DCT3DCT4_ReplyGetWAPBookmark (msg, s, true);
981} 986}
982 987
983static GSM_Error N6510_ReplyGetOperatorLogo(GSM_Protocol_Message msg, GSM_StateMachine *s) 988static GSM_Error N6510_ReplyGetOperatorLogo(GSM_Protocol_Message msg, GSM_StateMachine *s)
984{ 989{
985 GSM_Phone_Data *Data = &s->Phone.Data; 990 GSM_Phone_Data *Data = &s->Phone.Data;
986 991
987 smprintf(s, "Operator logo received\n"); 992 smprintf(s, "Operator logo received\n");
993 if (msg.Length == 18) return ERR_EMPTY;
988 NOKIA_DecodeNetworkCode(msg.Buffer+12,Data->Bitmap->NetworkCode); 994 NOKIA_DecodeNetworkCode(msg.Buffer+12,Data->Bitmap->NetworkCode);
989 smprintf(s, "Network code %s\n",Data->Bitmap->NetworkCode); 995 smprintf(s, "Network code %s\n",Data->Bitmap->NetworkCode);
990 Data->Bitmap->BitmapWidth= msg.Buffer[20]; 996 Data->Bitmap->BitmapWidth= msg.Buffer[20];
991 Data->Bitmap->BitmapHeight= msg.Buffer[21]; 997 Data->Bitmap->BitmapHeight= msg.Buffer[21];
992 if (msg.Length == 18) return ERR_EMPTY;
993 PHONE_DecodeBitmap(GSM_Nokia6510OperatorLogo,msg.Buffer+26,Data->Bitmap); 998 PHONE_DecodeBitmap(GSM_Nokia6510OperatorLogo,msg.Buffer+26,Data->Bitmap);
994 return ERR_NONE; 999 return ERR_NONE;
995} 1000}
996 1001
997GSM_Error N6510_ReplyDeleteMemory(GSM_Protocol_Message msg, GSM_StateMachine *s) 1002GSM_Error N6510_ReplyDeleteMemory(GSM_Protocol_Message msg, GSM_StateMachine *s)
998{ 1003{
999 smprintf(s, "Phonebook entry deleted\n"); 1004 smprintf(s, "Phonebook entry deleted\n");
1000 return ERR_NONE; 1005 return ERR_NONE;
1001} 1006}
1002 1007
1003GSM_Error N6510_DeleteMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry) 1008GSM_Error N6510_DeleteMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
1004{ 1009{
@@ -1756,25 +1761,26 @@ static GSM_Error N6510_GetSyncMLSettings(GSM_StateMachine *s, GSM_SyncMLSettings
1756 0x00, 0x00, 0x00, 0x31, 0x00, 1761 0x00, 0x00, 0x00, 0x31, 0x00,
1757 0x01, //location 1762 0x01, //location
1758 0x00, 0x00, 0x02, 0x46, 0x00, 0x00}; 1763 0x00, 0x00, 0x02, 0x46, 0x00, 0x00};
1759 1764
1760 settings->Connection.Location = settings->Location; 1765 settings->Connection.Location = settings->Location;
1761 error = N6510_GetConnectionSettings(s, &settings->Connection, N6510_SYNCML_SETTINGS); 1766 error = N6510_GetConnectionSettings(s, &settings->Connection, N6510_SYNCML_SETTINGS);
1762 if (error != ERR_NONE) return error; 1767 if (error != ERR_NONE) return error;
1763 1768
1764 settings->Active = settings->Connection.Active; 1769 settings->Active = settings->Connection.Active;
1765 1770
1766 settings->Name[0] = 0; 1771 settings->Name[0] = 0;
1767 settings->Name[1] = 0; 1772 settings->Name[1] = 0;
1768 //s->Phone.Data.SyncMLSettings = settings; 1773 s->Phone.Data.SyncMLSettings = settings;
1774
1769 //smprintf(s, "Getting SyncML settings name\n"); 1775 //smprintf(s, "Getting SyncML settings name\n");
1770 //error = GSM_WaitFor (s, NameReq, 16, 0x43, 4, ID_GetSyncMLName); 1776 //error = GSM_WaitFor (s, NameReq, 16, 0x43, 4, ID_GetSyncMLName);
1771 //if (error != ERR_NONE) return error; 1777 //if (error != ERR_NONE) return error;
1772 1778
1773 req[9] = settings->Location - 1; 1779 req[9] = settings->Location - 1;
1774 smprintf(s, "Getting additional SyncML settings\n"); 1780 smprintf(s, "Getting additional SyncML settings\n");
1775 return GSM_WaitFor (s, req, 16, 0x43, 4, ID_GetSyncMLSettings); 1781 return GSM_WaitFor (s, req, 16, 0x43, 4, ID_GetSyncMLSettings);
1776} 1782}
1777 1783
1778static GSM_Error N6510_ReplyGetChatSettings(GSM_Protocol_Message msg, GSM_StateMachine *s) 1784static GSM_Error N6510_ReplyGetChatSettings(GSM_Protocol_Message msg, GSM_StateMachine *s)
1779{ 1785{
1780 GSM_ChatSettings *Sett = s->Phone.Data.ChatSettings; 1786 GSM_ChatSettings *Sett = s->Phone.Data.ChatSettings;
@@ -2274,25 +2280,25 @@ static GSM_Error N6510_DeleteSMSMessage(GSM_StateMachine *s, GSM_SMSMessage *sms
2274 } 2280 }
2275 req[6]=location / 256; 2281 req[6]=location / 256;
2276 req[7]=location; 2282 req[7]=location;
2277 2283
2278 smprintf(s, "Deleting sms\n"); 2284 smprintf(s, "Deleting sms\n");
2279 return GSM_WaitFor (s, req, 10, 0x14, 4, ID_DeleteSMSMessage); 2285 return GSM_WaitFor (s, req, 10, 0x14, 4, ID_DeleteSMSMessage);
2280} 2286}
2281 2287
2282static GSM_Error N6510_ReplySendSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s) 2288static GSM_Error N6510_ReplySendSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s)
2283{ 2289{
2284 switch (msg.Buffer[8]) { 2290 switch (msg.Buffer[8]) {
2285 case 0x00: 2291 case 0x00:
2286 smprintf(s, "SMS sent OK, TPMR for sent sms is %02x\n",msg.Buffer[10]); 2292 smprintf(s, "SMS sent OK, TPMR for sent sms is %d\n",msg.Buffer[10]);
2287 if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,0,msg.Buffer[10]); 2293 if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,0,msg.Buffer[10]);
2288 return ERR_NONE; 2294 return ERR_NONE;
2289 default: 2295 default:
2290 smprintf(s, "SMS not sent OK, error code probably %i\n",msg.Buffer[8]); 2296 smprintf(s, "SMS not sent OK, error code probably %i\n",msg.Buffer[8]);
2291 if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,msg.Buffer[8],msg.Buffer[10]); 2297 if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,msg.Buffer[8],msg.Buffer[10]);
2292 return ERR_NONE; 2298 return ERR_NONE;
2293 } 2299 }
2294} 2300}
2295 2301
2296static GSM_Error N6510_SendSMSMessage(GSM_StateMachine *s, GSM_SMSMessage *sms) 2302static GSM_Error N6510_SendSMSMessage(GSM_StateMachine *s, GSM_SMSMessage *sms)
2297{ 2303{
2298 int length = 11; 2304 int length = 11;
@@ -2761,24 +2767,25 @@ static GSM_Error N6510_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone,
2761 return ERR_NOTSUPPORTED; 2767 return ERR_NOTSUPPORTED;
2762 case RING_NOKIABINARY: 2768 case RING_NOKIABINARY:
2763 s->Phone.Data.Ringtone= Ringtone; 2769 s->Phone.Data.Ringtone= Ringtone;
2764 Info.Number = 0; 2770 Info.Number = 0;
2765 error=N6510_PrivGetRingtonesInfo(s, &Info, PhoneRingtone); 2771 error=N6510_PrivGetRingtonesInfo(s, &Info, PhoneRingtone);
2766 if (error != ERR_NONE) return error; 2772 if (error != ERR_NONE) return error;
2767 if (Ringtone->Location > Info.Number) return ERR_INVALIDLOCATION; 2773 if (Ringtone->Location > Info.Number) return ERR_INVALIDLOCATION;
2768 req2[4] = Info.Ringtone[Ringtone->Location-1].ID / 256; 2774 req2[4] = Info.Ringtone[Ringtone->Location-1].ID / 256;
2769 req2[5] = Info.Ringtone[Ringtone->Location-1].ID % 256; 2775 req2[5] = Info.Ringtone[Ringtone->Location-1].ID % 256;
2770 smprintf(s, "Getting binary ringtone\n"); 2776 smprintf(s, "Getting binary ringtone\n");
2771 return GSM_WaitFor (s, req2, 6, 0x1f, 4, ID_GetRingtone); 2777 return GSM_WaitFor (s, req2, 6, 0x1f, 4, ID_GetRingtone);
2772 case RING_MIDI: 2778 case RING_MIDI:
2779 case RING_MMF:
2773 return ERR_NOTSUPPORTED; 2780 return ERR_NOTSUPPORTED;
2774 } 2781 }
2775 return ERR_NOTSUPPORTED; 2782 return ERR_NOTSUPPORTED;
2776} 2783}
2777 2784
2778static GSM_Error N6510_PlayTone(GSM_StateMachine *s, int Herz, unsigned char Volume, bool start) 2785static GSM_Error N6510_PlayTone(GSM_StateMachine *s, int Herz, unsigned char Volume, bool start)
2779{ 2786{
2780 GSM_Error error; 2787 GSM_Error error;
2781 unsigned char reqStart[] = { 2788 unsigned char reqStart[] = {
2782 0x00,0x06,0x01,0x00,0x07,0x00 }; 2789 0x00,0x06,0x01,0x00,0x07,0x00 };
2783 unsigned char reqPlay[] = { 2790 unsigned char reqPlay[] = {
2784 0x00,0x06,0x01,0x14,0x05,0x04, 2791 0x00,0x06,0x01,0x14,0x05,0x04,
@@ -2977,24 +2984,27 @@ static GSM_Error N6510_GetProfile(GSM_StateMachine *s, GSM_Profile *Profile)
2977 unsigned char req[150] = {N6110_FRAME_HEADER, 0x01, 0x01, 0x0C, 0x01}; 2984 unsigned char req[150] = {N6110_FRAME_HEADER, 0x01, 0x01, 0x0C, 0x01};
2978 unsigned charreqActive[] = {N6110_FRAME_HEADER, 0x05}; 2985 unsigned charreqActive[] = {N6110_FRAME_HEADER, 0x05};
2979 int i, length = 7; 2986 int i, length = 7;
2980 GSM_Errorerror; 2987 GSM_Errorerror;
2981 2988
2982 /* For now !!! */ 2989 /* For now !!! */
2983 if (!strcmp(s->Phone.Data.ModelInfo->model,"3510")) { 2990 if (!strcmp(s->Phone.Data.ModelInfo->model,"3510")) {
2984 if (s->Phone.Data.VerNum>3.37) return ERR_NOTSUPPORTED; 2991 if (s->Phone.Data.VerNum>3.37) return ERR_NOTSUPPORTED;
2985 } 2992 }
2986 if (!strcmp(s->Phone.Data.ModelInfo->model,"6230")) { 2993 if (!strcmp(s->Phone.Data.ModelInfo->model,"6230")) {
2987 return ERR_NOTSUPPORTED; 2994 return ERR_NOTSUPPORTED;
2988 } 2995 }
2996 if (!strcmp(s->Phone.Data.ModelInfo->model,"5140")) {
2997 return ERR_NOTSUPPORTED;
2998 }
2989 2999
2990 if (Profile->Location>5) return ERR_INVALIDLOCATION; 3000 if (Profile->Location>5) return ERR_INVALIDLOCATION;
2991 3001
2992 for (i = 0; i < 0x0a; i++) { 3002 for (i = 0; i < 0x0a; i++) {
2993 req[length++] = 0x04; 3003 req[length++] = 0x04;
2994 req[length++] = Profile->Location; 3004 req[length++] = Profile->Location;
2995 req[length++] = i; 3005 req[length++] = i;
2996 req[length++] = 0x01; 3006 req[length++] = 0x01;
2997 } 3007 }
2998 3008
2999 req[length++] = 0x04; 3009 req[length++] = 0x04;
3000 req[length++] = Profile->Location; 3010 req[length++] = Profile->Location;
@@ -3106,52 +3116,76 @@ static GSM_Error N6510_ReplyIncomingSMS(GSM_Protocol_Message msg, GSM_StateMachi
3106 sms.State = SMS_UnRead; 3116 sms.State = SMS_UnRead;
3107 sms.InboxFolder = true; 3117 sms.InboxFolder = true;
3108 3118
3109 N6510_DecodeSMSFrame(s, &sms, msg.Buffer+10); 3119 N6510_DecodeSMSFrame(s, &sms, msg.Buffer+10);
3110 3120
3111 s->User.IncomingSMS(s->CurrentConfig->Device,sms); 3121 s->User.IncomingSMS(s->CurrentConfig->Device,sms);
3112 } 3122 }
3113 return ERR_NONE; 3123 return ERR_NONE;
3114} 3124}
3115 3125
3116static GSM_Error N6510_DialVoice(GSM_StateMachine *s, char *number, GSM_CallShowNumber ShowNumber) 3126static GSM_Error N6510_DialVoice(GSM_StateMachine *s, char *number, GSM_CallShowNumber ShowNumber)
3117{ 3127{
3128 unsigned int pos2 = 15;
3118 unsigned intpos = 4; 3129 unsigned intpos = 4;
3130 unsigned char req2[100] = {N6110_FRAME_HEADER,0x01,
3131 0x00,0x02,0x07,0x04,
3132 0x01, // 1 - voice, 2 - data
3133 0x00,0x03,
3134 0x18, // length of rest + 1
3135 0x00,0x00,0x00};
3119 unsigned char req[100] = {N6110_FRAME_HEADER,0x01, 3136 unsigned char req[100] = {N6110_FRAME_HEADER,0x01,
3120 0x0c};/* Number length */ 3137 0x0c};/* Number length */
3138 GSM_Errorerror;
3139
3140 /* USSD not supported */
3141 if (number[0] == '*') return ERR_NOTSUPPORTED;
3142 if (number[0] == '#') return ERR_NOTSUPPORTED;
3121 3143
3122 req[pos++] = strlen(number); 3144 req[pos++] = strlen(number);
3123 EncodeUnicode(req+pos,number,strlen(number)); 3145 EncodeUnicode(req+pos,number,strlen(number));
3124 pos += strlen(number)*2; 3146 pos += strlen(number)*2;
3125 req[pos++] = 0x05; /* call type: voice - 0x05, data - 0x01 */ 3147 req[pos++] = 0x05; /* call type: voice - 0x05, data - 0x01 */
3126 req[pos++] = 0x01; 3148 req[pos++] = 0x01;
3127 req[pos++] = 0x05; 3149 req[pos++] = 0x05;
3128 req[pos++] = 0x00; 3150 req[pos++] = 0x00;
3129 req[pos++] = 0x02; 3151 req[pos++] = 0x02;
3130 req[pos++] = 0x00; 3152 req[pos++] = 0x00;
3131 req[pos++] = 0x00; 3153 req[pos++] = 0x00;
3132 switch (ShowNumber) { 3154 switch (ShowNumber) {
3133 case GSM_CALL_HideNumber: 3155 case GSM_CALL_HideNumber:
3134 req[pos++] = 0x02; 3156 req[pos++] = 0x02;
3135 break; 3157 break;
3136 case GSM_CALL_ShowNumber: 3158 case GSM_CALL_ShowNumber:
3137 req[pos++] = 0x03; 3159 req[pos++] = 0x03;
3138 break; 3160 break;
3139 case GSM_CALL_DefaultNumberPresence: 3161 case GSM_CALL_DefaultNumberPresence:
3140 req[pos++] = 0x01; 3162 req[pos++] = 0x01;
3141 break; 3163 break;
3142 } 3164 }
3165 smprintf(s, "Making voice call\n");
3166 error = GSM_WaitFor (s, req, pos, 0x01, 4, ID_DialVoice);
3167 if (error != ERR_NOTSUPPORTED) return error;
3168
3169 if (ShowNumber != GSM_CALL_DefaultNumberPresence) return ERR_NOTSUPPORTED;
3170
3171 req2[11] = strlen(number)*2+6;
3172 req2[pos2++] = strlen(number);
3173 EncodeUnicode(req2+pos2,number,strlen(number));
3174 pos2 += strlen(number)*2;
3143 3175
3144 smprintf(s, "Making voice call\n"); 3176 smprintf(s, "Making voice call\n");
3145 return GSM_WaitFor (s, req, pos, 0x01, 4, ID_DialVoice); 3177 error = GSM_WaitFor (s, req2, pos2, 0x01, 4, ID_DialVoice);
3178 if (error == ERR_NOTSUPPORTED) return ERR_NONE;
3179 return error;
3146} 3180}
3147 3181
3148/* method 3 */ 3182/* method 3 */
3149static GSM_Error N6510_ReplyGetCalendarInfo3(GSM_Protocol_Message msg, GSM_StateMachine *s, GSM_NOKIACalToDoLocations *Last) 3183static GSM_Error N6510_ReplyGetCalendarInfo3(GSM_Protocol_Message msg, GSM_StateMachine *s, GSM_NOKIACalToDoLocations *Last)
3150{ 3184{
3151 int i=0,j=0; 3185 int i=0,j=0;
3152 3186
3153 while (Last->Location[j] != 0x00) j++; 3187 while (Last->Location[j] != 0x00) j++;
3154 if (j >= GSM_MAXCALENDARTODONOTES) { 3188 if (j >= GSM_MAXCALENDARTODONOTES) {
3155 smprintf(s, "Increase GSM_MAXCALENDARTODONOTES\n"); 3189 smprintf(s, "Increase GSM_MAXCALENDARTODONOTES\n");
3156 return ERR_UNKNOWN; 3190 return ERR_UNKNOWN;
3157 } 3191 }
@@ -3165,63 +3199,69 @@ static GSM_Error N6510_ReplyGetCalendarInfo3(GSM_Protocol_Message msg, GSM_State
3165 smprintf(s, "%i ",Last->Location[j-1]); 3199 smprintf(s, "%i ",Last->Location[j-1]);
3166 i++; 3200 i++;
3167 } 3201 }
3168 smprintf(s, "\nNumber of Entries in frame: %i\n",i); 3202 smprintf(s, "\nNumber of Entries in frame: %i\n",i);
3169 Last->Location[j] = 0; 3203 Last->Location[j] = 0;
3170 smprintf(s, "\n"); 3204 smprintf(s, "\n");
3171 if (i == 1 && msg.Buffer[12+0*4]*256+msg.Buffer[13+0*4] == 0) return ERR_EMPTY; 3205 if (i == 1 && msg.Buffer[12+0*4]*256+msg.Buffer[13+0*4] == 0) return ERR_EMPTY;
3172 if (i == 0) return ERR_EMPTY; 3206 if (i == 0) return ERR_EMPTY;
3173 return ERR_NONE; 3207 return ERR_NONE;
3174} 3208}
3175 3209
3176/* method 3 */ 3210/* method 3 */
3177static GSM_Error N6510_GetCalendarInfo3(GSM_StateMachine *s, GSM_NOKIACalToDoLocations *Last, bool Calendar) 3211static GSM_Error N6510_GetCalendarInfo3(GSM_StateMachine *s, GSM_NOKIACalToDoLocations *Last, char Type)
3178{ 3212{
3179 GSM_Error error; 3213 GSM_Error error = ERR_UNKNOWN;
3180 int i; 3214 int i;
3181 unsigned char req[] = {N6110_FRAME_HEADER, 0x9E, 0xFF, 0xFF, 0x00, 0x00, 3215 unsigned char req[] = {N6110_FRAME_HEADER, 0x9E, 0xFF, 0xFF, 0x00, 0x00,
3182 0x00, 0x00,/* First location */ 3216 0x00, 0x00,/* First location */
3183 0x00}; /* 0 = calendar, 1 = ToDo in 6610 style */ 3217 0x00}; /* 0 = calendar, 1 = ToDo in 6610 style, 2 = Notes */
3184 3218
3185 Last->Location[0] = 0x00; 3219 Last->Location[0] = 0x00;
3186 Last->Number = 0; 3220 Last->Number = 0;
3187 3221
3188 if (Calendar) { 3222 req[10] = Type;
3223 if (Type == 0) {
3189 smprintf(s, "Getting locations for calendar method 3\n"); 3224 smprintf(s, "Getting locations for calendar method 3\n");
3190 error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetCalendarNotesInfo); 3225 error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetCalendarNotesInfo);
3191 } else { 3226 } else if (Type == 1) {
3192 req[10] = 0x01;
3193 smprintf(s, "Getting locations for ToDo method 2\n"); 3227 smprintf(s, "Getting locations for ToDo method 2\n");
3194 error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetToDo); 3228 error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetToDo);
3229 } else if (Type == 2) {
3230 smprintf(s, "Getting locations for Notes\n");
3231 error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetNote);
3195 } 3232 }
3196 if (error != ERR_NONE && error != ERR_EMPTY) return error; 3233 if (error != ERR_NONE && error != ERR_EMPTY) return error;
3197 3234
3198 while (1) { 3235 while (1) {
3199 i=0; 3236 i=0;
3200 while (Last->Location[i] != 0x00) i++; 3237 while (Last->Location[i] != 0x00) i++;
3201 smprintf(s, "i = %i %i\n",i,Last->Number); 3238 smprintf(s, "i = %i %i\n",i,Last->Number);
3202 if (i == Last->Number) break; 3239 if (i == Last->Number) break;
3203 if (i != Last->Number && error == ERR_EMPTY) { 3240 if (i != Last->Number && error == ERR_EMPTY) {
3204 smprintf(s, "Phone doesn't support some notes with this method. Workaround\n"); 3241 smprintf(s, "Phone doesn't support some notes with this method. Workaround\n");
3205 Last->Number = i; 3242 Last->Number = i;
3206 break; 3243 break;
3207 } 3244 }
3208 req[8] = Last->Location[i-1] / 256; 3245 req[8] = Last->Location[i-1] / 256;
3209 req[9] = Last->Location[i-1] % 256; 3246 req[9] = Last->Location[i-1] % 256;
3210 if (Calendar) { 3247 if (Type == 0) {
3211 smprintf(s, "Getting locations for calendar method 3\n"); 3248 smprintf(s, "Getting locations for calendar method 3\n");
3212 error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetCalendarNotesInfo); 3249 error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetCalendarNotesInfo);
3213 } else { 3250 } else if (Type == 1) {
3214 smprintf(s, "Getting locations for todo method 2\n"); 3251 smprintf(s, "Getting locations for todo method 2\n");
3215 error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetToDo); 3252 error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetToDo);
3253 } else if (Type == 2) {
3254 smprintf(s, "Getting locations for Notes\n");
3255 error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetNote);
3216 } 3256 }
3217 if (error != ERR_NONE && error != ERR_EMPTY) return error; 3257 if (error != ERR_NONE && error != ERR_EMPTY) return error;
3218 } 3258 }
3219 return ERR_NONE; 3259 return ERR_NONE;
3220} 3260}
3221 3261
3222/* method 3 */ 3262/* method 3 */
3223GSM_Error N6510_ReplyGetCalendar3(GSM_Protocol_Message msg, GSM_StateMachine *s) 3263GSM_Error N6510_ReplyGetCalendar3(GSM_Protocol_Message msg, GSM_StateMachine *s)
3224{ 3264{
3225 GSM_CalendarEntry *entry = s->Phone.Data.Cal; 3265 GSM_CalendarEntry *entry = s->Phone.Data.Cal;
3226 GSM_DateTime Date; 3266 GSM_DateTime Date;
3227 unsigned long diff; 3267 unsigned long diff;
@@ -3341,69 +3381,75 @@ GSM_Error N6510_ReplyGetCalendar3(GSM_Protocol_Message msg, GSM_StateMachine *s)
3341 } 3381 }
3342 if (entry->Type == GSM_CAL_MEETING) { 3382 if (entry->Type == GSM_CAL_MEETING) {
3343 memcpy(entry->Entries[entry->EntriesNum].Text, msg.Buffer+(54+msg.Buffer[51]*2), msg.Buffer[52]*2); 3383 memcpy(entry->Entries[entry->EntriesNum].Text, msg.Buffer+(54+msg.Buffer[51]*2), msg.Buffer[52]*2);
3344 entry->Entries[entry->EntriesNum].Text[msg.Buffer[52]*2] = 0; 3384 entry->Entries[entry->EntriesNum].Text[msg.Buffer[52]*2] = 0;
3345 entry->Entries[entry->EntriesNum].Text[msg.Buffer[52]*2+1] = 0; 3385 entry->Entries[entry->EntriesNum].Text[msg.Buffer[52]*2+1] = 0;
3346 entry->Entries[entry->EntriesNum].EntryType = CAL_LOCATION; 3386 entry->Entries[entry->EntriesNum].EntryType = CAL_LOCATION;
3347 entry->EntriesNum++; 3387 entry->EntriesNum++;
3348 } 3388 }
3349 3389
3350 return ERR_NONE; 3390 return ERR_NONE;
3351} 3391}
3352 3392
3393static GSM_Error N6510_PrivGetGenericCalendar3(GSM_StateMachine *s, int Location, GSM_Phone_RequestID ID)
3394{
3395 unsigned char req[] = {N6110_FRAME_HEADER,0x7D,0x00,0x00,0x00,0x00,
3396 0x00,0x99,/* Location */
3397 0xff,0xff,0xff,0xff};
3398
3399 req[8] = Location / 256;
3400 req[9] = Location % 256;
3401
3402 return GSM_WaitFor (s, req, 14, 0x13, 4, ID);
3403}
3404
3353static GSM_Error N6510_PrivGetCalendar3(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start, int *LastCalendarYear) 3405static GSM_Error N6510_PrivGetCalendar3(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start, int *LastCalendarYear)
3354{ 3406{
3355 GSM_Error error; 3407 GSM_Error error;
3356 GSM_DateTime date_time; 3408 GSM_DateTime date_time;
3357 unsigned char req[] = {N6110_FRAME_HEADER,0x7D,0x00,0x00,0x00,0x00,
3358 0x00,0x99,/* Location */
3359 0xff,0xff,0xff,0xff,0x01};
3360 3409
3361 if (start) { 3410 if (start) {
3362 /* We have to get current year. It's NOT written in frame for 3411 /* We have to get current year. It's NOT written in frame for
3363 * Birthday 3412 * Birthday
3364 */ 3413 */
3365 error=s->Phone.Functions->GetDateTime(s,&date_time); 3414 error=s->Phone.Functions->GetDateTime(s,&date_time);
3366 switch (error) { 3415 switch (error) {
3367 case ERR_EMPTY: 3416 case ERR_EMPTY:
3368 case ERR_NOTIMPLEMENTED: 3417 case ERR_NOTIMPLEMENTED:
3369 GSM_GetCurrentDateTime(&date_time); 3418 GSM_GetCurrentDateTime(&date_time);
3370 break; 3419 break;
3371 case ERR_NONE: 3420 case ERR_NONE:
3372 break; 3421 break;
3373 default: 3422 default:
3374 return error; 3423 return error;
3375 } 3424 }
3376 *LastCalendarYear = date_time.Year; 3425 *LastCalendarYear = date_time.Year;
3377 } 3426 }
3378 3427
3379 Note->EntriesNum = 0; 3428 Note->EntriesNum = 0;
3380 Note->Entries[0].Date.Year = *LastCalendarYear; 3429 Note->Entries[0].Date.Year = *LastCalendarYear;
3381 3430
3382 req[8] = Note->Location / 256;
3383 req[9] = Note->Location % 256;
3384
3385 s->Phone.Data.Cal=Note; 3431 s->Phone.Data.Cal=Note;
3386 smprintf(s, "Getting calendar note method 3\n"); 3432 smprintf(s, "Getting calendar note method 3\n");
3387 return GSM_WaitFor (s, req, 15, 0x13, 4, ID_GetCalendarNote); 3433 return N6510_PrivGetGenericCalendar3(s, Note->Location, ID_GetCalendarNote);
3388} 3434}
3389 3435
3390/* method 3 */ 3436/* method 3 */
3391GSM_Error N6510_GetNextCalendar3(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start, GSM_NOKIACalToDoLocations *LastCalendar, int *LastCalendarYear, int *LastCalendarPos) 3437GSM_Error N6510_GetNextCalendar3(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start, GSM_NOKIACalToDoLocations *LastCalendar, int *LastCalendarYear, int *LastCalendarPos)
3392{ 3438{
3393 GSM_Error error; 3439 GSM_Error error;
3394 bool start2; 3440 bool start2;
3395 3441
3396 if (start) { 3442 if (start) {
3397 error=N6510_GetCalendarInfo3(s,LastCalendar,true); 3443 error=N6510_GetCalendarInfo3(s,LastCalendar,0);
3398 if (error!=ERR_NONE) return error; 3444 if (error!=ERR_NONE) return error;
3399 if (LastCalendar->Number == 0) return ERR_EMPTY; 3445 if (LastCalendar->Number == 0) return ERR_EMPTY;
3400 3446
3401 *LastCalendarPos = 0; 3447 *LastCalendarPos = 0;
3402 } else { 3448 } else {
3403 (*LastCalendarPos)++; 3449 (*LastCalendarPos)++;
3404 } 3450 }
3405 3451
3406 error = ERR_EMPTY; 3452 error = ERR_EMPTY;
3407 start2 = start; 3453 start2 = start;
3408 while (error == ERR_EMPTY) { 3454 while (error == ERR_EMPTY) {
3409 if (*LastCalendarPos >= LastCalendar->Number) return ERR_EMPTY; 3455 if (*LastCalendarPos >= LastCalendar->Number) return ERR_EMPTY;
@@ -3468,42 +3514,42 @@ static GSM_Error N6510_FindCalendarIconID3(GSM_StateMachine *s, GSM_CalendarEntr
3468 GSM_Error error; 3514 GSM_Error error;
3469 bool found; 3515 bool found;
3470 3516
3471 for(i=0;i<Priv->CalendarIconsNum;i++) { 3517 for(i=0;i<Priv->CalendarIconsNum;i++) {
3472 if (Priv->CalendarIconsTypes[i] == Entry->Type) { 3518 if (Priv->CalendarIconsTypes[i] == Entry->Type) {
3473 *ID = Priv->CalendarIcons[i]; 3519 *ID = Priv->CalendarIcons[i];
3474 return ERR_NONE; 3520 return ERR_NONE;
3475 } 3521 }
3476 } 3522 }
3477 3523
3478 smprintf(s, "Starting finding note ID\n"); 3524 smprintf(s, "Starting finding note ID\n");
3479 3525
3480 error=N6510_GetCalendarInfo3(s, &Priv->LastCalendar,true); 3526 error=N6510_GetCalendarInfo3(s, &Priv->LastCalendar,0);
3481 memcpy(&LastCalendar1,&Priv->LastCalendar,sizeof(GSM_NOKIACalToDoLocations)); 3527 memcpy(&LastCalendar1,&Priv->LastCalendar,sizeof(GSM_NOKIACalToDoLocations));
3482 if (error != ERR_NONE) return error; 3528 if (error != ERR_NONE) return error;
3483 3529
3484 if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL35) || 3530 if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL35) ||
3485 IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL65) || 3531 IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL65) ||
3486 IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL62)) { 3532 IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL62)) {
3487 error=N71_65_AddCalendar2(s,Entry); 3533 error=N71_65_AddCalendar2(s,Entry);
3488 } else { 3534 } else {
3489 if (Entry->Type == GSM_CAL_MEETING) { 3535 if (Entry->Type == GSM_CAL_MEETING) {
3490 error=N71_65_AddCalendar1(s, Entry, &s->Phone.Data.Priv.N6510.FirstCalendarPos); 3536 error=N71_65_AddCalendar1(s, Entry, &s->Phone.Data.Priv.N6510.FirstCalendarPos);
3491 } else { 3537 } else {
3492 error=N71_65_AddCalendar2(s,Entry); 3538 error=N71_65_AddCalendar2(s,Entry);
3493 } 3539 }
3494 } 3540 }
3495 if (error != ERR_NONE) return error; 3541 if (error != ERR_NONE) return error;
3496 3542
3497 error=N6510_GetCalendarInfo3(s, &Priv->LastCalendar,true); 3543 error=N6510_GetCalendarInfo3(s, &Priv->LastCalendar,0);
3498 memcpy(&LastCalendar2,&Priv->LastCalendar,sizeof(GSM_NOKIACalToDoLocations)); 3544 memcpy(&LastCalendar2,&Priv->LastCalendar,sizeof(GSM_NOKIACalToDoLocations));
3499 if (error != ERR_NONE) return error; 3545 if (error != ERR_NONE) return error;
3500 3546
3501 smprintf(s,"Number of entries: %i %i\n",LastCalendar1.Number,LastCalendar2.Number); 3547 smprintf(s,"Number of entries: %i %i\n",LastCalendar1.Number,LastCalendar2.Number);
3502 3548
3503 for(i=0;i<LastCalendar2.Number;i++) { 3549 for(i=0;i<LastCalendar2.Number;i++) {
3504 found = true; 3550 found = true;
3505 for(j=0;j<LastCalendar1.Number;j++) { 3551 for(j=0;j<LastCalendar1.Number;j++) {
3506 if (LastCalendar1.Location[j] == LastCalendar2.Location[i]) { 3552 if (LastCalendar1.Location[j] == LastCalendar2.Location[i]) {
3507 found = false; 3553 found = false;
3508 break; 3554 break;
3509 } 3555 }
@@ -3728,25 +3774,25 @@ static GSM_Error N6510_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus
3728 3774
3729 if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL62)) { 3775 if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL62)) {
3730 /* Method 1 */ 3776 /* Method 1 */
3731 error=N71_65_GetCalendarInfo1(s, &s->Phone.Data.Priv.N6510.LastCalendar); 3777 error=N71_65_GetCalendarInfo1(s, &s->Phone.Data.Priv.N6510.LastCalendar);
3732 if (error!=ERR_NONE) return error; 3778 if (error!=ERR_NONE) return error;
3733 Status->Used = s->Phone.Data.Priv.N6510.LastCalendar.Number; 3779 Status->Used = s->Phone.Data.Priv.N6510.LastCalendar.Number;
3734 return ERR_NONE; 3780 return ERR_NONE;
3735 3781
3736 /* Method 2 */ 3782 /* Method 2 */
3737 // return ERR_NOTSUPPORTED; 3783 // return ERR_NOTSUPPORTED;
3738 } else { 3784 } else {
3739 /* Method 3 */ 3785 /* Method 3 */
3740 error=N6510_GetCalendarInfo3(s,&s->Phone.Data.Priv.N6510.LastCalendar,true); 3786 error=N6510_GetCalendarInfo3(s,&s->Phone.Data.Priv.N6510.LastCalendar,0);
3741 if (error!=ERR_NONE) return error; 3787 if (error!=ERR_NONE) return error;
3742 Status->Used = s->Phone.Data.Priv.N6510.LastCalendar.Number; 3788 Status->Used = s->Phone.Data.Priv.N6510.LastCalendar.Number;
3743 return ERR_NONE; 3789 return ERR_NONE;
3744 } 3790 }
3745} 3791}
3746 3792
3747static GSM_Error N6510_AddCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note) 3793static GSM_Error N6510_AddCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note)
3748{ 3794{
3749#ifdef GSM_FORCE_DCT4_CALENDAR_6210 3795#ifdef GSM_FORCE_DCT4_CALENDAR_6210
3750 return N71_65_AddCalendar2(s,Note); 3796 return N71_65_AddCalendar2(s,Note);
3751#endif 3797#endif
3752 3798
@@ -3963,24 +4009,60 @@ static GSM_Error N6510_ShowStartInfo(GSM_StateMachine *s, bool enable)
3963 return N6510_SetLight(s,N6510_LIGHT_KEYPAD,true); 4009 return N6510_SetLight(s,N6510_LIGHT_KEYPAD,true);
3964 } else { 4010 } else {
3965 error=N6510_SetLight(s,N6510_LIGHT_DISPLAY,false); 4011 error=N6510_SetLight(s,N6510_LIGHT_DISPLAY,false);
3966 if (error != ERR_NONE) return error; 4012 if (error != ERR_NONE) return error;
3967 4013
3968 error=N6510_SetLight(s,N6510_LIGHT_TORCH,false); 4014 error=N6510_SetLight(s,N6510_LIGHT_TORCH,false);
3969 if (error != ERR_NONE) return error; 4015 if (error != ERR_NONE) return error;
3970 4016
3971 return N6510_SetLight(s,N6510_LIGHT_KEYPAD,false); 4017 return N6510_SetLight(s,N6510_LIGHT_KEYPAD,false);
3972 } 4018 }
3973} 4019}
3974 4020
4021static GSM_Error N6510_ReplyGetNoteInfo(GSM_Protocol_Message msg, GSM_StateMachine *s)
4022{
4023 return N6510_ReplyGetCalendarInfo3(msg, s, &s->Phone.Data.Priv.N6510.LastNote);
4024}
4025
4026static GSM_Error N6510_ReplyGetNote(GSM_Protocol_Message msg, GSM_StateMachine *s)
4027{
4028 smprintf(s, "Note received\n");
4029 memcpy(s->Phone.Data.Note->Text,msg.Buffer+54,(msg.Buffer[50]*256+msg.Buffer[51])*2);
4030 s->Phone.Data.Note->Text[(msg.Buffer[50]*256+msg.Buffer[51])*2] = 0;
4031 s->Phone.Data.Note->Text[(msg.Buffer[50]*256+msg.Buffer[51])*2+1] = 0;
4032 return ERR_NONE;
4033}
4034
4035GSM_Error N6510_GetNextNote(GSM_StateMachine *s, GSM_NoteEntry *Note, bool start)
4036{
4037 GSM_Error error;
4038 GSM_NOKIACalToDoLocations *LastNote = &s->Phone.Data.Priv.N6510.LastNote;
4039
4040 if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_NOTES)) return ERR_NOTSUPPORTED;
4041
4042 if (start) {
4043 error=N6510_GetCalendarInfo3(s,LastNote,2);
4044 if (error!=ERR_NONE) return error;
4045 Note->Location = 1;
4046 } else {
4047 Note->Location++;
4048 }
4049
4050 if (Note->Location > LastNote->Number) return ERR_EMPTY;
4051
4052 s->Phone.Data.Note = Note;
4053 smprintf(s, "Getting note\n");
4054 return N6510_PrivGetGenericCalendar3(s, LastNote->Location[Note->Location-1], ID_GetNote);
4055}
4056
3975static int N6510_FindFileCheckSum(unsigned char *ptr, int len) 4057static int N6510_FindFileCheckSum(unsigned char *ptr, int len)
3976{ 4058{
3977 int acc, i, accx; 4059 int acc, i, accx;
3978 4060
3979 accx = 0; 4061 accx = 0;
3980 acc = 0xffff; 4062 acc = 0xffff;
3981 while (len--) { 4063 while (len--) {
3982 accx = (accx & 0xffff00ff) | (acc & 0xff00); 4064 accx = (accx & 0xffff00ff) | (acc & 0xff00);
3983 acc = (acc & 0xffff00ff) | *ptr++ << 8; 4065 acc = (acc & 0xffff00ff) | *ptr++ << 8;
3984 for (i = 0; i < 8; i++) { 4066 for (i = 0; i < 8; i++) {
3985 acc <<= 1; 4067 acc <<= 1;
3986 if (acc & 0x10000) acc ^= 0x1021; 4068 if (acc & 0x10000) acc ^= 0x1021;
@@ -4046,25 +4128,25 @@ static GSM_Error N6510_ReplyGetFileFolderInfo(GSM_Protocol_Message msg, GSM_Stat
4046 else if (msg.Buffer[i]==0x02 && msg.Buffer[i+2]==0x05) 4128 else if (msg.Buffer[i]==0x02 && msg.Buffer[i+2]==0x05)
4047 File->Type = GSM_File_Image_GIF; 4129 File->Type = GSM_File_Image_GIF;
4048 else if (msg.Buffer[i]==0x02 && msg.Buffer[i+2]==0x09) 4130 else if (msg.Buffer[i]==0x02 && msg.Buffer[i+2]==0x09)
4049 File->Type = GSM_File_Image_WBMP; 4131 File->Type = GSM_File_Image_WBMP;
4050 else if (msg.Buffer[i]==0x04 && msg.Buffer[i+2]==0x01) 4132 else if (msg.Buffer[i]==0x04 && msg.Buffer[i+2]==0x01)
4051 File->Type = GSM_File_Sound_AMR; 4133 File->Type = GSM_File_Sound_AMR;
4052 else if (msg.Buffer[i]==0x04 && msg.Buffer[i+2]==0x02) 4134 else if (msg.Buffer[i]==0x04 && msg.Buffer[i+2]==0x02)
4053 File->Type = GSM_File_Sound_MIDI; 4135 File->Type = GSM_File_Sound_MIDI;
4054 else if (msg.Buffer[i]==0x08 && msg.Buffer[i+2]==0x05) 4136 else if (msg.Buffer[i]==0x08 && msg.Buffer[i+2]==0x05)
4055 File->Type = GSM_File_Video_3GP; 4137 File->Type = GSM_File_Video_3GP;
4056 else if (msg.Buffer[i]==0x10 && msg.Buffer[i+2]==0x01) 4138 else if (msg.Buffer[i]==0x10 && msg.Buffer[i+2]==0x01)
4057 File->Type = GSM_File_Java_JAR; 4139 File->Type = GSM_File_Java_JAR;
4058#if DEVELOP 4140#ifdef DEVELOP
4059 else if (msg.Buffer[i]==0x00 && msg.Buffer[i+2]==0x01) 4141 else if (msg.Buffer[i]==0x00 && msg.Buffer[i+2]==0x01)
4060 File->Type = GSM_File_MMS; 4142 File->Type = GSM_File_MMS;
4061#endif 4143#endif
4062 } 4144 }
4063 return ERR_NONE; 4145 return ERR_NONE;
4064 case 0x2F: 4146 case 0x2F:
4065 smprintf(s,"File or folder used bytes received\n"); 4147 smprintf(s,"File or folder used bytes received\n");
4066 File->Used = msg.Buffer[6]*256*256*256+ 4148 File->Used = msg.Buffer[6]*256*256*256+
4067 msg.Buffer[7]*256*256+ 4149 msg.Buffer[7]*256*256+
4068 msg.Buffer[8]*256+ 4150 msg.Buffer[8]*256+
4069 msg.Buffer[9]; 4151 msg.Buffer[9];
4070 return ERR_NONE; 4152 return ERR_NONE;
@@ -4389,25 +4471,25 @@ static GSM_Error N6510_AddFilePart(GSM_StateMachine *s, GSM_File *File, int *Pos
4389 0x01, 0x28}; /* length */ 4471 0x01, 0x28}; /* length */
4390 unsigned char end[30] = { 4472 unsigned char end[30] = {
4391 N7110_FRAME_HEADER, 0x40, 0x00, 0x00, 0x00, 0x01, 4473 N7110_FRAME_HEADER, 0x40, 0x00, 0x00, 0x00, 0x01,
4392 0x00, 0x04, /* file ID */ 4474 0x00, 0x04, /* file ID */
4393 0x00, 0x00, 0x00, 0x00}; 4475 0x00, 0x00, 0x00, 0x00};
4394 4476
4395 if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_NOFILESYSTEM)) return ERR_NOTSUPPORTED; 4477 if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_NOFILESYSTEM)) return ERR_NOTSUPPORTED;
4396 4478
4397 s->Phone.Data.File = File; 4479 s->Phone.Data.File = File;
4398 4480
4399 if (*Pos == 0) { 4481 if (*Pos == 0) {
4400 error = N6510_SearchForFileName(s,File); 4482 error = N6510_SearchForFileName(s,File);
4401 if (error == ERR_NONE) return ERR_INVALIDLOCATION; 4483 if (error == ERR_NONE) return ERR_FILEALREADYEXIST;
4402 if (error != ERR_EMPTY) return error; 4484 if (error != ERR_EMPTY) return error;
4403 4485
4404 Header[8] = atoi(File->ID_FullName) / 256; 4486 Header[8] = atoi(File->ID_FullName) / 256;
4405 Header[9] = atoi(File->ID_FullName) % 256; 4487 Header[9] = atoi(File->ID_FullName) % 256;
4406 memset(Header+14, 0x00, 300); 4488 memset(Header+14, 0x00, 300);
4407 CopyUnicodeString(Header+14,File->Name); 4489 CopyUnicodeString(Header+14,File->Name);
4408 Header[222] = File->Used / (256*256*256); 4490 Header[222] = File->Used / (256*256*256);
4409 Header[223] = File->Used / (256*256); 4491 Header[223] = File->Used / (256*256);
4410 Header[224] = File->Used / 256; 4492 Header[224] = File->Used / 256;
4411 Header[225] = File->Used % 256; 4493 Header[225] = File->Used % 256;
4412 switch(File->Type) { 4494 switch(File->Type) {
4413 case GSM_File_Image_JPG : Header[231]=0x02; Header[233]=0x01; break; 4495 case GSM_File_Image_JPG : Header[231]=0x02; Header[233]=0x01; break;
@@ -4805,25 +4887,25 @@ static GSM_Error N6510_GetToDoStatus1(GSM_StateMachine *s, GSM_ToDoStatus *statu
4805 error = GSM_WaitFor (s, reqLoc, 10, 0x55, 4, ID_GetToDo); 4887 error = GSM_WaitFor (s, reqLoc, 10, 0x55, 4, ID_GetToDo);
4806 if (error != ERR_NONE) return error; 4888 if (error != ERR_NONE) return error;
4807 4889
4808 status->Used = LastToDo->Number; 4890 status->Used = LastToDo->Number;
4809 return ERR_NONE; 4891 return ERR_NONE;
4810} 4892}
4811 4893
4812static GSM_Error N6510_GetToDoStatus2(GSM_StateMachine *s, GSM_ToDoStatus *status) 4894static GSM_Error N6510_GetToDoStatus2(GSM_StateMachine *s, GSM_ToDoStatus *status)
4813{ 4895{
4814 GSM_NOKIACalToDoLocations*LastToDo = &s->Phone.Data.Priv.N6510.LastToDo; 4896 GSM_NOKIACalToDoLocations*LastToDo = &s->Phone.Data.Priv.N6510.LastToDo;
4815 GSM_Error error; 4897 GSM_Error error;
4816 4898
4817 error = N6510_GetCalendarInfo3(s,LastToDo,false); 4899 error = N6510_GetCalendarInfo3(s,LastToDo,1);
4818 if (error!=ERR_NONE) return error; 4900 if (error!=ERR_NONE) return error;
4819 4901
4820 status->Used = LastToDo->Number; 4902 status->Used = LastToDo->Number;
4821 return ERR_NONE; 4903 return ERR_NONE;
4822} 4904}
4823 4905
4824static GSM_Error N6510_GetToDoStatus(GSM_StateMachine *s, GSM_ToDoStatus *status) 4906static GSM_Error N6510_GetToDoStatus(GSM_StateMachine *s, GSM_ToDoStatus *status)
4825{ 4907{
4826 status->Used = 0; 4908 status->Used = 0;
4827 4909
4828 if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO63)) { 4910 if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO63)) {
4829 return N6510_GetToDoStatus1(s, status); 4911 return N6510_GetToDoStatus1(s, status);
@@ -4935,26 +5017,25 @@ static GSM_Error N6510_ReplyGetToDo2(GSM_Protocol_Message msg, GSM_StateMachine
4935 Date.Minute = msg.Buffer[33]; 5017 Date.Minute = msg.Buffer[33];
4936 Date.Second= 0; 5018 Date.Second= 0;
4937 5019
4938 Last->EntriesNum = 2; 5020 Last->EntriesNum = 2;
4939 5021
4940 if (msg.Buffer[45] == 0x01) { 5022 if (msg.Buffer[45] == 0x01) {
4941 Last->Entries[2].Number = msg.Buffer[45]; 5023 Last->Entries[2].Number = msg.Buffer[45];
4942 Last->Entries[2].EntryType = TODO_COMPLETED; 5024 Last->Entries[2].EntryType = TODO_COMPLETED;
4943 Last->EntriesNum++; 5025 Last->EntriesNum++;
4944 smprintf(s,"Completed\n"); 5026 smprintf(s,"Completed\n");
4945 } 5027 }
4946 5028
4947 if (msg.Buffer[14] == 0xFF && msg.Buffer[15] == 0xFF && msg.Buffer[16] == 0xff && msg.Buffer[17] == 0xff) 5029 if (msg.Buffer[14] == 0xFF && msg.Buffer[15] == 0xFF && msg.Buffer[16] == 0xff && msg.Buffer[17] == 0xff) {
4948 {
4949 smprintf(s, "No alarm\n"); 5030 smprintf(s, "No alarm\n");
4950 } else { 5031 } else {
4951 diff = ((unsigned int)msg.Buffer[14]) << 24; 5032 diff = ((unsigned int)msg.Buffer[14]) << 24;
4952 diff += ((unsigned int)msg.Buffer[15]) << 16; 5033 diff += ((unsigned int)msg.Buffer[15]) << 16;
4953 diff += ((unsigned int)msg.Buffer[16]) << 8; 5034 diff += ((unsigned int)msg.Buffer[16]) << 8;
4954 diff += msg.Buffer[17]; 5035 diff += msg.Buffer[17];
4955 5036
4956 memcpy(&Last->Entries[Last->EntriesNum].Date,&Date,sizeof(GSM_DateTime)); 5037 memcpy(&Last->Entries[Last->EntriesNum].Date,&Date,sizeof(GSM_DateTime));
4957 GetTimeDifference(diff, &Last->Entries[Last->EntriesNum].Date, false, 60); 5038 GetTimeDifference(diff, &Last->Entries[Last->EntriesNum].Date, false, 60);
4958 smprintf(s, "Alarm date : %02i-%02i-%04i %02i:%02i:%02i\n", 5039 smprintf(s, "Alarm date : %02i-%02i-%04i %02i:%02i:%02i\n",
4959 Last->Entries[Last->EntriesNum].Date.Day, Last->Entries[Last->EntriesNum].Date.Month, 5040 Last->Entries[Last->EntriesNum].Date.Day, Last->Entries[Last->EntriesNum].Date.Month,
4960 Last->Entries[Last->EntriesNum].Date.Year, Last->Entries[Last->EntriesNum].Date.Hour, 5041 Last->Entries[Last->EntriesNum].Date.Year, Last->Entries[Last->EntriesNum].Date.Hour,
@@ -4969,46 +5050,38 @@ static GSM_Error N6510_ReplyGetToDo2(GSM_Protocol_Message msg, GSM_StateMachine
4969 } 5050 }
4970 Last->EntriesNum++; 5051 Last->EntriesNum++;
4971 } 5052 }
4972 5053
4973 return ERR_NONE; 5054 return ERR_NONE;
4974} 5055}
4975 5056
4976/* ToDo support - 6610 style */ 5057/* ToDo support - 6610 style */
4977static GSM_Error N6510_GetNextToDo2(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool refresh) 5058static GSM_Error N6510_GetNextToDo2(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool refresh)
4978{ 5059{
4979 GSM_Error error; 5060 GSM_Error error;
4980 GSM_NOKIACalToDoLocations *LastToDo = &s->Phone.Data.Priv.N6510.LastToDo; 5061 GSM_NOKIACalToDoLocations *LastToDo = &s->Phone.Data.Priv.N6510.LastToDo;
4981 /* The same to getting calendar method 3 */
4982 unsigned char req[] = {
4983 N6110_FRAME_HEADER,0x7D,0x00,0x00,0x00,0x00,
4984 0x00,0x99, /* Location */
4985 0xff,0xff,0xff,0xff,0x01};
4986 5062
4987 if (refresh) { 5063 if (refresh) {
4988 error=N6510_GetCalendarInfo3(s,LastToDo,false); 5064 error=N6510_GetCalendarInfo3(s,LastToDo,1);
4989 if (error!=ERR_NONE) return error; 5065 if (error!=ERR_NONE) return error;
4990 ToDo->Location = 1; 5066 ToDo->Location = 1;
4991 } else { 5067 } else {
4992 ToDo->Location++; 5068 ToDo->Location++;
4993 } 5069 }
4994 5070
4995 if (ToDo->Location > LastToDo->Number) return ERR_EMPTY; 5071 if (ToDo->Location > LastToDo->Number) return ERR_EMPTY;
4996 5072
4997 req[8] = LastToDo->Location[ToDo->Location-1] / 256;
4998 req[9] = LastToDo->Location[ToDo->Location-1] % 256;
4999
5000 s->Phone.Data.ToDo = ToDo; 5073 s->Phone.Data.ToDo = ToDo;
5001 smprintf(s, "Getting todo method 2\n"); 5074 smprintf(s, "Getting todo method 2\n");
5002 return GSM_WaitFor (s, req, 15, 0x13, 4, ID_GetToDo); 5075 return N6510_PrivGetGenericCalendar3(s, LastToDo->Location[ToDo->Location-1], ID_GetToDo);
5003} 5076}
5004 5077
5005static GSM_Error N6510_GetNextToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool refresh) 5078static GSM_Error N6510_GetNextToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool refresh)
5006{ 5079{
5007 if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO63)) { 5080 if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO63)) {
5008 return N6510_GetNextToDo1(s, ToDo, refresh); 5081 return N6510_GetNextToDo1(s, ToDo, refresh);
5009 } else if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO66)) { 5082 } else if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO66)) {
5010 return N6510_GetNextToDo2(s, ToDo, refresh); 5083 return N6510_GetNextToDo2(s, ToDo, refresh);
5011 } else { 5084 } else {
5012 return ERR_NOTSUPPORTED; 5085 return ERR_NOTSUPPORTED;
5013 } 5086 }
5014} 5087}
@@ -5034,25 +5107,25 @@ static GSM_Error N6510_DeleteAllToDo1(GSM_StateMachine *s)
5034} 5107}
5035 5108
5036static GSM_Error N6510_DeleteToDo2(GSM_StateMachine *s, GSM_ToDoEntry *ToDo) 5109static GSM_Error N6510_DeleteToDo2(GSM_StateMachine *s, GSM_ToDoEntry *ToDo)
5037{ 5110{
5038 GSM_Error error; 5111 GSM_Error error;
5039 GSM_NOKIACalToDoLocations *LastToDo = &s->Phone.Data.Priv.N6510.LastToDo; 5112 GSM_NOKIACalToDoLocations *LastToDo = &s->Phone.Data.Priv.N6510.LastToDo;
5040 GSM_CalendarEntry Note; 5113 GSM_CalendarEntry Note;
5041 5114
5042 if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO66)) { 5115 if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO66)) {
5043 return ERR_NOTSUPPORTED; 5116 return ERR_NOTSUPPORTED;
5044 } 5117 }
5045 5118
5046 error=N6510_GetCalendarInfo3(s,LastToDo,false); 5119 error=N6510_GetCalendarInfo3(s,LastToDo,1);
5047 if (error!=ERR_NONE) return error; 5120 if (error!=ERR_NONE) return error;
5048 5121
5049 smprintf(s, "Deleting ToDo method 2\n"); 5122 smprintf(s, "Deleting ToDo method 2\n");
5050 5123
5051 if (ToDo->Location > LastToDo->Number || ToDo->Location == 0) return ERR_INVALIDLOCATION; 5124 if (ToDo->Location > LastToDo->Number || ToDo->Location == 0) return ERR_INVALIDLOCATION;
5052 5125
5053 Note.Location = LastToDo->Location[ToDo->Location-1]; 5126 Note.Location = LastToDo->Location[ToDo->Location-1];
5054 return N71_65_DelCalendar(s,&Note); 5127 return N71_65_DelCalendar(s,&Note);
5055} 5128}
5056 5129
5057/* ToDo support - 6310 style */ 5130/* ToDo support - 6310 style */
5058static GSM_Error N6510_ReplyGetToDoFirstLoc1(GSM_Protocol_Message msg, GSM_StateMachine *s) 5131static GSM_Error N6510_ReplyGetToDoFirstLoc1(GSM_Protocol_Message msg, GSM_StateMachine *s)
@@ -5442,31 +5515,37 @@ static GSM_Reply_Function N6510ReplyFunctions[] = {
5442 {N71_65_ReplyCallInfo, "\x01",0x03,0x02,ID_IncomingFrame }, 5515 {N71_65_ReplyCallInfo, "\x01",0x03,0x02,ID_IncomingFrame },
5443 {N71_65_ReplyCallInfo, "\x01",0x03,0x03,ID_IncomingFrame }, 5516 {N71_65_ReplyCallInfo, "\x01",0x03,0x03,ID_IncomingFrame },
5444 {N71_65_ReplyCallInfo, "\x01",0x03,0x04,ID_IncomingFrame }, 5517 {N71_65_ReplyCallInfo, "\x01",0x03,0x04,ID_IncomingFrame },
5445 {N71_65_ReplyCallInfo, "\x01",0x03,0x05,ID_IncomingFrame }, 5518 {N71_65_ReplyCallInfo, "\x01",0x03,0x05,ID_IncomingFrame },
5446 {N71_65_ReplyCallInfo, "\x01",0x03,0x07,ID_AnswerCall }, 5519 {N71_65_ReplyCallInfo, "\x01",0x03,0x07,ID_AnswerCall },
5447 {N71_65_ReplyCallInfo, "\x01",0x03,0x07,ID_IncomingFrame }, 5520 {N71_65_ReplyCallInfo, "\x01",0x03,0x07,ID_IncomingFrame },
5448 {N71_65_ReplyCallInfo, "\x01",0x03,0x09,ID_CancelCall }, 5521 {N71_65_ReplyCallInfo, "\x01",0x03,0x09,ID_CancelCall },
5449 {N71_65_ReplyCallInfo, "\x01",0x03,0x09,ID_IncomingFrame }, 5522 {N71_65_ReplyCallInfo, "\x01",0x03,0x09,ID_IncomingFrame },
5450 {N71_65_ReplyCallInfo, "\x01",0x03,0x0A,ID_IncomingFrame }, 5523 {N71_65_ReplyCallInfo, "\x01",0x03,0x0A,ID_IncomingFrame },
5451 {N71_65_ReplyCallInfo, "\x01",0x03,0x0B,ID_IncomingFrame }, 5524 {N71_65_ReplyCallInfo, "\x01",0x03,0x0B,ID_IncomingFrame },
5452 {N71_65_ReplyCallInfo, "\x01",0x03,0x0C,ID_DialVoice }, 5525 {N71_65_ReplyCallInfo, "\x01",0x03,0x0C,ID_DialVoice },
5453 {N71_65_ReplyCallInfo, "\x01",0x03,0x0C,ID_IncomingFrame }, 5526 {N71_65_ReplyCallInfo, "\x01",0x03,0x0C,ID_IncomingFrame },
5527 {N71_65_ReplyCallInfo, "\x01",0x03,0x0F,ID_IncomingFrame },
5528 {N71_65_ReplyCallInfo, "\x01",0x03,0x10,ID_DialVoice },
5529 {N71_65_ReplyCallInfo, "\x01",0x03,0x10,ID_IncomingFrame },
5454 {N71_65_ReplyCallInfo, "\x01",0x03,0x23,ID_IncomingFrame }, 5530 {N71_65_ReplyCallInfo, "\x01",0x03,0x23,ID_IncomingFrame },
5455 {N71_65_ReplyCallInfo, "\x01",0x03,0x25,ID_IncomingFrame }, 5531 {N71_65_ReplyCallInfo, "\x01",0x03,0x25,ID_IncomingFrame },
5456 {N71_65_ReplyCallInfo, "\x01",0x03,0x27,ID_IncomingFrame }, 5532 {N71_65_ReplyCallInfo, "\x01",0x03,0x27,ID_IncomingFrame },
5457 {N71_65_ReplySendDTMF, "\x01",0x03,0x51,ID_SendDTMF }, 5533 {N71_65_ReplySendDTMF, "\x01",0x03,0x51,ID_SendDTMF },
5458 {N71_65_ReplyCallInfo, "\x01",0x03,0x53,ID_IncomingFrame }, 5534 {N71_65_ReplyCallInfo, "\x01",0x03,0x53,ID_IncomingFrame },
5459 {N71_65_ReplySendDTMF, "\x01",0x03,0x59,ID_SendDTMF }, 5535 {N71_65_ReplySendDTMF, "\x01",0x03,0x59,ID_SendDTMF },
5460 {N71_65_ReplySendDTMF, "\x01",0x03,0x5E,ID_SendDTMF }, 5536 {N71_65_ReplySendDTMF, "\x01",0x03,0x5E,ID_SendDTMF },
5537 {N71_65_ReplyCallInfo, "\x01",0x03,0xA6,ID_IncomingFrame },
5538 {N71_65_ReplyCallInfo, "\x01",0x03,0xD2,ID_IncomingFrame },
5539 {N71_65_ReplyCallInfo, "\x01",0x03,0xD3,ID_IncomingFrame },
5461 5540
5462 {N6510_ReplySendSMSMessage, "\x02",0x03,0x03,ID_IncomingFrame }, 5541 {N6510_ReplySendSMSMessage, "\x02",0x03,0x03,ID_IncomingFrame },
5463 {N6510_ReplyIncomingSMS, "\x02",0x03,0x04,ID_IncomingFrame }, 5542 {N6510_ReplyIncomingSMS, "\x02",0x03,0x04,ID_IncomingFrame },
5464 {N6510_ReplySetSMSC, "\x02",0x03,0x13,ID_SetSMSC }, 5543 {N6510_ReplySetSMSC, "\x02",0x03,0x13,ID_SetSMSC },
5465 {N6510_ReplyGetSMSC, "\x02",0x03,0x15,ID_GetSMSC }, 5544 {N6510_ReplyGetSMSC, "\x02",0x03,0x15,ID_GetSMSC },
5466 5545
5467 {N6510_ReplyGetMemoryStatus, "\x03",0x03,0x04,ID_GetMemoryStatus }, 5546 {N6510_ReplyGetMemoryStatus, "\x03",0x03,0x04,ID_GetMemoryStatus },
5468 {N6510_ReplyGetMemory, "\x03",0x03,0x08,ID_GetMemory }, 5547 {N6510_ReplyGetMemory, "\x03",0x03,0x08,ID_GetMemory },
5469 {N6510_ReplyDeleteMemory, "\x03",0x03,0x10,ID_SetMemory }, 5548 {N6510_ReplyDeleteMemory, "\x03",0x03,0x10,ID_SetMemory },
5470 {N71_65_ReplyWritePhonebook, "\x03",0x03,0x0C,ID_SetBitmap }, 5549 {N71_65_ReplyWritePhonebook, "\x03",0x03,0x0C,ID_SetBitmap },
5471 {N71_65_ReplyWritePhonebook, "\x03",0x03,0x0C,ID_SetMemory }, 5550 {N71_65_ReplyWritePhonebook, "\x03",0x03,0x0C,ID_SetMemory },
5472 5551
@@ -5499,31 +5578,33 @@ static GSM_Reply_Function N6510ReplyFunctions[] = {
5499 {N71_65_ReplyDelCalendar, "\x13",0x03,0x0C,ID_DeleteCalendarNote }, 5578 {N71_65_ReplyDelCalendar, "\x13",0x03,0x0C,ID_DeleteCalendarNote },
5500 {N71_65_ReplyGetNextCalendar1, "\x13",0x03,0x1A,ID_GetCalendarNote },/*method 1*/ 5579 {N71_65_ReplyGetNextCalendar1, "\x13",0x03,0x1A,ID_GetCalendarNote },/*method 1*/
5501 {N6510_ReplyGetCalendarNotePos, "\x13",0x03,0x32,ID_GetCalendarNotePos },/*method 1*/ 5580 {N6510_ReplyGetCalendarNotePos, "\x13",0x03,0x32,ID_GetCalendarNotePos },/*method 1*/
5502 {N6510_ReplyGetCalendarInfo, "\x13",0x03,0x3B,ID_GetCalendarNotesInfo},/*method 1*/ 5581 {N6510_ReplyGetCalendarInfo, "\x13",0x03,0x3B,ID_GetCalendarNotesInfo},/*method 1*/
5503#ifdef DEBUG 5582#ifdef DEBUG
5504 {N71_65_ReplyGetNextCalendar2, "\x13",0x03,0x3F,ID_GetCalendarNote }, 5583 {N71_65_ReplyGetNextCalendar2, "\x13",0x03,0x3F,ID_GetCalendarNote },
5505#endif 5584#endif
5506 {N71_65_ReplyAddCalendar2, "\x13",0x03,0x41,ID_SetCalendarNote },/*method 2*/ 5585 {N71_65_ReplyAddCalendar2, "\x13",0x03,0x41,ID_SetCalendarNote },/*method 2*/
5507 {N6510_ReplyAddCalendar3, "\x13",0x03,0x66,ID_SetCalendarNote },/*method 3*/ 5586 {N6510_ReplyAddCalendar3, "\x13",0x03,0x66,ID_SetCalendarNote },/*method 3*/
5508 {N6510_ReplyAddToDo2, "\x13",0x03,0x66,ID_SetToDo }, 5587 {N6510_ReplyAddToDo2, "\x13",0x03,0x66,ID_SetToDo },
5509 {N6510_ReplyGetCalendar3, "\x13",0x03,0x7E,ID_GetCalendarNote },/*method 3*/ 5588 {N6510_ReplyGetCalendar3, "\x13",0x03,0x7E,ID_GetCalendarNote },/*method 3*/
5510 {N6510_ReplyGetToDo2, "\x13",0x03,0x7E,ID_GetToDo }, 5589 {N6510_ReplyGetToDo2, "\x13",0x03,0x7E,ID_GetToDo },
5590 {N6510_ReplyGetNote, "\x13",0x03,0x7E,ID_GetNote },
5511 {N6510_ReplyGetCalendarSettings, "\x13",0x03,0x86,ID_GetCalendarSettings }, 5591 {N6510_ReplyGetCalendarSettings, "\x13",0x03,0x86,ID_GetCalendarSettings },
5512 {N6510_ReplyGetLocale, "\x13",0x03,0x8A,ID_GetLocale }, 5592 {N6510_ReplyGetLocale, "\x13",0x03,0x8A,ID_GetLocale },
5513 {N6510_ReplyGetCalendarSettings, "\x13",0x03,0x8E,ID_GetCalendarSettings }, 5593 {N6510_ReplyGetCalendarSettings, "\x13",0x03,0x8E,ID_GetCalendarSettings },
5514 {N6510_ReplyGetCalendarNotePos, "\x13",0x03,0x96,ID_GetCalendarNotePos },/*method 3*/ 5594 {N6510_ReplyGetCalendarNotePos, "\x13",0x03,0x96,ID_GetCalendarNotePos },/*method 3*/
5515 {N6510_ReplyGetToDoFirstLoc2, "\x13",0x03,0x96,ID_SetToDo }, 5595 {N6510_ReplyGetToDoFirstLoc2, "\x13",0x03,0x96,ID_SetToDo },
5516 {N6510_ReplyGetCalendarInfo, "\x13",0x03,0x9F,ID_GetCalendarNotesInfo},/*method 3*/ 5596 {N6510_ReplyGetCalendarInfo, "\x13",0x03,0x9F,ID_GetCalendarNotesInfo},/*method 3*/
5517 {N6510_ReplyGetToDoStatus2, "\x13",0x03,0x9F,ID_GetToDo }, 5597 {N6510_ReplyGetToDoStatus2, "\x13",0x03,0x9F,ID_GetToDo },
5598 {N6510_ReplyGetNoteInfo, "\x13",0x03,0x9F,ID_GetNote },
5518 5599
5519 {N6510_ReplySaveSMSMessage, "\x14",0x03,0x01,ID_SaveSMSMessage }, 5600 {N6510_ReplySaveSMSMessage, "\x14",0x03,0x01,ID_SaveSMSMessage },
5520 {N6510_ReplySetPicture, "\x14",0x03,0x01,ID_SetBitmap }, 5601 {N6510_ReplySetPicture, "\x14",0x03,0x01,ID_SetBitmap },
5521 {N6510_ReplyGetSMSMessage, "\x14",0x03,0x03,ID_GetSMSMessage }, 5602 {N6510_ReplyGetSMSMessage, "\x14",0x03,0x03,ID_GetSMSMessage },
5522 {N6510_ReplyDeleteSMSMessage, "\x14",0x03,0x05,ID_DeleteSMSMessage }, 5603 {N6510_ReplyDeleteSMSMessage, "\x14",0x03,0x05,ID_DeleteSMSMessage },
5523 {N6510_ReplyDeleteSMSMessage, "\x14",0x03,0x06,ID_DeleteSMSMessage }, 5604 {N6510_ReplyDeleteSMSMessage, "\x14",0x03,0x06,ID_DeleteSMSMessage },
5524 {N6510_ReplyGetSMSStatus, "\x14",0x03,0x09,ID_GetSMSStatus }, 5605 {N6510_ReplyGetSMSStatus, "\x14",0x03,0x09,ID_GetSMSStatus },
5525 {N6510_ReplyGetSMSFolderStatus, "\x14",0x03,0x0d,ID_GetSMSFolderStatus }, 5606 {N6510_ReplyGetSMSFolderStatus, "\x14",0x03,0x0d,ID_GetSMSFolderStatus },
5526 {N6510_ReplyGetSMSMessage, "\x14",0x03,0x0f,ID_GetSMSMessage }, 5607 {N6510_ReplyGetSMSMessage, "\x14",0x03,0x0f,ID_GetSMSMessage },
5527 {N6510_ReplyAddSMSFolder, "\x14",0x03,0x11,ID_AddSMSFolder }, 5608 {N6510_ReplyAddSMSFolder, "\x14",0x03,0x11,ID_AddSMSFolder },
5528 {N6510_ReplyGetSMSFolders, "\x14",0x03,0x13,ID_GetSMSFolders }, 5609 {N6510_ReplyGetSMSFolders, "\x14",0x03,0x13,ID_GetSMSFolders },
5529 {N6510_ReplySaveSMSMessage, "\x14",0x03,0x17,ID_SaveSMSMessage }, 5610 {N6510_ReplySaveSMSMessage, "\x14",0x03,0x17,ID_SaveSMSMessage },
@@ -5642,25 +5723,25 @@ static GSM_Reply_Function N6510ReplyFunctions[] = {
5642 5723
5643 {DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetModel }, 5724 {DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetModel },
5644 {DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetFirmware }, 5725 {DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetFirmware },
5645 5726
5646 /* 0xD7 - Bluetooth */ 5727 /* 0xD7 - Bluetooth */
5647 5728
5648 {N6510_ReplyGetRingtoneID, "\xDB",0x03,0x02,ID_SetRingtone }, 5729 {N6510_ReplyGetRingtoneID, "\xDB",0x03,0x02,ID_SetRingtone },
5649 5730
5650 {NULL, "\x00",0x00,0x00,ID_None } 5731 {NULL, "\x00",0x00,0x00,ID_None }
5651}; 5732};
5652 5733
5653GSM_Phone_Functions N6510Phone = { 5734GSM_Phone_Functions N6510Phone = {
5654 "1100|1100a|1100b|3100|3100b|3108|3200|3200a|3300|3510|3510i|3530|3589i|3590|3595|5100|6100|6200|6220|6230|6310|6310i|6385|6510|6610|6800|7210|7250|7250i|7600|8310|8390|8910|8910i", 5735 "1100|1100a|1100b|3100|3100b|3108|3200|3200a|3300|3510|3510i|3530|3589i|3590|3595|5100|5140|6100|6200|6220|6230|6310|6310i|6385|6510|6610|6610i|6800|6810|6820|7210|7250|7250i|7600|8310|8390|8910|8910i",
5655 N6510ReplyFunctions, 5736 N6510ReplyFunctions,
5656 N6510_Initialise, 5737 N6510_Initialise,
5657 NONEFUNCTION, /* Terminate */ 5738 NONEFUNCTION, /* Terminate */
5658 GSM_DispatchMessage, 5739 GSM_DispatchMessage,
5659 N6510_ShowStartInfo, 5740 N6510_ShowStartInfo,
5660 NOKIA_GetManufacturer, 5741 NOKIA_GetManufacturer,
5661 DCT3DCT4_GetModel, 5742 DCT3DCT4_GetModel,
5662 DCT3DCT4_GetFirmware, 5743 DCT3DCT4_GetFirmware,
5663 DCT4_GetIMEI, 5744 DCT4_GetIMEI,
5664 N6510_GetOriginalIMEI, 5745 N6510_GetOriginalIMEI,
5665 N6510_GetManufactureMonth, 5746 N6510_GetManufactureMonth,
5666 DCT4_GetProductCode, 5747 DCT4_GetProductCode,
@@ -5696,24 +5777,25 @@ GSM_Phone_Functions N6510Phone = {
5696 N6510_GetSpeedDial, 5777 N6510_GetSpeedDial,
5697 NOTIMPLEMENTED, /* SetSpeedDial */ 5778 NOTIMPLEMENTED, /* SetSpeedDial */
5698 N6510_GetSMSC, 5779 N6510_GetSMSC,
5699 N6510_SetSMSC, 5780 N6510_SetSMSC,
5700 N6510_GetSMSStatus, 5781 N6510_GetSMSStatus,
5701 N6510_GetSMSMessage, 5782 N6510_GetSMSMessage,
5702 N6510_GetNextSMSMessage, 5783 N6510_GetNextSMSMessage,
5703 N6510_SetSMS, 5784 N6510_SetSMS,
5704 N6510_AddSMS, 5785 N6510_AddSMS,
5705 N6510_DeleteSMSMessage, 5786 N6510_DeleteSMSMessage,
5706 N6510_SendSMSMessage, 5787 N6510_SendSMSMessage,
5707 NOTSUPPORTED, /* SendSavedSMS */ 5788 NOTSUPPORTED, /* SendSavedSMS */
5789 NOTSUPPORTED, /* SetFastSMSSending*/
5708 NOKIA_SetIncomingSMS, 5790 NOKIA_SetIncomingSMS,
5709 NOTIMPLEMENTED, /* SetIncomingCB */ 5791 NOTIMPLEMENTED, /* SetIncomingCB */
5710 N6510_GetSMSFolders, 5792 N6510_GetSMSFolders,
5711 N6510_AddSMSFolder, 5793 N6510_AddSMSFolder,
5712 NOTIMPLEMENTED, /* DeleteSMSFolder */ 5794 NOTIMPLEMENTED, /* DeleteSMSFolder */
5713 N6510_DialVoice, 5795 N6510_DialVoice,
5714 N6510_AnswerCall, 5796 N6510_AnswerCall,
5715 N6510_CancelCall, 5797 N6510_CancelCall,
5716 NOTIMPLEMENTED, /* HoldCall */ 5798 NOTIMPLEMENTED, /* HoldCall */
5717 NOTIMPLEMENTED, /* UnholdCall */ 5799 NOTIMPLEMENTED, /* UnholdCall */
5718 NOTIMPLEMENTED, /* ConferenceCall */ 5800 NOTIMPLEMENTED, /* ConferenceCall */
5719 NOTIMPLEMENTED, /* SplitCall */ 5801 NOTIMPLEMENTED, /* SplitCall */
@@ -5750,25 +5832,25 @@ GSM_Phone_Functions N6510Phone = {
5750 N6510_AddToDo, 5832 N6510_AddToDo,
5751 N6510_DeleteToDo2, 5833 N6510_DeleteToDo2,
5752 N6510_DeleteAllToDo1, 5834 N6510_DeleteAllToDo1,
5753 N6510_GetCalendarStatus, 5835 N6510_GetCalendarStatus,
5754 NOTIMPLEMENTED, /* GetCalendar */ 5836 NOTIMPLEMENTED, /* GetCalendar */
5755 N6510_GetNextCalendar, 5837 N6510_GetNextCalendar,
5756 NOTIMPLEMENTED, /* SetCalendar */ 5838 NOTIMPLEMENTED, /* SetCalendar */
5757 N6510_AddCalendar, 5839 N6510_AddCalendar,
5758 N71_65_DelCalendar, 5840 N71_65_DelCalendar,
5759 NOTIMPLEMENTED, /* DeleteAllCalendar*/ 5841 NOTIMPLEMENTED, /* DeleteAllCalendar*/
5760 N6510_GetCalendarSettings, 5842 N6510_GetCalendarSettings,
5761 NOTSUPPORTED, /* SetCalendarSettings*/ 5843 NOTSUPPORTED, /* SetCalendarSettings*/
5762 NOTIMPLEMENTED, /* GetNote */ 5844 N6510_GetNextNote,
5763 N6510_GetProfile, 5845 N6510_GetProfile,
5764 N6510_SetProfile, 5846 N6510_SetProfile,
5765 N6510_GetFMStation, 5847 N6510_GetFMStation,
5766 N6510_SetFMStation, 5848 N6510_SetFMStation,
5767 N6510_ClearFMStations, 5849 N6510_ClearFMStations,
5768 N6510_GetNextFileFolder, 5850 N6510_GetNextFileFolder,
5769 N6510_GetFilePart, 5851 N6510_GetFilePart,
5770 N6510_AddFilePart, 5852 N6510_AddFilePart,
5771 N6510_GetFileSystemStatus, 5853 N6510_GetFileSystemStatus,
5772 N6510_DeleteFile, 5854 N6510_DeleteFile,
5773 N6510_AddFolder, 5855 N6510_AddFolder,
5774 N6510_GetGPRSAccessPoint, 5856 N6510_GetGPRSAccessPoint,
diff --git a/gammu/emb/common/phone/nokia/dct4/n6510.h b/gammu/emb/common/phone/nokia/dct4/n6510.h
index 4717aeb..26623d6 100644
--- a/gammu/emb/common/phone/nokia/dct4/n6510.h
+++ b/gammu/emb/common/phone/nokia/dct4/n6510.h
@@ -25,24 +25,26 @@ typedef struct {
25 int LastCalendarPos; 25 int LastCalendarPos;
26 GSM_NOKIACalToDoLocationsLastCalendar; 26 GSM_NOKIACalToDoLocationsLastCalendar;
27 int FirstCalendarPos; 27 int FirstCalendarPos;
28 unsigned char CalendarIcons[10]; 28 unsigned char CalendarIcons[10];
29 GSM_CalendarNoteType CalendarIconsTypes[10]; 29 GSM_CalendarNoteType CalendarIconsTypes[10];
30 int CalendarIconsNum; 30 int CalendarIconsNum;
31 31
32 GSM_NOKIASMSFolder LastSMSFolder; 32 GSM_NOKIASMSFolder LastSMSFolder;
33 GSM_SMSFolders LastSMSFolders; 33 GSM_SMSFolders LastSMSFolders;
34 34
35 GSM_NOKIACalToDoLocationsLastToDo; 35 GSM_NOKIACalToDoLocationsLastToDo;
36 36
37 GSM_NOKIACalToDoLocationsLastNote;
38
37 unsigned char RingtoneID;/* When set with preview */ 39 unsigned char RingtoneID;/* When set with preview */
38 40
39 int FilesLocations[1000]; 41 int FilesLocations[1000];
40 int FilesLevels[1000]; 42 int FilesLevels[1000];
41 int FilesLocationsUsed; 43 int FilesLocationsUsed;
42 int FilesLocationsCurrent; 44 int FilesLocationsCurrent;
43 int FileToken; 45 int FileToken;
44 int ParentID; 46 int ParentID;
45 int FileCheckSum; 47 int FileCheckSum;
46 48
47 unsigned char FMStatus[4000]; 49 unsigned char FMStatus[4000];
48 int FMStatusLength; 50 int FMStatusLength;
diff --git a/gammu/emb/common/phone/nokia/nauto.c b/gammu/emb/common/phone/nokia/nauto.c
index bf74bc9..3bb53ec 100644
--- a/gammu/emb/common/phone/nokia/nauto.c
+++ b/gammu/emb/common/phone/nokia/nauto.c
@@ -112,25 +112,25 @@ GSM_Phone_Functions NAUTOPhone = {
112 NOTSUPPORTED, /* AddToDo */ 112 NOTSUPPORTED, /* AddToDo */
113 NOTSUPPORTED, /* DeleteToDo */ 113 NOTSUPPORTED, /* DeleteToDo */
114 NOTSUPPORTED, /* DeleteAllToDo */ 114 NOTSUPPORTED, /* DeleteAllToDo */
115 NOTSUPPORTED, /* GetCalendarStatus*/ 115 NOTSUPPORTED, /* GetCalendarStatus*/
116 NOTSUPPORTED, /* GetCalendar */ 116 NOTSUPPORTED, /* GetCalendar */
117 NOTSUPPORTED, /* GetNextCalendar */ 117 NOTSUPPORTED, /* GetNextCalendar */
118 NOTSUPPORTED, /* SetCalendar */ 118 NOTSUPPORTED, /* SetCalendar */
119 NOTSUPPORTED, /* AddCalendar */ 119 NOTSUPPORTED, /* AddCalendar */
120 NOTSUPPORTED, /* DeleteCalendar */ 120 NOTSUPPORTED, /* DeleteCalendar */
121 NOTSUPPORTED, /* DeleteAllCalendar*/ 121 NOTSUPPORTED, /* DeleteAllCalendar*/
122 NOTSUPPORTED, /* GetCalendarSettings*/ 122 NOTSUPPORTED, /* GetCalendarSettings*/
123 NOTSUPPORTED, /* SetCalendarSettings*/ 123 NOTSUPPORTED, /* SetCalendarSettings*/
124 NOTSUPPORTED, /* GetNote */ 124 NOTSUPPORTED, /* GetNextNote */
125 NOTSUPPORTED, /* GetProfile */ 125 NOTSUPPORTED, /* GetProfile */
126 NOTSUPPORTED, /* SetProfile */ 126 NOTSUPPORTED, /* SetProfile */
127 NOTSUPPORTED, /* GetFMStation */ 127 NOTSUPPORTED, /* GetFMStation */
128 NOTSUPPORTED, /* SetFMStation */ 128 NOTSUPPORTED, /* SetFMStation */
129 NOTSUPPORTED, /* ClearFMStations */ 129 NOTSUPPORTED, /* ClearFMStations */
130 NOTSUPPORTED, /* GetNextFileFolder*/ 130 NOTSUPPORTED, /* GetNextFileFolder*/
131 NOTSUPPORTED, /* GetFilePart */ 131 NOTSUPPORTED, /* GetFilePart */
132 NOTSUPPORTED, /* AddFilePart */ 132 NOTSUPPORTED, /* AddFilePart */
133 NOTSUPPORTED, /* GetFileSystemStatus*/ 133 NOTSUPPORTED, /* GetFileSystemStatus*/
134 NOTSUPPORTED, /* DeleteFile */ 134 NOTSUPPORTED, /* DeleteFile */
135 NOTSUPPORTED, /* AddFolder */ 135 NOTSUPPORTED, /* AddFolder */
136 NOTSUPPORTED, /* GetGPRSAccessPoint*/ 136 NOTSUPPORTED, /* GetGPRSAccessPoint*/
diff --git a/gammu/emb/common/phone/nokia/nfunc.c b/gammu/emb/common/phone/nokia/nfunc.c
index 3acfb10..d4d8b03 100644
--- a/gammu/emb/common/phone/nokia/nfunc.c
+++ b/gammu/emb/common/phone/nokia/nfunc.c
@@ -1384,53 +1384,67 @@ GSM_Error N71_65_ReplyCallInfo(GSM_Protocol_Message msg, GSM_StateMachine *s)
1384 smprintf(s, "Call is being released\n"); 1384 smprintf(s, "Call is being released\n");
1385 break; 1385 break;
1386 case 0x0b: 1386 case 0x0b:
1387 smprintf(s, "Meaning not known\n"); 1387 smprintf(s, "Meaning not known\n");
1388 call.CallIDAvailable = false; 1388 call.CallIDAvailable = false;
1389 break; 1389 break;
1390 case 0x0c: 1390 case 0x0c:
1391 smprintf(s, "Audio status\n"); 1391 smprintf(s, "Audio status\n");
1392 if (msg.Buffer[4] == 0x01) smprintf(s, "Audio enabled\n"); 1392 if (msg.Buffer[4] == 0x01) smprintf(s, "Audio enabled\n");
1393 else smprintf(s, "Audio disabled\n"); 1393 else smprintf(s, "Audio disabled\n");
1394 call.CallIDAvailable = false; 1394 call.CallIDAvailable = false;
1395 break; 1395 break;
1396 case 0x0f:
1397 case 0x10:
1398 smprintf(s, "Meaning not known\n");
1399 call.CallIDAvailable = false;
1400 break;
1396 case 0x23: 1401 case 0x23:
1397 smprintf(s, "Call held\n"); 1402 smprintf(s, "Call held\n");
1398 call.Status = GSM_CALL_CallHeld; 1403 call.Status = GSM_CALL_CallHeld;
1399 break; 1404 break;
1400 case 0x25: 1405 case 0x25:
1401 smprintf(s, "Call resumed\n"); 1406 smprintf(s, "Call resumed\n");
1402 call.Status = GSM_CALL_CallResumed; 1407 call.Status = GSM_CALL_CallResumed;
1403 break; 1408 break;
1404 case 0x27: 1409 case 0x27:
1405 smprintf(s, "Call switched\n"); 1410 smprintf(s, "Call switched\n");
1406 call.Status = GSM_CALL_CallSwitched; 1411 call.Status = GSM_CALL_CallSwitched;
1407 break; 1412 break;
1408 case 0x53: 1413 case 0x53:
1409 smprintf(s, "Outgoing call\n"); 1414 smprintf(s, "Outgoing call\n");
1410 smprintf(s, "Call mode : %i\n",msg.Buffer[5]);//such interpretation is in gnokii 1415 smprintf(s, "Call mode : %i\n",msg.Buffer[5]);//such interpretation is in gnokii
1411 tmp = 6; 1416 tmp = 6;
1412 NOKIA_GetUnicodeString(s, &tmp, msg.Buffer,buffer,false); 1417 NOKIA_GetUnicodeString(s, &tmp, msg.Buffer,buffer,false);
1413 smprintf(s, "Number : \"%s\"\n",DecodeUnicodeString(buffer)); 1418 smprintf(s, "Number : \"%s\"\n",DecodeUnicodeString(buffer));
1414 /* FIXME: read name from frame */ 1419 /* FIXME: read name from frame */
1415 call.Status = GSM_CALL_OutgoingCall; 1420 call.Status = GSM_CALL_OutgoingCall;
1416 tmp = 6; 1421 tmp = 6;
1417 NOKIA_GetUnicodeString(s, &tmp, msg.Buffer,call.PhoneNumber,false); 1422 NOKIA_GetUnicodeString(s, &tmp, msg.Buffer,call.PhoneNumber,false);
1418 break; 1423 break;
1424 case 0xA6:
1425 case 0xD2:
1426 case 0xD3:
1427 smprintf(s, "Meaning not known\n");
1428 call.CallIDAvailable = false;
1429 break;
1419 } 1430 }
1420 if (call.CallIDAvailable) smprintf(s, "Call ID : %d\n",msg.Buffer[4]); 1431 if (call.CallIDAvailable) smprintf(s, "Call ID : %d\n",msg.Buffer[4]);
1421 if (s->Phone.Data.EnableIncomingCall && s->User.IncomingCall!=NULL && call.Status != 0) { 1432 if (s->Phone.Data.EnableIncomingCall && s->User.IncomingCall!=NULL && call.Status != 0) {
1422 if (call.CallIDAvailable) call.CallID = msg.Buffer[4]; 1433 if (call.CallIDAvailable) call.CallID = msg.Buffer[4];
1423 s->User.IncomingCall(s->CurrentConfig->Device, call); 1434 s->User.IncomingCall(s->CurrentConfig->Device, call);
1424 } 1435 }
1436 if (s->Phone.Data.RequestID == ID_DialVoice) {
1437 if (msg.Buffer[3] == 0x10) return ERR_NOTSUPPORTED;
1438 }
1425 if (s->Phone.Data.RequestID == ID_CancelCall) { 1439 if (s->Phone.Data.RequestID == ID_CancelCall) {
1426 if (msg.Buffer[3] == 0x09) { 1440 if (msg.Buffer[3] == 0x09) {
1427 if (s->Phone.Data.CallID == msg.Buffer[4]) return ERR_NONE; 1441 if (s->Phone.Data.CallID == msg.Buffer[4]) return ERR_NONE;
1428 /* when we canceled call and see frame about other 1442 /* when we canceled call and see frame about other
1429 * call releasing, we don't give ERR_NONE for "our" 1443 * call releasing, we don't give ERR_NONE for "our"
1430 * call release command 1444 * call release command
1431 */ 1445 */
1432 return ERR_NEEDANOTHERANSWER; 1446 return ERR_NEEDANOTHERANSWER;
1433 } 1447 }
1434 } 1448 }
1435 if (s->Phone.Data.RequestID == ID_AnswerCall) { 1449 if (s->Phone.Data.RequestID == ID_AnswerCall) {
1436 if (msg.Buffer[3] == 0x07) { 1450 if (msg.Buffer[3] == 0x07) {