Hi,
what this a procedure for delete ol event log of phone?
Thanks
Silvia
Hi,
what this a procedure for delete ol event log of phone?
Thanks
Silvia
I write this code, but don't delete the event
CLogExEngine::CLogExEngine():CActive(EPriorityStandard)
{
}
void CLogExEngine::RemoveObserver()
{
iObserver = NULL;
}
void CLogExEngine::SetRecentObserver(MEventsObserver* aObserver)
{
iRecentObserver = aObserver;
}
void CLogExEngine::RemoveRecentObserver()
{
iRecentObserver = NULL;
}
void CLogExEngine::SetEventFilterDirectionIncoming()
{
TBuf<KLogMaxDirectionLength> direction;
iLogClient->GetString(direction, R_LOG_DIR_IN);
ClearEventFilter();
iLogFilter->SetDirection(direction);
}
void CLogExEngine::SetEventFilterDirectionOutgoing()
{
TBuf<KLogMaxDirectionLength> direction;
iLogClient->GetString(direction, R_LOG_DIR_OUT);
ClearEventFilter();
iLogFilter->SetDirection(direction);
}
void CLogExEngine::SetEventFilterEventTypeVoice()
{
ClearEventFilter();
iLogFilter->SetEventType(KLogCallEventTypeUid);
}
void CLogExEngine::SetEventFilterEventTypeSMS()
{
ClearEventFilter();
iLogFilter->SetEventType(KLogShortMessageEventTypeUid);
}
void CLogExEngine::ClearEventFilter()
{
// Empty the active filter copying empty filter to it
iLogFilter->Copy(*iEmptyLogFilter);
}
void CLogExEngine::ReadEventsL()
{
Cancel();
CEikonEnv::Static()->AlertWin(_L("nella lettura"));
// ETrue if there are any events in the log view
if(iLogViewEvent->SetFilterL(*iLogFilter,iStatus))
{
// set this active object active to get the events
// from the main event database, see RunL()
iTask = EGetEvent;
SetActive();
}
// If there are no events in the main event database,
// do nothing and return
}
// ----------------------------------------------------
// CLogExEngine::ReadRecentEventsL()
// Reads recents events from main event database
// ----------------------------------------------------
//
void CLogExEngine::ReadRecentEventsL()
{
Cancel();
// ETrue if there are any events in the log view
if(iLogViewRecent->SetRecentListL(KLogNullRecentList, iStatus))
{
// set this active object active to get the events
// from the main event database, see RunL()
iTask = EGetRecent;
SetActive();
}
// If there are no events in the main event database,
// do nothing and return
}
// ----------------------------------------------------
// CLogExEngine::AddRandomEventL()
// Adds random event to log engine database
// ----------------------------------------------------
//
void CLogExEngine::AddRandomEventL()
{
Cancel();
__ASSERT_ALWAYS( (iLogEvent == 0), User::Panic(KEngineAddRandomText,1) );
iLogEvent = CreateRandomLogEventL(); // create new random log event
iTask = EAddEvent; // tell RunL to add the iLogEvent to the log engine database
iLogClient->AddEvent(*iLogEvent, iStatus); // call asynchronous method to add the event
SetActive();
}
// ----------------------------------------------------
// CLogExEngine::AddEventTypeToLogEngineL()
// Adds own event to main event database
// ----------------------------------------------------
//
void CLogExEngine::AddEventTypeToLogEngineL()
{
if(iOwnEvenTypeRegistered) // if already registered, do nothing and return
{
return;
}
Cancel(); // possible requests pending
iTask = EAddEventType; // set task type for RunL
iLogEventType = OwnLogEventTypeL(); // create new event type
// register new event type the main event database
iLogClient->AddEventType(*iLogEventType, iStatus);
SetActive();
}
// ----------------------------------------------------
// CLogExEngine::AddOwnEventL()
// Adds own event to the log engine database
// ----------------------------------------------------
//
void CLogExEngine::AddOwnEventL()
{
Cancel();
if(!iOwnEvenTypeRegistered)
{
AddEventTypeToLogEngineL();
return;
}
__ASSERT_ALWAYS( (iLogEvent == 0), User::Panic(KEngineAddOwnText,1) );
iLogEvent = CreateRandomLogEventL(); // create a new random log event
// change information and Uid
// Own eventtypes TUids must be different from those defined
// in logeng.h. They also don't show up in the Log application.
iLogEvent->SetEventType(KOwnEventTypeUid);
// Set own information for the event
iLogEvent->SetDescription(KOwnEventDescription);
iLogEvent->SetDirection(KOwnEventDirection);
iLogEvent->SetNumber(KOwnEventNumber);
iTask = EAddEvent; // tell RunL to add the iLogEvent to the log engine database
iLogClient->AddEvent(*iLogEvent, iStatus); // call asynchronous method to add the event
SetActive();
}
// ----------------------------------------------------
// CLogExEngine::OwnLogEventTypeL()
// This is to demonstrate how to build up an own event type.
// ----------------------------------------------------
//
CLogEventType* CLogExEngine::OwnLogEventTypeL()
{
CLogEventType* owneventtype = CLogEventType::NewL();
// Event type spesific TUid must be set
const TUid KOwnEventTypeUid = {0x10005570};
owneventtype->SetUid(KOwnEventTypeUid);
owneventtype->SetDescription(KOwnEventDescription);
// Make sure event type is logged
owneventtype->SetLoggingEnabled(ETrue);
return owneventtype;
}
// ----------------------------------------------------
// CLogExEngine::CreateRandomLogEventL()
// creates a random new log event for emulator
// ----------------------------------------------------
//
CLogEvent* CLogExEngine::CreateRandomLogEventL()
{
CLogEvent* event = CLogEvent::NewL();
// Sets the duration of the event in seconds.
// Randomize something between 0-299
event->SetDuration(Random(300));
TBuf<KLogMaxDirectionLength> direction;
// Direction of the event is randomized
TInt randomDirection = Random(2); // randomize direction
TInt dirID = 0;
switch (randomDirection)
{
case 0:
dirID = R_LOG_DIR_IN;
break;
case 1:
dirID = R_LOG_DIR_OUT;
break;
default:
break;
}
// Human readable presentations of directions
// with CLogClient::GetString()-method
iLogClient->GetString(direction, dirID);
// Set the direction
event->SetDirection(direction);
TInt randomEventType = Random(6); // randomize event type
TUid eventTypeID = KLogCallEventTypeUid;
switch (randomEventType)
{
case 0:
eventTypeID = KLogCallEventTypeUid; //Voice call
break;
case 1:
eventTypeID = KLogDataEventTypeUid; // Data call
break;
case 2:
eventTypeID = KLogFaxEventTypeUid; // Fax call
break;
case 3:
eventTypeID = KLogShortMessageEventTypeUid; // SMS call
break;
case 4:
eventTypeID = KLogMailEventTypeUid; // Email
break;
case 5:
eventTypeID = KLogTaskSchedulerEventTypeUid; // Task scheduler event
break;
default:
User::Panic(KEngineDefaultSwitch,1);
break;
}
event->SetEventType(eventTypeID);
event->SetSubject(KOwnEventSubject);
TTime time; // creation time from the device clock
time.HomeTime();
event->SetTime(time);
TBuf<KLogMaxNumberLength> number; // Randomize number
number.AppendNum(Random(7000000));
event->SetNumber(number);
event->SetRemoteParty(KOwnEventRemoteParty);
return event;
}
// ----------------------------------------------------
// CLogExEngine::Random(const TInt& aLimiter)
// Creates random number
// ----------------------------------------------------
//
TInt CLogExEngine::Random(const TInt& aLimiter)
{
TTime time;
time.HomeTime();
TInt64 smallRandSeed=time.Int64();
TInt number = Math::Rand(smallRandSeed)%aLimiter;
return number;
}
//End of file
in my appui:
void CAppui:eleteLog(CLogEvent *aEvent)
{
TBuf<22>ss;
TInt c;
c = iLogEvents->Count();
ss.AppendNum(c);
ss.Append(_L(" "));
TInt v;
v =iLogEvents->Length();
ss.AppendNum(v);
if(iLogEvents == NULL)
{
CEikonEnv::Static()->AlertWin(_L("null"),ss);
}
else
{
CEikonEnv::Static()->AlertWin(_L("non null"),ss);
}
TLogId selectedId;
selectedId = iLogEvents->At(0)->Id();
CEikonEnv::Static()->AlertWin(_L("leggo eventi"));
iLogEngine->DeleteEventL(selectedId);
CEikonEnv::Static()->AlertWin(_L("fine log"));
}
What is the problem?
Thanks
Silvia