diff options
| -rw-r--r-- | altoslib/AltosLib.java | 1 | ||||
| -rw-r--r-- | altosui/Altos.java | 184 | ||||
| -rw-r--r-- | altosui/AltosEepromDownload.java | 10 | 
3 files changed, 6 insertions, 189 deletions
| diff --git a/altoslib/AltosLib.java b/altoslib/AltosLib.java index 27d72079..e74eaf99 100644 --- a/altoslib/AltosLib.java +++ b/altoslib/AltosLib.java @@ -185,6 +185,7 @@ public class AltosLib {  	public static final int AO_LOG_FORMAT_TINY = 2;  	public static final int AO_LOG_FORMAT_TELEMETRY = 3;  	public static final int AO_LOG_FORMAT_TELESCIENCE = 4; +	public static final int AO_LOG_FORMAT_MEGAMETRUM = 5;  	public static final int AO_LOG_FORMAT_NONE = 127;  	public static boolean isspace(int c) { diff --git a/altosui/Altos.java b/altosui/Altos.java index 351927ee..78e56970 100644 --- a/altosui/Altos.java +++ b/altosui/Altos.java @@ -86,190 +86,6 @@ public class Altos extends AltosLib {  		return state_to_string[state];  	} -	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_NUM_SAT_SHIFT = 0; -	static final int AO_GPS_NUM_SAT_MASK = 0xf; - -	static final int AO_LOG_FORMAT_UNKNOWN = 0; -	static final int AO_LOG_FORMAT_FULL = 1; -	static final int AO_LOG_FORMAT_TINY = 2; -	static final int AO_LOG_FORMAT_TELEMETRY = 3; -	static final int AO_LOG_FORMAT_TELESCIENCE = 4; -	static final int AO_LOG_FORMAT_MEGAMETRUM = 5; -	static final int AO_LOG_FORMAT_NONE = 127; - -	static boolean isspace(int c) { -		switch (c) { -		case ' ': -		case '\t': -			return true; -		} -		return false; -	} - -	static boolean ishex(int c) { -		if ('0' <= c && c <= '9') -			return true; -		if ('a' <= c && c <= 'f') -			return true; -		if ('A' <= c && c <= 'F') -			return true; -		return false; -	} - -	static boolean ishex(String s) { -		for (int i = 0; i < s.length(); i++) -			if (!ishex(s.charAt(i))) -				return false; -		return true; -	} - -	static int fromhex(int c) { -		if ('0' <= c && c <= '9') -			return c - '0'; -		if ('a' <= c && c <= 'f') -			return c - 'a' + 10; -		if ('A' <= c && c <= 'F') -			return c - 'A' + 10; -		return -1; -	} - -	static int fromhex(String s) throws NumberFormatException { -		int c, v = 0; -		for (int i = 0; i < s.length(); i++) { -			c = s.charAt(i); -			if (!ishex(c)) { -				if (i == 0) -					throw new NumberFormatException(String.format("invalid hex \"%s\"", s)); -				return v; -			} -			v = v * 16 + fromhex(c); -		} -		return v; -	} - -	static boolean isdec(int c) { -		if ('0' <= c && c <= '9') -			return true; -		return false; -	} - -	static boolean isdec(String s) { -		for (int i = 0; i < s.length(); i++) -			if (!isdec(s.charAt(i))) -				return false; -		return true; -	} - -	static int fromdec(int c) { -		if ('0' <= c && c <= '9') -			return c - '0'; -		return -1; -	} - -	static int int8(int[] bytes, int i) { -		return (int) (byte) bytes[i]; -	} - -	static int uint8(int[] bytes, int i) { -		return bytes[i]; -	} - -	static int int16(int[] bytes, int i) { -		return (int) (short) (bytes[i] + (bytes[i+1] << 8)); -	} - -	static int uint16(int[] bytes, int i) { -		return bytes[i] + (bytes[i+1] << 8); -	} - -	static int uint32(int[] bytes, int i) { -		return bytes[i] + -			(bytes[i+1] << 8) + -			(bytes[i+2] << 16) + -			(bytes[i+3] << 24); -	} - -	static final Charset	unicode_set = Charset.forName("UTF-8"); - -	static String string(int[] bytes, int s, int l) { -		if (s + l > bytes.length) { -			if (s > bytes.length) { -				s = bytes.length; -				l = 0; -			} else { -				l = bytes.length - s; -			} -		} - -		int i; -		for (i = l - 1; i >= 0; i--) -			if (bytes[s+i] != 0) -				break; - -		l = i + 1; -		byte[]	b = new byte[l]; - -		for (i = 0; i < l; i++) -			b[i] = (byte) bytes[s+i]; -		String n = new String(b, unicode_set); -		return n; -	} - -	static int hexbyte(String s, int i) { -		int c0, c1; - -		if (s.length() < i + 2) -			throw new NumberFormatException(String.format("invalid hex \"%s\"", s)); -		c0 = s.charAt(i); -		if (!Altos.ishex(c0)) -			throw new NumberFormatException(String.format("invalid hex \"%c\"", c0)); -		c1 = s.charAt(i+1); -		if (!Altos.ishex(c1)) -			throw new NumberFormatException(String.format("invalid hex \"%c\"", c1)); -		return Altos.fromhex(c0) * 16 + Altos.fromhex(c1); -	} - -	static int[] hexbytes(String s) { -		int	n; -		int[]	r; -		int	i; - -		if ((s.length() & 1) != 0) -			throw new NumberFormatException(String.format("invalid line \"%s\"", s)); -		n = s.length() / 2; -		r = new int[n]; -		for (i = 0; i < n; i++) -			r[i] = Altos.hexbyte(s, i * 2); -		return r; -	} - -	static int fromdec(String s) throws NumberFormatException { -		int c, v = 0; -		int sign = 1; -		for (int i = 0; i < s.length(); i++) { -			c = s.charAt(i); -			if (i == 0 && c == '-') { -				sign = -1; -			} else if (!isdec(c)) { -				if (i == 0) -					throw new NumberFormatException(String.format("invalid number \"%s\"", s)); -				return v; -			} else -				v = v * 10 + fromdec(c); -		} -		return v * sign; -	} - -	static String replace_extension(String input, String extension) { -		int dot = input.lastIndexOf("."); -		if (dot > 0) -			input = input.substring(0,dot); -		return input.concat(extension); -	} -  	static public boolean initialized = false;  	static public boolean loaded_library = false; diff --git a/altosui/AltosEepromDownload.java b/altosui/AltosEepromDownload.java index 080bfc99..d1e5fdf0 100644 --- a/altosui/AltosEepromDownload.java +++ b/altosui/AltosEepromDownload.java @@ -357,23 +357,23 @@ public class AltosEepromDownload implements Runnable {  			}  			switch (log_format) { -			case Altos.AO_LOG_FORMAT_FULL: +			case AltosLib.AO_LOG_FORMAT_FULL:  				extension = "eeprom";  				CaptureFull(eechunk);  				break; -			case Altos.AO_LOG_FORMAT_TINY: +			case AltosLib.AO_LOG_FORMAT_TINY:  				extension = "eeprom";  				CaptureTiny(eechunk);  				break; -			case Altos.AO_LOG_FORMAT_TELEMETRY: +			case AltosLib.AO_LOG_FORMAT_TELEMETRY:  				extension = "telem";  				CaptureTelemetry(eechunk);  				break; -			case Altos.AO_LOG_FORMAT_TELESCIENCE: +			case AltosLib.AO_LOG_FORMAT_TELESCIENCE:  				extension = "science";  				CaptureTeleScience(eechunk);  				break; -			case Altos.AO_LOG_FORMAT_MEGAMETRUM: +			case AltosLib.AO_LOG_FORMAT_MEGAMETRUM:  				extension = "mega";  				CaptureMega(eechunk);  			} | 
