×
Namespaces

Variants
Actions

Data Connection Log Counters API

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Code ExampleArticle
Created: ltomuta (16 Jun 2007)
Last edited: hamishwillee (30 May 2013)


Note.pngNote: :This API is not part of the public SDK. It can be found in the SDK API Plug-in.

The Data Connection Log Counters API provides central repository keys using which we can get the total amount of data sent and recieved using GPRS and WLAN.

Use cases

These APIs can be used in an application, which is developed to send/recieve data using WLAN/GPRS, to check the data transfer rate over specified duration.

They can be also used to check the amount of data transfered by your application by checking the log counters before and after data transfer. You can also monitor any data connection and get the data amounts by using File:RConMon Example.zip

Note that the logs can be disabled by the user using the Log application!

Example code

Headers Used

#include <centralrepository.h>
#include <dclcrkeys.h> # or <dclinternalcrkeys.h>

Link against

LIBRARY   centralrepository.lib

The following code displays the total data sent using GPRS :

// We need to Query Central Repository.
CRepository* cRepository = CRepository::NewLC( KCRUidDCLLogs );
 
// Get the data in bytes
TBuf<50> bytes;
User::LeaveIfError( cRepository->Get( KLogsGPRSSentCounter, bytes ) );
 
// To display message
 
CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
TBuf<100> msg;
msg.Copy(_L("Data in bytes : "));
msg.Append(bytes) ;
 
informationNote->ExecuteLD(msg);
 
CleanupStack::PopAndDestroy();



The following code displays the total data received using GPRS :

// We need to Query Central Repository.
CRepository* cRepository = CRepository::NewLC( KCRUidDCLLogs );
 
// Get the data in bytes
TBuf<50> bytes;
User::LeaveIfError( cRepository->Get( KLogsGPRSReceivedCounter, bytes ) );
 
// To display message
 
CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
TBuf<100> msg;
msg.Copy(_L("Data in bytes : "));
msg.Append(bytes) ;
 
informationNote->ExecuteLD(msg);
 
CleanupStack::PopAndDestroy();



The following code displays the total data sent using WLAN :

// We need to Query Central Repository.
CRepository* cRepository = CRepository::NewLC( KCRUidDCLLogs );
 
// Get the data in bytes
TBuf<50> bytes;
User::LeaveIfError( cRepository->Get( KLogsWLANSentCounter, bytes ) );
 
// To display message
 
CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
TBuf<100> msg;
msg.Copy(_L("Data in bytes : "));
msg.Append(bytes) ;
 
informationNote->ExecuteLD(msg);
 
CleanupStack::PopAndDestroy();

The following code displays the total data received using WLAN :

// We need to Query Central Repository.
CRepository* cRepository = CRepository::NewLC( KCRUidDCLLogs );
 
// Get the data in bytes
TBuf<50> bytes;
User::LeaveIfError( cRepository->Get( KLogsWLANReceivedCounter, bytes ) );
 
// To display message
 
CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
TBuf<100> msg;
msg.Copy(_L("Data in bytes : "));
msg.Append(bytes) ;
 
informationNote->ExecuteLD(msg);
 
CleanupStack::PopAndDestroy();

Note: The data display is in bytes


Example project

File:PacketDataCounters.zip

This page was last modified on 30 May 2013, at 04:37.
44 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×