summaryrefslogtreecommitdiffabout
path: root/gammu/emb/common/phone/nokia/dct3
Side-by-side diff
Diffstat (limited to 'gammu/emb/common/phone/nokia/dct3') (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
5 files changed, 31 insertions, 12 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:
*/