2 * Copyright © 2010 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; version 2 of the License.
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.
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.
23 import java.nio.charset.Charset;
27 import org.altusmetrum.AltosLib.*;
29 public class Altos extends AltosLib {
31 static final int tab_elt_pad = 5;
33 static Font label_font;
34 static Font value_font;
35 static Font status_font;
36 static Font table_label_font;
37 static Font table_value_font;
39 final static int font_size_small = 1;
40 final static int font_size_medium = 2;
41 final static int font_size_large = 3;
43 static void set_fonts(int size) {
55 case font_size_medium:
66 label_font = new Font("Dialog", Font.PLAIN, brief_size);
67 value_font = new Font("Monospaced", Font.PLAIN, brief_size);
68 status_font = new Font("SansSerif", Font.BOLD, status_size);
69 table_label_font = new Font("SansSerif", Font.PLAIN, table_size);
70 table_value_font = new Font("Monospaced", Font.PLAIN, table_size);
73 static final int text_width = 20;
75 static public int state(String state) {
78 if (string_to_state.containsKey(state))
79 return string_to_state.get(state);
80 return ao_flight_invalid;
83 static public String state_name(int state) {
84 if (state < 0 || state_to_string.length <= state)
86 return state_to_string[state];
89 static public boolean initialized = false;
90 static public boolean loaded_library = false;
92 public static boolean load_library() {
95 System.loadLibrary("altos");
96 libaltos.altos_init();
97 loaded_library = true;
98 } catch (UnsatisfiedLinkError e) {
100 System.loadLibrary("altos64");
101 libaltos.altos_init();
102 loaded_library = true;
103 } catch (UnsatisfiedLinkError e2) {
104 loaded_library = false;
109 return loaded_library;
112 static int usb_vendor_altusmetrum() {
117 static int usb_product_altusmetrum() {
122 static int usb_product_altusmetrum_min() {
127 static int usb_product_altusmetrum_max() {
132 static int usb_product_telemetrum() {
137 static int usb_product_teledongle() {
142 static int usb_product_teleterra() {
147 static int usb_product_telebt() {
152 static int usb_product_telelaunch() {
157 static int usb_product_telelco() {
162 static int usb_product_telescience() {
167 static int usb_product_telepyro() {
172 public final static int vendor_altusmetrum = usb_vendor_altusmetrum();
173 public final static int product_altusmetrum = usb_product_altusmetrum();
174 public final static int product_telemetrum = usb_product_telemetrum();
175 public final static int product_teledongle = usb_product_teledongle();
176 public final static int product_teleterra = usb_product_teleterra();
177 public final static int product_telebt = usb_product_telebt();
178 public final static int product_telelaunch = usb_product_telelaunch();
179 public final static int product_tele10 = usb_product_telelco();
180 public final static int product_telescience = usb_product_telescience();
181 public final static int product_telepyro = usb_product_telepyro();
182 public final static int product_altusmetrum_min = usb_product_altusmetrum_min();
183 public final static int product_altusmetrum_max = usb_product_altusmetrum_max();
185 public final static int product_any = 0x10000;
186 public final static int product_basestation = 0x10000 + 1;
188 static String bt_product_telebt() {
193 public final static String bt_product_telebt = bt_product_telebt();
195 public static AltosBTKnown bt_known = new AltosBTKnown();