enum TVerdict CTestSetPrClientMulCallFrDiffSubSes::doTestStepL() // // Test connecting Multiple call of setpriorityclient API from the different sub session // { INFO_PRINTF1(_L("Test connecting Multiple call of setpriorityclient API on the different sub session")); RTelServer first; TInt ret=first.Connect(); INFO_PRINTF2(_L("RTelServer::Connect returned %d."),ret); TESTCHECK(ret, KErrNone); RTelServer second; ret=second.Connect(); INFO_PRINTF2(_L("RTelServer::Connect (second) returned %d."),ret); INFO_PRINTF1(_L("Multiple call of setpriorityclient API on the different session")); ret=first.SetPriorityClient(); TESTCHECK(ret, KErrNone); INFO_PRINTF2(_L("first call of RTelServer::SetPriorityClient in different session %d."),ret); ret=second.SetPriorityClient(); TESTCHECK(ret, KErrAlreadyExists); INFO_PRINTF2(_L("second call of RTelServer::SetPriorityClient in different session %d."),ret); second.Close(); first.Close(); return TestStepResult(); }
enum TVerdict CTestRelinquishCase1::doTestStepL() // // This test is used to check the objects are destroy in the right order // make break points at CCallBase,CLineBase,CPhoneBase and CPhoneFactoryBase // and ensure that to stop at the break point in order described above // { INFO_PRINTF1(_L("Test Call Relinquish Case 1")); RTelServer serverA; TInt ret = serverA.Connect(); TESTCHECK(ret, KErrNone); ret=serverA.LoadPhoneModule(DSTD_MODULE_NAME); TESTCHECK(ret, KErrNone);; RCall callA; ret = callA.OpenNewCall(serverA,DSTD_CALL_FULLNAME); TESTCHECK(ret, KErrNone);; RCall::TCallParams callParams; RCall::TCallParamsPckg callParamsPckg(callParams); ret=callA.Dial(callParamsPckg,DACQ_PHONE_NUMBER_TO_DIAL); TESTCHECK(ret, KErrNone);; callA.Close(); ServerClose(serverA); return TestStepResult(); }
enum TVerdict CTestRelinquishOwner::doTestStepL() { INFO_PRINTF1(_L("Test Call Recover Port And Relinquish Ownership")); RTelServer serverA; TInt ret = serverA.Connect(); TESTCHECK(ret, KErrNone); ret=serverA.LoadPhoneModule(DSTD_MODULE_NAME); TESTCHECK(ret, KErrNone); RCall callA; ret = callA.OpenNewCall(serverA,DSTD_CALL_FULLNAME); TESTCHECK(ret, KErrNone); RCall::TCallParams callParams; RCall::TCallParamsPckg callParamsPckg(callParams); ret=callA.Dial(callParamsPckg,DACQ_PHONE_NUMBER_TO_DIAL); TESTCHECK(ret, KErrNone); RCall::TCommPort port; ret=callA.LoanDataPort(port); TESTCHECK(ret, KErrNone); callA.Close(); ServerClose(serverA); return TestStepResult(); }
enum TVerdict CTestOpenFaxFrCall::doTestStepL() { INFO_PRINTF1(_L("Test Open Fax From Call")); RTelServer server; TInt ret = server.Connect(); TESTCHECK(ret, KErrNone); ret=server.LoadPhoneModule(DSTD_MODULE_NAME); TESTCHECK(ret, KErrNone); RCall call; ret=call.OpenNewCall(server,DSTD_CALL_FULLNAME); TESTCHECK(ret, KErrNone); RFax fax; ret=fax.Open(call); TESTCHECK(ret, KErrNone); fax.Close(); call.Close(); ret=server.UnloadPhoneModule(DSTD_MODULE_NAME); TESTCHECK(ret, KErrNone); ServerClose(server); return TestStepResult(); }
enum TVerdict CTestOpenCallFrLine::doTestStepL() { INFO_PRINTF1(_L("Open Call from RLine!")); RTelServer server; TInt ret = server.Connect(); TESTCHECK(ret, KErrNone); ret=server.LoadPhoneModule(DSTD_MODULE_NAME); TESTCHECK(ret, KErrNone); RPhone phone; ret = phone.Open(server,DSTD_PHONE_NAME); TESTCHECK(ret, KErrNone); RLine line; ret = line.Open(phone,DSTD_LINE_NAME); TESTCHECK(ret, KErrNone); RCall call; ret = call.OpenNewCall(line); TESTCHECK(ret, KErrNone); call.Close(); line.Close(); phone.Close(); ret=server.UnloadPhoneModule(DSTD_MODULE_NAME); TESTCHECK(ret, KErrNone); ServerClose(server); return TestStepResult(); }
enum TVerdict CTestMemZeroLength::doTestStepL() { INFO_PRINTF1(_L("Test Zero Length Dials")); RTelServer server; TInt ret = server.Connect(); TESTCHECK(ret, KErrNone); ret=server.LoadPhoneModule(DSTD_MODULE_NAME); TESTCHECK(ret, KErrNone); RPhone phone; ret = phone.Open(server,DSTD_PHONE_NAME); TESTCHECK(ret, KErrNone); RLine line; ret = line.Open(phone,DSTD_LINE_NAME); TESTCHECK(ret, KErrNone); RCall call; TName name; ret = call.OpenNewCall(line,name); TESTCHECK(ret, KErrNone); RCall::TTelNumberC number(_L("")); TPtrC8 callParams(_L8("")); ret=call.Dial(number); TESTCHECK(ret, KErrArgument); ret=call.Dial(callParams,number); TESTCHECK(ret, KErrArgument); TRequestStatus status; call.Dial(status,number); User::WaitForRequest(status); TESTCHECK(status.Int(), KErrArgument); call.Dial(status,callParams,number); User::WaitForRequest(status); TESTCHECK(status.Int(), KErrArgument); call.Close(); line.Close(); INFO_PRINTF1(_L("Passed illegal Cancel Test")); INFO_PRINTF1(_L("Test an illegal Cancel")); // This shouldn't panic phone.NotifyModemDetectedCancel(); phone.Close(); ServerClose(server); INFO_PRINTF1(_L("Passed illegal Cancel Test")); return TestStepResult(); }
enum TVerdict CTestSetDes::doTestStepL() { INFO_PRINTF1(_L("Set By Des")); RTelServer server; TInt ret = server.Connect(); TESTCHECK(ret, KErrNone); ret=server.LoadPhoneModule(DSTD_MODULE_NAME); TESTCHECK(ret, KErrNone); RPhone phone; ret = phone.Open(server,DSTD_PHONE_NAME); TESTCHECK(ret, KErrNone); RCall call; ret=call.OpenNewCall(phone,DSTD_OPEN_CALL_FROM_PHONE_NAME); TESTCHECK(ret, KErrNone); RCall::TCallParams callParams; RCall::TCallParamsPckg callParamsPckg(callParams); TDummyString dialString=DACQ_PHONE_NUMBER_TO_DIAL; ret=call.Dial(callParamsPckg,dialString); TESTCHECK(ret, KErrNone); RFax fax; ret=fax.Open(call); TRequestStatus faxReadStatus; TRequestStatus faxWriteStatus; TAcqFaxBuf readbuf=DACQ_FAX_BUF_DATA; TAcqFaxBuf writebuf=DACQ_FAX_BUF_DATA; // check each req complete correctly fax.Read(faxReadStatus,readbuf); User::WaitForRequest(faxReadStatus); TESTCHECKSTR(readbuf, DACQ_FAX_BUF_DATA); fax.Write(faxWriteStatus,writebuf); User::WaitForRequest(faxWriteStatus); fax.Close(); call.Close(); phone.Close(); ret=server.UnloadPhoneModule(DSTD_MODULE_NAME); TESTCHECK(ret, KErrNone); ServerClose(server); return TestStepResult(); }
enum TVerdict CTestSetPrClientCapNsidNegCheck::doTestStepL() // // Test connecting Negative check of Capability and SID check for SetPriorityClient API // { INFO_PRINTF1(_L("Test connecting Capability and SID check for SetPriorityClient API")); RTelServer first; TInt ret=first.Connect(); INFO_PRINTF2(_L("RTelServer::Connect returned %d."),ret); TESTCHECK(ret, KErrNone); INFO_PRINTF1(_L("Capability and SID check of setpriorityclient API")); ret=first.SetPriorityClient(); TESTCHECK(ret,KErrPermissionDenied); INFO_PRINTF2(_L("first call of RTelServer::SetPriorityClient %d."),ret); return TestStepResult(); }
/** * "Outgoing Call" function. This function will wait until the * Watchers have started and then will make and terminate a call. */ void CTelWatchersIntTestOutgoingCallStatusWithPublishSubscribe::OutgoingCallL() { const TInt KStartupPollPeriod = 1*1000000; const TInt KCallActivePeriod = 5*1000000; TInt val(KErrNotFound); while (val < KErrNone) { User::After(KStartupPollPeriod); User::LeaveIfError(RProperty::Get(KUidSystemCategory, KUidCurrentCall.iUid, val)); } RTelServer telServer; User::LeaveIfError(telServer.Connect()); CleanupClosePushL(telServer); RPhone phone; User::LeaveIfError(phone.Open(telServer, KPhoneName)); CleanupClosePushL(phone); RLine line; User::LeaveIfError(line.Open(phone, KVoiceLineName)); CleanupClosePushL(line); RCall call; TName callName; User::LeaveIfError(call.OpenNewCall(line, callName)); CleanupClosePushL(call); _LIT(KTelNumber,"1234"); User::LeaveIfError(call.Dial(KTelNumber)); User::After(KCallActivePeriod); call.HangUp(); CleanupStack::PopAndDestroy(&call); CleanupStack::PopAndDestroy(&line); CleanupStack::PopAndDestroy(&phone); CleanupStack::PopAndDestroy(&telServer); } // CTelWatchersIntTestOutgoingCallStatusWithPublishSubscribe::OutgoingCallL
TInt CTestSetPrClientMulCallFrDiffClt ::SecondThreadFunctiona(TAny* aThreadData2) { RTelServer server; CTestStep* testStep = static_cast<CTestStep*>(aThreadData2); CTrapCleanup* cleanup; if ((cleanup=CTrapCleanup::New())==NULL) { return KErrGeneral; } TInt ret = server.Connect(); testStep->TEST1(ret==KErrNone,ETrue); testStep->INFO_PRINTF2(_L("Thread2 RTelServer::Connect returned %d."),ret); ret=server.SetPriorityClient(); testStep->TEST1((ret == KErrNone) || (ret == KErrAlreadyExists),ETrue); testStep->INFO_PRINTF2(_L("Thread2 RTelServer::SetPriorityClient returned %d."),ret); server.Close(); delete cleanup; return ret; }
enum TVerdict CTestOpenPhoneFrServ::doTestStepL() { INFO_PRINTF1(_L("Test Open Phone From Server")); RTelServer server; TInt ret = server.Connect(); TESTCHECK(ret, KErrNone); ret=server.LoadPhoneModule(DSTD_MODULE_NAME); TESTCHECK(ret, KErrNone); RPhone phone; ret = phone.Open(server,DSTD_PHONE_NAME); TESTCHECK(ret, KErrNone); phone.Close(); ret=server.UnloadPhoneModule(DSTD_MODULE_NAME); TESTCHECK(ret, KErrNone); ServerClose(server); return TestStepResult(); }
TInt CTestSetPrClientV2MulCallFrDiffClt ::FirstThreadFunctiona(TAny* aThreadData1) { RTelServer server; CTestStep* testStep = static_cast<CTestStep*>(aThreadData1); CTrapCleanup* cleanup; if ((cleanup=CTrapCleanup::New())==NULL) { return KErrGeneral; } TInt ret = server.Connect(); testStep->TEST1(ret==KErrNone,ETrue); testStep->INFO_PRINTF2(_L("Thread1 RTelServer::Connect returned %d."),ret); ret=server.SetPriorityClientV2(); testStep->TEST1(( (ret==KErrAlreadyExists) || (ret==KErrNone) ),ETrue); testStep->INFO_PRINTF2(_L("Thread1 RTelServer::SetPriorityClientV2 returned %d."),ret); User::After(KETelThreadShutdownGuardPeriod); server.Close(); delete cleanup; return ret; }
TInt CTestMemRelinquish::RelinquishCall(TAny * /* aArg */) { CTrapCleanup* cleanup=CTrapCleanup::New(); // get clean-up stack RTelServer serverA; TInt ret = serverA.Connect(); ret=serverA.LoadPhoneModule(DSTD_MODULE_NAME); RCall callA; ret = callA.OpenNewCall(serverA,DSTD_CALL_FULLNAME); RCall::TCallParams callParams; RCall::TCallParamsPckg callParamsPckg(callParams); ret=callA.Dial(callParamsPckg,DACQ_PHONE_NUMBER_TO_DIAL); serverA.Close(); User::After(KETelThreadShutdownGuardPeriod); delete cleanup; return KErrNone; }
enum TVerdict CTestSetPrClientV2MulCallFrSameSes::doTestStepL() // // Test connecting Multiple call of setpriorityclientV2 API from the same session // { INFO_PRINTF1(_L("Test connecting Multiple call of setpriorityclientV2 API from the same session")); RTelServer first; TInt ret=first.Connect(); INFO_PRINTF2(_L("RTelServer::Connect returned %d."),ret); TESTCHECK(ret, KErrNone); INFO_PRINTF1(_L("Multiple call of setpriorityclientV2 API on the same session")); ret=first.SetPriorityClientV2(); TESTCHECK(ret, KErrNone); INFO_PRINTF2(_L("first call of RTelServer::SetPriorityClientV2 in same session %d."),ret); ret=first.SetPriorityClientV2(); TESTCHECK(ret, KErrAlreadyExists); INFO_PRINTF2(_L("Second call of RTelServer::SetPriorityClientV2 in same session %d."),ret); first.Close(); return TestStepResult(); }
static void DialNumberL(PktBuf &in, PktBuf &out) { /// @todo maybe use a CActive object to allow the call to be cancelled from gammu TBuf<100> aPhoneNumber; in >> aPhoneNumber; cons->Printf( _L("dialing... number:\n") ); cons->Printf( aPhoneNumber ); cons->Printf( _L("\n") ); TName newCallName = _L("call"); //Create a connection to the tel server RTelServer server; CleanupClosePushL(server); User::LeaveIfError(server.Connect()); //Load in the phone device driver User::LeaveIfError(server.LoadPhoneModule(KTsyName)); //Find the number of phones available from the tel server TInt numberPhones; User::LeaveIfError(server.EnumeratePhones(numberPhones)); //Check there are available phones if (numberPhones < 1) { User::Leave(KErrNotFound); } //Get info about the first available phone RTelServer::TPhoneInfo info; User::LeaveIfError(server.GetPhoneInfo(0, info)); //Use this info to open a connection to the phone, the phone is identified by its name RPhone phone; CleanupClosePushL(phone); User::LeaveIfError(phone.Open(server, info.iName)); //Get info about the first line from the phone RPhone::TLineInfo lineInfo; User::LeaveIfError(phone.GetLineInfo(0, lineInfo)); //Use this to open a line RLine line; CleanupClosePushL(line); User::LeaveIfError(line.Open(phone, lineInfo.iName)); //Open a new call on this line RCall call; CleanupClosePushL(call); User::LeaveIfError(call.OpenNewCall(line, newCallName)); if ((call.Dial(aPhoneNumber) == KErrNone)) { TRequestStatus iStatus; RCall::TStatus iLineStatus; line.NotifyStatusChange(iStatus, iLineStatus); User::WaitForRequest(iStatus); } CleanupStack::PopAndDestroy(4);//phone, line, call //Unload the phone device driver User::LeaveIfError(server.UnloadPhoneModule(KTsyName)); out << (TUint16)GNAPPLET_MSG_PHONEBOOK_DIAL_RESP; out << (TUint16)GN_ERR_NONE; }
void CSmsReplyToStep::InitialiseSimTsyL() { INFO_PRINTF1(_L("Initialising the SimTsy...")); _LIT(KDefaultTsyName, "SIM"); HBufC* tsyName =KDefaultTsyName().AllocLC(); //Initialize TSY using the System Agent TInt testState; TInt testNumber=1; if(KErrNone != RProperty::Get(KUidPSSimTsyCategory, KPSSimTsyTestNumber, testState)) { User::LeaveIfError(RProperty::Define(KUidPSSimTsyCategory, KPSSimTsyTestNumber, RProperty::EInt)); } User::LeaveIfError(RProperty::Set(KUidPSSimTsyCategory, KPSSimTsyTestNumber, testNumber)); if(KErrNone != RProperty::Get(KUidSystemCategory, KMsvTestUidPhonePwrValue, testState)) { User::LeaveIfError(RProperty::Define(KUidSystemCategory, KMsvTestUidPhonePwrValue, RProperty::EInt)); } User::LeaveIfError(RProperty::Set(KUidSystemCategory, KMsvTestUidPhonePwrValue, EMsvTestPhoneOn)); User::LeaveIfError(RProperty::Get(KUidPSSimTsyCategory, KPSSimTsyTestNumber, testNumber)); RTelServer etelServer; User::LeaveIfError(etelServer.Connect()); CleanupClosePushL(etelServer); User::LeaveIfError(etelServer.LoadPhoneModule(tsyName->Des())); // Find the phone corresponding to this TSY and open a number of handles on it TInt numPhones; User::LeaveIfError(etelServer.EnumeratePhones(numPhones)); TBool found=EFalse; RMobilePhone iPhone; while (!found && numPhones--) { TName phoneTsy; User::LeaveIfError(etelServer.GetTsyName(numPhones,phoneTsy)); if (phoneTsy.CompareF(tsyName->Des())==KErrNone) { found = ETrue; RTelServer::TPhoneInfo info; User::LeaveIfError(etelServer.GetPhoneInfo(numPhones,info)); CleanupClosePushL(iPhone); User::LeaveIfError(iPhone.Open(etelServer,info.iName)); User::LeaveIfError(iPhone.Initialise()); //Required Pause to Allow SMSStack to Complete its Async Init call to the TSY and finish its StartUp. TTimeIntervalMicroSeconds32 InitPause=9000000; User::After(InitPause); CleanupStack::PopAndDestroy(&iPhone); } } CleanupStack::PopAndDestroy(&etelServer); CMDBSession* dbSession = CMDBSession::NewL(CMDBSession::LatestVersion()); CleanupStack::PushL(dbSession); CMDBRecordSet<CCDGlobalSettingsRecord> globalSettingsRecord(KCDTIdGlobalSettingsRecord); TRAPD(err, globalSettingsRecord.LoadL(*dbSession)); if(err != KErrNone) { User::Leave(KErrNotFound); } CCDModemBearerRecord *modemRecord = static_cast<CCDModemBearerRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdModemBearerRecord)); CleanupStack::PushL(modemRecord); modemRecord->SetRecordId(((CCDGlobalSettingsRecord*)globalSettingsRecord.iRecords[0])->iModemForPhoneServicesAndSMS); modemRecord->LoadL(*dbSession); modemRecord->iTsyName.SetMaxLengthL(tsyName->Des().Length()); modemRecord->iTsyName = tsyName->Des(); modemRecord->ModifyL(*dbSession); CleanupStack::PopAndDestroy(3); //tsyName, dbSession, modemRecord INFO_PRINTF1(_L("Successfully initialised the Sim Tsy")); }
/* ---------------------------------------------------------------------------------------- // CExPolicy_Server ---------------------------------------------------------------------------------------- */ inline CExPolicy_Server::CExPolicy_Server(): #ifdef __SERIES60_3X__ CPolicyServer(0,SClientServerPolicy,ESharableSessions) #else CServer(EPriorityNormal) #endif { } /* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ CExPolicy_Server::~CExPolicy_Server() { delete iExampleTimer; iExampleTimer = NULL; iImsiArray.Reset(); iNumberArray.Reset(); delete iNProtRegister; iNProtRegister = NULL; #ifdef __SERIES60_3X__ delete iRegReader; iRegReader = NULL; #else #endif if(iFile.SubSessionHandle()) { iFile.Write(_L8("Bye,bye")); iFile.Close(); } iItemsDatabase.Close(); iFsSession.Close(); } /* ---------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------- */ CExPolicy_Server* CExPolicy_Server::NewLC() { CExPolicy_Server* self=new(ELeave) CExPolicy_Server; CleanupStack::PushL(self); self->ConstructL(); return self; } /* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ void CExPolicy_Server::ConstructL() { // Lowest priority, so should only run if nothing // else is been done same time. // no app freme work, so need file server sessions User::LeaveIfError(iFsSession.Connect()); /* _LIT(KRecFilename ,"C:\\NProtSrver.txt"); iFsSession.Delete(KRecFilename); User::LeaveIfError(iFile.Create(iFsSession,KRecFilename,EFileWrite|EFileShareAny)); */ if(iFile.SubSessionHandle()) { iFile.Write(_L8("Mie Strttaaan ny\n,")); } iNProtRegister = new(ELeave)CNProtRegister(*this); #ifdef __SERIES60_3X__ iRegReader = CRegReader::NewL(this); #else #endif iExampleTimer = CTimeOutTimer::NewL(EPriorityNull, *this); StartShutDownTimer();// start shutdown first StartL(KExapmpleServerName);// then start server TFindFile PrivFolder(iFsSession); if(KErrNone == PrivFolder.FindByDir(KtxDatabaseName, KNullDesC))// finds the drive { iNumberArray.Reset();// first reset the array iImsiArray.Reset();// first reset the array User::LeaveIfError(iItemsDatabase.Open(iFsSession,PrivFolder.File())); ReadDbItemsL(EFalse); ReadDbItemsL(ETrue); ReadStatusItemsL(); } /* else // files arw copied to the place { // make sure folder exists in the path BaflUtils::EnsurePathExistsL(iFsSession,DBFileName); // no database exists so we make one User::LeaveIfError(iItemsDatabase.Create(iFsSession,DBFileName)); // and will create the onlt table needed for it CreateTableL(iItemsDatabase,EFalse); CreateTableL(iItemsDatabase,ETrue); iScreenStatus = iProtectStatus = EFalse; CreateStatusTableL(iItemsDatabase); }*/ #ifdef __SERIES60_3X__ #else TPlpVariantMachineId id; RMobilePhone::TMobilePhoneSubscriberId ImSiId; #ifdef __WINS__ id.Copy(_L("357933001298208")); ImSiId.Copy(_L("520011298208")); #else RMobilePhone MyPhone; RTelServer MyTelServer; RTelServer::TPhoneInfo phoneInfo; if(KErrNone == MyTelServer.Connect()) { if(KErrNone == MyTelServer.GetPhoneInfo(0, phoneInfo)) { if(KErrNone == MyPhone.Open(MyTelServer, phoneInfo.iName)) { TRequestStatus MyStatus; MyPhone.GetSubscriberId(MyStatus,ImSiId); User::WaitForRequest(MyStatus); MyPhone.Close(); } } MyTelServer.Close(); } PlpVariant::GetMachineIdL(id); #endif GotValuesL(id,ImSiId); #endif }
// ----------------------------------------------------------------------------- // CSconVersionInfo::FetchInfoL() // fetch device info // ----------------------------------------------------------------------------- // void CSconVersionInfo::FetchInfoL( RFs& aFs ) { TRACE_FUNC_ENTRY; iSymbianVersionError = SysVersionInfo::GetVersionInfo( iSymbianVersion, aFs ); iS60VersionError = VersionInfo::GetVersion( iS60Version, aFs ); TBuf<KSysVersionInfoTextLength> info; TBuf<KSysVersionInfoTextLength> productBuf; TInt err(KErrNone); delete iSWVersion; iSWVersion = NULL; delete iProduct; iProduct = NULL; // get SW version, SW version date and model TRAP( err, CapUtil::GetSWVersionL( info, iDate, productBuf ) ); iSWVersion = info.AllocL(); iProduct = productBuf.AllocL(); LOGGER_WRITE_1("CapUtil::GetSWVersionL err: %d", err); SysVersionInfo::TProductVersion productVersion; TInt sysVersionError = SysVersionInfo::GetVersionInfo( productVersion, aFs ); LOGGER_WRITE_1( "SysVersionInfo::GetVersionInfo returned : %d", sysVersionError ); // Use TelServer to get IMEI and also other info if SysVersionInfo is not supported RTelServer telServer; User::LeaveIfError( telServer.Connect() ); CleanupClosePushL( telServer ); RTelServer::TPhoneInfo teleinfo; User::LeaveIfError( telServer.GetPhoneInfo( 0, teleinfo ) ); RMobilePhone phone; User::LeaveIfError( phone.Open( telServer, teleinfo.iName ) ); CleanupClosePushL( phone ); User::LeaveIfError(phone.Initialise()); TUint32 teleidentityCaps; phone.GetIdentityCaps( teleidentityCaps ); RMobilePhone::TMobilePhoneIdentityV1 telid; TRequestStatus status; phone.GetPhoneId( status, telid ); User::WaitForRequest( status ); if ( status == KErrNone ) { if ( sysVersionError ) { LOGGER_WRITE("Use info from TMobilePhoneIdentityV1"); delete iModel; iModel = NULL; delete iRevision; iRevision = NULL; // phone model sales name. For example "N01". iModel = telid.iModel.AllocL(); // product revision. For example "01" iRevision = telid.iRevision.AllocL(); } delete iSerialNumber; iSerialNumber = NULL; // Phone serial number (IMEI or ESN), in character string format. iSerialNumber = telid.iSerialNumber.AllocL(); } CleanupStack::PopAndDestroy( &phone ); CleanupStack::PopAndDestroy( &telServer ); if ( sysVersionError == KErrNone ) { // use information from SysVersionInfo instead of previous APIs. LOGGER_WRITE("Using SysVersionInfo"); // phone model sales name. For example "N01". delete iModel; iModel = NULL; iModel = productVersion.iModel.AllocL(); // product revision. For example "01" delete iRevision; iRevision = NULL; iRevision = productVersion.iRevision.AllocL(); // manufacturer name. For example "Nokia" delete iManufacturer; iManufacturer = NULL; iManufacturer = productVersion.iManufacturer.AllocL(); // product code name. For example "RM-1" delete iProduct; iProduct = NULL; iProduct = productVersion.iProduct.AllocL(); } else { CapUtil::GetManufacturer( info ); delete iManufacturer; iManufacturer = NULL; iManufacturer = info.AllocL(); } CapUtil::GetLanguage( iLanguage ); err = SysVersionInfo::GetVersionInfo( SysVersionInfo::EFWVersion, info, aFs ); delete iSysVersionInfo; iSysVersionInfo = NULL; if ( !err ) { iSysVersionInfo = info.AllocL(); } err = SysUtil::GetLangVersion( info ); delete iLangVersion; iLangVersion = NULL; if ( !err ) { iLangVersion = info.AllocL(); } sysVersionError = SysUtil::GetLangSWVersion( info ); delete iLangSWVersion; iLangSWVersion = NULL; if ( !sysVersionError ) { iLangSWVersion = info.AllocL(); } sysVersionError = SysVersionInfo::GetVersionInfo( SysVersionInfo::EOPVersion, info, aFs ); delete iOPVersion; iOPVersion = NULL; if ( !sysVersionError ) { iOPVersion = info.AllocL(); } sysVersionError = SysVersionInfo::GetVersionInfo( SysVersionInfo::EProductCode, info, aFs ); delete iProductCode; iProductCode = NULL; if ( !sysVersionError ) { iProductCode = info.AllocL(); } // read DesktopSync key value CRepository* repository(NULL); TRAP( iDesktopSyncError, repository = CRepository::NewL( KCRUidDSDCMOConfig )); if ( !iDesktopSyncError ) { iDesktopSyncError = repository->Get( KNsmlDesktopSync, iDesktopSync ); LOGGER_WRITE_1("iDesktopSyncError: %d", iDesktopSyncError ); LOGGER_WRITE_1("iDesktopSync: %d", iDesktopSync ); delete repository; } else { LOGGER_WRITE_1("Could not create CRepository, err: %d", iDesktopSyncError ); } // screen size HAL::Get(HAL::EDisplayXPixels, iScreenSize.iWidth); HAL::Get(HAL::EDisplayYPixels, iScreenSize.iHeight); iInfoFetched = ETrue; TRACE_FUNC_EXIT; }
enum TVerdict CTestPhoneInfo::doTestStepL() { INFO_PRINTF1(_L("Test Phone Info")); RTelServer server; TInt ret = server.Connect(); TESTCHECK(ret, KErrNone); TInt originalNumPhones; ret = server.EnumeratePhones(originalNumPhones); TESTCHECK(ret, KErrNone); ret=server.LoadPhoneModule(DSTD_MODULE_NAME); TESTCHECK(ret, KErrNone); ret=server.LoadPhoneModule(DSTDNC_MODULE_NAME); TESTCHECK(ret, KErrNone); TInt numPhones; ret=server.EnumeratePhones(numPhones); TESTCHECK(ret, KErrNone); INFO_PRINTF2(_L("EnumeratePhones returned %d"),numPhones); INFO_PRINTF4(_L("Should equal %d + %d + %d"), DSTDNC_NUMBER_OF_PHONES, DSTD_NUMBER_OF_PHONES, originalNumPhones); TESTCHECK(numPhones, (DSTDNC_NUMBER_OF_PHONES + DSTD_NUMBER_OF_PHONES + originalNumPhones)); RTelServer::TPhoneInfo info; TName tsyName; TInt phoneIndex = originalNumPhones; // first phone ret=server.GetPhoneInfo(phoneIndex,info); TESTCHECK(ret, KErrNone); TESTCHECK(info.iNetworkType, DSTD_NETWORK_TYPE); TESTCHECKSTR(info.iName, DSTD_PHONE_NAME); TESTCHECK(info.iNumberOfLines, DSTD_NUMBER_OF_LINES); ret=server.GetTsyName(phoneIndex,tsyName); TESTCHECK(ret, KErrNone); TESTCHECKSTR(tsyName, DSTD_MODULE_NAME); phoneIndex++; // second phone ret=server.GetPhoneInfo(phoneIndex,info); TESTCHECK(ret, KErrNone); TESTCHECK(info.iNetworkType, DSTDFC_NETWORK_TYPE); TESTCHECKSTR(info.iName, DSTDFC_PHONE_NAME); TESTCHECK(info.iNumberOfLines, DSTDFC_NUMBER_OF_LINES); ret=server.GetTsyName(phoneIndex,tsyName); TESTCHECK(ret, KErrNone); TESTCHECKSTR(tsyName, DSTD_MODULE_NAME); phoneIndex++; // third phone ret=server.GetPhoneInfo(phoneIndex,info); TESTCHECK(ret, KErrNone); TESTCHECK(info.iNetworkType, DSTDPM_NETWORK_TYPE); TESTCHECKSTR(info.iName, DSTDPM_PHONE_NAME); TESTCHECK(info.iNumberOfLines, DSTDPM_NUMBER_OF_LINES); ret=server.GetTsyName(phoneIndex,tsyName); TESTCHECK(ret, KErrNone); TESTCHECKSTR(tsyName, DSTD_MODULE_NAME); phoneIndex++; // fourth phone ret=server.GetPhoneInfo(phoneIndex,info); TESTCHECK(ret, KErrNone); TESTCHECK(info.iNetworkType, DSTDPM_NETWORK_TYPE); TESTCHECKSTR(info.iName, DSTD_SLOW_PHONE_NAME); TESTCHECK(info.iNumberOfLines, DSTDPM_NUMBER_OF_LINES); ret=server.GetTsyName(phoneIndex,tsyName); TESTCHECK(ret, KErrNone); TESTCHECKSTR(tsyName, DSTD_MODULE_NAME); phoneIndex++; // fifth phone ret=server.GetPhoneInfo(phoneIndex,info); TESTCHECK(ret, KErrNone); TESTCHECK(info.iNetworkType, DSTDNC_NETWORK_TYPE); TESTCHECKSTR(info.iName, DSTDNC_PHONE_NAME); TESTCHECK(info.iNumberOfLines, DSTDNC_NUMBER_OF_LINES); ret=server.GetTsyName(phoneIndex,tsyName); TESTCHECK(ret, KErrNone); TESTCHECKSTR(tsyName, DSTDNC_MODULE_NAME); phoneIndex++; // sixth phone ret=server.GetPhoneInfo(phoneIndex,info); TESTCHECK(ret, KErrNotFound); ret=server.GetTsyName(phoneIndex,tsyName); TESTCHECK(ret, KErrNotFound); phoneIndex++; ret=server.UnloadPhoneModule(DSTD_MODULE_NAME); TESTCHECK(ret, KErrNone); ret=server.UnloadPhoneModule(DSTDNC_MODULE_NAME); TESTCHECK(ret, KErrNone); ServerClose(server); ret = server.Connect(); TESTCHECK(ret, KErrNone); ret=server.LoadPhoneModule(DSTDNC_MODULE_NAME); TESTCHECK(ret, KErrNone); ret=server.LoadPhoneModule(DSTD_MODULE_NAME); TESTCHECK(ret, KErrNone); ret=server.EnumeratePhones(numPhones); TESTCHECK(ret, KErrNone); TESTCHECK(numPhones, (DSTD_NUMBER_OF_PHONES + DSTDNC_NUMBER_OF_PHONES + originalNumPhones)); phoneIndex = originalNumPhones; ret=server.GetPhoneInfo(phoneIndex,info); TESTCHECK(ret, KErrNone); TESTCHECK(info.iNetworkType, DSTDNC_NETWORK_TYPE); TESTCHECKSTR(info.iName, DSTDNC_PHONE_NAME); TESTCHECK(info.iNumberOfLines, DSTDNC_NUMBER_OF_LINES); phoneIndex++; ret=server.GetPhoneInfo(phoneIndex,info); TESTCHECK(ret, KErrNone); TESTCHECK(info.iNetworkType, DSTD_NETWORK_TYPE); TESTCHECKSTR(info.iName, DSTD_PHONE_NAME); TESTCHECK(info.iNumberOfLines, DSTD_NUMBER_OF_LINES); phoneIndex++; ret=server.GetPhoneInfo(phoneIndex,info); TESTCHECK(ret, KErrNone); TESTCHECK(info.iNetworkType, DSTDFC_NETWORK_TYPE); TESTCHECKSTR(info.iName, DSTDFC_PHONE_NAME); TESTCHECK(info.iNumberOfLines, DSTDFC_NUMBER_OF_LINES); phoneIndex++; ret=server.GetPhoneInfo(phoneIndex,info); TESTCHECK(ret, KErrNone); TESTCHECK(info.iNetworkType, DSTDPM_NETWORK_TYPE); TESTCHECKSTR(info.iName, DSTDPM_PHONE_NAME); TESTCHECK(info.iNumberOfLines, DSTDPM_NUMBER_OF_LINES); phoneIndex++; ret=server.GetPhoneInfo(phoneIndex,info); TESTCHECK(ret, KErrNone); TESTCHECK(info.iNetworkType, DSTDPM_NETWORK_TYPE); TESTCHECKSTR(info.iName, DSTD_SLOW_PHONE_NAME); TESTCHECK(info.iNumberOfLines, DSTDPM_NUMBER_OF_LINES); phoneIndex++; ret=server.GetPhoneInfo(phoneIndex,info); TESTCHECK(ret, KErrNotFound); phoneIndex++; ret=server.UnloadPhoneModule(DSTD_MODULE_NAME); TESTCHECK(ret, KErrNone); ret=server.UnloadPhoneModule(DSTDNC_MODULE_NAME); TESTCHECK(ret, KErrNone); ServerClose(server); return TestStepResult(); }
TInt CTestDriveOOMVoiceCall::DoTestL(TInt aAllocFailNumber) { _LIT(KPhoneModule,"MM"); _LIT(KPhoneName, "GsmPhone1"); _LIT(KLineName, "Voice"); RTelServer telServer; TInt ret=telServer.Connect(); if(ret!=KErrNone) return ret; telServer.__DbgFailNext(aAllocFailNumber); ret=telServer.LoadPhoneModule(KPhoneModule); if(ret!=KErrNone) { telServer.Close(); return ret; } RMobilePhone mobilePhone; ret=mobilePhone.Open(telServer, KPhoneName); if(ret!=KErrNone) { mobilePhone.Close(); telServer.Close(); return ret; } RLine line; INFO_PRINTF1(_L("Opening Voice Line")); ret=line.Open(mobilePhone,KLineName); if(ret!=KErrNone) { line.Close(); mobilePhone.Close(); telServer.Close(); return ret; } INFO_PRINTF1(_L("Opening New Voice Call")); RCall call; ret=call.OpenNewCall(line); if(ret!=KErrNone) { call.Close(); line.Close(); mobilePhone.Close(); telServer.Close(); return ret; } INFO_PRINTF1(_L("Initialise the Phone...")); TRequestStatus reqStatus; RMobilePhone::TMMTableSettings tableSettings; tableSettings.iLocId=KInternetAccessPoint; RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings); mobilePhone.InitialiseMM(reqStatus, tableSettingsPckg); User::WaitForRequest(reqStatus); TESTL(reqStatus == KErrNone); if(reqStatus!=KErrNone) { call.Close(); line.Close(); mobilePhone.Close(); telServer.Close(); return ret; } INFO_PRINTF1(_L("Dial a number...")); _LIT(KDialString, "+1234"); ret=call.Dial(KDialString); if(ret!=KErrNone) { call.Close(); line.Close(); mobilePhone.Close(); telServer.Close(); return ret; } INFO_PRINTF1(_L("Hangup a call...")); ret=call.HangUp(); if(ret!=KErrNone) { call.Close(); line.Close(); mobilePhone.Close(); telServer.Close(); return ret; } INFO_PRINTF1(_L("Close the call, line & iPhone...")); call.Close(); line.Close(); mobilePhone.Close(); return KErrNone; }
// ----------------------------------------------------------------------------- // DMFotaView::addFotaView // Creates and adds the Fota Portrait and Landscape View // ----------------------------------------------------------------------------- // bool DMFotaView::addFotaView() { qDebug("DMFotaView::addFotaView >>"); connect( mMainWindow, SIGNAL( orientationChanged(Qt::Orientation) ), this, SLOT( readSection(Qt::Orientation) ) ); bool ok = false; QString val,val2; loader.load(":/xml/devman.docml", &ok); ok = false; loader2.load(":/xml/devman.docml", &ok); // Exit if the file format is invalid Q_ASSERT_X(ok, "Device Manager", "Invalid docml file"); ok=false; loader.load(":/xml/devman.docml","Portrait", &ok); ok=false; loader2.load(":/xml/devman.docml","Landscape", &ok); // Load the view by name from the xml file fotaPortraitView = qobject_cast<HbView*>(loader.findWidget("p:view")); fotaLandscapeView = qobject_cast<HbView*>(loader2.findWidget("l:view")); HbAction *help = qobject_cast<HbAction*> (loader.findObject("help")); help->setText(QString("txt_common_menu_help")); QObject::connect(help, SIGNAL(triggered()), this, SLOT(OnHelp())); HbAction *exit = qobject_cast<HbAction*> (loader.findObject("exit")); exit->setText(QString("txt_common_menu_exit")); QObject::connect(exit, SIGNAL(triggered()), this, SLOT(OnExit())); help = qobject_cast<HbAction*>(loader2.findObject("help")); help->setText(QString("txt_common_menu_help")); QObject::connect(help, SIGNAL(triggered()), this, SLOT(OnHelp())); exit = qobject_cast<HbAction*>( loader2.findObject("exit")); exit->setText(QString("txt_common_menu_exit")); QObject::connect(exit, SIGNAL(triggered()), this, SLOT(OnExit())); mSoftKeyBackAction = new HbAction(Hb::BackNaviAction ,this); mSoftKeyBackAction->setText("Back"); fotaPortraitView->setNavigationAction(mSoftKeyBackAction); fotaLandscapeView->setNavigationAction(mSoftKeyBackAction); connect(mSoftKeyBackAction, SIGNAL(triggered()), this, SLOT(backtoMainWindow())); i=0; QString str; //Setting title text label = qobject_cast<HbLabel*> (loader.findWidget("p:title")); label2 = qobject_cast<HbLabel*> (loader2.findWidget("l:title")); val = hbTrId("txt_device_update_subhead_device_updates"); label->setPlainText(val); label2->setPlainText(val); HbScrollArea* area = qobject_cast<HbScrollArea*> (loader.findWidget("scrollArea")); area->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAlwaysOn); list1 << "label" << "label_1" << "label_2" << "label_3" << "label_4" << "label_5" << "label_6"<<"label_7"<<"label_8"<<"label_9"<<"label_10"<<"label_11"; list2 << "label_13" << "label_14" << "label_15" << "label_16" << "label_17" << "label_18" << "label_19"<<"label_20"<<"label_21"<<"label_22"<<"label_23"<<"label_24"; //Product Release TBuf< KSysUtilVersionTextLength > prodrelease; prodrelease.Zero(); if(SysUtil::GetPRInformation(prodrelease)==KErrNone) { val = hbTrId("txt_device_update_dblist_product_release"); str = QString::fromUtf16(prodrelease.Ptr(), prodrelease.Length()); FormatList(val,str); } //Software version TBuf< KSysUtilVersionTextLength > swversion; TBuf< KSysUtilVersionTextLength > swversiondate; TBuf< KSysUtilVersionTextLength > typedesignator; TBuf< KSysUtilVersionTextLength > version; swversion.Zero(); version.Zero(); typedesignator.Zero(); swversiondate.Zero(); if( SysUtil::GetSWVersion(version)==KErrNone) { TInt len= version.Length(); TInt pos1 = version.Find(KSmlEOL); if( pos1 != KErrNotFound && len > pos1 ) { TBuf<KSysUtilVersionTextLength> version1; version1.Zero(); swversion.Append( version.Left(pos1)); version1.Append( version.Right( len-pos1-1 )); len= version1.Length(); pos1 = version1.Find(KSmlEOL); if( pos1 != KErrNotFound && len > pos1 ) { swversiondate.Append(version1.Left( pos1 )); version.Zero(); version.Append( version1.Right( len-pos1-1 )); len= version.Length(); pos1 = version.Find(KSmlEOL); if( pos1 != KErrNotFound && len > pos1 ) { typedesignator.Append(version.Left(pos1)); } } } val = hbTrId("txt_device_update_dblist_software_version"); str = QString::fromUtf16(swversion.Ptr(), swversion.Length()); FormatList(val,str); } //Model TBuf<100> phoneName; TInt error = SysVersionInfo::GetVersionInfo(SysVersionInfo::EModelVersion, phoneName); if (error==KErrNone) { //phoneName.Copy( telid.iModel ); //imei.Copy(telid.iSerialNumber); if( phoneName.Length()>0 ) { val = hbTrId("txt_device_update_dblist_model"); str = QString::fromUtf16(phoneName.Ptr(), phoneName.Length()); FormatList(val,str); } } RTelServer telServer; User::LeaveIfError( telServer.Connect() ); RTelServer::TPhoneInfo teleinfo; User::LeaveIfError( telServer.GetPhoneInfo( 0, teleinfo ) ); RMobilePhone phone; User::LeaveIfError( phone.Open( telServer, teleinfo.iName ) ); User::LeaveIfError(phone.Initialise()); TUint32 teleidentityCaps; phone.GetIdentityCaps( teleidentityCaps ); RMobilePhone::TMobilePhoneIdentityV1 telid; TRequestStatus status; phone.GetPhoneId( status, telid ); User::WaitForRequest( status ); TBuf <50> imei; if (status==KErrNone) { TBuf<100> phoneName; imei.Copy(telid.iSerialNumber); } phone.Close(); telServer.Close(); //type if(typedesignator.Length()>0) { val = hbTrId("txt_device_update_dblist_type"); str = QString::fromUtf16(typedesignator.Ptr(), typedesignator.Length()); FormatList(val,str); } //Product Code /* TInt runtimesupport(0); CRepository* cenrep = NULL; TRAPD( error, cenrep = CRepository::NewL( KCRUidNSmlDMSyncApp ) ); if(error) { runtimesupport=1; } if ( cenrep ) { cenrep->Get( KNsmlDmRuntimeVerSupport, runtimesupport ); delete cenrep; cenrep = NULL; } if(runtimesupport) { */ TBuf<KSysUtilVersionTextLength> productcode; productcode.Zero(); error = SysVersionInfo::GetVersionInfo(SysVersionInfo::EProductCode, productcode); if(error ==KErrNone ) { if( productcode.Length()>0 ) { val = hbTrId("txt_device_update_dblist_product_code"); str = QString::fromUtf16(productcode.Ptr(), productcode.Length()); FormatList(val,str); } } //IMEI if(imei.Length()>0) { val = hbTrId("txt_device_update_dblist_imei"); str = QString::fromUtf16(imei.Ptr(), imei.Length()); FormatList(val,str); } iFotaState = FotaEngineL().GetState(-1); TBuf8<80> Name; TBuf8<80> Version; TInt Size; if(iFotaState == RFotaEngineSession::EDownloadComplete || iFotaState == RFotaEngineSession::EStartingUpdate || iFotaState == RFotaEngineSession::EStartingDownload || iFotaState == RFotaEngineSession::EDownloadProgressing) { label = qobject_cast<HbLabel*> (loader.findWidget("p:updatelabel")); label2 = qobject_cast<HbLabel*> (loader2.findWidget("l:updatelabel")); FotaEngineL().GetCurrentFirmwareDetailsL(Name, Version, Size); const QString name = QString::fromUtf8( reinterpret_cast<const char*> (Name.Ptr()), Name.Length()); const QString ver = QString::fromUtf8( reinterpret_cast<const char*> (Version.Ptr()), Version.Length()); TInt sizeKB = Size / 1024; if(sizeKB < 1024) { val = hbTrId("txt_device_update_setlabel_the_last_update_1_2_kb").arg(name) .arg(ver).arg(sizeKB); } else { TInt sizeMB = sizeKB / 1024; val = hbTrId("txt_device_update_setlabel_the_last_update_1_2_mb").arg(name) .arg(ver).arg(sizeMB); } label->setPlainText(val); label2->setPlainText(val); val = hbTrId("txt_device_update_button_resume_update"); updateButton = qobject_cast<HbPushButton*>(loader.findWidget("p:update")); updateButton->setText(val); QObject::connect(updateButton, SIGNAL(clicked()), this, SLOT(ResumeUpdate())); updateButtonLandscape = qobject_cast<HbPushButton*>(loader2.findWidget("l:update")); updateButtonLandscape->setText(val); QObject::connect(updateButtonLandscape, SIGNAL(clicked()), this, SLOT(ResumeUpdate())); Connected = ETrue; } else { //Setting help text for update button label = qobject_cast<HbLabel*> (loader.findWidget("p:updatelabel")); label2 = qobject_cast<HbLabel*> (loader2.findWidget("l:updatelabel")); val = hbTrId("txt_device_update_setlabel_to_update_your_device_s"); label->setPlainText(val); label2->setPlainText(val); val = hbTrId("txt_device_update_button_update"); updateButton = qobject_cast<HbPushButton*>(loader.findWidget("p:update")); updateButton->setText(val); QObject::connect(updateButton, SIGNAL(clicked()), this, SLOT(CheckforUpdate())); updateButtonLandscape = qobject_cast<HbPushButton*>(loader2.findWidget("l:update")); updateButtonLandscape->setText(val); QObject::connect(updateButtonLandscape, SIGNAL(clicked()), this, SLOT(CheckforUpdate())); Connected = ETrue; } val = hbTrId("txt_device_update_button_advanced"); advancedButton = qobject_cast<HbPushButton*>(loader.findWidget("p:advanced")); advancedButton->setText(val); QObject::connect(advancedButton, SIGNAL(clicked()), this, SLOT(AdvancedDeviceManager())); advancedButtonLandscape = qobject_cast<HbPushButton*>(loader2.findWidget("l:advanced")); advancedButtonLandscape->setText(val); QObject::connect(advancedButtonLandscape, SIGNAL(clicked()), this, SLOT(AdvancedDeviceManager())); fotaSupportEnabled(); mMainWindow->addView(fotaPortraitView); mMainWindow->addView(fotaLandscapeView); if(mMainWindow->orientation()==Qt::Vertical) mMainWindow->setCurrentView(fotaPortraitView); else mMainWindow->setCurrentView(fotaLandscapeView); iMoniter = CDeviceUpdateMoniter::NewL(this); //iMoniter->StartMoniter(); emit applicationReady(); qDebug("DMFotaView::addFotaView <<"); return ETrue; }