Commands can now only be sent when the device is open

checksum-failure-logging
EricLiu2000 2019-06-12 17:28:56 -04:00
parent 8a6073a9cf
commit dc4f96affb
1 changed files with 5 additions and 0 deletions

View File

@ -39,6 +39,11 @@ bool ICommunication::readWait(std::vector<uint8_t>& bytes, std::chrono::millisec
}
bool ICommunication::write(const std::vector<uint8_t>& bytes) {
if(!isOpen()) {
err(APIError::DeviceCurrentlyClosed);
return false;
}
if(writeBlocks) {
std::unique_lock<std::mutex> lk(writeMutex);
if(writeQueue.size_approx() > writeQueueSize) {