--- a/locationmgmt/networkgateway/src/netregstatusmonitor.cpp Wed Aug 18 11:11:46 2010 +0300
+++ b/locationmgmt/networkgateway/src/netregstatusmonitor.cpp Fri Sep 17 08:37:32 2010 +0300
@@ -69,6 +69,7 @@
*/
void CNetworkRegistrationStatusMonitor::ConstructL()
{
+ LBSLOG(ELogP1, "CNetworkRegistrationStatusMonitor::ConstructL++");
iConfigurationProperty.Attach(KUidSystemCategory, RootServer::KUidC32StartPropertyKey.iUid); // needs the KEY
TInt propertyValue = RootServer::EInitialising; // set to safe state
TInt propertyResult = iConfigurationProperty.Get(propertyValue);
@@ -77,6 +78,7 @@
{
//Attempt to connect to the ETel Server. This will start C32Start if it has not already been started by the startup routine.
User::LeaveIfError(iTelServer.Connect());
+ LBSLOG(ELogP1, "CNetworkRegistrationStatusMonitor Connected to ETel");
iConfigurationProperty.Subscribe(iStatus);
SetActive();
}
@@ -86,32 +88,38 @@
SetupPhoneL();
iInitialised = ETrue;
}
+ LBSLOG(ELogP1, "CNetworkRegistrationStatusMonitor::ConstructL++");
}
void CNetworkRegistrationStatusMonitor::SetupPhoneL()
{
+ LBSLOG(ELogP1, "CNetworkRegistrationStatusMonitor::SetupPhoneL++");
// Connect to the Network Registration Status internal LBS bus
iLbsNetRegStatus.OpenL();
-
+ LBSLOG(ELogP1, "attached to NetworkRegistrationStatus property");
TRAPD(err, InitialisePhoneL());
if (err == KErrNone)
{
// Connected to ETel successfully, now get the network
// registration status.
iPhone.GetNetworkRegistrationStatus(iStatus, iPhoneNetRegStatus);
+ LBSLOG2(ELogP2, "Current network registration status: %S", &NetRegStatusToDesC(iPhoneNetRegStatus));
SetActive();
}
else
{
+ LBSLOG(ELogP2, "couldn't connect to ETEL, setting network reg status to ENotRegistered");
// Couldn't connect to ETel; publish a default value.
iLbsNetRegStatus.SetNetworkRegistrationStatus(RLbsNetworkRegistrationStatus::ENotRegistered);
}
+ LBSLOG(ELogP1, "CNetworkRegistrationStatusMonitor::SetupPhoneL--");
}
/**
*/
void CNetworkRegistrationStatusMonitor::RunL()
{
+ LBSLOG(ELogP1, "CNetworkRegistrationStatusMonitor::RunL++");
User::LeaveIfError(iStatus.Int());
//Check to see whether the initialisation has finished
@@ -179,6 +187,7 @@
iObserver.OnNetworkRegistrationStatusChange(iCurrentNetRegStatus);
}
+ LBSLOG(ELogP1, "CNetworkRegistrationStatusMonitor::RunL--");
}
/**
@@ -262,43 +271,60 @@
*/
void CNetworkRegistrationStatusMonitor::InitialisePhoneL()
{
+ LBSLOG(ELogP1, "CNetworkRegistrationStatusMonitor::InitialisePhoneL++");
TInt err(KErrNone);
User::LeaveIfError(iTelServer.Connect());
-
+ LBSLOG(ELogP1, "connected to RTelServer");
// Read the name of the .tsy to load from CommDB
TBuf<KCommsDbSvrMaxFieldLength> tsyName;
GetCommDbTSYnameL(tsyName);
-
+
// Load .tsy into ETel
- User::LeaveIfError(iTelServer.LoadPhoneModule(tsyName));
-
+ err = iTelServer.LoadPhoneModule(tsyName);
+
+ LBSLOG2(ELogP2, "TSY Name: %S", &tsyName);
+ User::LeaveIfError(err);
+ LBSLOG(ELogP2, "TSY loaded");
// Find available phones; check that the one we requested
// to be loaded is there.
TInt phoneIndex(0);
User::LeaveIfError(iTelServer.EnumeratePhones(phoneIndex));
+ LBSLOG2(ELogP2, "phones enumerated. There are %d", phoneIndex);
while(phoneIndex-->0)
{
TName searchTsyName;
// Check whether this phone belongs to loaded TSY
if ((iTelServer.GetTsyName(phoneIndex, searchTsyName) == KErrNone)
&& (searchTsyName.CompareF(tsyName) == KErrNone))
+ {
+ LBSLOG(ELogP2, "Found phone belonging to the loaded TSY");
break;
+ }
}
// Open a phone to be used for monitoring the network registration status.
RTelServer::TPhoneInfo phoneInfo;
User::LeaveIfError(iTelServer.GetPhoneInfo(phoneIndex, phoneInfo));
- User::LeaveIfError(iPhone.Open(iTelServer, phoneInfo.iName));
-
+ LBSLOG(ELogP2, "Got phone info from RTelServer");
+ err = iPhone.Open(iTelServer, phoneInfo.iName);
+ if(KErrNone != err)
+ {
+ LBSLOG2(ELogP2, "error %d returned from RMobilePhone::Open()", err);
+ }
+ User::LeaveIfError(err);
+ LBSLOG2(ELogP2, "%S phone opened", &phoneInfo.iName);
// Check that the phone is ready to be used.
RPhone::TStatus status;
User::LeaveIfError(iPhone.GetStatus(status));
+ LBSLOG3(ELogP2, "Phone status: modem detected = %d, mode = %d", status.iModemDetected, status.iMode);
if(status.iModemDetected != RPhone::EDetectedPresent)
{
+
err = iPhone.Initialise();
if(err != KErrNone)
{
+ LBSLOG2(ELogP2, "Error %d on initialising phone", err);
iPhone.Close();
User::Leave(err);
}
@@ -306,14 +332,22 @@
// Check that we can access the info we want
TUint32 networkCaps;
- User::LeaveIfError(iPhone.GetNetworkCaps(networkCaps));
+ err = iPhone.GetNetworkCaps(networkCaps);
+ if(KErrNone != err)
+ {
+ LBSLOG2(ELogP2, "Error %d on getting network caps", err);
+ }
+ User::LeaveIfError(err);
+ LBSLOG2(ELogP2, "Network caps = 0x%x", networkCaps);
if (!(networkCaps & RMobilePhone::KCapsGetRegistrationStatus
&& networkCaps & RMobilePhone::KCapsNotifyRegistrationStatus))
{
+ LBSLOG(ELogP2, "Leaving with KErrNotSupported (registration status not supported by phone)");
err = KErrNotSupported;
}
User::LeaveIfError(err);
+ LBSLOG(ELogP1, "CNetworkRegistrationStatusMonitor::InitialisePhoneL--");
}
#ifdef ENABLE_LBS_DEV_LOGGER