mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Added icsneo_isOpen() functionality
This commit is contained in:
+11
-1
@@ -135,6 +135,10 @@ void Device::enforcePollingMessageLimit() {
|
||||
}
|
||||
|
||||
bool Device::open() {
|
||||
if(opened) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!com) {
|
||||
err(APIError::Unknown);
|
||||
return false;
|
||||
@@ -170,10 +174,15 @@ bool Device::open() {
|
||||
handleInternalMessage(message);
|
||||
}));
|
||||
|
||||
opened = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Device::close() {
|
||||
if(!opened) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!com) {
|
||||
err(APIError::Unknown);
|
||||
return false;
|
||||
@@ -183,7 +192,8 @@ bool Device::close() {
|
||||
com->removeMessageCallback(internalHandlerCallbackID);
|
||||
|
||||
goOffline();
|
||||
return com->close();
|
||||
opened = !com->close();
|
||||
return !opened;
|
||||
}
|
||||
|
||||
bool Device::goOnline() {
|
||||
|
||||
Reference in New Issue
Block a user