{
string script = zavai.config.find_script("keyboard");
if (script == null) return;
-
string[] args = { script, null };
int opid;
try {
}
}
-/*
-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;
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;
}