collect-view gui: Add support for OS X serialdump and motelist

Select the tools for macos when checking for motes or opening a
serial dump connection on OS X.
This commit is contained in:
Tommy Sparber 2015-10-28 23:32:04 +11:00
parent 94c26b90d0
commit 1eb1f88aa4
2 changed files with 9 additions and 1 deletions

View file

@ -54,9 +54,11 @@ public class MoteFinder {
public static final String MOTELIST_WINDOWS = "./tools/motelist-windows.exe"; public static final String MOTELIST_WINDOWS = "./tools/motelist-windows.exe";
public static final String MOTELIST_LINUX = "./tools/motelist-linux"; public static final String MOTELIST_LINUX = "./tools/motelist-linux";
public static final String MOTELIST_MACOS = "./tools/motelist-macos";
private final Pattern motePattern; private final Pattern motePattern;
private final boolean isWindows; private final boolean isWindows;
private final boolean isMacos;
private Process moteListProcess; private Process moteListProcess;
// private boolean hasVerifiedProcess; // private boolean hasVerifiedProcess;
private ArrayList<String> comList = new ArrayList<String>(); private ArrayList<String> comList = new ArrayList<String>();
@ -65,7 +67,8 @@ public class MoteFinder {
public MoteFinder() { public MoteFinder() {
String osName = System.getProperty("os.name", "").toLowerCase(); String osName = System.getProperty("os.name", "").toLowerCase();
isWindows = osName.startsWith("win"); isWindows = osName.startsWith("win");
motePattern = Pattern.compile("\\s(COM|/dev/[a-zA-Z]+)(\\d+)\\s"); isMacos = osName.startsWith("mac");
motePattern = Pattern.compile("\\s(COM|/dev/[a-zA-Z]+|/dev/tty.usbserial-)(\\d+|[A-Z0-9]+)\\s");
} }
public String[] getMotes() throws IOException { public String[] getMotes() throws IOException {
@ -87,6 +90,8 @@ public class MoteFinder {
String fullCommand; String fullCommand;
if (isWindows) { if (isWindows) {
fullCommand = MOTELIST_WINDOWS; fullCommand = MOTELIST_WINDOWS;
} else if (isMacos) {
fullCommand = MOTELIST_MACOS;
} else { } else {
fullCommand = MOTELIST_LINUX; fullCommand = MOTELIST_LINUX;
} }

View file

@ -46,6 +46,7 @@ public class SerialDumpConnection extends CommandConnection {
public static final String SERIALDUMP_WINDOWS = "./tools/serialdump-windows.exe"; public static final String SERIALDUMP_WINDOWS = "./tools/serialdump-windows.exe";
public static final String SERIALDUMP_LINUX = "./tools/serialdump-linux"; public static final String SERIALDUMP_LINUX = "./tools/serialdump-linux";
public static final String SERIALDUMP_MACOS = "./tools/serialdump-macos";
public SerialDumpConnection(SerialConnectionListener listener) { public SerialDumpConnection(SerialConnectionListener listener) {
super(listener); super(listener);
@ -72,6 +73,8 @@ public class SerialDumpConnection extends CommandConnection {
String fullCommand; String fullCommand;
if (osName.startsWith("win")) { if (osName.startsWith("win")) {
fullCommand = SERIALDUMP_WINDOWS + " " + "-b115200" + " " + getMappedComPortForWindows(comPort); fullCommand = SERIALDUMP_WINDOWS + " " + "-b115200" + " " + getMappedComPortForWindows(comPort);
} else if (osName.startsWith("mac")) {
fullCommand = SERIALDUMP_MACOS + " " + "-b115200" + " " + comPort;
} else { } else {
fullCommand = SERIALDUMP_LINUX + " " + "-b115200" + " " + comPort; fullCommand = SERIALDUMP_LINUX + " " + "-b115200" + " " + comPort;
} }