Jump to content

GPRS Counter code - can anyone make an app from it?


Recommended Posts

Guest stevewright
Posted

I left the following message on the www.developers.orange.com forum:

Had my SPV since March, and didn't purchase a GPRS counter (All-locations is the only one?) as I was on Orange's unlimited "SPV Promotional pack", and it wasn't necessary.

Now I've been put on GPRS2 (although they didn't notify me), and a GPRS counter is essential.

After a long conversation to Customer Services, they said my only option was to purchase one.  

Any free ones out there being written? Only VERY basic functionality required (no fancy graphs, just one line of text telling my how many bytes sent/received), hence unwilling to pay ~£10

And received reply of:

Hello stevewright,

There are no freeware GPRS counters (to my knowledge) for the SPV.  

Also, there is no way to find out exactly how many bytes are attributed to any one application - without you metering the data inflow and transmission within that application.

In other words, if you can not count how many bytes of information flow in and out of your application, then there is no way to programatically get how much information you are sending and receiving.

You CAN get a count of the total octets received and transmitted by the SPV at any given time by using the following function:

//

// Does all the work of figuring out the GPRS raw data counter

//

// RAW GPRS data counter is in Octets - and does not care whether

// data was sent over GPRS or over some other interface (fastIR,

// Pass Through Connector, etc.).

//

// -- John Wolfe 17-Feb-2003

//

DWORD GetCurrentGPRSDataCounter()

{

DWORD dwResult = 0;

DWORD dwNumInterfaces = 0;

// ODS( TEXT("rnDoTest: Entryrn") );

dwResult = GetNumberOfInterfaces( &dwNumInterfaces );

if ( dwResult != NO_ERROR )

return 0;

DWORD dwTotalInOctets = 0;

DWORD dwTotalOutOctets = 0;

// TCHAR strText[400];

MIB_IFROW mibIFRow;

dwNumInterfaces++; // Love 1-based indexing systems!!!

for (int nIndex=1; (DWORD)nIndex

{

memset(&mibIFRow, 0, sizeof(mibIFRow));

mibIFRow.dwIndex = nIndex;

dwResult = GetIfEntry( &mibIFRow );

if ( dwResult == NO_ERROR )

{

// wsprintf(strText,

// TEXT("DoTest: Adapter #%d: InOctets=<0x%08X> OutOctets=<0x%08X> Desc=<%s>rn"),

// nIndex,

// mibIFRow.dwInOctets,

// mibIFRow.dwOutOctets,

// mibIFRow.wszName );

// ODS( strText );

dwTotalInOctets += mibIFRow.dwInOctets;

dwTotalOutOctets += mibIFRow.dwOutOctets;

}

}

// wsprintf(strText,

// TEXT("DoTest: TOTAL OCTETS IN = <0x%08X> TOTAL OCTETS OUT = <0x%08X>rnrn"),

// dwTotalInOctets,

// dwTotalOutOctets);

// OutputDebugString( strText );

// return rounded up to nearest kilobyte

return ( (dwTotalInOctets + dwTotalOutOctets + 1023) / 1024 );

}

With this, some enterprising person could easily put together a freeware application that counted how many octets of data flow in and out of your SPV.

Anyone up for the programming task?

-- John

__________________

John Wolfe

[email protected]

Challenge anyone?

Guest Gorskar
Posted

I'd love this app - I can't bring myself to buy the All-locations one as its really expensive for what should be an included app anyway.

If you could get it to watch what applications open, and stop counting when activesync opens (for passthrough connections) and maybe inbox(option) so it doesnt count sms and mms then it should work ok.

I'd do it myself if I had the foggiest idea how to!

Guest stevewright
Posted

Just found IMeter (beta) linked from www.smartphony.org

It counts SMS, MMS, Emails, Call timers AND GPRS!!!

It's all in French, but it's understandable.

Check out this website.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.