update
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Irini Kosmidou
2022-05-29 17:52:13 +02:00
parent 1f616a101d
commit 24cb555849
8 changed files with 48 additions and 14 deletions

View File

@ -8,6 +8,7 @@
#include "fsfw/globalfunctions/CRC.h"
#include "mission/devices/devicedefinitions/ScexDefinitions.h"
#include <random>
using std::ofstream;
@ -47,7 +48,7 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic
switch (deviceCommand) {
case (PING): {
rawPacket = cmdBuf.data();
//rawPacket = cmdBuf.data();
prepareScexCmd(cmdTyped, commandData[0], {cmdBuf.data(), cmdBuf.size()}, rawPacketLen,
{nullptr, 0});
return RETURN_OK;
@ -220,4 +221,23 @@ ReturnValue_t ScexDeviceHandler::initializeLocalDataPool(localpool::DataPool& lo
return RETURN_OK;
}
std::string ScexDeviceHandler::random_string(std::string::size_type length) {
static auto& chrs =
"0123456789"
"abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
thread_local static std::mt19937 rg{std::random_device{}()};
thread_local static std::uniform_int_distribution<std::string::size_type> pick(0,
sizeof(chrs) - 2);
std::string s;
s.reserve(length);
while (length--) s += chrs[pick(rg)];
return s;
}
void ScexDeviceHandler::modeChanged() {}