From: gregor herrmann Date: Sat, 3 Apr 2010 20:42:50 +0000 (+0200) Subject: Merge branch 'master' into gregoa X-Git-Url: https://git.toastfreeware.priv.at/gregoa/zavai.git/commitdiff_plain/43677c8ab39c540121af5fdfaecf14ff2275556c?hp=ec503392ddba6000fac8ac18dea94a0e2ba860c1 Merge branch 'master' into gregoa --- diff --git a/src/app_keyboard.vala b/src/app_keyboard.vala index 18efc2b..31c0492 100644 --- a/src/app_keyboard.vala +++ b/src/app_keyboard.vala @@ -44,7 +44,6 @@ public class Keyboard : Service { string script = zavai.config.find_script("keyboard"); if (script == null) return; - string[] args = { script, null }; int opid; try { @@ -115,41 +114,6 @@ public class KeyboardIcon : Gtk.StatusIcon } } -/* -public class GPSRequestLink : Gtk.ToggleButton -{ - public GPSRequestLink() - { - // GPS status icon - status_icon = new Gtk.StatusIcon(); - status_icon.set_visible(true); - status_icon.activate += on_status_activate; - update_icon(); - } - - private void on_fix_status_changed(dynamic DBus.Object pos, int fix_status) - { - this.fix_status = fix_status; - update_icon(); - } - - private void on_toggled(Gtk.Button src) - { - Service s = zavai.registry.gets(service_name); - if (get_active()) - s.request("servicerequestlink"); - else - s.release("servicerequestlink"); - set_label(get_active() ? label_stop : label_start); - update_icon(); - } - - private void on_status_activate() - { - set_active(!get_active()); - } -} -*/ Keyboard keyboard; KeyboardIcon icon; diff --git a/src/core.vala b/src/core.vala index 2e21915..6eb4de4 100644 --- a/src/core.vala +++ b/src/core.vala @@ -141,7 +141,7 @@ public abstract class Service : Object, Resource { if (el == null) return false; - ++el.data.count; + --el.data.count; if (el.data.count == 0) requests.delete_link(el); @@ -261,7 +261,6 @@ public abstract class ScriptMonitorService : Service protected void on_child(Pid pid, int status) { zavai.log.info("Exited"); -stderr.printf("STATUS %d\n", status); Process.close_pid(pid); try { diff --git a/src/gps.vala b/src/gps.vala index 17e7642..64037ce 100644 --- a/src/gps.vala +++ b/src/gps.vala @@ -52,42 +52,39 @@ public class GPS: zavai.ScriptService protected bool on_input_data(IOChannel source, IOCondition condition) { - while (libgps.waiting(ref data)) + int res = libgps.poll(ref data); + if (res != 0) + zavai.log.error(libgps.errstr(res)); + + if (data.status != old_fix_status) + { + fix_status_changed(data.status); + old_fix_status = data.status; + } + + uint cur_time = (uint)data.fix.time; + if (data.status != libgps.STATUS_NO_FIX && old_time != cur_time) + { + time_changed(cur_time); + old_time = cur_time; + } + + double lat = (data.status == libgps.STATUS_NO_FIX ? 1000 : data.fix.latitude); + double lon = (data.status == libgps.STATUS_NO_FIX ? 1000 : data.fix.longitude); + if (lat != old_lat || lon != old_lon) + pos_changed(); + + /* + stderr.printf("GPSMSG %d %d\n", (int)data.set, data.status); + stderr.printf("SATUSED %d\n", data.satellites_used); + stderr.printf("SWT %f\n", data.skyview_time); + stderr.printf("SATVIS %d\n", data.satellites_visible); + for (int i = 0; i < data.satellites_visible; ++i) { - int res = libgps.poll(ref data); - if (res != 0) - zavai.log.error(libgps.errstr(res)); - - if (data.status != old_fix_status) - { - fix_status_changed(data.status); - old_fix_status = data.status; - } - - uint cur_time = (uint)data.fix.time; - if (data.status != libgps.STATUS_NO_FIX && old_time != cur_time) - { - time_changed(cur_time); - old_time = cur_time; - } - - double lat = (data.status == libgps.STATUS_NO_FIX ? 1000 : data.fix.latitude); - double lon = (data.status == libgps.STATUS_NO_FIX ? 1000 : data.fix.longitude); - if (lat != old_lat || lon != old_lon) - pos_changed(); - - /* - stderr.printf("GPSMSG %d %d\n", (int)data.set, data.status); - stderr.printf("SATUSED %d\n", data.satellites_used); - stderr.printf("SWT %f\n", data.skyview_time); - stderr.printf("SATVIS %d\n", data.satellites_visible); - for (int i = 0; i < data.satellites_visible; ++i) - { - stderr.printf("PRN %d ELE %d AZI %d SS %f\n", - data.PRN[i], data.elevation[i], data.azimuth[i], data.ss[i]); - } - */ + stderr.printf("PRN %d ELE %d AZI %d SS %f\n", + data.PRN[i], data.elevation[i], data.azimuth[i], data.ss[i]); } + */ return true; }