| Note! |
|---|
|
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.
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 link Connection monitoring API
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
No related wiki articles found