×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jan 2012
    Posts
    110

    Don't read callog.

    I am use Ex: http://www.developer.nokia.com/Commu...i/Logs_Example read callog.

    File header:
    #include <F32FILE.H>
    #include <LOGVIEW.H>
    #include <logcli.h>

    class MLogCallBack
    {
    public:
    virtual void HandleLogEventL(const CLogEvent& event) = 0;
    virtual void LogProcessed(TInt aError) = 0;
    };


    class CCallLogReader: public CActive
    {
    enum TCallLogReaderState
    {
    ECreatingView,
    EReadingEntries,
    EReadingLast,
    Esleep
    };

    public: // constructors and destructor
    static CCallLogReader* NewL(MLogCallBack* aCallBack);
    static CCallLogReader* NewLC(MLogCallBack* aCallBack);
    ~CCallLogReader();

    public: // from CActive
    void DoCancel();
    void RunL();

    private: // constructors
    CCallLogReader(MLogCallBack* aCallBack);
    void ConstructL();
    void DoneReadingL(TInt aError);
    public:
    void ReadEvent();
    private: // data
    TCallLogReaderState iEngineState;
    CLogClient* iLogClient;
    CLogViewEvent* iLogView;
    CLogViewRecent* iLogRecent;
    CLogFilter* iLogFilter;
    MLogCallBack* iCallBack;
    RFs iFsSession;
    };
    File .Cpp
    CCallLogReader* CCallLogReader::NewL(MLogCallBack* aCallBack)
    {
    CCallLogReader* self = CCallLogReader::NewLC(aCallBack);
    CleanupStack::Pop(self);
    return self;
    }

    CCallLogReader* CCallLogReader::NewLC(MLogCallBack* aCallBack)
    {
    CCallLogReader* self = new (ELeave) CCallLogReader(aCallBack);
    CleanupStack::PushL(self);
    self->ConstructL();
    return self;
    }

    CCallLogReader::CCallLogReader(MLogCallBack* aCallBack)
    :CActive(CActive::EPriorityStandard),iCallBack(aCallBack)
    {
    }

    CCallLogReader::~CCallLogReader()
    {
    Cancel();
    delete iLogView, iLogView = NULL;
    delete iLogFilter, iLogFilter = NULL;
    delete iLogClient, iLogClient = NULL;
    iFsSession.Close();
    }

    void CCallLogReader::ConstructL(void)
    {


    User::LeaveIfError(iFsSession.Connect());

    iLogClient = CLogClient::NewL(iFsSession);
    iLogView = CLogViewEvent::NewL(*iLogClient);
    iLogRecent = CLogViewRecent::NewL(*iLogClient);
    iLogFilter = CLogFilter::NewL();
    iEngineState = Esleep;
    CActiveScheduler::Add(this);
    }

    void CCallLogReader:oCancel()
    {
    if(iLogView)
    iLogView->Cancel();

    if(iLogClient)
    iLogClient->Cancel();
    }

    void CCallLogReader::RunL()
    {
    switch (iEngineState)
    {
    case Esleep:
    break;

    case EReadingEntries:
    {
    if(iLogView)
    {
    if (iCallBack)
    {
    iCallBack->HandleLogEventL(iLogView->Event());
    }
    else
    {
    iEngineState = Esleep;
    DoneReadingL(KErrNone);
    break;
    }

    if (iLogView->NextL(iStatus))
    {
    SetActive();
    }
    else
    {
    DoneReadingL(KErrNone);
    }
    }
    break;
    }
    default:
    break;
    }
    }


    void CCallLogReader::ReadEvent()
    {
    if(iLogView->SetFilterL(*iLogFilter, iStatus))
    {
    iEngineState = EReadingEntries;
    SetActive();
    }
    else
    {
    DoneReadingL(KErrNone);
    }
    }

    void CCallLogReader:oneReadingL(TInt aError)
    {
    iCallBack->LogProcessed(aError);
    }
    in My Class , i am call:

    iCallLog = CCallLogReader::NewL(this);
    iCallLog->ReadEvent();
    void MuClassView::HandleLogEventL(const CLogEvent& event)
    {
    TBuf<20> Number, Direction, Name;
    TLogDuration Duration;
    TTime aTime;

    Number.Copy(event.Number());
    Name.Copy(event.Description());
    Direction.Copy(event.Direction());
    Duration = event.Duration();
    aTime = event.Time();

    RFile file;
    TBuf8<100> buf;
    /* Open a file if it exists, otherwise create new one*/
    if (KErrNone != file.Open(CCoeEnv::Static()->FsSession(), _L("E:\\CallLog.txt"), EFileWrite))
    {
    file.Replace(CCoeEnv::Static()->FsSession(), _L("E:\\CallLog.txt"), EFileWrite);
    }

    TInt pos = 0;
    file.Seek(ESeekEnd, pos);

    file.Write(_L8("\n\nName : "));
    buf.Copy(Name);
    file.Write(buf);

    file.Write(_L8("\nNumber : "));
    buf.Copy(Number);
    file.Write(buf);

    file.Write(_L8("\nDirection : "));
    buf.Copy(Direction);
    file.Write(buf);

    file.Write(_L8("\nTime : "));

    TBuf<50> dateString;
    _LIT(KDateString3,"%D%M%Y%/0%1%/1%2%/2%3%/3");
    aTime.FormatL(dateString,KDateString3);
    buf.Copy(dateString);
    buf.Append(_L(" - "));
    _LIT(KDateString5,"%-B%:0%J%:1%T%:2%S%:3%+B");
    aTime.FormatL(dateString,KDateString5);
    buf.Append(dateString);
    file.Write(buf);

    file.Write(_L8("\nDuration : "));
    buf.Num(Duration);
    file.Write(buf);
    file.Close();

    }
    but I only get results by WLAN connection.
    Can anyone help me! Thanks!

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: Don't read callog.

    What excatly is happening when you try the code, and what do you expect to happen instead ?

    Also if you use example without modifications, then do not paste the code here, just refer to teh example. And if you did modify the code, you could first check whether the modification did make the difference in operations.

Similar Threads

  1. Replies: 0
    Last Post: 2008-11-07, 14:45
  2. recv, read, recvoneormore do not read from socket
    By hansapariya in forum Symbian
    Replies: 1
    Last Post: 2008-02-11, 16:20
  3. how to read read and write the calendar entries
    By Basu in forum Mobile Java General
    Replies: 2
    Last Post: 2007-12-13, 10:22
  4. Nokia 3230 and S.E k300i can not handle http Connection read while n6030 can read
    By jasmitvala in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2006-03-21, 14:01
  5. Replies: 3
    Last Post: 1970-01-01, 02:00

Posting Permissions

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