- boolean get_int(String line, String label, int_ref x) {
- if (line.startsWith(label)) {
- try {
- String tail = line.substring(label.length()).trim();
- String[] tokens = tail.split("\\s+");
- if (tokens.length > 0) {
- int i = Integer.parseInt(tokens[0]);
- x.set(i);
- return true;
- }
- } catch (NumberFormatException ne) {
- }
- }
- return false;
- }
-
- boolean get_string(String line, String label, string_ref s) {
- if (line.startsWith(label)) {
- String quoted = line.substring(label.length()).trim();
-
- if (quoted.startsWith("\""))
- quoted = quoted.substring(1);
- if (quoted.endsWith("\""))
- quoted = quoted.substring(0,quoted.length()-1);
- s.set(quoted);
- return true;
- } else {
- return false;
- }
- }
-
- void start_serial() throws InterruptedException {