summaryrefslogtreecommitdiffabout
path: root/gammu/emb/common/phone/nokia/dct4/n6510.c
Unidiff
Diffstat (limited to 'gammu/emb/common/phone/nokia/dct4/n6510.c') (more/less context) (ignore whitespace changes)
-rw-r--r--gammu/emb/common/phone/nokia/dct4/n6510.c168
1 files changed, 125 insertions, 43 deletions
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,