⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sysinfo60container.cpp

📁 基于SYMBIAN OS 的Moblile硬件管理器. 支持series 70平台
💻 CPP
📖 第 1 页 / 共 2 页
字号:
				ClrScreen();
				TBuf<256> adata(items->operator[](selectedItem));
				adata.Append(_L("\f"));
				if (aMode == KAppUid)
				{
					TApaAppCapabilityBuf appCapBuf;
					if (apa.GetAppCapability(appCapBuf, appInfo.iUid) == KErrNone)
					{
						adata.Append(appInfo.iUid.Name());

						if (appCapBuf().iAppIsHidden)
							adata.Append(_L("\fHidden"));
						else
							adata.Append(_L("\fNot hidden"));
						
						if (appCapBuf().iSupportsNewFile)
							adata.Append(_L("\fSupports new file"));
						else
							adata.Append(_L("\fNo support for new file"));

						if (appCapBuf().iLaunchInBackground)
							adata.Append(_L("\fBg launch allowed"));
						else
							adata.Append(_L("\fNo bg launch allowed"));

						switch (appCapBuf().iEmbeddability)
						{
						case appCapBuf().ENotEmbeddable:
							adata.Append(_L("\fNot embeddable"));
							break;
						case appCapBuf().EEmbeddable:
							adata.Append(_L("\fEmbeddable"));
							break;
						case appCapBuf().EEmbeddableOnly:
							adata.Append(_L("\fEmbeddable only"));
							break;
						default:
							break;
						}
					}
					else
						adata.Append(appInfo.iUid.Name());
				}
				else
				{
					adata.Append(appInfo.iFullName);
				}
				TEntry entry;
				if (!iRfs.Entry(appInfo.iFullName, entry))
				{
					adata.Append(_L("\f"));
					adata.AppendNum(entry.iSize / 1024);
					adata.Append(_L("K "));
					TBuf<30> dtStr;
					entry.iModified.FormatL(dtStr, KDateString);
					adata.Append(dtStr);
					if (aMode != KAppUid)
					{
						adata.Append(_L("\fAttributes "));
						adata.AppendNumUC(entry.iAtt, EBinary);
					}
				}
			    iGText.Copy(adata);
				iSysText->SetTextL(&iGText);
				SizeChanged();
			}
			else
			{
				NShowErrorMsgL(_L("Error "), iError);
			}
		}
	}
	iRfs.Close();
	apa.Close();
	items->Reset();
	appUids->Reset();
	CleanupStack::PopAndDestroy(2);
}

void CSYSINFO60Container::DisplayInfo(void)
{
	ClrScreen();
	RWsSession rws = RWsSession();
	if (rws.Connect() == KErrNone)
	{
		TPoint sv = rws.ShadowVector();
		rws.Close();
		iGText.Format(_L("Shadow vector X=%d, Y=%d"), sv.iX, sv.iY);
	}
    TPckgBuf<TScreenInfoV01> info;
    UserSvr::ScreenInfo(info);
	iGText.Append(_L("\fScreen address $"));
	iGText.AppendNum(reinterpret_cast<TUint> (info().iScreenAddress), EHex);
	iGText.Append(_L("\fScreen modes "));
	iGText.AppendNum(iCoeEnv->ScreenDevice()->NumScreenModes());
	iGText.Append(_L("\fTypefaces "));
	iGText.AppendNum(iCoeEnv->ScreenDevice()->NumTypefaces());
	TSize twips = iCoeEnv->ScreenDevice()->SizeInTwips();
	iGText.Append(_L("\fWidth (twips) "));
	iGText.AppendNum(twips.iWidth);
	iGText.Append(_L("\fHeight (twips) "));
	iGText.AppendNum(twips.iHeight);
	iGText.Append(_L("\fPalette "));
	TBool modifiable = EFalse;
	TInt  numOfEntries = 0;
	iCoeEnv->ScreenDevice()->PaletteAttributes(modifiable, numOfEntries);
	if (modifiable)
		iGText.Append(_L("modifiable ("));
	else
		iGText.Append(_L("fixed ("));
	iGText.AppendNum(numOfEntries);
	iGText.Append(_L(")"));
	iSysText->SetTextL(&iGText);
	SizeChanged();
}

