How to retrieve the phone IMEI code on UIQ3.0
2008-08-02 17:25
477 查看
How to retrieve the phone IMEI code on UIQ3.0
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:
[align=left]RTelServer iTelServer; // Root telephony server session[/align]
[align=left]RMobilePhone iMmPhone;[/align]
[align=left]TBuf< KCommsDbSvrMaxFieldLength> iPhoneName[/align]
[align=left]RMobilePhone::TMobilePhoneIdentityV1 iPhoneId;[/align]
1. Connect to the ETel server
[align=left]User::LeaveIfError(iTelServer.Connect());[/align]
2. Get the name of registered phones
[align=left]// Get the number of registered phones[/align]
[align=left]TInt numberOfPhones;[/align]
[align=left]User::LeaveIfError(aTelServer.EnumeratePhones(numberOfPhones));[/align]
[align=left]LOG("%i",numberOfPhones);[/align]
[align=left]for( TInt i = 0; i <numberOfPhones ; i++ )[/align]
[align=left]{[/align]
[align=left]RTelServer::TPhoneInfo info;[/align]
[align=left]iTelServer.GetPhoneInfo(i,info);[/align]
[align=left]LOG("NetworkTyp:[%i],Name:[%S],NumberofLines:[%i],Extensions:[%i]", (TInt)info.iNetworkType,&info.iName,info.iNumberOfLines,info.iExtensions);[/align]
[align=left]iPhoneName.Copy(info.iName);[/align]
[align=left]}[/align]
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
[align=left]// open mobile phone sub session [/align]
[align=left]User::LeaveIfError(iMmPhone.Open(iTelServer, iPhoneName));[/align]
4. Check if the phone provided the capabilities to retrieve IMEI code or not
And call the RMobilePhone::GetPhoneId function to retrieve IMEI.
[align=left]TUint32 lCaps = 0;[/align]
[align=left]TInt err = iMmPhone.GetIdentityCaps(lCaps);[/align]
[align=left]if(err != KErrNone && err != KErrNotSupported)[/align]
[align=left] {[/align]
[align=left] LOG(_L("an unexpected error occoured"));[/align]
[align=left] }[/align]
[align=left]else if(err == KErrNotSupported)[/align]
[align=left] {[/align]
[align=left] LOG(_L("RMobilePhone::GetIdentityCaps() returned KErrNotSupported ")); [/align]
[align=left] }[/align]
[align=left]else if (lCaps & RMobilePhone::KCapsGetSerialNumber)[/align]
[align=left] {[/align]
[align=left] iMmPhone.GetPhoneId(iStatus, iPhoneId); // asynchronous call[/align]
[align=left] iActiveStatus = ST_GET_PHONE_ID;[/align]
[align=left] SetActive();[/align]
[align=left] return;[/align]
[align=left] }[/align]
[align=left]// very important, Otherwise application will panic when called twice[/align]
[align=left]iMmPhone.Close();[/align]
[align=left]iTelServer.Close();[/align]
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:
[align=left]iMmPhone.Close();[/align]
[align=left]iTelServer.Close();[/align]
<SCRIPT type=text/javascript><!--
google_ad_client = "pub-5802524690470106";
//728x15, 创建于 07-11-13
google_ad_slot = "7233856721";
google_ad_width = 728;
google_ad_height = 15;
//--></SCRIPT>
<SCRIPT src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type=text/javascript>
</SCRIPT>
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:
[align=left]RTelServer iTelServer; // Root telephony server session[/align]
[align=left]RMobilePhone iMmPhone;[/align]
[align=left]TBuf< KCommsDbSvrMaxFieldLength> iPhoneName[/align]
[align=left]RMobilePhone::TMobilePhoneIdentityV1 iPhoneId;[/align]
1. Connect to the ETel server
[align=left]User::LeaveIfError(iTelServer.Connect());[/align]
2. Get the name of registered phones
[align=left]// Get the number of registered phones[/align]
[align=left]TInt numberOfPhones;[/align]
[align=left]User::LeaveIfError(aTelServer.EnumeratePhones(numberOfPhones));[/align]
[align=left]LOG("%i",numberOfPhones);[/align]
[align=left]for( TInt i = 0; i <numberOfPhones ; i++ )[/align]
[align=left]{[/align]
[align=left]RTelServer::TPhoneInfo info;[/align]
[align=left]iTelServer.GetPhoneInfo(i,info);[/align]
[align=left]LOG("NetworkTyp:[%i],Name:[%S],NumberofLines:[%i],Extensions:[%i]", (TInt)info.iNetworkType,&info.iName,info.iNumberOfLines,info.iExtensions);[/align]
[align=left]iPhoneName.Copy(info.iName);[/align]
[align=left]}[/align]
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
[align=left]// open mobile phone sub session [/align]
[align=left]User::LeaveIfError(iMmPhone.Open(iTelServer, iPhoneName));[/align]
4. Check if the phone provided the capabilities to retrieve IMEI code or not
And call the RMobilePhone::GetPhoneId function to retrieve IMEI.
[align=left]TUint32 lCaps = 0;[/align]
[align=left]TInt err = iMmPhone.GetIdentityCaps(lCaps);[/align]
[align=left]if(err != KErrNone && err != KErrNotSupported)[/align]
[align=left] {[/align]
[align=left] LOG(_L("an unexpected error occoured"));[/align]
[align=left] }[/align]
[align=left]else if(err == KErrNotSupported)[/align]
[align=left] {[/align]
[align=left] LOG(_L("RMobilePhone::GetIdentityCaps() returned KErrNotSupported ")); [/align]
[align=left] }[/align]
[align=left]else if (lCaps & RMobilePhone::KCapsGetSerialNumber)[/align]
[align=left] {[/align]
[align=left] iMmPhone.GetPhoneId(iStatus, iPhoneId); // asynchronous call[/align]
[align=left] iActiveStatus = ST_GET_PHONE_ID;[/align]
[align=left] SetActive();[/align]
[align=left] return;[/align]
[align=left] }[/align]
[align=left]// very important, Otherwise application will panic when called twice[/align]
[align=left]iMmPhone.Close();[/align]
[align=left]iTelServer.Close();[/align]
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:
[align=left]iMmPhone.Close();[/align]
[align=left]iTelServer.Close();[/align]
<SCRIPT type=text/javascript><!--
google_ad_client = "pub-5802524690470106";
//728x15, 创建于 07-11-13
google_ad_slot = "7233856721";
google_ad_width = 728;
google_ad_height = 15;
//--></SCRIPT>
<SCRIPT src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type=text/javascript>
</SCRIPT>
相关文章推荐
- How to retrieve the phone IMEI code on UIQ3.0
- How to build the Robotics Library from source code on Windows
- How to Ditch Phone Mode & Get the Full Tablet UI on Your Nexus 7—Without Rooting
- How to freeze a dynamic aspx page into a static html page (on the server).(转:http://codebetter.com/blogs/peter.van.ooijen/archiv
- How to calculate the time consumed on a block of souce code.
- Android: How to download the latest zip Android Source Code easily and using it in Intellij
- How to add dependency on a Windows Service AFTER the service is installed
- Links to sample code for the Windows Phone 7
- How to deploy the ASP.NET MVC 3 website into the IIS7 on Windows server 2008
- How to get the control inside the ControlTemplate/DataTemplate on run time.
- How to Get the Function Code in R
- how to find the tomcat version info on linux
- How to remove the "Active" marked on partitions
- How to restore ASM based OCR after complete loss of the CRS diskgroup on Linux systems[ID 1062983.1]
- (OK) how to compile the source code for Android-x86 (Android 7.1.1)
- How to display the data from database on JTable
- The way to select how large is diesel-engined keep an eye on
- [ios] how to findout the language you use on ios devices.
- How to grant access to SQL logins on a standby database when the guest user is disabled in SQL Serve
- How To Focus On The Positive Qualities Of Your Relationship