Getting the Current Cell Id using Symbian S60
What you need:
Series 60 SDK
Communicator 9200 SDK version 0.9 or higher
etel.h from Communicator 9200 SDK
etelbgsm.h from Communicator 9200 SDK
Instructions:
Copy etel.h and etelbgsm.h to the /Symbian/6.1/Series60/Epoc32/Include directory.
Link your app to gsmbas.lib and etel.lib.
Use this code:
RBasicGsmPhone phone;
RTelServer server;
User::LeaveIfError( server.Connect() );
// load a phone profile
_LIT(KGsmModuleName, "phonetsy.tsy");
User::LeaveIfError( server.LoadPhoneModule( KGsmModuleName ) );
// initialize the phone object
RTelServer::TPhoneInfo info;
User::LeaveIfError( server.GetPhoneInfo( 0, info ) );
User::LeaveIfError( phone.Open( server, info.iName ) );
MBasicGsmPhoneNetwork::TCurrentNetworkInfo netinfo;
User::LeaveIfError( phone.GetCurrentNetworkInfo( netinfo ) );
Now you should be able to access the fields of
MBasicGsmPhoneNetwork::TCurrentNetworkInfo
which are
.iCellId
.iLocationAreaCode
.iNetworkInfo.iShortName
Once you have grabbed the info use this code to clean up:
phone.Close();
server.UnloadPhoneModule( KGsmModuleName );
server.Close();
All the code should work for the 6600 as well. You have the option of
just compiling with the 1.2 SDK or copying the headers to the 2.0 SDK .
Explore the other functions and data available through these objects as well. The headers should provide you with enough information to figure out what they are. Not all of them are completely implemented. According to a Forum Nokia post you can get to the information by:
- ManufacturerId, Serial No: GetPhoneInfo()
- BER, battery status: GetX - async version
- Signal Strength: SignalStrengthNotification()
Use the NotifyChangeOfCurrentNetwork, so that works as well
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type=text/javascript> </script>
本文介绍如何使用Symbian S60 SDK获取手机当前所在的蜂窝网络小区ID、位置区码等信息。通过加载电话模块并初始化电话对象,可以获取到MBasicGsmPhoneNetwork::TCurrentNetworkInfo结构体中包含的小区信息。
4万+

被折叠的 条评论
为什么被折叠?



