How to retrieve the phone IMEI code on UIQ3.0
来源:互联网 发布:crossover mac激活码 编辑:程序博客网 时间:2024/05/06 01:10
Here I’ll present an approach to retrieve IMEI code by calling functions of class RMobilePhone. I have debugged these source codes on W950 (Symbian 9.1, UIQ3.0).
You can get some description of the format of IMEI code in [1]. In this paper, the PlpVariant::GetMachineIdL function is called to retrieve the phone IMEI code, but this function has been deprecated on UIQ3.0. So if you call it, you maybe will retrieve a incorrect IMEI code. I have debugged it on W950, the return is ‘14750005-630771776’. My phone IMEI code is actually ‘00440107-000879-8’.
And the link [2] provides another approach, but it’s so hard to get the mentioned .h files and librarys. I can not find them, so I did not debug it.
On UIQ 3.0, class RMobilePhone provides client access to mobile phone functionality provided by TSY. You can get the detailed description of class RMobilePhone in the help document of UIQ SDK.
My steps are as following:
1. Connect to the ETel server
2. Get the name of registered phones
3. Open mobile phone sub session
4. Check if the phone provided the capabilities to retrieve IMEI code or not
5. Retrieve the phone IMEI code
The defined parameters:
RTelServer iTelServer; // Root telephony server session
RMobilePhone iMmPhone;
TBuf< KCommsDbSvrMaxFieldLength> iPhoneName
RMobilePhone::TMobilePhoneIdentityV1 iPhoneId;
1. Connect to the ETel server
User::LeaveIfError(iTelServer.Connect());
2. Get the name of registered phones
// Get the number of registered phones
TInt numberOfPhones;
User::LeaveIfError(aTelServer.EnumeratePhones(numberOfPhones));
LOG("%i",numberOfPhones);
for( TInt i = 0; i <numberOfPhones ; i++ )
{
RTelServer::TPhoneInfo info;
iTelServer.GetPhoneInfo(i,info);
LOG("NetworkTyp:[%i],Name:[%S],NumberofLines:[%i],Extensions:[%i]", (TInt)info.iNetworkType,&info.iName,info.iNumberOfLines,info.iExtensions);
iPhoneName.Copy(info.iName);
}
In your smart phone, there can be several registered phones i.e. the returned value of ‘number ofPhones’ can be more than 1. hence you need to choice one directly or adopt other policy.But fortunately most of the smart phones have just one
3. Open mobile phone sub session
// open mobile phone sub session
User::LeaveIfError(iMmPhone.Open(iTelServer, iPhoneName));
4. Check if the phone provided the capabilities to retrieve IMEI code or not
And call the RMobilePhone::GetPhoneId function to retrieve IMEI.
TUint32 lCaps = 0;
TInt err = iMmPhone.GetIdentityCaps(lCaps);
if(err != KErrNone && err != KErrNotSupported)
{
LOG(_L("an unexpected error occoured"));
}
else if(err == KErrNotSupported)
{
LOG(_L("RMobilePhone::GetIdentityCaps() returned KErrNotSupported "));
}
else if (lCaps & RMobilePhone::KCapsGetSerialNumber)
{
iMmPhone.GetPhoneId(iStatus, iPhoneId); // asynchronous call
iActiveStatus = ST_GET_PHONE_ID;
SetActive();
return;
}
// very important, Otherwise application will panic when called twice
iMmPhone.Close();
iTelServer.Close();
The function,RMobilePhone:: GetPhoneId, is the key function. In fact, here I introduce how to use it.
5. After returning, the value of the parameter, iPhoneId.iSerialNumber, is the phone IMEI code
6. Don't forget to close the opened handles as like:
iMmPhone.Close();
iTelServer.Close();
Reference:
1. “Retrieving the device IMEI code”
http://www.newlc.com/Retrieving-the-device-IMEI-code.html
2. “FAQ & Tech Tips”
http://www2.symbian.com/faq.nsf/7b5405edb1250e7c802569ee005d054e/ba491eaeb25c5c7d80256bf3003e75fc?OpenDocument
- How to retrieve the phone IMEI code on UIQ3.0
- How to retrieve the phone IMEI code on UIQ3.0
- How to retrieve the Device Unique ID from android device
- How JavaScript works: inside the V8 engine + 5 tips on how to write optimized code
- How to analyse the code
- Nokia forum:How do I retrieve the phone number from my midlet?
- How to: Retrieve List Items
- How to build the andriod4.0 on unbuntu12.04
- How to Ditch Phone Mode & Get the Full Tablet UI on Your Nexus 7—Without Rooting
- how to modify host file on android phone
- How to Dual Boot Multiple ROMs on Your Android Phone
- How to retrieve and change partition's UUID Universally Unique Identifier on linux
- dephi tcxgrid How to Retrieve the Record Values for the Selected Grid Rows
- how to intall stardict on the ubuntu
- How to enable the MPlayer on centOS7
- How To Retrieve the URL of a Web Page from an ActiveX Control
- Axure RP Pro - 相关问题 - How to retrieve the URL of IFrame widget
- Get "Server Down" when retrieve the channel list in sopcast, how to solve it?
- 《Windows程序设计》读书笔记------------->>基本滚动条<<
- 我对【纹理坐标】的理解
- String#rjust
- 最值得MM购买的手机荐
- 深入了解Java ClassLoader,Bytecode,ASM,Cglib
- How to retrieve the phone IMEI code on UIQ3.0
- acl-控制列表编辑
- 在Linux下安装和使用MySQL
- 绘制平行线
- 我对【纹理颜色混合】与【ALPHA混合】的理解
- 经典对白,超然人生
- 上传文件 JSP+java
- C#通过Win32 API操作IE浏览器 --- 获得IE的URL
- DataGrid数据导出excel文件,有时出现乱码解决方法。