Added icsneo_isOpen() functionality

This commit is contained in:
EricLiu2000
2019-06-13 16:01:35 -04:00
parent f1e0625429
commit 903615dadd
4 changed files with 39 additions and 3 deletions
+11 -1
View File
@@ -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() {