// ---------------------------------------------------------------------------- // Construct USB serial number. Some of the personalities may need this. // ---------------------------------------------------------------------------- // void CUsbActivePersonalityHandler::ConstructUsbSerialNumberL() { LOG_FUNC RTelServer telServer; RMobilePhone phone; LEAVEIFERROR( telServer.Connect() ); CleanupClosePushL( telServer ); LEAVEIFERROR( telServer.LoadPhoneModule( KMmTsyModuleName ) ); LEAVEIFERROR( phone.Open( telServer, KMmTsyPhoneName ) ); CleanupClosePushL( phone ); // to store the serial number to be published as the USB device's serial // number, fetch it from telephony server. TRequestStatus status; phone.GetPhoneId( status, iPhoneInfo ); User::WaitForRequest( status ); // make sure that the serial number fulfills USB requirements and then // convert the serial number so that it can be printed to log TLex lex( iPhoneInfo.iSerialNumber ); TInt length = iPhoneInfo.iSerialNumber.Length(); if( length < KSerialNumberLength ) { // In GSM, the complete IMEI can be used as USB serial // number. But in CDMA, the ESN is too short for a valid Mass // Storage serial number (Mass-Storage and Bulk Only Transport // specs both require minimum 12 byte number), so it is // extended with trailing zeroes. When doing this, make sure // not to write anything over descriptor's max length if( iPhoneInfo.iSerialNumber.MaxLength() < KSerialNumberLength ) { iPhoneInfo.iSerialNumber.SetLength( KSerialNumberLength ); } while( length < KSerialNumberLength ) { iPhoneInfo.iSerialNumber.Append( '0' ); ++length; } } CleanupStack::PopAndDestroy( 2, &telServer ); }
static inline void GetPhoneId(RMobilePhone& aPhone, TRequestStatus& aReqStatus, RMobilePhone::TMobilePhoneIdentityV1& aMobilePhoneId) { aPhone.GetPhoneId(aReqStatus, aMobilePhoneId); }
// ----------------------------------------------------------------------------- // 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; }
// ----------------------------------------------------------------------------- // 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; }