--- /dev/null
+/*
+ * Copyright © 2011 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.
+ */
+
+package org.altusmetrum.AltosLib;
+
+public interface AltosFontListener {
+ void font_size_changed(int font_size);
+}
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package altosui;
+package org.altusmetrum.AltosLib;
public class AltosCRCException extends Exception {
public int rssi;
/*
* Sensor data conversion functions
*/
-package altosui;
+package org.altusmetrum.AltosLib;
public class AltosConvert {
/*
+++ /dev/null
-/*
- * Copyright © 2011 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.
- */
-
-package altosui;
-
-public interface AltosFontListener {
- void font_size_changed(int font_size);
-}
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package altosui;
+package org.altusmetrum.AltosLib;
import java.awt.*;
import java.awt.event.*;
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package altosui;
+package org.altusmetrum.AltosLib;
import java.lang.*;
import java.text.*;
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package altosui;
+package org.altusmetrum.AltosLib;
public class AltosGPSSat {
int svid;
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package altosui;
+package org.altusmetrum.AltosLib;
public class AltosLine {
public String line;
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package altosui;
+package org.altusmetrum.AltosLib;
import java.text.*;
import java.lang.*;
static int parse_int(String v) throws ParseException {
try {
- return Altos.fromdec(v);
+ return AltosLib.fromdec(v);
} catch (NumberFormatException e) {
throw new ParseException("error parsing int " + v, 0);
}
static int parse_hex(String v) throws ParseException {
try {
- return Altos.fromhex(v);
+ return AltosLib.fromhex(v);
} catch (NumberFormatException e) {
throw new ParseException("error parsing hex " + v, 0);
}
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package altosui;
+package org.altusmetrum.AltosLib;
import java.lang.*;
import java.text.*;
}
public String state() {
- return Altos.state_name(state);
+ return AltosLib.state_name(state);
}
public static String gets(FileInputStream s) throws IOException {
flight = 0;
rssi = 0;
status = 0;
- state = Altos.ao_flight_startup;
+ state = AltosLib.ao_flight_startup;
tick = 0;
accel = MISSING;
pres = MISSING;
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package altosui;
+package org.altusmetrum.AltosLib;
public class AltosRecordCompanion {
final static int board_id_telescience = 0x0a;
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package altosui;
+package org.altusmetrum.AltosLib;
import java.awt.*;
import java.awt.event.*;
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package altosui;
+package org.altusmetrum.AltosLib;
import java.lang.*;
import java.text.*;
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package altosui;
+package org.altusmetrum.AltosLib;
import java.io.*;
import java.util.*;
current_tick = tick;
record.tick = current_tick;
}
- if (!saw_boost && record.state >= Altos.ao_flight_boost)
+ if (!saw_boost && record.state >= AltosLib.ao_flight_boost)
{
saw_boost = true;
boost_tick = record.tick;
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package altosui;
+package org.altusmetrum.AltosLib;
import java.lang.*;
import java.text.*;
import java.util.HashMap;
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package altosui;
+package org.altusmetrum.AltosLib;
import java.lang.*;
import java.text.*;
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package altosui;
+package org.altusmetrum.AltosLib;
public interface AltosTelemetryRecord {
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package altosui;
+package org.altusmetrum.AltosLib;
public class AltosTelemetryRecordCompanion extends AltosTelemetryRecordRaw {
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package altosui;
+package org.altusmetrum.AltosLib;
public class AltosTelemetryRecordConfiguration extends AltosTelemetryRecordRaw {
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package altosui;
+package org.altusmetrum.AltosLib;
import java.lang.*;
import java.text.*;
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package altosui;
+package org.altusmetrum.AltosLib;
import java.lang.*;
import java.text.*;
serial = map.get_int(AO_TELEM_SERIAL, MISSING);
flight = map.get_int(AO_TELEM_FLIGHT, MISSING);
rssi = map.get_int(AO_TELEM_RSSI, MISSING);
- state = Altos.state(map.get_string(AO_TELEM_STATE, "invalid"));
+ state = AltosLib.state(map.get_string(AO_TELEM_STATE, "invalid"));
tick = map.get_int(AO_TELEM_TICK, 0);
/* raw sensor values */
status = AltosParse.parse_hex(words[i++]);
AltosParse.word(words[i++], "STATE");
- state = Altos.state(words[i++]);
+ state = AltosLib.state(words[i++]);
tick = AltosParse.parse_int(words[i++]);
int adjust;
private int int8(int i) {
- return Altos.int8(bytes, i + 1 + adjust);
+ return AltosLib.int8(bytes, i + 1 + adjust);
}
private int uint8(int i) {
- return Altos.uint8(bytes, i + 1 + adjust);
+ return AltosLib.uint8(bytes, i + 1 + adjust);
}
private int int16(int i) {
- return Altos.int16(bytes, i + 1 + adjust);
+ return AltosLib.int16(bytes, i + 1 + adjust);
}
private int uint16(int i) {
- return Altos.uint16(bytes, i + 1 + adjust);
+ return AltosLib.uint16(bytes, i + 1 + adjust);
}
private int uint32(int i) {
- return Altos.uint32(bytes, i + 1 + adjust);
+ return AltosLib.uint32(bytes, i + 1 + adjust);
}
private String string(int i, int l) {
- return Altos.string(bytes, i + 1 + adjust, l);
+ return AltosLib.string(bytes, i + 1 + adjust, l);
}
static final int AO_GPS_NUM_SAT_MASK = (0xf << 0);
version = 4;
adjust = 0;
- if (bytes.length == Altos.ao_telemetry_0_8_len + 4) {
+ if (bytes.length == AltosLib.ao_telemetry_0_8_len + 4) {
serial = uint8(0);
adjust = -1;
} else
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package altosui;
+package org.altusmetrum.AltosLib;
public class AltosTelemetryRecordLocation extends AltosTelemetryRecordRaw {
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package altosui;
+package org.altusmetrum.AltosLib;
import java.lang.*;
import java.text.*;
int[] bytes;
try {
- bytes = Altos.hexbytes(hex);
+ bytes = AltosLib.hexbytes(hex);
} catch (NumberFormatException ne) {
throw new ParseException(ne.getMessage(), 0);
}
if (!cksum(bytes))
throw new ParseException(String.format("invalid line \"%s\"", hex), 0);
- int rssi = Altos.int8(bytes, bytes.length - 3) / 2 - 74;
- int status = Altos.uint8(bytes, bytes.length - 2);
+ int rssi = AltosLib.int8(bytes, bytes.length - 3) / 2 - 74;
+ int status = AltosLib.uint8(bytes, bytes.length - 2);
if ((status & PKT_APPEND_STATUS_1_CRC_OK) == 0)
throw new AltosCRCException(rssi);
/* length, data ..., rssi, status, checksum -- 4 bytes extra */
switch (bytes.length) {
- case Altos.ao_telemetry_standard_len + 4:
- int type = Altos.uint8(bytes, 4 + 1);
+ case AltosLib.ao_telemetry_standard_len + 4:
+ int type = AltosLib.uint8(bytes, 4 + 1);
switch (type) {
case packet_type_TM_sensor:
case packet_type_Tm_sensor:
break;
}
break;
- case Altos.ao_telemetry_0_9_len + 4:
+ case AltosLib.ao_telemetry_0_9_len + 4:
r = new AltosTelemetryRecordLegacy(bytes, rssi, status);
break;
- case Altos.ao_telemetry_0_8_len + 4:
+ case AltosLib.ao_telemetry_0_8_len + 4:
r = new AltosTelemetryRecordLegacy(bytes, rssi, status);
break;
default:
}
public int int8(int off) {
- return Altos.int8(bytes, off + 1);
+ return AltosLib.int8(bytes, off + 1);
}
public int uint8(int off) {
- return Altos.uint8(bytes, off + 1);
+ return AltosLib.uint8(bytes, off + 1);
}
public int int16(int off) {
- return Altos.int16(bytes, off + 1);
+ return AltosLib.int16(bytes, off + 1);
}
public int uint16(int off) {
- return Altos.uint16(bytes, off + 1);
+ return AltosLib.uint16(bytes, off + 1);
}
public int uint32(int off) {
- return Altos.uint32(bytes, off + 1);
+ return AltosLib.uint32(bytes, off + 1);
}
public String string(int off, int l) {
- return Altos.string(bytes, off + 1, l);
+ return AltosLib.string(bytes, off + 1, l);
}
public AltosTelemetryRecordRaw(int[] in_bytes) {
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package altosui;
+package org.altusmetrum.AltosLib;
public class AltosTelemetryRecordSatellite extends AltosTelemetryRecordRaw {
int channels;
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package altosui;
+package org.altusmetrum.AltosLib;
public class AltosTelemetryRecordSensor extends AltosTelemetryRecordRaw {