Rework SIM D-Bus object intialization, placing it in its own method so it can have its own try-again-timer
Make debug output a little more descriptive git-svn-id: http://www.neo1973-germany.de/svn@120 46df4e5c-bc4e-4628-a0fc-830ba316316d
This commit is contained in:
parent
2a739e1378
commit
ce0260dbc1
1 changed files with 27 additions and 14 deletions
|
@ -127,6 +127,7 @@ class MainScreen(EdjeGroup):
|
|||
class PyneoController(object):
|
||||
_dbus_timer = None
|
||||
_gsm_timer = None
|
||||
_keyring_timer = None
|
||||
_callbacks = {}
|
||||
|
||||
gsm = None
|
||||
|
@ -162,7 +163,7 @@ class PyneoController(object):
|
|||
class_.gsm_wireless = object_by_url(class_.gsm.GetDevice('wireless'))
|
||||
|
||||
except Exception, e:
|
||||
print "XXXXXXX1 " + str(e)
|
||||
print "Pyneo error: " + str(e)
|
||||
if not class_._dbus_timer:
|
||||
class_._dbus_timer = ecore.timer_add(5, class_.init)
|
||||
|
||||
|
@ -178,18 +179,6 @@ 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:
|
||||
|
@ -200,7 +189,7 @@ class PyneoController(object):
|
|||
print '---', 'switching device on'
|
||||
|
||||
except Exception, e:
|
||||
print "XXXXXXX2 " + str(e)
|
||||
print "GSM error: " + str(e)
|
||||
if not class_._gsm_timer:
|
||||
class_._gsm_timer = ecore.timer_add(5, class_.power_up_gsm)
|
||||
|
||||
|
@ -210,6 +199,30 @@ class PyneoController(object):
|
|||
# No error (anymore)
|
||||
if class_._gsm_timer: class_._gsm_timer.stop()
|
||||
|
||||
# Now we can request the keyring object for the SIM, it didn't exist before powering up
|
||||
class_.get_gsm_keyring()
|
||||
|
||||
@classmethod
|
||||
def get_gsm_keyring(class_):
|
||||
try:
|
||||
class_.gsm_keyring = object_by_url(class_.gsm_wireless.GetKeyring())
|
||||
|
||||
except Exception, e:
|
||||
print "SIM error: " + str(e)
|
||||
if not class_._keyring_timer:
|
||||
class_._keyring_timer = ecore.timer_add(5, class_.get_gsm_keyring)
|
||||
|
||||
# We had an error, keep the timer running if we were called by ecore
|
||||
return True
|
||||
|
||||
# No error (anymore)
|
||||
if class_._keyring_timer: class_._keyring_timer.stop()
|
||||
|
||||
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 gsm_sim_locked(class_):
|
||||
|
|
Loading…
Reference in a new issue