gsm register check
git-svn-id: http://www.neo1973-germany.de/svn@201 46df4e5c-bc4e-4628-a0fc-830ba316316d
This commit is contained in:
parent
a82f57c20b
commit
6fd2f1f258
4 changed files with 124 additions and 32 deletions
|
@ -11,6 +11,11 @@ data {
|
||||||
item: "name" "epydial_blackwhite";
|
item: "name" "epydial_blackwhite";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fonts {
|
||||||
|
font: "Vera.ttf" "Vera";
|
||||||
|
font: "VeraBd.ttf" "VeraBd";
|
||||||
|
}
|
||||||
|
|
||||||
images {
|
images {
|
||||||
image: "bg.png" COMP;
|
image: "bg.png" COMP;
|
||||||
}
|
}
|
||||||
|
@ -34,6 +39,12 @@ color_classes {
|
||||||
color2: 128 128 128 255;
|
color2: 128 128 128 255;
|
||||||
color3: 128 128 128 255;;
|
color3: 128 128 128 255;;
|
||||||
}
|
}
|
||||||
|
color_class {
|
||||||
|
name: "scale";
|
||||||
|
color: 255 255 255 64;
|
||||||
|
color2: 0 0 0 255;
|
||||||
|
color3: 0 0 0 255;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
styles {
|
styles {
|
||||||
|
@ -50,7 +61,7 @@ styles {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BUTTON(button_number, rel1x, rel1y, rel2x, rel2y, button_caption) \
|
#define BUTTON(button_number, rel1x, rel1y, rel2x, rel2y, button_caption, color_class_caption, alignx, aligny) \
|
||||||
part { \
|
part { \
|
||||||
name: "button_"button_number; \
|
name: "button_"button_number; \
|
||||||
type: RECT; \
|
type: RECT; \
|
||||||
|
@ -78,7 +89,7 @@ part { \
|
||||||
mouse_events: 0; \
|
mouse_events: 0; \
|
||||||
description { \
|
description { \
|
||||||
state: "default" 0; \
|
state: "default" 0; \
|
||||||
color_class: "button_inactive"; \
|
color_class: color_class_caption; \
|
||||||
rel1 { \
|
rel1 { \
|
||||||
to: "button_"button_number; \
|
to: "button_"button_number; \
|
||||||
relative: 0 0; \
|
relative: 0 0; \
|
||||||
|
@ -90,8 +101,9 @@ part { \
|
||||||
text { \
|
text { \
|
||||||
text: button_caption; \
|
text: button_caption; \
|
||||||
size: 18; \
|
size: 18; \
|
||||||
font: "Sans:style=Bold,Edje-Vera"; \
|
font: "VeraBd"; \
|
||||||
fit: 1 1; \
|
fit: 1 1; \
|
||||||
|
align: alignx aligny; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
|
@ -115,7 +127,68 @@ program { \
|
||||||
action: STATE_SET "default" 1; \
|
action: STATE_SET "default" 1; \
|
||||||
target: "button_"button_number; \
|
target: "button_"button_number; \
|
||||||
transition: DECELERATE 0.1; \
|
transition: DECELERATE 0.1; \
|
||||||
}
|
} \
|
||||||
|
|
||||||
|
#define HBAR(barname, bordercolor, borderwidth, rel1x, rel1y, rel2x, rel2y, left_right_offset) \
|
||||||
|
part { \
|
||||||
|
name: "border_left_"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; \
|
||||||
|
description { \
|
||||||
|
color_class: bordercolor; \
|
||||||
|
rel1 { relative: 1-rel2x/2 rel1y; offset: -80 -10; }; \
|
||||||
|
rel2 { relative: 1-rel2x/2 rel1y; offset: +80 10; }; \
|
||||||
|
text { \
|
||||||
|
text: barname; \
|
||||||
|
font: "VeraBd"; \
|
||||||
|
size: 16; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
|
||||||
collections {
|
collections {
|
||||||
group {
|
group {
|
||||||
|
@ -145,7 +218,7 @@ collections {
|
||||||
text {
|
text {
|
||||||
text: "gsm status";
|
text: "gsm status";
|
||||||
size: 18;
|
size: 18;
|
||||||
font: "Sans:style=Bold,Edje-Vera";
|
font: "VeraBd";
|
||||||
fit: 1 1;
|
fit: 1 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,25 +239,14 @@ collections {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} /* end gsm_caption */
|
} /* end gsm_caption */
|
||||||
part {
|
BUTTON(4, 0, 36/70, 1/4, 46/70, "-", button_inactive, 0.5, 0.5);
|
||||||
name: "device_caption";
|
BUTTON(7, 1/4, 36/70, 3/4, 46/70, "||||||||||", scale, 0, 0);
|
||||||
type: TEXTBLOCK;
|
BUTTON(5, 1/4, 36/70, 3/4, 46/70, "|", button_inactive, 0, 0);
|
||||||
mouse_events: 0;
|
BUTTON(6, 3/4, 36/70, 4/4, 46/70, "+", button_inactive, 0.5, 0.5);
|
||||||
description {
|
BUTTON(11, 1/3, 58/70, 2/3, 68/70, "on", button_inactive, 0.5, 0.5);
|
||||||
color_class: "button_inactive";
|
BUTTON(12, 0, 58/70 , 1/3, 68/70, "<", button_inactive, 0.5, 0.5);
|
||||||
align: 0.5 0.5;
|
HBAR("Brightness", button_inactive, 1, 0, 36/70, 1, 46/70, 10);
|
||||||
fixed: 1 1;
|
HBAR("Volume", button_inactive, 1, 0, 47/70, 3/3, 57/70, 10);
|
||||||
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, ">");*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,9 +31,9 @@ class DialerScreen(EdjeGroup):
|
||||||
|
|
||||||
def on_battvolt_change(self, battvolt, chgmode):
|
def on_battvolt_change(self, battvolt, chgmode):
|
||||||
if chgmode == "play-only":
|
if chgmode == "play-only":
|
||||||
EdjeGroup.color_class_set(self, "battvolt_active", 255, 255, 255, 64, 0,0,0,0,0,0,0,0)
|
EdjeGroup.color_class_set(self, "battvolt_active", 255, 255, 255, 64, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||||
else:
|
else:
|
||||||
EdjeGroup.color_class_set(self, "battvolt_active", 255, 255, 255, 128, 0,0,0,0,0,0,0,0)
|
EdjeGroup.color_class_set(self, "battvolt_active", 255, 255, 255, 128, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||||
self.part_text_set("battvolt_text", "%s V"%str(battvolt)[:4])
|
self.part_text_set("battvolt_text", "%s V"%str(battvolt)[:4])
|
||||||
|
|
||||||
def on_sim_key_required(self, key_type):
|
def on_sim_key_required(self, key_type):
|
||||||
|
@ -127,7 +127,6 @@ class DialerScreen(EdjeGroup):
|
||||||
self.text = []
|
self.text = []
|
||||||
self.part_text_set("numberdisplay_text", "".join(self.text))
|
self.part_text_set("numberdisplay_text", "".join(self.text))
|
||||||
PyneoController.show_hon_screen()
|
PyneoController.show_hon_screen()
|
||||||
# PyneoController.get_hon()
|
|
||||||
elif source == "dial":
|
elif source == "dial":
|
||||||
PyneoController.show_incall_screen('outgoing')
|
PyneoController.show_incall_screen('outgoing')
|
||||||
PyneoController.gsm_dial("".join(self.text))
|
PyneoController.gsm_dial("".join(self.text))
|
||||||
|
|
|
@ -83,6 +83,8 @@ class PyneoController(object):
|
||||||
gsm_keyring_status = None
|
gsm_keyring_status = None
|
||||||
|
|
||||||
call_type = None
|
call_type = None
|
||||||
|
|
||||||
|
brightness_value = None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def register_callback(class_, event_name, callback):
|
def register_callback(class_, event_name, callback):
|
||||||
|
@ -113,6 +115,7 @@ class PyneoController(object):
|
||||||
class_.hon = object_by_url('dbus:///org/pyneo/HotOrNot')
|
class_.hon = object_by_url('dbus:///org/pyneo/HotOrNot')
|
||||||
class_.hon_hotornot = object_by_url(class_.hon.GetDevice('hotornot'))
|
class_.hon_hotornot = object_by_url(class_.hon.GetDevice('hotornot'))
|
||||||
class_.call_type = 'nix'
|
class_.call_type = 'nix'
|
||||||
|
class_.brightness_value = 60
|
||||||
|
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
print "Pyneo error: " + str(e)
|
print "Pyneo error: " + str(e)
|
||||||
|
@ -280,8 +283,13 @@ class PyneoController(object):
|
||||||
class_.notify_callbacks("sim_ready")
|
class_.notify_callbacks("sim_ready")
|
||||||
|
|
||||||
# Try registering on the network
|
# Try registering on the network
|
||||||
class_.gsm_wireless.Register(dbus_interface=DIN_WIRELESS)
|
res = dedbusmap(class_.gsm_wireless.GetStatus(dbus_interface=DIN_WIRELESS, ))
|
||||||
|
if not res['stat'] in (1, 5, ):
|
||||||
|
print '---', 'registering to gsm network'
|
||||||
|
class_.gsm_wireless.Register()
|
||||||
|
res = dedbusmap(class_.gsm_wireless.GetStatus(dbus_interface=DIN_WIRELESS, ))
|
||||||
|
else:
|
||||||
|
print '---', 'already registered'
|
||||||
else:
|
else:
|
||||||
class_.notify_callbacks("sim_key_required", status["code"])
|
class_.notify_callbacks("sim_key_required", status["code"])
|
||||||
|
|
||||||
|
@ -341,11 +349,13 @@ class PyneoController(object):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def show_dialer_screen(class_):
|
def show_dialer_screen(class_):
|
||||||
|
class_.pwr.SetBrightness(class_.brightness_value, dbus_interface=DIN_POWER)
|
||||||
class_.notify_callbacks("show_dialer_screen")
|
class_.notify_callbacks("show_dialer_screen")
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def show_gsm_status_screen(class_):
|
def show_gsm_status_screen(class_):
|
||||||
class_.notify_callbacks("show_gsm_status_screen")
|
class_.notify_callbacks("show_gsm_status_screen")
|
||||||
|
class_.notify_callbacks("brightness_change", class_.brightness_value)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def show_gps_status_screen(class_):
|
def show_gps_status_screen(class_):
|
||||||
|
@ -361,6 +371,17 @@ class PyneoController(object):
|
||||||
def show_hon_screen(class_):
|
def show_hon_screen(class_):
|
||||||
class_.notify_callbacks("show_hon_screen")
|
class_.notify_callbacks("show_hon_screen")
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def brightness_change(class_, up_down):
|
||||||
|
if up_down == '+':
|
||||||
|
class_.brightness_value += 10
|
||||||
|
if class_.brightness_value > 100: class_.brightness_value = 100
|
||||||
|
else:
|
||||||
|
class_.brightness_value -= 10
|
||||||
|
if class_.brightness_value < 0: class_.brightness_value = 0
|
||||||
|
class_.pwr.SetBrightness(class_.brightness_value, dbus_interface=DIN_POWER)
|
||||||
|
class_.notify_callbacks("brightness_change", class_.brightness_value)
|
||||||
|
|
||||||
|
|
||||||
from dialer_screen import *
|
from dialer_screen import *
|
||||||
from incall_screen import *
|
from incall_screen import *
|
||||||
|
|
|
@ -14,6 +14,13 @@ class GsmStatusScreen(EdjeGroup):
|
||||||
def register_pyneo_callbacks(self):
|
def register_pyneo_callbacks(self):
|
||||||
PyneoController.register_callback("power_status_gsm", self.on_power_status_gsm)
|
PyneoController.register_callback("power_status_gsm", self.on_power_status_gsm)
|
||||||
PyneoController.register_callback("pwr_status_change", self.on_pwr_status_change)
|
PyneoController.register_callback("pwr_status_change", self.on_pwr_status_change)
|
||||||
|
PyneoController.register_callback("brightness_change", self.on_brightness_change)
|
||||||
|
|
||||||
|
def on_brightness_change(self, status):
|
||||||
|
if status == 10: bar = '| '
|
||||||
|
else: bar = '|'
|
||||||
|
self.part_text_set("button_5_caption", status/10*bar)
|
||||||
|
self.part_text_set("top_description_Brightness", "Brightness %s"%status+"%")
|
||||||
|
|
||||||
def on_pwr_status_change(self, status):
|
def on_pwr_status_change(self, status):
|
||||||
self.part_text_set("pwr_caption", "battemp: %s<br>chgmode: %s<br>chgstate: %s<br>chgcur: %s<br>battvolt: %f"%(status['battemp'], status['chgmode'], status['chgstate'], status['chgcur'], status['battvolt']))
|
self.part_text_set("pwr_caption", "battemp: %s<br>chgmode: %s<br>chgstate: %s<br>chgcur: %s<br>battvolt: %f"%(status['battemp'], status['chgmode'], status['chgstate'], status['chgcur'], status['battvolt']))
|
||||||
|
@ -30,9 +37,12 @@ class GsmStatusScreen(EdjeGroup):
|
||||||
status = self.part_text_get("button_11_caption")
|
status = self.part_text_get("button_11_caption")
|
||||||
if source == "<":
|
if source == "<":
|
||||||
PyneoController.show_dialer_screen()
|
PyneoController.show_dialer_screen()
|
||||||
if source == "on" and status == "on": PyneoController.power_down_gsm()
|
elif source == "on" and status == "on":
|
||||||
|
PyneoController.power_down_gsm()
|
||||||
elif source == "on" and status == "off":
|
elif source == "on" and status == "off":
|
||||||
self.first = time.time()
|
|
||||||
PyneoController.power_up_gsm()
|
PyneoController.power_up_gsm()
|
||||||
|
elif source == "+":
|
||||||
|
PyneoController.brightness_change(source)
|
||||||
|
elif source == "-":
|
||||||
|
PyneoController.brightness_change(source)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue