diff options
| author | Keith Packard <keithp@keithp.com> | 2013-09-05 11:50:41 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2013-09-05 11:50:41 -0700 | 
| commit | 3325df306933f080619f13ba1db45de484613d5a (patch) | |
| tree | a2a4b8bd42cedce421a92dad0392f4c9eca48cab | |
| parent | e9e9c6592c49109288a4e02e780b130fadb97db7 (diff) | |
altoslib: Remove AltosRecord-based telemetry code
All of this is now AltosState based
Signed-off-by: Keith Packard <keithp@keithp.com>
| -rw-r--r-- | altoslib/AltosTelemetryRecord.java | 136 | ||||
| -rw-r--r-- | altoslib/AltosTelemetryRecordCompanion.java | 52 | ||||
| -rw-r--r-- | altoslib/AltosTelemetryRecordConfiguration.java | 64 | ||||
| -rw-r--r-- | altoslib/AltosTelemetryRecordGeneral.java | 41 | ||||
| -rw-r--r-- | altoslib/AltosTelemetryRecordLegacy.java | 521 | ||||
| -rw-r--r-- | altoslib/AltosTelemetryRecordLocation.java | 93 | ||||
| -rw-r--r-- | altoslib/AltosTelemetryRecordMegaData.java | 94 | ||||
| -rw-r--r-- | altoslib/AltosTelemetryRecordMegaSensor.java | 88 | ||||
| -rw-r--r-- | altoslib/AltosTelemetryRecordMetrumData.java | 54 | ||||
| -rw-r--r-- | altoslib/AltosTelemetryRecordMetrumSensor.java | 81 | ||||
| -rw-r--r-- | altoslib/AltosTelemetryRecordMini.java | 82 | ||||
| -rw-r--r-- | altoslib/AltosTelemetryRecordRaw.java | 81 | ||||
| -rw-r--r-- | altoslib/AltosTelemetryRecordSatellite.java | 52 | ||||
| -rw-r--r-- | altoslib/AltosTelemetryRecordSensor.java | 104 | 
14 files changed, 0 insertions, 1543 deletions
| diff --git a/altoslib/AltosTelemetryRecord.java b/altoslib/AltosTelemetryRecord.java deleted file mode 100644 index a46c1a33..00000000 --- a/altoslib/AltosTelemetryRecord.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * 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_2; -import java.text.*; - -public abstract class AltosTelemetryRecord { - -	long	received_time; -	abstract public AltosRecord update_state(AltosRecord previous); - -	static boolean cksum(int[] bytes) { -		int	sum = 0x5a; -		for (int i = 1; i < bytes.length - 1; i++) -			sum += bytes[i]; -		sum &= 0xff; -		return sum == bytes[bytes.length - 1]; -	} - -	final static int PKT_APPEND_STATUS_1_CRC_OK		= (1 << 7); -	final static int PKT_APPEND_STATUS_1_LQI_MASK		= (0x7f); -	final static int PKT_APPEND_STATUS_1_LQI_SHIFT		= 0; - -	final static int packet_type_TM_sensor = 0x01; -	final static int packet_type_Tm_sensor = 0x02; -	final static int packet_type_Tn_sensor = 0x03; -	final static int packet_type_configuration = 0x04; -	final static int packet_type_location = 0x05; -	final static int packet_type_satellite = 0x06; -	final static int packet_type_companion = 0x07; -	final static int packet_type_MM_sensor = 0x08; -	final static int packet_type_MM_data = 0x09; -	final static int packet_type_Mini = 0x10; -	 -	static AltosTelemetryRecord parse_hex(String hex)  throws ParseException, AltosCRCException { -		AltosTelemetryRecord	r; - -		int[] bytes; -		try { -			bytes = AltosLib.hexbytes(hex); -		} catch (NumberFormatException ne) { -			throw new ParseException(ne.getMessage(), 0); -		} - -		/* one for length, one for checksum */ -		if (bytes[0] != bytes.length - 2) -			throw new ParseException(String.format("invalid length %d != %d\n", -							       bytes[0], -							       bytes.length - 2), 0); -		if (!cksum(bytes)) -			throw new ParseException(String.format("invalid line \"%s\"", hex), 0); - -		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 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: -			case packet_type_Tn_sensor: -				r = new AltosTelemetryRecordSensor(bytes, rssi); -				break; -			case packet_type_configuration: -				r = new AltosTelemetryRecordConfiguration(bytes, rssi); -				break; -			case packet_type_location: -				r = new AltosTelemetryRecordLocation(bytes, rssi); -				break; -			case packet_type_satellite: -				r = new AltosTelemetryRecordSatellite(bytes, rssi); -				break; -			case packet_type_companion: -				r = new AltosTelemetryRecordCompanion(bytes, rssi); -				break; -			case packet_type_MM_sensor: -				r = new AltosTelemetryRecordMegaSensor(bytes, rssi); -				break; -			case packet_type_MM_data: -				r = new AltosTelemetryRecordMegaData(bytes, rssi); -				break; -			default: -				r = new AltosTelemetryRecordRaw(bytes, rssi); -				break; -			} -			break; -		case AltosLib.ao_telemetry_0_9_len + 4: -			r = new AltosTelemetryRecordLegacy(bytes, rssi, status); -			break; -		case AltosLib.ao_telemetry_0_8_len + 4: -			r = new AltosTelemetryRecordLegacy(bytes, rssi, status); -			break; -		default: -			throw new ParseException(String.format("Invalid packet length %d", bytes.length), 0); -		} -		r.received_time = System.currentTimeMillis(); -		return r; -	} - -	public static AltosTelemetryRecord parse(String line) throws ParseException, AltosCRCException { -		AltosTelemetryRecord	r; - -		String[] word = line.split("\\s+"); -		int i =0; -		if (word[i].equals("CRC") && word[i+1].equals("INVALID")) { -			i += 2; -			AltosParse.word(word[i++], "RSSI"); -			throw new AltosCRCException(AltosParse.parse_int(word[i++])); -		} - -		if (word[i].equals("TELEM")) -			r = parse_hex(word[i+1]); -		else -			r = new AltosTelemetryRecordLegacy(line); -		return r; -	} -} diff --git a/altoslib/AltosTelemetryRecordCompanion.java b/altoslib/AltosTelemetryRecordCompanion.java deleted file mode 100644 index 9c38ba0a..00000000 --- a/altoslib/AltosTelemetryRecordCompanion.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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_2; - -public class AltosTelemetryRecordCompanion extends AltosTelemetryRecordRaw { - -	AltosRecordCompanion	companion; - -	public AltosTelemetryRecordCompanion(int[] in_bytes, int rssi) { -		super(in_bytes, rssi); - -		int	off = 0; -		if (uint8(6) == 0) -			off = 1; -		int channels = uint8(7+off); - -		if (off != 0 && channels >= 12) -			channels = 11; - -		companion = new AltosRecordCompanion(channels); -		companion.tick		= tick; -		companion.board_id      = uint8(5); -		companion.update_period = uint8(6+off); -		for (int i = 0; i < companion.companion_data.length; i++) -			companion.companion_data[i] = uint16(8 + off + i * 2); -	} - -	public AltosRecord update_state(AltosRecord previous) { -		AltosRecord	next = super.update_state(previous); - -		next.companion = companion; -		next.seen |= AltosRecord.seen_sensor | AltosRecord.seen_temp_volt; - -		companion.tick = tick; -		return next; -	} -} diff --git a/altoslib/AltosTelemetryRecordConfiguration.java b/altoslib/AltosTelemetryRecordConfiguration.java deleted file mode 100644 index 48474fa5..00000000 --- a/altoslib/AltosTelemetryRecordConfiguration.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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_2; - - -public class AltosTelemetryRecordConfiguration extends AltosTelemetryRecordRaw { -	int	device_type; -	int	flight; -	int	config_major; -	int	config_minor; -	int	apogee_delay; -	int	main_deploy; -	int	flight_log_max; -	String	callsign; -	String	version; - -	public AltosTelemetryRecordConfiguration(int[] in_bytes, int rssi) { -		super(in_bytes, rssi); - -		device_type    = uint8(5); -		flight         = uint16(6); -		config_major   = uint8(8); -		config_minor   = uint8(9); -		apogee_delay   = uint16(10); -		main_deploy    = uint16(12); -		flight_log_max = uint16(14); -		callsign       = string(16, 8); -		version        = string(24, 8); -	} - -	public AltosRecord update_state(AltosRecord previous) { -		AltosRecord	next = super.update_state(previous); - -		next.device_type = device_type; -		next.flight = flight; -		next.config_major = config_major; -		next.config_minor = config_minor; -		next.apogee_delay = apogee_delay; -		next.main_deploy = main_deploy; -		next.flight_log_max = flight_log_max; - -		next.callsign = callsign; -		next.firmware_version = version; - -		next.seen |= AltosRecord.seen_deploy | AltosRecord.seen_flight; - -		return next; -	} -} diff --git a/altoslib/AltosTelemetryRecordGeneral.java b/altoslib/AltosTelemetryRecordGeneral.java deleted file mode 100644 index 258678c7..00000000 --- a/altoslib/AltosTelemetryRecordGeneral.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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_2; - -import java.text.*; - -public class AltosTelemetryRecordGeneral { - -	static AltosTelemetryRecord parse(String line) throws ParseException, AltosCRCException { -		AltosTelemetryRecord	r; - -		String[] word = line.split("\\s+"); -		int i =0; -		if (word[i].equals("CRC") && word[i+1].equals("INVALID")) { -			i += 2; -			AltosParse.word(word[i++], "RSSI"); -			throw new AltosCRCException(AltosParse.parse_int(word[i++])); -		} - -		if (word[i].equals("TELEM")) -			r = AltosTelemetryRecordRaw.parse(word[i+1]); -		else -			r = new AltosTelemetryRecordLegacy(line); -		return r; -	} -} diff --git a/altoslib/AltosTelemetryRecordLegacy.java b/altoslib/AltosTelemetryRecordLegacy.java deleted file mode 100644 index 5f86d671..00000000 --- a/altoslib/AltosTelemetryRecordLegacy.java +++ /dev/null @@ -1,521 +0,0 @@ -/* - * Copyright © 2010 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_2; - -import java.text.*; - -/* - * Telemetry data contents - */ - - -/* - * The packet format is a simple hex dump of the raw telemetry frame. - * It starts with 'TELEM', then contains hex digits with a checksum as the last - * byte on the line. - * - * Version 4 is a replacement with consistent syntax. Each telemetry line - * contains a sequence of space-separated names and values, the values are - * either integers or strings. The names are all unique. All values are - * optional - * - * VERSION 4 c KD7SQG n 236 f 18 r -25 s pad t 513 r_a 15756 r_b 26444 r_t 20944 - *   r_v 26640 r_d 512 r_m 208 c_a 15775 c_b 26439 c_p 15749 c_m 16281 a_a 15764 - *   a_s 0 a_b 26439 g_s u g_n 0 s_n 0 - * - * VERSION 4 c KD7SQG n 19 f 0 r -23 s pad t 513 r_b 26372 r_t 21292 r_v 26788 - *   r_d 136 r_m 140 c_b 26370 k_h 0 k_s 0 k_a 0 - * - * General header fields - * - *	Name		Value - * - *	VERSION		Telemetry version number (4 or more). Must be first. - * 	c		Callsign (string, no spaces allowed) - *	n		Flight unit serial number (integer) - * 	f		Flight number (integer) - *	r		Packet RSSI value (integer) - * 	s		Flight computer state (string, no spaces allowed) - *	t		Flight computer clock (integer in centiseconds) - * - * Version 3 is Version 2 with fixed RSSI numbers -- the radio reports - * in 1/2dB increments while this protocol provides only integers. So, - * the syntax didn't change just the interpretation of the RSSI - * values. - * - * Version 2 of the telemetry data stream is a bit of a mess, with no - * consistent formatting. In particular, the GPS data is formatted for - * viewing instead of parsing.  However, the key feature is that every - * telemetry line contains all of the information necessary to - * describe the current rocket state, including the calibration values - * for accelerometer and barometer. - * - * GPS unlocked: - * - * VERSION 2 CALL KB0G SERIAL  51 FLIGHT     2 RSSI  -68 STATUS ff STATE     pad  1001 \ - *    a: 16032 p: 21232 t: 20284 v: 25160 d:   204 m:   204 fa: 16038 ga: 16032 fv:       0 \ - *    fp: 21232 gp: 21230 a+: 16049 a-: 16304 GPS  0 sat unlocked SAT 1   15  30 - * - * GPS locked: - * - * VERSION 2 CALL KB0G SERIAL  51 FLIGHT     2 RSSI  -71 STATUS ff STATE     pad  2504 \ - *     a: 16028 p: 21220 t: 20360 v: 25004 d:   208 m:   200 fa: 16031 ga: 16032 fv:     330 \ - *     fp: 21231 gp: 21230 a+: 16049 a-: 16304 \ - *     GPS  9 sat 2010-02-13 17:16:51 35°20.0803'N 106°45.2235'W  1790m  \ - *     0.00m/s(H) 0°     0.00m/s(V) 1.0(hdop)     0(herr)     0(verr) \ - *     SAT 10   29  30  24  28   5  25  21  20  15  33   1  23  30  24  18  26  10  29   2  26 - * - */ - -public class AltosTelemetryRecordLegacy extends AltosTelemetryRecord { -	/* -	 * General header fields -	 * -	 *	Name		Value -	 * -	 *	VERSION		Telemetry version number (4 or more). Must be first. -	 * 	c		Callsign (string, no spaces allowed) -	 *	n		Flight unit serial number (integer) -	 * 	f		Flight number (integer) -	 *	r		Packet RSSI value (integer) -	 * 	s		Flight computer state (string, no spaces allowed) -	 *	t		Flight computer clock (integer in centiseconds) -	 */ - -	final static String AO_TELEM_VERSION	= "VERSION"; -	final static String AO_TELEM_CALL	= "c"; -	final static String AO_TELEM_SERIAL	= "n"; -	final static String AO_TELEM_FLIGHT	= "f"; -	final static String AO_TELEM_RSSI	= "r"; -	final static String AO_TELEM_STATE	= "s"; -	final static String AO_TELEM_TICK	= "t"; - -	/* -	 * Raw sensor values -	 * -	 *	Name		Value -	 *	r_a		Accelerometer reading (integer) -	 *	r_b		Barometer reading (integer) -	 *	r_t		Thermometer reading (integer) -	 *	r_v		Battery reading (integer) -	 *	r_d		Drogue continuity (integer) -	 *	r_m		Main continuity (integer) -	 */ - -	final static String AO_TELEM_RAW_ACCEL	= "r_a"; -	final static String AO_TELEM_RAW_BARO	= "r_b"; -	final static String AO_TELEM_RAW_THERMO	= "r_t"; -	final static String AO_TELEM_RAW_BATT	= "r_v"; -	final static String AO_TELEM_RAW_DROGUE	= "r_d"; -	final static String AO_TELEM_RAW_MAIN	= "r_m"; - -	/* -	 * Sensor calibration values -	 * -	 *	Name		Value -	 *	c_a		Ground accelerometer reading (integer) -	 *	c_b		Ground barometer reading (integer) -	 *	c_p		Accelerometer reading for +1g -	 *	c_m		Accelerometer reading for -1g -	 */ - -	final static String AO_TELEM_CAL_ACCEL_GROUND	= "c_a"; -	final static String AO_TELEM_CAL_BARO_GROUND	= "c_b"; -	final static String AO_TELEM_CAL_ACCEL_PLUS	= "c_p"; -	final static String AO_TELEM_CAL_ACCEL_MINUS	= "c_m"; - -	/* -	 * Kalman state values -	 * -	 *	Name		Value -	 *	k_h		Height above pad (integer, meters) -	 *	k_s		Vertical speeed (integer, m/s * 16) -	 *	k_a		Vertical acceleration (integer, m/s² * 16) -	 */ - -	final static String AO_TELEM_KALMAN_HEIGHT	= "k_h"; -	final static String AO_TELEM_KALMAN_SPEED	= "k_s"; -	final static String AO_TELEM_KALMAN_ACCEL	= "k_a"; - -	/* -	 * Ad-hoc flight values -	 * -	 *	Name		Value -	 *	a_a		Acceleration (integer, sensor units) -	 *	a_s		Speed (integer, integrated acceleration value) -	 *	a_b		Barometer reading (integer, sensor units) -	 */ - -	final static String AO_TELEM_ADHOC_ACCEL	= "a_a"; -	final static String AO_TELEM_ADHOC_SPEED	= "a_s"; -	final static String AO_TELEM_ADHOC_BARO		= "a_b"; - -	/* -	 * GPS values -	 * -	 *	Name		Value -	 *	g_s		GPS state (string): -	 *				l	locked -	 *				u	unlocked -	 *				e	error (missing or broken) -	 *	g_n		Number of sats used in solution -	 *	g_ns		Latitude (degrees * 10e7) -	 *	g_ew		Longitude (degrees * 10e7) -	 *	g_a		Altitude (integer meters) -	 *	g_Y		GPS year (integer) -	 *	g_M		GPS month (integer - 1-12) -	 *	g_D		GPS day (integer - 1-31) -	 *	g_h		GPS hour (integer - 0-23) -	 *	g_m		GPS minute (integer - 0-59) -	 *	g_s		GPS second (integer - 0-59) -	 *	g_v		GPS vertical speed (integer, cm/sec) -	 *	g_s		GPS horizontal speed (integer, cm/sec) -	 *	g_c		GPS course (integer, 0-359) -	 *	g_hd		GPS hdop (integer * 10) -	 *	g_vd		GPS vdop (integer * 10) -	 *	g_he		GPS h error (integer) -	 *	g_ve		GPS v error (integer) -	 */ - -	final static String AO_TELEM_GPS_STATE	 		= "g"; -	final static String AO_TELEM_GPS_STATE_LOCKED		= "l"; -	final static String AO_TELEM_GPS_STATE_UNLOCKED		= "u"; -	final static String AO_TELEM_GPS_STATE_ERROR		= "e"; -	final static String AO_TELEM_GPS_NUM_SAT		= "g_n"; -	final static String AO_TELEM_GPS_LATITUDE		= "g_ns"; -	final static String AO_TELEM_GPS_LONGITUDE		= "g_ew"; -	final static String AO_TELEM_GPS_ALTITUDE		= "g_a"; -	final static String AO_TELEM_GPS_YEAR			= "g_Y"; -	final static String AO_TELEM_GPS_MONTH			= "g_M"; -	final static String AO_TELEM_GPS_DAY			= "g_D"; -	final static String AO_TELEM_GPS_HOUR			= "g_h"; -	final static String AO_TELEM_GPS_MINUTE			= "g_m"; -	final static String AO_TELEM_GPS_SECOND			= "g_s"; -	final static String AO_TELEM_GPS_VERTICAL_SPEED		= "g_v"; -	final static String AO_TELEM_GPS_HORIZONTAL_SPEED	= "g_g"; -	final static String AO_TELEM_GPS_COURSE			= "g_c"; -	final static String AO_TELEM_GPS_HDOP			= "g_hd"; -	final static String AO_TELEM_GPS_VDOP			= "g_vd"; -	final static String AO_TELEM_GPS_HERROR			= "g_he"; -	final static String AO_TELEM_GPS_VERROR			= "g_ve"; - -	/* -	 * GPS satellite values -	 * -	 *	Name		Value -	 *	s_n		Number of satellites reported (integer) -	 *	s_v0		Space vehicle ID (integer) for report 0 -	 *	s_c0		C/N0 number (integer) for report 0 -	 *	s_v1		Space vehicle ID (integer) for report 1 -	 *	s_c1		C/N0 number (integer) for report 1 -	 *	... -	 */ - -	final static String AO_TELEM_SAT_NUM	= "s_n"; -	final static String AO_TELEM_SAT_SVID	= "s_v"; -	final static String AO_TELEM_SAT_C_N_0	= "s_c"; - -	AltosRecordTM	record; - -	private void parse_v4(String[] words, int i) throws ParseException { -		AltosTelemetryMap	map = new AltosTelemetryMap(words, i); - -		record.callsign = map.get_string(AO_TELEM_CALL, "N0CALL"); -		record.serial = map.get_int(AO_TELEM_SERIAL, AltosLib.MISSING); -		record.flight = map.get_int(AO_TELEM_FLIGHT, AltosLib.MISSING); -		record.rssi = map.get_int(AO_TELEM_RSSI, AltosLib.MISSING); -		record.state = AltosLib.state(map.get_string(AO_TELEM_STATE, "invalid")); -		record.tick = map.get_int(AO_TELEM_TICK, 0); - -		/* raw sensor values */ -		record.accel = map.get_int(AO_TELEM_RAW_ACCEL, AltosLib.MISSING); -		record.pres = map.get_int(AO_TELEM_RAW_BARO, AltosLib.MISSING); -		record.temp = map.get_int(AO_TELEM_RAW_THERMO, AltosLib.MISSING); -		record.batt = map.get_int(AO_TELEM_RAW_BATT, AltosLib.MISSING); -		record.drogue = map.get_int(AO_TELEM_RAW_DROGUE, AltosLib.MISSING); -		record.main = map.get_int(AO_TELEM_RAW_MAIN, AltosLib.MISSING); - -		/* sensor calibration information */ -		record.ground_accel = map.get_int(AO_TELEM_CAL_ACCEL_GROUND, AltosLib.MISSING); -		record.ground_pres = map.get_int(AO_TELEM_CAL_BARO_GROUND, AltosLib.MISSING); -		record.accel_plus_g = map.get_int(AO_TELEM_CAL_ACCEL_PLUS, AltosLib.MISSING); -		record.accel_minus_g = map.get_int(AO_TELEM_CAL_ACCEL_MINUS, AltosLib.MISSING); - -		/* flight computer values */ -		record.kalman_acceleration = map.get_double(AO_TELEM_KALMAN_ACCEL, AltosLib.MISSING, 1/16.0); -		record.kalman_speed = map.get_double(AO_TELEM_KALMAN_SPEED, AltosLib.MISSING, 1/16.0); -		record.kalman_height = map.get_int(AO_TELEM_KALMAN_HEIGHT, AltosLib.MISSING); - -		record.flight_accel = map.get_int(AO_TELEM_ADHOC_ACCEL, AltosLib.MISSING); -		record.flight_vel = map.get_int(AO_TELEM_ADHOC_SPEED, AltosLib.MISSING); -		record.flight_pres = map.get_int(AO_TELEM_ADHOC_BARO, AltosLib.MISSING); - -		if (map.has(AO_TELEM_GPS_STATE)) { -		record.gps = new AltosGPS(map); -		record.gps_sequence++; -		} -		else -		record.gps = null; -	} - -	private void parse_legacy(String[] words, int i) throws ParseException { - -		AltosParse.word (words[i++], "CALL"); -		record.callsign = words[i++]; - -		AltosParse.word (words[i++], "SERIAL"); -		record.serial = AltosParse.parse_int(words[i++]); - -		if (record.version >= 2) { -			AltosParse.word (words[i++], "FLIGHT"); -			record.flight = AltosParse.parse_int(words[i++]); -		} else -			record.flight = 0; - -		AltosParse.word(words[i++], "RSSI"); -		record.rssi = AltosParse.parse_int(words[i++]); - -		/* Older telemetry data had mis-computed RSSI value */ -		if (record.version <= 2) -			record.rssi = (record.rssi + 74) / 2 - 74; - -		AltosParse.word(words[i++], "STATUS"); -		record.status = AltosParse.parse_hex(words[i++]); - -		AltosParse.word(words[i++], "STATE"); -		record.state = AltosLib.state(words[i++]); - -		record.tick = AltosParse.parse_int(words[i++]); - -		AltosParse.word(words[i++], "a:"); -		record.accel = AltosParse.parse_int(words[i++]); - -		AltosParse.word(words[i++], "p:"); -		record.pres = AltosParse.parse_int(words[i++]); - -		AltosParse.word(words[i++], "t:"); -		record.temp = AltosParse.parse_int(words[i++]); - -		AltosParse.word(words[i++], "v:"); -		record.batt = AltosParse.parse_int(words[i++]); - -		AltosParse.word(words[i++], "d:"); -		record.drogue = AltosParse.parse_int(words[i++]); - -		AltosParse.word(words[i++], "m:"); -		record.main = AltosParse.parse_int(words[i++]); - -		AltosParse.word(words[i++], "fa:"); -		record.flight_accel = AltosParse.parse_int(words[i++]); - -		AltosParse.word(words[i++], "ga:"); -		record.ground_accel = AltosParse.parse_int(words[i++]); - -		AltosParse.word(words[i++], "fv:"); -		record.flight_vel = AltosParse.parse_int(words[i++]); - -		AltosParse.word(words[i++], "fp:"); -		record.flight_pres = AltosParse.parse_int(words[i++]); - -		/* Old TeleDongle code with kalman-reporting TeleMetrum code */ -		if ((record.flight_vel & 0xffff0000) == 0x80000000) { -			record.kalman_speed = ((short) record.flight_vel) / 16.0; -			record.kalman_acceleration = record.flight_accel / 16.0; -			record.kalman_height = record.flight_pres; -			record.flight_vel = AltosLib.MISSING; -			record.flight_pres = AltosLib.MISSING; -			record.flight_accel = AltosLib.MISSING; -		} - -		AltosParse.word(words[i++], "gp:"); -		record.ground_pres = AltosParse.parse_int(words[i++]); - -		if (record.version >= 1) { -			AltosParse.word(words[i++], "a+:"); -			record.accel_plus_g = AltosParse.parse_int(words[i++]); - -			AltosParse.word(words[i++], "a-:"); -			record.accel_minus_g = AltosParse.parse_int(words[i++]); -		} else { -			record.accel_plus_g = record.ground_accel; -			record.accel_minus_g = record.ground_accel + 530; -		} - -		record.gps = new AltosGPS(words, i, record.version); -		record.gps_sequence++; -	} - -	public AltosTelemetryRecordLegacy(String line) throws ParseException, AltosCRCException { -		String[] words = line.split("\\s+"); -		int	i = 0; - -		record = new AltosRecordTM(); - -		if (words[i].equals("CRC") && words[i+1].equals("INVALID")) { -			i += 2; -			AltosParse.word(words[i++], "RSSI"); -			record.rssi = AltosParse.parse_int(words[i++]); -			throw new AltosCRCException(record.rssi); -		} -		if (words[i].equals("CALL")) { -			record.version = 0; -		} else { -			AltosParse.word (words[i++], "VERSION"); -			record.version = AltosParse.parse_int(words[i++]); -		} - -		if (record.version < 4) -			parse_legacy(words, i); -		else -			parse_v4(words, i); -	} - -	/* -	 * Given a hex dump of a legacy telemetry line, construct an AltosRecordTM from that -	 */ - -	int[]	bytes; -	int	adjust; - -	/* -	private int int8(int i) { -		return AltosLib.int8(bytes, i + 1 + adjust); -	} -	*/ -	private int uint8(int i) { -		return AltosLib.uint8(bytes, i + 1 + adjust); -	} -	private int int16(int i) { -		return AltosLib.int16(bytes, i + 1 + adjust); -	} -	private int uint16(int i) { -		return AltosLib.uint16(bytes, i + 1 + adjust); -	} -	private int uint32(int i) { -		return AltosLib.uint32(bytes, i + 1 + adjust); -	} -	private String string(int i, int l) { -		return AltosLib.string(bytes, i + 1 + adjust, l); -	} - -	static final int AO_GPS_NUM_SAT_MASK	= (0xf << 0); -	static final int AO_GPS_NUM_SAT_SHIFT	= (0); - -	static final int AO_GPS_VALID		= (1 << 4); -	static final int AO_GPS_RUNNING		= (1 << 5); -	static final int AO_GPS_DATE_VALID	= (1 << 6); -	static final int AO_GPS_COURSE_VALID	= (1 << 7); - -	public AltosTelemetryRecordLegacy(int[] in_bytes, int in_rssi, int in_status) { -		record = new AltosRecordTM(); - -		bytes = in_bytes; -		record.version = 4; -		adjust = 0; - -		if (bytes.length == AltosLib.ao_telemetry_0_8_len + 4) { -			record.serial = uint8(0); -			adjust = -1; -		} else -			record.serial = uint16(0); - -		record.seen = AltosRecord.seen_flight | AltosRecord.seen_sensor | AltosRecord.seen_temp_volt | AltosRecord.seen_deploy; - -		record.callsign = string(62, 8); -		record.flight = uint16(2); -		record.rssi = in_rssi; -		record.status = in_status; -		record.state = uint8(4); -		record.tick = uint16(21); -		record.accel = int16(23); -		record.pres = int16(25); -		record.temp = int16(27); -		record.batt = int16(29); -		record.drogue = int16(31); -		record.main = int16(33); -		 -		record.ground_accel = int16(7); -		record.ground_pres = int16(15); -		record.accel_plus_g = int16(17); -		record.accel_minus_g = int16(19); - -		if (uint16(11) == 0x8000) { -			record.kalman_acceleration = int16(5); -			record.kalman_speed = int16(9); -			record.kalman_height = int16(13); -			record.flight_accel = AltosLib.MISSING; -			record.flight_vel = AltosLib.MISSING; -			record.flight_pres = AltosLib.MISSING; -		} else { -			record.flight_accel = int16(5); -			record.flight_vel = uint32(9); -			record.flight_pres = int16(13); -			record.kalman_acceleration = AltosLib.MISSING; -			record.kalman_speed = AltosLib.MISSING; -			record.kalman_height = AltosLib.MISSING; -		} - -		record.gps = null; - -		int gps_flags = uint8(41); - -		if ((gps_flags & (AO_GPS_VALID|AO_GPS_RUNNING)) != 0) { -			record.gps = new AltosGPS(); -			record.gps_sequence++; - -			record.seen |= AltosRecord.seen_gps_time | AltosRecord.seen_gps_lat | AltosRecord.seen_gps_lon; -			record.gps.nsat = (gps_flags & AO_GPS_NUM_SAT_MASK); -			record.gps.locked = (gps_flags & AO_GPS_VALID) != 0; -			record.gps.connected = true; -			record.gps.lat = uint32(42) / 1.0e7; -			record.gps.lon = uint32(46) / 1.0e7; -			record.gps.alt = int16(50); -			record.gps.ground_speed = uint16(52) / 100.0; -			record.gps.course = uint8(54) * 2; -			record.gps.hdop = uint8(55) / 5.0; -			record.gps.h_error = uint16(58); -			record.gps.v_error = uint16(60); - -			int	n_tracking_reported = uint8(70); -			if (n_tracking_reported > 12) -				n_tracking_reported = 12; -			int	n_tracking_actual = 0; -			for (int i = 0; i < n_tracking_reported; i++) { -				if (uint8(71 + i*2) != 0) -					n_tracking_actual++; -			} -			if (n_tracking_actual > 0) { -				record.gps.cc_gps_sat = new AltosGPSSat[n_tracking_actual]; - -				n_tracking_actual = 0; -				for (int i = 0; i < n_tracking_reported; i++) { -					int	svid = uint8(71 + i*2); -					int	c_n0 = uint8(72 + i*2); -					if (svid != 0) -						record.gps.cc_gps_sat[n_tracking_actual++] = new AltosGPSSat(svid, c_n0); -				} -			} -		} - -		record.time = 0.0; -	} - -	public AltosRecord update_state(AltosRecord previous) { -		return record; -	} -} diff --git a/altoslib/AltosTelemetryRecordLocation.java b/altoslib/AltosTelemetryRecordLocation.java deleted file mode 100644 index 0eea8361..00000000 --- a/altoslib/AltosTelemetryRecordLocation.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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_2; - - -public class AltosTelemetryRecordLocation extends AltosTelemetryRecordRaw { -	int	flags; -	int	altitude; -	int	latitude; -	int	longitude; -	int	year; -	int	month; -	int	day; -	int	hour; -	int	minute; -	int	second; -	int	pdop; -	int	hdop; -	int	vdop; -	int	mode; -	int	ground_speed; -	int	climb_rate; -	int	course; - -	public AltosTelemetryRecordLocation(int[] in_bytes, int rssi) { -		super(in_bytes, rssi); - -		flags          = uint8(5); -		altitude       = int16(6); -		latitude       = uint32(8); -		longitude      = uint32(12); -		year	       = uint8(16); -		month	       = uint8(17); -		day	       = uint8(18); -		hour	       = uint8(19); -		minute	       = uint8(20); -		second	       = uint8(21); -		pdop	       = uint8(22); -		hdop	       = uint8(23); -		vdop	       = uint8(24); -		mode	       = uint8(25); -		ground_speed   = uint16(26); -		climb_rate     = int16(28); -		course	       = uint8(30); -	} - -	public AltosRecord update_state(AltosRecord previous) { -		AltosRecord	next = super.update_state(previous); - -		if (next.gps == null) -			next.gps = new AltosGPS(); - -		next.gps.nsat = flags & 0xf; -		next.gps.locked = (flags & (1 << 4)) != 0; -		next.gps.connected = (flags & (1 << 5)) != 0; - -		if (next.gps.locked) { -			next.gps.lat = latitude * 1.0e-7; -			next.gps.lon = longitude * 1.0e-7; -			next.gps.alt = altitude; -			next.gps.year = 2000 + year; -			next.gps.month = month; -			next.gps.day = day; -			next.gps.hour = hour; -			next.gps.minute = minute; -			next.gps.second = second; -			next.gps.ground_speed = ground_speed * 1.0e-2; -			next.gps.course = course * 2; -			next.gps.climb_rate = climb_rate * 1.0e-2; -			next.gps.hdop = hdop; -			next.gps.vdop = vdop; -			next.seen |= AltosRecord.seen_gps_time | AltosRecord.seen_gps_lat | AltosRecord.seen_gps_lon; -			next.gps_sequence++; -		} - -		return next; -	} -} diff --git a/altoslib/AltosTelemetryRecordMegaData.java b/altoslib/AltosTelemetryRecordMegaData.java deleted file mode 100644 index ee9442d2..00000000 --- a/altoslib/AltosTelemetryRecordMegaData.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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_2; - - -public class AltosTelemetryRecordMegaData extends AltosTelemetryRecordRaw { - -	int	state; -	 -	int	v_batt; -	int	v_pyro; -	int	sense[]; - -	int	ground_pres; -	int	ground_accel; -	int	accel_plus_g; -	int	accel_minus_g; - -	int	acceleration; -	int	speed; -	int	height; - -	public AltosTelemetryRecordMegaData(int[] in_bytes, int rssi) { -		super(in_bytes, rssi); - -		state = int8(5); - -		v_batt = int16(6); -		v_pyro = int16(8); - -		sense = new int[6];	 - -		for (int i = 0; i < 6; i++) { -			sense[i] = int8(10 + i) << 4; -			sense[i] |= sense[i] >> 8; -		} - -		ground_pres = int32(16); -		ground_accel = int16(20); -		accel_plus_g = int16(22); -		accel_minus_g = int16(24); - -		acceleration = int16(26); -		speed = int16(28); -		height = int16(30); -	} - -	public AltosRecord update_state(AltosRecord previous) { -		AltosRecord	n = super.update_state(previous); - -		AltosRecordMM	next; -		if (!(n instanceof AltosRecordMM)) { -			next = new AltosRecordMM(n); -		} else { -			next = (AltosRecordMM) n; -		} - -		next.state = state; - -		next.v_batt = v_batt; -		next.v_pyro = v_pyro; - -		for (int i = 0; i < 6; i++) -			next.sense[i] = sense[i]; - -		next.ground_accel = ground_accel; -		next.ground_pres = ground_pres; -		next.accel_plus_g = accel_plus_g; -		next.accel_minus_g = accel_minus_g; - -		next.kalman_acceleration = acceleration / 16.0; -		next.kalman_speed = speed / 16.0; -		next.kalman_height = height; - -		next.seen |= AltosRecord.seen_sensor | AltosRecord.seen_temp_volt; - -		return next; -	} -} diff --git a/altoslib/AltosTelemetryRecordMegaSensor.java b/altoslib/AltosTelemetryRecordMegaSensor.java deleted file mode 100644 index 234cda27..00000000 --- a/altoslib/AltosTelemetryRecordMegaSensor.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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_2; - - -public class AltosTelemetryRecordMegaSensor extends AltosTelemetryRecordRaw { -	int	accel; -	int	pres; -	int	temp; - -	int	accel_x; -	int	accel_y; -	int	accel_z; - -	int	gyro_x; -	int	gyro_y; -	int	gyro_z; - -	int	mag_x; -	int	mag_y; -	int	mag_z; - -	public AltosTelemetryRecordMegaSensor(int[] in_bytes, int rssi) { -		super(in_bytes, rssi); - -		accel         = int16(6); -		pres          = int32(8); -		temp          = int16(12); - -		accel_x	      = int16(14); -		accel_y	      = int16(16); -		accel_z	      = int16(18); - -		gyro_x	      = int16(20); -		gyro_y	      = int16(22); -		gyro_z	      = int16(24); - -		mag_x	      = int16(26); -		mag_y	      = int16(28); -		mag_z	      = int16(30); -	} - -	public AltosRecord update_state(AltosRecord previous) { -		AltosRecord	n = super.update_state(previous); - -		AltosRecordMM	next; -		if (!(n instanceof AltosRecordMM)) { -			next = new AltosRecordMM(n); -		} else { -			next = (AltosRecordMM) n; -		} - -		next.accel = accel; -		next.pres = pres; -		next.temp = temp; - -		next.imu.accel_x = accel_x; -		next.imu.accel_y = accel_y; -		next.imu.accel_z = accel_z; - -		next.imu.gyro_x = gyro_x; -		next.imu.gyro_y = gyro_y; -		next.imu.gyro_z = gyro_z; - -		next.mag.x = mag_x; -		next.mag.y = mag_y; -		next.mag.z = mag_z; - -		next.seen |= AltosRecord.seen_sensor; - -		return next; -	} -} diff --git a/altoslib/AltosTelemetryRecordMetrumData.java b/altoslib/AltosTelemetryRecordMetrumData.java deleted file mode 100644 index ade2494f..00000000 --- a/altoslib/AltosTelemetryRecordMetrumData.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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_2; - - -public class AltosTelemetryRecordMetrumData extends AltosTelemetryRecordRaw { - -	int	ground_pres; -	int	ground_accel; -	int	accel_plus_g; -	int	accel_minus_g; - -	public AltosTelemetryRecordMetrumData(int[] in_bytes, int rssi) { -		super(in_bytes, rssi); - -		ground_pres = int32(8); -		ground_accel = int16(12); -		accel_plus_g = int16(14); -		accel_minus_g = int16(16); -	} - -	public AltosRecord update_state(AltosRecord previous) { -		AltosRecord	n = super.update_state(previous); - -		AltosRecordTM2	next; -		if (!(n instanceof AltosRecordTM2)) { -			next = new AltosRecordTM2(n); -		} else { -			next = (AltosRecordTM2) n; -		} - -		next.ground_accel = ground_accel; -		next.ground_pres = ground_pres; -		next.accel_plus_g = accel_plus_g; -		next.accel_minus_g = accel_minus_g; - -		return next; -	} -} diff --git a/altoslib/AltosTelemetryRecordMetrumSensor.java b/altoslib/AltosTelemetryRecordMetrumSensor.java deleted file mode 100644 index d6d29b15..00000000 --- a/altoslib/AltosTelemetryRecordMetrumSensor.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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_2; - - -public class AltosTelemetryRecordMetrumSensor extends AltosTelemetryRecordRaw { -	int	state; - -	int	accel; -	int	pres; -	int	temp; - -	int	acceleration; -	int	speed; -	int	height; - -	int	v_batt; -	int	sense_a; -	int	sense_m; - -	public AltosTelemetryRecordMetrumSensor(int[] in_bytes, int rssi) { -		super(in_bytes, rssi); - -		state	      = int8(5); -		accel         = int16(6); -		pres          = int32(8); -		temp          = int16(12); - -		acceleration  = int16(14); -		speed         = int16(16); -		height        = int16(18); - -		v_batt        = int16(20); -		sense_a       = int16(22); -		sense_m       = int16(24); -	} - -	public AltosRecord update_state(AltosRecord previous) { -		AltosRecord	n = super.update_state(previous); - -		AltosRecordTM2	next; -		if (!(n instanceof AltosRecordTM2)) { -			next = new AltosRecordTM2(n); -		} else { -			next = (AltosRecordTM2) n; -		} - -		next.state = state; - -		next.accel = accel; -		next.pres = pres; -		next.temp = temp; - -		next.kalman_acceleration = acceleration / 16.0; -		next.kalman_speed = speed / 16.0; -		next.kalman_height = height; - -		next.v_batt = v_batt; -		next.sense_a = sense_a; -		next.sense_m = sense_m; - -		next.seen |= AltosRecord.seen_sensor | AltosRecord.seen_temp_volt;; - -		return next; -	} -} diff --git a/altoslib/AltosTelemetryRecordMini.java b/altoslib/AltosTelemetryRecordMini.java deleted file mode 100644 index 3c290208..00000000 --- a/altoslib/AltosTelemetryRecordMini.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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_2; - - -public class AltosTelemetryRecordMini extends AltosTelemetryRecordRaw { -	int	state; - -	int	accel; -	int	pres; -	int	temp; - -	int	v_batt; -	int	sense_a; -	int	sense_m; - -	int	acceleration; -	int	speed; -	int	height; - -	int	ground_pres; - -	public AltosTelemetryRecordMini(int[] in_bytes, int rssi) { -		super(in_bytes, rssi); - -		state	      = int8(5); -		v_batt	      = int16(6); -		sense_a	      = int16(8); -		sense_m	      = int16(10); - -		pres	      = int32(12); -		temp	      = int16(16); - -		acceleration  = int16(18); -		speed        = int16(20); -		height        = int16(22); - -		ground_pres   = int32(24); -	} - -	public AltosRecord update_state(AltosRecord previous) { -		AltosRecord	n = super.update_state(previous); - -		AltosRecordMini	next; -		if (!(n instanceof AltosRecordMini)) { -			next = new AltosRecordMini(n); -		} else { -			next = (AltosRecordMini) n; -		} - -		next.pres = pres; -		next.temp = temp; - -		next.sense_a = sense_a; -		next.sense_m = sense_m; - -		next.ground_pres = ground_pres; -		next.flight_accel = acceleration; -		next.flight_vel = speed; -		next.flight_height = height; -		next.flight_pres = pres; - -		next.seen |= AltosRecord.seen_sensor; - -		return next; -	} -} diff --git a/altoslib/AltosTelemetryRecordRaw.java b/altoslib/AltosTelemetryRecordRaw.java deleted file mode 100644 index 93d0ca50..00000000 --- a/altoslib/AltosTelemetryRecordRaw.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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_2; - -public class AltosTelemetryRecordRaw extends AltosTelemetryRecord { -	int[]	bytes; -	int	serial; -	int	tick; -	int	type; -	int	rssi; - -	long	received_time; - -	public int int8(int off) { -		return AltosLib.int8(bytes, off + 1); -	} - -	public int uint8(int off) { -		return AltosLib.uint8(bytes, off + 1); -	} - -	public int int16(int off) { -		return AltosLib.int16(bytes, off + 1); -	} - -	public int uint16(int off) { -		return AltosLib.uint16(bytes, off + 1); -	} - -	public int uint32(int off) { -		return AltosLib.uint32(bytes, off + 1); -	} - -	public int int32(int off) { -		return AltosLib.int32(bytes, off + 1); -	} - -	public String string(int off, int l) { -		return AltosLib.string(bytes, off + 1, l); -	} - -	public AltosTelemetryRecordRaw(int[] in_bytes, int in_rssi) { -		bytes = in_bytes; -		serial = uint16(0); -		tick   = uint16(2); -		type   = uint8(4); -		rssi   = in_rssi; -	} - -	public AltosRecord update_state(AltosRecord previous) { -		AltosRecord	next; - -		if (previous != null && previous.serial == serial) -			next = previous.clone(); -		else -			next = new AltosRecordNone(); -		next.serial = serial; -		next.tick = tick; -		next.rssi = rssi; -		return next; -	} - -	public long received_time() { -		return received_time; -	} -} diff --git a/altoslib/AltosTelemetryRecordSatellite.java b/altoslib/AltosTelemetryRecordSatellite.java deleted file mode 100644 index 5de16ab4..00000000 --- a/altoslib/AltosTelemetryRecordSatellite.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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_2; - -public class AltosTelemetryRecordSatellite extends AltosTelemetryRecordRaw { -	int		channels; -	AltosGPSSat[]	sats; - -	public AltosTelemetryRecordSatellite(int[] in_bytes, int rssi) { -		super(in_bytes, rssi); - -		channels = uint8(5); -		if (channels > 12) -			channels = 12; -		if (channels == 0) -			sats = null; -		else { -			sats = new AltosGPSSat[channels]; -			for (int i = 0; i < channels; i++) { -				int	svid =  uint8(6 + i * 2 + 0); -				int	c_n_1 = uint8(6 + i * 2 + 1); -				sats[i] = new AltosGPSSat(svid, c_n_1); -			} -		} -	} - -	public AltosRecord update_state(AltosRecord previous) { -		AltosRecord	next = super.update_state(previous); - -		if (next.gps == null) -			next.gps = new AltosGPS(); - -		next.gps.cc_gps_sat = sats; - -		return next; -	} -} diff --git a/altoslib/AltosTelemetryRecordSensor.java b/altoslib/AltosTelemetryRecordSensor.java deleted file mode 100644 index d1d9dd7e..00000000 --- a/altoslib/AltosTelemetryRecordSensor.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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_2; - - -public class AltosTelemetryRecordSensor extends AltosTelemetryRecordRaw { -	int	state; -	int	accel; -	int	pres; -	int	temp; -	int	v_batt; -	int	sense_d; -	int	sense_m; - -	int	acceleration; -	int	speed; -	int	height; - -	int	ground_accel; -	int	ground_pres; -	int	accel_plus_g; -	int	accel_minus_g; - -	public AltosTelemetryRecordSensor(int[] in_bytes, int rssi) { -		super(in_bytes, rssi); -		state         = uint8(5); - -		accel         = int16(6); -		pres          = int16(8); -		temp          = int16(10); -		v_batt        = int16(12); -		sense_d       = int16(14); -		sense_m       = int16(16); - -		acceleration  = int16(18); -		speed         = int16(20); -		height        = int16(22); - -		ground_pres   = int16(24); -		ground_accel  = int16(26); -		accel_plus_g  = int16(28); -		accel_minus_g = int16(30); -	} - -	public AltosRecord update_state(AltosRecord prev) { -		AltosRecord	n = super.update_state(prev); - -		AltosRecordTM	next; -		if (!(n instanceof AltosRecordTM)) -			next = new AltosRecordTM(n); -		else -			next = (AltosRecordTM) n; - -		next.state = state; -		if (type == packet_type_TM_sensor) -			next.accel = accel; -		else -			next.accel = AltosLib.MISSING; -		next.pres = pres; -		next.temp = temp; -		next.batt = v_batt; -		if (type == packet_type_TM_sensor || type == packet_type_Tm_sensor) { -			next.drogue = sense_d; -			next.main = sense_m; -		} else { -			next.drogue = AltosLib.MISSING; -			next.main = AltosLib.MISSING; -		} - -		next.kalman_acceleration = acceleration / 16.0; -		next.kalman_speed = speed / 16.0; -		next.kalman_height = height; - -		next.ground_pres = ground_pres; -		if (type == packet_type_TM_sensor) { -			next.ground_accel = ground_accel; -			next.accel_plus_g = accel_plus_g; -			next.accel_minus_g = accel_minus_g; -		} else { -			next.ground_accel = AltosLib.MISSING; -			next.accel_plus_g = AltosLib.MISSING; -			next.accel_minus_g = AltosLib.MISSING; -		} - -		next.seen |= AltosRecord.seen_sensor | AltosRecord.seen_temp_volt; - -		return next; -	} -} | 
