[maemo-developers] Starting a 3G traffic monitoring application for N900: some questions

From: Harald Schmitt linux at hschmitt.de
Date: Mon Nov 29 17:02:36 EET 2010
Am 29.11.2010 15:14, schrieb Mohammad Abu-Garbeyyeh:
> Hi,
>
> On 11/29/2010 04:04 PM, a.grandi at gmail.com wrote:
>> Hi all,
>>
>> I'd like to write an application that allows me to monitor the 3G data
>> traffic on my N900.
>> I've an option called "SuperInternet" with Tre Italy that gives you
>> 100Mb/day Internet traffic.
>>
>> It's not easy to keep track of transfered data, so I'd like to write a
>> desktop applet that monitor traffic and keep the amount updated.
>> I'm going to write this in Qt/C++.
>>
>> I've some question before starting:
>>
>> 1) How can I detect, from a Qt/C++ application, if a 3G connection is
>> estabilished and when it disconnects?
>>
>> 2) Is it ok if I monitor the trasmitted/received data using ifconfig?
>> If yes, how can I execute ifconfig from an application running as
>> user? (Usually you can only execute ifconfig if you "sudo gainroot"
>> before).
>>
>> Thanks for your help!
>>
>
> You can use DBus to monitor 3G connection states, run dbus-monitor
> --system in a shell to see the paths send, then you can just use QtDbus
> to connect a signal to a function in your app.
>
> I'm not sure if ifconfig is the right way (you might also be able to use
> DBus, I see something about DataCounters in dbus-monitor too), but if
> you find it good enough, you can run /sbin/ifconfig and use QProcess and
> read standard output, the reason you can't run it as user is that /sbin
> isn't in user's $PATH (at least not by default ;))
>
> Regards,
> Mohammad Abu-Garbeyyeh

You can have a look at "Personal Dataplan Monitor"
http://maemo.org/packages/view/personal-gprs-mon/
and "Netstory".
http://maemo.org/packages/view/netstory/
Maybe they do what you want and you can combine the best of both.

Best regards,
Harald

More information about the maemo-developers mailing list