Ignore aoview_glade.h
[fw/altos] / aoview / aoview.h
1 /*
2  * Copyright © 2009 Keith Packard <keithp@keithp.com>
3  *
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; version 2 of the License.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along
14  * with this program; if not, write to the Free Software Foundation, Inc.,
15  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
16  */
17
18 #ifndef _AOVIEW_H_
19 #define _AOVIEW_H_
20
21 #define _GNU_SOURCE
22
23 #include <stdlib.h>
24 #include <stdio.h>
25 #include <string.h>
26 #include <unistd.h>
27 #include <fcntl.h>
28 #include <err.h>
29 #include <errno.h>
30 #include <getopt.h>
31 #include <sys/types.h>
32 #include <sys/stat.h>
33 #include <assert.h>
34
35 #include <gtk/gtk.h>
36 #include <glade/glade.h>
37 #include <gconf/gconf-client.h>
38
39 struct usbdev {
40         char    *sys;
41         char    *tty;
42         char    *manufacturer;
43         char    *product;
44         char    *serial;
45         int     idProduct;
46         int     idVendor;
47 };
48
49 struct aostate {
50         char    callsign[16];
51         int     serial;
52         int     rssi;
53         char    state[16];
54         int     tick;
55         int     accel;
56         int     pres;
57         int     temp;
58         int     batt;
59         int     drogue;
60         int     main;
61         int     flight_accel;
62         int     ground_accel;
63         int     flight_vel;
64         int     flight_pres;
65         int     ground_pres;
66         int     nsat;
67         int     locked;
68         struct {
69                 int hour;
70                 int minute;
71                 int second;
72         } gps_time;
73         double  lat;
74         double  lon;
75         int     alt;
76 };
77
78 void
79 aoview_monitor_disconnect(void);
80
81 gboolean
82 aoview_monitor_connect(char *tty);
83
84 struct aoview_serial *
85 aoview_serial_open(const char *tty);
86
87 void
88 aoview_serial_close(struct aoview_serial *serial);
89
90 typedef void (*aoview_serial_callback)(gpointer user_data, struct aoview_serial *serial, gint revents);
91
92 void
93 aoview_serial_set_callback(struct aoview_serial *serial,
94                            aoview_serial_callback func,
95                            gpointer data,
96                            GDestroyNotify notify);
97
98 void
99 aoview_serial_printf(struct aoview_serial *serial, char *format, ...);
100
101 int
102 aoview_serial_read(struct aoview_serial *serial, char *buf, int len);
103
104 int
105 aoview_serial_getc(struct aoview_serial *serial);
106
107 void
108 aoview_dev_dialog_init(GladeXML *xml);
109
110 int
111 aoview_usb_scan(struct usbdev ***devs_ret);
112
113 void
114 aoview_usbdev_free(struct usbdev *usbdev);
115
116 void
117 aoview_state_notify(struct aostate *state);
118
119 void
120 aoview_state_new(void);
121
122 void
123 aoview_state_init(GladeXML *xml);
124
125 int16_t
126 aoview_pres_to_altitude(int16_t pres);
127
128 int16_t
129 aoview_altitude_to_pres(int16_t alt);
130
131 char *
132 aoview_fullname (char *dir, char *file);
133
134 char *
135 aoview_basename(char *file);
136
137 GtkTreeViewColumn *
138 aoview_add_plain_text_column (GtkTreeView *view, const gchar *title, gint model_column, gint width);
139
140 int
141 aoview_mkdir(char *dir);
142
143 void
144 aoview_log_init(GladeXML *xml);
145
146 void
147 aoview_log_set_serial(int serial);
148
149 int
150 aoview_log_get_serial(void);
151
152 void
153 aoview_log_printf(char *format, ...);
154
155 void
156 aoview_log_new(void);
157
158 void
159 aoview_table_start(void);
160
161 void
162 aoview_table_add_row(char *label, char *format, ...);
163
164 void
165 aoview_table_finish(void);
166
167 void
168 aoview_table_init(GladeXML *xml);
169
170 void
171 aoview_table_clear(void);
172
173 #endif /* _AOVIEW_H_ */