void CSYSINFO60Container::ROMinfo(void)
{
	ClrScreen();
	iGText.Copy(_L("ROM root directory address\f$"));
	iGText.AppendNum(UserSvr::RomRootDirectoryAddress(), EHex);
	iGText.Append(_L("\fROM header address\f$"));
	iGText.AppendNum(UserSvr::RomHeaderAddress(), EHex);
	iGText.Append(_L("\fKernel debug mask\f$"));
	iGText.AppendNum(UserSvr::DebugMask(), EHex);
	iSysText->SetTextL(&iGText);
	SizeChanged();
}

void CSYSINFO60Container::CPUinfo(void)
{
	ClrScreen();
	iHalValue = -1;
	iError = HAL::Get(HALData::ECPU, iHalValue);
	iGText.Copy(_L("CPU "));
	switch (iHalValue)
	{
	case 0:
		iGText.Append(_L("ARM"));
		break;
	case 1:
		iGText.Append(_L("MCORE"));
		break;
	case 2:
		iGText.Append(_L("X86"));
		break;
	default:
		iGText.AppendNum(iHalValue);
		break;
	};
	iHalValue = -1;
	iError = HAL::Get(HALData::ECPUABI, iHalValue);
	iGText.Append(_L("   ABI "));
	switch (iHalValue)
	{
	case 0:
		iGText.Append(_L("ARM4"));
		break;
	case 1:
		iGText.Append(_L("ARMI"));
		break;
	case 2:
		iGText.Append(_L("THUMB"));
		break;
	case 3:
		iGText.Append(_L("MCORE"));
		break;
	case 4:
		iGText.Append(_L("MSVC"));
		break;
	default:
		iGText.AppendNum(iHalValue);
		break;
	};

	iHalValue = -1;
	iError = HAL::Get(HALData::ECPUSpeed, iHalValue);
	iGText.Append(_L("\fCPU SPEED "));
	iGText.AppendNum(iHalValue / 1000);
	iGText.Append(_L(" MHz"));

	iHalValue = -1;
	iError = HAL::Get(HALData::ECPUArch, iHalValue);
	iGText.Append(_L("\fCPU ARCHITECTURE "));
	iGText.AppendNum(iHalValue);

	iHalValue = -1;
	iError = HAL::Get(HALData::ESystemTickPeriod, iHalValue);
	iGText.Append(_L("\fSystem tick period "));
	iGText.AppendNum(iHalValue);
	iGText.Append(_L("uS"));

	iHalValue = -1;
	iError = HAL::Get(HALData::EMemoryPageSize, iHalValue);
	iGText.Append(_L("\fMemory page size "));
	iGText.AppendNum(iHalValue / 1024);
	iGText.Append(_L("K"));

#ifndef __WINS__
	iHalValue = -1;
	iError = HAL::Get(HALData::ESystemStartupReason, iHalValue);
	iGText.Append(_L("\fStartup reason "));
	switch (iHalValue)
	{
	case 0:
		iGText.Append(_L("COLD"));
		break;
	case 1:
		iGText.Append(_L("WARM"));
		break;
	case 2:
		iGText.Append(_L("FAULT"));
		break;
	default:
		iGText.AppendNum(iHalValue);
		break;
	};
#endif

	iSysText->SetTextL(&iGText);
	SizeChanged();
}

void CSYSINFO60Container::MachineInfo(void)
{	
	ClrScreen();
	iHalValue = -1;
	iError = HAL::Get(HALData::EMachineUid, iHalValue);
	iGText.Copy(_L("Machine UID "));
	iGText.AppendNum(iHalValue, EHex);

	iHalValue = -1;
	iError = HAL::Get(HALData::EManufacturer, iHalValue);
	iGText.Append(_L("\fManufacturer "));
	iGText.AppendNum(iHalValue);

	iHalValue = -1;
	iError = HAL::Get(HALData::EManufacturerHardwareRev, iHalValue);
	iGText.Append(_L("\fHW rev "));
	iGText.AppendNum(iHalValue);

	iHalValue = -1;
	iError = HAL::Get(HALData::EManufacturerSoftwareRev, iHalValue);
	iGText.Append(_L("\fSW rev "));
	iGText.AppendNum(iHalValue);

	iHalValue = -1;
	iError = HAL::Get(HALData::EManufacturerSoftwareBuild, iHalValue);
	iGText.Append(_L("\fSW build "));
	iGText.AppendNum(iHalValue);

	iHalValue = -1;
	iError = HAL::Get(HALData::EDeviceFamilyRev, iHalValue);
	iGText.Append(_L("\fDevice family rev "));
	iGText.AppendNum(iHalValue);

	iHalValue = -1;
	iError = HAL::Get(HALData::EModel, iHalValue);
	iGText.Append(_L("\fModel "));
	iGText.AppendNum(iHalValue);

	iSysText->SetTextL(&iGText);
	SizeChanged();
}

void CSYSINFO60Container::ClrScreen(void)
{
	iGText.Copy(_L(""));
	iSysText->SetTextL(&iGText);
	iSysText->SetSize(TSize(KGTextWidth, KGTextHeight));
	//SizeChanged();
}

// ---------------------------------------------------------
// CSYSINFO60Container::SetImageDefs()
// ---------------------------------------------------------
//
void CSYSINFO60Container::SetImageDefs(const TInt aIndex)
{
	if (iBitmaps)
		iRfu60imgSize = iBitmaps->At(aIndex)->SizeInPixels();
	else
	{
		iRfu60imgSize.iWidth  = KImageWidth;
		iRfu60imgSize.iHeight = KImageHeight;
	}
}

// ---------------------------------------------------------
// CSYSINFO60Container::LoadImagesL()
// ---------------------------------------------------------
//
void CSYSINFO60Container::LoadImageL(const TDesC& aImageFile)
    {
    for (TInt i=0; i < KNumOfBitmaps; i++)
        {
        CFbsBitmap* bitmap = new (ELeave) CFbsBitmap;
        CleanupStack::PushL(bitmap);
        iError = bitmap->Load(aImageFile, i);
		User::LeaveIfError(iError);
        iBitmaps->AppendL(bitmap);
        CleanupStack::Pop(bitmap);
        }
    }

