add accept call

git-svn-id: http://www.neo1973-germany.de/svn@204 46df4e5c-bc4e-4628-a0fc-830ba316316d
This commit is contained in:
fgau 2008-11-03 18:34:09 +00:00
parent 5a3d06140f
commit 4cf11fd16c
6 changed files with 156 additions and 88 deletions

View file

@ -50,7 +50,7 @@ color_classes {
styles { styles {
style { style {
name: "textblock_style"; name: "textblock_style";
base: "font=sans.bold font_size=20 align=left valign=top color=#fff wrap=word"; base: "font=Vera font_size=20 align=left valign=top color=#fff";
tag: "h1" "+ font_size=28"; tag: "h1" "+ font_size=28";
tag: "/h1" "- \n"; tag: "/h1" "- \n";
tag: "p" "+"; tag: "p" "+";
@ -58,6 +58,10 @@ styles {
tag: "em" "+ style=underline underline_color=#000A underline2_color=#0005"; tag: "em" "+ style=underline underline_color=#000A underline2_color=#0005";
tag: "/em" "-"; tag: "/em" "-";
tag: "br" "\n"; tag: "br" "\n";
tag: "c1" "+ color=#fff";
tag: "/c1" "-";
tag: "c2" "+ color=#f3f";
tag: "/c2" "-";
} }
} }
@ -107,12 +111,6 @@ part { \
} \ } \
} \ } \
} \ } \
program { \
name: "button_"button_number"_signal_emit"; \
signal: "mouse,down,*"; \
source: "button_"button_number; \
action: SIGNAL_EMIT "gsm_send" button_caption; \
} \
program { \ program { \
name: "button_"button_number"_animation"; \ name: "button_"button_number"_animation"; \
signal: "mouse,down,*"; \ signal: "mouse,down,*"; \
@ -131,57 +129,13 @@ program { \
#define HBAR(barname, bordercolor, borderwidth, rel1x, rel1y, rel2x, rel2y, left_right_offset) \ #define HBAR(barname, bordercolor, borderwidth, rel1x, rel1y, rel2x, rel2y, left_right_offset) \
part { \ part { \
name: "border_left_"barname; \ name: "description_"barname; \
type: RECT; \
description { \
color_class: bordercolor; \
rel1 { relative: rel1x rel1y; offset: left_right_offset 0; }; \
rel2 { relative: rel1x rel2y; offset: (borderwidth+left_right_offset) 0; }; \
} \
} \
part { \
name: "border_right_"barname; \
type: RECT; \
description { \
color_class: bordercolor; \
rel1 { relative: rel2x rel1y; offset: (0-left_right_offset-borderwidth) 0; }; \
rel2 { relative: rel2x rel2y; offset: 0-left_right_offset 0; }; \
} \
} \
part { \
name: "border_bottom_"barname; \
type: RECT; \
description { \
color_class: bordercolor; \
rel1 { relative: rel1x rel2y; offset: (borderwidth+left_right_offset) -borderwidth; }; \
rel2 { relative: rel2x rel2y; offset: 0-left_right_offset 0; }; \
} \
} \
part { \
name: "border_top_left"barname; \
type: RECT; \
description { \
color_class: bordercolor; \
rel1 { relative: rel1x rel1y; offset: left_right_offset 0; }; \
rel2 { relative: rel2x/4 rel1y; offset: 0-left_right_offset borderwidth; }; \
} \
} \
part { \
name: "border_top_right"barname; \
type: RECT; \
description { \
color_class: bordercolor; \
rel1 { relative: 1-rel2x/4 rel1y; offset: left_right_offset 0; }; \
rel2 { relative: rel2x rel1y; offset: 0-left_right_offset borderwidth; }; \
} \
} \
part { \
name: "top_description_"barname; \
type: TEXT; \ type: TEXT; \
mouse_events: 0; \
description { \ description { \
color_class: bordercolor; \ color_class: bordercolor; \
rel1 { relative: 1-rel2x/2 rel1y; offset: -80 -10; }; \ rel1 { relative: rel1x rel1y; }; \
rel2 { relative: 1-rel2x/2 rel1y; offset: +80 10; }; \ rel2 { relative: rel2x rel2y; }; \
text { \ text { \
text: barname; \ text: barname; \
font: "VeraBd"; \ font: "VeraBd"; \
@ -189,6 +143,122 @@ part { \
} \ } \
} \ } \
} \ } \
part { \
name: "button_left_bg_"barname; \
type: RECT; \
description { \
state: "default" 0; \
color_class: "unvisible"; \
rel1 { relative: rel1x rel1y; offset: 0 0; }; \
rel2 { relative: rel2x/4 rel2y; offset: 0 0; }; \
} \
description { \
state: "default" 0.5; \
inherit: "default" 0; \
color_class: "unvisible"; \
rel1.offset: 0 -5; \
rel2.offset: 0 5; \
} \
description { \
state: "default" 1; \
inherit: "default" 0; \
} \
} \
part { \
name: "button_right_bg_"barname; \
type: RECT; \
description { \
state: "default" 0; \
color_class: "unvisible"; \
rel1 { relative: 1-rel2x/4 rel1y; offset: 0 0; }; \
rel2 { relative: rel2x rel2y; offset: 0 0; }; \
} \
description { \
state: "default" 0.5; \
inherit: "default" 0; \
color_class: "unvisible"; \
rel1.offset: 0 -5; \
rel2.offset: 0 5; \
} \
description { \
state: "default" 1; \
inherit: "default" 0; \
} \
} \
part { \
name: "button_left_"barname; \
type: TEXT; \
mouse_events: 0; \
description { \
state: "default" 0; \
color_class: bordercolor; \
rel1 { to: "button_left_bg_"barname; relative: 0 0; }; \
rel2 { to: "button_left_bg_"barname; relative: 1 1; }; \
text { \
text: "-"; \
font: "VeraBd"; \
size: 52; \
fit: 1 1; \
} \
} \
} \
part { \
name: "button_right_"barname; \
type: TEXT; \
mouse_events: 0; \
description { \
state: "default" 0; \
color_class: bordercolor; \
rel1 { to: "button_right_bg_"barname; relative: 0 0; }; \
rel2 { to: "button_right_bg_"barname; relative: 1 1; }; \
text { \
text: "+"; \
font: "VeraBd"; \
size: 52; \
fit: 1 1; \
} \
} \
} \
part { \
name: "scale_fg_"barname; \
type: RECT; \
mouse_events: 0; \
description { \
color_class: scale; \
rel1 { relative: rel2x/4 (rel1y+((rel2y-rel1y)/4)); }; \
rel2 { relative: 1-rel2x/4 (rel2y-((rel2y-rel1y)/4)); }; \
} \
} \
program { \
name: "button_left_bg_"barname"_animation"; \
signal: "mouse,down,*"; \
source: "button_left_bg_"barname; \
action: STATE_SET "default" 0.5; \
target: "button_left_bg_"barname; \
} \
program { \
name: "button_left_bg_"barname"_animation_end"; \
signal: "mouse,up,*"; \
source: "button_left_bg_"barname; \
action: STATE_SET "default" 1; \
target: "button_left_bg_"barname; \
transition: DECELERATE 0.1; \
} \
program { \
name: "button_right_bg_"barname"_animation"; \
signal: "mouse,down,*"; \
source: "button_right_bg_"barname; \
action: STATE_SET "default" 0.5; \
target: "button_right_bg_"barname; \
} \
program { \
name: "button_right_bg_"barname"_animation_end"; \
signal: "mouse,up,*"; \
source: "button_right_bg_"barname; \
action: STATE_SET "default" 1; \
target: "button_right_bg_"barname; \
transition: DECELERATE 0.1; \
} \
collections { collections {
group { group {
@ -216,8 +286,8 @@ collections {
rel1 { relative: 0 0; } rel1 { relative: 0 0; }
rel2 { relative: 1 1/7; } rel2 { relative: 1 1/7; }
text { text {
text: "gsm status"; text: "settings";
size: 18; size: 10;
font: "VeraBd"; font: "VeraBd";
fit: 1 1; fit: 1 1;
} }
@ -234,19 +304,16 @@ collections {
rel1 { relative: 0 3/20; } rel1 { relative: 0 3/20; }
rel2 { relative: 1 10/20; } rel2 { relative: 1 10/20; }
text { text {
text: "gsm"; text: "";
style: "textblock_style"; style: "textblock_style";
} }
} }
} /* end gsm_caption */ } /* end gsm_caption */
BUTTON(4, 0, 36/70, 1/4, 46/70, "-", button_inactive, 0.5, 0.5);
BUTTON(7, 1/4, 36/70, 3/4, 46/70, "||||||||||", scale, 0, 0);
BUTTON(5, 1/4, 36/70, 3/4, 46/70, "|", button_inactive, 0, 0);
BUTTON(6, 3/4, 36/70, 4/4, 46/70, "+", button_inactive, 0.5, 0.5);
BUTTON(11, 1/3, 58/70, 2/3, 68/70, "on", button_inactive, 0.5, 0.5); BUTTON(11, 1/3, 58/70, 2/3, 68/70, "on", button_inactive, 0.5, 0.5);
BUTTON(12, 0, 58/70 , 1/3, 68/70, "<", button_inactive, 0.5, 0.5); BUTTON(12, 0, 58/70 , 1/3, 68/70, "<", button_inactive, 0.5, 0.5);
HBAR("Brightness", button_inactive, 1, 0, 36/70, 1, 46/70, 10); HBAR("beer level", button_inactive, 1, 0, 26/70, 1, 36/70, 10);
HBAR("Volume", button_inactive, 1, 0, 47/70, 3/3, 57/70, 10); HBAR("brightness", button_inactive, 1, 0, 36/70, 1, 46/70, 10);
HBAR("volume", button_inactive, 1, 0, 46/70, 1, 56/70, 10);
} }
} }
} }

