Hi all,
I want to retrieve the numbers i dialed. Don't know how it can be done. Is there any possibility?? If then please show me some way to solve it.
With thanks & regards,
Santu
Hi all,
I want to retrieve the numbers i dialed. Don't know how it can be done. Is there any possibility?? If then please show me some way to solve it.
With thanks & regards,
Santu
Have you tried searching this forum and wiki. It has been discussed so many times.
Regards,
ivey
I think CTelephony work better than logs really.
Hi, symbianyucca
I have used CTelephony. Mainly i am trying to write all the numbers i dialed in a file.
CODE:
#include <f32file.h>
#include "OutgoingCall.h"
OutgoingCall::OutgoingCall(): CActive( CActive::EPriorityStandard )
{
}
OutgoingCall::~OutgoingCall()
{
Cancel();
delete iTelephony;
iTelephony = NULL;
}
OutgoingCall* OutgoingCall::NewL()
{
OutgoingCall* self = OutgoingCall::NewLC();
CleanupStack::Pop( self );
return self;
}
OutgoingCall* OutgoingCall::NewLC()
{
OutgoingCall* self = new ( ELeave ) OutgoingCall();
CleanupStack::PushL( self );
self->ConstructL();
return self;
}
void OutgoingCall::ConstructL()
{
CActiveScheduler::Add( this );
iTelephony = CTelephony::NewL();
// Initialize with ’unknown’ statuses
iLineStatus.iStatus = CTelephony::EStatusUnknown;
iLastInformedLineStatus = CTelephony::EStatusUnknown;
CTelephony::TCallStatusV1Pckg lineStatusPckg( iLineStatus );
// Request notification about the changes in voice line status
iTelephony->NotifyChange( iStatus, CTelephony::EVoiceLineStatusChange, lineStatusPckg );
SetActive();
}
void OutgoingCall::RunL()
{
if( iLineStatus.iStatus == CTelephony::EStatusDialling )
{
// GetNumber();
}
if(iLineStatus.iStatus == CTelephony::EStatusRinging)
{
if(iLastInformedLineStatus != CTelephony::EStatusDialling)
{
// GetNumber();
}
}
iLastInformedLineStatus = iLineStatus.iStatus;
}
void OutgoingCall:oCancel()
{
iTelephony->CancelAsync( CTelephony::EVoiceLineStatusChangeCancel );
}
void OutgoingCall::GetNumber()
{
_LIT(KFileSpec,"c:\\Data\\dialednumber.txt");//File, in which SMS Body will be stored
TInt pos=0;
RFs fs;
fs.Connect();
RFile file;
TInt err=file.Replace(fs,KFileSpec,EFileWrite);
CTelephony::TTelNumber dialnumber;
CTelephony::TCallInfoV1 callInfoV1;
CTelephony::TCallInfoV1Pckg callInfoV1Pckg( callInfoV1 );
CTelephony::TCallSelectionV1 callSelectionV1;
CTelephony::TCallSelectionV1Pckg callSelectionV1Pckg( callSelectionV1 );
CTelephony::TRemotePartyInfoV1 remotePartyInfoV1;
CTelephony::TRemotePartyInfoV1Pckg remotePartyInfoV1Pckg( remotePartyInfoV1 );
callSelectionV1.iLine = CTelephony::EVoiceLine;
callSelectionV1.iSelect = CTelephony::EInProgressCall;
iTelephony->GetCallInfo( callSelectionV1Pckg, callInfoV1Pckg, remotePartyInfoV1Pckg );
if( remotePartyInfoV1.iRemoteIdStatus == CTelephony::ERemoteIdentityAvailable )
{
if( remotePartyInfoV1.iRemoteNumber.iTelNumber.Length() > 0 )
{
// Incoming call number can be read from
// remotePartyInfoV1.iRemoteNumber.iTelNumber;
}
}
if( callInfoV1.iDialledParty.iTelNumber.Length() > 0 )
{
// Outgoing call number can be read from
dialnumber = callInfoV1.iDialledParty.iTelNumber;
TBufC<50> aText(dialnumber);
HBufC8* SMSContent8 = HBufC8::NewLC(400);
HBufC* Buf1 = aText.AllocL();
SMSContent8->Des().Copy(Buf1->Des());
if(err==KErrNone)
{
file.Seek(ESeekEnd,pos);
file.Write(SMSContent8->Des());
}
Buf1 = NULL;
CleanupStack::PopAndDestroy(1,Buf1);
}
file.Close();
fs.Close();
}
But (callInfoV1.iDialledParty.iTelNumber.Length() > 0) is coming false and (remotePartyInfoV1.iRemoteIdStatus == CTelephony::ERemoteIdentityAvailable) is coming false. I have added CAPABILITY ReadUserData,WriteUserData,WriteDeviceData and ReadDeviceData in the mmp file. Where i am doing wrong please help me to find it out.
With regards,
Santu
You are giving it up too early: if you do not get remote party information at the first time, you should simply re-issue the NotifyChange+EVoiceLineStatusChange, and sooner or later you will get the info.
Hi Santu,
use this in your code, hope works
Code:lineInfo1 = CTelephony::EVoiceLine; iTel->GetLineStatus(lineInfo1,iCallStatusPckg ); CTelephony::TCallInfoV1 callInfoV1; CTelephony::TCallSelectionV1 callSelectionV1; CTelephony::TRemotePartyInfoV1 remotePartyInfoV1; callSelectionV1.iLine = CTelephony::EVoiceLine; callSelectionV1.iSelect = CTelephony::EInProgressCall; CTelephony::TCallInfoV1Pckg callInfoV1Pckg( callInfoV1 ); CTelephony::TRemotePartyInfoV1Pckg remotePartyInfoV1Pckg( remotePartyInfoV1 ); CTelephony::TCallSelectionV1Pckg callSelectionV1Pckg( callSelectionV1 ); iTel->GetCallInfo( callSelectionV1Pckg, callInfoV1Pckg, remotePartyInfoV1Pckg ); ///////////////////////////////////////////// if (remotePartyInfoV1.iDirection == CTelephony::EMobileTerminated)// Incomin Call { phNumber.Copy(remotePartyInfoV1.iRemoteNumber.iTelNumber); //for incoming call } else if(remotePartyInfoV1.iDirection == CTelephony::EMobileOriginated)// OutGoing Call { phNumber.Copy(callInfoV1.iDialledParty.iTelNumber); }
Regards,
Amit
****"Putting a Smile on other's faces is the essence of true Happiness"****
Hi Amit, your code is not working too. May be i am doing something wrong. I want to know where does all the dialed numbers and missed call numbers are stored. My application should retrieve all those number.
Can anyone please guide me through this.
With regards,
Santu
check logs APIs, Wiki should also have good examples which you could find usefull, so check from there as well.
For your requirement You have to use CLogClient classes, try using wiki as suggested by yucca http://wiki.forum.nokia.com/index.php/Logs_Example
Hi skumar_rao,
I changed my code totally.
CODE:
#include <aknnotewrappers.h>
#include <e32base.h>
#include <logcli.h> // CLogClient
#include <logview.h> // CLogViewRecent
#include <logwrap.h> // CLogEvent
#include "CLogHandler.h"
/**
* Constructor. Defines the priority for this active object.
*/
CLogHandler::CLogHandler() : CActive(EPriorityStandard)
{
}
/**
* 2nd phase constructor.
*/
CLogHandler* CLogHandler::NewL()
{
CLogHandler* self = CLogHandler::NewLC();
CleanupStack::Pop(self);
return self;
}
/**
* 2nd phase constructor.
*/
CLogHandler* CLogHandler::NewLC()
{
CLogHandler* self = new (ELeave) CLogHandler();
CleanupStack::PushL(self);
self->ConstructL();
return self;
}
/**
* 2nd phase constructor.
*/
void CLogHandler::ConstructL()
{
User::LeaveIfError(iFs.Connect());
// Establish connection to log engine
iLogClient = CLogClient::NewL(iFs);
iLogViewRecent = CLogViewRecent::NewL(*iLogClient);
iTask = ESleep; // Default task for RunL
CActiveScheduler::Add(this);
}
/**
* Destructor.
*/
CLogHandler::~CLogHandler()
{
Cancel();
delete iLogViewRecent;
delete iLogClient;
iFs.Close();
}
/**
* From CActive.
*/
void CLogHandler::RunL()
{
switch (iTask)
{
case EGetRecent:
{
// Retrieve the event and handle it
HandleRecentEventL(iLogViewRecent->Event());
// If there are more events in the log engine database...
if (iLogViewRecent->NextL(iStatus))
{
if (iStatus == KErrNone)
{
// ... set active to get the next one
SetActive();
}
}
else
{
// No more events. Go to sleep.
iTask = ESleep;
}
break;
}
case ESleep:
default:
{
break;
}
}
}
/**
* From CActive.
*/
TInt CLogHandler::RunError(TInt anError)
{
return anError;
}
/**
* From CActive.
*/
void CLogHandler:oCancel()
{
// Cancel the appropriate task
switch (iTask)
{
case EGetRecent:
{
iLogViewRecent->Cancel();
}
case ESleep:
default:
{
break;
}
}
}
/**
* Reads recent events from the main event database
*/
void CLogHandler::ReadRecentEventsL()
{
if (iLogViewRecent->SetRecentListL(KLogNullRecentList, iStatus))
{
if (iStatus == KErrNone)
{
// If there are events in the log view, set this active object active
// to get the events from the main event database. See RunL().
iTask = EGetRecent;
SetActive();
}
}
else
{
_LIT(KTxt, "No recent calls.");
CAknInformationNote* note = new (ELeave)CAknInformationNote(ETrue);
note->ExecuteLD(KTxt);
}
}
/**
* Displays a recent event in an information note.
*/
void CLogHandler::HandleRecentEventL(const CLogEvent& anEvent)
{
TBuf<255> buffer;
_LIT(KTxt, "Description: %S\nNumber: %S");
buffer.Format(KTxt, &(anEvent.Description()), &(anEvent.Number()));
CAknInformationNote* note = new (ELeave)CAknInformationNote(ETrue);
note->ExecuteLD(buffer);
}
But as i call the the function ReadRecentEventsL, iStatus is not comming KErrNone.
Not getting where is the wrong. Please help me to find it out.
With regards,
Santu
Hi, It is working fine. I just comment the if condition
//if (iStatus == KErrNone).
Now for miss call what i have to do. Please guide me through this.
With regards,
Santu Paul
Hi All, I tested my application in mobile(N95), it gives all the events means dialed numbers, miss call and also received numbers.
But now the problem is how can i extract that which one is dialed and which one is received number.
Anyone please give me any idea.
With regards,
Santu
Hi all, for missed call i have used
iLogViewRecent->SetRecentListL(KLogRecentMissedCalls,iStatus);
But don't know how to get the dialled numbers.
And one more thing, i got the missed call numbers but how i can get the name associated with the number saved in the phone.
Any idea. Please reply me.
With regards,
Santu