mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-09 03:54:18 +01:00
27 lines
717 B
Java
27 lines
717 B
Java
package cc.arduino.packages;
|
|
|
|
import cc.arduino.packages.uploaders.SSHUploader;
|
|
import cc.arduino.packages.uploaders.SerialUploader;
|
|
import processing.app.*;
|
|
import processing.app.debug.TargetBoard;
|
|
|
|
public class UploaderAndMonitorFactory {
|
|
|
|
public Uploader newUploader(TargetBoard board, String port) {
|
|
if ("true".equals(board.getPreferences().get("upload.via_ssh")) && Constants.IPV4_ADDRESS.matcher(port).find()) {
|
|
return new SSHUploader(port);
|
|
}
|
|
|
|
return new SerialUploader();
|
|
}
|
|
|
|
public AbstractMonitor newMonitor(String port, Base base) {
|
|
if (Constants.IPV4_ADDRESS.matcher(port).find()) {
|
|
return new NetworkMonitor(port, base);
|
|
}
|
|
|
|
return new SerialMonitor(port);
|
|
}
|
|
|
|
}
|