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 {
25 public int int8(int off) {
26 return AltosLib.int8(bytes, off + 1);
29 public int uint8(int off) {
30 return AltosLib.uint8(bytes, off + 1);
33 public int int16(int off) {
34 return AltosLib.int16(bytes, off + 1);
37 public int uint16(int off) {
38 return AltosLib.uint16(bytes, off + 1);
41 public int uint32(int off) {
42 return AltosLib.uint32(bytes, off + 1);
45 public int int32(int off) {
46 return AltosLib.int32(bytes, off + 1);
49 public String string(int off, int l) {
50 return AltosLib.string(bytes, off + 1, l);
53 public static AltosTelemetry parse_hex(int[] bytes) {
54 int type = AltosLib.uint8(bytes, 4 + 1);
58 case packet_type_TM_sensor:
59 case packet_type_Tm_sensor:
60 case packet_type_Tn_sensor:
61 telem = new AltosTelemetrySensor(bytes);
63 case packet_type_configuration:
64 telem = new AltosTelemetryConfiguration(bytes);
66 case packet_type_location:
67 telem = new AltosTelemetryLocation(bytes);
69 case packet_type_satellite:
70 telem = new AltosTelemetrySatellite(bytes);
72 case packet_type_companion:
73 telem = new AltosTelemetryCompanion(bytes);
75 case packet_type_mega_sensor:
76 telem = new AltosTelemetryMegaSensor(bytes);
78 case packet_type_mega_data:
79 telem = new AltosTelemetryMegaData(bytes);
81 case packet_type_metrum_sensor:
82 telem = new AltosTelemetryMetrumSensor(bytes);
84 case packet_type_metrum_data:
85 telem = new AltosTelemetryMetrumData(bytes);
87 case packet_type_mini:
88 telem = new AltosTelemetryMini(bytes);
91 telem = new AltosTelemetryRaw(bytes);
97 public AltosTelemetryStandard(int[] bytes) {
105 public void update_state(AltosState state) {
106 super.update_state(state);