Symbian OS s60 3rd编程中实现IMSI、IMEI查询
2010-06-19 04:22:00 来源:WEB开发网核心提示:telephony->GetPhoneId(); aIMEI = telephony->iPhoneId.iSerialNumber;delete telephony;#else //模拟器 Return a fake IMEI when working onemulator _LIT(KEmulatorI
telephony->GetPhoneId(); aIMEI = telephony->iPhoneId.iSerialNumber;delete
telephony;#else //模拟器 Return a fake IMEI when working onemulator
_LIT(KEmulatorImei, "000000000000000"); aIMEI=KEmulatorImei;#endif }void
CMyTelephony::GetPhoneType(TDes& aPhoneType) {#ifndef __WINS__ CMyTelephony*
telephony = CMyTelephony::NewL(); telephony->GetPhoneId();
aPhoneType.Copy(telephony->iPhoneId.iManufacturer);
aPhoneType.Append(telephony->iPhoneId.iModel); delete telephony;#else //模拟器
Return a fake IMEI when working onemulator _LIT(KPhoneType, "Nokia5500d");
aPhoneType=KPhoneType;#endif }void CMyTelephony::DialPhone(const TDesC&
aPhoneId) {#ifndef __WINS__ //真实设备 This only works on target machine
CMyTelephony* telephony = CMyTelephony::NewLC();
telephony->DialNewCall(aPhoneId);#else //模拟器 Return a fake IMEI when working
onemulator#endif }void CMyTelephony::DoCancel() {
iTelephony->CancelAsync(iRequest);
iTelephony->CancelAsync(CTelephony::EDialNewCallCancel); }void
CMyTelephony::RunL() { CActiveScheduler::Stop(); }CMyTelephony::~CMyTelephony()
{ delete iTelephony; }CMyTelephony::CMyTelephony() :
CActive(CActive::EPriorityStandard), iSubscriberIdPckg(iSubscriberId),
iPhoneIdPckg(iPhoneId) { CActiveScheduler::Add(this); }void
CMyTelephony::ConstructL() { iTelephony = CTelephony::NewL(); }void
CMyTelephony::GetSubscriberId() { Cancel(); iRequest =
CTelephony::EGetSubscriberIdCancel; iTelephony->GetSubscriberId(iStatus,
iSubscriberIdPckg); SetActive(); CActiveScheduler::Start(); }void
CMyTelephony::GetPhoneId() { Cancel(); iRequest = CTelephony::EGetPhoneIdCancel;
iTelephony->GetPhoneId(iStatus, iPhoneIdPckg); SetActive();
CActiveScheduler::Start(); }/*
*此方法可以获得详细的手机型号,但是由于在此处使用时与活动对象易发生冲突,所以就没有采用等待后期修改void CMyTelephony::GetType() {
_LIT(KPath,"z:\resource\versions\model.txt"); Cancel();RFs fs; RFile
typeFile; User::LeaveIfError(fs.Connect()); TFileText myFile;
更多精彩
赞助商链接