diff options
| author | Keith Packard <keithp@keithp.com> | 2012-06-21 09:50:18 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2012-06-21 09:50:18 -0700 | 
| commit | 6f421818fd7062f03bfaf9e606d6a4cfdcb13b49 (patch) | |
| tree | 912ddd51730e370b641e45da3065cd9273e4215e /altoslib/AltosLib.java | |
| parent | ff5b0ba90e73a83360a2e8a7e9969ed2c3ce1514 (diff) | |
altosui: Support MM telemetry packets
Required restructuring the whole telemetry system to provide abstract
interfaces to flight data.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosLib.java')
| -rw-r--r-- | altoslib/AltosLib.java | 20 | 
1 files changed, 20 insertions, 0 deletions
| diff --git a/altoslib/AltosLib.java b/altoslib/AltosLib.java index 4a779c55..2402331e 100644 --- a/altoslib/AltosLib.java +++ b/altoslib/AltosLib.java @@ -20,6 +20,7 @@ package org.altusmetrum.AltosLib;  import java.awt.*;  import java.util.*;  import java.text.*; +import java.io.*;  import java.nio.charset.Charset;  public class AltosLib { @@ -304,6 +305,10 @@ public class AltosLib {  			(bytes[i+3] << 24);  	} +	public static int int32(int[] bytes, int i) { +		return (int) uint32(bytes, i); +	} +  	public static final Charset	unicode_set = Charset.forName("UTF-8");  	public static String string(int[] bytes, int s, int l) { @@ -375,6 +380,21 @@ public class AltosLib {  		return v * sign;  	} +	public static String gets(FileInputStream s) throws IOException { +		int c; +		String	line = ""; + +		while ((c = s.read()) != -1) { +			if (c == '\r') +				continue; +			if (c == '\n') { +				return line; +			} +			line = line + (char) c; +		} +		return null; +	} +  	public static String replace_extension(String input, String extension) {  		int dot = input.lastIndexOf(".");  		if (dot > 0) | 
