Bug 10084 - conic_monitor.py example broken
: conic_monitor.py example broken
Status: NEW
Product: PyMaemo
General
: unspecified
: All Maemo
: Unspecified normal with 1 vote (vote)
: ---
Assigned To: Anderson Lizardo
: general
: https://vcs.maemo.org/svn/pymaemo/pac...
: patch
:
:
  Show dependency tree
 
Reported: 2010-05-03 00:04 UTC by Mikko Vartiainen
Modified: 2010-05-31 23:21 UTC (History)
2 users (show)

See Also:


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description Mikko Vartiainen (reporter) 2010-05-03 00:04:23 UTC
EXACT STEPS LEADING TO PROBLEM: 
1. run conic_example.py (see URL) on device
2. connect/disconnect cellular/wifi connections
3. 

EXPECTED OUTCOME:
Lots of data is printed every time when data connection is made or
disconnected.
Example:
connection_cb(<conic.Connection object at 0x4081d508 (ConIcConnection at
0x1e0820)>, <conic.ConnectionEvent object at 0x4081d580 (ConIcConnectionEvent
at 0x1e1040)>)
(CONNECTED (0a87d55b-a726-44ed-89d0-8bb4fae5f752, WLAN_INFRA, 0, 0)

ACTUAL OUTCOME:
"connect():" is printed once on program startup , but nothing after that.

OTHER COMMENTS:
Following program does work.

#!/usr/bin/python2.5 
import conic
import gobject, dbus
from dbus.mainloop.glib import DBusGMainLoop

def connection_cb(connection, event):
    print "connection_cb(%s, %s)" % (connection, event)

    status = event.get_status()
    error = event.get_error()
    iap_id = event.get_iap_id()
    bearer = event.get_bearer_type()

    if status == conic.STATUS_CONNECTED:
        print "(CONNECTED (%s, %s, %i, %i)" % (iap_id, bearer, status, error)
    elif status == conic.STATUS_DISCONNECTED:
        print "(DISCONNECTED (%s, %s, %i, %i)" % (iap_id, bearer, status,
error)
    elif status == conic.STATUS_DISCONNECTING:
        print "(DISCONNECTING (%s, %s, %i, %i)" % (iap_id, bearer, status,
error)


if __name__ == "__main__":
    DBusGMainLoop(set_as_default=True)
    bus = dbus.SystemBus()
    connection = conic.Connection()
    connection.set_property("automatic-connection-events", True)
    connection.connect("connection-event", connection_cb)
    gobject.MainLoop().run()
Comment 1 Thomas Perl 2010-05-12 18:27:16 UTC
Might be related to bug 7729
Comment 2 Mikko Vartiainen (reporter) 2010-05-12 18:37:04 UTC
(In reply to comment #1)
> Might be related to bug 7729
> 

Yeah, it is. I just decided to make explicit bug about this example because I
have working example. Other python-conic examples can be fixed similar way as
this one.
Comment 3 Mikko Vartiainen (reporter) 2010-05-12 19:01:41 UTC
Thomas, does my example work for you?

I have used similar python-conic monitor in openvpn-applet to detect when GPRS
connection is established and it is working fine.
Comment 4 Thomas Perl 2010-05-12 19:29:17 UTC
(In reply to comment #3)
> Thomas, does my example work for you?

Yes, sorry, I overread your example. I just tried it and it works fine :)
Thanks!
Comment 5 Lauro Moura 2010-05-31 21:22:13 UTC
Removing bugs from depends/block lines. This is not related to documentation
and they already depend on 7729.

Mikko, your test is similar to test_automatic_events. The
automatic-connection-events property makes libconic emit the "connection-event"
signal for all connections and there is already an example for this.
test_connection should print the connection data only for the requested
connection.
Comment 6 Mikko Vartiainen (reporter) 2010-05-31 23:19:35 UTC
(In reply to comment #5)
> This is not related to documentation

In this page http://pymaemo.garage.maemo.org/conic.html these test cases are
used as examples, which is about closest thing to documentation availalebe for
python-conic (other thant C api documentation). Sorry for confusion

> Mikko, your test is similar to test_automatic_events. The
> automatic-connection-events property makes libconic emit the "connection-event"
> signal for all connections and there is already an example for this.

Just found that out. Sorry for the confusion again.

> test_connection should print the connection data only for the requested
> connection.

I didn't realise this, nevertheless result is same; data is not printed
Comment 7 Lauro Moura 2010-05-31 23:21:43 UTC
Oh, sorry. I meant "Removed bug dependencies as they are not related to
documentation".