X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altoslib%2FAltosEepromChunk.java;h=36b5961bf36a786fe8ca784f4a65145309d724d3;hb=c296acd643698d0128e2f58f91a9cfeea63f580a;hp=b1bba3bb56d67154c8cc49f23e3ab76c6cd84c02;hpb=8d1d8d2a3c129cdbd55427bcda0f26715b02f1ee;p=fw%2Faltos diff --git a/altoslib/AltosEepromChunk.java b/altoslib/AltosEepromChunk.java index b1bba3bb..36b5961b 100644 --- a/altoslib/AltosEepromChunk.java +++ b/altoslib/AltosEepromChunk.java @@ -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 @@ -15,7 +16,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altoslib_1; +package org.altusmetrum.altoslib_11; import java.text.*; import java.util.concurrent.*; @@ -62,6 +63,39 @@ public class AltosEepromChunk { return true; } + public AltosEeprom eeprom(int offset, int log_format, AltosState state) throws ParseException { + AltosEeprom eeprom = null; + switch (log_format) { + case AltosLib.AO_LOG_FORMAT_FULL: + eeprom = new AltosEepromTM(this, offset); + break; + case AltosLib.AO_LOG_FORMAT_TINY: + eeprom = new AltosEepromTMini(this, offset, state); + break; + case AltosLib.AO_LOG_FORMAT_TELEMETRY: + case AltosLib.AO_LOG_FORMAT_TELESCIENCE: + break; + case AltosLib.AO_LOG_FORMAT_TELEMEGA: + case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD: + eeprom = new AltosEepromMega(this, offset, log_format); + break; + case AltosLib.AO_LOG_FORMAT_TELEMETRUM: + eeprom = new AltosEepromMetrum2(this, offset); + break; + case AltosLib.AO_LOG_FORMAT_TELEMINI2: + case AltosLib.AO_LOG_FORMAT_TELEMINI3: + case AltosLib.AO_LOG_FORMAT_EASYMINI: + eeprom = new AltosEepromMini(this, offset); + break; + case AltosLib.AO_LOG_FORMAT_TELEGPS: + eeprom = new AltosEepromGPS(this, offset); + break; + default: + throw new ParseException("unknown eeprom format " + log_format, 0); + } + return eeprom; + } + public AltosEepromChunk(AltosLink link, int block, boolean flush) throws TimeoutException, InterruptedException { @@ -97,4 +131,4 @@ public class AltosEepromChunk { } } } -} \ No newline at end of file +}