Make PyneoControl.gsm_dial() work as expected
Add PyneoControl.gsm_hangup() git-svn-id: http://www.neo1973-germany.de/svn@121 46df4e5c-bc4e-4628-a0fc-830ba316316d
This commit is contained in:
parent
ce0260dbc1
commit
6f254d30e6
1 changed files with 21 additions and 5 deletions
|
@ -129,6 +129,7 @@ class PyneoController(object):
|
||||||
_gsm_timer = None
|
_gsm_timer = None
|
||||||
_keyring_timer = None
|
_keyring_timer = None
|
||||||
_callbacks = {}
|
_callbacks = {}
|
||||||
|
_calls = {}
|
||||||
|
|
||||||
gsm = None
|
gsm = None
|
||||||
gsm_wireless = None
|
gsm_wireless = None
|
||||||
|
@ -235,12 +236,27 @@ class PyneoController(object):
|
||||||
@classmethod
|
@classmethod
|
||||||
def gsm_dial(class_, number):
|
def gsm_dial(class_, number):
|
||||||
os.system('alsactl -f /usr/share/openmoko/scenarios/gsmhandset.state restore')
|
os.system('alsactl -f /usr/share/openmoko/scenarios/gsmhandset.state restore')
|
||||||
|
|
||||||
name = class_.gsm_wireless.Initiate(number, dbus_interface=DIN_VOICE_CALL_INITIATOR, timeout=200)
|
name = class_.gsm_wireless.Initiate(number, dbus_interface=DIN_VOICE_CALL_INITIATOR, timeout=200)
|
||||||
|
call = object_by_url(name)
|
||||||
|
|
||||||
|
# Initialize "active call" counter
|
||||||
|
class_._calls[call] = 1
|
||||||
|
|
||||||
class_.notify_callbacks("gsm_dialing")
|
class_.notify_callbacks("gsm_dialing")
|
||||||
|
|
||||||
time.sleep(20)
|
@classmethod
|
||||||
call = object_by_url(name)
|
def gsm_hangup(class_, number):
|
||||||
call.Hangup(dbus_interface=DIN_CALL)
|
# Find call with highest "active call" counter - it'll be the one currently active
|
||||||
|
call = None
|
||||||
|
highest = 0
|
||||||
|
|
||||||
|
for (call_obj, counter) in class_._calls.items():
|
||||||
|
if counter > highest:
|
||||||
|
highest = counter
|
||||||
|
call = call_obj
|
||||||
|
|
||||||
|
if call: call.Hangup(dbus_interface=DIN_CALL)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def on_gsm_wireless_status(class_, status_map):
|
def on_gsm_wireless_status(class_, status_map):
|
||||||
|
|
Loading…
Reference in a new issue