View file

@ -62,7 +62,7 @@ class DialerScreen(EdjeGroup):
self.part_text_set("signalq_text", "%s dBm /"%str(rssi)) self.part_text_set("signalq_text", "%s dBm /"%str(rssi))
def display_time(self): def display_time(self):
self.part_text_set("time_text", time.strftime("%H:%M", time.localtime())); self.part_text_set("time_text", datetime.now().strftime('%H:%M'));
return True; return True;

View file

@ -41,6 +41,7 @@ from pyneo.dbus_support import *
from pyneo.sys_support import pr_set_name from pyneo.sys_support import pr_set_name
from ConfigParser import SafeConfigParser from ConfigParser import SafeConfigParser
import cairo
class EdjeGroup(edje.Edje): class EdjeGroup(edje.Edje):
@ -203,6 +204,8 @@ class PyneoController(object):
@classmethod @classmethod
def gsm_dial(class_, number): def gsm_dial(class_, number):
class_.notify_callbacks("gsm_phone_call_start")
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)
@ -211,26 +214,17 @@ class PyneoController(object):
# Initialize "active call" counter # Initialize "active call" counter
class_._calls[call] = 1 class_._calls[call] = 1
# class_.notify_callbacks("gsm_dialing")
@classmethod @classmethod
def gsm_hangup(class_): def gsm_hangup(class_):
# Find call with highest "active call" counter - it'll be the one currently active call = object_by_url('dbus:///org/pyneo/gsmdevice/Call/1')
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) call.Hangup(dbus_interface=DIN_CALL)
os.system('alsactl -f /usr/share/openmoko/scenarios/stereoout.state restore') os.system('alsactl -f /usr/share/openmoko/scenarios/stereoout.state restore')
class_.call_type = 'nix'
# Remove the call from our list @classmethod
# class_._calls.__delitem__(call_obj) def gsm_accept(class_):
call = object_by_url('dbus:///org/pyneo/gsmdevice/Call/1')
call.Accept(dbus_interface=DIN_CALL)
os.system('alsactl -f /usr/share/openmoko/scenarios/gsmhandset.state restore')
@classmethod @classmethod
def on_gsm_wireless_status(class_, status_map): def on_gsm_wireless_status(class_, status_map):
@ -255,11 +249,10 @@ class PyneoController(object):
if status.has_key('phone_activity_status'): if status.has_key('phone_activity_status'):
ph_status = status['phone_activity_status'] ph_status = status['phone_activity_status']
if ph_status == 0 and class_.call_type != 'outgoing': if ph_status == 0:
# class_.pwr.BlinkenLeds("power:blue", 0, 0, 0, dbus_interface=DIN_POWER)
class_.notify_callbacks("gsm_phone_call_end") class_.notify_callbacks("gsm_phone_call_end")
os.system('alsactl -f /usr/share/openmoko/scenarios/stereoout.state restore')
if ph_status == 3: if ph_status == 3:
# class_.pwr.BlinkenLeds("power:blue", 400, 1300, 0, dbus_interface=DIN_POWER)
class_.notify_callbacks("gsm_phone_ringing") class_.notify_callbacks("gsm_phone_ringing")
if ph_status == 4: if ph_status == 4:
class_.notify_callbacks("gsm_phone_call_start") class_.notify_callbacks("gsm_phone_call_start")
@ -374,7 +367,7 @@ class PyneoController(object):
@classmethod @classmethod
def brightness_change(class_, up_down): def brightness_change(class_, up_down):
if up_down == '+': if up_down == 'button_right_bg_brightness':
class_.brightness_value += 10 class_.brightness_value += 10
if class_.brightness_value > 100: class_.brightness_value = 100 if class_.brightness_value > 100: class_.brightness_value = 100
else: else:

