split the dbus initialisation and fixed gsm_wireless_status

git-svn-id: http://www.neo1973-germany.de/svn@117 46df4e5c-bc4e-4628-a0fc-830ba316316d
This commit is contained in:
fgau 2008-09-02 16:57:10 +00:00
parent 8e6d08c3b2
commit 60f1bd4e8f

View file

@ -175,7 +175,6 @@ class PyneoController(object):
try:
class_.gsm = object_by_url('dbus:///org/pyneo/GsmDevice')
class_.gsm_wireless = object_by_url(class_.gsm.GetDevice('wireless'))
class_.gsm_keyring = object_by_url(class_.gsm_wireless.GetKeyring())
except Exception, e:
print "XXXXXXX1 " + str(e)
@ -190,7 +189,6 @@ class PyneoController(object):
# Register our own D-Bus callbacks
class_.gsm_wireless.connect_to_signal("Status", class_.on_gsm_wireless_status, dbus_interface=DIN_WIRELESS)
class_.gsm_keyring.connect_to_signal("Opened", class_.on_gsm_keyring_status, dbus_interface=DIN_KEYRING)
# Notify all screens that the interfaces are here so that they can connect their signal callbacks
class_.notify_callbacks("init")
@ -198,6 +196,18 @@ class PyneoController(object):
# D-Bus is ready, let's power up GSM
class_.power_up_gsm()
try:
class_.gsm_keyring = object_by_url(class_.gsm_wireless.GetKeyring())
except Exception, e:
print "XXXSIM " + str(e)
class_.gsm_keyring.connect_to_signal("Opened", class_.on_gsm_keyring_status, dbus_interface=DIN_KEYRING)
# Inquire SIM status and act accordingly to the initial state
status = class_.gsm_keyring.GetOpened(dbus_interface=DIN_KEYRING)
class_.on_gsm_keyring_status(status)
@classmethod
def power_up_gsm(class_):
try:
@ -218,9 +228,6 @@ class PyneoController(object):
# No error (anymore)
if class_._gsm_timer: class_._gsm_timer.stop()
# Inquire SIM status and act accordingly to the initial state
status = class_.gsm_keyring.GetOpened(dbus_interface=DIN_KEYRING)
class_.on_gsm_keyring_status(status)
@classmethod
def gsm_sim_locked(class_):
@ -246,7 +253,8 @@ class PyneoController(object):
class_.gsm_net_status = status
print "GSM NET Status: " + str(status)
nw_status = status["stat"]
if status.has_key('stat'):
nw_status = status['stat']
if nw_status == 0:
class_.notify_callbacks("gsm_unregistered")