summaryrefslogtreecommitdiffabout
path: root/gammu/emb/common/phone/nokia/nfunc.c
Side-by-side diff
Diffstat (limited to 'gammu/emb/common/phone/nokia/nfunc.c') (more/less context) (show whitespace changes)
-rw-r--r--gammu/emb/common/phone/nokia/nfunc.c14
1 files changed, 14 insertions, 0 deletions
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));