×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Aug 2006
    Posts
    252

    CLogEvent problem

    Hi,
    what this a procedure for delete ol event log of phone?
    Thanks
    Silvia

  2. #2
    Regular Contributor
    Join Date
    Aug 2006
    Posts
    252

    Re: CLogEvent problem

    I don't want use Object active, is possible?

  3. #3
    Regular Contributor
    Join Date
    Aug 2006
    Posts
    252

    Re: CLogEvent problem

    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

Similar Threads

  1. Problem with eglSwapBuffers and heap corruption
    By greatape in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2007-05-24, 03:35
  2. netcards - Problem with opening adapter
    By kernj in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2007-01-10, 08:56
  3. WAP service problem on Apache
    By bigg_o in forum Browsing and Mark-ups
    Replies: 3
    Last Post: 2005-04-17, 16:05
  4. Problem: S60 SDK for CW in PC with .NET
    By anttij in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2005-02-28, 11:36

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •