void GetPhoneInfoL(RTelServer& aTelServer, const TDesC& aLoadedTsyName, RTelServer::TPhoneInfo& aInfo) { TInt count; User::LeaveIfError(aTelServer.EnumeratePhones(count)); if (count<=0) { User::Leave(KErrNotFound); } TBool found = EFalse; for (TInt i=0; i < count; i++) { TBuf<KCommsDbSvrMaxFieldLength> currentTsyName; User::LeaveIfError(aTelServer.GetTsyName(i,currentTsyName)); TInt r=currentTsyName.Locate('.'); if (r!=KErrNotFound) { currentTsyName.SetLength(r); } if (currentTsyName.CompareF(aLoadedTsyName)==KErrNone) { User::LeaveIfError(aTelServer.GetPhoneInfo(i,aInfo)); found = ETrue; break; } } if (!found) { User::Leave(KErrNotFound); } }
//== Mobile Line functions void CT_RMobilePhoneData::DoCmdOpen(const TDesC& aSection) { INFO_PRINTF1(_L("*START*CT_RMobilePhoneData::DoCmdOpen")); // Check that first phone is available and log phone name. RTelServer::TPhoneInfo info; // Reading phone info for the first available phone TInt error(0); TBool dataOk = ETrue; TInt parPhone = 0; if ( !GetIntFromConfig(aSection, KPhone(), parPhone) ) { ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KPhone); SetBlockResult(EFail); dataOk = EFalse; } TPtrC telServerName; if ( !GetStringFromConfig(aSection, KTelServerKey(), telServerName) ) { ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KTelServerKey); SetBlockResult(EFail); dataOk = EFalse; } if ( dataOk ) { RTelServer* telServerObject = static_cast<RTelServer*>(GetDataObjectL(telServerName)); INFO_PRINTF1(_L("Check if phone info was found.")); error = telServerObject->GetPhoneInfo(parPhone, info); if (error != KErrNone) { ERR_PRINTF2(_L("Failed to read phone info for phone KFirstPhone with error %d"), error); SetError(error); } else { // Connect to RMobilePhone interface. INFO_PRINTF1(_L("Opening connection to phone")); error = iMobilePhone->Open(*telServerObject, info.iName); if (error != KErrNone) { ERR_PRINTF2(_L("Connection to phone failed with error %d"), error); SetError(error); } else { INFO_PRINTF1(_L("Opening connection to phone sucessfull")); } } } INFO_PRINTF1(_L("*END*CT_RMobilePhoneData::DoCmdOpen")); }
void CSmsStackTestServer::LoadTsyL(RTelServer& aServer, RPhone& aPhone, const TDesC& aTsyName) { INFO_PRINTF2(_L("Using TSY \"%S\"Loading RTelServer..."), &aTsyName); TInt ret = aServer.LoadPhoneModule(aTsyName); if (ret!=KErrNone) { ERR_PRINTF2(_L("Loading Phone Module returned %d"), ret); User::Leave(ret); } // Find the phone corresponding to this TSY and open a number of handles on it TInt numPhones; ret = aServer.EnumeratePhones(numPhones); if (ret!=KErrNone) { ERR_PRINTF2(_L("Enumerate Phones returned %d"), ret); User::Leave(ret); } TBool found=EFalse; while (numPhones--) { TName phoneTsy; ret = aServer.GetTsyName(numPhones,phoneTsy); if (ret!=KErrNone) { ERR_PRINTF2(_L("GetTsyName returned %d"), ret); User::Leave(ret); } if (phoneTsy.CompareF(aTsyName)==KErrNone) { INFO_PRINTF1(_L("Found RPhone...")); found = ETrue; RTelServer::TPhoneInfo info; ret = aServer.GetPhoneInfo(numPhones,info); if (ret!=KErrNone) { ERR_PRINTF2(_L("GetPhoneInfo returned %d"), ret); User::Leave(ret); } ret = aPhone.Open(aServer,info.iName); if (ret!=KErrNone) { ERR_PRINTF2(_L("Opening phone returned %d"), ret); User::Leave(ret); } INFO_PRINTF1(_L("Initializing...")); ret = aPhone.Initialise(); TTimeIntervalMicroSeconds32 InitPause=9000000; //Required Pause to Allow SMSStack to Complete its Async Init User::After(InitPause); //call to the TSY and finish its StartUp. if (ret!=KErrNone) { ERR_PRINTF2(_L("Completed Initialize returned %d"), ret); User::Leave(ret); } break; } } if(!found) { ERR_PRINTF2(_L("Couldn't find the phone for TSY %S"), &aTsyName); } }
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(); }
static inline TInt GetPhoneInfo(RTelServer& aTelServer, TInt aIndex, RTelServer::TPhoneInfo& aPhoneInfo) { return aTelServer.GetPhoneInfo(aIndex, aPhoneInfo); }
// ----------------------------------------------------------------------------- // 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; }