Problem with GetHomeNetwork API
| Fri, 2005-09-30 07:03 | |
|
|
Hi All, I am trying to get home network info (MCC, Home MNC) using GetHomeNetwork API of RMobilePhone class. But many times it does not gives correct value. GetCurrentNetwork API of the same class works always form me but GetHomeNetwork API give me wrong MNC value some of times. Is this API really works or I am doing something wrong. If it does not works, then what is the working alternative. I am using the following code: ////////// source   RTelServer iTelserver;   RMobilePhone iPhone;   RLine iLine;   TBuf <128>           lPhoneName;   TBuf <128>           lLineName;   TInt              lNumberPhones;   RTelServer::TPhoneInfo     lPhoneInfo;   RPhone::TLineInfo        lLineInfo;   TRequestStatus NetworkStatus;   User::LeaveIfError(iTelserver.Connect(RTelServer::KDefaultMessageSlots));   _LIT (KTsyName,"phonetsy.tsy");   User::LeaveIfError(iTelserver.LoadPhoneModule(KTsyName));   //Find the number of phones available from the tel server   User::LeaveIfError(iTelserver.EnumeratePhones(lNumberPhones));   //Check there are available phones   if ( lNumberPhones < 1 )   {     User::Leave(KErrNotFound);   }   //Get info about the first available phone   User::LeaveIfError(iTelserver.GetPhoneInfo(0, lPhoneInfo));   lPhoneName.Copy(lPhoneInfo.iName);   //Use this info to open a connection to the phone, the phone is identified by its name   User::LeaveIfError(iPhone.Open(iTelserver, lPhoneName));   //Get info about the first line from the phone   User::LeaveIfError(iPhone.GetLineInfo(0, lLineInfo));   lLineName.Copy(lLineInfo.iName);   //Use this to open a line   User::LeaveIfError(iLine.Open(iPhone, lLineName));   RMobilePhone::TMobilePhoneNetworkInfoV1 infov1;   RMobilePhone::TMobilePhoneNetworkInfoV1Pckg statusPkg(infov1);   iPhone.GetHomeNetwork(NetworkStatus,statusPkg);   User::WaitForRequest(NetworkStatus);   if ( NetworkStatus == KErrNone )   {     TBuf8<50> country;     TBuf8<50> network;     country.Copy(infov1.iCountryCode);     network.Copy(infov1.iNetworkId);     aNetworkInfo.mcc=KN_ATOI((const char *)country.Ptr());     aNetworkInfo.mnc=KN_ATOI((const char *)network.Ptr());// This is coming wrong some of the times??  }   iLine.Close();   iPhone.Close();   iTelserver.Close(); Dushyant Gaur |






Forum posts: 52
Country Code = 442
Network ID = 12
, which stands for Vodafone in U.K., it means that you may be using the original MM.TSY from symbian DevKit, without being ported to local operator.
If you get a different value than expected, you may be using a different MM.TSY.
If you get the correct value SOMETIMES only, I cannot explain it.
NewLC #2150