summaryrefslogtreecommitdiff
path: root/aoview/aoview.h
blob: 028b2f162839a56aed1c598a3dd829c1197c0608 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
 * Copyright © 2009 Keith Packard <keithp@keithp.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
 */

#ifndef _AOVIEW_H_
#define _AOVIEW_H_

#include <gtk/gtk.h>
#include <glade/glade.h>

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <err.h>
#include <errno.h>
#include <getopt.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <assert.h>

struct usbdev {
	char	*sys;
	char	*tty;
	char	*manufacturer;
	char	*product;
	char	*serial;
	int	idProduct;
	int	idVendor;
};

struct aostate {
	char	callsign[16];
	int	serial;
	int	rssi;
	char	state[16];
	int	tick;
	int	accel;
	int	pres;
	int	temp;
	int	batt;
	int	drogue;
	int	main;
	int	nsat;
	int	locked;
	struct {
		int hour;
		int minute;
		int second;
	} gps_time;
	double	lat;
	double	lon;
	int	alt;
};

void
aoview_monitor_disconnect(void);

void
aoview_monitor_connect(char *tty);

struct aoview_serial *
aoview_serial_open(const char *tty);

void
aoview_serial_close(struct aoview_serial *serial);

void
aoview_serial_set_callback(struct aoview_serial *serial,
			   GSourceFunc func,
			   gpointer data,
			   GDestroyNotify notify);

void
aoview_serial_printf(struct aoview_serial *serial, char *format, ...);

int
aoview_serial_read(struct aoview_serial *serial, char *buf, int len);

int
aoview_serial_getc(struct aoview_serial *serial);

void
aoview_dev_dialog_init(GladeXML *xml);

int
aoview_usb_scan(struct usbdev ***devs_ret);

void
aoview_usbdev_free(struct usbdev *usbdev);

void
aoview_state_notify(struct aostate *state);

void
aoview_state_init(GladeXML *xml);

int16_t
aoview_pres_to_altitude(int16_t pres);

int16_t
aoview_altitude_to_pres(int16_t alt);

#endif /* _AOVIEW_H_ */