void CSYSINFO60Container::GetFileListLC(const TDesC& aPath)
{
	User::LeaveIfError(iRfs.Connect());
	CDir *dirList;
	iError = iRfs.GetDir(aPath, KEntryAttMaskSupported, ESortByName, dirList);
	if (iError != KErrNone)
	{
		delete dirList;
		iRfs.Close();
		User::Leave(iError);
	}
	CDesCArrayFlat* items = new(ELeave) CDesCArrayFlat(dirList->Count());
	CleanupStack::PushL(items);

	TEntry dirEntry;
	for (TInt i=0; i<dirList->Count(); i++)
	{
		iKdata.Copy(_L(""));
		iKdata.AppendNum(i + 1);
		iKdata.Append(_L("\t"));
		dirEntry = dirList->operator[](i);
		iKdata.Append(dirEntry.iName);
		iItemData.Copy(iKdata);
		items->AppendL(iItemData);
	}

	TInt selectedItem(0);
	CAknSelectionListDialog* apaList = CAknSelectionListDialog::NewL(selectedItem, items, R_MENUBAR);
	if (apaList->ExecuteLD(R_APA_LIST))
	{
		ClrScreen();
		dirEntry = dirList->operator[](selectedItem);
		iGText.Num(selectedItem + 1);
		iGText.Append(_L(" "));
		iGText.Append(dirEntry.iName);
		iGText.Append(_L("\f"));
		TBuf<30> dtStr;
		dirEntry.iModified.FormatL(dtStr, KDateString);
		iGText.Append(dtStr);
		iGText.Append(_L("\fHidden: "));
		if (dirEntry.IsHidden())
			iGText.Append(KYes); else iGText.Append(KNo);
		iGText.Append(_L("\fSystem attribute: "));
		if (dirEntry.IsSystem())
			iGText.Append(KYes); else iGText.Append(KNo);
		iGText.Append(_L("\fAttributes: "));
		iGText.AppendNum(dirEntry.iAtt, EBinary);
		iGText.Append(_L("\fArchive: "));
		if (dirEntry.IsArchive())
			iGText.Append(KYes); else iGText.Append(KNo);
		iGText.Append(_L("\fRead-only: "));
		if (dirEntry.IsReadOnly())
			iGText.Append(KYes); else iGText.Append(KNo);
		iSysText->SetTextL(&iGText);
		SizeChanged();
	}

	items->Reset();
	CleanupStack::PopAndDestroy(1);
	delete dirList;
	iRfs.Close();
}

void CSYSINFO60Container::MiscInfo(void)
{
	ClrScreen();

	iHalValue = -1;
	iError = HAL::Get(HALData::EDisplayContrast, iHalValue);
	iGText.Format(_L("LCD contrast %d"), iHalValue);
	//iGText.AppendNum(iHalValue);

	iHalValue = -1;
	iError = HAL::Get(HALData::EDisplayContrastMax, iHalValue);
	iGText.Append(_L("\fLCD max contrast "));
	iGText.AppendNum(iHalValue);

	iGText.Append(_L("\fLCD min contrast "));
	iGText.AppendNum(iHalValue * -1);

	iHalValue = -1;
	iError = HAL::Get(HALData::ELanguageIndex, iHalValue);
	iGText.Append(_L("\fLanguage index "));
	iGText.AppendNum(iHalValue);

	iHalValue = -1;
	iError = HAL::Get(HALData::EPowerBatteryStatus, iHalValue);
	iGText.Append(_L("\fBattery status "));
	iGText.AppendNum(iHalValue);

	iHalValue = -1;
	iError = HAL::Get(HALData::EMaxRAMDriveSize, iHalValue);
	iGText.Append(_L("\fMax RAM drive size "));
	iGText.AppendNum(iHalValue);

	iHalValue = -1;
	iError = HAL::Get(HALData::ESystemException, iHalValue);
	iGText.Append(_L("\fSys exception "));
	iGText.AppendNum(iHalValue, EHex);

	iSysText->SetTextL(&iGText);
	SizeChanged();
}

void CSYSINFO60Container::UserStringLC(void)
{
	ClrScreen();
#ifndef __WINS__
	HBufC8* userAgent = HBufC8::NewLC(160);
	userAgent = SysUtil::UserAgentStringL();
	iGText.Copy(*userAgent);
	iSysText->SetTextL(&iGText);
	SizeChanged();
	CleanupStack::PopAndDestroy(1);
#endif
}

void CSYSINFO60Container::RegInfo(void)
{
	ClrScreen();
	SRegisterInfo regInfo;
	RDebug::RegisterInfo(regInfo);
	iGText.Format(_L("Number of PC register %d\fNumber of status reg %d\fNumber of registers %d\fThread start register %d"), regInfo.iNumberOfPcRegister, regInfo.iNumberOfStatusRegister, regInfo.iNumberOfRegisters, regInfo.iThreadStartRegister);
	iSysText->SetTextL(&iGText);
	SizeChanged();
}

// End of File

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -