2 * Copyright © 2011 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; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
19 package org.altusmetrum.altoslib_11;
21 public abstract class AltosTelemetryStandard extends AltosTelemetry {
22 public int int8(int off) {
23 return AltosLib.int8(bytes, off + 1);
26 public int uint8(int off) {
27 return AltosLib.uint8(bytes, off + 1);
30 public int int16(int off) {
31 return AltosLib.int16(bytes, off + 1);
34 public int uint16(int off) {
35 return AltosLib.uint16(bytes, off + 1);
38 public int uint32(int off) {
39 return AltosLib.uint32(bytes, off + 1);
42 public int int32(int off) {
43 return AltosLib.int32(bytes, off + 1);
46 public String string(int off, int l) {
47 return AltosLib.string(bytes, off + 1, l);
50 public int type() { return uint8(4); }
52 public int serial() { return uint16(0); }
54 public int tick() { return uint16(2); }
56 public static AltosTelemetry parse_hex(int[] bytes) throws AltosCRCException {
59 int type = AltosLib.uint8(bytes, 4+1);
61 case packet_type_TM_sensor:
62 case packet_type_Tm_sensor:
63 case packet_type_Tn_sensor:
64 telem = new AltosTelemetrySensor(bytes);
66 case packet_type_configuration:
67 telem = new AltosTelemetryConfiguration(bytes);
69 case packet_type_location:
70 telem = new AltosTelemetryLocation(bytes);
72 case packet_type_satellite:
73 telem = new AltosTelemetrySatellite(bytes);
75 case packet_type_companion:
76 telem = new AltosTelemetryCompanion(bytes);
78 case packet_type_mega_sensor:
79 telem = new AltosTelemetryMegaSensor(bytes);
81 case packet_type_mega_data:
82 telem = new AltosTelemetryMegaData(bytes);
84 case packet_type_metrum_sensor:
85 telem = new AltosTelemetryMetrumSensor(bytes);
87 case packet_type_metrum_data:
88 telem = new AltosTelemetryMetrumData(bytes);
90 case packet_type_mini2:
91 telem = new AltosTelemetryMini2(bytes);
93 case packet_type_mini3:
94 telem = new AltosTelemetryMini3(bytes);
97 telem = new AltosTelemetryRaw(bytes);
103 public AltosTelemetryStandard(int[] bytes) throws AltosCRCException {
107 public void provide_data(AltosDataListener listener, AltosCalData cal_data) {
108 super.provide_data(listener, cal_data);