Skip to content

Commit

Permalink
1. 修改 设备查询API
Browse files Browse the repository at this point in the history
  • Loading branch information
F1ReKing committed Nov 25, 2019
1 parent 029fb4b commit f30cedc
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import java.io.IOException;
import java.io.LineNumberReader;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;

/**
* @author F1ReKing
Expand Down Expand Up @@ -86,20 +88,22 @@ public List<Device> getAllDevices() {
*
* @return serialPort path
*/
public List<String> getAllDeicesPath() {
List<String> paths = new ArrayList<>();
public String[] getAllDeicesPath() {
Vector<String> paths = new Vector<>();
Iterator<Driver> drivers;
try {
List<Driver> drivers = getDrivers();
for (Driver driver : drivers) {
List<File> driverDevices = driver.getDevices();
for (File file : driverDevices) {
String devicesPaths = file.getAbsolutePath();
drivers = getDrivers().iterator();
while (drivers.hasNext()) {
Driver driver = drivers.next();
Iterator<File> files = driver.getDevices().iterator();
while (files.hasNext()) {
String devicesPaths = files.next().getAbsolutePath();
paths.add(devicesPaths);
}
}
} catch (IOException e) {
e.printStackTrace();
}
return paths;
return paths.toArray(new String[paths.size()]);
}
}

0 comments on commit f30cedc

Please sign in to comment.