1 /* 2 * Copyright © 2016 Greg Chabala 3 * 4 * This file is part of brick-control-lab. 5 * 6 * brick-control-lab is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU Lesser General Public License as 8 * published by the Free Software Foundation, either version 3 of the 9 * License, or (at your option) any later version. 10 * 11 * brick-control-lab is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public License 17 * along with brick-control-lab. If not, see http://www.gnu.org/licenses/. 18 */ 19 package org.chabala.brick.controllab; 20 21 import java.util.List; 22 23 /** 24 * Interface to separate listing and obtaining serial ports from implementation. 25 */ 26 interface SerialPortFactory { 27 /** 28 * List available serial ports on this machine. May change over time due to 29 * hot pluggable USB serial port adapters and the like. 30 * 31 * @return a list of system specific string identifiers for serial ports 32 */ 33 List<String> getAvailablePorts(); 34 35 /** 36 * Obtain a {@link SerialPort} for the specified serial port. This will succeed 37 * even if the port name is invalid, though operations on that object may fail. 38 * 39 * @param portName a system specific string identifier for a serial port 40 * @return a serial port object for the specified port 41 */ 42 SerialPort getSerialPort(String portName); 43 }