-rw-r--r-- | gammu/emb/gammu/depend/nokia/dct3.c | 6 | ||||
-rw-r--r-- | gammu/emb/gammu/depend/nokia/dct4.c | 11 | ||||
-rw-r--r-- | gammu/emb/gammu/depend/nokia/dct4.h | 13 |
3 files changed, 24 insertions, 6 deletions
diff --git a/gammu/emb/gammu/depend/nokia/dct3.c b/gammu/emb/gammu/depend/nokia/dct3.c index d4a55da..b9e47ea 100644 --- a/gammu/emb/gammu/depend/nokia/dct3.c +++ b/gammu/emb/gammu/depend/nokia/dct3.c @@ -589,52 +589,56 @@ void DCT3SetPhoneMenus(int argc, char *argv[]) // reqSet[6]=0xe0; error=GSM_WaitFor (&s, reqSet, 7, 0x40, 4, ID_User4); Print_Error(error); printf("Enabling netmonitor\n"); error=DCT3_Netmonitor(&s, 243, value); Print_Error(error); } static GSM_Error DCT3_Reply61GetSecurityCode(GSM_Protocol_Message msg, GSM_StateMachine *s) { printf("Security Code is \"%s\"\n",msg.Buffer+5); return ERR_NONE; } static GSM_Error DCT3_Reply7191GetSecurityCode(GSM_Protocol_Message msg, GSM_StateMachine *s) { printf("Security Code is \"%s\"\n",msg.Buffer+6); return ERR_NONE; } void DCT3GetSecurityCode(int argc, char *argv[]) { +#ifdef GSM_ENABLE_NOKIA6110 unsigned char req6110[] = {0x00, 0x01, 0x6e, 0x01}; /* Code type */ +#endif +#if defined(GSM_ENABLE_NOKIA7110) || defined(GSM_ENABLE_NOKIA9210) unsigned char req71_91[] = {N7110_FRAME_HEADER, 0xee, 0x1c}; /* Setting */ +#endif if (CheckDCT3Only()!=ERR_NONE) return; error=DCT3_EnableSecurity (&s, 0x01); Print_Error(error); s.User.UserReplyFunctions=UserReplyFunctions3; #ifdef GSM_ENABLE_NOKIA6110 if (strstr(N6110Phone.models, s.Phone.Data.ModelInfo->model) != NULL) { error=GSM_WaitFor (&s, req6110, 4, 0x40, 4, ID_User6); } #endif #ifdef GSM_ENABLE_NOKIA7110 if (strstr(N7110Phone.models, s.Phone.Data.ModelInfo->model) != NULL) { error=GSM_WaitFor (&s, req71_91, 5, 0x7a, 4, ID_User6); } #endif #ifdef GSM_ENABLE_NOKIA9210 if (strstr(N9210Phone.models, s.Phone.Data.ModelInfo->model) != NULL) { error=GSM_WaitFor (&s, req71_91, 5, 0x7a, 4, ID_User6); } #endif Print_Error(error); @@ -746,50 +750,52 @@ void DCT3DisplayOutput(int argc, char *argv[]) s.User.UserReplyFunctions=UserReplyFunctions3; error=GSM_WaitFor (&s, req, 5, 0x0d, 4, ID_User7); Print_Error(error); signal(SIGINT, interrupt); printf("Press Ctrl+C to break...\n"); printf("Entering monitor mode...\n\n"); while (!gshutdown) { GSM_ReadDevice(&s,true); my_sleep(10); } req[4] = 0x02; error=GSM_WaitFor (&s, req, 5, 0x0d, 4, ID_User7); Print_Error(error); GSM_Terminate(); } #endif static GSM_Reply_Function UserReplyFunctions3[] = { +#ifdef GSM_ENABLE_NOKIA6110 {DCT3_ReplyDisplayOutput, "\x0D",0x03,0x50,ID_IncomingFrame }, {DCT3_ReplyDisplayOutput, "\x0D",0x03,0x54,ID_User7 }, +#endif {DCT3_ReplyEnableSecurity2, "\x40",0x02,0x64,ID_EnableSecurity }, {DCT3_ReplyResetTest36, "\x40",0x02,0x65,ID_User2 }, {DCT3_ReplyGetADC, "\x40",0x02,0x68,ID_User3 }, {DCT3_ReplyGetPPS, "\x40",0x02,0x6A,ID_User4 }, {DCT3_ReplySetPPS, "\x40",0x02,0x6B,ID_User4 }, {DCT3_Reply61GetSecurityCode, "\x40",0x02,0x6E,ID_User6 }, {DCT3_ReplySimlockInfo, "\x40",0x02,0x8A,ID_User3 }, #ifdef GSM_ENABLE_NOKIA6110 {DCT3_ReplySetOperatorName, "\x40",0x02,0x8B,ID_User7 }, {DCT3_ReplyGetOperatorName, "\x40",0x02,0x8C,ID_User5 }, #endif {DCT3_ReplyGetADC, "\x40",0x02,0x91,ID_User3 }, {NoneReply, "\x40",0x02,0xA3,ID_User3 }, {DCT3_ReplyGetT9, "\x40",0x02,0xAE,ID_User3 }, {DCT3_ReplyGetMSID, "\x40",0x02,0xb5,ID_User8 }, {DCT3_ReplyGetDSPROM, "\x40",0x02,0xC8,ID_User10 }, {DCT3_ReplyGetMCUchkSum, "\x40",0x02,0xC8,ID_User9 }, {DCT3_ReplyPhoneTests, "\x40",0x02,0xCF,ID_User1 }, {DCT3_Reply7191GetSecurityCode, "\x7a",0x04,0x1C,ID_User6 }, {NULL, "\x00",0x00,0x00,ID_None } }; diff --git a/gammu/emb/gammu/depend/nokia/dct4.c b/gammu/emb/gammu/depend/nokia/dct4.c index f4ed305..4bf958d 100644 --- a/gammu/emb/gammu/depend/nokia/dct4.c +++ b/gammu/emb/gammu/depend/nokia/dct4.c @@ -14,49 +14,50 @@ #include "../../../common/misc/coding/coding.h" extern GSM_Reply_Function UserReplyFunctions4[]; /* ------- some usefull functions ----------------------------------------- */ GSM_Error CheckDCT4Only() { bool found = false; /* Checking if phone is DCT4 */ #ifdef GSM_ENABLE_NOKIA3650 if (strstr(N3650Phone.models, s.Phone.Data.ModelInfo->model) != NULL) found = true; #endif #ifdef GSM_ENABLE_NOKIA6510 if (strstr(N6510Phone.models, s.Phone.Data.ModelInfo->model) != NULL) found = true; #endif #ifdef GSM_ENABLE_NOKIA3320 if (strstr(N3320Phone.models, s.Phone.Data.ModelInfo->model) != NULL) found = true; #endif if (!found) return ERR_NOTSUPPORTED; if (s.ConnectionType!=GCT_MBUS2 && s.ConnectionType!=GCT_FBUS2 && s.ConnectionType!=GCT_FBUS2DLR3 && s.ConnectionType!=GCT_PHONETBLUE && - s.ConnectionType!=GCT_IRDAPHONET && s.ConnectionType!=GCT_BLUEPHONET) { + s.ConnectionType!=GCT_IRDAPHONET && s.ConnectionType!=GCT_BLUEPHONET && + s.ConnectionType!=GCT_FBUS2DKU5) { return ERR_OTHERCONNECTIONREQUIRED; } return ERR_NONE; } static void CheckDCT4() { GSM_Error error; error = CheckDCT4Only(); switch (error) { case ERR_NOTSUPPORTED: Print_Error(ERR_NOTSUPPORTED); break; case ERR_OTHERCONNECTIONREQUIRED: printf("Can't do it with current phone protocol\n"); GSM_TerminateConnection(&s); exit(-1); default: break; } } static bool answer_yes2(char *text) @@ -864,84 +865,87 @@ void DCT4GetT9(int argc, char *argv[]) i = 0; while (1) { req[12] = i / 256; req[13] = i % 256; if (i != 0) { if (T9Dictionary - i < req[16]*256+req[17]) { req[16] = (T9Dictionary - i) / 256; req[17] = (T9Dictionary - i) % 256; } if (T9Dictionary - i == 0) break; } error=GSM_WaitFor (&s, req, 18, 0x23, 4, ID_User3); Print_Error(error); if (i==0) { T9Dictionary = T9FullSize; dbgprintf("T9 dictionary size is %i\n",T9Dictionary); } i+=T9Size; } fclose(T9File); } +#ifdef GSM_ENABLE_NOKIA6510 + extern GSM_Error N6510_SetLight(GSM_StateMachine *s, N6510_PHONE_LIGHTS light, bool enable); void DCT4SetLight(int argc, char *argv[]) { int i; N6510_PHONE_LIGHTS type; bool enable; if (mystrncasecmp(argv[2],"display",0)) { type = N6510_LIGHT_DISPLAY; } else if (mystrncasecmp(argv[2],"keypad",0)) { type = N6510_LIGHT_KEYPAD; } else if (mystrncasecmp(argv[2],"torch",0)) { type = N6510_LIGHT_TORCH; } else { printf("What lights should I enable (\"%s\") ?\n",argv[2]); exit(-1); } if (mystrncasecmp(argv[3],"on",0)) { enable = true; } else if (mystrncasecmp(argv[3],"off",0)) { enable = false; } else { printf("What should I do (\"%s\") ?\n",argv[3]); exit(-1); } for (i=0;i<s.ConfigNum;i++) { s.Config[i].StartInfo = "false"; } GSM_Init(true); CheckDCT4(); error=N6510_SetLight(&s, type, enable); Print_Error(error); GSM_Terminate(); } +#endif void DCT4DisplayTest(int argc, char *argv[]) { unsigned char ans[200]; unsigned char req0[] = {0x00, 0x08, 0x0D, 0x00, 0x0F, 0x00}; unsigned char req[] = {0x00, 0x08, 0x0E, 0x00, 0x12, 0x01, 0x00, 0x04, 0x09, /* test number */ 0x00}; if (CheckDCT4Only()!=ERR_NONE) return; s.User.UserReplyFunctions=UserReplyFunctions4; DCT4_SetPhoneMode(&s, DCT4_MODE_TEST); s.Protocol.Functions->WriteMessage(&s, req0, 6, 0x40); req[8] = atoi(argv[2]); s.Protocol.Functions->WriteMessage(&s, req, 10, 0x40); printf("Press any key to continue...\n"); GetLine(stdin, ans, 99); DCT4_SetPhoneMode(&s, DCT4_MODE_NORMAL); @@ -1000,48 +1004,50 @@ void DCT4GetADC(int argc, char *argv[]) 0x01}; unsigned char GetUnit[] = {N6110_FRAME_HEADER, 0x11, 0x00, /* Test number */ 0x01}; if (CheckDCT4Only()!=ERR_NONE) return; s.User.UserReplyFunctions=UserReplyFunctions4; while (1) { printf(" %30s ",DCT4ADC[i].name); GetRaw[4] = i; error=GSM_WaitFor (&s, GetRaw, 6, 0x17, 4, ID_User3); Print_Error(error); GetUnit[4] = i; ADC = DCT4ADC[i].x; error=GSM_WaitFor (&s, GetUnit, 6, 0x17, 4, ID_User3); Print_Error(error); printf("%s\n",DCT4ADC[i].unit); i++; if (DCT4ADC[i].name[0] == 0x00) break; } } +#ifdef GSM_ENABLE_NOKIA6510 + static double RadioFreq; static unsigned char RadioName[100]; static GSM_Error DCT4_ReplyTuneRadio(GSM_Protocol_Message msg, GSM_StateMachine *s) { int length; unsigned char name[100]; switch (msg.Buffer[3]) { case 0x09: N6510_DecodeFMFrequency(&RadioFreq, msg.Buffer+16); length = msg.Buffer[8]; memcpy(name,msg.Buffer+18,length*2); name[length*2] = 0x00; name[length*2+1] = 0x00; CopyUnicodeString(RadioName,name); smprintf(s,"Station name: \"%s\"\n",DecodeUnicodeString(RadioName)); return ERR_NONE; case 0x15: case 0x16: smprintf(s,"Response for enabling radio/headset status received\n"); if (msg.Buffer[5] == 0) { smprintf(s,"Connected\n"); @@ -1153,48 +1159,49 @@ void DCT4TuneRadio(int argc, char *argv[]) fprintf(stderr,"%.1f MHz - \"%s\" \n", FMStation[i].Frequency, DecodeUnicodeString(FMStation[i].StationName)); } if (answer_yes2("Do you want to save found stations")) { fprintf(stderr,"Deleting old FM stations: "); error=Phone->ClearFMStations(&s); Print_Error(error); fprintf(stderr,"Done\n"); for (i=0;i<num;i++) { FMStation[i].Location = i+1; error=Phone->SetFMStation(&s,&FMStation[i]); Print_Error(error); fprintf(stderr,"%cWriting: %i percent",13,(i+1)*100/num); } fprintf(stderr,"\n"); } error=GSM_WaitFor (&s, Disable, 6, 0x3E, 4, ID_User3); Print_Error(error); GSM_Terminate(); } +#endif void DCT4PlaySavedRingtone(int argc, char *argv[]) { unsigned char req[] = {N6110_FRAME_HEADER, 0x01, 0x00,0x64, //id 0x01, //group 0x01,0x00,0x00, 0x0A, //volume 0x00,0x00,0x00,0x00,0x00,0x00,0x00}; GSM_AllRingtonesInfo Info; GSM_Init(true); CheckDCT4(); s.User.UserReplyFunctions=UserReplyFunctions4; error=Phone->GetRingtonesInfo(&s,&Info); Print_Error(error); if (atoi(argv[2]) > Info.Number-1) { GSM_Terminate(); return; @@ -1292,50 +1299,52 @@ static GSM_Reply_Function UserReplyFunctions4[] = { {DCT4_ReplyGetScreenDump, "\x0E",0x00,0x00,ID_IncomingFrame}, {DCT4_ReplyGetADC, "\x17",0x03,0x10,ID_User3 }, {DCT4_ReplyGetADC, "\x17",0x03,0x12,ID_User3 }, {DCT4_ReplySetPPS, "\x1b",0x03,0x05,ID_User1 }, {NOKIA_ReplyGetPhoneString, "\x1B",0x03,0x08,ID_User6 }, {DCT4_ReplyVibra, "\x1C",0x03,0x0D,ID_User3 }, {DCT4_ReplyVibra, "\x1C",0x03,0x0F,ID_User3 }, {NoneReply, "\x1F",0x03,0x02,ID_User3 }, {DCT4_ReplyGetSecurityCode, "\x23",0x03,0x05,ID_User1 }, {DCT4_ReplyGetT9, "\x23",0x03,0x05,ID_User3 }, {DCT4_ReplyGetVoiceRecord, "\x23",0x03,0x05,ID_User4 }, {DCT4_ReplyGetVoiceRecord, "\x23",0x03,0x0D,ID_User4 }, {DCT4_ReplyGetSecurityCode, "\x23",0x03,0x0D,ID_User1 }, {DCT4_ReplyTestsStartup, "\x35",0x02,0x01,ID_User3 }, {DCT4_ReplyTestsStartup, "\x35",0x02,0x02,ID_User3 }, {DCT4_ReplyTestsNames, "\x35",0x02,0x03,ID_User1 }, {DCT4_ReplyTestsStatus, "\x35",0x02,0x04,ID_User2 }, +#ifdef GSM_ENABLE_NOKIA6510 {DCT4_ReplyTuneRadio, "\x3E",0x03,0x09,ID_User3 }, {DCT4_ReplyTuneRadio, "\x3E",0x03,0x15,ID_User3 }, {DCT4_ReplyTuneRadio, "\x3E",0x03,0x15,ID_SetFMStation}, {DCT4_ReplyTuneRadio, "\x3E",0x03,0x16,ID_User3 }, +#endif {DCT4_ReplyGetVoiceRecord, "\x4A",0x03,0x31,ID_User4 }, {DCT4_ReplyGetSimlock, "\x53",0x03,0x0D,ID_User6 }, {DCT4_ReplyGetSimlock, "\x53",0x03,0x13,ID_User6 }, {DCT4_ReplyMakeCameraShoot, "\x61",0x03,0x03,ID_User3 }, {DCT4_ReplyMakeCameraShoot, "\x61",0x03,0x07,ID_User3 }, {DCT4_ReplyMakeCameraShoot, "\x61",0x03,0x08,ID_User3 }, {DCT4_ReplyMakeCameraShoot, "\x61",0x03,0x0A,ID_User3 }, {DCT4_ReplyMakeCameraShoot, "\x61",0x03,0xF0,ID_User3 }, {DCT4_ReplyGetBTInfo, "\xD7",0x03,0x0A,ID_User6 }, {NULL, "\x00",0x00,0x00,ID_None } }; #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/gammu/depend/nokia/dct4.h b/gammu/emb/gammu/depend/nokia/dct4.h index fde5b08..fae809f 100644 --- a/gammu/emb/gammu/depend/nokia/dct4.h +++ b/gammu/emb/gammu/depend/nokia/dct4.h @@ -1,47 +1,50 @@ /* (c) 2002-2004 by Marcin Wiacek */ #include "../../../common/gsmstate.h" void DCT4SetPhoneMenus (int argc, char *argv[]); void DCT4SelfTests (int argc, char *argv[]); void DCT4SetVibraLevel (int argc, char *argv[]); void DCT4GetSecurityCode (int argc, char *argv[]); -#ifdef DEBUG -void DCT4ResetSecurityCode (int argc, char *argv[]); -#endif void DCT4GetVoiceRecord (int argc, char *argv[]); void DCT4Info (int argc, char *argv[]); void DCT4GetT9 (int argc, char *argv[]); -void DCT4SetLight (int argc, char *argv[]); void DCT4DisplayTest (int argc, char *argv[]); void DCT4GetADC (int argc, char *argv[]); void DCT4VibraTest (int argc, char *argv[]); -void DCT4TuneRadio (int argc, char *argv[]); void DCT4PlaySavedRingtone (int argc, char *argv[]); void DCT4MakeCameraShoot (int argc, char *argv[]); void DCT4GetScreenDump (int argc, char *argv[]); +#ifdef DEBUG + void DCT4ResetSecurityCode (int argc, char *argv[]); +#endif +#ifdef GSM_ENABLE_NOKIA6510 + void DCT4SetLight (int argc, char *argv[]); + void DCT4TuneRadio (int argc, char *argv[]); +#endif + /* ------------------- features matrix ------------------------------------- */ typedef enum { DCT4_ALWAYS_ONLINE = 1, DCT4_GPRS_PCCH, DCT4_GEA1, DCT4_EOTD, DCT4_WAP_PUSH, DCT4_USE_PREF_SIM_NET, DCT4_JAVA_TCK, DCT4_ALS, DCT4_A52, DCT4_CSP, DCT4_EONS, DCT4_3GINDICATOR, DCT4_DISPLAY_PHONE_NAME, DCT4_DISPLAY_WAP_PROFILE, DCT4_GAMES_WAP_DOWNLOAD, DCT4_GAMES_SCORE_SEND, DCT4_GAMES_URL_CHECK, DCT4_BLUETOOTH_MENU, |