summaryrefslogtreecommitdiffabout
path: root/gammu/emb/common/phone/nokia/dct3/n6110.c
Side-by-side diff
Diffstat (limited to 'gammu/emb/common/phone/nokia/dct3/n6110.c') (more/less context) (ignore whitespace changes)
-rw-r--r--gammu/emb/common/phone/nokia/dct3/n6110.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/gammu/emb/common/phone/nokia/dct3/n6110.c b/gammu/emb/common/phone/nokia/dct3/n6110.c
index 263d12b..dac6c12 100644
--- a/gammu/emb/common/phone/nokia/dct3/n6110.c
+++ b/gammu/emb/common/phone/nokia/dct3/n6110.c
@@ -1,16 +1,18 @@
/* (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"
@@ -118,24 +120,25 @@ static void N6110_EncodeUnicode(GSM_StateMachine *s, unsigned char *dest, const
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.
*/
@@ -815,24 +818,25 @@ static GSM_Error N6110_SetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone,
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);
@@ -1515,24 +1519,25 @@ static GSM_Error N6110_ReplyGetRingtone(GSM_Protocol_Message msg, GSM_StateMachi
}
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)
@@ -1552,24 +1557,25 @@ static GSM_Error N6110_GetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone,
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);
}
@@ -2434,26 +2440,26 @@ static GSM_Error N6110_GetNextCalendarNote(GSM_StateMachine *s, GSM_CalendarEntr
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)
@@ -2798,24 +2804,25 @@ GSM_Phone_Functions N6110Phone = {
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,
@@ -2852,25 +2859,25 @@ GSM_Phone_Functions N6110Phone = {
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 */