GSM_Error DCT4Info(void) { unsigned char GetBTAddress[8] = {N6110_FRAME_HEADER, 0x09, 0x19, 0x01, 0x03, 0x06}; unsigned char GetSimlock[5] = {N6110_FRAME_HEADER, 0x12, 0x0D}; unsigned char value[10]; GSM_Error error; error = CheckDCT4Only(); if (error != ERR_NONE) return error; if (GSM_IsPhoneFeatureAvailable(gsm->Phone.Data.ModelInfo, F_SERIES40_30)) return ERR_NOTSUPPORTED; gsm->User.UserReplyFunctions=UserReplyFunctions4; if (GSM_IsPhoneFeatureAvailable(gsm->Phone.Data.ModelInfo, F_BLUETOOTH)) { printf(LISTFORMAT, _("Bluetooth")); error=GSM_WaitFor (gsm, GetBTAddress, 8, 0xD7, 4, ID_User6); Print_Error(error); } error=GSM_WaitFor (gsm, GetSimlock, 5, 0x53, 4, ID_User6); Print_Error(error); GetSimlock[4] = 0x0E; error=GSM_WaitFor (gsm, GetSimlock, 5, 0x53, 4, ID_User6); Print_Error(error); GetSimlock[3] = 0x0C; error=GSM_WaitFor (gsm, GetSimlock, 4, 0x53, 4, ID_User6); Print_Error(error); error=NOKIA_GetPhoneString(gsm,"\x00\x03\x02\x07\x00\x08",6,0x1b,value,ID_User6,10); Print_Error(error); printf(LISTFORMAT "%s\n", _("UEM"), value); return ERR_NONE; }
void DCT4ResetSecurityCode(int argc, char *argv[]) { unsigned int i; GSM_Error error; unsigned char ResetCode[30] = {0x00,0x06,0x03,0x04,0x01, '1','2','3','4','5','6','7','8','9','0', /* Old code */ 0x00, '1','2','3','4','5',0x00,0x00,0x00,0x00,0x00, /* New code */ 0x00}; if (CheckDCT4Only()!=ERR_NONE) return; gsm->User.UserReplyFunctions=UserReplyFunctions4; error=GSM_WaitFor (gsm, ResetCode, 27, 0x08, 4, ID_User2); if (error == ERR_UNKNOWN) { if (answer_yes2("Try brutal force ?")) { for (i=10000;i<9999999;i++) { printf(_("Trying %i\n"),i); memset(ResetCode+6,0,22); sprintf(ResetCode+5,"%i",i); sprintf(ResetCode+16,"12345"); error=GSM_WaitFor (gsm, ResetCode, 27, 0x08, 4, ID_User2); if (error == ERR_NONE) break; } } } else Print_Error(error); }
void DCT4GetSecurityCode(int argc, char *argv[]) { GSM_Error error; unsigned char getlen[]={0x00, 0x08, 0x01, 0x0C, 0x00, 0x23, //ID 0x00, 0x00, //Index 0x00, 0x00}; unsigned char readcode[]={0x00, 0x08, 0x02, 0x04, 0x00, 0x23, //ID 0x00, 0x00, //Index 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; //Length if (CheckDCT4Only()!=ERR_NONE) return; gsm->User.UserReplyFunctions=UserReplyFunctions4; SecLength = 0; error=GSM_WaitFor (gsm, getlen, sizeof(getlen), 0x23, 1, ID_User1); Print_Error(error); if (SecLength != 0) { readcode[17] = SecLength; error=GSM_WaitFor (gsm, readcode, sizeof(readcode), 0x23, 5, ID_User1); Print_Error(error); } }
void DCT4GetADC(int argc, char *argv[]) { int i = 0; GSM_Error error; unsigned char GetRaw[] = {N6110_FRAME_HEADER, 0x0F, 0x00, /* Test number */ 0x01}; unsigned char GetUnit[] = {N6110_FRAME_HEADER, 0x11, 0x00, /* Test number */ 0x01}; if (CheckDCT4Only()!=ERR_NONE) return; gsm->User.UserReplyFunctions=UserReplyFunctions4; while (1) { printf(" %30s ", gettext(DCT4ADC[i].name)); GetRaw[4] = i; error=GSM_WaitFor (gsm, GetRaw, 6, 0x17, 4, ID_User3); Print_Error(error); GetUnit[4] = i; ADC = DCT4ADC[i].x; error=GSM_WaitFor (gsm, GetUnit, 6, 0x17, 4, ID_User3); Print_Error(error); printf("%s\n", gettext(DCT4ADC[i].unit)); i++; if (DCT4ADC[i].name[0] == 0x00) break; } }
void NokiaSelfTests(int argc, char *argv[]) { GSM_Init(TRUE); #ifdef GSM_ENABLE_NOKIA_DCT3 if (CheckDCT3Only() != ERR_NOTSUPPORTED) { DCT3SelfTests(argc, argv); } #endif #ifdef GSM_ENABLE_NOKIA_DCT4 if (CheckDCT4Only() != ERR_NOTSUPPORTED) { DCT4SelfTests(argc, argv); } #endif GSM_Terminate(); }
void CheckDCT4(void) { GSM_Error error; error = CheckDCT4Only(); switch (error) { case ERR_NOTSUPPORTED: Print_Error(ERR_NOTSUPPORTED); break; case ERR_OTHERCONNECTIONREQUIRED: printf("%s\n", _("Can't do it with current phone protocol")); Print_Error(ERR_NOTSUPPORTED); break; default: break; } }
void NokiaSecurityCode(int argc, char *argv[]) { GSM_Init(TRUE); #ifdef GSM_ENABLE_NOKIA_DCT3 if (CheckDCT3Only() != ERR_NOTSUPPORTED) { DCT3GetSecurityCode(argc,argv); } #endif #ifdef GSM_ENABLE_NOKIA_DCT4 if (CheckDCT4Only() != ERR_NOTSUPPORTED) { /* DCT4ResetSecurityCode(argc, argv); */ DCT4GetSecurityCode(argc,argv); } #endif GSM_Terminate(); }
void DCT4VibraTest(int argc, char *argv[]) { unsigned char ans[200]; GSM_Error error; if (CheckDCT4Only()!=ERR_NONE) return; gsm->User.UserReplyFunctions=UserReplyFunctions4; error=DCT4EnableVibra(gsm, TRUE); Print_Error(error); printf("%s\n", _("Press any key to continue...")); GetLine(stdin, ans, 99); error=DCT4EnableVibra(gsm, FALSE); Print_Error(error); }
void DCT4SetPhoneMenus(int argc, char *argv[]) { int current = 10,i=0,j,z; unsigned char reqSet[200] = { N7110_FRAME_HEADER,0x04,0x00,0x01,0x47,0x48,0x02, 0x00}; /* Number of changed features */ GSM_Error error; if (CheckDCT4Only()!=ERR_NONE) return; gsm->User.UserReplyFunctions=UserReplyFunctions4; while (DCT4PhoneFeatures[i].Model[0] != 0x00) { if (!strcmp(DCT4PhoneFeatures[i].Model,gsm->Phone.Data.Model)) { j = 0; while (DCT4PhoneFeatures[i].Features[j].Name != 0x00) { z = 0; while (DCT4Features[z].Name != 0x00) { if (DCT4Features[z].Name == DCT4PhoneFeatures[i].Features[j].Name) { printf("%s : %s\n",DCT4Features[z].Text,DCT4Features[z].Values[0].Text); reqSet[9]++; /* Number of features */ reqSet[current++] = DCT4PhoneFeatures[i].Features[j].Number; /* Feature number */ reqSet[current++] = DCT4Features[z].Values[0].Value; /* Value */ break; } z++; } j++; } } i++; } if (current == 10) { printf("%s\n", _("Sorry, but configuration matrix for this model has not yet been added. See <https://wammu.eu/support/bugs/> for information how to report it.")); return; } reqSet[current++] = 0x00; reqSet[current++] = 0x00; error=GSM_WaitFor (gsm, reqSet, current, 0x1b, 4, ID_User1); Print_Error(error); }
void DCT4GetT9(int argc, char *argv[]) { int i,T9Dictionary=0; unsigned char req[] = {N7110_FRAME_HEADER, 0x04, 0x00, 0x5B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* Start position */ 0x00, 0x00, 0x02, 0xBC}; /* How many bytes to read */ GSM_Error error; if (CheckDCT4Only()!=ERR_NONE) return; T9File = fopen("T9", "w"); if (T9File == NULL) return; gsm->User.UserReplyFunctions=UserReplyFunctions4; 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 (gsm, req, 18, 0x23, 4, ID_User3); Print_Error(error); if (i==0) { T9Dictionary = T9FullSize; smprintf(gsm, "T9 dictionary size is %i\n",T9Dictionary); } i+=T9Size; } fclose(T9File); }
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; gsm->User.UserReplyFunctions=UserReplyFunctions4; DCT4_SetPhoneMode(gsm, DCT4_MODE_TEST); gsm->Protocol.Functions->WriteMessage(gsm, req0, 6, 0x40); req[8] = GetInt(argv[2]); gsm->Protocol.Functions->WriteMessage(gsm, req, 10, 0x40); printf("%s\n", _("Press any key to continue...")); GetLine(stdin, ans, 99); DCT4_SetPhoneMode(gsm, DCT4_MODE_NORMAL); }
void DCT4SelfTests(int argc, char *argv[]) { int j; GSM_Error error; unsigned char GetDoneST[6] = {0x00, 0x08, 0x01, 0x04, 0x01, 0x00}; unsigned char GetDoneST2[6] = {0x00, 0x08, 0x02, 0x04, 0x02, 0x00}; unsigned char GetNames[6] = {0x00, 0x08, 0x03, 0x06, 0x03, 0x00}; unsigned char GetStatus[6] = {0x00, 0x08, 0x04, 0x02, 0x03, 0x00}; unsigned char RunALL[6] = {0x00, 0x06, 0x04, 0x00, 0x03, 0x00}; // unsigned char GetID[6] = {0x00, 0x08, 0x00, 0x04, 0x03, 0x00};//tests ID if (CheckDCT4Only()!=ERR_NONE) return; gsm->User.UserReplyFunctions=UserReplyFunctions4; if (answer_yes2("Run all tests now ?")) { error=GSM_WaitFor (gsm, RunALL, 6, 0x35, 4, ID_User1); Print_Error(error); } error=GSM_WaitFor (gsm, GetNames, 6, 0x35, 4, ID_User1); Print_Error(error); for (j=0;j<DCT4Tests.Num;j++) DCT4Tests.Tests[j].Startup = FALSE; error=GSM_WaitFor (gsm, GetDoneST, 6, 0x35, 4, ID_User3); Print_Error(error); error=GSM_WaitFor (gsm, GetDoneST2, 6, 0x35, 4, ID_User3); Print_Error(error); error=GSM_WaitFor (gsm, GetStatus, 6, 0x35, 4, ID_User2); Print_Error(error); }