Methods Summary |
---|
public java.lang.String[] | getSerialPorts()
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.SERIAL_PORT, null);
ArrayList<String> ports = new ArrayList<String>();
for (int i = 0; i < mSerialPorts.length; i++) {
String path = mSerialPorts[i];
if (new File(path).exists()) {
ports.add(path);
}
}
String[] result = new String[ports.size()];
ports.toArray(result);
return result;
|
private native android.os.ParcelFileDescriptor | native_open(java.lang.String path)
|
public android.os.ParcelFileDescriptor | openSerialPort(java.lang.String path)
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.SERIAL_PORT, null);
for (int i = 0; i < mSerialPorts.length; i++) {
if (mSerialPorts[i].equals(path)) {
return native_open(path);
}
}
throw new IllegalArgumentException("Invalid serial port " + path);
|