From 7c821e33f04354a57e2fce64a37f6a7eaefb59cd Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 17 Nov 2022 15:59:31 +0100 Subject: [PATCH] somethings wrong --- linux/devices/ploc/PlocSupvUartMan.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/linux/devices/ploc/PlocSupvUartMan.cpp b/linux/devices/ploc/PlocSupvUartMan.cpp index c423944f..f7d15317 100644 --- a/linux/devices/ploc/PlocSupvUartMan.cpp +++ b/linux/devices/ploc/PlocSupvUartMan.cpp @@ -907,12 +907,12 @@ ReturnValue_t PlocSupvUartManager::sendMessage(CookieIF* cookie, const uint8_t* if (sendData == nullptr or sendLen == 0) { return FAILED; } - lock->lockMutex(); - if (state == InternalState::SLEEPING or state == InternalState::DEDICATED_REQUEST) { - lock->unlockMutex(); - return FAILED; + { + MutexGuard mg(lock); + if (state == InternalState::SLEEPING or state == InternalState::DEDICATED_REQUEST) { + return FAILED; + } } - lock->unlockMutex(); return encodeAndSendPacket(sendData, sendLen); } @@ -977,8 +977,9 @@ ReturnValue_t PlocSupvUartManager::encodeAndSendPacket(const uint8_t* sendData, arrayprinter::print(encodedSendBuf.data(), encodedLen); size_t bytesWritten = write(serialPort, encodedSendBuf.data(), encodedLen); if (bytesWritten != encodedLen) { - sif::warning << "ScexUartReader::sendMessage: Sending ping command to solar experiment failed" - << std::endl; + sif::warning + << "PlocSupvUartManager::sendMessage: Sending ping command to solar experiment failed" + << std::endl; return FAILED; } return returnvalue::OK;