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(); }
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; }
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; }
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(); }
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; }
/* ---------------------------------------------------------------------------------------- // 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 }
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; }