手机型号能从如下文件中读取出来:
z: esourceversionsmodel.txt
型号名称是如下格式:
"Nokia 3250"
相关代码:
_LIT(KFilename,"Z:\resource\versions\model.txt"); \ \ \ RFile file; User::LeaveIfError(file.Open(CCoeEnv::Static()->FsSession(),KFilename,EFileRead)); CleanupClosePushL(file);
TFileText text;
text.Set(file);
TBuf16<128> szModelName;
User::LeaveIfError(text.Read(szModelName));
CleanupStack::PopAndDestroy(&file);
CAknInformationNote* note = new (ELeave) CAknInformationNote(ETrue);
note->ExecuteLD(szModelName);
所有的Series60设备都拥有一个由制造商分配的唯一标识符-机器UID,因此可以通过这一UID信息来获取手机型号。
常见的S60机型及其机器UID:
S60 1st Edition (0.9):
Nokia 7650 0x101F4FC3
S60 1st Edition, FP1 (1.2):
Nokia 3650 0x101F466A
Nokia 3660 0x101F466A
Sendo-X 0x101FA031
Siemens SX-1 0x101F9071
S60 2nd Edition:
Nokia 6600 0x101FB3DD
S60 2nd Edition, FP1:
Nokia 3230 0x10200F97
Nokia 6260 0x101FB3F4
Nokia 6620 0x101F3EE3
Nokia 6670 0x101FB3F3
Nokia 7610 0x101FB3F3
S60 2nd Edition, FP2:
Nokia 6630 0x101FBB55
Nokia 6680 0x10200F99
Nokia 6681 0x10200F9C
Nokia 6682 0x10200F9B
S60 2nd Edition, FP3:
Nokia N70 0x10200F9A
Nokia N90 0x10200F98
other
Nokia N-Gage™ 0x101F8C19
Nokia N-Gage™ QD 0x101FB2B1
因此可通过以下代码获取手机型号:
void GetPhoneModeL()
{
TInt machineUid = 0;
HAL::Get(HALData::EMachineUid, machineUid);
switch (machineUid)
{
case 0x101F9071:
{
//Siemens SX1
break;
}
case 0x101F466A:
{
//Nokia 3650
break;
}
case 0x101F4FC3:
{
//Nokia 7650
break;
}
case 0x101FB3DD:
{
//Nokia 6600
break;
}
// ......
}
}
手机型号能从如下文件中读取出来:
z: esourceversionsmodel.txt
型号名称是如下格式:
"Nokia 3250"
相关代码:
_LIT(KFilename,"Z:\resource\versions\model.txt"); \ \ \ RFile file; User::LeaveIfError(file.Open(CCoeEnv::Static()->FsSession(),KFilename,EFileRead));
CleanupClosePushL(file);
TFileText text;
text.Set(file);
TBuf16<128> szModelName;
User::LeaveIfError(text.Read(szModelName));
CleanupStack::PopAndDestroy(&file);
_LIT(KFilename,"Z:\resource\versions\model.txt"); \\ RFile file; User::LeaveIfError(file.Open(CCoeEnv::Static()->FsSession(),KFilename,EFileRead));
CleanupClosePushL(file);
TFileText text;
text.Set(file);
TBuf16<128> szModelName;
User::LeaveIfError(text.Read(szModelName));
CleanupStack::PopAndDestroy(&file);
_LIT(KFilename,"Z:\resource\versions\model.txt"); \\ RFile file;
User::LeaveIfError(file.Open(CCoeEnv::Static()->FsSession(),KFilename,EFileRead));
CleanupClosePushL(file);
TFileText text;
text.Set(file);
TBuf16<128> szModelName;
User::LeaveIfError(text.Read(szModelName));
CleanupStack::PopAndDestroy(&file);