mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Added error checking and removed some redundancy from device isOpen()
This commit is contained in:
+2
-9
@@ -135,17 +135,14 @@ void Device::enforcePollingMessageLimit() {
|
||||
}
|
||||
|
||||
bool Device::open() {
|
||||
if(opened) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!com) {
|
||||
err(APIError::Unknown);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!com->open())
|
||||
if(!com->open()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto serial = com->getSerialNumberSync();
|
||||
int i = 0;
|
||||
@@ -179,10 +176,6 @@ bool Device::open() {
|
||||
}
|
||||
|
||||
bool Device::close() {
|
||||
if(!opened) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!com) {
|
||||
err(APIError::Unknown);
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user