added basic unittests for hdlc encoder
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2023-02-15 19:58:32 +01:00
parent 655e01c2d1
commit 9fdb41506b
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
8 changed files with 95 additions and 63 deletions

View File

@ -190,7 +190,7 @@ ReturnValue_t RwPollingTask::readNextReply(RwCookie& rwCookie, uint8_t* replyBuf
return rws::SPI_READ_FAILURE;
}
if (idx == 0) {
if (byteRead != FLAG_BYTE) {
if (byteRead != rws::FRAME_DELIMITER) {
sif::error << "Invalid data, expected start marker" << std::endl;
pullCsHigh(gpioId, gpioIF);
closeSpi(fd);
@ -198,7 +198,7 @@ ReturnValue_t RwPollingTask::readNextReply(RwCookie& rwCookie, uint8_t* replyBuf
}
}
if (byteRead != FLAG_BYTE) {
if (byteRead != rws::FRAME_DELIMITER) {
break;
}
@ -228,7 +228,7 @@ ReturnValue_t RwPollingTask::readNextReply(RwCookie& rwCookie, uint8_t* replyBuf
}
}
if (byteRead == FLAG_BYTE) {
if (byteRead == rws::FRAME_DELIMITER) {
// Reached end of frame
break;
} else if (byteRead == 0x7D) {
@ -268,9 +268,9 @@ ReturnValue_t RwPollingTask::readNextReply(RwCookie& rwCookie, uint8_t* replyBuf
result = rws::SPI_READ_FAILURE;
break;
}
if (byteRead != FLAG_BYTE) {
sif::error << "rwSpiCallback::spiCallback: Missing end sign " << static_cast<int>(FLAG_BYTE)
<< std::endl;
if (byteRead != rws::FRAME_DELIMITER) {
sif::error << "rwSpiCallback::spiCallback: Missing end sign "
<< static_cast<int>(rws::FRAME_DELIMITER) << std::endl;
decodedFrameLen--;
result = rws::MISSING_END_SIGN;
break;
@ -353,23 +353,6 @@ size_t RwPollingTask::idAndIdxToReadBuffer(DeviceCommandId_t id, uint8_t rwIdx,
}
}
void RwPollingTask::encodeHdlc(const uint8_t* sourceBuf, size_t sourceLen, size_t& encodedLen) {
encodedBuffer[0] = FLAG_BYTE;
encodedLen = 1;
for (size_t sourceIdx = 0; sourceIdx < sourceLen; sourceIdx++) {
if (sourceBuf[sourceIdx] == 0x7E) {
encodedBuffer[encodedLen++] = 0x7D;
encodedBuffer[encodedLen++] = 0x5E;
} else if (sourceBuf[sourceIdx] == 0x7D) {
encodedBuffer[encodedLen++] = 0x7D;
encodedBuffer[encodedLen++] = 0x5D;
} else {
encodedBuffer[encodedLen++] = sourceBuf[sourceIdx];
}
}
encodedBuffer[encodedLen++] = FLAG_BYTE;
}
// This closes the SPI
void RwPollingTask::closeSpi(int fd) {
// This will perform the function to close the SPI
@ -385,31 +368,9 @@ ReturnValue_t RwPollingTask::sendOneMessage(int fd, RwCookie& rwCookie) {
return returnvalue::FAILED;
}
pullCsLow(gpioId, spiLock, gpioIF);
/*
//Encoding and sending command
size_t idx = 0;
while (idx < dataLen) {
switch (*(data + idx)) {
case 0x7E:
writeBuffer[0] = 0x7D;
writeBuffer[1] = 0x5E;
writeSize = 2;
break;
case 0x7D:
writeBuffer[0] = 0x7D;
writeBuffer[1] = 0x5D;
writeSize = 2;
break;
default:
writeBuffer[0] = *(data + idx);
writeSize = 1;
break;
}
}
*/
// Add datalinklayer like specified in the datasheet.
size_t lenToSend = 0;
encodeHdlc(writeBuffer.data(), writeLen, lenToSend);
rws::encodeHdlc(writeBuffer.data(), writeLen, encodedBuffer.data(), lenToSend);
if (write(fd, encodedBuffer.data(), lenToSend) != static_cast<ssize_t>(lenToSend)) {
sif::error << "rwSpiCallback::spiCallback: Write failed!" << std::endl;
pullCsHigh(gpioId, gpioIF);

View File

@ -48,8 +48,6 @@ class RwPollingTask : public SystemObject, public ExecutableObjectIF, public Dev
std::array<uint8_t, rws::MAX_CMD_SIZE * 2> encodedBuffer;
size_t writeLen = 0;
//! This is the end and start marker of the frame datalinklayer
static constexpr uint8_t FLAG_BYTE = 0x7E;
static constexpr MutexIF::TimeoutType TIMEOUT_TYPE = MutexIF::TimeoutType::WAITING;
static constexpr uint32_t TIMEOUT_MS = 20;
static constexpr uint8_t MAX_RETRIES_REPLY = 5;
@ -75,7 +73,6 @@ class RwPollingTask : public SystemObject, public ExecutableObjectIF, public Dev
ReturnValue_t prepareSetSpeedCmd(uint8_t rwIdx);
size_t idAndIdxToReadBuffer(DeviceCommandId_t id, uint8_t rwIdx, uint8_t** readPtr);
void encodeHdlc(const uint8_t* sourceBuf, size_t sourceLen, size_t& encodedLen);
void pullCsHigh(gpioId_t gpioId, GpioIF& gpioIF);
void closeSpi(int);

View File

@ -57,7 +57,8 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="thirdparty/json/tests|thirdparty/json/docs|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-release-q7s|bsp_linux_board|thirdparty/json/single_include|cmake-build-debug-q7s-em|cmake-build-debug-q7s/_deps/etl-src/temp|thirdparty/rapidcsv/examples|cmake-build-debug-q7s/_deps/etl-src/images|fsfwconfig|cmake-build-debug-q7s/_deps/etl-src/subprojects|thirdparty/json/third_party|bsp_q7s|thirdparty/json/test|bsp_te0720_1cfa|scripts|cmake-build-debug-q7s/_deps/etl-src/cmake|bsp_egse|build-Debug-RPi|thirdparty/rapidcsv/doc|thirdparty/json/doc|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-release-q7s-em|cmake-build-debug-q7s|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/test|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug/_deps|thirdparty/rapidcsv/tests|archive|thirdparty/json/cmake|thirdparty/json/benchmarks" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry excluding="cmake-build-debug-q7s-em|cmake-build-debug-q7s|bsp_q7s|cmake-build-debug/_deps|cmake-build-release-q7s-em|build-Debug-RPi|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test|fsfwconfig" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="cmake-build-debug/_deps/etl-src/include"/>
</sourceEntries>
</configuration>
</storageModule>
@ -119,7 +120,8 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="thirdparty/json/tests|thirdparty/json/docs|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-release-q7s|bsp_linux_board|thirdparty/json/single_include|cmake-build-debug-q7s-em|cmake-build-debug-q7s/_deps/etl-src/temp|thirdparty/rapidcsv/examples|cmake-build-debug-q7s/_deps/etl-src/images|fsfwconfig|cmake-build-debug-q7s/_deps/etl-src/subprojects|thirdparty/json/third_party|bsp_q7s|thirdparty/json/test|bsp_te0720_1cfa|scripts|cmake-build-debug-q7s/_deps/etl-src/cmake|bsp_egse|build-Debug-RPi|thirdparty/rapidcsv/doc|thirdparty/json/doc|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-release-q7s-em|cmake-build-debug-q7s|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/test|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug/_deps|thirdparty/rapidcsv/tests|archive|thirdparty/json/cmake|thirdparty/json/benchmarks" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry excluding="cmake-build-debug-q7s-em|cmake-build-debug-q7s|bsp_q7s|cmake-build-debug/_deps|cmake-build-release-q7s-em|build-Debug-RPi|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test|fsfwconfig" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="cmake-build-debug/_deps/etl-src/include"/>
</sourceEntries>
</configuration>
</storageModule>
@ -187,7 +189,8 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="thirdparty/json/tests|thirdparty/json/docs|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-release-q7s|bsp_linux_board|thirdparty/json/single_include|cmake-build-debug-q7s-em|cmake-build-debug-q7s/_deps/etl-src/temp|thirdparty/rapidcsv/examples|cmake-build-debug-q7s/_deps/etl-src/images|fsfwconfig|cmake-build-debug-q7s/_deps/etl-src/subprojects|thirdparty/json/third_party|bsp_q7s|thirdparty/json/test|bsp_te0720_1cfa|scripts|cmake-build-debug-q7s/_deps/etl-src/cmake|bsp_egse|build-Debug-RPi|thirdparty/rapidcsv/doc|thirdparty/json/doc|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-release-q7s-em|cmake-build-debug-q7s|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/test|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug/_deps|thirdparty/rapidcsv/tests|archive|thirdparty/json/cmake|thirdparty/json/benchmarks" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry excluding="cmake-build-debug-q7s-em|cmake-build-debug-q7s|bsp_q7s|cmake-build-debug/_deps|cmake-build-release-q7s-em|build-Debug-RPi|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test|fsfwconfig" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="cmake-build-debug/_deps/etl-src/include"/>
</sourceEntries>
</configuration>
</storageModule>
@ -255,7 +258,8 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="thirdparty/json/tests|thirdparty/json/docs|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-release-q7s|bsp_linux_board|thirdparty/json/single_include|cmake-build-debug-q7s-em|cmake-build-debug-q7s/_deps/etl-src/temp|thirdparty/rapidcsv/examples|cmake-build-debug-q7s/_deps/etl-src/images|fsfwconfig|cmake-build-debug-q7s/_deps/etl-src/subprojects|thirdparty/json/third_party|bsp_q7s|thirdparty/json/test|bsp_te0720_1cfa|scripts|cmake-build-debug-q7s/_deps/etl-src/cmake|bsp_egse|build-Debug-RPi|thirdparty/rapidcsv/doc|thirdparty/json/doc|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-release-q7s-em|cmake-build-debug-q7s|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/test|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug/_deps|thirdparty/rapidcsv/tests|archive|thirdparty/json/cmake|thirdparty/json/benchmarks" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry excluding="cmake-build-debug-q7s-em|cmake-build-debug-q7s|bsp_q7s|cmake-build-debug/_deps|cmake-build-release-q7s-em|build-Debug-RPi|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test|fsfwconfig" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="cmake-build-debug/_deps/etl-src/include"/>
</sourceEntries>
</configuration>
</storageModule>
@ -418,7 +422,8 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="thirdparty/json/tests|thirdparty/json/docs|build-Debug-RPi/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-release-q7s|build-Debug-RPi/_deps/etl-src/temp|thirdparty/json/single_include|cmake-build-debug-q7s-em|cmake-build-debug-q7s/_deps/etl-src/temp|thirdparty/rapidcsv/examples|build-Debug-RPi/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/images|build-Debug-RPi/_deps/etl-src/subprojects|cmake-build-debug|cmake-build-debug-q7s/_deps/etl-src/subprojects|thirdparty/json/third_party|bsp_hosted|thirdparty/json/test|bsp_te0720_1cfa|scripts|build-Debug-RPi/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/cmake|bsp_egse|thirdparty/rapidcsv/doc|build-Debug-RPi/_deps/etl-src/examples|thirdparty/json/doc|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-release-q7s-em|build-Debug-RPi/_deps/etl-src/test|build-Debug-RPi/_deps/etl-src/scripts|cmake-build-debug-q7s|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/test|build-Debug-RPi/_deps/etl-src/arduino|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|build-Debug-RPi/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/support|thirdparty/rapidcsv/tests|archive|thirdparty/json/cmake|thirdparty/json/benchmarks" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry excluding="build-Debug-RPi/_deps/etl-src/uml|build-Debug-RPi/_deps/etl-src/test|build-Debug-RPi/_deps/etl-src/temp|build-Debug-RPi/_deps/etl-src/support|build-Debug-RPi/_deps/etl-src/subprojects|build-Debug-RPi/_deps/etl-src/scripts|build-Debug-RPi/_deps/etl-src/images|build-Debug-RPi/_deps/etl-src/examples|build-Debug-RPi/_deps/etl-src/cmake|build-Debug-RPi/_deps/etl-src/arduino|cmake-build-debug-q7s|cmake-build-debug|cmake-build-debug-q7s-em|cmake-build-release-q7s-em|bsp_hosted|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="cmake-build-debug/_deps/etl-src/include"/>
</sourceEntries>
</configuration>
</storageModule>
@ -580,7 +585,8 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="thirdparty/json/tests|thirdparty/json/docs|build-Debug-RPi/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-release-q7s|build-Debug-RPi/_deps/etl-src/temp|thirdparty/json/single_include|cmake-build-debug-q7s-em|cmake-build-debug-q7s/_deps/etl-src/temp|thirdparty/rapidcsv/examples|build-Debug-RPi/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/images|build-Debug-RPi/_deps/etl-src/subprojects|cmake-build-debug|cmake-build-debug-q7s/_deps/etl-src/subprojects|thirdparty/json/third_party|bsp_hosted|thirdparty/json/test|bsp_te0720_1cfa|scripts|build-Debug-RPi/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/cmake|bsp_egse|thirdparty/rapidcsv/doc|build-Debug-RPi/_deps/etl-src/examples|thirdparty/json/doc|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-release-q7s-em|build-Debug-RPi/_deps/etl-src/test|build-Debug-RPi/_deps/etl-src/scripts|cmake-build-debug-q7s|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/test|build-Debug-RPi/_deps/etl-src/arduino|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|build-Debug-RPi/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/support|thirdparty/rapidcsv/tests|archive|thirdparty/json/cmake|thirdparty/json/benchmarks" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry excluding="build-Debug-RPi/_deps/etl-src/uml|build-Debug-RPi/_deps/etl-src/test|build-Debug-RPi/_deps/etl-src/temp|build-Debug-RPi/_deps/etl-src/support|build-Debug-RPi/_deps/etl-src/subprojects|build-Debug-RPi/_deps/etl-src/scripts|build-Debug-RPi/_deps/etl-src/images|build-Debug-RPi/_deps/etl-src/examples|build-Debug-RPi/_deps/etl-src/cmake|build-Debug-RPi/_deps/etl-src/arduino|cmake-build-debug-q7s|cmake-build-debug|cmake-build-debug-q7s-em|cmake-build-release-q7s-em|bsp_hosted|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="cmake-build-debug/_deps/etl-src/include"/>
</sourceEntries>
</configuration>
</storageModule>
@ -680,7 +686,7 @@
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.other.1721137382" name="Other debugging flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.debugging.other"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.showDevicesTab.2014131279" name="showDevicesTab" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.showDevicesTab"/>
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform.363832829" isAbstract="false" osList="all" superClass="ilg.gnuarmeclipse.managedbuild.cross.targetPlatform"/>
<builder arguments="--build . -j" buildPath="${workspace_loc:/eive-obsw/cmake-build-debug-q7s}" command="cmake" enableCleanBuild="false" enabledIncrementalBuild="true" id="ilg.gnuarmeclipse.managedbuild.cross.builder.1895725167" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="ilg.gnuarmeclipse.managedbuild.cross.builder"/>
<builder arguments="--build . -j 10" buildPath="${workspace_loc:/eive-obsw/cmake-build-debug-q7s}" command="cmake" enableCleanBuild="false" enabledIncrementalBuild="true" id="ilg.gnuarmeclipse.managedbuild.cross.builder.1895725167" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="ilg.gnuarmeclipse.managedbuild.cross.builder"/>
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.2035413172" name="GNU Arm Cross Assembler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor.1527860624" name="Use preprocessor" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.usepreprocessor" value="true" valueType="boolean"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths.1772224733" name="Include paths (-I)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.include.paths" valueType="includePath">
@ -750,7 +756,8 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="thirdparty/json/tests|thirdparty/json/docs|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-release-q7s|bsp_linux_board|thirdparty/json/single_include|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s-em|thirdparty/rapidcsv/examples|build-Debug-Host|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug|cmake-build-debug-q7s/_deps/etl-src/subprojects|thirdparty/json/third_party|bsp_hosted|thirdparty/json/test|bsp_te0720_1cfa|scripts|cmake-build-debug-q7s/_deps/etl-src/cmake|bsp_egse|build-Debug-RPi|thirdparty/rapidcsv/doc|thirdparty/json/doc|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-release-q7s-em|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/test|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|cmake-build-debug-q7s/_deps/etl-src/support|thirdparty/rapidcsv/tests|archive|build-Watchdog-Debug|thirdparty/json/cmake|thirdparty/json/benchmarks" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry excluding="cmake-build-debug-q7s|cmake-build-release-q7s-em|build-Debug-RPi|bsp_hosted|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test|cmake-build-debug|cmake-build-debug-q7s-em|build-Debug-Host|build-Watchdog-Debug" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="cmake-build-debug/_deps/etl-src/include"/>
</sourceEntries>
</configuration>
</storageModule>
@ -917,7 +924,8 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="thirdparty/json/tests|thirdparty/json/docs|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-release-q7s/_deps/etl-src/support|bsp_linux_board|thirdparty/json/single_include|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s-em|thirdparty/rapidcsv/examples|build-Debug-Host|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug|cmake-build-debug-q7s/_deps/etl-src/subprojects|thirdparty/json/third_party|bsp_hosted|thirdparty/json/test|bsp_te0720_1cfa|scripts|cmake-build-release-q7s/_deps/etl-src/test|cmake-build-release-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/cmake|bsp_egse|cmake-build-release-q7s/_deps/etl-src/arduino|build-Debug-RPi|cmake-build-release-q7s/_deps/etl-src/cmake|thirdparty/rapidcsv/doc|thirdparty/json/doc|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-release-q7s-em|cmake-build-debug-q7s|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/test|cmake-build-release-q7s/_deps/etl-src/uml|cmake-build-release-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/arduino|cmake-build-release-q7s/_deps/etl-src/temp|tmtc|cmake-build-release-q7s/_deps/etl-src/images|cmake-build-release-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/support|thirdparty/rapidcsv/tests|archive|build-Watchdog-Debug|thirdparty/json/cmake|thirdparty/json/benchmarks" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry excluding="cmake-build-debug-q7s|cmake-build-release-q7s-em|cmake-build-release-q7s/_deps/etl-src/uml|cmake-build-release-q7s/_deps/etl-src/test|cmake-build-release-q7s/_deps/etl-src/temp|cmake-build-release-q7s/_deps/etl-src/support|cmake-build-release-q7s/_deps/etl-src/subprojects|cmake-build-release-q7s/_deps/etl-src/scripts|cmake-build-release-q7s/_deps/etl-src/images|cmake-build-release-q7s/_deps/etl-src/examples|cmake-build-release-q7s/_deps/etl-src/cmake|cmake-build-release-q7s/_deps/etl-src/arduino|build-Debug-RPi|bsp_hosted|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test|cmake-build-debug|cmake-build-debug-q7s-em|build-Debug-Host|build-Watchdog-Debug" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="cmake-build-debug/_deps/etl-src/include"/>
</sourceEntries>
</configuration>
</storageModule>
@ -1084,7 +1092,7 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="thirdparty/json/tests|thirdparty/json/docs|cmake-build-debug-q7s-em/_deps/etl-src/test|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-release-q7s|bsp_linux_board|thirdparty/json/single_include|cmake-build-debug-q7s/_deps/etl-src/temp|thirdparty/rapidcsv/examples|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/subprojects|thirdparty/json/third_party|bsp_hosted|thirdparty/json/test|bsp_te0720_1cfa|scripts|cmake-build-debug-q7s/_deps/etl-src/cmake|bsp_egse|build-Debug-RPi|thirdparty/rapidcsv/doc|thirdparty/json/doc|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-release-q7s-em|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/test|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|cmake-build-debug-q7s/_deps/etl-src/support|thirdparty/rapidcsv/tests|archive|thirdparty/json/cmake|thirdparty/json/benchmarks" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry excluding="cmake-build-debug/_deps/etl-src/uml|cmake-build-debug/_deps/etl-src/test|cmake-build-debug/_deps/etl-src/temp|cmake-build-debug/_deps/etl-src/support|cmake-build-debug/_deps/etl-src/subprojects|cmake-build-debug/_deps/etl-src/scripts|cmake-build-debug/_deps/etl-src/images|cmake-build-debug/_deps/etl-src/examples|cmake-build-debug/_deps/etl-src/cmake|cmake-build-debug/_deps/etl-src/arduino|cmake-build-release-q7s-em|build-Debug-RPi|bsp_hosted|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
@ -1149,7 +1157,7 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="thirdparty/json/tests|thirdparty/json/docs|cmake-build-debug-q7s-em/_deps/etl-src/test|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-release-q7s|bsp_linux_board|thirdparty/json/single_include|cmake-build-debug-q7s/_deps/etl-src/temp|thirdparty/rapidcsv/examples|cmake-build-debug-q7s/_deps/etl-src/images|fsfwconfig|cmake-build-debug-q7s/_deps/etl-src/subprojects|thirdparty/json/third_party|thirdparty/json/test|bsp_te0720_1cfa|scripts|cmake-build-debug-q7s/_deps/etl-src/cmake|bsp_egse|build-Debug-RPi|thirdparty/rapidcsv/doc|thirdparty/json/doc|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-release-q7s-em|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/test|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|cmake-build-debug-q7s/_deps/etl-src/support|thirdparty/rapidcsv/tests|archive|thirdparty/json/cmake|thirdparty/json/benchmarks" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry excluding="cmake-build-debug/_deps/etl-src/uml|cmake-build-debug/_deps/etl-src/test|cmake-build-debug/_deps/etl-src/temp|cmake-build-debug/_deps/etl-src/support|cmake-build-debug/_deps/etl-src/subprojects|cmake-build-debug/_deps/etl-src/scripts|cmake-build-debug/_deps/etl-src/images|cmake-build-debug/_deps/etl-src/examples|cmake-build-debug/_deps/etl-src/cmake|cmake-build-debug/_deps/etl-src/arduino|cmake-build-release-q7s-em|build-Debug-RPi|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test|fsfwconfig" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
@ -1317,7 +1325,8 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="thirdparty/json/tests|thirdparty/json/docs|cmake-build-debug-q7s-em/_deps/etl-src/test|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-release-q7s|bsp_linux_board|thirdparty/json/single_include|cmake-build-debug-q7s/_deps/etl-src/temp|thirdparty/rapidcsv/examples|build-Debug-Host|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug|cmake-build-debug-q7s/_deps/etl-src/subprojects|thirdparty/json/third_party|bsp_hosted|thirdparty/json/test|bsp_te0720_1cfa|scripts|cmake-build-debug-q7s/_deps/etl-src/cmake|bsp_egse|build-Debug-RPi|thirdparty/rapidcsv/doc|thirdparty/json/doc|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-release-q7s-em|cmake-build-debug-q7s|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/test|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|cmake-build-debug-q7s/_deps/etl-src/support|thirdparty/rapidcsv/tests|archive|build-Watchdog-Debug|thirdparty/json/cmake|thirdparty/json/benchmarks" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry excluding="cmake-build-debug-q7s|cmake-build-release-q7s-em|build-Debug-RPi|bsp_hosted|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test|cmake-build-debug|build-Debug-Host|build-Watchdog-Debug" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="cmake-build-debug/_deps/etl-src/include"/>
</sourceEntries>
</configuration>
</storageModule>
@ -1386,7 +1395,7 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="thirdparty/json/tests|thirdparty/json/docs|cmake-build-debug-q7s-em/_deps/etl-src/test|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-release-q7s|bsp_linux_board|thirdparty/json/single_include|cmake-build-debug-q7s/_deps/etl-src/temp|thirdparty/rapidcsv/examples|cmake-build-debug-q7s/_deps/etl-src/images|fsfwconfig|cmake-build-debug-q7s/_deps/etl-src/subprojects|thirdparty/json/third_party|thirdparty/json/test|bsp_te0720_1cfa|scripts|cmake-build-debug-q7s/_deps/etl-src/cmake|bsp_egse|build-Debug-RPi|thirdparty/rapidcsv/doc|thirdparty/json/doc|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-release-q7s-em|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/test|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|cmake-build-debug-q7s/_deps/etl-src/support|thirdparty/rapidcsv/tests|archive|thirdparty/json/cmake|thirdparty/json/benchmarks" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry excluding="cmake-build-debug/_deps/etl-src/uml|cmake-build-debug/_deps/etl-src/test|cmake-build-debug/_deps/etl-src/temp|cmake-build-debug/_deps/etl-src/support|cmake-build-debug/_deps/etl-src/subprojects|cmake-build-debug/_deps/etl-src/scripts|cmake-build-debug/_deps/etl-src/images|cmake-build-debug/_deps/etl-src/examples|cmake-build-debug/_deps/etl-src/cmake|cmake-build-debug/_deps/etl-src/arduino|cmake-build-release-q7s-em|build-Debug-RPi|bsp_linux_board|cmake-build-debug-q7s/_deps/etl-src/uml|cmake-build-debug-q7s/_deps/etl-src/temp|cmake-build-debug-q7s/_deps/etl-src/support|cmake-build-debug-q7s/_deps/etl-src/subprojects|cmake-build-debug-q7s/_deps/etl-src/scripts|cmake-build-debug-q7s/_deps/etl-src/images|cmake-build-debug-q7s/_deps/etl-src/examples|cmake-build-debug-q7s/_deps/etl-src/cmake|cmake-build-debug-q7s/_deps/etl-src/arduino|tmtc|scripts|bsp_te0720_1cfa|thirdparty/rapidcsv/tests|thirdparty/rapidcsv/examples|thirdparty/rapidcsv/doc|thirdparty/json/third_party|thirdparty/json/test|thirdparty/json/single_include|thirdparty/json/doc|thirdparty/json/cmake|thirdparty/json/benchmarks|archive|cmake-build-release-q7s|bsp_egse|cmake-build-debug-q7s/_deps/etl-src/test|fsfwconfig" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>

View File

@ -1 +1 @@
target_sources(${LIB_EIVE_MISSION} PRIVATE ScexDefinitions.cpp)
target_sources(${LIB_EIVE_MISSION} PRIVATE ScexDefinitions.cpp rwHelpers.cpp)

View File

@ -3,4 +3,22 @@
#include "rwHelpers.h"
void rws::encodeHdlc(const uint8_t* sourceBuf, size_t sourceLen, uint8_t* encodedBuffer,
size_t& encodedLen) {
encodedBuffer[0] = rws::FRAME_DELIMITER;
encodedLen = 1;
for (size_t sourceIdx = 0; sourceIdx < sourceLen; sourceIdx++) {
if (sourceBuf[sourceIdx] == 0x7E) {
encodedBuffer[encodedLen++] = 0x7D;
encodedBuffer[encodedLen++] = 0x5E;
} else if (sourceBuf[sourceIdx] == 0x7D) {
encodedBuffer[encodedLen++] = 0x7D;
encodedBuffer[encodedLen++] = 0x5D;
} else {
encodedBuffer[encodedLen++] = sourceBuf[sourceIdx];
}
}
encodedBuffer[encodedLen++] = rws::FRAME_DELIMITER;
}
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_RWHELPERS_CPP_ */

View File

@ -5,11 +5,15 @@
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
#include <fsfw/devicehandlers/DeviceHandlerIF.h>
#include "eive/resultClassIds.h"
#include "events/subsystemIdRanges.h"
#include "objects/systemObjectList.h"
namespace rws {
void encodeHdlc(const uint8_t* sourceBuf, size_t sourceLen, uint8_t* encodedBuffer,
size_t& encodedLen);
static const size_t SIZE_GET_RESET_STATUS = 5;
static const size_t SIZE_CLEAR_RESET_STATUS = 4;
static const size_t SIZE_INIT_RW = 4;
@ -19,6 +23,10 @@ static const size_t SIZE_GET_TEMPERATURE_REPLY = 8;
/** Max size when requesting telemetry */
static const size_t SIZE_GET_TELEMETRY_REPLY = 91;
//! This is the end and start marker of the frame datalinklayer. Also called frame delimiter
//! in the NanoAvionics datasheet.
static constexpr uint8_t FRAME_DELIMITER = 0x7E;
enum class SpecialRwRequest : uint8_t {
REQUEST_NONE = 0,
RESET_MCU = 1,

View File

@ -4,5 +4,6 @@ add_subdirectory(mocks)
target_sources(${UNITTEST_NAME} PRIVATE
main.cpp
testEnvironment.cpp
hdlcEncodingRw.cpp
printChar.cpp
)

View File

@ -0,0 +1,38 @@
#include <catch2/catch_test_macros.hpp>
#include "mission/devices/devicedefinitions/rwHelpers.h"
TEST_CASE("HDLC Encoding RW", "[acs]") {
std::array<uint8_t, 256> encodedBuffer{};
size_t encodedLen = 0;
SECTION("Basic No Escaped Bytes") {
std::array<uint8_t, 4> dummyNoEscaped = {1, 2, 3, 4};
rws::encodeHdlc(dummyNoEscaped.data(), dummyNoEscaped.size(), encodedBuffer.data(), encodedLen);
REQUIRE(encodedLen == 6);
REQUIRE(encodedBuffer[0] == rws::FRAME_DELIMITER);
REQUIRE(encodedBuffer[1] == 1);
REQUIRE(encodedBuffer[2] == 2);
REQUIRE(encodedBuffer[3] == 3);
REQUIRE(encodedBuffer[4] == 4);
REQUIRE(encodedBuffer[5] == rws::FRAME_DELIMITER);
}
SECTION("Basic Some Escaped Bytes") {
std::array<uint8_t, 4> dummySomeEscaped = {1, 0x7D, 0x7E, 4};
rws::encodeHdlc(dummySomeEscaped.data(), dummySomeEscaped.size(), encodedBuffer.data(),
encodedLen);
REQUIRE(encodedLen == 8);
REQUIRE(encodedBuffer[0] == rws::FRAME_DELIMITER);
REQUIRE(encodedBuffer[1] == 1);
REQUIRE(encodedBuffer[2] == 0x7D);
REQUIRE(encodedBuffer[3] == 0x5D);
REQUIRE(encodedBuffer[4] == 0x7D);
REQUIRE(encodedBuffer[5] == 0x5E);
REQUIRE(encodedBuffer[6] == 4);
REQUIRE(encodedBuffer[7] == rws::FRAME_DELIMITER);
}
}