Make syrlinks COM more reliable

This commit is contained in:
2023-03-24 00:59:41 +01:00
parent 7f36bd365f
commit a9efedfc86
12 changed files with 280 additions and 20 deletions

View File

@ -7,6 +7,9 @@ ArcsecDatalinkLayer::~ArcsecDatalinkLayer() {}
ReturnValue_t ArcsecDatalinkLayer::checkRingBufForFrame(const uint8_t** decodedFrame,
size_t& frameLen) {
size_t currentLen = decodeRingBuf.getAvailableReadData();
if (currentLen == 0) {
return returnvalue::OK;
}
decodeRingBuf.readData(rxAnalysisBuffer, currentLen);
for (size_t idx = 0; idx < currentLen; idx++) {
enum arc_dec_result decResult =

View File

@ -155,9 +155,7 @@ ReturnValue_t StrComHandler::startImageDownload(std::string path) {
return returnvalue::OK;
}
void StrComHandler::stopProcess() {
terminate = true;
}
void StrComHandler::stopProcess() { terminate = true; }
void StrComHandler::setDownloadImageName(std::string filename) {
downloadImage.filename = filename;
@ -652,10 +650,9 @@ ReturnValue_t StrComHandler::sendMessage(CookieIF* cookie, const uint8_t* sendDa
const uint8_t* txFrame;
size_t frameLen;
datalinkLayer.encodeFrame(sendData, sendLen, &txFrame, frameLen);
size_t bytesWritten = write(serialPort, txFrame, frameLen);
if (bytesWritten != frameLen) {
sif::warning << "ScexUartReader::sendMessage: Sending ping command to solar experiment failed"
<< std::endl;
ssize_t bytesWritten = write(serialPort, txFrame, frameLen);
if (bytesWritten != static_cast<ssize_t>(frameLen)) {
sif::warning << "StrComHandler: Sending packet failed" << std::endl;
return returnvalue::FAILED;
}
// Hacky, but the alternatives look bleak. The raw data contains the information we need
@ -746,12 +743,12 @@ ReturnValue_t StrComHandler::handleSerialReception() {
if (bytesRead == 0) {
return NO_SERIAL_DATA_READ;
} else if (bytesRead < 0) {
sif::warning << "PlocSupvHelper::performOperation: read call failed with error [" << errno
<< ", " << strerror(errno) << "]" << std::endl;
sif::warning << "StrComHandler: read call failed with error [" << errno << ", "
<< strerror(errno) << "]" << std::endl;
return FAILED;
} else if (bytesRead >= static_cast<int>(recBuf.size())) {
sif::error << "PlocSupvHelper::performOperation: Receive buffer too small for " << bytesRead
<< " bytes" << std::endl;
sif::error << "StrComHandler: Receive buffer too small for " << bytesRead << " bytes"
<< std::endl;
return FAILED;
} else if (bytesRead > 0) {
// sif::info << "Received " << bytesRead << " bytes from the STR" << std::endl;

View File

@ -28,7 +28,6 @@ class StrComHandler : public SystemObject, public DeviceCommunicationIF, public
public:
static const uint8_t INTERFACE_ID = CLASS_ID::STR_HELPER;
static const ReturnValue_t BUSY = MAKE_RETURN_CODE(0);
//! [EXPORT] : [COMMENT] SD card specified in path string not mounted
static const ReturnValue_t SD_NOT_MOUNTED = MAKE_RETURN_CODE(1);
//! [EXPORT] : [COMMENT] Specified file does not exist on filesystem