Added SerialPortException.TYPE_PERMISSION_DENIED support into SerialPort class

This commit is contained in:
scream3r 2013-04-17 13:38:06 +04:00
parent fa056da300
commit 82a01329a6
1 changed files with 5 additions and 4 deletions

View File

@ -151,14 +151,15 @@ public class SerialPort {
else { else {
throw new SerialPortException(portName, "openPort()", SerialPortException.TYPE_NULL_NOT_PERMITTED);//since 2.1.0 -> NULL port name fix throw new SerialPortException(portName, "openPort()", SerialPortException.TYPE_NULL_NOT_PERMITTED);//since 2.1.0 -> NULL port name fix
} }
//since 0.9.0 -> if(portHandle == -1){//since 0.9.0 ->
if(portHandle == -1){
throw new SerialPortException(portName, "openPort()", SerialPortException.TYPE_PORT_BUSY); throw new SerialPortException(portName, "openPort()", SerialPortException.TYPE_PORT_BUSY);
} }
else if(portHandle == -2){ else if(portHandle == -2){
throw new SerialPortException(portName, "openPort()", SerialPortException.TYPE_PORT_NOT_FOUND); throw new SerialPortException(portName, "openPort()", SerialPortException.TYPE_PORT_NOT_FOUND);
} }//<- since 0.9.0
//<- since 0.9.0 else if(portHandle == -3){//since 2.2.0 ->
throw new SerialPortException(portName, "openPort()", SerialPortException.TYPE_PERMISSION_DENIED);
}//<- since 2.2.0
portOpened = true; portOpened = true;
return true; return true;
} }