Diffstat (limited to 'gammu/emb/common/phone/nokia/dct4/n6510.c') (more/less context) (ignore whitespace changes)
-rw-r--r-- | gammu/emb/common/phone/nokia/dct4/n6510.c | 142 |
1 files changed, 126 insertions, 16 deletions
diff --git a/gammu/emb/common/phone/nokia/dct4/n6510.c b/gammu/emb/common/phone/nokia/dct4/n6510.c index 2208def..c481863 100644 --- a/gammu/emb/common/phone/nokia/dct4/n6510.c +++ b/gammu/emb/common/phone/nokia/dct4/n6510.c @@ -1,54 +1,63 @@ /* (c) 2002-2004 by Marcin Wiacek */ /* 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 */ +/* Due to a problem in the source code management, the names of some of + * the authors have unfortunately been lost. We do not mean to belittle + * their efforts and hope they will contact us to see their names + * properly added to the Copyright notice above. + * Having published their contributions under the terms of the GNU + * General Public License (GPL) [version 2], the Copyright of these + * authors will remain respected by adhering to the license they chose + * to publish their code under. + */ #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; @@ -241,123 +250,123 @@ static GSM_Error N6510_SetSMSC(GSM_StateMachine *s, GSM_SMSC *smsc) req[count] = GSM_PackSemiOctetNumber(smsc->DefaultNumber, req+count+2, true) + 1; if (req[count]*2>12) { smprintf(s, "Too long SMSC number in frame\n"); return ERR_UNKNOWN; } req[count+1] = req[count] - 1; count += 17; /* -------------- SMSC name ------------------- */ req[count++] = 0x81; req[count++] = UnicodeLength(smsc->Name)*2 + 2 + 4; req[count++] = UnicodeLength(smsc->Name)*2 + 2; req[count++] = 0x00; /* Can't make CopyUnicodeString(req+count,sms->Name) !!!! * with MSVC6 count is changed then */ i = count; CopyUnicodeString(req+i,smsc->Name); count += UnicodeLength(smsc->Name)*2 + 2; smprintf(s, "Setting SMSC\n"); return GSM_WaitFor (s, req, count, 0x02, 4, ID_SetSMSC); } static GSM_Error N6510_ReplyGetNetworkInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) { int current = msg.Buffer[7]+7, tmp; GSM_Phone_Data *Data = &s->Phone.Data; #ifdef DEBUG char name[100]; GSM_NetworkInfo NetInfo; smprintf(s, "Network status : "); switch (msg.Buffer[8]) { case 0x00 : smprintf(s, "home network\n"); break; case 0x01 : smprintf(s, "roaming network\n"); break; case 0x04 : smprintf(s, "not logged"); break; case 0x06 : smprintf(s, "SIM card rejected\n"); break; case 0x09 : smprintf(s, "not logged"); break; default : smprintf(s, "unknown %i!\n",msg.Buffer[8]); break; } if (msg.Buffer[8]==0x00 || msg.Buffer[8] == 0x01) { NOKIA_DecodeNetworkCode(msg.Buffer + (current + 7),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))); - sprintf(NetInfo.LAC, "%02x%02x", msg.Buffer[current+1], msg.Buffer[current+2]); + sprintf(NetInfo.LAC, "%02X%02X", msg.Buffer[current+1], msg.Buffer[current+2]); smprintf(s, "LAC : %s\n", NetInfo.LAC); - sprintf(NetInfo.CID, "%02x%02x", msg.Buffer[current+5], msg.Buffer[current+6]); + sprintf(NetInfo.CID, "%02X%02X", msg.Buffer[current+5], msg.Buffer[current+6]); smprintf(s, "CID : %s\n", NetInfo.CID); tmp = 10; NOKIA_GetUnicodeString(s, &tmp, msg.Buffer,name,true); 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 0x00: Data->NetworkInfo->State = GSM_HomeNetwork; break; case 0x01: Data->NetworkInfo->State = GSM_RoamingNetwork; break; case 0x04: case 0x06: case 0x09: Data->NetworkInfo->State = GSM_NoNetwork; break; } if (Data->NetworkInfo->State == GSM_HomeNetwork || Data->NetworkInfo->State == GSM_RoamingNetwork) { tmp = 10; NOKIA_GetUnicodeString(s, &tmp, msg.Buffer,Data->NetworkInfo->NetworkName,true); - sprintf(Data->NetworkInfo->LAC, "%02x%02x", msg.Buffer[current+1], msg.Buffer[current+2]); - sprintf(Data->NetworkInfo->CID, "%02x%02x", msg.Buffer[current+5], msg.Buffer[current+6]); + sprintf(Data->NetworkInfo->LAC, "%02X%02X", msg.Buffer[current+1], msg.Buffer[current+2]); + sprintf(Data->NetworkInfo->CID, "%02X%02X", msg.Buffer[current+5], msg.Buffer[current+6]); NOKIA_DecodeNetworkCode(msg.Buffer + (current+7),Data->NetworkInfo->NetworkCode); } } return ERR_NONE; } static GSM_Error N6510_GetNetworkInfo(GSM_StateMachine *s, GSM_NetworkInfo *netinfo) { unsigned char req[] = {N6110_FRAME_HEADER, 0x00, 0x00}; s->Phone.Data.NetworkInfo=netinfo; smprintf(s, "Getting network info\n"); return GSM_WaitFor (s, req, 5, 0x0a, 4, ID_GetNetworkInfo); } static GSM_Error N6510_EncodeSMSFrame(GSM_StateMachine *s, GSM_SMSMessage *sms, unsigned char *req, GSM_SMSMessageLayout *Layout, int *length) { int start, count = 0, pos1, pos2, pos3, pos4, pos5; GSM_Error error; memset(Layout,255,sizeof(GSM_SMSMessageLayout)); start = *length; req[count++] = 0x01; if (sms->PDU != SMS_Deliver) { req[count++] = 0x02; } else { req[count++] = 0x00; } pos1 = count; count++; /* firstbyte set in SMS Layout */ Layout->firstbyte = count; count++; if (sms->PDU != SMS_Deliver) { Layout->TPMR = count; count++; Layout->TPPID = count; count++; /* TP.DCS set in SMS layout */ Layout->TPDCS = count; count++; req[count++] = 0x00; } else { Layout->TPPID = count; count++; /* TP.DCS set in SMS layout */ Layout->TPDCS = count; count++; Layout->DateTime = count; count += 7; req[count++] = 0x55; @@ -1082,100 +1091,98 @@ static GSM_Error N6510_SetCallerLogo(GSM_StateMachine *s, GSM_Bitmap *bitmap) 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 */ if (!bitmap->DefaultName) { i = UnicodeLength(bitmap->Text) * 2; string[0] = i + 2; memcpy(string + 1, bitmap->Text, i); string[i + 1] = 0; count += N71_65_PackPBKBlock(s, N7110_PBK_NAME, i + 2, block++, string, req + count); } /* Logo */ if (!bitmap->DefaultBitmap) { PHONE_GetBitmapWidthHeight(GSM_NokiaCallerLogo, &Width, &Height); string[0] = Width; string[1] = Height; string[2] = 0; string[3] = 0; string[4] = PHONE_GetBitmapSize(GSM_NokiaCallerLogo,0,0); PHONE_EncodeBitmap(GSM_NokiaCallerLogo, string + 5, bitmap); count += N71_65_PackPBKBlock(s, N7110_PBK_GROUPLOGO, PHONE_GetBitmapSize(GSM_NokiaCallerLogo,0,0) + 5, block++, string, req + count); } req[21] = block; return GSM_WaitFor (s, req, count, 0x03, 4, ID_SetBitmap); } static GSM_Error N6510_ReplySetPicture(GSM_Protocol_Message msg, GSM_StateMachine *s) { // smprintf(s, "Picture Image written OK, folder %i, location %i\n",msg.Buffer[4],msg.Buffer[5]*256+msg.Buffer[6]); return ERR_NONE; } static GSM_Error N6510_SetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap) { GSM_SMSMessage sms; GSM_Phone_Bitmap_Types Type; int Width, Height, i, count; -#ifdef DEVELOP unsigned char folderid; - int location; -#endif + int location; GSM_NetworkInfo NetInfo; GSM_Error error; unsigned char reqStartup[1000] = { N7110_FRAME_HEADER, 0x04, 0x0F, 0x00, 0x00, 0x00, 0x04, 0xC0, 0x02, 0x00, 0x41, 0xC0, 0x03, 0x00, 0x60, 0xC0, 0x04}; unsigned char reqColourWallPaper[200] = { N6110_FRAME_HEADER, 0x07, 0x00, 0x00, 0x00, 0xD5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18}; /* Bitmap ID */ unsigned char reqColourStartup[200] = { N6110_FRAME_HEADER, 0x04, 0x25, 0x00, 0x01, 0x00, 0x18}; unsigned char reqOp[1000] = { N7110_FRAME_HEADER, 0x25, 0x01, 0x55, 0x00, 0x00, 0x55, 0x01, /* 0x01 - not set, 0x02 - set */ 0x0C, 0x08, 0x62, 0xF0, 0x10, /* Network code */ 0x03, 0x55, 0x55}; unsigned char reqColourOp[200] = { N6110_FRAME_HEADER, 0x07, 0x00, 0x00, 0x00, 0xE7, 0x00, 0x00, 0x00, 0xF9, 0x00, 0x08, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x00, 0x18, /* File ID */ 0x00, 0x00, 0x00, 0x00}; /* Network code */ unsigned char reqNote[200] = {N6110_FRAME_HEADER, 0x04, 0x01}; unsigned char reqPicture[2000] = { N6110_FRAME_HEADER, 0x00, 0x02, 0x05, /* SMS folder */ 0x00, 0x00, /* location */ 0x01, 0x01, 0xa0, 0x02, 0x01, 0x40, 0x00, 0x34, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x55, 0x03, 0x82, 0x10, 0x01, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x10, 0x02, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x04, 0x00, 0x00, 0xa1, 0x55, 0x01, 0x08, 0x00, 0x00, 0x00, 0x01, 0x48, 0x1c, 0x00, 0xfc, 0x00}; switch (Bitmap->Type) { case GSM_ColourWallPaper_ID: reqColourWallPaper[21] = Bitmap->ID; smprintf(s, "Setting colour wall paper\n"); @@ -1210,109 +1217,105 @@ static GSM_Error N6510_SetBitmap(GSM_StateMachine *s, GSM_Bitmap *Bitmap) if (strcmp(Bitmap->NetworkCode,"000 00")) { memset(reqOp + 19, 0, 281); NOKIA_EncodeNetworkCode(reqOp+12, Bitmap->NetworkCode); Type = GSM_Nokia6510OperatorLogo; reqOp[9] = 0x02; /* Logo enabled */ reqOp[18] = 0x1a; /* FIXME */ reqOp[19] = PHONE_GetBitmapSize(Type,0,0) + 8 + 29 + 2; PHONE_GetBitmapWidthHeight(Type, &Width, &Height); reqOp[20] = Width; reqOp[21] = Height; reqOp[22] = 0x00; reqOp[23] = PHONE_GetBitmapSize(Type,0,0) + 29; reqOp[24] = 0x00; reqOp[25] = PHONE_GetBitmapSize(Type,0,0) + 29; PHONE_EncodeBitmap(Type, reqOp + 26, Bitmap); smprintf(s, "Setting operator logo\n"); return GSM_WaitFor (s, reqOp, reqOp[19]+reqOp[11]+10, 0x0A, 4, ID_SetBitmap); } else { error=N6510_GetNetworkInfo(s,&NetInfo); if (error != ERR_NONE) return error; NOKIA_EncodeNetworkCode(reqOp+12, NetInfo.NetworkCode); smprintf(s, "Clearing operator logo\n"); return GSM_WaitFor (s, reqOp, 18, 0x0A, 4, ID_SetBitmap); } case GSM_ColourOperatorLogo_ID: /* We want to set operator logo, not clear */ if (strcmp(Bitmap->NetworkCode,"000 00")) { EncodeBCD(reqColourOp+23, Bitmap->NetworkCode, 6, false); reqColourOp[21] = Bitmap->ID; } smprintf(s, "Setting colour operator logo\n"); return GSM_WaitFor (s, reqColourOp, 26, 0x43, 4, ID_SetBitmap); case GSM_ColourStartupLogo_ID: switch (Bitmap->Location) { case 0: reqColourStartup[6] = 0x00; reqColourStartup[8] = 0x00; smprintf(s, "Setting colour startup logo\n"); return GSM_WaitFor (s, reqColourStartup, 9, 0x7A, 4, ID_SetBitmap); case 1: reqColourStartup[8] = Bitmap->ID; smprintf(s, "Setting colour startup logo\n"); return GSM_WaitFor (s, reqColourStartup, 9, 0x7A, 4, ID_SetBitmap); default:return ERR_NOTSUPPORTED; } case GSM_CallerGroupLogo: return N6510_SetCallerLogo(s,Bitmap); case GSM_PictureImage: error = N6510_GetPictureImage(s, Bitmap, &sms.Location); if (error == ERR_NONE) { -#ifdef DEVELOP sms.Folder = 0; N6510_GetSMSLocation(s, &sms, &folderid, &location); switch (folderid) { case 0x01: reqPicture[5] = 0x02; break; /* INBOX SIM */ case 0x02: reqPicture[5] = 0x03; break; /* OUTBOX SIM */ default : reqPicture[5] = folderid - 1; reqPicture[4] = 0x02; break; /* ME folders */ } reqPicture[6]=location / 256; reqPicture[7]=location; -#else - return ERR_NOTSUPPORTED; -#endif } Type = GSM_NokiaPictureImage; count = 78; PHONE_EncodeBitmap(Type, reqPicture + count, Bitmap); count += PHONE_GetBitmapSize(Type,0,0); smprintf(s, "Setting Picture Image\n"); return GSM_WaitFor (s, reqPicture, count, 0x14, 4, ID_SetBitmap); default: break; } return ERR_NOTSUPPORTED; } static GSM_Error N6510_ReplyGetRingtoneID(GSM_Protocol_Message msg, GSM_StateMachine *s) { GSM_Phone_N6510Data *Priv = &s->Phone.Data.Priv.N6510; smprintf(s, "Ringtone ID received\n"); Priv->RingtoneID = msg.Buffer[15]; return ERR_NONE; } static GSM_Error N6510_ReplySetBinRingtone(GSM_Protocol_Message msg, GSM_StateMachine *s) { smprintf(s, "Binary ringtone set\n"); return ERR_NONE; } static GSM_Error N6510_SetRingtone(GSM_StateMachine *s, GSM_Ringtone *Ringtone, int *maxlength) { GSM_Error error; GSM_Phone_N6510Data *Priv = &s->Phone.Data.Priv.N6510; GSM_NetworkInfo NetInfo; int size=200, current; unsigned char GetIDReq[] = { N7110_FRAME_HEADER, 0x01, 0x00, 0x00, 0x00, 0xFF, 0x06, 0xE1, 0x00, 0xFF, 0x06, 0xE1, 0x01, 0x42}; unsigned char SetPreviewReq[1000] = { 0xAE, /* Ringtone ID */ 0x01, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; /*Length*/ unsigned char AddBinaryReq[33000] = { N7110_FRAME_HEADER, 0x0E, 0x7F, 0xFF, 0xFE}; if (Ringtone->Format == RING_NOTETONE && Ringtone->Location==255) { @@ -2374,96 +2377,99 @@ static GSM_Error N6510_EnterSecurityCode(GSM_StateMachine *s, GSM_SecurityCode C 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); } static GSM_Error N6510_ReplySaveSMSMessage(GSM_Protocol_Message msg, GSM_StateMachine *s) { unsigned char folder; GSM_Phone_Data *Data = &s->Phone.Data; switch (msg.Buffer[3]) { case 0x01: switch (msg.Buffer[4]) { case 0x00: smprintf(s, "Done OK\n"); smprintf(s, "Folder info: %i %i\n",msg.Buffer[5],msg.Buffer[8]); switch (msg.Buffer[8]) { case 0x02 : if (msg.Buffer[5] == 0x02) { folder = 0x03; /* INBOX ME */ } else { folder = 0x01; /* INBOX SIM */ } break; case 0x03 : if (msg.Buffer[5] == 0x02) { folder = 0x04; /* OUTBOX ME */ } else { folder = 0x02; /* OUTBOX SIM */ } break; default : folder = msg.Buffer[8] + 1; } N6510_SetSMSLocation(s, Data->SaveSMSMessage,folder,msg.Buffer[6]*256+msg.Buffer[7]); smprintf(s, "Saved in folder %i at location %i\n",folder, msg.Buffer[6]*256+msg.Buffer[7]); Data->SaveSMSMessage->Folder = folder; return ERR_NONE; case 0x02: printf("Incorrect location\n"); return ERR_INVALIDLOCATION; + case 0x03: + printf("Memory full (for example no empty space in SIM)\n"); + return ERR_FULL; case 0x05: printf("Incorrect folder\n"); return ERR_INVALIDLOCATION; default: smprintf(s, "ERROR: unknown %i\n",msg.Buffer[4]); return ERR_UNKNOWNRESPONSE; } case 0x17: smprintf(s, "SMS name changed\n"); return ERR_NONE; } return ERR_UNKNOWNRESPONSE; } static GSM_Error N6510_PrivSetSMSMessage(GSM_StateMachine *s, GSM_SMSMessage *sms) { int location, length = 11; unsigned char folderid, folder; GSM_SMSMessageLayout Layout; GSM_Error error; unsigned char req [300] = { N6110_FRAME_HEADER, 0x00, 0x01, /* 1 = SIM, 2 = ME */ 0x02, /* Folder */ 0x00, 0x01, /* Location */ 0x01}; /* SMS state */ unsigned char NameReq[200] = { N6110_FRAME_HEADER, 0x16, 0x01, /* 1 = SIM, 2 = ME */ 0x02, /* Folder */ 0x00, 0x01}; /* Location */ 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; switch (sms->PDU) { case SMS_Submit: /* Inbox */ if (folderid == 0x01 || folderid == 0x03) sms->PDU = SMS_Deliver; break; case SMS_Deliver: /* SIM Outbox */ @@ -2631,195 +2637,199 @@ static GSM_Error N6510_GetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm) { unsigned char StateReq[] = {N6110_FRAME_HEADER, 0x1f, 0x01, 0x00}; unsigned char GetReq [] = {N6110_FRAME_HEADER, 0x19, 0x00, 0x02}; GSM_Error error; if (alarm->Location != 1) return ERR_NOTSUPPORTED; s->Phone.Data.Alarm=alarm; smprintf(s, "Getting alarm state\n"); error = GSM_WaitFor (s, StateReq, 6, 0x19, 4, ID_GetAlarm); if (error != ERR_NONE) return error; smprintf(s, "Getting alarm\n"); return GSM_WaitFor (s, GetReq, 6, 0x19, 4, ID_GetAlarm); } static GSM_Error N6510_ReplySetAlarm(GSM_Protocol_Message msg, GSM_StateMachine *s) { smprintf(s, "Alarm set\n"); return ERR_NONE; } static GSM_Error N6510_SetAlarm(GSM_StateMachine *s, GSM_Alarm *alarm) { unsigned char req[] = {N6110_FRAME_HEADER, 0x11, 0x00, 0x01, 0x01, 0x0c, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Hours, Minutes */ 0x00, 0x00, 0x00 }; if (alarm->Location != 1) return ERR_NOTSUPPORTED; req[14] = alarm->DateTime.Hour; req[15] = alarm->DateTime.Minute; smprintf(s, "Setting alarm\n"); return GSM_WaitFor (s, req, 19, 0x19, 4, ID_SetAlarm); } static GSM_Error N6510_ReplyGetRingtonesInfo(GSM_Protocol_Message msg, GSM_StateMachine *s) { int tmp,i; GSM_Phone_Data *Data = &s->Phone.Data; smprintf(s, "Ringtones info received\n"); memset(Data->RingtonesInfo,0,sizeof(GSM_AllRingtonesInfo)); if (msg.Buffer[4] * 256 + msg.Buffer[5] == 0x00) return ERR_EMPTY; Data->RingtonesInfo->Number = msg.Buffer[4] * 256 + msg.Buffer[5]; + // allocate array of ringtones based on number + Data->RingtonesInfo->Ringtone = calloc(Data->RingtonesInfo->Number, sizeof(GSM_RingtoneInfo)); tmp = 6; for (i=0;i<Data->RingtonesInfo->Number;i++) { Data->RingtonesInfo->Ringtone[i].Group = msg.Buffer[tmp+4]; Data->RingtonesInfo->Ringtone[i].ID = msg.Buffer[tmp+2] * 256 + msg.Buffer[tmp+3]; 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_AllRingtonesInfo Info = {0, NULL}; 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); + error = GSM_WaitFor (s, req2, 6, 0x1f, 4, ID_GetRingtone); + if (Info.Ringtone) free(Info.Ringtone); + return error; 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; @@ -4009,96 +4019,187 @@ static GSM_Error N6510_ShowStartInfo(GSM_StateMachine *s, bool enable) 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 GSM_Error N6510_DeleteNote(GSM_StateMachine *s, GSM_NoteEntry *Not) +{ + GSM_Error error; + GSM_NOKIACalToDoLocations *LastNote = &s->Phone.Data.Priv.N6510.LastNote; + GSM_CalendarEntry Note; + + if (!IsPhoneFeatureAvailable(s->Phone.Data.ModelInfo, F_NOTES)) return ERR_NOTSUPPORTED; + + error=N6510_GetCalendarInfo3(s,LastNote,2); + if (error!=ERR_NONE) return error; + + smprintf(s, "Deleting Note\n"); + + if (Not->Location > LastNote->Number || Not->Location == 0) return ERR_INVALIDLOCATION; + + Note.Location = LastNote->Location[Not->Location-1]; + return N71_65_DelCalendar(s,&Note); +} + +static GSM_Error N6510_ReplyGetNoteFirstLoc(GSM_Protocol_Message msg, GSM_StateMachine *s) +{ + smprintf(s, "First Note location: %i\n",msg.Buffer[8]*256+msg.Buffer[9]); + s->Phone.Data.Note->Location = msg.Buffer[8]*256+msg.Buffer[9]; + return ERR_NONE; +} + +static GSM_Error N6510_ReplyAddNote(GSM_Protocol_Message msg, GSM_StateMachine *s) +{ + smprintf(s, "ToDo added\n"); + return ERR_NONE; +} + +static GSM_Error N6510_AddNote(GSM_StateMachine *s, GSM_NoteEntry *Not) +{ + GSM_Error error; + int count=54; + unsigned char reqLoc[] = {N6110_FRAME_HEADER, 0x95, + 0x02}; /* 1 = todo, 2 = note */ + unsigned char req[5000] = { + N6110_FRAME_HEADER, 0x65, + 0x02, /* 0 = calendar, 1 = todo, 2 = note */ + 0x00, 0x00, 0x00, + 0x00, 0x00, /* location */ + 0x00, 0x00, 0x00, 0x00, + 0xFF, 0xFF, 0xFF, 0xFF, /* alarm */ + 0x80, 0x00, 0x00, + 0xA9, /* note icon */ + 0x00, 0x00, 0x00, 0x00, /* alarm type */ + 0x00, /* 0x02 or 0x00 */ + 0x80, /* note type */ + 0x07, 0xD2, 0x01, 0x01, 0x00, 0x00, /* start date/time */ + 0x07, 0xD2, 0x01, 0x11, 0x00, 0x00, /* end date/time */ + 0x00, 0x00, /* recurrance */ + 0xFF, 0xFF, /* birth year */ + 0x00, /* ToDo priority */ + 0x00, /* ToDo completed ? */ + 0x00, 0x00, 0x00, + 0x00, /* note text length */ + 0x00, /* phone length/meeting place */ + 0x00, 0x00, 0x00}; + + s->Phone.Data.Note = Not; + + smprintf(s, "Getting first free Note location\n"); + error = GSM_WaitFor (s, reqLoc, 5, 0x13, 4, ID_SetNote); + if (error!=ERR_NONE) return error; + req[8] = Not->Location/256; + req[9] = Not->Location%256; + + req[49] = UnicodeLength(Not->Text); + CopyUnicodeString(req+54,Not->Text); + count+= req[49]*2; + + req[count++] = 0x00; + + smprintf(s, "Adding Note\n"); + return GSM_WaitFor (s, req, count, 0x13, 4, ID_SetNote); +} + +static GSM_Error N6510_GetNoteStatus(GSM_StateMachine *s, GSM_ToDoStatus *status) +{ + GSM_NOKIACalToDoLocations *LastNote = &s->Phone.Data.Priv.N6510.LastNote; + GSM_Error error; + + error = N6510_GetCalendarInfo3(s,LastNote,2); + if (error!=ERR_NONE) return error; + + status->Used = LastNote->Number; + return ERR_NONE; +} + 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; @@ -5144,109 +5245,110 @@ static GSM_Error N6510_ReplyAddToDo1(GSM_Protocol_Message msg, GSM_StateMachine /* 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]; + s->Phone.Data.ToDo->Location = msg.Buffer[8]*256+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 reqLoc[] = {N6110_FRAME_HEADER, 0x95, + 0x01}; /* 1 = todo, 2 = note */ 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 */ 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}; s->Phone.Data.ToDo = ToDo; smprintf(s, "Getting first free ToDo location method 2\n"); error = GSM_WaitFor (s, reqLoc, 5, 0x13, 4, ID_SetToDo); if (error!=ERR_NONE) return error; req[8] = ToDo->Location/256; req[9] = ToDo->Location%256; Note.Type = GSM_CAL_MEETING; DT.Year = 2004; DT.Month = 1; DT.Day = 1; DT.Hour = 12; DT.Minute = 12; DT.Second = 0; memcpy(&Note.Entries[0].Date,&DT,sizeof(GSM_DateTime)); Note.Entries[0].EntryType = CAL_START_DATETIME; memcpy(&Note.Entries[1].Date,&DT,sizeof(GSM_DateTime)); Note.Entries[1].EntryType = CAL_END_DATETIME; EncodeUnicode(Note.Entries[2].Text,"ala",3); Note.Entries[2].EntryType = CAL_TEXT; Note.EntriesNum = 3; error=N6510_FindCalendarIconID3(s, &Note, &req[21]); if (error!=ERR_NONE) return error; switch (ToDo->Priority) { case GSM_Priority_Low : req[44] = 0x10; break; case GSM_Priority_Medium: req[44] = 0x20; break; case GSM_Priority_High : req[44] = 0x30; break; @@ -5540,104 +5642,106 @@ static GSM_Reply_Function N6510ReplyFunctions[] = { {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_ReplyAddNote, "\x13",0x03,0x66,ID_SetNote }, {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_ReplyGetNoteFirstLoc, "\x13",0x03,0x96,ID_SetNote }, {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 }, @@ -5687,97 +5791,97 @@ static GSM_Reply_Function N6510ReplyFunctions[] = { /* 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|5140|6100|6200|6220|6230|6310|6310i|6385|6510|6610|6610i|6800|6810|6820|7210|7250|7250i|7600|8310|8390|8910|8910i", + "1100|1100a|1100b|3100|3100b|3105|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, @@ -5796,69 +5900,75 @@ GSM_Phone_Functions N6510Phone = { 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 */ + N6510_GetNoteStatus, + NOTIMPLEMENTED, /* GetNote */ N6510_GetNextNote, + NOTIMPLEMENTED, /* SetNote */ + N6510_AddNote, + N6510_DeleteNote, + NOTSUPPORTED, /* DeleteAllNotes */ 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: */ |