I need to get the "Own Number" of the mobile device and thus have been using the Mobinfo APIs as my app has to support 2nd Ed devices too.
I have implemented the Active Object and invoke the CMobileInfo::OwnNumber() API, but in the RunL() when the AO returns the status is always KErrNotSupported.
Similar is seen when I try to fetch the IMSI info too...
As per my understanding, on the emulator, the API should have returned a mock Own number. This is failing to happen and the return value is a Null.
This behaviour is seen only on the emulator. I haven't tried my app on the device as yet and currently using the S60_2nd_FP2 (8.0a) SDK.
Below is the Code:
CMobileUtils* CMobileUtils::NewL()
{
CMobileUtils* self = new (ELeave) CMobileUtils();
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop(self);
return self;
}
CMobileUtils::CMobileUtils() : CActive(EPriorityHigh)
{
}
void CMobileUtils::ConstructL()
{
iMobileInfo = CMobileInfo::NewL();
CActiveScheduler::Add(this); // Add to scheduler
}
CMobileUtils::~CMobileUtils()
{
Cancel(); // Cancel any request, if outstanding
// Delete instance variables if any
delete iMobileInfo;
}
void CMobileUtils::DoCancel()
{
switch(iPhoneInfoType)
{
case EHandsetIMSI:
iMobileInfo->CancelGetIMSI(); //CMobInfo::
break;
case EHandsetOwnNumber:
iMobileInfo->CancelGetOwnNumber(); //CMobInfo::
break;
default:
break;
}
}
void CMobileUtils::StartL()
{
Cancel(); // Cancel any request, just to be sure
iState = EGetPhoneInfo;
switch(iPhoneInfoType)
{
case EHandsetIMSI:
{
iMobileInfo->GetIMSI(iImsiNumber, iStatus); //CMobInfo::
}
break;
case EHandsetOwnNumber:
{
iMobileInfo->GetOwnNumber(iOwnNumber, iStatus); //CMobInfo::
}
break;
}
SetActive(); // Tell scheduler a request is active
iActiveSchedulerWait.Start();
}
void CMobileUtils::RunL()
{
iState = EDone;
if ( iActiveSchedulerWait.IsStarted() )
{
iActiveSchedulerWait.AsyncStop();
if(iStatus == KErrNone)
{
switch(iPhoneInfoType)
{
case EHandsetIMEI:
break;
case EHandsetIMSI:
{
//Successfully obtained
//dummy Operation
}
break;
case EHandsetOwnNumber:
{
//Successfully obtained
//dummy Op
}
break;
}
}
else if(KErrNotSupported)
{
// Error...
//dummy
}
}
}
const TPtrC CMobileUtils::GetIMSI()
{
iPhoneInfoType = EHandsetIMSI;
iImsiNumber.Zero();
StartL();
TPtrC ptr(iImsiNumber.Ptr());
return ptr;
}
const TPtrC CMobileUtils::GetOwnNumber()
{
iPhoneInfoType = EHandsetOwnNumber;
iOwnNumber.Zero();
StartL();
TPtrC ptr(iOwnNumber.Ptr());
return ptr;
}





