mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Allow disconnections to be signaled by drivers
This allows for disconnections to be detected quickly where possible. It also makes sure other driver errors aren't thrown in the event of a disconnection.
This commit is contained in:
committed by
Paul Hollinsky
parent
dfe2d23d85
commit
a5b27a15b0
@@ -43,7 +43,7 @@ void Communication::joinThreads() {
|
||||
bool Communication::close() {
|
||||
joinThreads();
|
||||
|
||||
if(!isOpen()) {
|
||||
if(!isOpen() && !isDisconnected()) {
|
||||
report(APIEvent::Type::DeviceCurrentlyClosed, APIEvent::Severity::Error);
|
||||
return false;
|
||||
}
|
||||
@@ -55,6 +55,10 @@ bool Communication::isOpen() {
|
||||
return driver->isOpen();
|
||||
}
|
||||
|
||||
bool Communication::isDisconnected() {
|
||||
return driver->isDisconnected();
|
||||
}
|
||||
|
||||
bool Communication::sendPacket(std::vector<uint8_t>& bytes) {
|
||||
// This is here so that other communication types (like multichannel) can override it
|
||||
return rawWrite(bytes);
|
||||
|
||||
Reference in New Issue
Block a user