Namespaces
Variants
Actions

Data Connection Log Counters API

Jump to: navigation, search
Article Metadata

Code Example
Article
Created: ltomuta (16 Jun 2007)
Last edited: hamishwillee (08 May 2013)


Note.png
Note: :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 8 May 2013, at 02:59.
519 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved