Read-only archive of the All About Symbian forum (2001–2013) · About this archive

etelmm.h code - need help

1 replies · 2,002 views · Started 11 December 2004

Hi
Please take a look at the code below.
after loading the TSY (which goes well) ,
I call the GetCurrentNetwork method (after a basic initiation of params - I dont know how to initiate them).
I Checked and found that the iNetworkInfoPckg var is empty after calling the method.

* How can I actually retrieve the relevant data ? -
For a start I want to see the current network ...
* What should I change or add to the code?

Thanks a LOT , TE


RTelServer iServer;
CCommsDatabase* const db = CCommsDatabase::NewL(EDatabaseTypeUnspecified);
CleanupStack::PushL(db); // PUSH
TUint32 modemId = 0;
db->GetGlobalSettingL(TPtrC(MODEM_PHONE_SERVICES_SMS), modemId);
CCommsDbTableView* const view = db->OpenViewMatchingUintLC(TPtrC(MODEM), TPtrC(COMMDB_ID), modemId); // PUSH
TInt err = view->GotoFirstRecord();
User::LeaveIfError(err);
TFileName tsyName;
view->ReadTextL(TPtrC(MODEM_TSY_NAME), tsyName);
User::LeaveIfError(iServer.LoadPhoneModule(tsyName));
CleanupStack::PopAndDestroy(2, db); // view & db

User::LeaveIfError(iServer.EnumeratePhones(enumphone));
if (enumphone < 1)
{
User::Leave(KErrNotFound);
}
HBufC8 * iNetworkInfoPckg = HBufC8::NewL(50);
RMobilePhone::TMobilePhoneLocationAreaV1 * iArea;
RMobilePhone phone;
RTelServer::TPhoneInfo info;
User::LeaveIfError(iServer.GetPhoneInfo(0, info));
User::LeaveIfError(phone.Open(iServer, info.iName));
phone.GetCurrentNetwork(iReqStatus, iNetworkInfoPckg->Des(), (*iArea));
User::WaitForRequest(iReqStatus);
phone.Close();

This is what you have to do. see text in italic

RTelServer iServer; 
CCommsDatabase* const db = CCommsDatabase::NewL(EDatabaseTypeUnspecified);
CleanupStack::PushL(db); // PUSH
TUint32 modemId = 0;
db->GetGlobalSettingL(TPtrC(MODEM_PHONE_SERVICES_SMS), modemId);
CCommsDbTableView* const view = db->OpenViewMatchingUintLC(TPtrC(MODEM), TPtrC(COMMDB_ID), modemId); // PUSH
TInt err = view->GotoFirstRecord();
User::LeaveIfError(err);
TFileName tsyName;
view->ReadTextL(TPtrC(MODEM_TSY_NAME), tsyName);
User::LeaveIfError(iServer.LoadPhoneModule(tsyName));
CleanupStack::PopAndDestroy(2, db); // view & db

User::LeaveIfError(iServer.EnumeratePhones(enumphone));
if (enumphone < 1)
{
User::Leave(KErrNotFound);
}
RMobilePhone::TMobilePhoneNetworkInfoV1 iNetworkInfo;
RMobilePhone::TMobilePhoneNetworkInfoV1Pckg iNetworkInfoPkg(iNetworkInfo);
RMobilePhone::TMobilePhoneLocationAreaV1 iLocationInfo;

RMobilePhone phone;
RTelServer::TPhoneInfo info;
User::LeaveIfError(iServer.GetPhoneInfo(0, info));
User::LeaveIfError(phone.Open(iServer, info.iName));
phone.GetCurrentNetwork(iReqStatus, iNetworkInfoPkg, iLocationInfo);
User::WaitForRequest(iReqStatus);
if(iReqStatus == KErrNone)
{
TBuf<256> iNetworkName;
TUint iCellId;
iNetworkName.Copy(iNetworkInfo().iShortName);
iCellId = iLoactionInfo.iCellId;
....
// do something with these
....
}
phone.Close();