Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos
[fw/altos] / altoslib / AltosTelemetryMetrumData.java
index b623997195ad5a1fb4887f9566f8e81661eaa7ac..8cd09b41c3b697a60a7350a00952d2cdbfc2cb2d 100644 (file)
@@ -3,7 +3,8 @@
  *
  * 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.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
  */
 
-package org.altusmetrum.altoslib_2;
+package org.altusmetrum.altoslib_12;
 
 
 public class AltosTelemetryMetrumData extends AltosTelemetryStandard {
 
-       int     ground_pres;
-       int     ground_accel;
-       int     accel_plus_g;
-       int     accel_minus_g;
+       int     ground_pres() { return int32(8); }
+       int     ground_accel() { return int16(12); }
+       int     accel_plus_g() { return int16(14); }
+       int     accel_minus_g() { return int16(16); }
 
-       public AltosTelemetryMetrumData(int[] bytes) {
+       public AltosTelemetryMetrumData(int[] bytes) throws AltosCRCException {
                super(bytes);
-
-               ground_pres = int32(8);
-               ground_accel = int16(12);
-               accel_plus_g = int16(14);
-               accel_minus_g = int16(16);
        }
 
-       public void update_state(AltosState state) {
-               state.set_ground_accel(ground_accel);
-               state.set_accel_g(accel_plus_g, accel_minus_g);
-               state.set_ground_pressure(ground_pres);
+       public void provide_data(AltosDataListener listener, AltosCalData cal_data) {
+               cal_data.set_ground_accel(ground_accel());
+               cal_data.set_accel_plus_minus(accel_plus_g(), accel_minus_g());
+               cal_data.set_ground_pressure(ground_pres());
        }
 }