×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Regular Contributor
    Join Date
    May 2004
    Location
    NRW/ Germany
    Posts
    188

    Read out Connection Manager GPRS

    Hi,

    I want to read out the data which is presented to the user in the connection manager. First of all data in and data out, duration and what apn was used.

    I've tried to write an AO which monitors the Status of the System Agent GPRS Status and it works so far. Furthermore, I've changed the AO for getting the voice call data to get the gprs call data.

    My problem is that the data Buf remains empty when it is called.
    I think it'll be something about AO and when to call the AO for getting the data from log server.
    Please look into the source. I would appreciate comments what I have to change or any other implementation to get the data. Maybe I'm completly wrong, don't know.

    So this is the AO which monitors the SystemAgent:

    CGprsMonitor* CGprsMonitor::NewL()
    {
    CGprsMonitor* self = NewLC();
    CleanupStack::Pop(self);
    return self;
    }

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

    // -----------------------------------------------------------------------
    // Construct object (private)
    // -----------------------------------------------------------------------
    CGprsMonitor::CGprsMonitor()
    : CActive(EPriorityStandard)
    {
    /*
    // Set the TRequestStatus for the event to use our iStatus
    iSysAgentEvent.SetRequestStatus(iStatus);
    // Set the iSysAgentEvent for monitoring the state variable with the requested UID
    // requested UID is KUidGprsStatus
    iSysAgentEvent.SetUid(KUidGprsStatus);
    */
    // Add this active object to the active scheduler
    CActiveScheduler::Add(this);
    }

    // -----------------------------------------------------------------------
    // Destroy object
    // -----------------------------------------------------------------------
    CGprsMonitor::~CGprsMonitor()
    {
    // Make sure this active object is cancelled and close connection to the System Agent
    Cancel();
    iSysAgent.Close();
    delete iGetGPRSLog;
    }

    // -----------------------------------------------------------------------
    // Construction leaving function (public)
    // -----------------------------------------------------------------------
    void CGprsMonitor::ConstructL()
    {
    iGetGPRSLog = CGetGPRSLog::NewL();
    // Set the TRequestStatus for the event to use our iStatus
    iSysAgentEvent.SetRequestStatus(iStatus);
    // Set the iSysAgentEvent for monitoring the state variable with the requested UID
    // requested UID is KUidGprsStatus
    iSysAgentEvent.SetUid(KUidGprsStatus);

    // Connect to the system agent
    User::LeaveIfError(iSysAgent.Connect());

    // Enable the event buffer to ensure no changes in the State Variable are missed,
    // the default expiry time is 10s
    iSysAgent.SetEventBufferEnabled(ETrue);

    // Add this active object to the active scheduler
    //CActiveScheduler::Add(this);
    }

    void CGprsMonitor::StartL()
    {
    iSysAgent.NotifyOnEvent(iSysAgentEvent);
    SetActive();
    }

    void CGprsMonitor::RunL()
    {
    //iSysAgent.NotifyOnEvent(iSysAgentEvent);
    TInt state = iSysAgent.GetState(iSysAgentEvent.Uid());
    if(state == 1) // should be Status attached
    {
    iSysAgent.NotifyOnEvent(iSysAgentEvent);
    iGetGPRSLog->GetLatest();
    }
    //TBuf<10> aBuf;
    //aBuf.AppendNum(state);
    //CEikonEnv::Static()->AlertWin(aBuf);
    //aBuf.Zero();
    StartL();
    }

    // -----------------------------------------------------------------------
    // DoCancel is necessary to cancel the AO
    // -----------------------------------------------------------------------
    void CGprsMonitor:oCancel()
    {
    iSysAgent.NotifyEventCancel();
    }


    and this is CGetGPRSLog:

    CGetGPRSLog::CGetGPRSLog(): CActive(EPriorityStandard)
    {
    }

    CGetGPRSLog::~CGetGPRSLog()
    {
    DoCancel();
    }

    CGetGPRSLog* CGetGPRSLog::NewL()
    {
    CGetGPRSLog* self = NewLC();
    CleanupStack::Pop();
    return(self) ;
    }

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


    void CGetGPRSLog::RunL()
    {
    if( iStatus == KErrNone)
    {

    const CLogEvent& event = iRecentLogView->Event();
    iData.Copy(event.Data());
    CAknInformationNote *thankyou = new(ELeave) CAknInformationNote;
    thankyou->ExecuteLD(iData);
    //thankyou->ExecuteLD(_L("TEST!"));
    }
    }

    void CGetGPRSLog::ConstructL()
    {
    // Connect to the Log Server
    iFs.Connect();
    iLogClient = CLogClient::NewL(iFs);
    iRecentLogView = CLogViewRecent::NewL(*iLogClient);
    filterList = new ( ELeave ) CLogFilterList();
    filter = CLogFilter::NewL();
    filter->SetEventType(KLogPacketDataEventTypeUid); //GPRS DATA PKT
    filterList->AppendL(filter);
    iFs.Close();
    CActiveScheduler::Add(this);
    }

    void CGetGPRSLog::GetLatest()
    {
    // Cancel any outstanding requests.
    iRecentLogView->Cancel();
    // Make a call into the Log server to get the latest call event.
    //just works after the call is finished
    if( iRecentLogView->SetRecentListL(KLogNullRecentList,iStatus))
    {
    // Notify the Log server that we're ready
    SetActive(); //tells the active scheduler a request is active
    }
    }

    void CGetGPRSLog:oCancel()
    {
    CActive::Cancel();
    // Cancel any outstanding requests.
    iRecentLogView->Cancel();
    }

  2. #2
    Regular Contributor
    Join Date
    May 2004
    Location
    NRW/ Germany
    Posts
    188
    Hi there

    no one who could help?

    Thanks

    Arne

  3. #3
    Regular Contributor
    Join Date
    May 2004
    Location
    NRW/ Germany
    Posts
    188
    Hi,

    I'm still struggling with this problem.
    In the meantime I've found the ELog application from PsiLoc. They can do the job and monitor the GPRS usage. Sadly I do not know how to achieve this.

    Help would be nice!

    Greetz and Thanks

    Arne

  4. #4
    Super Contributor
    Join Date
    Feb 2004
    Location
    Dallas
    Posts
    605
    Hi ,
    Have u been able to get the GPRS status using System Agent API.
    I am unable to find it in documentation ..
    Can u help me with the code ?

  5. #5
    Regular Contributor
    Join Date
    May 2004
    Location
    NRW/ Germany
    Posts
    188
    Hi,

    my code from above should do the job.
    The KUidGprsStatus is not documented in the SDK. I found it somewhere in another forum.
    I get the status of the GPRS connection right, but the call to the log remains empty in my code.

    Greetz

    Arne

  6. #6
    Super Contributor
    Join Date
    Feb 2004
    Location
    Dallas
    Posts
    605
    Thnx Arne .. I will try your code .

  7. #7
    Regular Contributor
    Join Date
    May 2004
    Location
    NRW/ Germany
    Posts
    188
    Little update:
    seems that monitoring the System Agent gives the wrong trigger for reading the logs.
    I've found different methods in RConnection to read out the traffic, duration, apn... will give it a try. Maybe someone can help me, how to a AO for monitoring GPRS connections. Searched the forum for RConnection, but found not enough information.
    At the moment I'm stuck with RConnection::GetConnectionInfo(). I don't know how to do the Pckg<ConnectionInfo>.

Posting Permissions

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