How to retrieve the phone IMEI code on UIQ3.0

本文介绍了一种在Symbian UIQ3.0环境下使用RMobilePhone类来检索手机IMEI码的方法。通过连接到ETel服务器、获取注册设备名称等步骤实现IMEI码的读取。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  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”
2.       “FAQ & Tech Tips”

    http://www2.symbian.com/faq.nsf/7b5405edb1250e7c802569ee005d054e/ba491eaeb25c5c7d80256bf3003e75fc?OpenDocument 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值