2 * Copyright © 2009 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
24 #ifndef AO_GPS_ORIG_ALTITUDE
25 #define AO_GPS_ORIG_ALTITUDE(l) ((l)->altitude)
29 ao_gps_print(struct ao_gps_orig *gps_data)
33 if (gps_data->flags & AO_GPS_VALID)
34 state = AO_TELEM_GPS_STATE_LOCKED;
35 else if (gps_data->flags & AO_GPS_RUNNING)
36 state = AO_TELEM_GPS_STATE_UNLOCKED;
38 state = AO_TELEM_GPS_STATE_ERROR;
39 printf(AO_TELEM_GPS_STATE " %c "
40 AO_TELEM_GPS_NUM_SAT " %d ",
42 (gps_data->flags & AO_GPS_NUM_SAT_MASK) >> AO_GPS_NUM_SAT_SHIFT);
43 if (!(gps_data->flags & AO_GPS_VALID))
45 printf(AO_TELEM_GPS_LATITUDE " %ld "
46 AO_TELEM_GPS_LONGITUDE " %ld "
47 AO_TELEM_GPS_ALTITUDE " %d ",
48 (long) gps_data->latitude,
49 (long) gps_data->longitude,
50 AO_GPS_ORIG_ALTITUDE(gps_data));
52 if (gps_data->flags & AO_GPS_DATE_VALID)
53 printf(AO_TELEM_GPS_YEAR " %d "
54 AO_TELEM_GPS_MONTH " %d "
55 AO_TELEM_GPS_DAY " %d ",
60 printf(AO_TELEM_GPS_HOUR " %d "
61 AO_TELEM_GPS_MINUTE " %d "
62 AO_TELEM_GPS_SECOND " %d ",
67 printf(AO_TELEM_GPS_HDOP " %d ",
70 if (gps_data->flags & AO_GPS_COURSE_VALID) {
71 printf(AO_TELEM_GPS_HERROR " %d "
72 AO_TELEM_GPS_VERROR " %d "
73 AO_TELEM_GPS_VERTICAL_SPEED " %d "
74 AO_TELEM_GPS_HORIZONTAL_SPEED " %d "
75 AO_TELEM_GPS_COURSE " %d ",
79 gps_data->ground_speed,
80 (int) gps_data->course * 2);
85 ao_gps_tracking_print(struct ao_gps_tracking_orig *gps_tracking_data)
88 struct ao_gps_sat_orig *sat;
90 n = gps_tracking_data->channels;
94 sat = gps_tracking_data->sats;
96 for (c = 0; c < n; c++) {
102 printf (AO_TELEM_SAT_NUM " %d ",
105 sat = gps_tracking_data->sats;
107 for (c = 0; c < n; c++) {
109 printf (AO_TELEM_SAT_SVID "%d %d "
110 AO_TELEM_SAT_C_N_0 "%d %d ",