summaryrefslogtreecommitdiffabout
path: root/gammu/emb/common/phone/nokia
Side-by-side diff
Diffstat (limited to 'gammu/emb/common/phone/nokia') (more/less context) (show whitespace changes)
-rw-r--r--gammu/emb/common/phone/nokia/dct3/dct3func.c12
-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.c166
-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, 176 insertions, 57 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,99 +1,102 @@
/* (c) 2001-2004 by Marcin Wiacek */
-/* based on some work from Markus Plail, Pavel Janik, others and Gnokii */
/* resetting DCT4 phones settings (c) by Walek */
+/* based on some Markus Plail, Pavel Janik & others work from Gnokii (www.gnokii.org)
+ * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
+ * GNU GPL version 2 or later
+ */
#include <string.h> /* memcpy only */
#include <stdio.h>
#include <ctype.h>
#include "../../../gsmstate.h"
#include "../../../misc/coding/coding.h"
#include "../../../service/sms/gsmsms.h"
#include "../../pfunc.h"
#include "../nfunc.h"
#include "dct3func.h"
#ifdef GSM_ENABLE_NOKIA_DCT3
GSM_Error DCT3_DeleteWAPBookmark(GSM_StateMachine *s, GSM_WAPBookmark *bookmark)
{
GSM_Error error;
/* We have to enable WAP frames in phone */
error=DCT3DCT4_EnableWAPFunctions(s);
if (error!=ERR_NONE) return error;
return DCT3DCT4_DeleteWAPBookmarkPart(s,bookmark);
}
GSM_Error DCT3_GetWAPBookmark(GSM_StateMachine *s, GSM_WAPBookmark *bookmark)
{
GSM_Error error;
/* We have to enable WAP frames in phone */
error=DCT3DCT4_EnableWAPFunctions(s);
if (error!=ERR_NONE) return error;
return DCT3DCT4_GetWAPBookmarkPart(s,bookmark);
}
GSM_Error DCT3_ReplyPressKey(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
GSM_Phone_Data *Data = &s->Phone.Data;
switch (msg.Buffer[2]) {
case 0x46:
smprintf(s, "Pressing key OK\n");
if (Data->PressKey) return ERR_NONE;
break;
case 0x47:
smprintf(s, "Releasing key OK\n");
if (!Data->PressKey) return ERR_NONE;
break;
}
return ERR_UNKNOWNRESPONSE;
}
GSM_Error DCT3_PressKey(GSM_StateMachine *s, GSM_KeyCode Key, bool Press)
{
unsigned char PressReq[] = {0x00, 0x01, 0x46, 0x00, 0x01,
0x0a}; /* Key code */
unsigned char ReleaseReq[] = {0x00, 0x01, 0x47, 0x00, 0x01, 0x0c};
if (Press) {
PressReq[5] = Key;
s->Phone.Data.PressKey = true;
smprintf(s, "Pressing key\n");
return GSM_WaitFor (s, PressReq, 6, 0xd1, 4, ID_PressKey);
} else {
s->Phone.Data.PressKey = false;
smprintf(s, "Releasing key\n");
return GSM_WaitFor (s, ReleaseReq, 6, 0xd1, 4, ID_PressKey);
}
}
GSM_Error DCT3_ReplyPlayTone(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
smprintf(s, "Tone played\n");
return ERR_NONE;
}
GSM_Error DCT3_PlayTone(GSM_StateMachine *s, int Herz, unsigned char Volume, bool start)
{
GSM_Error error;
unsigned char req[] = {0x00,0x01,0x8f,
0x00, /* Volume */
0x00, /* HerzLo */
0x00}; /* HerzHi */
if (start) {
error=DCT3_EnableSecurity (s, 0x01);
if (error!=ERR_NONE) return error;
}
/* For Herz==255*255 we have silent */
if (Herz!=255*255) {
req[3]=Volume;
req[5]=Herz%256;
req[4]=Herz/256;
} else {
@@ -301,259 +304,260 @@ GSM_Error DCT3_ReplyGetAlarm(GSM_Protocol_Message msg, GSM_StateMachine *s)
if (msg.Buffer[8]==0x02) {
smprintf(s, "set to %02i:%02i\n", msg.Buffer[9], msg.Buffer[10]);
Data->Alarm->Repeating = true;
Data->Alarm->Text[0] = 0;
Data->Alarm->Text[1] = 0;
Data->Alarm->DateTime.Hour = msg.Buffer[9];
Data->Alarm->DateTime.Minute = msg.Buffer[10];
Data->Alarm->DateTime.Second = 0;
return ERR_NONE;
}
smprintf(s, "not set\n");
return ERR_EMPTY;
}
GSM_Error DCT3_GetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm, unsigned char msgtype)
{
unsigned char req[] = {N6110_FRAME_HEADER, 0x6d};
if (alarm->Location!=1) return ERR_NOTSUPPORTED;
s->Phone.Data.Alarm=alarm;
smprintf(s, "Getting alarm\n");
return GSM_WaitFor (s, req, 4, msgtype, 4, ID_GetAlarm);
}
GSM_Error DCT3_ReplySetDateTime(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
smprintf(s, "Date & time: ");
if (msg.Buffer[4]==0x01) {
smprintf(s, "set OK\n");
return ERR_NONE;
}
smprintf(s, "error setting\n");
return ERR_UNKNOWN;
}
GSM_Error DCT3_SetDateTime(GSM_StateMachine *s, GSM_DateTime *date_time, unsigned char msgtype)
{
unsigned char req[] = {N6110_FRAME_HEADER, 0x60, 0x01, 0x01, 0x07,
0x00, 0x00, /* Year */
0x00, /* Month */
0x00, /* Day */
0x00, /* Hour */
0x00, /* Minute */
0x00}; /* Unknown. Not seconds */
NOKIA_EncodeDateTime(s, req+7, date_time);
smprintf(s, "Setting date & time\n");
return GSM_WaitFor (s, req, 14, msgtype, 4, ID_SetDateTime);
}
GSM_Error DCT3_ReplySetAlarm(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
smprintf(s, "Alarm: ");
if (msg.Buffer[4]==0x01) {
smprintf(s, "set OK\n");
return ERR_NONE;
}
smprintf(s, "error setting\n");
return ERR_UNKNOWN;
}
GSM_Error DCT3_SetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm, unsigned char msgtype)
{
unsigned char req[] = {N6110_FRAME_HEADER, 0x6b, 0x01, 0x20, 0x03,
0x02, /* Unknown. Not for enabling/disabling */
0x00, /* Hour */
0x00, /* Minute */
0x00}; /* Unknown. Not seconds */
if (alarm->Location != 1) return ERR_NOTSUPPORTED;
req[8] = alarm->DateTime.Hour;
req[9] = alarm->DateTime.Minute;
smprintf(s, "Setting alarm\n");
return GSM_WaitFor (s, req, 11, msgtype, 4, ID_SetAlarm);
}
GSM_Error DCT3_ReplyGetSMSC(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
int i;
GSM_Phone_Data *Data = &s->Phone.Data;
switch (msg.Buffer[3]) {
case 0x34:
smprintf(s, "SMSC received\n");
Data->SMSC->Format = SMS_FORMAT_Text;
switch (msg.Buffer[6]) {
case 0x00: Data->SMSC->Format = SMS_FORMAT_Text; break;
case 0x22: Data->SMSC->Format = SMS_FORMAT_Fax; break;
case 0x26: Data->SMSC->Format = SMS_FORMAT_Pager; break;
case 0x32: Data->SMSC->Format = SMS_FORMAT_Email; break;
}
Data->SMSC->Validity.Format = SMS_Validity_RelativeFormat;
Data->SMSC->Validity.Relative = msg.Buffer[8];
+ if (msg.Buffer[8] == 0x00) Data->SMSC->Validity.Relative = SMS_VALID_Max_Time;
i=33;
while (msg.Buffer[i]!=0) {i++;}
i=i-33;
if (i>GSM_MAX_SMSC_NAME_LENGTH) {
smprintf(s, "Too long name\n");
return ERR_UNKNOWNRESPONSE;
}
EncodeUnicode(Data->SMSC->Name,msg.Buffer+33,i);
smprintf(s, "Name \"%s\"\n", DecodeUnicodeString(Data->SMSC->Name));
GSM_UnpackSemiOctetNumber(Data->SMSC->DefaultNumber,msg.Buffer+9,true);
smprintf(s, "Default number \"%s\"\n", DecodeUnicodeString(Data->SMSC->DefaultNumber));
GSM_UnpackSemiOctetNumber(Data->SMSC->Number,msg.Buffer+21,false);
smprintf(s, "Number \"%s\"\n", DecodeUnicodeString(Data->SMSC->Number));
return ERR_NONE;
case 0x35:
smprintf(s, "Getting SMSC failed\n");
return ERR_INVALIDLOCATION;
}
return ERR_UNKNOWNRESPONSE;
}
GSM_Error DCT3_GetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc)
{
unsigned char req[] = {N6110_FRAME_HEADER, 0x33, 0x64,
0x00}; /* Location */
if (smsc->Location==0x00) return ERR_INVALIDLOCATION;
req[5]=smsc->Location;
s->Phone.Data.SMSC=smsc;
smprintf(s, "Getting SMSC\n");
return GSM_WaitFor (s, req, 6, 0x02, 4, ID_GetSMSC);
}
GSM_Error DCT3_ReplyGetNetworkInfo(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
int count;
GSM_Phone_Data *Data = &s->Phone.Data;
#ifdef DEBUG
GSM_NetworkInfo NetInfo;
char name[100];
smprintf(s, "Network info received\n");
smprintf(s, " Status : ");
switch (msg.Buffer[8]) {
case 0x01: smprintf(s, "home network"); break;
case 0x02: smprintf(s, "roaming network"); break;
case 0x03: smprintf(s, "requesting network"); break;
case 0x04: smprintf(s, "not registered in the network"); break;
default : smprintf(s, "unknown");
}
smprintf(s, "\n");
smprintf(s, "Network selection : %s\n", msg.Buffer[9]==1?"manual":"automatic");
if (msg.Buffer[8]<0x03) {
sprintf(NetInfo.CID, "%02x%02x", msg.Buffer[10], msg.Buffer[11]);
smprintf(s, "CID : %s\n", NetInfo.CID);
sprintf(NetInfo.LAC, "%02x%02x", msg.Buffer[12], msg.Buffer[13]);
smprintf(s, "LAC : %s\n", NetInfo.LAC);
- smprintf(s, "Network code : %s\n", NetInfo.NetworkCode);
NOKIA_DecodeNetworkCode(msg.Buffer+14,NetInfo.NetworkCode);
+ smprintf(s, "Network code : %s\n", NetInfo.NetworkCode);
smprintf(s, "Network name for Gammu : %s ",
DecodeUnicodeString(GSM_GetNetworkName(NetInfo.NetworkCode)));
smprintf(s, "(%s)\n",DecodeUnicodeString(GSM_GetCountryName(NetInfo.NetworkCode)));
if (msg.Length>18) {
if (msg.Buffer[18]==0x00) {
/* In 6210 name is in "normal" Unicode */
memcpy(name,msg.Buffer+18,msg.Buffer[17]*2);
name[msg.Buffer[17]*2] =0x00;
name[msg.Buffer[17]*2+1]=0x00;
smprintf(s, "Network name for phone : %s\n",DecodeUnicodeString(name));
} else {
/* In 9210 first 0x00 is cut from Unicode string */
name[0] = 0;
memcpy(name+1,msg.Buffer+18,msg.Buffer[17]*2);
name[msg.Buffer[17]*2+1]=0x00;
name[msg.Buffer[17]*2+2]=0x00;
smprintf(s, "Network name for phone : %s\n",DecodeUnicodeString(name));
}
}
}
#endif
if (Data->RequestID==ID_GetNetworkInfo) {
Data->NetworkInfo->NetworkName[0] = 0x00;
Data->NetworkInfo->NetworkName[1] = 0x00;
Data->NetworkInfo->State = 0;
switch (msg.Buffer[8]) {
case 0x01: Data->NetworkInfo->State = GSM_HomeNetwork; break;
case 0x02: Data->NetworkInfo->State = GSM_RoamingNetwork; break;
case 0x03: Data->NetworkInfo->State = GSM_RequestingNetwork; break;
case 0x04: Data->NetworkInfo->State = GSM_NoNetwork; break;
}
if (Data->NetworkInfo->State == GSM_HomeNetwork || Data->NetworkInfo->State == GSM_RoamingNetwork) {
if (msg.Buffer[18]==0x00) {
/* In 6210 name is in "normal" Unicode */
memcpy(Data->NetworkInfo->NetworkName,msg.Buffer+18,msg.Buffer[17]*2);
Data->NetworkInfo->NetworkName[msg.Buffer[17]*2] = 0x00;
Data->NetworkInfo->NetworkName[msg.Buffer[17]*2+1] = 0x00;
} else {
/* In 9210 first 0x00 is cut from Unicode string */
Data->NetworkInfo->NetworkName[0] = 0;
memcpy(Data->NetworkInfo->NetworkName+1,msg.Buffer+18,msg.Buffer[17]*2);
Data->NetworkInfo->NetworkName[msg.Buffer[17]*2+1]=0x00;
Data->NetworkInfo->NetworkName[msg.Buffer[17]*2+2]=0x00;
}
NOKIA_DecodeNetworkCode(msg.Buffer+14,Data->NetworkInfo->NetworkCode);
sprintf(Data->NetworkInfo->CID, "%02x%02x", msg.Buffer[10], msg.Buffer[11]);
sprintf(Data->NetworkInfo->LAC, "%02x%02x", msg.Buffer[12], msg.Buffer[13]);
}
}
/* 6210/6250/7110 */
if (Data->RequestID==ID_GetBitmap) {
if (msg.Buffer[4]==0x02) {
smprintf(s, "Operator logo available\n");
count = 7;
/* skip network info */
count += msg.Buffer[count];
count ++;
Data->Bitmap->BitmapWidth = msg.Buffer[count++];
Data->Bitmap->BitmapHeight = msg.Buffer[count++];
count+=4;
PHONE_DecodeBitmap(GSM_Nokia7110OperatorLogo,msg.Buffer+count,Data->Bitmap);
NOKIA_DecodeNetworkCode(msg.Buffer+14,Data->Bitmap->NetworkCode);
} else {
Data->Bitmap->BitmapWidth = 78;
Data->Bitmap->BitmapHeight = 21;
GSM_ClearBitmap(Data->Bitmap);
strcpy(Data->Bitmap->NetworkCode,"000 00");
}
}
return ERR_NONE;
}
GSM_Error DCT3_GetNetworkInfo(GSM_StateMachine *s, GSM_NetworkInfo *netinfo)
{
unsigned char req[] = {N6110_FRAME_HEADER, 0x70};
s->Phone.Data.NetworkInfo=netinfo;
smprintf(s, "Getting network info\n");
return GSM_WaitFor (s, req, 4, 0x0a, 4, ID_GetNetworkInfo);
}
GSM_Error DCT3_ReplyDialCommand(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
smprintf(s, "Answer for call commands\n");
return ERR_NONE;
}
GSM_Error DCT3_DialVoice(GSM_StateMachine *s, char *number, GSM_CallShowNumber ShowNumber)
{
unsigned int i = 0;
GSM_Error error;
unsigned char req[100] = {0x00, 0x01, 0x7c,
0x01}; /* call command */
if (ShowNumber != GSM_CALL_DefaultNumberPresence) return ERR_NOTSUPPORTED;
@@ -1115,197 +1119,197 @@ GSM_Error DCT3_SetWAPSettings(GSM_StateMachine *s, GSM_MultiWAPSettings *setting
/* Data */
if (phone1 != -1) {
pos = 4;
memset(SetReq2 + pos, 0, 200 - pos);
SetReq2[pos++] = phone1;
SetReq2[pos++] = 0x02;
SetReq2[pos++] = 0x01; /* GSMdata */
if (loc1 != -1) {
if (!settings->Settings[loc1].IsNormalAuthentication) SetReq2[pos] = 0x01;
}
pos++;
if (loc1 != -1) {
if (settings->Settings[loc1].IsISDNCall) SetReq2[pos] = 0x01;
}
pos++;
if (loc1 != -1) {
switch (settings->Settings[loc1].Speed) {
case WAPSETTINGS_SPEED_9600 : SetReq2[pos++] = 0x01; break;
case WAPSETTINGS_SPEED_14400 : SetReq2[pos++] = 0x02; break;
default : SetReq2[pos++] = 0x02; break;
}
switch (settings->Settings[loc1].Speed) {
case WAPSETTINGS_SPEED_9600 : SetReq2[pos++] = 0x01; break;
case WAPSETTINGS_SPEED_14400 : SetReq2[pos++] = 0x02; break;
default : SetReq2[pos++] = 0x02; break;
}
} else pos+=2;
if (loc1 != -1) {
/* IP */
pos += NOKIA_SetUnicodeString(s, SetReq2 + pos, settings->Settings[loc1].IPAddress, false);
/* Number */
pos += NOKIA_SetUnicodeString(s, SetReq2 + pos, settings->Settings[loc1].DialUp, false);
/* Username */
pos += NOKIA_SetUnicodeString(s, SetReq2 + pos, settings->Settings[loc1].User, false);
/* Password */
pos += NOKIA_SetUnicodeString(s, SetReq2 + pos, settings->Settings[loc1].Password, false);
} else pos+=5;
memcpy(SetReq2 + pos, "\x80\x00\x00\x00\x00\x00\x00\x00", 8);
pos += 8;
smprintf(s, "Writing WAP settings part 2 (Data bearer)\n");
error=GSM_WaitFor (s, SetReq2, pos, 0x3f, 4, ID_SetConnectSet);
if (error != ERR_NONE) return error;
}
/* SMS */
if (phone2 != -1) {
pos = 4;
memset(SetReq2 + pos, 0, 200 - pos);
SetReq2[pos++] = phone2;
SetReq2[pos++] = 0x02;
SetReq2[pos++] = 0x00; /* SMS */
if (loc2 != -1) {
/* Service number */
pos += NOKIA_SetUnicodeString(s, SetReq2 + pos, settings->Settings[loc2].Service, false);
/* Server number */
pos += NOKIA_SetUnicodeString(s, SetReq2 + pos, settings->Settings[loc2].Server, false);
} else pos += 2;
memcpy(SetReq2 + pos, "\x80\x00\x00\x00\x00\x00\x00\x00", 8);
pos += 8;
smprintf(s, "Writing WAP settings part 2 (SMS bearer)\n");
error=GSM_WaitFor (s, SetReq2, pos, 0x3f, 4, ID_SetConnectSet);
if (error != ERR_NONE) return error;
}
/* USSD */
if (phone3 != -1) {
pos = 4;
memset(SetReq2 + pos, 0, 200 - pos);
SetReq2[pos++] = phone3;
SetReq2[pos++] = 0x02;
SetReq2[pos++] = 0x02; /* USSD */
if (loc3 != -1) {
if (!settings->Settings[loc3].IsIP) SetReq2[pos] = 0x01;
}
pos++;
if (loc3 != -1) {
/* Service number or IP address */
pos += NOKIA_SetUnicodeString(s, SetReq2 + pos, settings->Settings[loc3].Service, false);
/* Code number */
pos += NOKIA_SetUnicodeString(s, SetReq2 + pos, settings->Settings[loc3].Code, false);
} else pos+=2;
memcpy(SetReq2 + pos, "\x80\x00\x00\x00\x00\x00\x00\x00", 8);
pos += 8;
smprintf(s, "Writing WAP settings part 2 (USSD bearer)\n");
error=GSM_WaitFor (s, SetReq2, pos, 0x3f, 4, ID_SetConnectSet);
if (error != ERR_NONE) return error;
}
error = DCT3DCT4_SetActiveConnectSet(s, settings);
if (error != ERR_NONE) return error;
return DCT3DCT4_DisableConnectionFunctions(s);
}
GSM_Error DCT3_ReplySendSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
switch (msg.Buffer[3]) {
case 0x02:
smprintf(s, "SMS sent OK\n");
- if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,0,0);
+ if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,0,msg.Buffer[5]);
return ERR_NONE;
case 0x03:
smprintf(s, "Error %i\n",msg.Buffer[6]);
- if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,msg.Buffer[6],0);
+ if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,msg.Buffer[6],-1);
return ERR_NONE;
}
return ERR_UNKNOWNRESPONSE;
}
GSM_Error DCT3_SendSMSMessage(GSM_StateMachine *s, GSM_SMSMessage *sms)
{
int length;
GSM_Error error;
unsigned char req[256] = {N6110_FRAME_HEADER, 0x01, 0x02, 0x00};
error=PHONE_EncodeSMSFrame(s,sms,req+6,PHONE_SMSSubmit,&length, true);
if (error != ERR_NONE) return error;
smprintf(s, "Sending sms\n");
return s->Protocol.Functions->WriteMessage(s, req, 6+length, 0x02);
}
GSM_Error DCT3_ReplyNetmonitor(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
switch (msg.Buffer[3]) {
case 0x00:
smprintf(s, "Netmonitor correctly set\n");
break;
default:
smprintf(s, "Menu %i\n",msg.Buffer[3]);
smprintf(s, "%s\n",msg.Buffer+4);
strcpy(s->Phone.Data.Netmonitor,msg.Buffer+4);
break;
}
return ERR_NONE;
}
GSM_Error DCT3_Netmonitor(GSM_StateMachine *s, int testnumber, char *value)
{
GSM_Error error;
unsigned char req[] = {0x00, 0x01, 0x7e,
0x00}; /* Test number */
value[0] = 0;
error=DCT3_EnableSecurity (s, 0x01);
if (error != ERR_NONE) return error;
req[3] = testnumber;
smprintf(s, "Getting netmonitor test\n");
s->Phone.Data.Netmonitor = value;
return GSM_WaitFor (s, req, 4, 0x40, 4, ID_Netmonitor);
}
GSM_Error DCT3_GetManufactureMonth(GSM_StateMachine *s, char *value)
{
GSM_Error error;
error=DCT3_EnableSecurity (s, 0x01);
if (error != ERR_NONE) return error;
return NOKIA_GetPhoneString(s,"\x00\x01\xCC\x02",4,0x40,value,ID_GetManufactureMonth,5);
}
GSM_Error DCT3_GetProductCode(GSM_StateMachine *s, char *value)
{
GSM_Error error;
if (strlen(s->Phone.Data.ProductCodeCache)!=0) {
strcpy(value,s->Phone.Data.ProductCodeCache);
return ERR_NONE;
}
error=DCT3_EnableSecurity (s, 0x01);
if (error != ERR_NONE) return error;
return NOKIA_GetPhoneString(s,"\x00\x01\xCA\x01",4,0x40,value,ID_GetProductCode,5);
}
GSM_Error DCT3_GetOriginalIMEI(GSM_StateMachine *s, char *value)
{
GSM_Error error;
error=DCT3_EnableSecurity (s, 0x01);
if (error != ERR_NONE) return error;
return NOKIA_GetPhoneString(s,"\x00\x01\xCC\x01",4,0x40,value,ID_GetOriginalIMEI,5);
}
GSM_Error DCT3_GetHardware(GSM_StateMachine *s, char *value)
{
GSM_Error error;
if (strlen(s->Phone.Data.HardwareCache)!=0) {
strcpy(value,s->Phone.Data.HardwareCache);
return ERR_NONE;
}
error=DCT3_EnableSecurity (s, 0x01);
if (error != ERR_NONE) return error;
return NOKIA_GetPhoneString(s,"\x00\x01\xC8\x05",4,0x40,value,ID_GetHardware,5);
}
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,78 +1,80 @@
/* (c) 2002-2003 by Marcin Wiacek */
#ifndef phone_nokia_dct3_h
#define phone_nokia_dct3_h
+#include "../ncommon.h"
+
GSM_Error DCT3_ReplyPressKey (GSM_Protocol_Message msg, GSM_StateMachine *s);
GSM_Error DCT3_ReplyPlayTone (GSM_Protocol_Message msg, GSM_StateMachine *s);
GSM_Error DCT3_ReplyEnableSecurity (GSM_Protocol_Message msg, GSM_StateMachine *s);
GSM_Error DCT3_ReplyGetIMEI (GSM_Protocol_Message msg, GSM_StateMachine *s);
GSM_Error DCT3_ReplyGetSMSC (GSM_Protocol_Message msg, GSM_StateMachine *s);
GSM_Error DCT3_ReplySIMLogin (GSM_Protocol_Message msg, GSM_StateMachine *s);
GSM_Error DCT3_ReplySIMLogout (GSM_Protocol_Message msg, GSM_StateMachine *s);
GSM_Error DCT3_ReplyGetDateTime (GSM_Protocol_Message msg, GSM_StateMachine *s);
GSM_Error DCT3_ReplyGetAlarm (GSM_Protocol_Message msg, GSM_StateMachine *s);
GSM_Error DCT3_ReplySetDateTime (GSM_Protocol_Message msg, GSM_StateMachine *s);
GSM_Error DCT3_ReplySetAlarm (GSM_Protocol_Message msg, GSM_StateMachine *s);
GSM_Error DCT3_ReplyDialCommand (GSM_Protocol_Message msg, GSM_StateMachine *s);
GSM_Error DCT3_ReplyGetWAPBookmark (GSM_Protocol_Message msg, GSM_StateMachine *s);
GSM_Error DCT3_ReplyGetNetworkInfo (GSM_Protocol_Message msg, GSM_StateMachine *s);
GSM_Error DCT3_ReplySendSMSMessage (GSM_Protocol_Message msg, GSM_StateMachine *s);
GSM_Error DCT3_ReplySetSMSC (GSM_Protocol_Message msg, GSM_StateMachine *s);
GSM_Error DCT3_ReplyGetWAPSettings (GSM_Protocol_Message msg, GSM_StateMachine *s);
GSM_Error DCT3_ReplySetWAPSettings (GSM_Protocol_Message msg, GSM_StateMachine *s);
GSM_Error DCT3_ReplyNetmonitor (GSM_Protocol_Message msg, GSM_StateMachine *s);
GSM_Error DCT3_ReplyDeleteSMSMessage (GSM_Protocol_Message msg, GSM_StateMachine *s);
GSM_Error N71_92_ReplyGetSignalQuality (GSM_Protocol_Message msg, GSM_StateMachine *s);
GSM_Error N71_92_ReplyGetBatteryCharge (GSM_Protocol_Message msg, GSM_StateMachine *s);
GSM_Error N71_92_ReplyPhoneSetting (GSM_Protocol_Message msg, GSM_StateMachine *s);
GSM_Error N61_71_ReplyResetPhoneSettings(GSM_Protocol_Message msg, GSM_StateMachine *s);
GSM_Error N61_91_ReplySetOpLogo (GSM_Protocol_Message msg, GSM_StateMachine *s);
#ifdef GSM_ENABLE_CELLBROADCAST
GSM_Error DCT3_ReplySetIncomingCB (GSM_Protocol_Message msg, GSM_StateMachine *s);
GSM_Error DCT3_ReplyIncomingCB (GSM_Protocol_Message msg, GSM_StateMachine *s);
#endif
GSM_Error DCT3_DeleteWAPBookmark (GSM_StateMachine *s, GSM_WAPBookmark *bookmark);
GSM_Error DCT3_GetWAPBookmark (GSM_StateMachine *s, GSM_WAPBookmark *bookmark);
GSM_Error DCT3_PressKey (GSM_StateMachine *s, GSM_KeyCode Key, bool Press);
GSM_Error DCT3_PlayTone (GSM_StateMachine *s, int Herz, unsigned char Volume, bool start);
GSM_Error DCT3_EnableSecurity (GSM_StateMachine *s, unsigned char status );
GSM_Error DCT3_GetIMEI (GSM_StateMachine *s);
GSM_Error DCT3_GetSMSC (GSM_StateMachine *s, GSM_SMSC *smsc );
GSM_Error DCT3_GetNetworkInfo (GSM_StateMachine *s, GSM_NetworkInfo *netinfo );
GSM_Error DCT3_DialVoice (GSM_StateMachine *s, char *number, GSM_CallShowNumber ShowNumber);
GSM_Error DCT3_Reset (GSM_StateMachine *s, bool hard );
GSM_Error DCT3_CancelCall (GSM_StateMachine *s, int ID, bool all);
GSM_Error DCT3_AnswerAllCalls (GSM_StateMachine *s);
GSM_Error DCT3_SendSMSMessage (GSM_StateMachine *s, GSM_SMSMessage *sms );
GSM_Error DCT3_GetAlarm (GSM_StateMachine *s, GSM_Alarm *alarm, unsigned char msgtype);
GSM_Error DCT3_GetDateTime (GSM_StateMachine *s, GSM_DateTime *date_time, unsigned char msgtype );
GSM_Error DCT3_SetAlarm (GSM_StateMachine *s, GSM_Alarm *alarm, unsigned char msgtype);
GSM_Error DCT3_SetDateTime (GSM_StateMachine *s, GSM_DateTime *date_time, unsigned char msgtype );
GSM_Error DCT3_SetIncomingCB (GSM_StateMachine *s, bool enable );
GSM_Error DCT3_GetSMSStatus (GSM_StateMachine *s, GSM_SMSMemoryStatus *status );
GSM_Error DCT3_SetSMSC (GSM_StateMachine *s, GSM_SMSC *smsc );
GSM_Error DCT3_GetWAPSettings (GSM_StateMachine *s, GSM_MultiWAPSettings *settings );
GSM_Error DCT3_SetWAPSettings (GSM_StateMachine *s, GSM_MultiWAPSettings *settings);
GSM_Error DCT3_SetWAPBookmark (GSM_StateMachine *s, GSM_WAPBookmark *bookmark);
GSM_Error DCT3_Netmonitor (GSM_StateMachine *s, int testnumber, char *value );
GSM_Error DCT3_GetManufactureMonth (GSM_StateMachine *s, char *value );
GSM_Error DCT3_GetProductCode (GSM_StateMachine *s, char *value);
GSM_Error DCT3_GetOriginalIMEI (GSM_StateMachine *s, char *value);
GSM_Error DCT3_GetHardware (GSM_StateMachine *s, char *value);
GSM_Error DCT3_GetPPM (GSM_StateMachine *s, char *value);
GSM_Error N61_71_ResetPhoneSettings (GSM_StateMachine *s, GSM_ResetSettingsType Type);
GSM_Error N71_92_GetBatteryCharge (GSM_StateMachine *s, GSM_BatteryCharge *bat);
GSM_Error N71_92_GetSignalQuality (GSM_StateMachine *s, GSM_SignalQuality *sig);
GSM_Error N71_92_GetPhoneSetting (GSM_StateMachine *s, int Request, int Setting);
GSM_Error N71_92_GetDateTime (GSM_StateMachine *s, GSM_DateTime *date_time );
GSM_Error N71_92_SetDateTime (GSM_StateMachine *s, GSM_DateTime *date_time );
GSM_Error DCT3_DecodeSMSFrame (GSM_StateMachine *s, GSM_SMSMessage *SMS, unsigned char *buffer);
#endif
/* How should editor hadle tabs in this file? Add editor commands here.
* vim: noexpandtab sw=8 ts=8 sts=8:
*/
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,225 +1,228 @@
/* (c) 2001-2004 by Marcin Wiacek */
-/* based on some work from Markus Plail and Gnokii */
-/* Authentication function (c) 1999 or earlier by Pavel Janik */
/* 5210 calendar IDs by Frederick Ros */
+/* based on some Markus Plail, Pavel Janik & others work from Gnokii (www.gnokii.org)
+ * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
+ * GNU GPL version 2 or later
+ */
#include "../../../gsmstate.h"
#ifdef GSM_ENABLE_NOKIA6110
#include <string.h>
#include "../../../../cfg/config.h"
#include "../../../misc/coding/coding.h"
#include "../../../service/sms/gsmsms.h"
#include "../../../gsmcomon.h"
#include "../../pfunc.h"
#include "../nfunc.h"
#include "n6110.h"
#include "dct3func.h"
static unsigned char N6110_MEMORY_TYPES[] = {
MEM_ME, 0x02,
MEM_SM, 0x03,
MEM_ON, 0x05,
MEM_DC, 0x07,
MEM_RC, 0x08,
MEM_MC, 0x09,
MEM_VM, 0x0b,
0x00, 0x00
};
static GSM_Error N6110_ReplyGetPhoneLanguage(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
N6110_Language lang = N6110_Auto;
if (msg.Buffer[3] == 0x15) return ERR_NONE;
smprintf(s, "Phone language is %02x\n",msg.Buffer[6]);
switch (msg.Buffer[6]) {
case 0x21: lang = N6110_Europe; break; //Polish
}
s->Phone.Data.Priv.N6110.PhoneLanguage = lang;
return ERR_NONE;
}
static GSM_Error N6110_GetPhoneLanguage(GSM_StateMachine *s)
{
unsigned char feat_req[] = {N6110_FRAME_HEADER, 0x13, 0x01,
0x00, /* Profile location */
0x00}; /* Feature number */
s->Phone.Data.Priv.N6110.PhoneLanguage = N6110_Auto;
feat_req[5] = 0;
if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_PROFILES33)) {
feat_req[6] = 0x1E;
} else {
feat_req[6] = 0x21;
}
smprintf(s, "Getting profile feature\n");
return GSM_WaitFor (s, feat_req, 7, 0x05, 4, ID_GetLanguage);
}
struct N6110_Lang_Char {
N6110_Language Lang;
unsigned char Phone;
unsigned char Unicode1;
unsigned char Unicode2;
};
static struct N6110_Lang_Char N6110_Lang_Table[] = {
{N6110_Europe,0x13,0x01,0x04},//Latin capital letter a with ogonek
{N6110_Europe,0x14,0x01,0x05},//Latin small letter a with ogonek
{N6110_Europe,0x15,0x01,0x06},//Latin capital letter c with acute
{N6110_Europe,0x17,0x01,0x07},//Latin small letter c with acute
{N6110_Europe,0x1D,0x01,0x18},//Latin capital letter e with ogonek
{N6110_Europe,0x1E,0x01,0x19},//Latin small letter e with ogonek
{N6110_Europe,0x83,0x00,0xD3},//Latin capital letter o with acute
{N6110_Europe,0x8E,0x01,0x41},//Latin capital letter l with stroke
{N6110_Europe,0x90,0x01,0x42},//Latin small letter l with stroke
{N6110_Europe,0x92,0x01,0x43},//Latin capital letter n with acute
{N6110_Europe,0x93,0x01,0x44},//Latin small letter n with acute
{N6110_Europe,0x9A,0x00,0xF3},//Latin small letter o with acute
{N6110_Europe,0xB2,0x20,0xAC},//euro
{N6110_Europe,0xB5,0x01,0x5A},//Latin capital letter s with acute
{N6110_Europe,0xB6,0x01,0x5B},//Latin small letter s with acute
{N6110_Europe,0xE7,0x01,0x79},//Latin capital letter z with acute
{N6110_Europe,0xEE,0x01,0x7A},//Latin small letter z with acute
{N6110_Europe,0xF4,0x01,0x7C},//Latin small letter z with dot above
{N6110_Europe,0xF0,0x01,0x7B},//Latin capital letter z with dot above
{0,0,0,0}
};
static void N6110_EncodeUnicode(GSM_StateMachine *s, unsigned char *dest, const unsigned char *src, int len)
{
int i_len = 0, o_len, i;
wchar_t wc;
GSM_Phone_N6110Data *Priv = &s->Phone.Data.Priv.N6110;
bool found;
for (o_len = 0; i_len < len; o_len++) {
found = false;
if (Priv->PhoneLanguage != N6110_Auto) {
i = 0;
while(1) {
if (N6110_Lang_Table[i].Lang == 0) break;
if (N6110_Lang_Table[i].Lang == Priv->PhoneLanguage &&
N6110_Lang_Table[i].Phone == src[i_len]) {
dest[o_len*2] = N6110_Lang_Table[i].Unicode1;
dest[(o_len*2)+1] = N6110_Lang_Table[i].Unicode2;
i_len++;
found = true;
break;
}
i++;
}
}
if (!found) {
i_len += EncodeWithUnicodeAlphabet(&src[i_len], &wc);
dest[o_len*2] = (wc >> 8) & 0xff;
dest[(o_len*2)+1] = wc & 0xff;
}
}
dest[o_len*2] = 0;
dest[(o_len*2)+1] = 0;
}
#ifndef ENABLE_LGPL
+/* Pavel Janik */
/* This function provides Nokia authentication protocol.
* Nokia authentication protocol is used in the communication between Nokia
* mobile phones (e.g. Nokia 6110) and Nokia Cellular Data Suite software,
* commercially sold by Nokia Corp.
* The authentication scheme is based on the token send by the phone to the
* software. The software does it's magic (see the function
* N6110_GetNokiaAuthentication) and returns the result back to the phone.
* If the result is correct the phone responds with the message "Accessory
* connected!" displayed on the LCD. Otherwise it will display "Accessory not
* supported" and some functions will not be available for use (?).
* The specification of the protocol is not publicly available, no comment.
*/
static void N6110_GetNokiaAuthentication(unsigned char *Imei, unsigned char *MagicBytes, unsigned char *MagicResponse)
{
int i, j, CRC=0;
unsigned char Temp[16]; /* This is our temporary working area. */
/* Here we put FAC (Final Assembly Code) and serial number into our area. */
Temp[0] = Imei[6]; Temp[1] = Imei[7];
Temp[2] = Imei[8]; Temp[3] = Imei[9];
Temp[4] = Imei[10]; Temp[5] = Imei[11];
Temp[6] = Imei[12]; Temp[7] = Imei[13];
/* And now the TAC (Type Approval Code). */
Temp[8] = Imei[2]; Temp[9] = Imei[3];
Temp[10] = Imei[4]; Temp[11] = Imei[5];
/* And now we pack magic bytes from the phone. */
Temp[12] = MagicBytes[0]; Temp[13] = MagicBytes[1];
Temp[14] = MagicBytes[2]; Temp[15] = MagicBytes[3];
for (i=0; i<=11; i++) if (Temp[i + 1]& 1) Temp[i]<<=1;
switch (Temp[15] & 0x03) {
case 1:
case 2: j = Temp[13] & 0x07;
for (i=0; i<=3; i++) Temp[i+j] ^= Temp[i+12];
break;
default: j = Temp[14] & 0x07;
for (i=0; i<=3; i++) Temp[i + j] |= Temp[i + 12];
}
for (i=0; i<=15; i++) CRC ^= Temp[i];
for (i=0; i<=15; i++) {
switch (Temp[15 - i] & 0x06) {
case 0: j = Temp[i] | CRC; break;
case 2:
case 4: j = Temp[i] ^ CRC; break;
case 6: j = Temp[i] & CRC; break;
}
if (j == CRC) j = 0x2c;
if (Temp[i] == 0) j = 0;
MagicResponse[i] = j;
}
}
static GSM_Error N6110_ReplyGetMagicBytes(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
GSM_Phone_N6110Data *Priv = &s->Phone.Data.Priv.N6110;
GSM_Phone_Data *Data = &s->Phone.Data;
sprintf(Data->IMEI, "%s", msg.Buffer+9);
sprintf(Data->HardwareCache, "%s", msg.Buffer+39);
sprintf(Data->ProductCodeCache, "%s", msg.Buffer+31);
smprintf(s, "Message: Mobile phone identification received:\n");
smprintf(s, "IMEI : %s\n", msg.Buffer+9);
smprintf(s, "Model : %s\n", msg.Buffer+25);
smprintf(s, "Production Code : %s\n", msg.Buffer+31);
smprintf(s, "HW : %s\n", msg.Buffer+39);
smprintf(s, "Firmware : %s\n", msg.Buffer+44);
/* These bytes are probably the source of the "Accessory not connected"
* messages on the phone when trying to emulate NCDS... I hope....
* UPDATE: of course, now we have the authentication algorithm.
*/
smprintf(s, " Magic bytes : %02x %02x %02x %02x\n", msg.Buffer[50], msg.Buffer[51], msg.Buffer[52], msg.Buffer[53]);
Priv->MagicBytes[0]=msg.Buffer[50];
Priv->MagicBytes[1]=msg.Buffer[51];
Priv->MagicBytes[2]=msg.Buffer[52];
Priv->MagicBytes[3]=msg.Buffer[53];
return ERR_NONE;
}
static GSM_Error N6110_MakeAuthentication(GSM_StateMachine *s)
{
GSM_Phone_N6110Data *Priv = &s->Phone.Data.Priv.N6110;
GSM_Error error;
unsigned char connect4[] = {N6110_FRAME_HEADER, 0x10};
unsigned char magic_connect[] = {
N6110_FRAME_HEADER, 0x12,
/* The real magic goes here ... These bytes are filled in
* with the function N6110_GetNokiaAuthentication. */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* NOKIA&GNOKII Accessory */
@@ -731,192 +734,193 @@ static GSM_Error N6110_SetSMS(GSM_StateMachine *s, GSM_SMSMessage *sms)
}
static GSM_Error N6110_AddSMS(GSM_StateMachine *s, GSM_SMSMessage *sms)
{
sms->Location = 0;
return N6110_PrivSetSMSMessage(s, sms);
}
static GSM_Error N6110_ReplySetRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
switch (msg.Buffer[3]) {
case 0x37:
smprintf(s, "Ringtone set OK\n");
return ERR_NONE;
break;
case 0x38:
smprintf(s, "Error setting ringtone\n");
switch (msg.Buffer[4]) {
case 0x7d:
smprintf(s, "Too high location ?\n");
return ERR_INVALIDLOCATION;
default:
smprintf(s, "ERROR: unknown %i\n",msg.Buffer[4]);
}
}
return ERR_UNKNOWNRESPONSE;
}
static GSM_Error N6110_ReplySetBinRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
switch (msg.Buffer[4]) {
case 0x00:
smprintf(s, "Set at location %i\n",msg.Buffer[3]+1);
return ERR_NONE;
default:
smprintf(s, "Invalid location. Too high ?\n");
return ERR_INVALIDLOCATION;
}
}
static GSM_Error N6110_SetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, int *maxlength)
{
GSM_NetworkInfo NetInfo;
GSM_Error error;
int size=200,current=8;
GSM_UDHHeader UDHHeader;
unsigned char req[1000] = {N6110_FRAME_HEADER, 0x36,
0x00, /* Location */
0x00,0x78};
unsigned char reqBin[1000] = {0x00,0x01,0xa0,0x00,0x00,0x0c,0x01,0x2c};
if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_NORING)) return ERR_NOTSUPPORTED;
if (Ringtone->Location == 0) return ERR_INVALIDLOCATION;
switch (Ringtone->Format) {
case RING_NOTETONE:
if (Ringtone->Location==255) {
/* Only 6110, 6130 and 6150 support it */
if (strcmp(s->Phone.Data.Model,"NSE-3") == 0 || strcmp(s->Phone.Data.Model,"NSK-3") == 0 ||
strcmp(s->Phone.Data.Model,"NSM-1") == 0) {
req[0] = 0x0c;
req[1] = 0x01;
UDHHeader.Type = UDH_NokiaRingtone;
GSM_EncodeUDHHeader(&UDHHeader);
/* We copy UDH now */
memcpy(req+2,UDHHeader.Text,UDHHeader.Length);
*maxlength=GSM_EncodeNokiaRTTLRingtone(*Ringtone, req+2+UDHHeader.Length, &size);
error = s->Protocol.Functions->WriteMessage(s, req, 2+UDHHeader.Length+size, 0x12);
if (error!=ERR_NONE) return error;
my_sleep(1000);
/* We have to make something (not important, what) now */
/* no answer from phone*/
return DCT3_GetNetworkInfo(s,&NetInfo);
} else {
return ERR_NOTSUPPORTED;
}
}
*maxlength=GSM_EncodeNokiaRTTLRingtone(*Ringtone, req+7, &size);
req[4] = Ringtone->Location - 1;
smprintf(s, "Setting ringtone\n");
return GSM_WaitFor (s, req, 7 + size, 0x05, 4, ID_SetRingtone);
case RING_NOKIABINARY:
error=DCT3_EnableSecurity (s, 0x01);
if (error!=ERR_NONE) return error;
memcpy(reqBin+current,DecodeUnicodeString(Ringtone->Name),UnicodeLength(Ringtone->Name));
current += UnicodeLength(Ringtone->Name);
reqBin[current++] = 0x00;
reqBin[current++] = 0x00;
reqBin[current++] = 0x00;/*xxx*/
memcpy(reqBin+current,Ringtone->NokiaBinary.Frame,Ringtone->NokiaBinary.Length);
current=current+Ringtone->NokiaBinary.Length;
reqBin[3]=Ringtone->Location-1;
if (!strcmp(s->Phone.Data.ModelInfo->model,"3210")) reqBin[5]=0x10;
smprintf(s, "Setting binary ringtone\n");
return GSM_WaitFor (s, reqBin, current, 0x40, 4, ID_SetRingtone);
case RING_MIDI:
+ case RING_MMF:
return ERR_NOTSUPPORTED;
}
return ERR_NOTSUPPORTED;
}
static GSM_Error N6110_ReplyGetOpLogo(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
int count=5;
GSM_Phone_Data *Data = &s->Phone.Data;
smprintf(s, "Operator logo received\n");
NOKIA_DecodeNetworkCode(msg.Buffer+count,Data->Bitmap->NetworkCode);
count = count + 3;
smprintf(s, "Network code : %s\n", Data->Bitmap->NetworkCode);
smprintf(s, "Network name for Gammu : %s ",
DecodeUnicodeString(GSM_GetNetworkName(Data->Bitmap->NetworkCode)));
smprintf(s, "(%s)\n",DecodeUnicodeString(GSM_GetCountryName(Data->Bitmap->NetworkCode)));
count = count + 3; /* We ignore size */
Data->Bitmap->BitmapWidth = msg.Buffer[count++];
Data->Bitmap->BitmapHeight = msg.Buffer[count++];
count++;
PHONE_DecodeBitmap(GSM_NokiaOperatorLogo,msg.Buffer+count,Data->Bitmap);
return ERR_NONE;
}
static GSM_Error N6110_ReplyGetStartup(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
int i, count = 5;
GSM_Phone_Data *Data = &s->Phone.Data;
smprintf(s, "Startup logo & notes received\n");
for (i=0;i<msg.Buffer[4];i++) {
switch (msg.Buffer[count++]) {
case 0x01:
smprintf(s, "Startup logo\n");
if (Data->Bitmap->Type == GSM_StartupLogo) {
Data->Bitmap->BitmapHeight = msg.Buffer[count++];
Data->Bitmap->BitmapWidth = msg.Buffer[count++];
PHONE_DecodeBitmap(GSM_NokiaStartupLogo, msg.Buffer + count, Data->Bitmap);
} else {
count = count + 2;
}
count = count + PHONE_GetBitmapSize(GSM_NokiaStartupLogo,0,0);
break;
case 0x02:
smprintf(s, "Welcome note\n");
if (Data->Bitmap->Type == GSM_WelcomeNote_Text) {
EncodeUnicode(Data->Bitmap->Text,msg.Buffer+count, msg.Buffer[count]);
smprintf(s, "Text is \"%s\"\n",Data->Bitmap->Text);
}
count = count + msg.Buffer[count] + 1;
break;
case 0x03:
smprintf(s, "Dealer welcome note\n");
if (Data->Bitmap->Type == GSM_DealerNote_Text) {
EncodeUnicode(Data->Bitmap->Text,msg.Buffer+count, msg.Buffer[count]);
smprintf(s, "Text is \"%s\"\n",Data->Bitmap->Text);
}
count = count + msg.Buffer[count] + 1;
break;
default:
smprintf(s, "Unknown block\n");
return ERR_UNKNOWNRESPONSE;
break;
}
}
return ERR_NONE;
}
static GSM_Error N6110_ReplyGetCallerLogo(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
int count;
GSM_Phone_Data *Data = &s->Phone.Data;
switch (msg.Buffer[3]) {
case 0x11:
smprintf(s, "Caller group info received\n");
EncodeUnicode(Data->Bitmap->Text,msg.Buffer+6,msg.Buffer[5]);
smprintf(s, "Name : \"%s\"\n",DecodeUnicodeString(Data->Bitmap->Text));
Data->Bitmap->DefaultName = false;
if (msg.Buffer[5] == 0x00) Data->Bitmap->DefaultName = true;
count = msg.Buffer[5] + 6;
Data->Bitmap->RingtoneID = msg.Buffer[count++];
Data->Bitmap->DefaultRingtone = false;
Data->Bitmap->FileSystemRingtone = false;
if (Data->Bitmap->RingtoneID == 16) Data->Bitmap->DefaultRingtone = true;
smprintf(s, "Ringtone ID: %02x\n",Data->Bitmap->RingtoneID);
Data->Bitmap->BitmapEnabled=(msg.Buffer[count++]==1);
#ifdef DEBUG
smprintf(s, "Caller group logo ");
if (Data->Bitmap->BitmapEnabled) {
smprintf(s, "enabled\n");
} else {
smprintf(s, "disabled\n");
}
@@ -1431,229 +1435,231 @@ static GSM_Error N6110_SetMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
req[6] = UnicodeLength(entry->Entries[Name].Text);
memcpy(req+current,DecodeUnicodeString(entry->Entries[Name].Text),UnicodeLength(entry->Entries[Name].Text));
current += UnicodeLength(entry->Entries[Name].Text);
} else req[6] = 0;
} else {
if (Name != -1) {
req[6] = UnicodeLength(entry->Entries[Name].Text)*2+2;
memcpy(req+current,entry->Entries[Name].Text,UnicodeLength(entry->Entries[Name].Text)*2);
current += UnicodeLength(entry->Entries[Name].Text)*2;
} else req[6] = 0;
req[current++]=0x00;
req[current++]=0x00;
}
if (Number != -1) {
req[current++]=UnicodeLength(entry->Entries[Number].Text);
memcpy(req+current,DecodeUnicodeString(entry->Entries[Number].Text),UnicodeLength(entry->Entries[Number].Text));
current += UnicodeLength(entry->Entries[Number].Text);
} else req[current++] = 0;
/* This allow to save 14 characters name into SIM memory, when
* no caller group is selected. */
if (Group == -1) {
req[current++] = 0xff;
} else {
req[current++] = entry->Entries[Group].Number-1;
}
smprintf(s, "Writing phonebook entry\n");
return GSM_WaitFor (s, req, current, 0x03, 4, ID_SetMemory);
}
static GSM_Error N6110_DeleteMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
{
GSM_MemoryEntry dwa;
dwa.Location = entry->Location;
dwa.MemoryType = entry->MemoryType;
dwa.EntriesNum = 0;
return N6110_SetMemory(s, &dwa);
}
static GSM_Error N6110_ReplyGetRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
GSM_Phone_Data *Data = &s->Phone.Data;
char buffer[2000];
GSM_Error error;
int i,end,start;
smprintf(s, "Ringtone received\n");
switch (msg.Buffer[4]) {
case 0x00:
switch (Data->Ringtone->Format) {
case RING_NOTETONE:
memcpy(buffer,msg.Buffer,msg.Length);
i=7;
if (buffer[9]==0x4a && buffer[10]==0x3a) i=8;
buffer[i]=0x02;
error=GSM_DecodeNokiaRTTLRingtone(Data->Ringtone, buffer+i, msg.Length-i);
if (error!=ERR_NONE) return ERR_EMPTY;
return ERR_NONE;
case RING_NOKIABINARY:
i=8;
while (msg.Buffer[i]!=0) {
i++;
if (i>msg.Length) return ERR_EMPTY;
}
EncodeUnicode(Data->Ringtone->Name,msg.Buffer+8,i-8);
smprintf(s, "Name \"%s\"\n",DecodeUnicodeString(Data->Ringtone->Name));
/* Looking for start && end */
end=0;start=0;i=0;
while (true) {
if (start!=0) {
if (msg.Buffer[i]==0x07 && msg.Buffer[i+1]==0x0b) {
end=i+2; break;
}
if (msg.Buffer[i]==0x0e && msg.Buffer[i+1]==0x0b) {
end=i+2; break;
}
} else {
if (msg.Buffer[i]==0x02 && msg.Buffer[i+1]==0xfc && msg.Buffer[i+2]==0x09) {
start = i;
}
}
i++;
if (i==msg.Length-3) return ERR_EMPTY;
}
/* Copying frame */
memcpy(Data->Ringtone->NokiaBinary.Frame,msg.Buffer+start,end-start);
Data->Ringtone->NokiaBinary.Length=end-start;
#ifdef DEBUG
if (di.dl == DL_TEXTALL || di.dl == DL_TEXTALLDATE) DumpMessage(di.df, di.dl, Data->Ringtone->NokiaBinary.Frame, Data->Ringtone->NokiaBinary.Length);
#endif
return ERR_NONE;
case RING_MIDI:
+ case RING_MMF:
return ERR_NOTSUPPORTED;
}
smprintf(s, "Ringtone format is %i\n",Data->Ringtone->Format);
break;
default:
smprintf(s, "Invalid location. Too high ?\n");
return ERR_INVALIDLOCATION;
}
return ERR_UNKNOWNRESPONSE;
}
static GSM_Error N6110_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone)
{
GSM_Error error;
unsigned char req[] = {0x00, 0x01, 0x9e,
0x00}; /* location */
if (PhoneRingtone) return ERR_NOTSUPPORTED;
if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_NORING)) return ERR_NOTSUPPORTED;
if (Ringtone->Location == 0) return ERR_INVALIDLOCATION;
if (Ringtone->Format == 0x00) {
if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_RING_SM)) {
Ringtone->Format = RING_NOTETONE;
} else {
Ringtone->Format = RING_NOKIABINARY;
}
}
switch (Ringtone->Format) {
case RING_NOTETONE:
if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_RING_SM)) return ERR_NOTSUPPORTED;
break;
case RING_NOKIABINARY:
if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_RING_SM)) return ERR_NOTSUPPORTED;
break;
case RING_MIDI:
+ case RING_MMF:
return ERR_NOTSUPPORTED;
}
error=DCT3_EnableSecurity (s, 0x01);
if (error!=ERR_NONE) return error;
req[3]=Ringtone->Location-1;
s->Phone.Data.Ringtone=Ringtone;
smprintf(s, "Getting (binary) ringtone\n");
return GSM_WaitFor (s, req, 4, 0x40, 4, ID_GetRingtone);
}
static GSM_Error N6110_ReplyGetSecurityStatus(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
*s->Phone.Data.SecurityStatus = msg.Buffer[4];
#ifdef DEBUG
smprintf(s, "Security code status\n");
switch(msg.Buffer[4]) {
case SEC_SecurityCode: smprintf(s, "waiting for Security Code.\n"); break;
case SEC_Pin : smprintf(s, "waiting for PIN.\n"); break;
case SEC_Pin2 : smprintf(s, "waiting for PIN2.\n"); break;
case SEC_Puk : smprintf(s, "waiting for PUK.\n"); break;
case SEC_Puk2 : smprintf(s, "waiting for PUK2.\n"); break;
case SEC_None : smprintf(s, "nothing to enter.\n"); break;
default : smprintf(s, "ERROR: unknown %i\n",msg.Buffer[4]);
return ERR_UNKNOWNRESPONSE;
}
#endif
return ERR_NONE;
}
static GSM_Error N6110_GetSecurityStatus(GSM_StateMachine *s, GSM_SecurityCodeType *Status)
{
unsigned char req[4] = {N6110_FRAME_HEADER, 0x07};
s->Phone.Data.SecurityStatus=Status;
smprintf(s, "Getting security code status\n");
return GSM_WaitFor (s, req, 4, 0x08, 2, ID_GetSecurityStatus);
}
static GSM_Error N6110_ReplyEnterSecurityCode(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
switch (msg.Buffer[3]) {
case 0x0b:
smprintf(s, "Security code OK\n");
return ERR_NONE;
case 0x0c:
switch (msg.Buffer[4]) {
case 0x88:
smprintf(s, "Wrong code\n");
return ERR_SECURITYERROR;
case 0x8b:
smprintf(s, "Not required\n");
return ERR_NONE;
default:
smprintf(s, "ERROR: unknown %i\n",msg.Buffer[4]);
}
}
return ERR_UNKNOWNRESPONSE;
}
static GSM_Error N6110_EnterSecurityCode(GSM_StateMachine *s, GSM_SecurityCode Code)
{
int len = 0;
unsigned char req[15] = {N6110_FRAME_HEADER, 0x0a,
0x00}; /* Type of code to enter */
req[4]=Code.Type;
len = strlen(Code.Code);
memcpy(req+5,Code.Code,len);
req[5+len]=0x00;
req[6+len]=0x00;
smprintf(s, "Entering security code\n");
return GSM_WaitFor (s, req, 7+len, 0x08, 4, ID_EnterSecurityCode);
}
static GSM_Error N6110_ReplyGetSpeedDial(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
GSM_Phone_Data *Data = &s->Phone.Data;
switch (msg.Buffer[3]) {
case 0x17:
smprintf(s, "Speed dial received\n");
switch (msg.Buffer[4]) {
case 0x02:
Data->SpeedDial->MemoryType = MEM_ME;
smprintf(s, "ME ");
break;
case 0x03:
Data->SpeedDial->MemoryType = MEM_SM;
smprintf(s, "SIM ");
break;
default:
@@ -2350,194 +2356,194 @@ static GSM_Error N6110_ReplyGetNextCalendar(GSM_Protocol_Message msg, GSM_StateM
Entry->EntriesNum++;
NOKIA_DecodeDateTime(s, msg.Buffer+16, &Entry->Entries[1].Date);
if (Entry->Entries[1].Date.Year!=0) {
smprintf(s, "Alarm : %02i-%02i-%04i %02i:%02i:%02i\n",
Entry->Entries[1].Date.Day,Entry->Entries[1].Date.Month,Entry->Entries[1].Date.Year,
Entry->Entries[1].Date.Hour,Entry->Entries[1].Date.Minute,Entry->Entries[1].Date.Second);
Entry->Entries[1].EntryType = CAL_ALARM_DATETIME;
Entry->EntriesNum++;
} else {
smprintf(s, "No alarm\n");
}
if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_CAL52) ||
IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_CAL82)) {
memcpy(Entry->Entries[Entry->EntriesNum].Text,msg.Buffer+24,msg.Buffer[23]);
Entry->Entries[Entry->EntriesNum].Text[msg.Buffer[23] ]=0;
Entry->Entries[Entry->EntriesNum].Text[msg.Buffer[23]+1]=0;
} else {
if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_CAL33)) {
/* first char is subset for 33xx and reminders */
if (Entry->Type == GSM_CAL_REMINDER) {
i=1;
smprintf(s, "Subset %i in reminder note !\n",msg.Buffer[24]);
}
SpecialSubSet = true;
switch (msg.Buffer[24]) {
case 2 : Decode3310Subset2(i,msg,&s->Phone.Data); break;
case 3 : Decode3310Subset3(i,msg,&s->Phone.Data); break;
default : SpecialSubSet = false; break;
}
}
if (!SpecialSubSet) {
N6110_EncodeUnicode(s,Entry->Entries[Entry->EntriesNum].Text,msg.Buffer+24+i,msg.Buffer[23]-i);
}
}
smprintf(s, "Text \"%s\"\n",DecodeUnicodeString(Entry->Entries[Entry->EntriesNum].Text));
if (msg.Buffer[23] != 0x00) {
Entry->Entries[Entry->EntriesNum].EntryType = CAL_TEXT;
Entry->EntriesNum++;
}
if (Entry->Type == GSM_CAL_CALL) {
EncodeUnicode(Entry->Entries[Entry->EntriesNum].Text,msg.Buffer+24+msg.Buffer[23]+1,msg.Buffer[24+msg.Buffer[23]]);
smprintf(s, "Phone : \"%s\"\n",DecodeUnicodeString(Entry->Entries[Entry->EntriesNum].Text));
if (msg.Buffer[24+msg.Buffer[23]] != 0x00) {
Entry->Entries[Entry->EntriesNum].EntryType = CAL_PHONE;
Entry->EntriesNum++;
}
}
return ERR_NONE;
case 0x93:
smprintf(s, "Can't get calendar note - too high location?\n");
return ERR_INVALIDLOCATION;
}
return ERR_UNKNOWNRESPONSE;
}
static GSM_Error N6110_GetNextCalendarNote(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start)
{
int Text, Time, Alarm, Phone, Recurrance, EndTime, Location;
GSM_Error error;
GSM_DateTime date_time;
GSM_Phone_N6110Data *Priv = &s->Phone.Data.Priv.N6110;
unsigned char req[] = {N6110_FRAME_HEADER, 0x66,
0x00}; /* Location */
if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_NOCALENDAR)) return ERR_NOTSUPPORTED;
if (start) {
Priv->LastCalendarPos = 1;
} else {
Priv->LastCalendarPos++;
}
Note->Location = Priv->LastCalendarPos;
req[4] = Priv->LastCalendarPos;
s->Phone.Data.Cal=Note;
smprintf(s, "Getting calendar note\n");
error=GSM_WaitFor (s, req, 5, 0x13, 4, ID_GetCalendarNote);
GSM_CalendarFindDefaultTextTimeAlarmPhoneRecurrance(Note, &Text, &Time, &Alarm, &Phone, &Recurrance, &EndTime, &Location);
/* 2090 year is set for example in 3310 */
if (error == ERR_NONE && Note->Entries[Time].Date.Year == 2090) {
error=N6110_GetDateTime(s, &date_time);
if (error == ERR_NONE) Note->Entries[Time].Date.Year = date_time.Year;
}
return error;
}
GSM_Error N6110_ReplyUSSDInfo(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
unsigned char buffer[2000],buffer2[4000];
int tmp;
- tmp=GSM_UnpackEightBitsToSeven(0, 82, 82, msg.Buffer+8, buffer);
- msg.Buffer[tmp] = 0;
+ tmp=GSM_UnpackEightBitsToSeven(0, msg.Buffer[7], 82, msg.Buffer+8, buffer);
+ buffer[tmp] = 0;
smprintf(s, "USSD reply: \"%s\"\n",buffer);
if (s->Phone.Data.EnableIncomingUSSD && s->User.IncomingUSSD!=NULL) {
EncodeUnicode(buffer2,buffer,strlen(buffer));
s->User.IncomingUSSD(s->CurrentConfig->Device, buffer2);
}
return ERR_NONE;
}
GSM_Error N6110_AnswerCall(GSM_StateMachine *s, int ID, bool all)
{
GSM_Error error;
unsigned char req1[] = {N6110_FRAME_HEADER, 0x42, 0x05, 0x01,
0x07, 0xa2, 0x88, 0x81, 0x21, 0x15, 0x63, 0xa8,
0x00, 0x00, 0x07, 0xa3, 0xb8, 0x81, 0x20, 0x15,
0x63, 0x80};
if (!all) {
smprintf(s, "Answering call part 1\n");
error = GSM_WaitFor (s, req1, 24, 0x01, 5, ID_AnswerCall);
if (error != ERR_NONE) return error;
return DCT3DCT4_AnswerCall(s,ID);
}
return DCT3_AnswerAllCalls(s);
}
static GSM_Error N6110_DialVoice(GSM_StateMachine *s, char *number, GSM_CallShowNumber ShowNumber)
{
unsigned int pos = 4;
unsigned char req[100] = {N6110_FRAME_HEADER,0x01,
0x0c}; /* Length of number */
if (ShowNumber == GSM_CALL_DefaultNumberPresence) return DCT3_DialVoice(s,number,ShowNumber);
req[pos++] = strlen(number);
memcpy(req+pos,number,strlen(number));
pos += strlen(number);
req[pos++] = 0x05; /* call type: voice - 0x05, data - 0x01 */
req[pos++] = 0x01;
req[pos++] = 0x01;
req[pos++] = 0x05;
req[pos++] = 0x81;
switch (ShowNumber) {
case GSM_CALL_HideNumber:
req[pos++] = 0x02;
break;
case GSM_CALL_ShowNumber:
req[pos++] = 0x03;
break;
case GSM_CALL_DefaultNumberPresence:
req[pos++] = 0x01;
break;
}
req[pos++] = 0x00;
req[pos++] = 0x00;
smprintf(s, "Making voice call\n");
return GSM_WaitFor (s, req, pos, 0x01, 4, ID_DialVoice);
}
GSM_Error N6110_UnholdCall(GSM_StateMachine *s, int ID)
{
unsigned char req[] = {N6110_FRAME_HEADER, 0x24, 0x00, 0x02};
req[4] = (unsigned char)ID;
s->Phone.Data.CallID = ID;
smprintf(s, "Unholding call\n");
return GSM_WaitFor (s, req, 6, 0x01, 4, ID_UnholdCall);
}
GSM_Error N6110_HoldCall(GSM_StateMachine *s, int ID)
{
unsigned char req[] = {N6110_FRAME_HEADER, 0x22, 0x00, 0x00};
req[4] = (unsigned char)ID;
s->Phone.Data.CallID = ID;
smprintf(s, "Unholding call\n");
return GSM_WaitFor (s, req, 6, 0x01, 4, ID_HoldCall);
}
/* Joining selected call to current (and making conference) */
GSM_Error N6110_ConferenceCall(GSM_StateMachine *s, int ID)
{
unsigned char req[] = {N6110_FRAME_HEADER, 0x28, 0x00, 0x01};
req[4] = (unsigned char)ID;
s->Phone.Data.CallID = ID;
smprintf(s, "Conference call\n");
return GSM_WaitFor (s, req, 6, 0x01, 4, ID_ConferenceCall);
}
@@ -2714,171 +2720,172 @@ static GSM_Reply_Function N6110ReplyFunctions[] = {
{DCT3_ReplyGetWAPSettings, "\x3f",0x03,0x16,ID_GetConnectSet },
{DCT3_ReplyGetWAPSettings, "\x3f",0x03,0x17,ID_GetConnectSet },
{DCT3_ReplySetWAPSettings, "\x3f",0x03,0x19,ID_SetConnectSet },
{DCT3_ReplySetWAPSettings, "\x3f",0x03,0x1A,ID_SetConnectSet },
{DCT3_ReplyGetWAPSettings, "\x3f",0x03,0x1C,ID_GetConnectSet },
{DCT3_ReplyGetWAPSettings, "\x3f",0x03,0x1D,ID_GetConnectSet },
{DCT3_ReplySetWAPSettings, "\x3f",0x03,0x1F,ID_SetConnectSet },
{DCT3_ReplyEnableSecurity, "\x40",0x02,0x64,ID_EnableSecurity },
{N61_71_ReplyResetPhoneSettings, "\x40",0x02,0x65,ID_ResetPhoneSettings },
{DCT3_ReplyGetIMEI, "\x40",0x02,0x66,ID_GetIMEI },
{DCT3_ReplyDialCommand, "\x40",0x02,0x7C,ID_DialVoice },
{DCT3_ReplyDialCommand, "\x40",0x02,0x7C,ID_CancelCall },
{DCT3_ReplyDialCommand, "\x40",0x02,0x7C,ID_AnswerCall },
{DCT3_ReplyNetmonitor, "\x40",0x02,0x7E,ID_Netmonitor },
{DCT3_ReplyPlayTone, "\x40",0x02,0x8F,ID_PlayTone },
{N6110_ReplyGetRingtone, "\x40",0x02,0x9E,ID_GetRingtone },
{N6110_ReplySetBinRingtone, "\x40",0x02,0xA0,ID_SetRingtone },
{NOKIA_ReplyGetPhoneString, "\x40",0x02,0xC8,ID_GetHardware },
{NOKIA_ReplyGetPhoneString, "\x40",0x02,0xC8,ID_GetPPM },
{NOKIA_ReplyGetPhoneString, "\x40",0x02,0xCA,ID_GetProductCode },
{NOKIA_ReplyGetPhoneString, "\x40",0x02,0xCC,ID_GetManufactureMonth},
{NOKIA_ReplyGetPhoneString, "\x40",0x02,0xCC,ID_GetOriginalIMEI },
{N6110_ReplyGetSetPicture, "\x47",0x03,0x02,ID_GetBitmap },
{N6110_ReplyGetSetPicture, "\x47",0x03,0x04,ID_SetBitmap },
{N6110_ReplyGetSetPicture, "\x47",0x03,0x05,ID_SetBitmap },
{N6110_ReplyGetSetPicture, "\x47",0x03,0x06,ID_GetBitmap },
#ifndef ENABLE_LGPL
{N6110_ReplyGetMagicBytes, "\x64",0x00,0x00,ID_MakeAuthentication },
#endif
{DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetModel },
{DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetFirmware },
{DCT3_ReplyPressKey, "\xD2",0x02,0x46,ID_PressKey },
{DCT3_ReplyPressKey, "\xD2",0x02,0x47,ID_PressKey },
{NULL, "\x00",0x00,0x00,ID_None }
};
GSM_Phone_Functions N6110Phone = {
"2100|3210|3310|3330|3390|3410|3610|5110|5110i|5130|5190|5210|5510|6110|6130|6150|6190|8210|8250|8290|8850|8855|8890",
N6110ReplyFunctions,
N6110_Initialise,
PHONE_Terminate,
GSM_DispatchMessage,
N6110_ShowStartInfo,
NOKIA_GetManufacturer,
DCT3DCT4_GetModel,
DCT3DCT4_GetFirmware,
DCT3_GetIMEI,
DCT3_GetOriginalIMEI,
DCT3_GetManufactureMonth,
DCT3_GetProductCode,
DCT3_GetHardware,
DCT3_GetPPM,
NOTSUPPORTED, /* GetSIMIMSI */
N6110_GetDateTime,
N6110_SetDateTime,
N6110_GetAlarm,
N6110_SetAlarm,
NOTSUPPORTED, /* GetLocale */
NOTSUPPORTED, /* SetLocale */
DCT3_PressKey,
DCT3_Reset,
N61_71_ResetPhoneSettings,
N6110_EnterSecurityCode,
N6110_GetSecurityStatus,
N6110_GetDisplayStatus,
NOTIMPLEMENTED, /* SetAutoNetworkLogin */
N6110_GetBatteryCharge,
N6110_GetSignalQuality,
DCT3_GetNetworkInfo,
NOTSUPPORTED, /* GetCategory */
NOTSUPPORTED, /* AddCategory */
NOTSUPPORTED, /* GetCategoryStatus */
N6110_GetMemoryStatus,
N6110_GetMemory,
NOTIMPLEMENTED, /* GetNextMemory */
N6110_SetMemory,
NOTIMPLEMENTED, /* AddMemory */
N6110_DeleteMemory,
NOTIMPLEMENTED, /* DeleteAllMemory */
N6110_GetSpeedDial,
NOTIMPLEMENTED, /* SetSpeedDial */
DCT3_GetSMSC,
DCT3_SetSMSC,
DCT3_GetSMSStatus,
N6110_GetSMSMessage,
N6110_GetNextSMSMessage,
N6110_SetSMS,
N6110_AddSMS,
N6110_DeleteSMSMessage,
DCT3_SendSMSMessage,
NOTSUPPORTED, /* SendSavedSMS */
+ NOTSUPPORTED, /* SetFastSMSSending */
NOKIA_SetIncomingSMS,
DCT3_SetIncomingCB,
PHONE_GetSMSFolders,
NOTSUPPORTED, /* AddSMSFolder */
NOTSUPPORTED, /* DeleteSMSFolder */
N6110_DialVoice,
N6110_AnswerCall,
DCT3_CancelCall,
N6110_HoldCall,
N6110_UnholdCall,
N6110_ConferenceCall,
N6110_SplitCall,
N6110_TransferCall,
N6110_SwitchCall,
DCT3DCT4_GetCallDivert,
DCT3DCT4_SetCallDivert,
DCT3DCT4_CancelAllDiverts,
NOKIA_SetIncomingCall,
NOKIA_SetIncomingUSSD,
DCT3DCT4_SendDTMF,
N6110_GetRingtone,
N6110_SetRingtone,
NOTSUPPORTED, /* GetRingtonesInfo */
NOTSUPPORTED, /* DeleteUserRingtones */
DCT3_PlayTone,
DCT3_GetWAPBookmark,
DCT3_SetWAPBookmark,
DCT3_DeleteWAPBookmark,
DCT3_GetWAPSettings,
DCT3_SetWAPSettings,
NOTSUPPORTED, /* GetMMSSettings */
NOTSUPPORTED, /* SetMMSSettings */
NOTSUPPORTED, /* GetSyncMLSettings */
NOTSUPPORTED, /* SetSyncMLSettings */
NOTSUPPORTED, /* GetChatSettings */
NOTSUPPORTED, /* SetChatSettings */
N6110_GetBitmap,
N6110_SetBitmap,
NOTSUPPORTED, /* GetToDoStatus */
NOTSUPPORTED, /* GetToDo */
NOTSUPPORTED, /* GetNextToDo */
NOTSUPPORTED, /* SetToDo */
NOTSUPPORTED, /* AddToDo */
NOTSUPPORTED, /* DeleteToDo */
NOTSUPPORTED, /* DeleteAllToDo */
NOTIMPLEMENTED, /* GetCalendarStatus */
NOTIMPLEMENTED, /* GetCalendar */
N6110_GetNextCalendarNote,
NOTIMPLEMENTED, /* SetCalendar */
N6110_AddCalendarNote,
N6110_DeleteCalendarNote,
NOTIMPLEMENTED, /* DeleteAllCalendar */
NOTSUPPORTED, /* GetCalendarSettings */
NOTSUPPORTED, /* SetCalendarSettings */
- NOTSUPPORTED, /* GetNote */
+ NOTSUPPORTED, /* GetNextNote */
N6110_GetProfile,
N6110_SetProfile,
NOTSUPPORTED, /* GetFMStation */
NOTSUPPORTED, /* SetFMStation */
NOTSUPPORTED, /* ClearFMStations */
NOTSUPPORTED, /* GetNextFileFolder */
NOTSUPPORTED, /* GetFilePart */
NOTSUPPORTED, /* AddFile */
NOTSUPPORTED, /* GetFileSystemStatus */
NOTSUPPORTED, /* DeleteFile */
NOTSUPPORTED, /* AddFolder */
NOTSUPPORTED, /* GetGPRSAccessPoint */
NOTSUPPORTED /* SetGPRSAccessPoint */
};
#endif
/* How should editor hadle tabs in this file? Add editor commands here.
* vim: noexpandtab sw=8 ts=8 sts=8:
*/
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,98 +1,101 @@
/* (c) 2001-2004 by Marcin Wiacek */
-/* based on some work from Markus Plail and Gnokii */
+/* based on some Markus Plail work from Gnokii (www.gnokii.org)
+ * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
+ * GNU GPL version 2 or later
+ */
#include "../../../gsmstate.h"
#ifdef GSM_ENABLE_NOKIA7110
#include <string.h>
#include <time.h>
#include "../../../misc/coding/coding.h"
#include "../../../gsmcomon.h"
#include "../../../service/gsmlogo.h"
#include "../../pfunc.h"
#include "../nfunc.h"
#include "../nfuncold.h"
#include "n7110.h"
#include "dct3func.h"
static GSM_Error N7110_GetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm)
{
return DCT3_GetAlarm(s, alarm, 0x19);
}
static GSM_Error N7110_SetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm)
{
return DCT3_SetAlarm(s, alarm, 0x19);
}
static GSM_Error N7110_ReplyGetMemory(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
GSM_Phone_Data *Data = &s->Phone.Data;
smprintf(s, "Phonebook entry received\n");
switch (msg.Buffer[6]) {
case 0x0f:
return N71_65_ReplyGetMemoryError(msg.Buffer[10], s);
default:
return N71_65_DecodePhonebook(s, Data->Memory,Data->Bitmap,Data->SpeedDial,msg.Buffer+18,msg.Length-18,false);
}
return ERR_UNKNOWN;
}
static GSM_Error N7110_GetMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry)
{
unsigned char req[] = {N7110_FRAME_HEADER, 0x07, 0x01, 0x01, 0x00, 0x01,
0x02, /* memory type */
0x05,
0x00, 0x00, /* location */
0x00, 0x00};
req[9] = NOKIA_GetMemoryType(s, entry->MemoryType,N71_65_MEMORY_TYPES);
if (req[9]==0xff) return ERR_NOTSUPPORTED;
if (entry->Location==0x00) return ERR_INVALIDLOCATION;
req[10] = entry->Location / 256;
req[11] = entry->Location % 256;
s->Phone.Data.Memory=entry;
smprintf(s, "Getting phonebook entry\n");
return GSM_WaitFor (s, req, 14, 0x03, 4, ID_GetMemory);
}
static GSM_Error N7110_ReplyGetMemoryStatus(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
GSM_Phone_Data *Data = &s->Phone.Data;
smprintf(s, "Memory status received\n");
/* Quess ;-)) */
if (msg.Buffer[10]==0x10) {
Data->MemoryStatus->MemoryFree = msg.Buffer[14]*256 + msg.Buffer[15];
} else {
Data->MemoryStatus->MemoryFree = msg.Buffer[18];
}
smprintf(s, " Size : %i\n",Data->MemoryStatus->MemoryFree);
Data->MemoryStatus->MemoryUsed = msg.Buffer[16]*256 + msg.Buffer[17];
smprintf(s, " Used : %i\n",Data->MemoryStatus->MemoryUsed);
Data->MemoryStatus->MemoryFree -= Data->MemoryStatus->MemoryUsed;
smprintf(s, " Free : %i\n",Data->MemoryStatus->MemoryFree);
return ERR_NONE;
}
static GSM_Error N7110_GetMemoryStatus(GSM_StateMachine *s, GSM_MemoryStatus *Status)
{
unsigned char req[] = {N6110_FRAME_HEADER, 0x03, 0x02,
0x05}; /* Memory type */
req[5] = NOKIA_GetMemoryType(s, Status->MemoryType,N71_65_MEMORY_TYPES);
if (req[5]==0xff) return ERR_NOTSUPPORTED;
s->Phone.Data.MemoryStatus=Status;
smprintf(s, "Getting memory status\n");
return GSM_WaitFor (s, req, 6, 0x03, 4, ID_GetMemoryStatus);
}
static void N7110_GetSMSLocation(GSM_StateMachine *s, GSM_SMSMessage *sms, unsigned char *folderid, int *location)
{
@@ -433,192 +436,193 @@ static GSM_Error N7110_GetNextSMSMessage(GSM_StateMachine *s, GSM_MultiSMSMessag
error=N7110_GetSMSFolders(s,&Priv->LastSMSFolders);
if (error!=ERR_NONE) return error;
} else {
N7110_GetSMSLocation(s, &sms->SMS[0], &folderid, &location);
for (i=0;i<Priv->LastSMSFolder.Number;i++) {
if (Priv->LastSMSFolder.Location[i]==location) break;
}
/* Is this last location in this folder ? */
if (i==Priv->LastSMSFolder.Number-1) {
findnextfolder=true;
} else {
location=Priv->LastSMSFolder.Location[i+1];
}
}
if (findnextfolder) {
Priv->LastSMSFolder.Number=0;
while (Priv->LastSMSFolder.Number==0) {
folderid=folderid+0x08;
/* Too high folder number */
if ((folderid/0x08)>Priv->LastSMSFolders.Number) return ERR_EMPTY;
/* Get next folder status */
error=N7110_GetSMSFolderStatus(s, folderid);
if (error!=ERR_NONE) return error;
/* First location from this folder */
location=Priv->LastSMSFolder.Location[0];
}
}
N7110_SetSMSLocation(s, &sms->SMS[0], folderid, location);
return N7110_PrivGetSMSMessage(s, sms);
}
static int N7110_ReturnBinaryRingtoneLocation(char *model)
{
if (strcmp(model,"NSE-5") == 0) return 0x72; /* first 0x72 - 7110 */
if (strcmp(model,"NPE-3") == 0) return 0x89; /* first 0x89 - 6210 */
if (strcmp(model,"NHM-3") == 0) return 0x89; /* quess for 6250 */
return 0;
}
static GSM_Error N7110_ReplyGetRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
int tmp,i;
GSM_Phone_Data *Data = &s->Phone.Data;
smprintf(s, "Ringtone received\n");
switch (msg.Buffer[3]) {
case 0x23:
tmp=0;i=4;
while (msg.Buffer[i]!=0 || msg.Buffer[i+1]!=0) {
tmp++;
i=i+2;
if (i>msg.Length) return ERR_EMPTY;
}
memcpy(Data->Ringtone->Name,msg.Buffer+6,tmp*2);
smprintf(s, "Name \"%s\"\n",DecodeUnicodeString(Data->Ringtone->Name));
/* Looking for end */
i=37;
while (true) {
if (msg.Buffer[i]==0x07 && msg.Buffer[i+1]==0x0b) {
i=i+2; break;
}
if (msg.Buffer[i]==0x0e && msg.Buffer[i+1]==0x0b) {
i=i+2; break;
}
i++;
if (i==msg.Length) return ERR_EMPTY;
}
/* Copying frame */
memcpy(Data->Ringtone->NokiaBinary.Frame,msg.Buffer+37,i-37);
Data->Ringtone->NokiaBinary.Length=i-37;
return ERR_NONE;
case 0x24:
smprintf(s, "Invalid location. Too high ?\n");
return ERR_INVALIDLOCATION;
}
return ERR_UNKNOWNRESPONSE;
}
static GSM_Error N7110_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone)
{
unsigned char req[] = {N7110_FRAME_HEADER, 0x22, 0x00, 0x00};
if (PhoneRingtone) return ERR_NOTSUPPORTED;
if (Ringtone->Format == 0x00) Ringtone->Format = RING_NOKIABINARY;
switch (Ringtone->Format) {
case RING_NOTETONE:
/* In the future get binary and convert */
return ERR_NOTSUPPORTED;
case RING_NOKIABINARY:
req[5]=N7110_ReturnBinaryRingtoneLocation(s->Phone.Data.Model)+Ringtone->Location;
s->Phone.Data.Ringtone=Ringtone;
smprintf(s, "Getting binary ringtone\n");
return GSM_WaitFor (s, req, 6, 0x1f, 4, ID_GetRingtone);
case RING_MIDI:
+ case RING_MMF:
return ERR_NOTSUPPORTED;
}
return ERR_NOTSUPPORTED;
}
static GSM_Error N7110_ReplyGetPictureImageInfo(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
int i;
GSM_Phone_N7110Data *Priv = &s->Phone.Data.Priv.N7110;
smprintf(s, "Received info for Picture Images\n");
smprintf(s, "Number : %i\n",msg.Buffer[4]*256+msg.Buffer[5]);
smprintf(s, "Locations :");
Priv->LastPictureImageFolder.Number=msg.Buffer[4]*256+msg.Buffer[5];
for (i=0;i<Priv->LastPictureImageFolder.Number;i++) {
Priv->LastPictureImageFolder.Location[i]=msg.Buffer[6+i*2]*256+msg.Buffer[7+i*2];
smprintf(s, " %i",Priv->LastPictureImageFolder.Location[i]);
}
smprintf(s, "\n");
return ERR_NONE;
}
static GSM_Error N7110_GetPictureImageLocation(GSM_StateMachine *s, GSM_Bitmap *Bitmap, unsigned char *folder, int *location)
{
GSM_Phone_N7110Data *Priv = &s->Phone.Data.Priv.N7110;
GSM_SMSFolders folders;
GSM_Error error;
int i, j = 0, count = 0;
unsigned char req[] = {N6110_FRAME_HEADER, 0x96,
0x00, /* Folder ID */
0x0f, 0x07};
error=N7110_GetSMSFolders (s, &folders);
if (error!=ERR_NONE) return error;
for (i=0;i<folders.Number;i++) {
req[4] = (i+1) * 0x08; /* SMS folder ID */
error = GSM_WaitFor (s, req, 7, 0x14, 4, ID_GetBitmap);
if (error!=ERR_NONE) return error;
for (j=0;j<Priv->LastPictureImageFolder.Number;j++) {
count++;
if (count==Bitmap->Location) break;
}
if (count==Bitmap->Location) break;
}
if (count!=Bitmap->Location) return ERR_INVALIDLOCATION;
*folder = (i+1) * 0x08; /* SMS Folder ID */
*location = Priv->LastPictureImageFolder.Location[j];
return ERR_NONE;
}
static GSM_Error N7110_GetPictureImage(GSM_StateMachine *s, GSM_Bitmap *Bitmap)
{
unsigned char folder;
int location;
GSM_Error error;
unsigned char req[] = {N6110_FRAME_HEADER, 0x07,
0x00, /* Folder ID */
0x00, 0x00, /* Location */
0x00, 0x64};
error = N7110_GetPictureImageLocation(s, Bitmap, &folder, &location);
switch (error) {
case ERR_NONE:
req[4] = folder;
req[5] = location / 256;
req[6] = location % 256;
return GSM_WaitFor (s, req, 9, 0x14, 4, ID_GetBitmap);
default:
return error;
}
}
static GSM_Error N7110_GetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap)
{
GSM_MemoryEntry pbk;
GSM_Error error;
unsigned char OpReq[] = {N6110_FRAME_HEADER, 0x70};
s->Phone.Data.Bitmap=Bitmap;
switch (Bitmap->Type) {
case GSM_StartupLogo:
smprintf(s, "Getting startup logo\n");
return N71_92_GetPhoneSetting(s, ID_GetBitmap, 0x15);
case GSM_WelcomeNote_Text:
smprintf(s, "Getting welcome note\n");
return N71_92_GetPhoneSetting(s, ID_GetBitmap, 0x02);
case GSM_DealerNote_Text:
smprintf(s, "Getting dealer note\n");
return N71_92_GetPhoneSetting(s, ID_GetBitmap, 0x17);
case GSM_CallerGroupLogo:
pbk.MemoryType = MEM7110_CG;
pbk.Location = Bitmap->Location;
smprintf(s, "Getting caller group logo\n");
error=N7110_GetMemory(s,&pbk);
if (error==ERR_NONE) NOKIA_GetDefaultCallerGroupName(s,Bitmap);
@@ -1554,171 +1558,172 @@ static GSM_Reply_Function N7110ReplyFunctions[] = {
{DCT3_ReplyGetWAPSettings, "\x3f",0x03,0x16,ID_GetConnectSet },
{DCT3_ReplyGetWAPSettings, "\x3f",0x03,0x17,ID_GetConnectSet },
{DCT3_ReplySetWAPSettings, "\x3f",0x03,0x19,ID_SetConnectSet },
{DCT3_ReplySetWAPSettings, "\x3f",0x03,0x1A,ID_SetConnectSet },
{DCT3_ReplyGetWAPSettings, "\x3f",0x03,0x1C,ID_GetConnectSet },
{DCT3_ReplyGetWAPSettings, "\x3f",0x03,0x1D,ID_GetConnectSet },
{DCT3_ReplySetWAPSettings, "\x3f",0x03,0x1F,ID_SetConnectSet },
{N7110_ReplyGetProfileFeature, "\x39",0x03,0x02,ID_GetProfile },
{N7110_ReplySetProfileFeature, "\x39",0x03,0x04,ID_SetProfile },
{DCT3_ReplyEnableSecurity, "\x40",0x02,0x64,ID_EnableSecurity },
{N61_71_ReplyResetPhoneSettings, "\x40",0x02,0x65,ID_ResetPhoneSettings },
{DCT3_ReplyGetIMEI, "\x40",0x02,0x66,ID_GetIMEI },
{DCT3_ReplyDialCommand, "\x40",0x02,0x7C,ID_DialVoice },
{DCT3_ReplyDialCommand, "\x40",0x02,0x7C,ID_CancelCall },
{DCT3_ReplyDialCommand, "\x40",0x02,0x7C,ID_AnswerCall },
{DCT3_ReplyNetmonitor, "\x40",0x02,0x7E,ID_Netmonitor },
{DCT3_ReplyPlayTone, "\x40",0x02,0x8F,ID_PlayTone },
{NOKIA_ReplyGetPhoneString, "\x40",0x02,0xC8,ID_GetHardware },
{NOKIA_ReplyGetPhoneString, "\x40",0x02,0xC8,ID_GetPPM },
{NOKIA_ReplyGetPhoneString, "\x40",0x02,0xCA,ID_GetProductCode },
{NOKIA_ReplyGetPhoneString, "\x40",0x02,0xCC,ID_GetManufactureMonth },
{NOKIA_ReplyGetPhoneString, "\x40",0x02,0xCC,ID_GetOriginalIMEI },
{NoneReply, "\x40",0x02,0xFF,ID_IncomingFrame },
{N71_92_ReplyPhoneSetting, "\x7a",0x04,0x02,ID_GetBitmap },
{N71_92_ReplyPhoneSetting, "\x7a",0x04,0x02,ID_SetBitmap },
{N71_92_ReplyPhoneSetting, "\x7a",0x04,0x15,ID_GetBitmap },
{N71_92_ReplyPhoneSetting, "\x7a",0x04,0x15,ID_SetBitmap },
{N71_92_ReplyPhoneSetting, "\x7a",0x04,0x17,ID_GetBitmap },
{N71_92_ReplyPhoneSetting, "\x7a",0x04,0x17,ID_SetBitmap },
{DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetModel },
{DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetFirmware },
{DCT3_ReplyPressKey, "\xD2",0x02,0x46,ID_PressKey },
{DCT3_ReplyPressKey, "\xD2",0x02,0x47,ID_PressKey },
{NULL, "\x00",0x00,0x00,ID_None }
};
GSM_Phone_Functions N7110Phone = {
"6210|6250|7110|7190",
N7110ReplyFunctions,
N7110_Initialise,
PHONE_Terminate,
GSM_DispatchMessage,
NOTSUPPORTED, /* ShowStartInfo */
NOKIA_GetManufacturer,
DCT3DCT4_GetModel,
DCT3DCT4_GetFirmware,
DCT3_GetIMEI,
DCT3_GetOriginalIMEI,
DCT3_GetManufactureMonth,
DCT3_GetProductCode,
DCT3_GetHardware,
DCT3_GetPPM,
NOTSUPPORTED, /* GetSIMIMSI */
N71_92_GetDateTime,
N71_92_SetDateTime,
N7110_GetAlarm,
N7110_SetAlarm,
NOTSUPPORTED, /* GetLocale */
NOTSUPPORTED, /* SetLocale */
DCT3_PressKey,
DCT3_Reset,
N61_71_ResetPhoneSettings,
NOTSUPPORTED, /* EnterSecurityCode */
NOTSUPPORTED, /* GetSecurityStatus */
NOTSUPPORTED, /* GetDisplayStatus */
NOTIMPLEMENTED, /* SetAutoNetworkLogin */
N71_92_GetBatteryCharge,
N71_92_GetSignalQuality,
DCT3_GetNetworkInfo,
NOTSUPPORTED, /* GetCategory */
NOTSUPPORTED, /* AddCategory */
NOTSUPPORTED, /* GetCategoryStatus */
N7110_GetMemoryStatus,
N7110_GetMemory,
NOTIMPLEMENTED, /* GetNextMemory */
N7110_SetMemory,
NOTIMPLEMENTED, /* AddMemory */
N7110_DeleteMemory,
NOTIMPLEMENTED, /* DeleteAllMemory */
N7110_GetSpeedDial,
NOTIMPLEMENTED, /* SetSpeedDial */
DCT3_GetSMSC,
DCT3_SetSMSC,
N7110_GetSMSStatus,
N7110_GetSMSMessage,
N7110_GetNextSMSMessage,
N7110_SetSMS,
N7110_AddSMS,
N7110_DeleteSMS,
DCT3_SendSMSMessage,
NOTSUPPORTED, /* SendSavedSMS */
+ NOTSUPPORTED, /* SetFastSMSSending */
N7110_SetIncomingSMS,
DCT3_SetIncomingCB,
N7110_GetSMSFolders,
NOTIMPLEMENTED, /* AddSMSFolder */
NOTIMPLEMENTED, /* DeleteSMSFolder */
DCT3_DialVoice,
N7110_AnswerCall,
DCT3_CancelCall,
NOTIMPLEMENTED, /* HoldCall */
NOTIMPLEMENTED, /* UnholdCall */
NOTIMPLEMENTED, /* ConferenceCall */
NOTIMPLEMENTED, /* SplitCall */
NOTIMPLEMENTED, /* TransferCall */
NOTIMPLEMENTED, /* SwitchCall */
NOTSUPPORTED, /* GetCallDivert */
N7110_SetCallDivert,
N7110_CancelAllDiverts,
N7110_SetIncomingCall,
N7110_SetIncomingUSSD,
DCT3DCT4_SendDTMF,
N7110_GetRingtone,
N7110_SetRingtone,
NOTSUPPORTED, /* GetRingtonesInfo */
NOTSUPPORTED, /* DeleteUserRingtones */
DCT3_PlayTone,
DCT3_GetWAPBookmark,
DCT3_SetWAPBookmark,
DCT3_DeleteWAPBookmark,
DCT3_GetWAPSettings,
DCT3_SetWAPSettings,
NOTSUPPORTED, /* GetMMSSettings */
NOTSUPPORTED, /* SetMMSSettings */
NOTSUPPORTED, /* GetSyncMLSettings */
NOTSUPPORTED, /* SetSyncMLSettings */
NOTSUPPORTED, /* GetChatSettings */
NOTSUPPORTED, /* SetChatSettings */
N7110_GetBitmap,
N7110_SetBitmap,
NOTSUPPORTED, /* GetToDoStatus */
NOTSUPPORTED, /* GetToDo */
NOTSUPPORTED, /* GetNextToDo */
NOTSUPPORTED, /* SetToDo */
NOTSUPPORTED, /* AddToDo */
NOTSUPPORTED, /* DeleteToDo */
NOTSUPPORTED, /* DeleteAllToDo */
N7110_GetCalendarStatus,
NOTIMPLEMENTED, /* GetCalendar */
N7110_GetNextCalendar,
NOTIMPLEMENTED, /* SetCalendar */
N7110_AddCalendar,
N71_65_DelCalendar,
NOTIMPLEMENTED, /* DeleteAllCalendar */
NOTSUPPORTED, /* GetCalendarSettings */
NOTSUPPORTED, /* SetCalendarSettings */
- NOTSUPPORTED, /* GetNote */
+ NOTSUPPORTED, /* GetNextNote */
N7110_GetProfile,
N7110_SetProfile,
NOTSUPPORTED, /* GetFMStation */
NOTSUPPORTED, /* SetFMStation */
NOTSUPPORTED, /* ClearFMStations */
NOTSUPPORTED, /* GetNextFileFolder */
NOTSUPPORTED, /* GetFilePart */
NOTSUPPORTED, /* AddFile */
NOTSUPPORTED, /* GetFileSystemStatus */
NOTSUPPORTED, /* DeleteFile */
NOTSUPPORTED, /* AddFolder */
NOTSUPPORTED, /* GetGPRSAccessPoint */
NOTSUPPORTED /* SetGPRSAccessPoint */
};
#endif
/* How should editor hadle tabs in this file? Add editor commands here.
* vim: noexpandtab sw=8 ts=8 sts=8:
*/
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
@@ -226,171 +226,172 @@ static GSM_Reply_Function N9210ReplyFunctions[] = {
{DCT3_ReplySetSMSC, "\x02",0x03,0x31,ID_SetSMSC },
{DCT3_ReplyGetSMSC, "\x02",0x03,0x34,ID_GetSMSC },
{DCT3_ReplyGetSMSC, "\x02",0x03,0x35,ID_GetSMSC },
{N61_91_ReplySetOpLogo, "\x05",0x03,0x31,ID_SetBitmap },
{N61_91_ReplySetOpLogo, "\x05",0x03,0x32,ID_SetBitmap },
{DCT3_ReplyGetNetworkInfo, "\x0A",0x03,0x71,ID_GetNetworkInfo },
{DCT3_ReplyGetNetworkInfo, "\x0A",0x03,0x71,ID_IncomingFrame },
{N71_92_ReplyGetSignalQuality, "\x0A",0x03,0x82,ID_GetSignalQuality },
{N9210_ReplySetOpLogo, "\x0A",0x03,0xA4,ID_SetBitmap },
{N9210_ReplySetOpLogo, "\x0A",0x03,0xB0,ID_SetBitmap },
{N71_92_ReplyGetBatteryCharge, "\x17",0x03,0x03,ID_GetBatteryCharge },
{DCT3_ReplySetDateTime, "\x19",0x03,0x61,ID_SetDateTime },
{DCT3_ReplyGetDateTime, "\x19",0x03,0x63,ID_GetDateTime },
{DCT3_ReplyEnableSecurity, "\x40",0x02,0x64,ID_EnableSecurity },
{DCT3_ReplyGetIMEI, "\x40",0x02,0x66,ID_GetIMEI },
{DCT3_ReplyDialCommand, "\x40",0x02,0x7C,ID_DialVoice },
{DCT3_ReplyDialCommand, "\x40",0x02,0x7C,ID_CancelCall },
{DCT3_ReplyDialCommand, "\x40",0x02,0x7C,ID_AnswerCall },
{DCT3_ReplyNetmonitor, "\x40",0x02,0x7E,ID_Netmonitor },
{NOKIA_ReplyGetPhoneString, "\x40",0x02,0xC8,ID_GetHardware },
{NOKIA_ReplyGetPhoneString, "\x40",0x02,0xC8,ID_GetPPM },
{NOKIA_ReplyGetPhoneString, "\x40",0x02,0xCA,ID_GetProductCode },
{NOKIA_ReplyGetPhoneString, "\x40",0x02,0xCC,ID_GetManufactureMonth },
{NOKIA_ReplyGetPhoneString, "\x40",0x02,0xCC,ID_GetOriginalIMEI },
{N71_92_ReplyPhoneSetting, "\x7a",0x04,0x02,ID_GetBitmap },
{N71_92_ReplyPhoneSetting, "\x7a",0x04,0x02,ID_SetBitmap },
{N71_92_ReplyPhoneSetting, "\x7a",0x04,0x15,ID_GetBitmap },
{N71_92_ReplyPhoneSetting, "\x7a",0x04,0x15,ID_SetBitmap },
{DCT3DCT4_ReplyGetModelFirmware,"\xD2",0x02,0x00,ID_GetModel },
{DCT3DCT4_ReplyGetModelFirmware,"\xD2",0x02,0x00,ID_GetFirmware },
{NULL, "\x00",0x00,0x00,ID_None }
};
GSM_Phone_Functions N9210Phone = {
"9210|9210i",
N9210ReplyFunctions,
N9210_Initialise,
PHONE_Terminate,
GSM_DispatchMessage,
NOTSUPPORTED, /* ShowStartInfo */
NOKIA_GetManufacturer,
DCT3DCT4_GetModel,
DCT3DCT4_GetFirmware,
DCT3_GetIMEI,
DCT3_GetOriginalIMEI,
DCT3_GetManufactureMonth,
DCT3_GetProductCode,
DCT3_GetHardware,
DCT3_GetPPM,
NOTSUPPORTED, /* GetSIMIMSI */
N71_92_GetDateTime,
N71_92_SetDateTime,
NOTIMPLEMENTED, /* GetAlarm */
NOTIMPLEMENTED, /* SetAlarm */
NOTSUPPORTED, /* GetLocale */
NOTSUPPORTED, /* SetLocale */
NOTIMPLEMENTED, /* PressKey */
NOTIMPLEMENTED, /* Reset */
NOTIMPLEMENTED, /* ResetPhoneSettings */
NOTSUPPORTED, /* EnterSecurityCode */
NOTSUPPORTED, /* GetSecurityStatus */
NOTSUPPORTED, /* GetDisplayStatus */
NOTIMPLEMENTED, /* SetAutoNetworkLogin */
N71_92_GetBatteryCharge,
N71_92_GetSignalQuality,
DCT3_GetNetworkInfo,
NOTSUPPORTED, /* GetCategory */
NOTSUPPORTED, /* AddCategory */
NOTSUPPORTED, /* GetCategoryStatus */
NOTIMPLEMENTED, /* GetMemoryStatus */
NOTIMPLEMENTED, /* GetMemory */
NOTIMPLEMENTED, /* GetNextMemory */
NOTIMPLEMENTED, /* SetMemory */
NOTIMPLEMENTED, /* AddMemory */
NOTIMPLEMENTED, /* DeleteMemory */
NOTIMPLEMENTED, /* DeleteAllMemory */
NOTIMPLEMENTED, /* GetSpeedDial */
NOTIMPLEMENTED, /* SetSpeedDial */
DCT3_GetSMSC,
DCT3_SetSMSC, /* FIXME: test it */
NOTIMPLEMENTED, /* GetSMSStatus */
NOTIMPLEMENTED, /* GetSMS */
NOTIMPLEMENTED, /* GetNextSMS */
NOTIMPLEMENTED, /* SetSMS */
NOTIMPLEMENTED, /* AddSMS */
NOTIMPLEMENTED, /* DeleteSMS */
DCT3_SendSMSMessage,
NOTSUPPORTED, /* SendSavedSMS */
+ NOTSUPPORTED, /* SetFastSMSSending */
N9210_SetIncomingSMS,
DCT3_SetIncomingCB,
NOTIMPLEMENTED, /* GetSMSFolders */
NOTSUPPORTED, /* AddSMSFolder */
NOTSUPPORTED, /* DeleteSMSFolder */
DCT3_DialVoice,
N9210_AnswerCall,
DCT3_CancelCall,
NOTSUPPORTED, /* HoldCall */
NOTSUPPORTED, /* UnholdCall */
NOTSUPPORTED, /* ConferenceCall */
NOTSUPPORTED, /* SplitCall */
NOTSUPPORTED, /* TransferCall */
NOTSUPPORTED, /* SwitchCall */
NOTSUPPORTED, /* GetCallDivert */
NOTSUPPORTED, /* SetCallDivert */
NOTSUPPORTED, /* CancelAllDiverts */
NOTSUPPORTED, /* SetIncomingCall */
NOTIMPLEMENTED, /* SetIncomingUSSD */
NOTSUPPORTED, /* SendDTMF */
NOTIMPLEMENTED, /* GetRingtone */
NOTIMPLEMENTED, /* SetRingtone */
NOTSUPPORTED, /* GetRingtonesInfo */
NOTSUPPORTED, /* DeleteUserRingtones */
NOTSUPPORTED, /* PlayTone */
NOTIMPLEMENTED, /* GetWAPBookmark */
NOTIMPLEMENTED, /* SetWAPBookmark */
NOTIMPLEMENTED, /* DeleteWAPBookmark */
NOTIMPLEMENTED, /* GetWAPSettings */
NOTSUPPORTED, /* SetWAPSettings */
NOTSUPPORTED, /* GetMMSSettings */
NOTSUPPORTED, /* SetMMSSettings */
NOTSUPPORTED, /* GetSyncMLSettings */
NOTSUPPORTED, /* SetSyncMLSettings */
NOTSUPPORTED, /* GetChatSettings */
NOTSUPPORTED, /* SetChatSettings */
N9210_GetBitmap,
N9210_SetBitmap,
NOTSUPPORTED, /* GetToDoStatus */
NOTSUPPORTED, /* GetToDo */
NOTSUPPORTED, /* GetNextToDo */
NOTSUPPORTED, /* SetToDo */
NOTSUPPORTED, /* AddToDo */
NOTSUPPORTED, /* DeleteToDo */
NOTSUPPORTED, /* DeleteAllToDo */
NOTSUPPORTED, /* GetCalendarStatus */
NOTSUPPORTED, /* GetCalendar */
NOTSUPPORTED, /* GetNextCalendar */
NOTSUPPORTED, /* SetCalendar */
NOTSUPPORTED, /* AddCalendar */
NOTSUPPORTED, /* DeleteCalendar */
NOTSUPPORTED, /* DeleteAllCalendar */
NOTSUPPORTED, /* GetCalendarSettings */
NOTSUPPORTED, /* SetCalendarSettings */
- NOTSUPPORTED, /* GetNote */
+ NOTSUPPORTED, /* GetNextNote */
NOTIMPLEMENTED, /* GetProfile */
NOTSUPPORTED, /* SetProfile */
NOTSUPPORTED, /* GetFMStation */
NOTSUPPORTED, /* SetFMStation */
NOTSUPPORTED, /* ClearFMStations */
NOTSUPPORTED, /* GetNextFileFolder */
NOTSUPPORTED, /* GetFilePart */
NOTSUPPORTED, /* AddFile */
NOTSUPPORTED, /* GetFileSystemStatus */
NOTSUPPORTED, /* DeleteFile */
NOTSUPPORTED, /* AddFolder */
NOTSUPPORTED, /* GetGPRSAccessPoint */
NOTSUPPORTED /* SetGPRSAccessPoint */
};
#endif
/* How should editor hadle tabs in this file? Add editor commands here.
* vim: noexpandtab sw=8 ts=8 sts=8:
*/
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
@@ -101,171 +101,172 @@ static GSM_Error N3320_GetDateTime(GSM_StateMachine *s, GSM_DateTime *date_time)
s->Phone.Data.DateTime=date_time;
smprintf(s, "Getting date & time\n");
return GSM_WaitFor (s, req, 6, 0x19, 4, ID_GetDateTime);
}
static GSM_Error N3320_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start)
{
return N71_65_GetNextCalendar1(s,Note,start,&s->Phone.Data.Priv.N3320.LastCalendar,&s->Phone.Data.Priv.N3320.LastCalendarYear,&s->Phone.Data.Priv.N3320.LastCalendarPos);
}
static GSM_Error N3320_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus *Status)
{
GSM_Error error;
/* Method 1 */
error=N71_65_GetCalendarInfo1(s, &s->Phone.Data.Priv.N3320.LastCalendar);
if (error!=ERR_NONE) return error;
Status->Used = s->Phone.Data.Priv.N3320.LastCalendar.Number;
return ERR_NONE;
}
static GSM_Error N3320_ReplyGetCalendarInfo(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
return N71_65_ReplyGetCalendarInfo1(msg, s, &s->Phone.Data.Priv.N3320.LastCalendar);
}
static GSM_Reply_Function N3320ReplyFunctions[] = {
{N3320_ReplyGetMemoryStatus, "\x03",0x03,0x04,ID_GetMemoryStatus },
{N3320_ReplyGetMemory, "\x03",0x03,0x08,ID_GetMemory },
{N71_65_ReplyGetNextCalendar1, "\x13",0x03,0x1A,ID_GetCalendarNote },/*method 1*/
{N3320_ReplyGetCalendarInfo, "\x13",0x03,0x3B,ID_GetCalendarNotesInfo},/*method 1*/
{N3320_ReplyGetDateTime, "\x19",0x03,0x0B,ID_GetDateTime },
{DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetModel },
{DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetFirmware },
{NULL, "\x00",0x00,0x00,ID_None }
};
GSM_Phone_Functions N3320Phone = {
"3320",
N3320ReplyFunctions,
NONEFUNCTION, /* Initialise */
NONEFUNCTION, /* Terminate */
GSM_DispatchMessage,
NOTSUPPORTED, /* ShowStartInfo */
NOKIA_GetManufacturer,
DCT3DCT4_GetModel,
DCT3DCT4_GetFirmware,
NOTSUPPORTED, /* GetIMEI */
NOTSUPPORTED, /* GetOriginalIMEI */
NOTSUPPORTED, /* GetManufactureMonth */
NOTSUPPORTED, /* GetProductCode */
NOTSUPPORTED, /* GetHardware */
NOTSUPPORTED, /* GetPPM */
NOTSUPPORTED, /* GetSIMIMSI */
N3320_GetDateTime,
NOTSUPPORTED, /* SetDateTime */
NOTSUPPORTED, /* GetAlarm */
NOTSUPPORTED, /* SetAlarm */
NOTSUPPORTED, /* GetLocale */
NOTSUPPORTED, /* SetLocale */
NOTSUPPORTED, /* PressKey */
NOTSUPPORTED, /* Reset */
NOTSUPPORTED, /* ResetPhoneSettings */
NOTSUPPORTED, /* EnterSecurityCode */
NOTSUPPORTED, /* GetSecurityStatus */
NOTSUPPORTED, /* GetDisplayStatus */
NOTSUPPORTED, /* SetAutoNetworkLogin */
NOTSUPPORTED, /* GetBatteryCharge */
NOTSUPPORTED, /* GetSignalQuality */
NOTSUPPORTED, /* GetNetworkInfo */
NOTSUPPORTED, /* GetCategory */
NOTSUPPORTED, /* AddCategory */
NOTSUPPORTED, /* GetCategoryStatus */
N3320_GetMemoryStatus,
N3320_GetMemory,
NOTSUPPORTED, /* GetNextMemory */
NOTSUPPORTED, /* SetMemory */
NOTSUPPORTED, /* AddMemory */
NOTSUPPORTED, /* DeleteMemory */
NOTIMPLEMENTED, /* DeleteAllMemory */
NOTSUPPORTED, /* GetSpeedDial */
NOTSUPPORTED, /* SetSpeedDial */
NOTSUPPORTED, /* GetSMSC */
NOTSUPPORTED, /* SetSMSC */
NOTSUPPORTED, /* GetSMSStatus */
NOTSUPPORTED, /* GetSMS */
NOTSUPPORTED, /* GetNextSMS */
NOTSUPPORTED, /* SetSMS */
NOTSUPPORTED, /* AddSMS */
NOTSUPPORTED, /* DeleteSMS */
NOTSUPPORTED, /* SendSMS */
NOTSUPPORTED, /* SendSavedSMS */
+ NOTSUPPORTED, /* SetFastSMSSending */
NOTSUPPORTED, /* SetIncomingSMS */
NOTSUPPORTED, /* SetIncomingCB */
NOTSUPPORTED, /* GetSMSFolders */
NOTSUPPORTED, /* AddSMSFolder */
NOTSUPPORTED, /* DeleteSMSFolder */
NOTIMPLEMENTED, /* DialVoice */
NOTIMPLEMENTED, /* AnswerCall */
NOTIMPLEMENTED, /* CancelCall */
NOTIMPLEMENTED, /* HoldCall */
NOTIMPLEMENTED, /* UnholdCall */
NOTIMPLEMENTED, /* ConferenceCall */
NOTIMPLEMENTED, /* SplitCall */
NOTIMPLEMENTED, /* TransferCall */
NOTIMPLEMENTED, /* SwitchCall */
NOTSUPPORTED, /* GetCallDivert */
NOTSUPPORTED, /* SetCallDivert */
NOTSUPPORTED, /* CancelAllDiverts */
NOTIMPLEMENTED, /* SetIncomingCall */
NOTIMPLEMENTED, /* SetIncomingUSSD */
NOTSUPPORTED, /* SendDTMF */
NOTSUPPORTED, /* GetRingtone */
NOTSUPPORTED, /* SetRingtone */
NOTSUPPORTED, /* GetRingtonesInfo */
NOTIMPLEMENTED, /* DeleteUserRingtones */
NOTSUPPORTED, /* PlayTone */
NOTSUPPORTED, /* GetWAPBookmark */
NOTSUPPORTED, /* SetWAPBookmark */
NOTSUPPORTED, /* DeleteWAPBookmark */
NOTSUPPORTED, /* GetWAPSettings */
NOTSUPPORTED, /* SetWAPSettings */
NOTSUPPORTED, /* GetMMSSettings */
NOTSUPPORTED, /* SetMMSSettings */
NOTSUPPORTED, /* GetSyncMLSettings */
NOTSUPPORTED, /* SetSyncMLSettings */
NOTSUPPORTED, /* GetChatSettings */
NOTSUPPORTED, /* SetChatSettings */
NOTSUPPORTED, /* GetBitmap */
NOTSUPPORTED, /* SetBitmap */
NOTSUPPORTED, /* GetToDoStatus */
NOTSUPPORTED, /* GetToDo */
NOTSUPPORTED, /* GetNextToDo */
NOTSUPPORTED, /* SetToDo */
NOTSUPPORTED, /* AddToDo */
NOTSUPPORTED, /* DeleteToDo */
NOTSUPPORTED, /* DeleteAllToDo */
N3320_GetCalendarStatus,
NOTIMPLEMENTED, /* GetCalendar */
N3320_GetNextCalendar,
NOTIMPLEMENTED, /* SetCalendar */
NOTSUPPORTED, /* AddCalendar */
NOTSUPPORTED, /* DeleteCalendar */
NOTIMPLEMENTED, /* DeleteAllCalendar */
NOTSUPPORTED, /* GetCalendarSettings */
NOTSUPPORTED, /* SetCalendarSettings */
- NOTSUPPORTED, /* GetNote */
+ NOTSUPPORTED, /* GetNextNote */
NOTSUPPORTED, /* GetProfile */
NOTSUPPORTED, /* SetProfile */
NOTSUPPORTED, /* GetFMStation */
NOTSUPPORTED, /* SetFMStation */
NOTSUPPORTED, /* ClearFMStations */
NOTSUPPORTED, /* GetNextFileFolder */
NOTSUPPORTED, /* GetFilePart */
NOTIMPLEMENTED, /* AddFilePart */
NOTSUPPORTED, /* GetFileSystemStatus */
NOTIMPLEMENTED, /* DeleteFile */
NOTIMPLEMENTED, /* AddFolder */
NOTSUPPORTED, /* GetGPRSAccessPoint */
NOTSUPPORTED /* SetGPRSAccessPoint */
};
#endif
/* How should editor hadle tabs in this file? Add editor commands here.
* vim: noexpandtab sw=8 ts=8 sts=8:
*/
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
@@ -222,171 +222,172 @@ static GSM_Error N3650_GetNextFileFolder(GSM_StateMachine *s, GSM_File *File, bo
File->Hidden = false;
return N3650_GetFolderInfo(s, File);
}
static GSM_Error N3650_Initialise (GSM_StateMachine *s)
{
GSM_Phone_N3650Data *Priv = &s->Phone.Data.Priv.N3650;
int i;
for (i=0;i<10000;i++) {
Priv->Files[i] = malloc(sizeof(GSM_File));
if (Priv->Files[i] == NULL) return ERR_MOREMEMORY;
}
return ERR_NONE;
}
static GSM_Error N3650_Terminate(GSM_StateMachine *s)
{
GSM_Phone_N3650Data *Priv = &s->Phone.Data.Priv.N3650;
int i;
for (i=0;i<10000;i++) free(Priv->Files[i]);
return ERR_NONE;
}
static GSM_Reply_Function N3650ReplyFunctions[] = {
{DCT4_ReplySetPhoneMode, "\x15",0x03,0x64,ID_Reset },
{DCT4_ReplyGetPhoneMode, "\x15",0x03,0x65,ID_Reset },
{NoneReply, "\x15",0x03,0x68,ID_Reset },
{DCT4_ReplyGetIMEI, "\x1B",0x03,0x01,ID_GetIMEI },
{NOKIA_ReplyGetPhoneString, "\x1B",0x03,0x08,ID_GetHardware },
{NOKIA_ReplyGetPhoneString, "\x1B",0x03,0x0C,ID_GetProductCode },
{N3650_ReplyGetFolderInfo, "\x58",0x03,0x0C,ID_GetFile },
{N3650_ReplyGetFilePart, "\x58",0x03,0x0E,ID_GetFile },
{NULL, "\x00",0x00,0x00,ID_None }
};
GSM_Phone_Functions N3650Phone = {
"3650|NGAGE",
N3650ReplyFunctions,
N3650_Initialise,
N3650_Terminate,
GSM_DispatchMessage,
NOTSUPPORTED, /* ShowStartInfo */
NOKIA_GetManufacturer,
DCT3DCT4_GetModel,
DCT3DCT4_GetFirmware,
DCT4_GetIMEI,
NOTSUPPORTED, /* GetOriginalIMEI */
NOTSUPPORTED, /* GetManufactureMonth */
DCT4_GetProductCode,
DCT4_GetHardware,
NOTSUPPORTED, /* GetPPM */
NOTSUPPORTED, /* GetSIMIMSI */
NOTSUPPORTED, /* GetDateTime */
NOTSUPPORTED, /* SetDateTime */
NOTSUPPORTED, /* GetAlarm */
NOTSUPPORTED, /* SetAlarm */
NOTSUPPORTED, /* GetLocale */
NOTSUPPORTED, /* SetLocale */
NOTSUPPORTED, /* PressKey */
DCT4_Reset,
NOTSUPPORTED, /* ResetPhoneSettings */
NOTSUPPORTED, /* EnterSecurityCode */
NOTSUPPORTED, /* GetSecurityStatus */
NOTSUPPORTED, /* GetDisplayStatus */
NOTSUPPORTED, /* SetAutoNetworkLogin */
NOTSUPPORTED, /* GetBatteryCharge */
NOTSUPPORTED, /* GetSignalQuality */
NOTSUPPORTED, /* GetNetworkInfo */
NOTSUPPORTED, /* GetCategory */
NOTSUPPORTED, /* AddCategory */
NOTSUPPORTED, /* GetCategoryStatus */
NOTSUPPORTED, /* GetMemoryStatus */
NOTSUPPORTED, /* GetMemory */
NOTSUPPORTED, /* GetNextMemory */
NOTSUPPORTED, /* SetMemory */
NOTSUPPORTED, /* AddMemory */
NOTSUPPORTED, /* DeleteMemory */
NOTIMPLEMENTED, /* DeleteAllMemory */
NOTSUPPORTED, /* GetSpeedDial */
NOTSUPPORTED, /* SetSpeedDial */
NOTSUPPORTED, /* GetSMSC */
NOTSUPPORTED, /* SetSMSC */
NOTSUPPORTED, /* GetSMSStatus */
NOTSUPPORTED, /* GetSMS */
NOTSUPPORTED, /* GetNextSMS */
NOTSUPPORTED, /* SetSMS */
NOTSUPPORTED, /* AddSMS */
NOTSUPPORTED, /* DeleteSMS */
NOTSUPPORTED, /* SendSMS */
NOTSUPPORTED, /* SendSavedSMS */
+ NOTSUPPORTED, /* SetFastSMSSending */
NOTSUPPORTED, /* SetIncomingSMS */
NOTSUPPORTED, /* SetIncomingCB */
NOTSUPPORTED, /* GetSMSFolders */
NOTSUPPORTED, /* AddSMSFolder */
NOTSUPPORTED, /* DeleteSMSFolder */
NOTIMPLEMENTED, /* DialVoice */
NOTIMPLEMENTED, /* AnswerCall */
NOTIMPLEMENTED, /* CancelCall */
NOTIMPLEMENTED, /* HoldCall */
NOTIMPLEMENTED, /* UnholdCall */
NOTIMPLEMENTED, /* ConferenceCall */
NOTIMPLEMENTED, /* SplitCall */
NOTIMPLEMENTED, /* TransferCall */
NOTIMPLEMENTED, /* SwitchCall */
NOTSUPPORTED, /* GetCallDivert */
NOTSUPPORTED, /* SetCallDivert */
NOTSUPPORTED, /* CancelAllDiverts */
NOTIMPLEMENTED, /* SetIncomingCall */
NOTIMPLEMENTED, /* SetIncomingUSSD */
NOTSUPPORTED, /* SendDTMF */
NOTSUPPORTED, /* GetRingtone */
NOTSUPPORTED, /* SetRingtone */
NOTSUPPORTED, /* GetRingtonesInfo */
NOTIMPLEMENTED, /* DeleteUserRingtones */
NOTSUPPORTED, /* PlayTone */
NOTSUPPORTED, /* GetWAPBookmark */
NOTSUPPORTED, /* SetWAPBookmark */
NOTSUPPORTED, /* DeleteWAPBookmark */
NOTSUPPORTED, /* GetWAPSettings */
NOTSUPPORTED, /* SetWAPSettings */
NOTSUPPORTED, /* GetMMSSettings */
NOTSUPPORTED, /* SetMMSSettings */
NOTSUPPORTED, /* GetSyncMLSettings */
NOTSUPPORTED, /* SetSyncMLSettings */
NOTSUPPORTED, /* GetChatSettings */
NOTSUPPORTED, /* SetChatSettings */
NOTSUPPORTED, /* GetBitmap */
NOTSUPPORTED, /* SetBitmap */
NOTSUPPORTED, /* GetToDoStatus */
NOTSUPPORTED, /* GetToDo */
NOTSUPPORTED, /* GetNextToDo */
NOTSUPPORTED, /* SetToDo */
NOTSUPPORTED, /* AddToDo */
NOTSUPPORTED, /* DeleteToDo */
NOTSUPPORTED, /* DeleteAllToDo */
NOTIMPLEMENTED, /* GetCalendarStatus */
NOTIMPLEMENTED, /* GetCalendar */
NOTSUPPORTED, /* GetNextCalendar */
NOTIMPLEMENTED, /* SetCalendar */
NOTSUPPORTED, /* AddCalendar */
NOTSUPPORTED, /* DeleteCalendar */
NOTIMPLEMENTED, /* DeleteAllCalendar */
NOTSUPPORTED, /* GetCalendarSettings */
NOTSUPPORTED, /* SetCalendarSettings */
- NOTSUPPORTED, /* GetNote */
+ NOTSUPPORTED, /* GetNextNote */
NOTSUPPORTED, /* GetProfile */
NOTSUPPORTED, /* SetProfile */
NOTSUPPORTED, /* GetFMStation */
NOTSUPPORTED, /* SetFMStation */
NOTSUPPORTED, /* ClearFMStations */
N3650_GetNextFileFolder,
N3650_GetFilePart,
NOTIMPLEMENTED, /* AddFilePart */
NOTSUPPORTED, /* GetFileSystemStatus */
NOTIMPLEMENTED, /* DeleteFile */
NOTIMPLEMENTED, /* AddFolder */
NOTSUPPORTED, /* GetGPRSAccessPoint */
NOTSUPPORTED /* SetGPRSAccessPoint */
};
#endif
/* How should editor hadle tabs in this file? Add editor commands here.
* vim: noexpandtab sw=8 ts=8 sts=8:
*/
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,217 +1,222 @@
/* (c) 2002-2004 by Marcin Wiacek */
-/* based on some work from Markus Plail, Pawel Kot and Gnokii */
+/* based on some Markus Plail, Pawel Kot work from Gnokii (www.gnokii.org)
+ * (C) 1999-2000 Hugh Blemings & Pavel Janik ml. (C) 2001-2004 Pawel Kot
+ * GNU GPL version 2 or later
+ */
/* function for making CRC for filesystem (c) 2003 by Michael Schroeder */
#include "../../../gsmstate.h"
#ifdef GSM_ENABLE_NOKIA6510
#include <string.h>
#include <time.h>
#include "../../../misc/coding/coding.h"
#include "../../../gsmcomon.h"
#include "../../../service/gsmlogo.h"
#include "../nfunc.h"
#include "../nfuncold.h"
#include "../../pfunc.h"
#include "dct4func.h"
#include "n6510.h"
static GSM_Error N6510_Initialise (GSM_StateMachine *s)
{
s->Phone.Data.Priv.N6510.CalendarIconsNum = 0;
/* Enables various things like incoming SMS, call info, etc. */
return N71_65_EnableFunctions (s, "\x01\x02\x06\x0A\x14\x17\x39", 7);
}
static GSM_Error N6510_ReplyGetMemory(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
smprintf(s, "Phonebook entry received\n");
switch (msg.Buffer[6]) {
case 0x0f:
return N71_65_ReplyGetMemoryError(msg.Buffer[10], s);
default:
return N71_65_DecodePhonebook(s, s->Phone.Data.Memory, s->Phone.Data.Bitmap, s->Phone.Data.SpeedDial, msg.Buffer+22, msg.Length-22,false);
}
return ERR_UNKNOWN;
}
static GSM_Error N6510_GetMemory (GSM_StateMachine *s, GSM_MemoryEntry *entry)
{
unsigned char req[] = {N6110_FRAME_HEADER, 0x07, 0x01, 0x01, 0x00, 0x01,
0xfe, 0x10, /* memory type */
0x00, 0x00, 0x00, 0x00,
0x00, 0x01, /* location */
0x00, 0x00, 0x01};
req[9] = NOKIA_GetMemoryType(s, entry->MemoryType,N71_65_MEMORY_TYPES);
if (req[9]==0xff) return ERR_NOTSUPPORTED;
if (entry->Location==0x00) return ERR_INVALIDLOCATION;
req[14] = entry->Location / 256;
req[15] = entry->Location % 256;
s->Phone.Data.Memory=entry;
smprintf(s, "Getting phonebook entry\n");
return GSM_WaitFor (s, req, 19, 0x03, 4, ID_GetMemory);
}
static GSM_Error N6510_ReplyGetMemoryStatus(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
GSM_Phone_Data *Data = &s->Phone.Data;
smprintf(s, "Memory status received\n");
/* Quess ;-)) */
if (msg.Buffer[14]==0x10) {
Data->MemoryStatus->MemoryFree = msg.Buffer[18]*256 + msg.Buffer[19];
} else {
Data->MemoryStatus->MemoryFree = msg.Buffer[17];
}
smprintf(s, "Size : %i\n",Data->MemoryStatus->MemoryFree);
Data->MemoryStatus->MemoryUsed = msg.Buffer[20]*256 + msg.Buffer[21];
smprintf(s, "Used : %i\n",Data->MemoryStatus->MemoryUsed);
Data->MemoryStatus->MemoryFree -= Data->MemoryStatus->MemoryUsed;
smprintf(s, "Free : %i\n",Data->MemoryStatus->MemoryFree);
return ERR_NONE;
}
static GSM_Error N6510_GetMemoryStatus(GSM_StateMachine *s, GSM_MemoryStatus *Status)
{
unsigned char req[] = {N6110_FRAME_HEADER, 0x03, 0x02,
0x00, /* memory type */
0x55, 0x55, 0x55, 0x00};
req[5] = NOKIA_GetMemoryType(s, Status->MemoryType,N71_65_MEMORY_TYPES);
if (req[5]==0xff) return ERR_NOTSUPPORTED;
s->Phone.Data.MemoryStatus=Status;
smprintf(s, "Getting memory status\n");
return GSM_WaitFor (s, req, 10, 0x03, 4, ID_GetMemoryStatus);
}
static GSM_Error N6510_ReplyGetSMSC(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
int i, current, j;
GSM_Phone_Data *Data = &s->Phone.Data;
switch (msg.Buffer[4]) {
case 0x00:
smprintf(s, "SMSC received\n");
break;
case 0x02:
smprintf(s, "SMSC empty\n");
return ERR_INVALIDLOCATION;
default:
smprintf(s, "Unknown SMSC state: %02x\n",msg.Buffer[4]);
return ERR_UNKNOWNRESPONSE;
}
memset(Data->SMSC,0,sizeof(GSM_SMSC));
Data->SMSC->Location = msg.Buffer[8];
Data->SMSC->Format = SMS_FORMAT_Text;
switch (msg.Buffer[10]) {
case 0x00: Data->SMSC->Format = SMS_FORMAT_Text; break;
case 0x22: Data->SMSC->Format = SMS_FORMAT_Fax; break;
case 0x26: Data->SMSC->Format = SMS_FORMAT_Pager; break;
case 0x32: Data->SMSC->Format = SMS_FORMAT_Email; break;
}
Data->SMSC->Validity.Format = SMS_Validity_RelativeFormat;
Data->SMSC->Validity.Relative = msg.Buffer[12];
+ if (msg.Buffer[12] == 0x00) Data->SMSC->Validity.Relative = SMS_VALID_Max_Time;
+
current = 14;
for (i=0;i<msg.Buffer[13];i++) {
switch (msg.Buffer[current]) {
case 0x81:
j=current+4;
while (msg.Buffer[j]!=0) {j++;}
j=j-33;
if (j>GSM_MAX_SMSC_NAME_LENGTH) {
smprintf(s, "Too long name\n");
return ERR_UNKNOWNRESPONSE;
}
CopyUnicodeString(Data->SMSC->Name,msg.Buffer+current+4);
smprintf(s, " Name \"%s\"\n", DecodeUnicodeString(Data->SMSC->Name));
break;
case 0x82:
switch (msg.Buffer[current+2]) {
case 0x01:
GSM_UnpackSemiOctetNumber(Data->SMSC->DefaultNumber,msg.Buffer+current+4,true);
smprintf(s, " Default number \"%s\"\n", DecodeUnicodeString(Data->SMSC->DefaultNumber));
break;
case 0x02:
GSM_UnpackSemiOctetNumber(Data->SMSC->Number,msg.Buffer+current+4,false);
smprintf(s, " Number \"%s\"\n", DecodeUnicodeString(Data->SMSC->Number));
break;
default:
smprintf(s, "Unknown SMSC number: %02x\n",msg.Buffer[current+2]);
return ERR_UNKNOWNRESPONSE;
}
break;
default:
smprintf(s, "Unknown SMSC block: %02x\n",msg.Buffer[current]);
return ERR_UNKNOWNRESPONSE;
}
current = current + msg.Buffer[current+1];
}
return ERR_NONE;
}
static GSM_Error N6510_GetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc)
{
unsigned char req[] = {N6110_FRAME_HEADER, 0x14,
0x01, /* location */
0x00};
if (smsc->Location==0x00) return ERR_INVALIDLOCATION;
req[4]=smsc->Location;
s->Phone.Data.SMSC=smsc;
smprintf(s, "Getting SMSC\n");
return GSM_WaitFor (s, req, 6, 0x02, 4, ID_GetSMSC);
}
static GSM_Error N6510_ReplySetSMSC(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
switch (msg.Buffer[4]) {
case 0x00:
smprintf(s, "SMSC set OK\n");
return ERR_NONE;
case 0x02:
smprintf(s, "Invalid SMSC location\n");
return ERR_INVALIDLOCATION;
default:
smprintf(s, "Unknown SMSC state: %02x\n",msg.Buffer[4]);
return ERR_UNKNOWNRESPONSE;
}
return ERR_UNKNOWNRESPONSE;
}
static GSM_Error N6510_SetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc)
{
int count = 13,i;
unsigned char req[256] = {N6110_FRAME_HEADER,
0x12, 0x55, 0x01, 0x0B, 0x34,
0x05, /* Location */
0x00,
0x00, /* Format */
0x00,
0xFF}; /* Validity */
req[8] = smsc->Location;
switch (smsc->Format) {
case SMS_FORMAT_Text: req[10] = 0x00; break;
case SMS_FORMAT_Fax: req[10] = 0x22; break;
case SMS_FORMAT_Pager: req[10] = 0x26; break;
case SMS_FORMAT_Email: req[10] = 0x32; break;
}
req[12] = smsc->Validity.Relative;
/* We have now blocks. Number of blocks = 3 */
req[count++] = 0x03;
/* -------------- SMSC number ----------------- */
/* Block type: number */
req[count++] = 0x82;
/* Offset to next block */
@@ -892,197 +897,197 @@ static GSM_Error N6510_GetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap)
GSM_MemoryEntry pbk;
GSM_Error error;
int Location;
s->Phone.Data.Bitmap=Bitmap;
switch (Bitmap->Type) {
case GSM_StartupLogo:
Bitmap->BitmapWidth = 96;
Bitmap->BitmapHeight = 65;
GSM_ClearBitmap(Bitmap);
smprintf(s, "Getting startup logo\n");
return GSM_WaitFor (s, reqStartup, 5, 0x7A, 4, ID_GetBitmap);
case GSM_DealerNote_Text:
reqNote[4] = 0x10;
smprintf(s, "Getting dealer note\n");
return GSM_WaitFor (s, reqNote, 6, 0x7A, 4, ID_GetBitmap);
case GSM_WelcomeNote_Text:
smprintf(s, "Getting welcome note\n");
return GSM_WaitFor (s, reqNote, 6, 0x7A, 4, ID_GetBitmap);
case GSM_CallerGroupLogo:
if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_PBK35)) return ERR_NOTSUPPORTED;
Bitmap->BitmapWidth = 72;
Bitmap->BitmapHeight = 14;
GSM_ClearBitmap(Bitmap);
pbk.MemoryType = MEM7110_CG;
pbk.Location = Bitmap->Location;
smprintf(s, "Getting caller group logo\n");
error=N6510_GetMemory(s,&pbk);
if (error==ERR_NONE) NOKIA_GetDefaultCallerGroupName(s, Bitmap);
return error;
case GSM_OperatorLogo:
smprintf(s, "Getting operator logo\n");
return GSM_WaitFor (s, reqOp, 9, 0x0A, 4, ID_GetBitmap);
case GSM_PictureImage:
return N6510_GetPictureImage(s, Bitmap, &Location);
default:
break;
}
return ERR_NOTSUPPORTED;
}
static GSM_Error N6510_ReplyGetIncSignalQuality(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
smprintf(s, "Network level changed to: %i\n",msg.Buffer[4]);
return ERR_NONE;
}
static GSM_Error N6510_ReplyGetSignalQuality(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
GSM_Phone_Data *Data = &s->Phone.Data;
smprintf(s, "Network level received: %i\n",msg.Buffer[8]);
Data->SignalQuality->SignalStrength = -1;
Data->SignalQuality->SignalPercent = ((int)msg.Buffer[8]);
Data->SignalQuality->BitErrorRate = -1;
return ERR_NONE;
}
static GSM_Error N6510_GetSignalQuality(GSM_StateMachine *s, GSM_SignalQuality *sig)
{
unsigned char req[] = {N6110_FRAME_HEADER, 0x0B, 0x00, 0x02, 0x00, 0x00, 0x00};
s->Phone.Data.SignalQuality = sig;
smprintf(s, "Getting network level\n");
return GSM_WaitFor (s, req, 9, 0x0a, 4, ID_GetSignalQuality);
}
static GSM_Error N6510_ReplyGetBatteryCharge(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
GSM_Phone_Data *Data = &s->Phone.Data;
smprintf(s, "Battery level received: %i\n",msg.Buffer[9]*100/7);
Data->BatteryCharge->BatteryPercent = ((int)(msg.Buffer[9]*100/7));
Data->BatteryCharge->ChargeState = 0;
return ERR_NONE;
}
static GSM_Error N6510_GetBatteryCharge(GSM_StateMachine *s, GSM_BatteryCharge *bat)
{
unsigned char req[] = {N6110_FRAME_HEADER, 0x0A, 0x02, 0x00};
s->Phone.Data.BatteryCharge = bat;
smprintf(s, "Getting battery level\n");
return GSM_WaitFor (s, req, 6, 0x17, 4, ID_GetBatteryCharge);
}
static GSM_Error N6510_ReplyGetWAPBookmark(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
return DCT3DCT4_ReplyGetWAPBookmark (msg, s, true);
}
static GSM_Error N6510_ReplyGetOperatorLogo(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
GSM_Phone_Data *Data = &s->Phone.Data;
smprintf(s, "Operator logo received\n");
+ if (msg.Length == 18) return ERR_EMPTY;
NOKIA_DecodeNetworkCode(msg.Buffer+12,Data->Bitmap->NetworkCode);
smprintf(s, "Network code %s\n",Data->Bitmap->NetworkCode);
Data->Bitmap->BitmapWidth = msg.Buffer[20];
Data->Bitmap->BitmapHeight = msg.Buffer[21];
- if (msg.Length == 18) return ERR_EMPTY;
PHONE_DecodeBitmap(GSM_Nokia6510OperatorLogo,msg.Buffer+26,Data->Bitmap);
return ERR_NONE;
}
GSM_Error N6510_ReplyDeleteMemory(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
smprintf(s, "Phonebook entry deleted\n");
return ERR_NONE;
}
GSM_Error N6510_DeleteMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
{
unsigned char req[] = {N7110_FRAME_HEADER, 0x0f, 0x55, 0x01,
0x04, 0x55, 0x00, 0x10, 0xFF, 0x02,
0x00, 0x01, /* location */
0x00, 0x00, 0x00, 0x00,
0x05, /* memory type */
0x55, 0x55, 0x55};
req[12] = entry->Location / 256;
req[13] = entry->Location % 256;
req[18] = NOKIA_GetMemoryType(s, entry->MemoryType,N71_65_MEMORY_TYPES);
if (req[18]==0xff) return ERR_NOTSUPPORTED;
smprintf(s, "Deleting phonebook entry\n");
return GSM_WaitFor (s, req, 22, 0x03, 4, ID_SetMemory);
}
static GSM_Error N6510_SetMemory(GSM_StateMachine *s, GSM_MemoryEntry *entry)
{
int count = 22, blocks;
unsigned char req[500] = {
N7110_FRAME_HEADER, 0x0b, 0x00, 0x01, 0x01, 0x00, 0x00, 0x10,
0x02, 0x00, /* memory type */
0x00, 0x00, /* location */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
if (entry->Location == 0) return ERR_NOTSUPPORTED;
req[11] = NOKIA_GetMemoryType(s, entry->MemoryType,N71_65_MEMORY_TYPES);
if (req[11]==0xff) return ERR_NOTSUPPORTED;
req[12] = entry->Location / 256;
req[13] = entry->Location % 256;
count = count + N71_65_EncodePhonebookFrame(s, req+22, *entry, &blocks, true, IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_VOICETAGS));
req[21] = blocks;
smprintf(s, "Writing phonebook entry\n");
return GSM_WaitFor (s, req, count, 0x03, 4, ID_SetMemory);
}
static GSM_Error N6510_ReplySetOperatorLogo(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
smprintf(s, "Operator logo set OK\n");
return ERR_NONE;
}
static GSM_Error N6510_SetCallerLogo(GSM_StateMachine *s, GSM_Bitmap *bitmap)
{
char string[500];
int block=0, i, Width, Height;
unsigned int count = 22;
unsigned char req[500] = {
N6110_FRAME_HEADER, 0x0b, 0x00, 0x01, 0x01, 0x00, 0x00, 0x10,
0xfe, 0x10, /* memory type */
0x00, 0x00, /* location */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
req[13] = bitmap->Location;
/* Enabling/disabling logo */
string[0] = bitmap->BitmapEnabled?1:0;
string[1] = 0;
count += N71_65_PackPBKBlock(s, N7110_PBK_LOGOON, 2, block++, string, req + count);
/* Ringtone */
if (!bitmap->DefaultRingtone) {
if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_PBKTONEGAL)) {
} else {
string[0] = 0x00;
string[1] = 0x00;
string[2] = bitmap->RingtoneID;
count += N71_65_PackPBKBlock(s, N7110_PBK_RINGTONE_ID, 3, block++, string, req + count);
count --;
req[count-5] = 8;
}
}
/* Number of group */
string[0] = bitmap->Location;
string[1] = 0;
count += N71_65_PackPBKBlock(s, N7110_PBK_GROUP, 2, block++, string, req + count);
/* Name */
@@ -1672,193 +1677,194 @@ static GSM_Error N6510_GetConnectionSettings(GSM_StateMachine *s, GSM_MultiWAPSe
switch (Type) {
case N6510_MMS_SETTINGS:
smprintf(s, "Getting MMS settings\n");
Priv->BearerNumber = 1;
break;
case N6510_WAP_SETTINGS:
smprintf(s, "Getting WAP settings\n");
Priv->BearerNumber = 2;
break;
case N6510_SYNCML_SETTINGS:
smprintf(s, "Getting SyncML settings\n");
Priv->BearerNumber = 2;
break;
case N6510_CHAT_SETTINGS:
smprintf(s, "Getting Chat settings\n");
Priv->BearerNumber = 1;
break;
}
error=GSM_WaitFor (s, req, 5, 0x3f, 4, ID_GetConnectSet);
if (error != ERR_NONE) {
if (error == ERR_INVALIDLOCATION || error == ERR_INSIDEPHONEMENU) {
DCT3DCT4_DisableConnectionFunctions(s);
}
return error;
}
error=DCT3DCT4_GetActiveConnectSet(s);
if (error != ERR_NONE) return error;
return DCT3DCT4_DisableConnectionFunctions(s);
}
static GSM_Error N6510_GetWAPSettings(GSM_StateMachine *s, GSM_MultiWAPSettings *settings)
{
return N6510_GetConnectionSettings(s, settings, N6510_WAP_SETTINGS);
}
static GSM_Error N6510_GetMMSSettings(GSM_StateMachine *s, GSM_MultiWAPSettings *settings)
{
return N6510_GetConnectionSettings(s, settings, N6510_MMS_SETTINGS);
}
static GSM_Error N6510_ReplyGetSyncMLSettings(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
GSM_SyncMLSettings *Sett = s->Phone.Data.SyncMLSettings;
smprintf(s, "SyncML settings received OK\n");
CopyUnicodeString(Sett->User,msg.Buffer+18);
CopyUnicodeString(Sett->Password,msg.Buffer+86);
CopyUnicodeString(Sett->PhonebookDataBase,msg.Buffer+130);
CopyUnicodeString(Sett->CalendarDataBase,msg.Buffer+234);
CopyUnicodeString(Sett->Server,msg.Buffer+338);
Sett->SyncPhonebook = false;
Sett->SyncCalendar = false;
if ((msg.Buffer[598] & 0x02)==0x02) Sett->SyncCalendar = true;
if ((msg.Buffer[598] & 0x01)==0x01) Sett->SyncPhonebook = true;
return ERR_NONE;
}
static GSM_Error N6510_ReplyGetSyncMLName(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
GSM_SyncMLSettings *Sett = s->Phone.Data.SyncMLSettings;
smprintf(s, "SyncML names received OK\n");
CopyUnicodeString(Sett->Name,msg.Buffer+18);
return ERR_NONE;
}
static GSM_Error N6510_GetSyncMLSettings(GSM_StateMachine *s, GSM_SyncMLSettings *settings)
{
GSM_Error error;
// unsigned char NameReq[] = {N6110_FRAME_HEADER, 0x05,
// 0x00, 0x00, 0x00, 0x31, 0x00,
// 0x06, 0x00, 0x00, 0x00, 0xDE, 0x00, 0x00};
// unsigned char GetActive[] = {N6110_FRAME_HEADER, 0x05,
// 0x00, 0x00, 0x00, 0x31, 0x00,
// 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00};
unsigned char req[] = {N6110_FRAME_HEADER, 0x05,
0x00, 0x00, 0x00, 0x31, 0x00,
0x01, //location
0x00, 0x00, 0x02, 0x46, 0x00, 0x00};
settings->Connection.Location = settings->Location;
error = N6510_GetConnectionSettings(s, &settings->Connection, N6510_SYNCML_SETTINGS);
if (error != ERR_NONE) return error;
settings->Active = settings->Connection.Active;
settings->Name[0] = 0;
settings->Name[1] = 0;
-// s->Phone.Data.SyncMLSettings = settings;
+ s->Phone.Data.SyncMLSettings = settings;
+
// smprintf(s, "Getting SyncML settings name\n");
// error = GSM_WaitFor (s, NameReq, 16, 0x43, 4, ID_GetSyncMLName);
// if (error != ERR_NONE) return error;
req[9] = settings->Location - 1;
smprintf(s, "Getting additional SyncML settings\n");
return GSM_WaitFor (s, req, 16, 0x43, 4, ID_GetSyncMLSettings);
}
static GSM_Error N6510_ReplyGetChatSettings(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
GSM_ChatSettings *Sett = s->Phone.Data.ChatSettings;
int i;
Sett->Name[0] = 0;
Sett->Name[1] = 0;
Sett->HomePage[0] = 0;
Sett->HomePage[1] = 0;
Sett->User[0] = 0;
Sett->User[1] = 0;
Sett->Password[0] = 0;
Sett->Password[1] = 0;
switch(msg.Buffer[3]) {
case 0x3B:
smprintf(s, "Chat settings received OK\n");
memcpy(Sett->Name,msg.Buffer+20,msg.Buffer[12]*2);
Sett->Name[msg.Buffer[12]*2] = 0;
Sett->Name[msg.Buffer[12]*2+1] = 0;
memcpy(Sett->HomePage,msg.Buffer+20+msg.Buffer[12]*2,msg.Buffer[15]*2);
Sett->HomePage[msg.Buffer[15]*2] = 0;
Sett->HomePage[msg.Buffer[15]*2+1] = 0;
i = msg.Buffer[12]*2 + msg.Buffer[15]*2 + 29;
memcpy(Sett->User,msg.Buffer+i+3,msg.Buffer[i]*2);
Sett->User[msg.Buffer[i]*2] = 0;
Sett->User[msg.Buffer[i]*2+1] = 0;
memcpy(Sett->Password,msg.Buffer+i+3+msg.Buffer[i]*2,msg.Buffer[i+1]*2);
Sett->Password[msg.Buffer[i+1]*2] = 0;
Sett->Password[msg.Buffer[i+1]*2+1] = 0;
return ERR_NONE;
case 0x3C:
smprintf(s, "Empty chat settings received\n");
return ERR_NONE;
}
return ERR_UNKNOWNRESPONSE;
}
static GSM_Error N6510_GetChatSettings(GSM_StateMachine *s, GSM_ChatSettings *settings)
{
GSM_Error error;
unsigned char req[] = {N6110_FRAME_HEADER, 0x3a,
0x09, // location
0x01, 0x0e};
settings->Connection.Location = settings->Location;
error = N6510_GetConnectionSettings(s, &settings->Connection, N6510_CHAT_SETTINGS);
if (error != ERR_NONE) return error;
settings->Active = settings->Connection.Active;
s->Phone.Data.ChatSettings = settings;
req[4] = settings->Location - 1;
smprintf(s, "Getting additional Chat settings\n");
return GSM_WaitFor (s, req, 7, 0x3f, 4, ID_GetChatSettings);
}
static GSM_Error N6510_ReplySetConnectionSettings(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
switch (msg.Buffer[3]) {
case 0x19:
smprintf(s, "Connection settings cleaned\n");
return ERR_NONE;
case 0x1a:
smprintf(s, "Connection settings setting status\n");
switch (msg.Buffer[4]) {
case 0x01:
smprintf(s, "Security error. Inside phone settings menu\n");
return ERR_INSIDEPHONEMENU;
case 0x03:
smprintf(s, "Invalid location\n");
return ERR_INVALIDLOCATION;
case 0x05:
smprintf(s, "Written OK\n");
return ERR_NONE;
default:
smprintf(s, "ERROR: unknown %i\n",msg.Buffer[4]);
return ERR_UNKNOWNRESPONSE;
}
case 0x28:
case 0x2B:
smprintf(s, "Set OK\n");
return ERR_NONE;
}
return ERR_UNKNOWNRESPONSE;
}
@@ -2190,193 +2196,193 @@ static GSM_Error N6510_ReplyGetSMSStatus(GSM_Protocol_Message msg, GSM_StateMach
case 0x00:
smprintf(s, "Max. in phone memory : %i\n",msg.Buffer[10]*256+msg.Buffer[11]);
smprintf(s, "Used in phone memory : %i\n",msg.Buffer[12]*256+msg.Buffer[13]);
smprintf(s, "Unread in phone memory : %i\n",msg.Buffer[14]*256+msg.Buffer[15]);
smprintf(s, "Max. in SIM : %i\n",msg.Buffer[22]*256+msg.Buffer[23]);
smprintf(s, "Used in SIM : %i\n",msg.Buffer[24]*256+msg.Buffer[25]);
smprintf(s, "Unread in SIM : %i\n",msg.Buffer[26]*256+msg.Buffer[27]);
Data->SMSStatus->PhoneSize = msg.Buffer[10]*256+msg.Buffer[11];
Data->SMSStatus->PhoneUsed = msg.Buffer[12]*256+msg.Buffer[13];
Data->SMSStatus->PhoneUnRead = msg.Buffer[14]*256+msg.Buffer[15];
Data->SMSStatus->SIMSize = msg.Buffer[22]*256+msg.Buffer[23];
Data->SMSStatus->SIMUsed = msg.Buffer[24]*256+msg.Buffer[25];
Data->SMSStatus->SIMUnRead = msg.Buffer[26]*256+msg.Buffer[27];
return ERR_NONE;
case 0x0f:
smprintf(s, "No PIN\n");
return ERR_SECURITYERROR;
default:
smprintf(s, "ERROR: unknown %i\n",msg.Buffer[4]);
return ERR_UNKNOWNRESPONSE;
}
case 0x1a:
smprintf(s, "Wait a moment. Phone is during power on and busy now\n");
return ERR_SECURITYERROR;
}
return ERR_UNKNOWNRESPONSE;
}
static GSM_Error N6510_GetSMSStatus(GSM_StateMachine *s, GSM_SMSMemoryStatus *status)
{
GSM_Error error;
GSM_Phone_N6510Data *Priv = &s->Phone.Data.Priv.N6510;
unsigned char req[] = {N6110_FRAME_HEADER, 0x08, 0x00, 0x00};
s->Phone.Data.SMSStatus=status;
smprintf(s, "Getting SMS status\n");
error = GSM_WaitFor (s, req, 6, 0x14, 2, ID_GetSMSStatus);
if (error != ERR_NONE) return error;
/* DCT4 family doesn't show in frame with SMS status info
* about Templates. We get separately info about this SMS folder.
*/
error = N6510_GetSMSFolderStatus(s, 0x06);
if (error != ERR_NONE) return error;
status->TemplatesUsed = Priv->LastSMSFolder.Number;
return error;
}
static GSM_Error N6510_ReplyDeleteSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
switch (msg.Buffer[3]) {
case 0x05:
smprintf(s, "SMS deleted OK\n");
return ERR_NONE;
case 0x06:
switch (msg.Buffer[4]) {
case 0x02:
smprintf(s, "Invalid location\n");
return ERR_INVALIDLOCATION;
default:
smprintf(s, "Unknown error: %02x\n",msg.Buffer[4]);
return ERR_UNKNOWNRESPONSE;
}
}
return ERR_UNKNOWNRESPONSE;
}
static GSM_Error N6510_DeleteSMSMessage(GSM_StateMachine *s, GSM_SMSMessage *sms)
{
unsigned char folderid;
int location;
unsigned char req[] = {N6110_FRAME_HEADER, 0x04,
0x01, /* 0x01=SM, 0x02=ME */
0x00, /* FolderID */
0x00, 0x02, /* Location */
0x0F, 0x55};
N6510_GetSMSLocation(s, sms, &folderid, &location);
switch (folderid) {
case 0x01: req[5] = 0x02; break; /* INBOX SIM */
case 0x02: req[5] = 0x03; break; /* OUTBOX SIM */
default : req[5] = folderid - 1; req[4] = 0x02; break; /* ME folders */
}
req[6]=location / 256;
req[7]=location;
smprintf(s, "Deleting sms\n");
return GSM_WaitFor (s, req, 10, 0x14, 4, ID_DeleteSMSMessage);
}
static GSM_Error N6510_ReplySendSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
switch (msg.Buffer[8]) {
case 0x00:
- smprintf(s, "SMS sent OK, TPMR for sent sms is %02x\n",msg.Buffer[10]);
+ smprintf(s, "SMS sent OK, TPMR for sent sms is %d\n",msg.Buffer[10]);
if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,0,msg.Buffer[10]);
return ERR_NONE;
default:
smprintf(s, "SMS not sent OK, error code probably %i\n",msg.Buffer[8]);
if (s->User.SendSMSStatus!=NULL) s->User.SendSMSStatus(s->CurrentConfig->Device,msg.Buffer[8],msg.Buffer[10]);
return ERR_NONE;
}
}
static GSM_Error N6510_SendSMSMessage(GSM_StateMachine *s, GSM_SMSMessage *sms)
{
int length = 11;
GSM_Error error;
GSM_SMSMessageLayout Layout;
unsigned char req [300] = {
N6110_FRAME_HEADER, 0x02, 0x00, 0x00, 0x00, 0x55, 0x55};
if (sms->PDU == SMS_Deliver) sms->PDU = SMS_Submit;
memset(req+9,0x00,sizeof(req) - 9);
error=N6510_EncodeSMSFrame(s, sms, req + 9, &Layout, &length);
if (error != ERR_NONE) return error;
smprintf(s, "Sending sms\n");
return s->Protocol.Functions->WriteMessage(s, req, length + 9, 0x02);
}
static GSM_Error N6510_ReplyGetSecurityStatus(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
GSM_Phone_Data *Data = &s->Phone.Data;
smprintf(s, "Security Code status received: ");
switch (msg.Buffer[4]) {
case 0x01 : smprintf(s, "waiting for Security Code.\n"); *Data->SecurityStatus = SEC_SecurityCode; break;
case 0x07 :
case 0x02 : smprintf(s, "waiting for PIN.\n"); *Data->SecurityStatus = SEC_Pin; break;
case 0x03 : smprintf(s, "waiting for PUK.\n"); *Data->SecurityStatus = SEC_Puk; break;
case 0x05 : smprintf(s, "PIN ok, SIM ok\n"); *Data->SecurityStatus = SEC_None; break;
case 0x06 : smprintf(s, "No input status\n"); *Data->SecurityStatus = SEC_None; break;
case 0x16 : smprintf(s, "No SIM card\n"); *Data->SecurityStatus = SEC_None; break;
case 0x1A : smprintf(s, "SIM card rejected!\n"); *Data->SecurityStatus = SEC_None; break;
default : smprintf(s, "ERROR: unknown %i\n",msg.Buffer[4]);
return ERR_UNKNOWNRESPONSE;
}
return ERR_NONE;
}
static GSM_Error N6510_GetSecurityStatus(GSM_StateMachine *s, GSM_SecurityCodeType *Status)
{
unsigned char req[5] = {N6110_FRAME_HEADER, 0x11, 0x00};
s->Phone.Data.SecurityStatus=Status;
smprintf(s, "Getting security code status\n");
return GSM_WaitFor (s, req, 5, 0x08, 2, ID_GetSecurityStatus);
}
static GSM_Error N6510_ReplyEnterSecurityCode(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
switch (msg.Buffer[3]) {
case 0x08:
smprintf(s, "Security code OK\n");
return ERR_NONE;
case 0x09:
switch (msg.Buffer[4]) {
case 0x06:
smprintf(s, "Wrong PIN\n");
return ERR_SECURITYERROR;
case 0x09:
smprintf(s, "Wrong PUK\n");
return ERR_SECURITYERROR;
default:
smprintf(s, "ERROR: unknown %i\n",msg.Buffer[4]);
}
}
return ERR_UNKNOWNRESPONSE;
}
static GSM_Error N6510_EnterSecurityCode(GSM_StateMachine *s, GSM_SecurityCode Code)
{
int len = 0;
unsigned char req[15] = {N6110_FRAME_HEADER, 0x07,
0x00}; /* Code type */
switch (Code.Type) {
case SEC_Pin : req[4] = 0x02; break;
case SEC_Puk : req[4] = 0x03; break;/* FIXME */
default : return ERR_NOTSUPPORTED;
}
len = strlen(Code.Code);
memcpy(req+5,Code.Code,len);
req[5+len]=0x00;
smprintf(s, "Entering security code\n");
return GSM_WaitFor (s, req, 6+len, 0x08, 4, ID_EnterSecurityCode);
}
@@ -2677,192 +2683,193 @@ static GSM_Error N6510_ReplyGetRingtonesInfo(GSM_Protocol_Message msg, GSM_State
memcpy(Data->RingtonesInfo->Ringtone[i].Name,msg.Buffer+tmp+8,(msg.Buffer[tmp+6]*256+msg.Buffer[tmp+7])*2);
smprintf(s, "%5i (%5i). \"%s\"\n",
Data->RingtonesInfo->Ringtone[i].ID,
Data->RingtonesInfo->Ringtone[i].Group,
DecodeUnicodeString(Data->RingtonesInfo->Ringtone[i].Name));
tmp = tmp + (msg.Buffer[tmp]*256+msg.Buffer[tmp+1]);
}
return ERR_NONE;
}
static GSM_Error N6510_PrivGetRingtonesInfo(GSM_StateMachine *s, GSM_AllRingtonesInfo *Info, bool AllRingtones)
{
GSM_Error error;
unsigned char UserReq[8] = {N7110_FRAME_HEADER, 0x07, 0x00, 0x00, 0x00, 0x02};
// unsigned char All_Req[9] = {N7110_FRAME_HEADER, 0x07, 0x00, 0x00, 0xFE, 0x00, 0x7D};
unsigned char All_Req[8] = {N7110_FRAME_HEADER, 0x07, 0x00, 0x00, 0x00, 0x00};
s->Phone.Data.RingtonesInfo=Info;
smprintf(s, "Getting binary ringtones ID\n");
if (AllRingtones) {
// error = GSM_WaitFor (s, All_Req, 9, 0x1f, 4, ID_GetRingtonesInfo);
error = GSM_WaitFor (s, All_Req, 8, 0x1f, 4, ID_GetRingtonesInfo);
if (error == ERR_EMPTY && Info->Number == 0) return ERR_NOTSUPPORTED;
return error;
} else {
error = GSM_WaitFor (s, UserReq, 8, 0x1f, 4, ID_GetRingtonesInfo);
if (error == ERR_EMPTY && Info->Number == 0) return ERR_NOTSUPPORTED;
return error;
}
}
static GSM_Error N6510_GetRingtonesInfo(GSM_StateMachine *s, GSM_AllRingtonesInfo *Info)
{
return N6510_PrivGetRingtonesInfo(s, Info, true);
}
static GSM_Error N6510_ReplyGetRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
int tmp,i;
GSM_Phone_Data *Data = &s->Phone.Data;
smprintf(s, "Ringtone received\n");
memcpy(Data->Ringtone->Name,msg.Buffer+8,msg.Buffer[7]*2);
Data->Ringtone->Name[msg.Buffer[7]*2]=0;
Data->Ringtone->Name[msg.Buffer[7]*2+1]=0;
smprintf(s, "Name \"%s\"\n",DecodeUnicodeString(Data->Ringtone->Name));
if (msg.Buffer[msg.Buffer[7]*2+10] == 'M' &&
msg.Buffer[msg.Buffer[7]*2+11] == 'T' &&
msg.Buffer[msg.Buffer[7]*2+12] == 'h' &&
msg.Buffer[msg.Buffer[7]*2+13] == 'd') {
smprintf(s,"MIDI\n");
tmp = msg.Buffer[7]*2+10;
i = msg.Length - 2; /* ?????? */
Data->Ringtone->Format = RING_MIDI;
} else {
/* Looking for end */
i=8+msg.Buffer[7]*2+3;
tmp = i;
while (true) {
if (msg.Buffer[i]==0x07 && msg.Buffer[i+1]==0x0b) {
i=i+2; break;
}
i++;
if (i==msg.Length) return ERR_EMPTY;
}
}
/* Copying frame */
memcpy(Data->Ringtone->NokiaBinary.Frame,msg.Buffer+tmp,i-tmp);
Data->Ringtone->NokiaBinary.Length=i-tmp;
return ERR_NONE;
}
static GSM_Error N6510_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, bool PhoneRingtone)
{
GSM_AllRingtonesInfo Info;
GSM_Error error;
unsigned char req2[6] = {N7110_FRAME_HEADER, 0x12,
0x00, 0xe7}; /* Location */
if (Ringtone->Format == 0x00) Ringtone->Format = RING_NOKIABINARY;
switch (Ringtone->Format) {
case RING_NOTETONE:
/* In the future get binary and convert */
return ERR_NOTSUPPORTED;
case RING_NOKIABINARY:
s->Phone.Data.Ringtone = Ringtone;
Info.Number = 0;
error=N6510_PrivGetRingtonesInfo(s, &Info, PhoneRingtone);
if (error != ERR_NONE) return error;
if (Ringtone->Location > Info.Number) return ERR_INVALIDLOCATION;
req2[4] = Info.Ringtone[Ringtone->Location-1].ID / 256;
req2[5] = Info.Ringtone[Ringtone->Location-1].ID % 256;
smprintf(s, "Getting binary ringtone\n");
return GSM_WaitFor (s, req2, 6, 0x1f, 4, ID_GetRingtone);
case RING_MIDI:
+ case RING_MMF:
return ERR_NOTSUPPORTED;
}
return ERR_NOTSUPPORTED;
}
static GSM_Error N6510_PlayTone(GSM_StateMachine *s, int Herz, unsigned char Volume, bool start)
{
GSM_Error error;
unsigned char reqStart[] = {
0x00,0x06,0x01,0x00,0x07,0x00 };
unsigned char reqPlay[] = {
0x00,0x06,0x01,0x14,0x05,0x04,
0x00,0x00,0x00,0x03,0x03,0x08,
0x00,0x00,0x00,0x01,0x00,0x00,
0x03,0x08,0x01,0x00,
0x07,0xd0, /*Frequency */
0x00,0x00,0x03,0x08,0x02,0x00,0x00,
0x05, /*Volume */
0x00,0x00};
unsigned char reqOff[] = {
0x00,0x06,0x01,0x14,0x05,0x05,
0x00,0x00,0x00,0x01,0x03,0x08,
0x05,0x00,0x00,0x08,0x00,0x00};
// unsigned char reqOff2[] = {
// 0x00,0x06,0x01,0x14,0x05,0x04,
// 0x00,0x00,0x00,0x01,0x03,0x08,
// 0x00,0x00,0x00,0x00,0x00,0x00};
if (start) {
smprintf(s, "Enabling sound - part 1\n");
error=GSM_WaitFor (s, reqStart, 6, 0x0b, 4, ID_PlayTone);
if (error!=ERR_NONE) return error;
smprintf(s, "Enabling sound - part 2 (disabling sound command)\n");
error=GSM_WaitFor (s, reqOff, 18, 0x0b, 4, ID_PlayTone);
if (error!=ERR_NONE) return error;
}
/* For Herz==255*255 we have silent */
if (Herz!=255*255) {
reqPlay[23] = Herz%256;
reqPlay[22] = Herz/256;
reqPlay[31] = Volume;
smprintf(s, "Playing sound\n");
return GSM_WaitFor (s, reqPlay, 34, 0x0b, 4, ID_PlayTone);
} else {
reqPlay[23] = 0;
reqPlay[22] = 0;
reqPlay[31] = 0;
smprintf(s, "Playing silent sound\n");
return GSM_WaitFor (s, reqPlay, 34, 0x0b, 4, ID_PlayTone);
// smprintf(s, "Disabling sound - part 1\n");
// error=GSM_WaitFor (s, reqOff, 18, 0x0b, 4, ID_PlayTone);
// if (error!=ERR_NONE) return error;
// smprintf(s, "Disabling sound - part 2\n");
// return GSM_WaitFor (s, reqOff2, 18, 0x0b, 4, ID_PlayTone);
}
}
static GSM_Error N6510_ReplyGetPPM(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
GSM_Phone_Data *Data = &s->Phone.Data;
int pos = 6,len;
smprintf(s, "Received phone info\n");
while(pos < msg.Length) {
if (msg.Buffer[pos] == 0x55 && msg.Buffer[pos+1] == 0x55) {
while(1) {
if (msg.Buffer[pos] != 0x55) break;
pos++;
}
}
len = pos;
while(1) {
if (msg.Buffer[len] == 0x00 && msg.Buffer[len+1] == 0x00) break;
len++;
}
while(1) {
if (msg.Buffer[len] != 0x00) break;
len++;
}
len = len-pos;
smprintf(s, "Block with ID %02x",msg.Buffer[pos]);
#ifdef DEBUG
if (di.dl == DL_TEXTALL || di.dl == DL_TEXTALLDATE) DumpMessage(di.df, di.dl, msg.Buffer+pos, len);
#endif
switch (msg.Buffer[pos]) {
case 0x49:
smprintf(s, "hardware version\n");
break;
case 0x58:
pos += 3;
while (msg.Buffer[pos] != 0x00) pos++;
Data->PhoneString[0] = msg.Buffer[pos - 1];
Data->PhoneString[1] = 0x00;
@@ -2893,701 +2900,740 @@ static GSM_Error N6510_GetSpeedDial(GSM_StateMachine *s, GSM_SpeedDial *SpeedDia
pbk.MemoryType = MEM7110_SP;
pbk.Location = SpeedDial->Location;
SpeedDial->MemoryLocation = 0;
s->Phone.Data.SpeedDial = SpeedDial;
smprintf(s, "Getting speed dial\n");
error=N6510_GetMemory(s,&pbk);
switch (error) {
case ERR_NOTSUPPORTED:
smprintf(s, "No speed dials set in phone\n");
return ERR_EMPTY;
case ERR_NONE:
if (SpeedDial->MemoryLocation == 0) {
smprintf(s, "Speed dial not assigned or error in firmware\n");
return ERR_EMPTY;
}
return ERR_NONE;
default:
return error;
}
}
static GSM_Error N6510_ReplyGetProfile(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
unsigned char *blockstart;
int i,j;
GSM_Phone_Data *Data = &s->Phone.Data;
switch (msg.Buffer[3]) {
case 0x02:
blockstart = msg.Buffer + 7;
for (i = 0; i < 11; i++) {
smprintf(s, "Profile feature %02x ",blockstart[1]);
#ifdef DEBUG
if (di.dl == DL_TEXTALL || di.dl == DL_TEXTALLDATE) DumpMessage(di.df, di.dl, blockstart, blockstart[0]);
#endif
switch (blockstart[1]) {
case 0x03:
smprintf(s, "Ringtone ID\n");
Data->Profile->FeatureID [Data->Profile->FeaturesNumber] = Profile_RingtoneID;
Data->Profile->FeatureValue [Data->Profile->FeaturesNumber] = blockstart[7];
if (blockstart[7] == 0x00) {
Data->Profile->FeatureValue[Data->Profile->FeaturesNumber] = blockstart[10];
}
Data->Profile->FeaturesNumber++;
break;
case 0x05: /* SMS tone */
j = Data->Profile->FeaturesNumber;
NOKIA_FindFeatureValue(s, Profile71_65,blockstart[1],blockstart[7],Data,false);
if (j == Data->Profile->FeaturesNumber) {
Data->Profile->FeatureID [Data->Profile->FeaturesNumber] = Profile_MessageTone;
Data->Profile->FeatureValue [Data->Profile->FeaturesNumber] = PROFILE_MESSAGE_PERSONAL;
Data->Profile->FeaturesNumber++;
Data->Profile->FeatureID [Data->Profile->FeaturesNumber] = Profile_MessageToneID;
Data->Profile->FeatureValue [Data->Profile->FeaturesNumber] = blockstart[7];
Data->Profile->FeaturesNumber++;
}
break;
case 0x08: /* Caller groups */
NOKIA_FindFeatureValue(s, Profile71_65,blockstart[1],blockstart[7],Data,true);
break;
case 0x0c :
CopyUnicodeString(Data->Profile->Name,blockstart + 7);
smprintf(s, "profile Name: \"%s\"\n", DecodeUnicodeString(Data->Profile->Name));
Data->Profile->DefaultName = false;
break;
default:
NOKIA_FindFeatureValue(s, Profile71_65,blockstart[1],blockstart[7],Data,false);
}
blockstart = blockstart + blockstart[0];
}
return ERR_NONE;
case 0x06:
Data->Profile->Active = false;
if (Data->Profile->Location == msg.Buffer[5]) Data->Profile->Active = true;
return ERR_NONE;
}
return ERR_UNKNOWNRESPONSE;
}
static GSM_Error N6510_GetProfile(GSM_StateMachine *s, GSM_Profile *Profile)
{
unsigned char req[150] = {N6110_FRAME_HEADER, 0x01, 0x01, 0x0C, 0x01};
unsigned char reqActive[] = {N6110_FRAME_HEADER, 0x05};
int i, length = 7;
GSM_Error error;
/* For now !!! */
if (!strcmp(s->Phone.Data.ModelInfo->model,"3510")) {
if (s->Phone.Data.VerNum>3.37) return ERR_NOTSUPPORTED;
}
if (!strcmp(s->Phone.Data.ModelInfo->model,"6230")) {
return ERR_NOTSUPPORTED;
}
+ if (!strcmp(s->Phone.Data.ModelInfo->model,"5140")) {
+ return ERR_NOTSUPPORTED;
+ }
if (Profile->Location>5) return ERR_INVALIDLOCATION;
for (i = 0; i < 0x0a; i++) {
req[length++] = 0x04;
req[length++] = Profile->Location;
req[length++] = i;
req[length++] = 0x01;
}
req[length++] = 0x04;
req[length++] = Profile->Location;
req[length++] = 0x0c;
req[length++] = 0x01;
req[length++] = 0x04;
Profile->CarKitProfile = false;
Profile->HeadSetProfile = false;
Profile->FeaturesNumber = 0;
s->Phone.Data.Profile=Profile;
smprintf(s, "Getting profile\n");
error = GSM_WaitFor (s, req, length, 0x39, 4, ID_GetProfile);
if (error != ERR_NONE) return error;
smprintf(s, "Checking, which profile is active\n");
return GSM_WaitFor (s, reqActive, 4, 0x39, 4, ID_GetProfile);
}
static GSM_Error N6510_ReplySetProfile(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
unsigned char *blockstart;
int i;
smprintf(s, "Response to profile writing received!\n");
blockstart = msg.Buffer + 6;
for (i = 0; i < msg.Buffer[5]; i++) {
switch (blockstart[2]) {
case 0x00: smprintf(s, "keypad tone level"); break;
case 0x02: smprintf(s, "call alert"); break;
case 0x03: smprintf(s, "ringtone"); break;
case 0x04: smprintf(s, "ringtone volume"); break;
case 0x05: smprintf(s, "SMS tone"); break;
case 0x06: smprintf(s, "vibration"); break;
case 0x07: smprintf(s, "warning tone level"); break;
case 0x08: smprintf(s, "caller groups"); break;
case 0x09: smprintf(s, "automatic answer"); break;
case 0x0c: smprintf(s, "name"); break;
default:
smprintf(s, "Unknown block type %02x", blockstart[2]);
break;
}
if (msg.Buffer[4] == 0x00) {
smprintf(s, ": set OK\n");
} else {
smprintf(s, ": setting error %i\n", msg.Buffer[4]);
}
blockstart = blockstart + blockstart[1];
}
return ERR_NONE;
}
static GSM_Error N6510_SetProfile(GSM_StateMachine *s, GSM_Profile *Profile)
{
int i, length = 7, blocks = 0;
bool found;
unsigned char ID,Value;
unsigned char req[150] = {N6110_FRAME_HEADER, 0x03, 0x01,
0x06, /* Number of blocks */
0x03};
if (Profile->Location>5) return ERR_INVALIDLOCATION;
for (i=0;i<Profile->FeaturesNumber;i++) {
found = false;
switch (Profile->FeatureID[i]) {
case Profile_RingtoneID:
ID = 0x03;
Value = Profile->FeatureValue[i];
found = true;
break;
default:
found=NOKIA_FindPhoneFeatureValue(
s,
Profile71_65,
Profile->FeatureID[i],Profile->FeatureValue[i],
&ID,&Value);
}
if (found) {
req[length] = 0x09;
req[length + 1] = ID;
req[length + 2] = Profile->Location;
memcpy(req + length + 4, "\x00\x00\x01", 3);
req[length + 8] = 0x03;
req[length + 3] = req[length + 7] = Value;
blocks++;
length += 9;
}
}
smprintf(s, "Setting profile\n");
return GSM_WaitFor (s, req, length, 0x39, 4, ID_SetProfile);
}
static GSM_Error N6510_ReplyIncomingSMS(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
GSM_SMSMessage sms;
#ifdef DEBUG
smprintf(s, "SMS message received\n");
N6510_DecodeSMSFrame(s, &sms, msg.Buffer+10);
#endif
if (s->Phone.Data.EnableIncomingSMS && s->User.IncomingSMS!=NULL) {
sms.State = SMS_UnRead;
sms.InboxFolder = true;
N6510_DecodeSMSFrame(s, &sms, msg.Buffer+10);
s->User.IncomingSMS(s->CurrentConfig->Device,sms);
}
return ERR_NONE;
}
static GSM_Error N6510_DialVoice(GSM_StateMachine *s, char *number, GSM_CallShowNumber ShowNumber)
{
+ unsigned int pos2 = 15;
unsigned int pos = 4;
+ unsigned char req2[100] = {N6110_FRAME_HEADER,0x01,
+ 0x00,0x02,0x07,0x04,
+ 0x01, // 1 - voice, 2 - data
+ 0x00,0x03,
+ 0x18, // length of rest + 1
+ 0x00,0x00,0x00};
unsigned char req[100] = {N6110_FRAME_HEADER,0x01,
0x0c}; /* Number length */
+ GSM_Error error;
+
+ /* USSD not supported */
+ if (number[0] == '*') return ERR_NOTSUPPORTED;
+ if (number[0] == '#') return ERR_NOTSUPPORTED;
req[pos++] = strlen(number);
EncodeUnicode(req+pos,number,strlen(number));
pos += strlen(number)*2;
req[pos++] = 0x05; /* call type: voice - 0x05, data - 0x01 */
req[pos++] = 0x01;
req[pos++] = 0x05;
req[pos++] = 0x00;
req[pos++] = 0x02;
req[pos++] = 0x00;
req[pos++] = 0x00;
switch (ShowNumber) {
case GSM_CALL_HideNumber:
req[pos++] = 0x02;
break;
case GSM_CALL_ShowNumber:
req[pos++] = 0x03;
break;
case GSM_CALL_DefaultNumberPresence:
req[pos++] = 0x01;
break;
}
+ smprintf(s, "Making voice call\n");
+ error = GSM_WaitFor (s, req, pos, 0x01, 4, ID_DialVoice);
+ if (error != ERR_NOTSUPPORTED) return error;
+
+ if (ShowNumber != GSM_CALL_DefaultNumberPresence) return ERR_NOTSUPPORTED;
+
+ req2[11] = strlen(number)*2+6;
+ req2[pos2++] = strlen(number);
+ EncodeUnicode(req2+pos2,number,strlen(number));
+ pos2 += strlen(number)*2;
smprintf(s, "Making voice call\n");
- return GSM_WaitFor (s, req, pos, 0x01, 4, ID_DialVoice);
+ error = GSM_WaitFor (s, req2, pos2, 0x01, 4, ID_DialVoice);
+ if (error == ERR_NOTSUPPORTED) return ERR_NONE;
+ return error;
}
/* method 3 */
static GSM_Error N6510_ReplyGetCalendarInfo3(GSM_Protocol_Message msg, GSM_StateMachine *s, GSM_NOKIACalToDoLocations *Last)
{
int i=0,j=0;
while (Last->Location[j] != 0x00) j++;
if (j >= GSM_MAXCALENDARTODONOTES) {
smprintf(s, "Increase GSM_MAXCALENDARTODONOTES\n");
return ERR_UNKNOWN;
}
if (j == 0) {
Last->Number=msg.Buffer[8]*256+msg.Buffer[9];
smprintf(s, "Number of Entries: %i\n",Last->Number);
}
smprintf(s, "Locations: ");
while (14+(i*4) <= msg.Length) {
Last->Location[j++]=msg.Buffer[12+i*4]*256+msg.Buffer[13+i*4];
smprintf(s, "%i ",Last->Location[j-1]);
i++;
}
smprintf(s, "\nNumber of Entries in frame: %i\n",i);
Last->Location[j] = 0;
smprintf(s, "\n");
if (i == 1 && msg.Buffer[12+0*4]*256+msg.Buffer[13+0*4] == 0) return ERR_EMPTY;
if (i == 0) return ERR_EMPTY;
return ERR_NONE;
}
/* method 3 */
-static GSM_Error N6510_GetCalendarInfo3(GSM_StateMachine *s, GSM_NOKIACalToDoLocations *Last, bool Calendar)
+static GSM_Error N6510_GetCalendarInfo3(GSM_StateMachine *s, GSM_NOKIACalToDoLocations *Last, char Type)
{
- GSM_Error error;
+ GSM_Error error = ERR_UNKNOWN;
int i;
unsigned char req[] = {N6110_FRAME_HEADER, 0x9E, 0xFF, 0xFF, 0x00, 0x00,
0x00, 0x00, /* First location */
- 0x00}; /* 0 = calendar, 1 = ToDo in 6610 style */
+ 0x00}; /* 0 = calendar, 1 = ToDo in 6610 style, 2 = Notes */
Last->Location[0] = 0x00;
Last->Number = 0;
- if (Calendar) {
+ req[10] = Type;
+ if (Type == 0) {
smprintf(s, "Getting locations for calendar method 3\n");
error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetCalendarNotesInfo);
- } else {
- req[10] = 0x01;
+ } else if (Type == 1) {
smprintf(s, "Getting locations for ToDo method 2\n");
error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetToDo);
+ } else if (Type == 2) {
+ smprintf(s, "Getting locations for Notes\n");
+ error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetNote);
}
if (error != ERR_NONE && error != ERR_EMPTY) return error;
while (1) {
i=0;
while (Last->Location[i] != 0x00) i++;
smprintf(s, "i = %i %i\n",i,Last->Number);
if (i == Last->Number) break;
if (i != Last->Number && error == ERR_EMPTY) {
smprintf(s, "Phone doesn't support some notes with this method. Workaround\n");
Last->Number = i;
break;
}
req[8] = Last->Location[i-1] / 256;
req[9] = Last->Location[i-1] % 256;
- if (Calendar) {
+ if (Type == 0) {
smprintf(s, "Getting locations for calendar method 3\n");
error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetCalendarNotesInfo);
- } else {
+ } else if (Type == 1) {
smprintf(s, "Getting locations for todo method 2\n");
error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetToDo);
+ } else if (Type == 2) {
+ smprintf(s, "Getting locations for Notes\n");
+ error = GSM_WaitFor (s, req, 11, 0x13, 4, ID_GetNote);
}
if (error != ERR_NONE && error != ERR_EMPTY) return error;
}
return ERR_NONE;
}
/* method 3 */
GSM_Error N6510_ReplyGetCalendar3(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
GSM_CalendarEntry *entry = s->Phone.Data.Cal;
GSM_DateTime Date;
unsigned long diff;
int i;
bool found = false;
GSM_Phone_N6510Data *Priv = &s->Phone.Data.Priv.N6510;
smprintf(s, "Calendar note received method 3\n");
smprintf(s,"Note type %02i: ",msg.Buffer[27]);
switch(msg.Buffer[27]) {
case 0x00: smprintf(s,"Reminder\n"); entry->Type = GSM_CAL_REMINDER; break;
case 0x01: smprintf(s,"Meeting\n"); entry->Type = GSM_CAL_MEETING; break;
case 0x02: smprintf(s,"Call\n"); entry->Type = GSM_CAL_CALL; break;
case 0x04: smprintf(s,"Birthday\n"); entry->Type = GSM_CAL_BIRTHDAY; break;
case 0x08: smprintf(s,"Memo\n"); entry->Type = GSM_CAL_MEMO; break;
default : smprintf(s,"unknown\n");
}
smprintf(s,"StartTime: %04i-%02i-%02i %02i:%02i\n",
msg.Buffer[28]*256+msg.Buffer[29],
msg.Buffer[30],msg.Buffer[31],msg.Buffer[32],
msg.Buffer[33]);
Date.Year = msg.Buffer[28]*256+msg.Buffer[29];
if (entry->Type == GSM_CAL_BIRTHDAY) {
Date.Year = entry->Entries[0].Date.Year;
smprintf(s,"%i\n",Date.Year);
}
Date.Month = msg.Buffer[30];
Date.Day = msg.Buffer[31];
Date.Hour = msg.Buffer[32];
Date.Minute = msg.Buffer[33];
/* Garbage seen with 3510i 3.51 */
if (Date.Month == 0 && Date.Day == 0 && Date.Hour == 0 && Date.Minute == 0) return ERR_EMPTY;
Date.Second = 0;
entry->Entries[0].EntryType = CAL_START_DATETIME;
memcpy(&entry->Entries[0].Date,&Date,sizeof(GSM_DateTime));
entry->EntriesNum++;
if (entry->Type != GSM_CAL_BIRTHDAY) {
smprintf(s,"EndTime: %04i-%02i-%02i %02i:%02i\n",
msg.Buffer[34]*256+msg.Buffer[35],
msg.Buffer[36],msg.Buffer[37],msg.Buffer[38],
msg.Buffer[39]);
Date.Year = msg.Buffer[34]*256+msg.Buffer[35];
Date.Month = msg.Buffer[36];
Date.Day = msg.Buffer[37];
Date.Hour = msg.Buffer[38];
Date.Minute = msg.Buffer[39];
Date.Second = 0;
entry->Entries[1].EntryType = CAL_END_DATETIME;
memcpy(&entry->Entries[1].Date,&Date,sizeof(GSM_DateTime));
entry->EntriesNum++;
}
smprintf(s, "Note icon: %02x\n",msg.Buffer[21]);
for(i=0;i<Priv->CalendarIconsNum;i++) {
if (Priv->CalendarIconsTypes[i] == entry->Type) {
found = true;
}
}
if (!found) {
Priv->CalendarIconsTypes[Priv->CalendarIconsNum] = entry->Type;
Priv->CalendarIcons [Priv->CalendarIconsNum] = msg.Buffer[21];
Priv->CalendarIconsNum++;
}
if (msg.Buffer[14] == 0xFF && msg.Buffer[15] == 0xFF && msg.Buffer[16] == 0xff && msg.Buffer[17] == 0xff)
{
smprintf(s, "No alarm\n");
} else {
diff = ((unsigned int)msg.Buffer[14]) << 24;
diff += ((unsigned int)msg.Buffer[15]) << 16;
diff += ((unsigned int)msg.Buffer[16]) << 8;
diff += msg.Buffer[17];
memcpy(&entry->Entries[entry->EntriesNum].Date,&entry->Entries[0].Date,sizeof(GSM_DateTime));
GetTimeDifference(diff, &entry->Entries[entry->EntriesNum].Date, false, 60);
smprintf(s, "Alarm date : %02i-%02i-%04i %02i:%02i:%02i\n",
entry->Entries[entry->EntriesNum].Date.Day, entry->Entries[entry->EntriesNum].Date.Month,
entry->Entries[entry->EntriesNum].Date.Year, entry->Entries[entry->EntriesNum].Date.Hour,
entry->Entries[entry->EntriesNum].Date.Minute,entry->Entries[entry->EntriesNum].Date.Second);
entry->Entries[entry->EntriesNum].EntryType = CAL_ALARM_DATETIME;
if (msg.Buffer[22]==0x00 && msg.Buffer[23]==0x00 &&
msg.Buffer[24]==0x00 && msg.Buffer[25]==0x00)
{
entry->Entries[entry->EntriesNum].EntryType = CAL_SILENT_ALARM_DATETIME;
smprintf(s, "Alarm type : Silent\n");
}
entry->EntriesNum++;
}
N71_65_GetCalendarRecurrance(s, msg.Buffer+40, entry);
if (entry->Type == GSM_CAL_BIRTHDAY) {
if (msg.Buffer[42] == 0xff && msg.Buffer[43] == 0xff) {
entry->Entries[0].Date.Year = 0;
} else {
entry->Entries[0].Date.Year = msg.Buffer[42]*256+msg.Buffer[43];
}
}
memcpy(entry->Entries[entry->EntriesNum].Text, msg.Buffer+54, msg.Buffer[51]*2);
entry->Entries[entry->EntriesNum].Text[msg.Buffer[51]*2] = 0;
entry->Entries[entry->EntriesNum].Text[msg.Buffer[51]*2+1] = 0;
entry->Entries[entry->EntriesNum].EntryType = CAL_TEXT;
entry->EntriesNum++;
smprintf(s, "Note text: \"%s\"\n",DecodeUnicodeString(entry->Entries[entry->EntriesNum-1].Text));
if (entry->Type == GSM_CAL_CALL) {
memcpy(entry->Entries[entry->EntriesNum].Text, msg.Buffer+(54+msg.Buffer[51]*2), msg.Buffer[52]*2);
entry->Entries[entry->EntriesNum].Text[msg.Buffer[52]*2] = 0;
entry->Entries[entry->EntriesNum].Text[msg.Buffer[52]*2+1] = 0;
entry->Entries[entry->EntriesNum].EntryType = CAL_PHONE;
entry->EntriesNum++;
}
if (entry->Type == GSM_CAL_MEETING) {
memcpy(entry->Entries[entry->EntriesNum].Text, msg.Buffer+(54+msg.Buffer[51]*2), msg.Buffer[52]*2);
entry->Entries[entry->EntriesNum].Text[msg.Buffer[52]*2] = 0;
entry->Entries[entry->EntriesNum].Text[msg.Buffer[52]*2+1] = 0;
entry->Entries[entry->EntriesNum].EntryType = CAL_LOCATION;
entry->EntriesNum++;
}
return ERR_NONE;
}
+static GSM_Error N6510_PrivGetGenericCalendar3(GSM_StateMachine *s, int Location, GSM_Phone_RequestID ID)
+{
+ unsigned char req[] = {N6110_FRAME_HEADER,0x7D,0x00,0x00,0x00,0x00,
+ 0x00,0x99, /* Location */
+ 0xff,0xff,0xff,0xff};
+
+ req[8] = Location / 256;
+ req[9] = Location % 256;
+
+ return GSM_WaitFor (s, req, 14, 0x13, 4, ID);
+}
+
static GSM_Error N6510_PrivGetCalendar3(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start, int *LastCalendarYear)
{
GSM_Error error;
GSM_DateTime date_time;
- unsigned char req[] = {N6110_FRAME_HEADER,0x7D,0x00,0x00,0x00,0x00,
- 0x00,0x99, /* Location */
- 0xff,0xff,0xff,0xff,0x01};
if (start) {
/* We have to get current year. It's NOT written in frame for
* Birthday
*/
error=s->Phone.Functions->GetDateTime(s,&date_time);
switch (error) {
case ERR_EMPTY:
case ERR_NOTIMPLEMENTED:
GSM_GetCurrentDateTime(&date_time);
break;
case ERR_NONE:
break;
default:
return error;
}
*LastCalendarYear = date_time.Year;
}
Note->EntriesNum = 0;
Note->Entries[0].Date.Year = *LastCalendarYear;
- req[8] = Note->Location / 256;
- req[9] = Note->Location % 256;
-
s->Phone.Data.Cal=Note;
smprintf(s, "Getting calendar note method 3\n");
- return GSM_WaitFor (s, req, 15, 0x13, 4, ID_GetCalendarNote);
+ return N6510_PrivGetGenericCalendar3(s, Note->Location, ID_GetCalendarNote);
}
/* method 3 */
GSM_Error N6510_GetNextCalendar3(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start, GSM_NOKIACalToDoLocations *LastCalendar, int *LastCalendarYear, int *LastCalendarPos)
{
GSM_Error error;
bool start2;
if (start) {
- error=N6510_GetCalendarInfo3(s,LastCalendar,true);
+ error=N6510_GetCalendarInfo3(s,LastCalendar,0);
if (error!=ERR_NONE) return error;
if (LastCalendar->Number == 0) return ERR_EMPTY;
*LastCalendarPos = 0;
} else {
(*LastCalendarPos)++;
}
error = ERR_EMPTY;
start2 = start;
while (error == ERR_EMPTY) {
if (*LastCalendarPos >= LastCalendar->Number) return ERR_EMPTY;
Note->Location = LastCalendar->Location[*LastCalendarPos];
error=N6510_PrivGetCalendar3(s, Note, start2, LastCalendarYear);
if (error == ERR_EMPTY) (*LastCalendarPos)++;
start2 = false;
}
return error;
}
static GSM_Error N6510_ReplyGetCalendarInfo(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
switch (msg.Buffer[3]) {
case 0x3B:
/* Old method 1 for accessing calendar */
return N71_65_ReplyGetCalendarInfo1(msg, s, &s->Phone.Data.Priv.N6510.LastCalendar);
case 0x9F:
smprintf(s, "Info with calendar notes locations received method 3\n");
return N6510_ReplyGetCalendarInfo3(msg, s, &s->Phone.Data.Priv.N6510.LastCalendar);
}
return ERR_UNKNOWNRESPONSE;
}
/* method 3 */
GSM_Error N6510_ReplyGetCalendarNotePos3(GSM_Protocol_Message msg, GSM_StateMachine *s,int *FirstCalendarPos)
{
smprintf(s, "First calendar location: %i\n",msg.Buffer[8]*256+msg.Buffer[9]);
*FirstCalendarPos = msg.Buffer[8]*256+msg.Buffer[9];
return ERR_NONE;
}
/* method 3 */
static GSM_Error N6510_GetCalendarNotePos3(GSM_StateMachine *s)
{
unsigned char req[] = {N6110_FRAME_HEADER, 0x95, 0x00};
smprintf(s, "Getting first free calendar note location\n");
return GSM_WaitFor (s, req, 5, 0x13, 4, ID_GetCalendarNotePos);
}
static GSM_Error N6510_ReplyGetCalendarNotePos(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
switch (msg.Buffer[3]) {
case 0x32:
/* Old method 1 for accessing calendar */
return N71_65_ReplyGetCalendarNotePos1(msg, s,&s->Phone.Data.Priv.N6510.FirstCalendarPos);
case 0x96:
return N6510_ReplyGetCalendarNotePos3(msg, s,&s->Phone.Data.Priv.N6510.FirstCalendarPos);
}
return ERR_UNKNOWNRESPONSE;
}
static GSM_Error N6510_FindCalendarIconID3(GSM_StateMachine *s, GSM_CalendarEntry *Entry, unsigned char *ID)
{
int i,j,LastCalendarYear;
GSM_Phone_N6510Data *Priv = &s->Phone.Data.Priv.N6510;
GSM_CalendarEntry Note;
GSM_NOKIACalToDoLocations LastCalendar1,LastCalendar2;
GSM_Error error;
bool found;
for(i=0;i<Priv->CalendarIconsNum;i++) {
if (Priv->CalendarIconsTypes[i] == Entry->Type) {
*ID = Priv->CalendarIcons[i];
return ERR_NONE;
}
}
smprintf(s, "Starting finding note ID\n");
- error=N6510_GetCalendarInfo3(s, &Priv->LastCalendar,true);
+ error=N6510_GetCalendarInfo3(s, &Priv->LastCalendar,0);
memcpy(&LastCalendar1,&Priv->LastCalendar,sizeof(GSM_NOKIACalToDoLocations));
if (error != ERR_NONE) return error;
if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL35) ||
IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL65) ||
IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL62)) {
error=N71_65_AddCalendar2(s,Entry);
} else {
if (Entry->Type == GSM_CAL_MEETING) {
error=N71_65_AddCalendar1(s, Entry, &s->Phone.Data.Priv.N6510.FirstCalendarPos);
} else {
error=N71_65_AddCalendar2(s,Entry);
}
}
if (error != ERR_NONE) return error;
- error=N6510_GetCalendarInfo3(s, &Priv->LastCalendar,true);
+ error=N6510_GetCalendarInfo3(s, &Priv->LastCalendar,0);
memcpy(&LastCalendar2,&Priv->LastCalendar,sizeof(GSM_NOKIACalToDoLocations));
if (error != ERR_NONE) return error;
smprintf(s,"Number of entries: %i %i\n",LastCalendar1.Number,LastCalendar2.Number);
for(i=0;i<LastCalendar2.Number;i++) {
found = true;
for(j=0;j<LastCalendar1.Number;j++) {
if (LastCalendar1.Location[j] == LastCalendar2.Location[i]) {
found = false;
break;
}
}
if (found) {
Note.Location = LastCalendar2.Location[i];
error=N6510_PrivGetCalendar3(s, &Note, true, &LastCalendarYear);
if (error != ERR_NONE) return error;
error=N71_65_DelCalendar(s, &Note);
if (error != ERR_NONE) return error;
smprintf(s, "Ending finding note ID\n");
for(j=0;j<Priv->CalendarIconsNum;j++) {
if (Priv->CalendarIconsTypes[j] == Entry->Type) {
*ID = Priv->CalendarIcons[j];
return ERR_NONE;
}
}
return ERR_UNKNOWN;
}
}
return ERR_UNKNOWN;
}
/* method 3 */
static GSM_Error N6510_ReplyAddCalendar3(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
smprintf(s, "Calendar note added\n");
return ERR_NONE;
}
/* method 3 */
GSM_Error N6510_AddCalendar3(GSM_StateMachine *s, GSM_CalendarEntry *Note, int *FirstCalendarPos)
{
GSM_CalendarNoteType NoteType, OldNoteType;
time_t t_time1,t_time2;
long diff;
GSM_Error error;
GSM_DateTime DT,date_time;
int Text, Time, Alarm, Phone, Recurrance, EndTime, Location, count=54;
unsigned char req[5000] = {
N6110_FRAME_HEADER, 0x65,
0x00, /* 0 = calendar, 1 = todo */
0x00, 0x00, 0x00,
0x00, 0x00, /* location */
0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, /* alarm */
0x80, 0x00, 0x00,
0x01, /* note icon */
0xFF, 0xFF, 0xFF, 0xFF, /* alarm type */
0x00, /* 0x02 or 0x00 */
0x01, /* note type */
0x07, 0xD0, 0x01, 0x12, 0x0C, 0x00, /* start date/time */
0x07, 0xD0, 0x01, 0x12, 0x0C, 0x00, /* end date/time */
0x00, 0x00, /* recurrance */
0x00, 0x00, /* birth year */
0x20, /* ToDo priority */
0x00, /* ToDo completed ? */
0x00, 0x00, 0x00,
0x00, /* note text length */
0x00, /* phone length/meeting place */
0x00, 0x00, 0x00};
error=N6510_GetCalendarNotePos3(s);
if (error!=ERR_NONE) return error;
req[8] = *FirstCalendarPos/256;
req[9] = *FirstCalendarPos%256;
NoteType = N71_65_FindCalendarType(Note->Type, s->Phone.Data.ModelInfo);
switch(NoteType) {
case GSM_CAL_REMINDER : req[27]=0x00; req[26]=0x02; break;
case GSM_CAL_MEETING : req[27]=0x01; break;
case GSM_CAL_CALL : req[27]=0x02; break;
case GSM_CAL_BIRTHDAY : req[27]=0x04; break;
case GSM_CAL_MEMO : req[27]=0x08; break;
default : return ERR_UNKNOWN;
}
OldNoteType = Note->Type;
Note->Type = NoteType;
error=N6510_FindCalendarIconID3(s, Note, &req[21]);
Note->Type = OldNoteType;
if (error!=ERR_NONE) return error;
@@ -3644,193 +3690,193 @@ GSM_Error N6510_AddCalendar3(GSM_StateMachine *s, GSM_CalendarEntry *Note, int *
req[40] = 0xff;
req[41] = 0xff;
} else {
req[40] = Note->Entries[Recurrance].Number / 256;
req[41] = Note->Entries[Recurrance].Number % 256;
}
}
if (Alarm != -1) {
memcpy(&DT,&Note->Entries[Time].Date,sizeof(GSM_DateTime));
if (Note->Entries[Alarm].EntryType == CAL_SILENT_ALARM_DATETIME) {
req[22] = 0x00; req[23] = 0x00; req[24] = 0x00; req[25] = 0x00;
}
if (NoteType == GSM_CAL_BIRTHDAY) DT.Year = date_time.Year;
t_time2 = Fill_Time_T(DT,8);
t_time1 = Fill_Time_T(Note->Entries[Alarm].Date,8);
diff = (t_time1-t_time2)/60;
smprintf(s, " Difference : %li seconds or minutes\n", -diff);
req[14] = (unsigned char)(-diff >> 24);
req[15] = (unsigned char)(-diff >> 16);
req[16] = (unsigned char)(-diff >> 8);
req[17] = (unsigned char)(-diff);
}
if (Text != -1) {
req[49] = UnicodeLength(Note->Entries[Text].Text);
CopyUnicodeString(req+54,Note->Entries[Text].Text);
count+= req[49]*2;
}
if (Phone != -1 && NoteType == GSM_CAL_CALL) {
req[50] = UnicodeLength(Note->Entries[Phone].Text);
CopyUnicodeString(req+54+req[49]*2,Note->Entries[Phone].Text);
count+= req[50]*2;
}
if (Location != -1 && NoteType == GSM_CAL_MEETING) {
if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL62) ||
IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL65) ||
IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL35)) {
} else {
req[50] = UnicodeLength(Note->Entries[Location].Text);
CopyUnicodeString(req+54+req[49]*2,Note->Entries[Location].Text);
count+= req[50]*2;
}
}
req[count++] = 0x00;
smprintf(s, "Writing calendar note method 3\n");
return GSM_WaitFor (s, req, count, 0x13, 4, ID_SetCalendarNote);
}
static GSM_Error N6510_GetNextCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note, bool start)
{
#ifdef GSM_FORCE_DCT4_CALENDAR_6210
/* Method 1. Some features missed. Not working with some notes in 3510 */
return N71_65_GetNextCalendar1(s,Note,start,&s->Phone.Data.Priv.N6510.LastCalendar,&s->Phone.Data.Priv.N6510.LastCalendarYear,&s->Phone.Data.Priv.N6510.LastCalendarPos);
#endif
if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL62)) {
/* Method 1. Some features missed. Not working with some notes in 3510 */
return N71_65_GetNextCalendar1(s,Note,start,&s->Phone.Data.Priv.N6510.LastCalendar,&s->Phone.Data.Priv.N6510.LastCalendarYear,&s->Phone.Data.Priv.N6510.LastCalendarPos);
/* Method 2. In known phones texts of notes cut to 50 chars. Some features missed */
// return N71_65_GetNextCalendar2(s,Note,start,&s->Phone.Data.Priv.N6510.LastCalendarYear,&s->Phone.Data.Priv.N6510.LastCalendarPos);
} else {
/* Method 3. All DCT4 features supported. Not supported by 8910 */
return N6510_GetNextCalendar3(s,Note,start,&s->Phone.Data.Priv.N6510.LastCalendar,&s->Phone.Data.Priv.N6510.LastCalendarYear,&s->Phone.Data.Priv.N6510.LastCalendarPos);
}
}
static GSM_Error N6510_GetCalendarStatus(GSM_StateMachine *s, GSM_CalendarStatus *Status)
{
GSM_Error error;
#ifdef GSM_FORCE_DCT4_CALENDAR_6210
/* Method 1 */
error=N71_65_GetCalendarInfo1(s, &s->Phone.Data.Priv.N6510.LastCalendar);
if (error!=ERR_NONE) return error;
Status->Used = s->Phone.Data.Priv.N6510.LastCalendar.Number;
return ERR_NONE;
#endif
if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL62)) {
/* Method 1 */
error=N71_65_GetCalendarInfo1(s, &s->Phone.Data.Priv.N6510.LastCalendar);
if (error!=ERR_NONE) return error;
Status->Used = s->Phone.Data.Priv.N6510.LastCalendar.Number;
return ERR_NONE;
/* Method 2 */
// return ERR_NOTSUPPORTED;
} else {
/* Method 3 */
- error=N6510_GetCalendarInfo3(s,&s->Phone.Data.Priv.N6510.LastCalendar,true);
+ error=N6510_GetCalendarInfo3(s,&s->Phone.Data.Priv.N6510.LastCalendar,0);
if (error!=ERR_NONE) return error;
Status->Used = s->Phone.Data.Priv.N6510.LastCalendar.Number;
return ERR_NONE;
}
}
static GSM_Error N6510_AddCalendar(GSM_StateMachine *s, GSM_CalendarEntry *Note)
{
#ifdef GSM_FORCE_DCT4_CALENDAR_6210
return N71_65_AddCalendar2(s,Note);
#endif
if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL62)) {
return N71_65_AddCalendar2(s,Note);
// return N71_65_AddCalendar1(s, Note, &s->Phone.Data.Priv.N6510.FirstCalendarPos);
} else {
/* Method 3. All DCT4 features supported. Not supported by 8910 */
return N6510_AddCalendar3(s, Note, &s->Phone.Data.Priv.N6510.FirstCalendarPos);
}
}
static GSM_Error N6510_ReplyLogIntoNetwork(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
smprintf(s, "Probably phone says: I log into network\n");
return ERR_NONE;
}
void N6510_EncodeFMFrequency(double freq, unsigned char *buff)
{
double freq0;
unsigned char buffer[20];
unsigned int i,freq2;
sprintf(buffer,"%.3f",freq);
for (i=0;i<strlen(buffer);i++) {
if (buffer[i] == ',' || buffer[i] == '.') buffer[i] = ' ';
}
StringToDouble(buffer, &freq0);
freq2 = (unsigned int)freq0;
dbgprintf("Frequency: %s %i\n",buffer,freq2);
freq2 = freq2 - 0xffff;
buff[0] = freq2 / 0x100;
buff[1] = freq2 % 0x100;
}
void N6510_DecodeFMFrequency(double *freq, unsigned char *buff)
{
unsigned char buffer[20];
sprintf(buffer,"%i.%i",(0xffff + buff[0] * 0x100 + buff[1])/1000,
(0xffff + buff[0] * 0x100 + buff[1])%1000);
dbgprintf("Frequency: %s\n",buffer);
StringToDouble(buffer, freq);
}
static GSM_Error N6510_ReplyGetFMStatus(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
smprintf(s, "getting FM status OK\n");
memcpy(s->Phone.Data.Priv.N6510.FMStatus,msg.Buffer,msg.Length);
s->Phone.Data.Priv.N6510.FMStatusLength = msg.Length;
return ERR_NONE;
}
static GSM_Error N6510_GetFMStatus(GSM_StateMachine *s)
{
unsigned char req[7] = {N6110_FRAME_HEADER, 0x0d, 0x00, 0x00, 0x01};
if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_RADIO)) return ERR_NOTSUPPORTED;
return GSM_WaitFor (s, req, 7, 0x3E, 2, ID_GetFMStation);
}
static GSM_Error N6510_ReplyGetFMStation(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
unsigned char name[GSM_MAX_FMSTATION_LENGTH*2+2];
int length;
GSM_Phone_Data *Data = &s->Phone.Data;
switch (msg.Buffer[3]) {
case 0x06:
smprintf(s, "Received FM station\n");
length = msg.Buffer[8];
memcpy(name,msg.Buffer+18,length*2);
name[length*2] = 0x00;
name[length*2+1] = 0x00;
CopyUnicodeString(Data->FMStation->StationName,name);
smprintf(s,"Station name: \"%s\"\n",DecodeUnicodeString(Data->FMStation->StationName));
N6510_DecodeFMFrequency(&Data->FMStation->Frequency, msg.Buffer+16);
return ERR_NONE;
case 0x16:
smprintf(s, "Received FM station. Empty ?\n");
return ERR_EMPTY;
}
return ERR_UNKNOWNRESPONSE;
}
static GSM_Error N6510_GetFMStation (GSM_StateMachine *s, GSM_FMStation *FMStation)
@@ -3879,276 +3925,312 @@ static GSM_Error N6510_ClearFMStations (GSM_StateMachine *s)
return GSM_WaitFor (s, req, 7, 0x3E, 2, ID_SetFMStation);
}
static GSM_Error N6510_SetFMStation (GSM_StateMachine *s, GSM_FMStation *FMStation)
{
unsigned int len, location;
GSM_Error error;
unsigned char setstatus[36] = {N6110_FRAME_HEADER,0x11,0x00,0x01,0x01,
0x00,0x00,0x1c,0x00,0x14,0x00,0x00,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0x01};
unsigned char req[64] = {N6110_FRAME_HEADER, 0x12,0x00,0x01,0x00,
0x00, // 0x0e + (strlen(name) * 2)
0x00, // strlen(name)
0x14,0x09,0x00,
0x00, // location
0x00,0x00,0x01,
0x00, // freqHi
0x00, // freqLo
0x01};
if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_RADIO)) return ERR_NOTSUPPORTED;
s->Phone.Data.FMStation = FMStation;
location = FMStation->Location-1;
error = N6510_GetFMStatus(s);
if (error != ERR_NONE) return error;
memcpy(setstatus+14,s->Phone.Data.Priv.N6510.FMStatus+14,20);
setstatus [14+location] = location;
smprintf(s, "Setting FM status %i\n",FMStation->Location);
error = GSM_WaitFor (s, setstatus, 36 , 0x3E, 2, ID_SetFMStation);
if (error != ERR_NONE) return error;
req[12] = location;
/* Name */
len = UnicodeLength(FMStation->StationName);
req[8] = len;
req[7] = 0x0e + len * 2;
memcpy (req+18,FMStation->StationName,len*2);
/* Frequency */
N6510_EncodeFMFrequency(FMStation->Frequency, req+16);
smprintf(s, "Setting FM Station %i\n",FMStation->Location);
return GSM_WaitFor (s, req, 0x13+len*2, 0x3E, 2, ID_SetFMStation);
}
static GSM_Error N6510_ReplySetLight(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
smprintf(s, "Light set\n");
return ERR_NONE;
}
GSM_Error N6510_SetLight(GSM_StateMachine *s, N6510_PHONE_LIGHTS light, bool enable)
{
unsigned char req[14] = {
N6110_FRAME_HEADER, 0x05,
0x01, /* 0x01 = Display, 0x03 = keypad */
0x01, /* 0x01 = Enable, 0x02 = disable */
0x00, 0x00, 0x00, 0x01,
0x05, 0x04, 0x02, 0x00};
req[4] = light;
if (!enable) req[5] = 0x02;
smprintf(s, "Setting light\n");
return GSM_WaitFor (s, req, 14, 0x3A, 4, ID_SetLight);
}
static GSM_Error N6510_ShowStartInfo(GSM_StateMachine *s, bool enable)
{
GSM_Error error;
if (enable) {
error=N6510_SetLight(s,N6510_LIGHT_DISPLAY,true);
if (error != ERR_NONE) return error;
error=N6510_SetLight(s,N6510_LIGHT_TORCH,true);
if (error != ERR_NONE) return error;
return N6510_SetLight(s,N6510_LIGHT_KEYPAD,true);
} else {
error=N6510_SetLight(s,N6510_LIGHT_DISPLAY,false);
if (error != ERR_NONE) return error;
error=N6510_SetLight(s,N6510_LIGHT_TORCH,false);
if (error != ERR_NONE) return error;
return N6510_SetLight(s,N6510_LIGHT_KEYPAD,false);
}
}
+static GSM_Error N6510_ReplyGetNoteInfo(GSM_Protocol_Message msg, GSM_StateMachine *s)
+{
+ return N6510_ReplyGetCalendarInfo3(msg, s, &s->Phone.Data.Priv.N6510.LastNote);
+}
+
+static GSM_Error N6510_ReplyGetNote(GSM_Protocol_Message msg, GSM_StateMachine *s)
+{
+ smprintf(s, "Note received\n");
+ memcpy(s->Phone.Data.Note->Text,msg.Buffer+54,(msg.Buffer[50]*256+msg.Buffer[51])*2);
+ s->Phone.Data.Note->Text[(msg.Buffer[50]*256+msg.Buffer[51])*2] = 0;
+ s->Phone.Data.Note->Text[(msg.Buffer[50]*256+msg.Buffer[51])*2+1] = 0;
+ return ERR_NONE;
+}
+
+GSM_Error N6510_GetNextNote(GSM_StateMachine *s, GSM_NoteEntry *Note, bool start)
+{
+ GSM_Error error;
+ GSM_NOKIACalToDoLocations *LastNote = &s->Phone.Data.Priv.N6510.LastNote;
+
+ if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_NOTES)) return ERR_NOTSUPPORTED;
+
+ if (start) {
+ error=N6510_GetCalendarInfo3(s,LastNote,2);
+ if (error!=ERR_NONE) return error;
+ Note->Location = 1;
+ } else {
+ Note->Location++;
+ }
+
+ if (Note->Location > LastNote->Number) return ERR_EMPTY;
+
+ s->Phone.Data.Note = Note;
+ smprintf(s, "Getting note\n");
+ return N6510_PrivGetGenericCalendar3(s, LastNote->Location[Note->Location-1], ID_GetNote);
+}
+
static int N6510_FindFileCheckSum(unsigned char *ptr, int len)
{
int acc, i, accx;
accx = 0;
acc = 0xffff;
while (len--) {
accx = (accx & 0xffff00ff) | (acc & 0xff00);
acc = (acc & 0xffff00ff) | *ptr++ << 8;
for (i = 0; i < 8; i++) {
acc <<= 1;
if (acc & 0x10000) acc ^= 0x1021;
if (accx & 0x80000000) acc ^= 0x1021;
accx <<= 1;
}
}
dbgprintf("Checksum from Gammu is %04X\n",(acc & 0xffff));
return (acc & 0xffff);
}
static GSM_Error N6510_ReplyGetFileFolderInfo(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
GSM_File *File = s->Phone.Data.FileInfo;
GSM_Phone_N6510Data *Priv = &s->Phone.Data.Priv.N6510;
int i;
switch (msg.Buffer[3]) {
case 0x15:
smprintf(s,"File or folder details received\n");
CopyUnicodeString(File->Name,msg.Buffer+10);
if (!strncmp(DecodeUnicodeString(File->Name),"GMSTemp",7)) return ERR_EMPTY;
if (File->Name[0] == 0x00 && File->Name[1] == 0x00) return ERR_UNKNOWN;
i = msg.Buffer[8]*256+msg.Buffer[9];
dbgprintf("%02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
msg.Buffer[i-5],msg.Buffer[i-4],msg.Buffer[i-3],
msg.Buffer[i-2],msg.Buffer[i-1],msg.Buffer[i],
msg.Buffer[i+1],msg.Buffer[i+2],msg.Buffer[i+3]);
File->Folder = false;
if (msg.Buffer[i-5] == 0x00) File->Folder = true;
File->ReadOnly = false;
File->Protected = false;
File->System = false;
File->Hidden = false;
if (msg.Buffer[i+2] == 0x01) File->Protected = true;
if (msg.Buffer[i+4] == 0x01) File->ReadOnly = true;
if (msg.Buffer[i+5] == 0x01) File->Hidden = true;
if (msg.Buffer[i+6] == 0x01) File->System = true;//fixme
File->ModifiedEmpty = false;
NOKIA_DecodeDateTime(s, msg.Buffer+i-22, &File->Modified);
if (File->Modified.Year == 0x00) File->ModifiedEmpty = true;
dbgprintf("%02x %02x %02x %02x\n",msg.Buffer[i-22],msg.Buffer[i-21],msg.Buffer[i-20],msg.Buffer[i-19]);
Priv->FileToken = msg.Buffer[i-10]*256+msg.Buffer[i-9];
Priv->ParentID = msg.Buffer[i]*256+msg.Buffer[i+1];
smprintf(s,"ParentID is %i\n",Priv->ParentID);
File->Type = GSM_File_Other;
if (msg.Length > 240){
i = 227;
if (msg.Buffer[i]==0x02 && msg.Buffer[i+2]==0x01)
File->Type = GSM_File_Image_JPG;
else if (msg.Buffer[i]==0x02 && msg.Buffer[i+2]==0x02)
File->Type = GSM_File_Image_BMP;
else if (msg.Buffer[i]==0x02 && msg.Buffer[i+2]==0x07)
File->Type = GSM_File_Image_BMP;
else if (msg.Buffer[i]==0x02 && msg.Buffer[i+2]==0x03)
File->Type = GSM_File_Image_PNG;
else if (msg.Buffer[i]==0x02 && msg.Buffer[i+2]==0x05)
File->Type = GSM_File_Image_GIF;
else if (msg.Buffer[i]==0x02 && msg.Buffer[i+2]==0x09)
File->Type = GSM_File_Image_WBMP;
else if (msg.Buffer[i]==0x04 && msg.Buffer[i+2]==0x01)
File->Type = GSM_File_Sound_AMR;
else if (msg.Buffer[i]==0x04 && msg.Buffer[i+2]==0x02)
File->Type = GSM_File_Sound_MIDI;
else if (msg.Buffer[i]==0x08 && msg.Buffer[i+2]==0x05)
File->Type = GSM_File_Video_3GP;
else if (msg.Buffer[i]==0x10 && msg.Buffer[i+2]==0x01)
File->Type = GSM_File_Java_JAR;
-#if DEVELOP
+#ifdef DEVELOP
else if (msg.Buffer[i]==0x00 && msg.Buffer[i+2]==0x01)
File->Type = GSM_File_MMS;
#endif
}
return ERR_NONE;
case 0x2F:
smprintf(s,"File or folder used bytes received\n");
File->Used = msg.Buffer[6]*256*256*256+
msg.Buffer[7]*256*256+
msg.Buffer[8]*256+
msg.Buffer[9];
return ERR_NONE;
case 0x33:
if (s->Phone.Data.RequestID == ID_GetFileInfo) {
i = Priv->FilesLocationsUsed-1;
while (1) {
if (i==Priv->FilesLocationsCurrent-1) break;
dbgprintf("Copying %i to %i, max %i, current %i\n",
i,i+msg.Buffer[9],
Priv->FilesLocationsUsed,Priv->FilesLocationsCurrent);
Priv->FilesLocations[i+msg.Buffer[9]] = Priv->FilesLocations[i];
Priv->FilesLevels[i+msg.Buffer[9]] = Priv->FilesLevels[i];
i--;
}
Priv->FilesLocationsUsed += msg.Buffer[9];
for (i=0;i<msg.Buffer[9];i++) {
Priv->FilesLocations[Priv->FilesLocationsCurrent+i] = msg.Buffer[13+i*4-1]*256 + msg.Buffer[13+i*4];
Priv->FilesLevels[Priv->FilesLocationsCurrent+i] = File->Level+1;
dbgprintf("%i ",Priv->FilesLocations[Priv->FilesLocationsCurrent+i]);
}
dbgprintf("\n");
}
if (msg.Buffer[9] != 0x00) File->Folder = true;
return ERR_NONE;
case 0x43:
Priv->FileCheckSum = msg.Buffer[6] * 256 + msg.Buffer[7];
smprintf(s,"File checksum from phone is %04X\n",Priv->FileCheckSum);
return ERR_NONE;
}
return ERR_UNKNOWNRESPONSE;
}
static GSM_Error N6510_GetFileFolderInfo(GSM_StateMachine *s, GSM_File *File, GSM_Phone_RequestID Request)
{
GSM_Error error;
unsigned char req[10] = {
N7110_FRAME_HEADER,
0x14, /* 0x14 - info, 0x22 - free/total, 0x2E - used, 0x32 - sublocations */
0x01, /* 0x00 for sublocations reverse sorting, 0x01 for free */
0x00, 0x00, 0x01,
0x00, 0x01}; /* Folder or file number */
unsigned char GetCRC[] = {
N7110_FRAME_HEADER, 0x42, 0x00, 0x00, 0x00, 0x01,
0x00, 0x1E}; /* file ID */
if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_NOFILESYSTEM)) return ERR_NOTSUPPORTED;
s->Phone.Data.FileInfo = File;
req[8] = atoi(File->ID_FullName) / 256;
req[9] = atoi(File->ID_FullName) % 256;
req[3] = 0x14;
req[4] = 0x01;
smprintf(s,"Getting info for file in filesystem\n");
error=GSM_WaitFor (s, req, 10, 0x6D, 4, Request);
if (error != ERR_NONE) return error;
if (Request != ID_AddFile) {
req[3] = 0x32;
req[4] = 0x00;
smprintf(s,"Getting subfolders for filesystem\n");
error=GSM_WaitFor (s, req, 10, 0x6D, 4, Request);
if (error != ERR_NONE) return error;
if (!File->Folder) {
req[3] = 0x2E;
req[4] = 0x01;
smprintf(s,"Getting used memory for file in filesystem\n");
error=GSM_WaitFor (s, req, 10, 0x6D, 4, Request);
if (error != ERR_NONE) return error;
GetCRC[8] = atoi(File->ID_FullName) / 256;
GetCRC[9] = atoi(File->ID_FullName) % 256;
smprintf(s,"Getting CRC for file in filesystem\n");
error=GSM_WaitFor (s, GetCRC, 10, 0x6D, 4, Request);
}
}
return error;
}
static GSM_Error N6510_GetNextFileFolder(GSM_StateMachine *s, GSM_File *File, bool start)
{
GSM_Phone_N6510Data *Priv = &s->Phone.Data.Priv.N6510;
GSM_Error error;
if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_NOFILESYSTEM)) return ERR_NOTSUPPORTED;
@@ -4305,193 +4387,193 @@ static GSM_Error N6510_GetFilePart(GSM_StateMachine *s, GSM_File *File)
GSM_Error error;
unsigned char req[] = {
N7110_FRAME_HEADER, 0x0E, 0x00, 0x00, 0x00, 0x01,
0x00, 0x01, /* Folder or file number */
0x00, 0x00, 0x00, 0x00, /* Start from xxx byte */
0x00, 0x00,
0x03, 0xE8}; /* Read xxx bytes */
if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_NOFILESYSTEM)) return ERR_NOTSUPPORTED;
if (File->Used == 0x00) {
error = N6510_GetFileFolderInfo(s, File, ID_GetFile);
if (error != ERR_NONE) return error;
File->Used = 0;
}
old = File->Used;
req[8] = atoi(File->ID_FullName) / 256;
req[9] = atoi(File->ID_FullName) % 256;
req[10] = old / (256*256*256);
req[11] = old / (256*256);
req[12] = old / 256;
req[13] = old % 256;
s->Phone.Data.File = File;
smprintf(s, "Getting file part from filesystem\n");
error=GSM_WaitFor (s, req, 18, 0x6D, 4, ID_GetFile);
if (error != ERR_NONE) return error;
if (File->Used - old != (0x03 * 256 + 0xE8)) {
if (N6510_FindFileCheckSum(File->Buffer, File->Used) != Priv->FileCheckSum) {
smprintf(s,"File2 checksum is %i, File checksum is %i\n",N6510_FindFileCheckSum(File->Buffer, File->Used),Priv->FileCheckSum);
return ERR_WRONGCRC;
}
return ERR_EMPTY;
}
return ERR_NONE;
}
static GSM_Error N6510_SetReadOnly(GSM_StateMachine *s, unsigned char *ID, bool enable)
{
unsigned char SetAttr[] = {
N7110_FRAME_HEADER, 0x18, 0x00, 0x00, 0x00, 0x01,
0x00, 0x20}; /* File ID */
if (!enable) SetAttr[4] = 0x06;
SetAttr[8] = atoi(ID) / 256;
SetAttr[9] = atoi(ID) % 256;
smprintf(s, "Setting readonly attribute\n");
return GSM_WaitFor (s, SetAttr, 10, 0x6D, 4, ID_DeleteFile);
}
static GSM_Error N6510_ReplyAddFileHeader(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
switch (msg.Buffer[3]) {
case 0x03:
smprintf(s,"File header added\n");
sprintf(s->Phone.Data.File->ID_FullName,"%i",msg.Buffer[9]);
return ERR_NONE;
case 0x13:
return ERR_NONE;
}
return ERR_UNKNOWNRESPONSE;
}
static GSM_Error N6510_ReplyAddFilePart(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
return ERR_NONE;
}
static GSM_Error N6510_AddFilePart(GSM_StateMachine *s, GSM_File *File, int *Pos)
{
GSM_Phone_N6510Data *Priv = &s->Phone.Data.Priv.N6510;
GSM_File File2;
GSM_Error error;
int j;
unsigned char Header[400] = {
N7110_FRAME_HEADER, 0x02, 0x00, 0x00, 0x00, 0x01,
0x00, 0x0C, /* parent folder ID */
0x00, 0x00, 0x00, 0xE8};
unsigned char Add[15000] = {
N7110_FRAME_HEADER, 0x40, 0x00, 0x00, 0x00, 0x01,
0x00, 0x04, /* file ID */
0x00, 0x00,
0x01, 0x28}; /* length */
unsigned char end[30] = {
N7110_FRAME_HEADER, 0x40, 0x00, 0x00, 0x00, 0x01,
0x00, 0x04, /* file ID */
0x00, 0x00, 0x00, 0x00};
if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_NOFILESYSTEM)) return ERR_NOTSUPPORTED;
s->Phone.Data.File = File;
if (*Pos == 0) {
error = N6510_SearchForFileName(s,File);
- if (error == ERR_NONE) return ERR_INVALIDLOCATION;
+ if (error == ERR_NONE) return ERR_FILEALREADYEXIST;
if (error != ERR_EMPTY) return error;
Header[8] = atoi(File->ID_FullName) / 256;
Header[9] = atoi(File->ID_FullName) % 256;
memset(Header+14, 0x00, 300);
CopyUnicodeString(Header+14,File->Name);
Header[222] = File->Used / (256*256*256);
Header[223] = File->Used / (256*256);
Header[224] = File->Used / 256;
Header[225] = File->Used % 256;
switch(File->Type) {
case GSM_File_Image_JPG : Header[231]=0x02; Header[233]=0x01; break;
case GSM_File_Image_BMP : Header[231]=0x02; Header[233]=0x02; break;
case GSM_File_Image_PNG : Header[231]=0x02; Header[233]=0x03; break;
case GSM_File_Image_GIF : Header[231]=0x02; Header[233]=0x05; break;
case GSM_File_Image_WBMP : Header[231]=0x02; Header[233]=0x09; break;
case GSM_File_Sound_AMR : Header[231]=0x04; Header[233]=0x01; break;
case GSM_File_Sound_MIDI : Header[231]=0x04; Header[233]=0x05; break; //Header[238]=0x01;
case GSM_File_Sound_NRT : Header[231]=0x04; Header[233]=0x06; break;
case GSM_File_Video_3GP : Header[231]=0x08; Header[233]=0x05; break;
case GSM_File_Java_JAR : Header[231]=0x10; Header[233]=0x01; break;
#ifdef DEVELOP
case GSM_File_MMS:
Header[214]=0x07;
Header[215]=0xd3;
Header[216]=0x06;
Header[217]=0x01;
Header[218]=0x12;
Header[219]=0x13;
Header[220]=0x29;
Header[233]=0x01;
break;
#endif
default : Header[231]=0x01; Header[233]=0x05;
}
Header[235] = 0x01;
Header[236] = atoi(File->ID_FullName) / 256;
Header[237] = atoi(File->ID_FullName) % 256;
if (File->Protected) Header[238] = 0x01; //Nokia forward lock
if (File->Hidden) Header[241] = 0x01;
if (File->System) Header[242] = 0x01; //fixme
smprintf(s, "Adding file header\n");
error=GSM_WaitFor (s, Header, 246, 0x6D, 4, ID_AddFile);
if (error != ERR_NONE) return error;
}
j = 1000;
if (File->Used - *Pos < 1000) j = File->Used - *Pos;
Add[ 8] = atoi(File->ID_FullName) / 256;
Add[ 9] = atoi(File->ID_FullName) % 256;
Add[12] = j / 256;
Add[13] = j % 256;
memcpy(Add+14,File->Buffer+(*Pos),j);
smprintf(s, "Adding file part %i %i\n",*Pos,j);
error=GSM_WaitFor (s, Add, 14+j, 0x6D, 4, ID_AddFile);
if (error != ERR_NONE) return error;
*Pos = *Pos + j;
if (j < 1000) {
end[8] = atoi(File->ID_FullName) / 256;
end[9] = atoi(File->ID_FullName) % 256;
smprintf(s, "Frame for ending adding file\n");
error = GSM_WaitFor (s, end, 14, 0x6D, 4, ID_AddFile);
if (error != ERR_NONE) return error;
strcpy(File2.ID_FullName,File->ID_FullName);
error = N6510_GetFileFolderInfo(s, &File2, ID_GetFileInfo);
if (error != ERR_NONE) return error;
if (!File->ModifiedEmpty) {
Header[3] = 0x12;
Header[4] = 0x01;
Header[12] = 0x00;
Header[13] = 0xE8;
Header[8] = atoi(File->ID_FullName) / 256;
Header[9] = atoi(File->ID_FullName) % 256;
memset(Header+14, 0x00, 300);
CopyUnicodeString(Header+14,File->Name);
NOKIA_EncodeDateTime(s,Header+214,&File->Modified);
/* When you save too big file for phone and it changes
* size (some part is cut by firmware), you HAVE to write
* here correct file size. In other case filesystem
* will be damaged
*/
Header[224] = File2.Used / 256;
Header[225] = File2.Used % 256;
Header[226] = Priv->FileToken / 256;
Header[227] = Priv->FileToken % 256;
switch(File->Type) {
case GSM_File_Image_JPG : Header[231]=0x02; Header[233]=0x01; break;
case GSM_File_Image_BMP : Header[231]=0x02; Header[233]=0x02; break;
case GSM_File_Image_PNG : Header[231]=0x02; Header[233]=0x03; break;
case GSM_File_Image_GIF : Header[231]=0x02; Header[233]=0x05; break;
case GSM_File_Image_WBMP : Header[231]=0x02; Header[233]=0x09; break;
case GSM_File_Sound_AMR : Header[231]=0x04; Header[233]=0x01; break;
case GSM_File_Sound_MIDI : Header[231]=0x04; Header[233]=0x05; break; //Header[238]=0x01;
@@ -4721,422 +4803,413 @@ static GSM_Error N6510_SetGPRSAccessPoint(GSM_StateMachine *s, GSM_GPRSAccessPoi
N7110_FRAME_HEADER, 0x05, 0x00, 0x00, 0x00, 0x2C, 0x00,
0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00};
if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_NOGPRSPOINT)) return ERR_NOTSUPPORTED;
if (point->Location < 1) return ERR_UNKNOWN;
if (point->Location > 5) return ERR_INVALIDLOCATION;
s->Phone.Data.GPRSPoint = point;
#ifdef DEVELOP
error = N6510_EnableGPRSAccessPoint(s);
if (error != ERR_NONE) return error;
#endif
smprintf(s, "Getting GPRS access point name\n");
error=GSM_WaitFor (s, Name, 16, 0x43, 4, ID_SetGPRSPoint);
if (error != ERR_NONE) return error;
CopyUnicodeString(buff+18+(point->Location-1)*42,point->Name);
buff[0] = 0x00;
buff[1] = 0x01;
buff[2] = 0x01;
buff[3] = 0x07;
smprintf(s, "Setting GPRS access point name\n");
error=GSM_WaitFor (s, buff, s->Phone.Data.Priv.N6510.GPRSPointsLength, 0x43, 4, ID_SetGPRSPoint);
if (error != ERR_NONE) return error;
smprintf(s, "Getting GPRS access point URL\n");
error=GSM_WaitFor (s, URL, 16, 0x43, 4, ID_SetGPRSPoint);
if (error != ERR_NONE) return error;
CopyUnicodeString(buff+18+(point->Location-1)*42,point->URL);
buff[0] = 0x00;
buff[1] = 0x01;
buff[2] = 0x01;
buff[3] = 0x07;
smprintf(s, "Setting GPRS access point URL\n");
error=GSM_WaitFor (s, buff, s->Phone.Data.Priv.N6510.GPRSPointsLength, 0x43, 4, ID_SetGPRSPoint);
if (error != ERR_NONE) return error;
if (point->Active) {
smprintf(s, "Getting number of active GPRS access point\n");
error=GSM_WaitFor (s, Active, 16, 0x43, 4, ID_SetGPRSPoint);
if (error != ERR_NONE) return error;
buff[0] = 0x00;
buff[1] = 0x01;
buff[2] = 0x01;
buff[3] = 0x07;
buff[18]= point->Location;
smprintf(s, "Setting number of active GPRS access point\n");
error=GSM_WaitFor (s, buff, s->Phone.Data.Priv.N6510.GPRSPointsLength, 0x43, 4, ID_SetGPRSPoint);
if (error != ERR_NONE) return error;
}
return error;
}
/* ToDo support - 6310 style */
static GSM_Error N6510_ReplyGetToDoStatus1(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
int i;
GSM_NOKIACalToDoLocations *Last = &s->Phone.Data.Priv.N6510.LastToDo;
smprintf(s, "TODO locations received\n");
Last->Number=msg.Buffer[6]*256+msg.Buffer[7];
smprintf(s, "Number of Entries: %i\n",Last->Number);
smprintf(s, "Locations: ");
for (i=0;i<Last->Number;i++) {
Last->Location[i]=msg.Buffer[12+(i*4)]*256+msg.Buffer[(i*4)+13];
smprintf(s, "%i ",Last->Location[i]);
}
smprintf(s, "\n");
return ERR_NONE;
}
/* ToDo support - 6310 style */
static GSM_Error N6510_GetToDoStatus1(GSM_StateMachine *s, GSM_ToDoStatus *status)
{
GSM_Error error;
GSM_NOKIACalToDoLocations *LastToDo = &s->Phone.Data.Priv.N6510.LastToDo;
unsigned char reqLoc[] = {
N6110_FRAME_HEADER,
0x15, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00};
smprintf(s, "Getting ToDo locations\n");
error = GSM_WaitFor (s, reqLoc, 10, 0x55, 4, ID_GetToDo);
if (error != ERR_NONE) return error;
status->Used = LastToDo->Number;
return ERR_NONE;
}
static GSM_Error N6510_GetToDoStatus2(GSM_StateMachine *s, GSM_ToDoStatus *status)
{
GSM_NOKIACalToDoLocations *LastToDo = &s->Phone.Data.Priv.N6510.LastToDo;
GSM_Error error;
- error = N6510_GetCalendarInfo3(s,LastToDo,false);
+ error = N6510_GetCalendarInfo3(s,LastToDo,1);
if (error!=ERR_NONE) return error;
status->Used = LastToDo->Number;
return ERR_NONE;
}
static GSM_Error N6510_GetToDoStatus(GSM_StateMachine *s, GSM_ToDoStatus *status)
{
status->Used = 0;
if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO63)) {
return N6510_GetToDoStatus1(s, status);
} else if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO66)) {
return N6510_GetToDoStatus2(s, status);
} else {
return ERR_NOTSUPPORTED;
}
}
/* ToDo support - 6310 style */
static GSM_Error N6510_ReplyGetToDo1(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
GSM_ToDoEntry *Last = s->Phone.Data.ToDo;
smprintf(s, "TODO received method 1\n");
switch (msg.Buffer[4]) {
case 1 : Last->Priority = GSM_Priority_High; break;
case 2 : Last->Priority = GSM_Priority_Medium; break;
case 3 : Last->Priority = GSM_Priority_Low; break;
default : return ERR_UNKNOWN;
}
smprintf(s, "Priority: %i\n",msg.Buffer[4]);
CopyUnicodeString(Last->Entries[0].Text,msg.Buffer+14);
Last->Entries[0].EntryType = TODO_TEXT;
Last->EntriesNum = 1;
smprintf(s, "Text: \"%s\"\n",DecodeUnicodeString(Last->Entries[0].Text));
return ERR_NONE;
}
/* ToDo support - 6310 style */
static GSM_Error N6510_GetNextToDo1(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool refresh)
{
GSM_Error error;
GSM_ToDoStatus status;
GSM_NOKIACalToDoLocations *LastToDo = &s->Phone.Data.Priv.N6510.LastToDo;
unsigned char reqGet[] = {
N6110_FRAME_HEADER,
0x03, 0x00, 0x00, 0x80, 0x00,
0x00, 0x17}; /* Location */
if (refresh) {
error = N6510_GetToDoStatus(s, &status);
if (error != ERR_NONE) return error;
ToDo->Location = 1;
} else {
ToDo->Location++;
}
if (ToDo->Location > LastToDo->Number) return ERR_EMPTY;
reqGet[8] = LastToDo->Location[ToDo->Location-1] / 256;
reqGet[9] = LastToDo->Location[ToDo->Location-1] % 256;
s->Phone.Data.ToDo = ToDo;
smprintf(s, "Getting ToDo\n");
return GSM_WaitFor (s, reqGet, 10, 0x55, 4, ID_GetToDo);
}
static GSM_Error N6510_ReplyGetToDoStatus2(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
return N6510_ReplyGetCalendarInfo3(msg, s, &s->Phone.Data.Priv.N6510.LastToDo);
}
/* Similiar to getting calendar method 3 */
static GSM_Error N6510_ReplyGetToDo2(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
GSM_ToDoEntry *Last = s->Phone.Data.ToDo;
GSM_DateTime Date;
unsigned long diff;
smprintf(s, "ToDo received method 2\n");
switch (msg.Buffer[44]) {
case 0x10: Last->Priority = GSM_Priority_Low; break;
case 0x20: Last->Priority = GSM_Priority_Medium; break;
case 0x30: Last->Priority = GSM_Priority_High; break;
default : return ERR_UNKNOWN;
}
memcpy(Last->Entries[0].Text,msg.Buffer+54,msg.Buffer[51]*2);
Last->Entries[0].Text[msg.Buffer[51]*2] = 0;
Last->Entries[0].Text[msg.Buffer[51]*2+1] = 0;
Last->Entries[0].EntryType = TODO_TEXT;
smprintf(s, "Text: \"%s\"\n",DecodeUnicodeString(Last->Entries[0].Text));
smprintf(s,"EndTime: %04i-%02i-%02i %02i:%02i\n",
msg.Buffer[34]*256+msg.Buffer[35],
msg.Buffer[36],msg.Buffer[37],msg.Buffer[38],
msg.Buffer[39]);
Date.Year = msg.Buffer[34]*256+msg.Buffer[35];
Date.Month = msg.Buffer[36];
Date.Day = msg.Buffer[37];
Date.Hour = msg.Buffer[38];
Date.Minute = msg.Buffer[39];
Date.Second = 0;
Last->Entries[1].EntryType = TODO_END_DATETIME;
memcpy(&Last->Entries[1].Date,&Date,sizeof(GSM_DateTime));
smprintf(s,"StartTime: %04i-%02i-%02i %02i:%02i\n",
msg.Buffer[28]*256+msg.Buffer[29],
msg.Buffer[30],msg.Buffer[31],msg.Buffer[32],
msg.Buffer[33]);
Date.Year = msg.Buffer[28]*256+msg.Buffer[29];
Date.Month = msg.Buffer[30];
Date.Day = msg.Buffer[31];
Date.Hour = msg.Buffer[32];
Date.Minute = msg.Buffer[33];
Date.Second = 0;
Last->EntriesNum = 2;
if (msg.Buffer[45] == 0x01) {
Last->Entries[2].Number = msg.Buffer[45];
Last->Entries[2].EntryType = TODO_COMPLETED;
Last->EntriesNum++;
smprintf(s,"Completed\n");
}
- if (msg.Buffer[14] == 0xFF && msg.Buffer[15] == 0xFF && msg.Buffer[16] == 0xff && msg.Buffer[17] == 0xff)
- {
+ if (msg.Buffer[14] == 0xFF && msg.Buffer[15] == 0xFF && msg.Buffer[16] == 0xff && msg.Buffer[17] == 0xff) {
smprintf(s, "No alarm\n");
} else {
diff = ((unsigned int)msg.Buffer[14]) << 24;
diff += ((unsigned int)msg.Buffer[15]) << 16;
diff += ((unsigned int)msg.Buffer[16]) << 8;
diff += msg.Buffer[17];
memcpy(&Last->Entries[Last->EntriesNum].Date,&Date,sizeof(GSM_DateTime));
GetTimeDifference(diff, &Last->Entries[Last->EntriesNum].Date, false, 60);
smprintf(s, "Alarm date : %02i-%02i-%04i %02i:%02i:%02i\n",
Last->Entries[Last->EntriesNum].Date.Day, Last->Entries[Last->EntriesNum].Date.Month,
Last->Entries[Last->EntriesNum].Date.Year, Last->Entries[Last->EntriesNum].Date.Hour,
Last->Entries[Last->EntriesNum].Date.Minute,Last->Entries[Last->EntriesNum].Date.Second);
Last->Entries[Last->EntriesNum].EntryType = TODO_ALARM_DATETIME;
if (msg.Buffer[22]==0x00 && msg.Buffer[23]==0x00 &&
msg.Buffer[24]==0x00 && msg.Buffer[25]==0x00)
{
Last->Entries[Last->EntriesNum].EntryType = TODO_SILENT_ALARM_DATETIME;
smprintf(s, "Alarm type : Silent\n");
}
Last->EntriesNum++;
}
return ERR_NONE;
}
/* ToDo support - 6610 style */
static GSM_Error N6510_GetNextToDo2(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool refresh)
{
GSM_Error error;
GSM_NOKIACalToDoLocations *LastToDo = &s->Phone.Data.Priv.N6510.LastToDo;
- /* The same to getting calendar method 3 */
- unsigned char req[] = {
- N6110_FRAME_HEADER,0x7D,0x00,0x00,0x00,0x00,
- 0x00,0x99, /* Location */
- 0xff,0xff,0xff,0xff,0x01};
if (refresh) {
- error=N6510_GetCalendarInfo3(s,LastToDo,false);
+ error=N6510_GetCalendarInfo3(s,LastToDo,1);
if (error!=ERR_NONE) return error;
ToDo->Location = 1;
} else {
ToDo->Location++;
}
if (ToDo->Location > LastToDo->Number) return ERR_EMPTY;
- req[8] = LastToDo->Location[ToDo->Location-1] / 256;
- req[9] = LastToDo->Location[ToDo->Location-1] % 256;
-
s->Phone.Data.ToDo = ToDo;
smprintf(s, "Getting todo method 2\n");
- return GSM_WaitFor (s, req, 15, 0x13, 4, ID_GetToDo);
+ return N6510_PrivGetGenericCalendar3(s, LastToDo->Location[ToDo->Location-1], ID_GetToDo);
}
static GSM_Error N6510_GetNextToDo(GSM_StateMachine *s, GSM_ToDoEntry *ToDo, bool refresh)
{
if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO63)) {
return N6510_GetNextToDo1(s, ToDo, refresh);
} else if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO66)) {
return N6510_GetNextToDo2(s, ToDo, refresh);
} else {
return ERR_NOTSUPPORTED;
}
}
/* ToDo support - 6310 style */
static GSM_Error N6510_ReplyDeleteAllToDo1(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
smprintf(s, "All TODO deleted\n");
return ERR_NONE;
}
/* ToDo support - 6310 style */
static GSM_Error N6510_DeleteAllToDo1(GSM_StateMachine *s)
{
unsigned char req[] = {N6110_FRAME_HEADER, 0x11};
if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO63)) {
return ERR_NOTSUPPORTED;
}
smprintf(s, "Deleting all ToDo method 1\n");
return GSM_WaitFor (s, req, 4, 0x55, 4, ID_DeleteAllToDo);
}
static GSM_Error N6510_DeleteToDo2(GSM_StateMachine *s, GSM_ToDoEntry *ToDo)
{
GSM_Error error;
GSM_NOKIACalToDoLocations *LastToDo = &s->Phone.Data.Priv.N6510.LastToDo;
GSM_CalendarEntry Note;
if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_TODO66)) {
return ERR_NOTSUPPORTED;
}
- error=N6510_GetCalendarInfo3(s,LastToDo,false);
+ error=N6510_GetCalendarInfo3(s,LastToDo,1);
if (error!=ERR_NONE) return error;
smprintf(s, "Deleting ToDo method 2\n");
if (ToDo->Location > LastToDo->Number || ToDo->Location == 0) return ERR_INVALIDLOCATION;
Note.Location = LastToDo->Location[ToDo->Location-1];
return N71_65_DelCalendar(s,&Note);
}
/* ToDo support - 6310 style */
static GSM_Error N6510_ReplyGetToDoFirstLoc1(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
smprintf(s, "TODO first location received method 1: %02x\n",msg.Buffer[9]);
s->Phone.Data.ToDo->Location = msg.Buffer[9];
return ERR_NONE;
}
/* ToDo support - 6310 style */
static GSM_Error N6510_ReplyAddToDo1(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
smprintf(s, "TODO set OK\n");
return ERR_NONE;
}
/* ToDo support - 6310 style */
static GSM_Error N6510_AddToDo1(GSM_StateMachine *s, GSM_ToDoEntry *ToDo)
{
int Text, Alarm, EndTime, Completed, ulen, Phone;
GSM_Error error;
unsigned char reqLoc[] = {N6110_FRAME_HEADER, 0x0F};
unsigned char reqSet[500] = {
N6110_FRAME_HEADER, 0x01,
0x03, /* Priority */
0x00, /* Length of text */
0x80,0x00,0x00,
0x18}; /* Location */
s->Phone.Data.ToDo = ToDo;
smprintf(s, "Getting first ToDo location\n");
error = GSM_WaitFor (s, reqLoc, 4, 0x55, 4, ID_SetToDo);
if (error != ERR_NONE) return error;
reqSet[9] = ToDo->Location;
switch (ToDo->Priority) {
case GSM_Priority_Low : reqSet[4] = 3; break;
case GSM_Priority_Medium: reqSet[4] = 2; break;
case GSM_Priority_High : reqSet[4] = 1; break;
}
GSM_ToDoFindDefaultTextTimeAlarmCompleted(ToDo, &Text, &Alarm, &Completed, &EndTime, &Phone);
if (Text == -1) return ERR_NOTSUPPORTED; /* XXX: shouldn't this be handled different way? */
ulen = UnicodeLength(ToDo->Entries[Text].Text);
reqSet[5] = ulen+1;
CopyUnicodeString(reqSet+10,ToDo->Entries[Text].Text);
reqSet[10+ulen*2] = 0x00;
reqSet[10+ulen*2+1] = 0x00;
smprintf(s, "Adding ToDo method 1\n");
return GSM_WaitFor (s, reqSet, 12+ulen*2, 0x55, 4, ID_SetToDo);
}
static GSM_Error N6510_ReplyAddToDo2(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
smprintf(s, "ToDo added method 2\n");
return ERR_NONE;
}
static GSM_Error N6510_ReplyGetToDoFirstLoc2(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
smprintf(s, "First ToDo location method 2: %i\n",msg.Buffer[8]*256+msg.Buffer[9]);
s->Phone.Data.ToDo->Location = msg.Buffer[9];
return ERR_NONE;
}
static GSM_Error N6510_AddToDo2(GSM_StateMachine *s, GSM_ToDoEntry *ToDo)
{
GSM_CalendarEntry Note;
time_t t_time1,t_time2;
long diff;
GSM_Error error;
GSM_DateTime DT;
int Text, Alarm, EndTime, Completed, count=54, Phone;
unsigned char reqLoc[] = {N6110_FRAME_HEADER, 0x95, 0x01};
unsigned char req[5000] = {
N6110_FRAME_HEADER, 0x65,
0x01, /* 0 = calendar, 1 = todo */
0x00, 0x00, 0x00,
0x00, 0x00, /* location */
0x00, 0x00, 0x00, 0x00,
0xFF, 0xFF, 0xFF, 0xFF, /* alarm */
0x80, 0x00, 0x00,
0x01, /* note icon */
0xFF, 0xFF, 0xFF, 0xFF, /* alarm type */
0x00, /* 0x02 or 0x00 */
@@ -5358,425 +5431,434 @@ GSM_Error N6510_CancelCall(GSM_StateMachine *s, int ID, bool all)
GSM_Error N6510_AnswerCall(GSM_StateMachine *s, int ID, bool all)
{
if (all) return ERR_NOTSUPPORTED;
return DCT3DCT4_AnswerCall(s,ID);
}
static GSM_Error N6510_ReplyAddSMSFolder(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
smprintf(s,"SMS folder \"%s\" has been added\n",DecodeUnicodeString(msg.Buffer+10));
return ERR_NONE;
}
GSM_Error N6510_AddSMSFolder(GSM_StateMachine *s, unsigned char *name)
{
unsigned char req[200] = {N6110_FRAME_HEADER, 0x10, 0x01, 0x00, 0x01,
0x00, /* Length */
0x00, 0x00};
CopyUnicodeString(req+10,name);
req[7] = UnicodeLength(name)*2 + 6;
smprintf(s, "Adding SMS folder\n");
return GSM_WaitFor (s, req, req[7] + 6, 0x14, 4, ID_AddSMSFolder);
}
static GSM_Error N6510_SetWAPBookmark(GSM_StateMachine *s, GSM_WAPBookmark *bookmark)
{
GSM_Error error;
int count=4, location;
unsigned char req[600] = {N6110_FRAME_HEADER, 0x09};
/* We have to enable WAP frames in phone */
error=N6510_EnableConnectionFunctions(s,N6510_WAP_SETTINGS);
if (error!=ERR_NONE) return error;
location = bookmark->Location - 1;
if (bookmark->Location == 0) location = 0xffff;
req[count++] = (location & 0xff00) >> 8;
req[count++] = location & 0x00ff;
count += NOKIA_SetUnicodeString(s, req+count, bookmark->Title, true);
count += NOKIA_SetUnicodeString(s, req+count, bookmark->Address, true);
req[count++] = 0x00;
req[count++] = 0x00;
req[count++] = 0x00;
req[count++] = 0x00;
smprintf(s, "Setting WAP bookmark\n");
error = GSM_WaitFor (s, req, count, 0x3f, 4, ID_SetWAPBookmark);
if (error != ERR_NONE) {
if (error == ERR_INSIDEPHONEMENU || error == ERR_EMPTY || error == ERR_FULL) {
DCT3DCT4_DisableConnectionFunctions(s);
}
return error;
}
return DCT3DCT4_DisableConnectionFunctions(s);
}
GSM_Error N6510_DeleteWAPBookmark(GSM_StateMachine *s, GSM_WAPBookmark *bookmark)
{
GSM_Error error;
/* We have to enable WAP frames in phone */
error=N6510_EnableConnectionFunctions(s,N6510_WAP_SETTINGS);
if (error!=ERR_NONE) return error;
return DCT3DCT4_DeleteWAPBookmarkPart(s,bookmark);
}
GSM_Error N6510_GetWAPBookmark(GSM_StateMachine *s, GSM_WAPBookmark *bookmark)
{
GSM_Error error;
/* We have to enable WAP frames in phone */
error=N6510_EnableConnectionFunctions(s,N6510_WAP_SETTINGS);
if (error!=ERR_NONE) return error;
return DCT3DCT4_GetWAPBookmarkPart(s,bookmark);
}
static GSM_Reply_Function N6510ReplyFunctions[] = {
{N71_65_ReplyCallInfo, "\x01",0x03,0x02,ID_IncomingFrame },
{N71_65_ReplyCallInfo, "\x01",0x03,0x03,ID_IncomingFrame },
{N71_65_ReplyCallInfo, "\x01",0x03,0x04,ID_IncomingFrame },
{N71_65_ReplyCallInfo, "\x01",0x03,0x05,ID_IncomingFrame },
{N71_65_ReplyCallInfo, "\x01",0x03,0x07,ID_AnswerCall },
{N71_65_ReplyCallInfo, "\x01",0x03,0x07,ID_IncomingFrame },
{N71_65_ReplyCallInfo, "\x01",0x03,0x09,ID_CancelCall },
{N71_65_ReplyCallInfo, "\x01",0x03,0x09,ID_IncomingFrame },
{N71_65_ReplyCallInfo, "\x01",0x03,0x0A,ID_IncomingFrame },
{N71_65_ReplyCallInfo, "\x01",0x03,0x0B,ID_IncomingFrame },
{N71_65_ReplyCallInfo, "\x01",0x03,0x0C,ID_DialVoice },
{N71_65_ReplyCallInfo, "\x01",0x03,0x0C,ID_IncomingFrame },
+ {N71_65_ReplyCallInfo, "\x01",0x03,0x0F,ID_IncomingFrame },
+ {N71_65_ReplyCallInfo, "\x01",0x03,0x10,ID_DialVoice },
+ {N71_65_ReplyCallInfo, "\x01",0x03,0x10,ID_IncomingFrame },
{N71_65_ReplyCallInfo, "\x01",0x03,0x23,ID_IncomingFrame },
{N71_65_ReplyCallInfo, "\x01",0x03,0x25,ID_IncomingFrame },
{N71_65_ReplyCallInfo, "\x01",0x03,0x27,ID_IncomingFrame },
{N71_65_ReplySendDTMF, "\x01",0x03,0x51,ID_SendDTMF },
{N71_65_ReplyCallInfo, "\x01",0x03,0x53,ID_IncomingFrame },
{N71_65_ReplySendDTMF, "\x01",0x03,0x59,ID_SendDTMF },
{N71_65_ReplySendDTMF, "\x01",0x03,0x5E,ID_SendDTMF },
+ {N71_65_ReplyCallInfo, "\x01",0x03,0xA6,ID_IncomingFrame },
+ {N71_65_ReplyCallInfo, "\x01",0x03,0xD2,ID_IncomingFrame },
+ {N71_65_ReplyCallInfo, "\x01",0x03,0xD3,ID_IncomingFrame },
{N6510_ReplySendSMSMessage, "\x02",0x03,0x03,ID_IncomingFrame },
{N6510_ReplyIncomingSMS, "\x02",0x03,0x04,ID_IncomingFrame },
{N6510_ReplySetSMSC, "\x02",0x03,0x13,ID_SetSMSC },
{N6510_ReplyGetSMSC, "\x02",0x03,0x15,ID_GetSMSC },
{N6510_ReplyGetMemoryStatus, "\x03",0x03,0x04,ID_GetMemoryStatus },
{N6510_ReplyGetMemory, "\x03",0x03,0x08,ID_GetMemory },
{N6510_ReplyDeleteMemory, "\x03",0x03,0x10,ID_SetMemory },
{N71_65_ReplyWritePhonebook, "\x03",0x03,0x0C,ID_SetBitmap },
{N71_65_ReplyWritePhonebook, "\x03",0x03,0x0C,ID_SetMemory },
{DCT3DCT4_ReplyCallDivert, "\x06",0x03,0x02,ID_Divert },
{N71_65_ReplyUSSDInfo, "\x06",0x03,0x03,ID_IncomingFrame },
{NoneReply, "\x06",0x03,0x06,ID_IncomingFrame },
{NoneReply, "\x06",0x03,0x09,ID_IncomingFrame },
{N6510_ReplyEnterSecurityCode, "\x08",0x03,0x08,ID_EnterSecurityCode },
{N6510_ReplyEnterSecurityCode, "\x08",0x03,0x09,ID_EnterSecurityCode },
{N6510_ReplyGetSecurityStatus, "\x08",0x03,0x12,ID_GetSecurityStatus },
{N6510_ReplyGetNetworkInfo, "\x0A",0x03,0x01,ID_GetNetworkInfo },
{N6510_ReplyGetNetworkInfo, "\x0A",0x03,0x01,ID_IncomingFrame },
{N6510_ReplyLogIntoNetwork, "\x0A",0x03,0x02,ID_IncomingFrame },
{N6510_ReplyGetSignalQuality, "\x0A",0x03,0x0C,ID_GetSignalQuality },
{N6510_ReplyGetIncSignalQuality, "\x0A",0x03,0x1E,ID_IncomingFrame },
{NoneReply, "\x0A",0x03,0x20,ID_IncomingFrame },
{N6510_ReplyGetOperatorLogo, "\x0A",0x03,0x24,ID_GetBitmap },
{N6510_ReplySetOperatorLogo, "\x0A",0x03,0x26,ID_SetBitmap },
{NoneReply, "\x0B",0x03,0x01,ID_PlayTone },
{NoneReply, "\x0B",0x03,0x15,ID_PlayTone },
{NoneReply, "\x0B",0x03,0x16,ID_PlayTone },
{N71_65_ReplyAddCalendar1, "\x13",0x03,0x02,ID_SetCalendarNote },
{N71_65_ReplyAddCalendar1, "\x13",0x03,0x04,ID_SetCalendarNote },
{N71_65_ReplyAddCalendar1, "\x13",0x03,0x06,ID_SetCalendarNote },
{N71_65_ReplyAddCalendar1, "\x13",0x03,0x08,ID_SetCalendarNote },
{N71_65_ReplyDelCalendar, "\x13",0x03,0x0C,ID_DeleteCalendarNote },
{N71_65_ReplyGetNextCalendar1, "\x13",0x03,0x1A,ID_GetCalendarNote },/*method 1*/
{N6510_ReplyGetCalendarNotePos, "\x13",0x03,0x32,ID_GetCalendarNotePos },/*method 1*/
{N6510_ReplyGetCalendarInfo, "\x13",0x03,0x3B,ID_GetCalendarNotesInfo},/*method 1*/
#ifdef DEBUG
{N71_65_ReplyGetNextCalendar2, "\x13",0x03,0x3F,ID_GetCalendarNote },
#endif
{N71_65_ReplyAddCalendar2, "\x13",0x03,0x41,ID_SetCalendarNote },/*method 2*/
{N6510_ReplyAddCalendar3, "\x13",0x03,0x66,ID_SetCalendarNote },/*method 3*/
{N6510_ReplyAddToDo2, "\x13",0x03,0x66,ID_SetToDo },
{N6510_ReplyGetCalendar3, "\x13",0x03,0x7E,ID_GetCalendarNote },/*method 3*/
{N6510_ReplyGetToDo2, "\x13",0x03,0x7E,ID_GetToDo },
+ {N6510_ReplyGetNote, "\x13",0x03,0x7E,ID_GetNote },
{N6510_ReplyGetCalendarSettings, "\x13",0x03,0x86,ID_GetCalendarSettings },
{N6510_ReplyGetLocale, "\x13",0x03,0x8A,ID_GetLocale },
{N6510_ReplyGetCalendarSettings, "\x13",0x03,0x8E,ID_GetCalendarSettings },
{N6510_ReplyGetCalendarNotePos, "\x13",0x03,0x96,ID_GetCalendarNotePos },/*method 3*/
{N6510_ReplyGetToDoFirstLoc2, "\x13",0x03,0x96,ID_SetToDo },
{N6510_ReplyGetCalendarInfo, "\x13",0x03,0x9F,ID_GetCalendarNotesInfo},/*method 3*/
{N6510_ReplyGetToDoStatus2, "\x13",0x03,0x9F,ID_GetToDo },
+ {N6510_ReplyGetNoteInfo, "\x13",0x03,0x9F,ID_GetNote },
{N6510_ReplySaveSMSMessage, "\x14",0x03,0x01,ID_SaveSMSMessage },
{N6510_ReplySetPicture, "\x14",0x03,0x01,ID_SetBitmap },
{N6510_ReplyGetSMSMessage, "\x14",0x03,0x03,ID_GetSMSMessage },
{N6510_ReplyDeleteSMSMessage, "\x14",0x03,0x05,ID_DeleteSMSMessage },
{N6510_ReplyDeleteSMSMessage, "\x14",0x03,0x06,ID_DeleteSMSMessage },
{N6510_ReplyGetSMSStatus, "\x14",0x03,0x09,ID_GetSMSStatus },
{N6510_ReplyGetSMSFolderStatus, "\x14",0x03,0x0d,ID_GetSMSFolderStatus },
{N6510_ReplyGetSMSMessage, "\x14",0x03,0x0f,ID_GetSMSMessage },
{N6510_ReplyAddSMSFolder, "\x14",0x03,0x11,ID_AddSMSFolder },
{N6510_ReplyGetSMSFolders, "\x14",0x03,0x13,ID_GetSMSFolders },
{N6510_ReplySaveSMSMessage, "\x14",0x03,0x17,ID_SaveSMSMessage },
{N6510_ReplyGetSMSStatus, "\x14",0x03,0x1a,ID_GetSMSStatus },
{DCT4_ReplySetPhoneMode, "\x15",0x03,0x64,ID_Reset },
{DCT4_ReplyGetPhoneMode, "\x15",0x03,0x65,ID_Reset },
{NoneReply, "\x15",0x03,0x68,ID_Reset },
{N6510_ReplyGetBatteryCharge, "\x17",0x03,0x0B,ID_GetBatteryCharge },
{N6510_ReplySetDateTime, "\x19",0x03,0x02,ID_SetDateTime },
{N6510_ReplyGetDateTime, "\x19",0x03,0x0B,ID_GetDateTime },
{N6510_ReplySetAlarm, "\x19",0x03,0x12,ID_SetAlarm },
{N6510_ReplyGetAlarm, "\x19",0x03,0x1A,ID_GetAlarm },
{N6510_ReplyGetAlarm, "\x19",0x03,0x20,ID_GetAlarm },
{DCT4_ReplyGetIMEI, "\x1B",0x03,0x01,ID_GetIMEI },
{NOKIA_ReplyGetPhoneString, "\x1B",0x03,0x08,ID_GetHardware },
{N6510_ReplyGetPPM, "\x1B",0x03,0x08,ID_GetPPM },
{NOKIA_ReplyGetPhoneString, "\x1B",0x03,0x0C,ID_GetProductCode },
/* 0x1C - vibra */
{N6510_ReplyGetRingtonesInfo, "\x1f",0x03,0x08,ID_GetRingtonesInfo },
{N6510_ReplyDeleteRingtones, "\x1f",0x03,0x11,ID_SetRingtone },
{N6510_ReplyGetRingtone, "\x1f",0x03,0x13,ID_GetRingtone },
{N6510_ReplySetBinRingtone, "\x1f",0x03,0x0F,ID_SetRingtone },
/* 0x23 - voice records */
{N6510_ReplyGetProfile, "\x39",0x03,0x02,ID_GetProfile },
{N6510_ReplySetProfile, "\x39",0x03,0x04,ID_SetProfile },
{N6510_ReplyGetProfile, "\x39",0x03,0x06,ID_GetProfile },
{N6510_ReplySetLight, "\x3A",0x03,0x06,ID_SetLight },
{N6510_ReplyGetFMStation, "\x3E",0x03,0x06,ID_GetFMStation },
{N6510_ReplyGetFMStatus, "\x3E",0x03,0x0E,ID_GetFMStation },
{N6510_ReplySetFMStation, "\x3E",0x03,0x15,ID_SetFMStation },
{N6510_ReplyGetFMStation, "\x3E",0x03,0x16,ID_GetFMStation },
{DCT3DCT4_ReplyEnableConnectFunc, "\x3f",0x03,0x01,ID_EnableConnectFunc },
{DCT3DCT4_ReplyEnableConnectFunc, "\x3f",0x03,0x02,ID_EnableConnectFunc },
{DCT3DCT4_ReplyDisableConnectFunc,"\x3f",0x03,0x04,ID_DisableConnectFunc },
{DCT3DCT4_ReplyDisableConnectFunc,"\x3f",0x03,0x05,ID_DisableConnectFunc },
{N6510_ReplyGetWAPBookmark, "\x3f",0x03,0x07,ID_GetWAPBookmark },
{N6510_ReplyGetWAPBookmark, "\x3f",0x03,0x08,ID_GetWAPBookmark },
{DCT3DCT4_ReplySetWAPBookmark, "\x3f",0x03,0x0A,ID_SetWAPBookmark },
{DCT3DCT4_ReplySetWAPBookmark, "\x3f",0x03,0x0B,ID_SetWAPBookmark },
{DCT3DCT4_ReplyDelWAPBookmark, "\x3f",0x03,0x0D,ID_DeleteWAPBookmark },
{DCT3DCT4_ReplyDelWAPBookmark, "\x3f",0x03,0x0E,ID_DeleteWAPBookmark },
{DCT3DCT4_ReplyGetActiveConnectSet,"\x3f",0x03,0x10,ID_GetConnectSet },
{DCT3DCT4_ReplySetActiveConnectSet,"\x3f",0x03,0x13,ID_SetConnectSet },
{N6510_ReplyGetConnectionSettings,"\x3f",0x03,0x16,ID_GetConnectSet },
{N6510_ReplyGetConnectionSettings,"\x3f",0x03,0x17,ID_GetConnectSet },
{N6510_ReplySetConnectionSettings,"\x3f",0x03,0x19,ID_SetConnectSet },
{N6510_ReplySetConnectionSettings,"\x3f",0x03,0x1A,ID_SetConnectSet },
{N6510_ReplySetConnectionSettings,"\x3f",0x03,0x28,ID_SetConnectSet },
{N6510_ReplySetConnectionSettings,"\x3f",0x03,0x2B,ID_SetConnectSet },
{N6510_ReplyGetChatSettings, "\x3f",0x03,0x3B,ID_GetChatSettings },
{N6510_ReplyGetChatSettings, "\x3f",0x03,0x3C,ID_GetChatSettings },
{N6510_ReplyGetOriginalIMEI, "\x42",0x07,0x00,ID_GetOriginalIMEI },
{N6510_ReplyGetManufactureMonth, "\x42",0x07,0x00,ID_GetManufactureMonth },
{N6510_ReplyGetOriginalIMEI, "\x42",0x07,0x01,ID_GetOriginalIMEI },
{N6510_ReplyGetManufactureMonth, "\x42",0x07,0x02,ID_GetManufactureMonth },
{N6510_ReplySetOperatorLogo, "\x43",0x03,0x08,ID_SetBitmap },
{N6510_ReplyGetGPRSAccessPoint, "\x43",0x03,0x06,ID_GetGPRSPoint },
{N6510_ReplySetGPRSAccessPoint1, "\x43",0x03,0x06,ID_SetGPRSPoint },
#ifdef DEVELOP
{N6510_ReplyEnableGPRSAccessPoint,"\x43",0x03,0x06,ID_EnableGPRSPoint },
#endif
{N6510_ReplyGetSyncMLSettings, "\x43",0x03,0x06,ID_GetSyncMLSettings },
{N6510_ReplyGetSyncMLName, "\x43",0x03,0x06,ID_GetSyncMLName },
{NoneReply, "\x43",0x03,0x08,ID_SetGPRSPoint },
/* 0x4A - voice records */
/* 0x53 - simlock */
{N6510_ReplyAddToDo1, "\x55",0x03,0x02,ID_SetToDo },
{N6510_ReplyGetToDo1, "\x55",0x03,0x04,ID_GetToDo },
{N6510_ReplyGetToDoFirstLoc1, "\x55",0x03,0x10,ID_SetToDo },
{N6510_ReplyDeleteAllToDo1, "\x55",0x03,0x12,ID_DeleteAllToDo },
{N6510_ReplyGetToDoStatus1, "\x55",0x03,0x16,ID_GetToDo },
{N6510_ReplyAddFileHeader, "\x6D",0x03,0x03,ID_AddFile },
{N6510_ReplyAddFolder, "\x6D",0x03,0x05,ID_AddFolder },
{N6510_ReplyGetFilePart, "\x6D",0x03,0x0F,ID_GetFile },
{N6510_ReplyAddFileHeader, "\x6D",0x03,0x13,ID_AddFile },
{N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x15,ID_GetFileInfo },
{N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x15,ID_GetFile },
{N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x15,ID_AddFile },
{N6510_ReplyDeleteFile, "\x6D",0x03,0x19,ID_DeleteFile },
{N6510_ReplyDeleteFile, "\x6D",0x03,0x1F,ID_DeleteFile },
{N6510_ReplyGetFileSystemStatus, "\x6D",0x03,0x23,ID_FileSystemStatus },
{N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x2F,ID_GetFileInfo },
{N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x2F,ID_GetFile },
{N6510_ReplyGetFileSystemStatus, "\x6D",0x03,0x2F,ID_FileSystemStatus },
{N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x33,ID_GetFileInfo },
{N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x33,ID_GetFile },
{N6510_ReplyAddFilePart, "\x6D",0x03,0x41,ID_AddFile },
{N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x43,ID_AddFile },
{N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x43,ID_GetFile },
{N6510_ReplyGetFileFolderInfo, "\x6D",0x03,0x43,ID_GetFileInfo },
{N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x01,ID_GetBitmap },
{N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x01,ID_SetBitmap },
{N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x0F,ID_GetBitmap },
{N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x0F,ID_SetBitmap },
{N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x10,ID_GetBitmap },
{N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x10,ID_SetBitmap },
{N6510_ReplyStartupNoteLogo, "\x7A",0x04,0x25,ID_SetBitmap },
{DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetModel },
{DCT3DCT4_ReplyGetModelFirmware, "\xD2",0x02,0x00,ID_GetFirmware },
/* 0xD7 - Bluetooth */
{N6510_ReplyGetRingtoneID, "\xDB",0x03,0x02,ID_SetRingtone },
{NULL, "\x00",0x00,0x00,ID_None }
};
GSM_Phone_Functions N6510Phone = {
- "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",
+ "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",
N6510ReplyFunctions,
N6510_Initialise,
NONEFUNCTION, /* Terminate */
GSM_DispatchMessage,
N6510_ShowStartInfo,
NOKIA_GetManufacturer,
DCT3DCT4_GetModel,
DCT3DCT4_GetFirmware,
DCT4_GetIMEI,
N6510_GetOriginalIMEI,
N6510_GetManufactureMonth,
DCT4_GetProductCode,
DCT4_GetHardware,
N6510_GetPPM,
NOTSUPPORTED, /* GetSIMIMSI */
N6510_GetDateTime,
N6510_SetDateTime,
N6510_GetAlarm,
N6510_SetAlarm,
N6510_GetLocale,
NOTSUPPORTED, /* SetLocale */
N6510_PressKey,
DCT4_Reset,
NOTIMPLEMENTED, /* ResetPhoneSettings */
N6510_EnterSecurityCode,
N6510_GetSecurityStatus,
NOTSUPPORTED, /* GetDisplayStatus */
NOTIMPLEMENTED, /* SetAutoNetworkLogin */
N6510_GetBatteryCharge,
N6510_GetSignalQuality,
N6510_GetNetworkInfo,
NOTSUPPORTED, /* GetCategory */
NOTSUPPORTED, /* AddCategory */
NOTSUPPORTED, /* GetCategoryStatus */
N6510_GetMemoryStatus,
N6510_GetMemory,
NOTIMPLEMENTED, /* GetNextMemory */
N6510_SetMemory,
NOTIMPLEMENTED, /* AddMemory */
N6510_DeleteMemory,
NOTIMPLEMENTED, /* DeleteAllMemory */
N6510_GetSpeedDial,
NOTIMPLEMENTED, /* SetSpeedDial */
N6510_GetSMSC,
N6510_SetSMSC,
N6510_GetSMSStatus,
N6510_GetSMSMessage,
N6510_GetNextSMSMessage,
N6510_SetSMS,
N6510_AddSMS,
N6510_DeleteSMSMessage,
N6510_SendSMSMessage,
NOTSUPPORTED, /* SendSavedSMS */
+ NOTSUPPORTED, /* SetFastSMSSending */
NOKIA_SetIncomingSMS,
NOTIMPLEMENTED, /* SetIncomingCB */
N6510_GetSMSFolders,
N6510_AddSMSFolder,
NOTIMPLEMENTED, /* DeleteSMSFolder */
N6510_DialVoice,
N6510_AnswerCall,
N6510_CancelCall,
NOTIMPLEMENTED, /* HoldCall */
NOTIMPLEMENTED, /* UnholdCall */
NOTIMPLEMENTED, /* ConferenceCall */
NOTIMPLEMENTED, /* SplitCall */
NOTIMPLEMENTED, /* TransferCall */
NOTIMPLEMENTED, /* SwitchCall */
DCT3DCT4_GetCallDivert,
DCT3DCT4_SetCallDivert,
DCT3DCT4_CancelAllDiverts,
NOKIA_SetIncomingCall,
NOKIA_SetIncomingUSSD,
DCT3DCT4_SendDTMF,
N6510_GetRingtone,
N6510_SetRingtone,
N6510_GetRingtonesInfo,
N6510_DeleteUserRingtones,
N6510_PlayTone,
N6510_GetWAPBookmark,
N6510_SetWAPBookmark,
N6510_DeleteWAPBookmark,
N6510_GetWAPSettings,
N6510_SetWAPSettings,
N6510_GetMMSSettings,
N6510_SetMMSSettings,
N6510_GetSyncMLSettings,
NOTSUPPORTED, /* SetSyncMLSettings */
N6510_GetChatSettings,
NOTSUPPORTED, /* SetChatSettings */
N6510_GetBitmap,
N6510_SetBitmap,
N6510_GetToDoStatus,
NOTIMPLEMENTED, /* GetToDo */
N6510_GetNextToDo,
NOTIMPLEMENTED, /* SetToDo */
N6510_AddToDo,
N6510_DeleteToDo2,
N6510_DeleteAllToDo1,
N6510_GetCalendarStatus,
NOTIMPLEMENTED, /* GetCalendar */
N6510_GetNextCalendar,
NOTIMPLEMENTED, /* SetCalendar */
N6510_AddCalendar,
N71_65_DelCalendar,
NOTIMPLEMENTED, /* DeleteAllCalendar */
N6510_GetCalendarSettings,
NOTSUPPORTED, /* SetCalendarSettings */
- NOTIMPLEMENTED, /* GetNote */
+ N6510_GetNextNote,
N6510_GetProfile,
N6510_SetProfile,
N6510_GetFMStation,
N6510_SetFMStation,
N6510_ClearFMStations,
N6510_GetNextFileFolder,
N6510_GetFilePart,
N6510_AddFilePart,
N6510_GetFileSystemStatus,
N6510_DeleteFile,
N6510_AddFolder,
N6510_GetGPRSAccessPoint,
N6510_SetGPRSAccessPoint
};
#endif
/* How should editor hadle tabs in this file? Add editor commands here.
* vim: noexpandtab sw=8 ts=8 sts=8:
*/
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
@@ -1,90 +1,92 @@
/* (c) 2002-2004 by Marcin Wiacek */
#ifndef n6510_h
#define n6510_h
#include "../ncommon.h"
#include "../../../service/sms/gsmsms.h"
typedef enum {
N6510_MMS_SETTINGS = 0x01,
N6510_CHAT_SETTINGS,
N6510_WAP_SETTINGS,
N6510_SYNCML_SETTINGS
} N6510_Connection_Settings;
typedef enum {
N6510_LIGHT_DISPLAY = 0x01,
N6510_LIGHT_KEYPAD = 0x03,
N6510_LIGHT_TORCH = 0x10
} N6510_PHONE_LIGHTS;
typedef struct {
int LastCalendarYear;
int LastCalendarPos;
GSM_NOKIACalToDoLocations LastCalendar;
int FirstCalendarPos;
unsigned char CalendarIcons[10];
GSM_CalendarNoteType CalendarIconsTypes[10];
int CalendarIconsNum;
GSM_NOKIASMSFolder LastSMSFolder;
GSM_SMSFolders LastSMSFolders;
GSM_NOKIACalToDoLocations LastToDo;
+ GSM_NOKIACalToDoLocations LastNote;
+
unsigned char RingtoneID; /* When set with preview */
int FilesLocations[1000];
int FilesLevels[1000];
int FilesLocationsUsed;
int FilesLocationsCurrent;
int FileToken;
int ParentID;
int FileCheckSum;
unsigned char FMStatus[4000];
int FMStatusLength;
unsigned char GPRSPoints[4000];
int GPRSPointsLength;
int BearerNumber;
unsigned char PhoneMode;
} GSM_Phone_N6510Data;
void N6510_EncodeFMFrequency(double freq, unsigned char *buff);
void N6510_DecodeFMFrequency(double *freq, unsigned char *buff);
#ifndef GSM_USED_MBUS2
# define GSM_USED_MBUS2
#endif
#ifndef GSM_USED_FBUS2
# define GSM_USED_FBUS2
#endif
#ifndef GSM_USED_FBUS2DLR3
# define GSM_USED_FBUS2DLR3
#endif
#ifndef GSM_USED_FBUS2DKU5
# define GSM_USED_FBUS2DKU5
#endif
#ifndef GSM_USED_PHONETBLUE
# define GSM_USED_PHONETBLUE
#endif
#ifndef GSM_USED_IRDAPHONET
# define GSM_USED_IRDAPHONET
#endif
#ifndef GSM_USED_BLUEPHONET
# define GSM_USED_BLUEPHONET
#endif
#ifndef GSM_USED_FBUS2PL2303
# define GSM_USED_FBUS2PL2303
#endif
#endif
/* How should editor hadle tabs in this file? Add editor commands here.
* vim: noexpandtab sw=8 ts=8 sts=8:
*/
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
@@ -28,117 +28,117 @@ GSM_Phone_Functions NAUTOPhone = {
DCT3DCT4_GetFirmware,
NOTSUPPORTED, /* GetIMEI */
NOTSUPPORTED, /* GetOriginalIMEI */
NOTSUPPORTED, /* GetManufactureMonth */
NOTSUPPORTED, /* GetProductCode */
NOTSUPPORTED, /* GetHardware */
NOTSUPPORTED, /* GetPPM */
NOTSUPPORTED, /* GetSIMIMSI */
NOTSUPPORTED, /* GetDateTime */
NOTSUPPORTED, /* SetDateTime */
NOTSUPPORTED, /* GetAlarm */
NOTSUPPORTED, /* SetAlarm */
NOTSUPPORTED, /* GetLocale */
NOTSUPPORTED, /* SetLocale */
NOTSUPPORTED, /* PressKey */
NOTSUPPORTED, /* Reset */
NOTSUPPORTED, /* ResetPhoneSettings */
NOTSUPPORTED, /* EnterSecurityCode */
NOTSUPPORTED, /* GetSecurityStatus */
NOTSUPPORTED, /* GetDisplayStatus */
NOTSUPPORTED, /* SetAutoNetworkLogin */
NOTSUPPORTED, /* GetBatteryCharge */
NOTSUPPORTED, /* GetSignalQuality */
NOTSUPPORTED, /* GetNetworkInfo */
NOTSUPPORTED, /* GetCategory */
NOTSUPPORTED, /* AddCategory */
NOTSUPPORTED, /* GetCategoryStatus */
NOTSUPPORTED, /* GetMemoryStatus */
NOTSUPPORTED, /* GetMemory */
NOTSUPPORTED, /* GetNextMemory */
NOTSUPPORTED, /* SetMemory */
NOTSUPPORTED, /* AddMemory */
NOTSUPPORTED, /* DeleteMemory */
NOTIMPLEMENTED, /* DeleteAllMemory */
NOTSUPPORTED, /* GetSpeedDial */
NOTSUPPORTED, /* SetSpeedDial */
NOTSUPPORTED, /* GetSMSC */
NOTSUPPORTED, /* SetSMSC */
NOTSUPPORTED, /* GetSMSStatus */
NOTSUPPORTED, /* GetSMS */
NOTSUPPORTED, /* GetNextSMS */
NOTSUPPORTED, /* SetSMS */
NOTSUPPORTED, /* AddSMS */
NOTSUPPORTED, /* DeleteSMS */
NOTSUPPORTED, /* SendSMSMessage */
NOTSUPPORTED, /* SendSavedSMS */
NOTSUPPORTED, /* SetIncomingSMS */
NOTSUPPORTED, /* SetIncomingCB */
NOTSUPPORTED, /* GetSMSFolders */
NOTSUPPORTED, /* AddSMSFolder */
NOTSUPPORTED, /* DeleteSMSFolder */
NOTSUPPORTED, /* DialVoice */
NOTSUPPORTED, /* AnswerCall */
NOTSUPPORTED, /* CancelCall */
NOTSUPPORTED, /* HoldCall */
NOTSUPPORTED, /* UnholdCall */
NOTSUPPORTED, /* ConferenceCall */
NOTSUPPORTED, /* SplitCall */
NOTSUPPORTED, /* TransferCall */
NOTSUPPORTED, /* SwitchCall */
NOTSUPPORTED, /* GetCallDivert */
NOTSUPPORTED, /* SetCallDivert */
NOTSUPPORTED, /* CancelAllDiverts */
NOTSUPPORTED, /* SetIncomingCall */
NOTSUPPORTED, /* SetIncomingUSSD */
NOTSUPPORTED, /* SendDTMF */
NOTSUPPORTED, /* GetRingtone */
NOTSUPPORTED, /* SetRingtone */
NOTSUPPORTED, /* GetRingtonesInfo */
NOTSUPPORTED, /* DeleteUserRingtones */
NOTSUPPORTED, /* PlayTone */
NOTSUPPORTED, /* GetWAPBookmark */
NOTSUPPORTED, /* SetWAPBookmark */
NOTSUPPORTED, /* DeleteWAPBookmark */
NOTSUPPORTED, /* GetWAPSettings */
NOTSUPPORTED, /* SetWAPSettings */
NOTSUPPORTED, /* GetMMSSettings */
NOTSUPPORTED, /* SetMMSSettings */
NOTSUPPORTED, /* GetBitmap */
NOTSUPPORTED, /* SetBitmap */
NOTSUPPORTED, /* GetToDoStatus */
NOTSUPPORTED, /* GetToDo */
NOTSUPPORTED, /* GetNextToDo */
NOTSUPPORTED, /* SetToDo */
NOTSUPPORTED, /* AddToDo */
NOTSUPPORTED, /* DeleteToDo */
NOTSUPPORTED, /* DeleteAllToDo */
NOTSUPPORTED, /* GetCalendarStatus */
NOTSUPPORTED, /* GetCalendar */
NOTSUPPORTED, /* GetNextCalendar */
NOTSUPPORTED, /* SetCalendar */
NOTSUPPORTED, /* AddCalendar */
NOTSUPPORTED, /* DeleteCalendar */
NOTSUPPORTED, /* DeleteAllCalendar */
NOTSUPPORTED, /* GetCalendarSettings */
NOTSUPPORTED, /* SetCalendarSettings */
- NOTSUPPORTED, /* GetNote */
+ NOTSUPPORTED, /* GetNextNote */
NOTSUPPORTED, /* GetProfile */
NOTSUPPORTED, /* SetProfile */
NOTSUPPORTED, /* GetFMStation */
NOTSUPPORTED, /* SetFMStation */
NOTSUPPORTED, /* ClearFMStations */
NOTSUPPORTED, /* GetNextFileFolder */
NOTSUPPORTED, /* GetFilePart */
NOTSUPPORTED, /* AddFilePart */
NOTSUPPORTED, /* GetFileSystemStatus */
NOTSUPPORTED, /* DeleteFile */
NOTSUPPORTED, /* AddFolder */
NOTSUPPORTED, /* GetGPRSAccessPoint */
NOTSUPPORTED /* SetGPRSAccessPoint */
};
#endif
/* How should editor hadle tabs in this file? Add editor commands here.
* vim: noexpandtab sw=8 ts=8 sts=8:
*/
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
@@ -1300,221 +1300,235 @@ GSM_Error N71_65_ReplyUSSDInfo(GSM_Protocol_Message msg, GSM_StateMachine *s)
return ERR_NONE;
}
GSM_Error NOKIA_SetIncomingUSSD(GSM_StateMachine *s, bool enable)
{
s->Phone.Data.EnableIncomingUSSD = enable;
#ifdef DEBUG
if (enable) {
smprintf(s, "Enabling incoming USSD\n");
} else {
smprintf(s, "Disabling incoming USSD\n");
}
#endif
return ERR_NONE;
}
GSM_Error NOKIA_SetIncomingCall(GSM_StateMachine *s, bool enable)
{
if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo,F_NOCALLINFO)) return ERR_NOTSUPPORTED;
s->Phone.Data.EnableIncomingCall = enable;
#ifdef DEBUG
if (enable) {
smprintf(s, "Enabling incoming Call\n");
} else {
smprintf(s, "Disabling incoming Call\n");
}
#endif
return ERR_NONE;
}
GSM_Error N71_65_ReplyCallInfo(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
GSM_Call call;
int tmp;
unsigned char buffer[200];
call.Status = 0;
call.CallIDAvailable = true;
smprintf(s, "Call info, ");
switch (msg.Buffer[3]) {
case 0x02:
smprintf(s, "Call established, waiting for answer\n");
call.Status = GSM_CALL_CallEstablished;
break;
case 0x03:
smprintf(s, "Call started\n");
smprintf(s, "Call mode : %i\n",msg.Buffer[5]);//such interpretation is in gnokii
tmp = 6;
NOKIA_GetUnicodeString(s, &tmp, msg.Buffer,buffer,false);
smprintf(s, "Number : \"%s\"\n",DecodeUnicodeString(buffer));
/* FIXME: read name from frame */
call.Status = GSM_CALL_CallStart;
break;
case 0x04:
smprintf(s, "Remote end hang up\n");
smprintf(s, "Cause Type : %i\n",msg.Buffer[5]);//such interpretation is in gnokii
smprintf(s, "CC : %i\n",msg.Buffer[6]);
smprintf(s, "MM(?) : %i\n",msg.Buffer[7]);
smprintf(s, "RR(?) : %i\n",msg.Buffer[8]);
call.Status = GSM_CALL_CallRemoteEnd;
call.StatusCode = msg.Buffer[6];
break;
case 0x05:
smprintf(s, "Incoming call\n");
smprintf(s, "Call mode : %i\n",msg.Buffer[5]);//such interpretation is in gnokii
tmp = 6;
NOKIA_GetUnicodeString(s, &tmp, msg.Buffer,buffer,false);
smprintf(s, "Number : \"%s\"\n",DecodeUnicodeString(buffer));
/* FIXME: read name from frame */
call.Status = GSM_CALL_IncomingCall;
tmp = 6;
NOKIA_GetUnicodeString(s, &tmp, msg.Buffer,call.PhoneNumber,false);
break;
case 0x07:
smprintf(s, "Call answer initiated\n");
break;
case 0x09:
smprintf(s, "Call released\n");
call.Status = GSM_CALL_CallLocalEnd;
break;
case 0x0a:
smprintf(s, "Call is being released\n");
break;
case 0x0b:
smprintf(s, "Meaning not known\n");
call.CallIDAvailable = false;
break;
case 0x0c:
smprintf(s, "Audio status\n");
if (msg.Buffer[4] == 0x01) smprintf(s, "Audio enabled\n");
else smprintf(s, "Audio disabled\n");
call.CallIDAvailable = false;
break;
+ case 0x0f:
+ case 0x10:
+ smprintf(s, "Meaning not known\n");
+ call.CallIDAvailable = false;
+ break;
case 0x23:
smprintf(s, "Call held\n");
call.Status = GSM_CALL_CallHeld;
break;
case 0x25:
smprintf(s, "Call resumed\n");
call.Status = GSM_CALL_CallResumed;
break;
case 0x27:
smprintf(s, "Call switched\n");
call.Status = GSM_CALL_CallSwitched;
break;
case 0x53:
smprintf(s, "Outgoing call\n");
smprintf(s, "Call mode : %i\n",msg.Buffer[5]);//such interpretation is in gnokii
tmp = 6;
NOKIA_GetUnicodeString(s, &tmp, msg.Buffer,buffer,false);
smprintf(s, "Number : \"%s\"\n",DecodeUnicodeString(buffer));
/* FIXME: read name from frame */
call.Status = GSM_CALL_OutgoingCall;
tmp = 6;
NOKIA_GetUnicodeString(s, &tmp, msg.Buffer,call.PhoneNumber,false);
break;
+ case 0xA6:
+ case 0xD2:
+ case 0xD3:
+ smprintf(s, "Meaning not known\n");
+ call.CallIDAvailable = false;
+ break;
}
if (call.CallIDAvailable) smprintf(s, "Call ID : %d\n",msg.Buffer[4]);
if (s->Phone.Data.EnableIncomingCall && s->User.IncomingCall!=NULL && call.Status != 0) {
if (call.CallIDAvailable) call.CallID = msg.Buffer[4];
s->User.IncomingCall(s->CurrentConfig->Device, call);
}
+ if (s->Phone.Data.RequestID == ID_DialVoice) {
+ if (msg.Buffer[3] == 0x10) return ERR_NOTSUPPORTED;
+ }
if (s->Phone.Data.RequestID == ID_CancelCall) {
if (msg.Buffer[3] == 0x09) {
if (s->Phone.Data.CallID == msg.Buffer[4]) return ERR_NONE;
/* when we canceled call and see frame about other
* call releasing, we don't give ERR_NONE for "our"
* call release command
*/
return ERR_NEEDANOTHERANSWER;
}
}
if (s->Phone.Data.RequestID == ID_AnswerCall) {
if (msg.Buffer[3] == 0x07) {
if (s->Phone.Data.CallID == msg.Buffer[4]) return ERR_NONE;
return ERR_NEEDANOTHERANSWER;
}
}
return ERR_NONE;
}
void N71_65_GetCalendarRecurrance(GSM_StateMachine *s, unsigned char *buffer, GSM_CalendarEntry *entry)
{
int Recurrance;
Recurrance = buffer[0]*256 + buffer[1];
/* 8760 hours = 1 year */
if (Recurrance == 0xffff) Recurrance=8760;
if (Recurrance != 0) {
smprintf(s, "Recurrance : %i hours\n",Recurrance);
entry->Entries[entry->EntriesNum].EntryType = CAL_RECURRANCE;
entry->Entries[entry->EntriesNum].Number = Recurrance;
entry->EntriesNum++;
}
}
/* method 2 */
GSM_Error N71_65_ReplyAddCalendar2(GSM_Protocol_Message msg, GSM_StateMachine *s)
{
smprintf(s, "Calendar note added\n");
return ERR_NONE;
}
/* method 2 */
GSM_Error N71_65_AddCalendar2(GSM_StateMachine *s, GSM_CalendarEntry *Note)
{
GSM_CalendarNoteType NoteType;
time_t t_time1,t_time2;
GSM_DateTime Date,date_time;
GSM_Error error;
long diff;
int Text, Time, Alarm, Phone, Recurrance, EndTime, Location, length=25;
unsigned char req[5000] = {
N6110_FRAME_HEADER,
0x40,
0x00, /* frame length - 7 */
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00, /* start time saved as difference */
0x00,0x00,0xff,0xff, /* alarm saved as difference */
0x00, /* frame length - 7 */
0x00, /* note type */
0x00,0x00, /* recurrance */
0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00}; /* rest depends on note type */
NoteType = N71_65_FindCalendarType(Note->Type, s->Phone.Data.ModelInfo);
if (IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL62) ||
IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_CAL65)) {
switch(NoteType) {
case GSM_CAL_MEETING : req[18] = 0x01; length = 25; break;
case GSM_CAL_CALL : req[18] = 0x02; length = 27; break;
case GSM_CAL_BIRTHDAY: req[18] = 0x04; length = 28; break;
case GSM_CAL_MEMO : req[18] = 0x08; length = 25; break;
default : return ERR_UNKNOWN;
}
} else {
switch(NoteType) {
case GSM_CAL_REMINDER: req[18] = 0x01; length = 25; break;
case GSM_CAL_CALL : req[18] = 0x02; length = 27; break;
case GSM_CAL_BIRTHDAY: req[18] = 0x04; length = 28; break;
case GSM_CAL_MEMO : req[18] = 0x08; length = 25; break;
default : return ERR_UNKNOWN;
}
}
GSM_CalendarFindDefaultTextTimeAlarmPhoneRecurrance(Note, &Text, &Time, &Alarm, &Phone, &Recurrance, &EndTime, &Location);
if (Time == -1) return ERR_UNKNOWN;
if (NoteType != GSM_CAL_BIRTHDAY) {
Date.Year = 2030; Date.Month = 01; Date.Day = 01;
Date.Hour = 00; Date.Minute = 00; Date.Second = 00;
} else {
Date.Year = 2029; Date.Month = 12; Date.Day = 31;
Date.Hour = 22; Date.Minute = 59; Date.Second = 58;
}
t_time1 = Fill_Time_T(Date,8);
memcpy(&Date,&Note->Entries[Time].Date,sizeof(GSM_DateTime));