maemo.org Bugzilla – Bug 10084
conic_monitor.py example broken
Last modified: 2010-05-31 23:21:43 UTC
You need to log in before you can comment on or make changes to this bug.
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()
Might be related to bug 7729
(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.
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.
(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!
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.
(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
Oh, sorry. I meant "Removed bug dependencies as they are not related to documentation".