maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   Check internet connection on application start? (https://talk.maemo.org/showthread.php?t=51060)

zolakt 2010-04-26 09:31

Check internet connection on application start?
 
Hi,

I am developing an application for N900.
It requires an Internet connection to work.
The initial data is fetched from a web service.

So, on startup I need to check is there an internet connection.

If true continue loading the application, if not show the connections dialog (like in email application when you click send/recieve but no internet is connected).
Otherwise it will print errors in my comboboxes.

How to do this in Python?

qwerty12 2010-04-26 09:38

Re: Check internet connection on application start?
 
https://vcs.maemo.org/svn/pymaemo/pa...atic_events.py

What you need to look at is the instantiation of the Conic.Connection object, the setting of a callback function - look at what it does when the state == conic.STATUS_CONNECTED and the setting of the "automatic-connection-events" property to True.

zolakt 2010-04-26 12:21

Re: Check internet connection on application start?
 
Thanks for the info.

But how do you get the connection dialog if no network is connected?

zolakt 2010-04-27 10:52

Re: Check internet connection on application start?
 
I have been trying to get this running, but I run into some problems.

I initialise the gobject and the loop.
But the problem is that it loops all the time, and doesn't show my application main form.

I need to check connectivity just once, before the form is show. How can I do that?

qwerty12 2010-04-27 10:57

Re: Check internet connection on application start?
 
Are you using Qt? I have no idea then, sorry. Qt probably has a connectivity wrapper somewhere; you could try using that, instead, if it exists.

Alternatively, just use QDBus. ICD2 emits signals and has methods for getting the current state etc.

zolakt 2010-04-27 11:10

Re: Check internet connection on application start?
 
Quote:

Originally Posted by qwerty12 (Post 629696)
Are you using Qt? I have no idea then, sorry. Qt probably has a connectivity wrapper somewhere; you could try using that, instead, if it exists.

Alternatively, just use QDBus. ICD2 emits signals and has methods for getting the current state etc.

Yes, I'm using Qt.

Btw. When I try to execute
https://vcs.maemo.org/svn/pymaemo/pa...est_connect.py

It just prints "connect()"
No callback is done. On the phone and in scrathcbox.

Can you give me some more info on QDBus?


All times are GMT. The time now is 08:00.

vBulletin® Version 3.8.8