Saturday, August 19, 2006

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

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
which are

Once you have grabbed the info use this code to clean up:

server.UnloadPhoneModule( KGsmModuleName );


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.

No comments: