diff --git a/epydial/data/themes/blackwhite/gsm_status.edc b/epydial/data/themes/blackwhite/gsm_status.edc index 717c946..cbf4b9a 100644 --- a/epydial/data/themes/blackwhite/gsm_status.edc +++ b/epydial/data/themes/blackwhite/gsm_status.edc @@ -151,7 +151,7 @@ collections { } } part { - name: "gsm_caption"; + name: "pwr_caption"; type: TEXTBLOCK; mouse_events: 0; description { @@ -165,7 +165,23 @@ collections { style: "textblock_style"; } } - } /* end fix_caption */ + } /* end gsm_caption */ + part { + name: "device_caption"; + type: TEXTBLOCK; + mouse_events: 0; + description { + color_class: "button_inactive"; + align: 0.5 0.5; + fixed: 1 1; + rel1 { relative: 0 11/20; } + rel2 { relative: 1 18/20; } + text { + text: "gsm"; + style: "textblock_style"; + } + } + } /* end gsm_caption */ BUTTON(11, 1/3, 58/70, 2/3, 68/70, "on"); BUTTON(12, 0, 58/70 , 1/3, 68/70, "<"); /*BUTTON(13, 2/3, 58/70, 3/3, 68/70, ">");*/ diff --git a/epydial/dialer_screen.py b/epydial/dialer_screen.py index 0e771f3..f96db98 100644 --- a/epydial/dialer_screen.py +++ b/epydial/dialer_screen.py @@ -18,15 +18,13 @@ class DialerScreen(EdjeGroup): self.display_time() self.part_text_set("numberdisplay_text", "Wait ...") - PyneoController.power_up_gsm() - PyneoController.get_gsm_keyring() def register_pyneo_callbacks(self): PyneoController.register_callback("sim_key_required", self.on_sim_key_required) PyneoController.register_callback("sim_ready", self.on_sim_ready) PyneoController.register_callback("gsm_registering", self.on_gsm_registering) PyneoController.register_callback("gsm_registered", self.on_gsm_registered) - PyneoController.register_callback("gsm_dialing", self.on_gsm_dialing) +# PyneoController.register_callback("gsm_dialing", self.on_gsm_dialing) PyneoController.register_callback("gsm_operator_change", self.on_gsm_operator_change) PyneoController.register_callback("gsm_signal_strength_change", self.on_gsm_signal_strength_change) @@ -45,9 +43,9 @@ class DialerScreen(EdjeGroup): def on_gsm_registered(self): self.part_text_set("numberdisplay_text", "Dial when ready") - def on_gsm_dialing(self): - print '---', 'dial number' - self.part_text_set("numberdisplay_text", "Dialing ...") +# def on_gsm_dialing(self): +# print '---', 'dial number' +# self.part_text_set("numberdisplay_text", "Dialing ...") def on_gsm_operator_change(self, operator): self.part_text_set("operater_text", operator) @@ -108,6 +106,7 @@ class DialerScreen(EdjeGroup): self.text = [] self.part_text_set("numberdisplay_text", "".join(self.text)) PyneoController.power_status_gsm() + PyneoController.get_pwr_status() PyneoController.show_gsm_status_screen() elif source == "dial" and ''.join(self.text) == "2": print '--- Gps Status' @@ -116,5 +115,6 @@ class DialerScreen(EdjeGroup): PyneoController.power_status_gps() PyneoController.show_gps_status_screen() elif source == "dial": + PyneoController.show_incall_screen('outgoing') PyneoController.gsm_dial("".join(self.text)) diff --git a/epydial/epydial.py b/epydial/epydial.py index c7d6cfa..3cf0af0 100755 --- a/epydial/epydial.py +++ b/epydial/epydial.py @@ -78,6 +78,8 @@ class PyneoController(object): gsm_wireless_status = None gsm_keyring_status = None + + call_type = None @classmethod def register_callback(class_, event_name, callback): @@ -105,6 +107,7 @@ class PyneoController(object): class_.gsm_wireless = object_by_url(class_.gsm.GetDevice('wireless')) class_.pwr = object_by_url('dbus:///org/pyneo/Power') class_.gps = object_by_url('dbus:///org/pyneo/GpsLocation') + class_.call_type = 'nix' except Exception, e: print "Pyneo error: " + str(e) @@ -121,6 +124,8 @@ class PyneoController(object): class_.gsm_wireless.connect_to_signal("Status", class_.on_gsm_wireless_status, dbus_interface=DIN_WIRELESS) class_.pwr.connect_to_signal("Status", class_.on_pwr_status, dbus_interface=DIN_POWERED) + @classmethod + def get_pwr_status(class_): status = class_.pwr.GetStatus(dbus_interface=DIN_POWERED) class_.on_pwr_status(status) @@ -148,14 +153,6 @@ class PyneoController(object): # No error (anymore) if class_._gsm_timer: class_._gsm_timer.stop() - # Register our own D-Bus Gps callbacks - class_.gps.connect_to_signal("Position", class_.on_gps_position_status, dbus_interface=DIN_LOCATION) - - class_.notify_callbacks("gps_power_status", class_.gps.GetPower(APP_TITLE, dbus_interface=DIN_POWERED)) - - status = class_.gps.GetPosition(dbus_interface=DIN_LOCATION) - class_.on_gps_position_status(status) - @classmethod def get_gsm_keyring(class_): try: @@ -196,7 +193,7 @@ class PyneoController(object): # Initialize "active call" counter class_._calls[call] = 1 - class_.notify_callbacks("gsm_dialing") +# class_.notify_callbacks("gsm_dialing") @classmethod def gsm_hangup(class_): @@ -212,6 +209,7 @@ class PyneoController(object): # if call: call.Hangup(dbus_interface=DIN_CALL) os.system('alsactl -f /usr/share/openmoko/scenarios/stereoout.state restore') + class_.call_type = 'nix' # Remove the call from our list # class_._calls.__delitem__(call_obj) @@ -239,11 +237,11 @@ class PyneoController(object): if status.has_key('phone_activity_status'): ph_status = status['phone_activity_status'] - if ph_status == 0: - class_.pwr.BlinkenLeds("power:blue", 0, 0, 0, dbus_interface=DIN_POWER) + if ph_status == 0 and class_.call_type != 'outgoing': +# class_.pwr.BlinkenLeds("power:blue", 0, 0, 0, dbus_interface=DIN_POWER) class_.notify_callbacks("gsm_phone_call_end") if ph_status == 3: - class_.pwr.BlinkenLeds("power:blue", 400, 1300, 0, dbus_interface=DIN_POWER) +# class_.pwr.BlinkenLeds("power:blue", 400, 1300, 0, dbus_interface=DIN_POWER) class_.notify_callbacks("gsm_phone_ringing") if ph_status == 4: class_.notify_callbacks("gsm_phone_call_start") @@ -336,6 +334,12 @@ class PyneoController(object): def show_gps_status_screen(class_): class_.notify_callbacks("show_gps_status_screen") + @classmethod + def show_incall_screen(class_, calling_type): + class_.call_type = calling_type + print "CALLING_TYPE: ", class_.call_type + class_.notify_callbacks("gsm_phone_call_start") + from dialer_screen import * from incall_screen import * @@ -354,19 +358,7 @@ class Dialer(object): self.evas_canvas = EvasCanvas(FULLSCREEN, "x11-16") self.screens = {} - - self.init_screen(DIALER_SCREEN_NAME, DialerScreen(self)) - self.init_screen(INCALL_SCREEN_NAME, InCallScreen(self)) - self.init_screen(GSM_STATUS_SCREEN_NAME, GsmStatusScreen(self)) - self.init_screen(GPS_STATUS_SCREEN_NAME, GpsStatusScreen(self)) - - self.show_screen(DIALER_SCREEN_NAME) - - # Initialize the D-Bus interface to pyneo - dbus_ml = e_dbus.DBusEcoreMainLoop() - self.system_bus = SystemBus(mainloop=dbus_ml) - PyneoController.init() - + # Register our own callbacks PyneoController.register_callback("gsm_phone_ringing", self.on_ringing) PyneoController.register_callback("gsm_phone_call_start", self.on_call_start) @@ -374,6 +366,21 @@ class Dialer(object): PyneoController.register_callback("show_gsm_status_screen", self.on_gsm_status_screen) PyneoController.register_callback("show_gps_status_screen", self.on_gps_status_screen) PyneoController.register_callback("show_dialer_screen", self.on_call_end) + + # Initialize the D-Bus interface to pyneo + dbus_ml = e_dbus.DBusEcoreMainLoop() + self.system_bus = SystemBus(mainloop=dbus_ml) + PyneoController.init() + + self.init_screen(DIALER_SCREEN_NAME, DialerScreen(self)) + PyneoController.show_dialer_screen() +# self.show_screen(DIALER_SCREEN_NAME) + self.init_screen(INCALL_SCREEN_NAME, InCallScreen(self)) + self.init_screen(GSM_STATUS_SCREEN_NAME, GsmStatusScreen(self)) + self.init_screen(GPS_STATUS_SCREEN_NAME, GpsStatusScreen(self)) + + PyneoController.power_up_gsm() + PyneoController.get_gsm_keyring() def init_screen(self, screen_name, instance): self.screens[screen_name] = instance diff --git a/epydial/gps_status_screen.py b/epydial/gps_status_screen.py index 6704d76..0da8633 100644 --- a/epydial/gps_status_screen.py +++ b/epydial/gps_status_screen.py @@ -10,8 +10,6 @@ from epydial import * class GpsStatusScreen(EdjeGroup): def __init__(self, screen_manager): EdjeGroup.__init__(self, screen_manager, GPS_STATUS_SCREEN_NAME) - self.first = 0.0 - self.last = 0.0 def register_pyneo_callbacks(self): PyneoController.register_callback("power_status_gps", self.on_power_status_gps) @@ -25,10 +23,8 @@ class GpsStatusScreen(EdjeGroup): self.part_text_set("gps_caption", "gps device is %s"%p_status) def on_gps_position_change(self, status): - if status['fix'] == 1: - self.last = time.time() - print 'TIME TO FIX: ', self.last-self.first - self.part_text_set("gps_caption", "fix: %s
long/lat: %f/%f
altitude: %d
kph/course: %d/%d
satellites: %s"%(status['fix'], status['longitude'], status['latitude'], status['altitude'], status['kph'], status['course'], status['satellites'])) + if status['fix'] != 0: + self.part_text_set("gps_caption", "fix: %d
long/lat: %f/%f
altitude: %d
kph/course: %d/%d
satellites: %d"%(status['fix'], status['longitude'], status['latitude'], status['altitude'], status['kph'], status['course'], status['satellites'])) else: self.part_text_set("gps_caption", "fix: NIX FIX") @@ -37,9 +33,8 @@ class GpsStatusScreen(EdjeGroup): status = self.part_text_get("button_11_caption") if source == "<": PyneoController.show_dialer_screen() - if source == "on" and status == "on": PyneoController.power_down_gps() + if source == "on" and status == "on": + PyneoController.power_down_gps() elif source == "on" and status == "off": - self.first = time.time() PyneoController.power_up_gps() - diff --git a/epydial/gsm_status_screen.py b/epydial/gsm_status_screen.py index 4e17e58..2e7ec7a 100644 --- a/epydial/gsm_status_screen.py +++ b/epydial/gsm_status_screen.py @@ -16,14 +16,14 @@ class GsmStatusScreen(EdjeGroup): PyneoController.register_callback("pwr_status_change", self.on_pwr_status_change) def on_pwr_status_change(self, status): - self.part_text_set("gsm_caption", "battvolt: %f
chgstate: %s"%(status['battvolt'], status['chgstate'])) + self.part_text_set("pwr_caption", "battemp: %s
chgmode: %s
chgstate: %s
chgcur: %s
battvolt: %f"%(status['battemp'], status['chgmode'], status['chgstate'], status['chgcur'], status['battvolt'])) def on_power_status_gsm(self, status): if status: p_status = "on" else: p_status = "off" print '--- gsm device is ', p_status self.part_text_set("button_11_caption", p_status) - self.part_text_set("gsm_caption", "gsm device is %s"%p_status) + self.part_text_set("pwr_caption", "gsm device is %s"%p_status) @edje.decorators.signal_callback("gsm_send", "*") def on_edje_signal_dialer_status_triggered(self, emission, source):