View file

@ -32,17 +32,18 @@ class GsmStatusScreen(EdjeGroup):
self.part_text_set("button_11_caption", p_status) self.part_text_set("button_11_caption", p_status)
self.part_text_set("pwr_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", "*") @edje.decorators.signal_callback("mouse,up,1", "*")
def on_edje_signal_dialer_status_triggered(self, emission, source): def on_edje_signal_dialer_status_triggered(self, emission, source):
status = self.part_text_get("button_11_caption") status = self.part_text_get("button_11_caption")
if source == "<": if source == "button_12":
PyneoController.show_dialer_screen() PyneoController.show_dialer_screen()
elif source == "on" and status == "on": elif source == "on" and status == "on":
PyneoController.power_down_gsm() PyneoController.power_down_gsm()
elif source == "on" and status == "off": elif source == "on" and status == "off":
PyneoController.power_up_gsm() PyneoController.power_up_gsm()
elif source == "+": elif source == "button_right_bg_brightness":
PyneoController.brightness_change(source) PyneoController.brightness_change(source)
elif source == "-": elif source == "button_left_bg_brightness":
PyneoController.brightness_change(source) PyneoController.brightness_change(source)
print 'settings source: ', source

View file

@ -8,8 +8,14 @@ __license__ = "GPL3"
from epydial import * from epydial import *
class HonScreen(EdjeGroup): class HonScreen(EdjeGroup):
class SignalGraph( evas.ClippedSmartObject ):
def __init__( self, *args, **kargs ):
evas.ClippedSmartObject.__init__( self, *args, **kargs )
def __init__(self, screen_manager): def __init__(self, screen_manager):
EdjeGroup.__init__(self, screen_manager, HON_SCREEN_NAME) EdjeGroup.__init__(self, screen_manager, HON_SCREEN_NAME)
self.signalgraph = self.SignalGraph( self.evas )
print 'signalgraph', self.signalgraph
def register_pyneo_callbacks(self): def register_pyneo_callbacks(self):
PyneoController.register_callback("get_hon", self.on_get_hon) PyneoController.register_callback("get_hon", self.on_get_hon)

View file

@ -24,4 +24,5 @@ class InCallScreen(EdjeGroup):
PyneoController.gsm_hangup() PyneoController.gsm_hangup()
if source == "Accept Call": if source == "Accept Call":
print source print source
PyneoController.gsm_accept()