v1.14.0 #304

Merged
muellerr merged 366 commits from develop into main 2022-10-10 17:46:38 +02:00
2 changed files with 27 additions and 19 deletions
Showing only changes of commit 7179d9dec3 - Show all commits

View File

@ -1,16 +1,16 @@
#include "ScexDeviceHandler.h" #include "ScexDeviceHandler.h"
#include <linux/devices/ScexHelper.h>
#include <algorithm> #include <algorithm>
#include "mission/devices/devicedefinitions/ScexDefinitions.h"
#include "fsfw/globalfunctions/CRC.h" #include "fsfw/globalfunctions/CRC.h"
#include <linux/devices/ScexHelper.h> #include "mission/devices/devicedefinitions/ScexDefinitions.h"
ScexDeviceHandler::ScexDeviceHandler(object_id_t objectId, ScexUartReader& reader, CookieIF* cookie) ScexDeviceHandler::ScexDeviceHandler(object_id_t objectId, ScexUartReader& reader, CookieIF* cookie)
: DeviceHandlerBase(objectId, reader.getObjectId(),cookie), reader(reader) : DeviceHandlerBase(objectId, reader.getObjectId(), cookie), reader(reader) {}
{
} ScexDeviceHandler::~ScexDeviceHandler() {}
void ScexDeviceHandler::doStartUp() { void ScexDeviceHandler::doStartUp() {
// mode on // mode on
@ -27,9 +27,9 @@ ReturnValue_t ScexDeviceHandler::buildTransitionDeviceCommand(DeviceCommandId_t*
return RETURN_OK; return RETURN_OK;
} }
ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand, ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(
const uint8_t* commandData, scex::Cmds deviceCommand, // DeviceCommandId_t
size_t commandDataLen) { const uint8_t* commandData, size_t commandDataLen) {
using namespace scex; using namespace scex;
if (not std::find(VALID_CMDS.begin(), VALID_CMDS.end(), deviceCommand) != VALID_CMDS.end()) { if (not std::find(VALID_CMDS.begin(), VALID_CMDS.end(), deviceCommand) != VALID_CMDS.end()) {
@ -96,8 +96,16 @@ void ScexDeviceHandler::fillCommandAndReplyMap() {
ReturnValue_t ScexDeviceHandler::scanForReply(const uint8_t* start, size_t remainingSize, ReturnValue_t ScexDeviceHandler::scanForReply(const uint8_t* start, size_t remainingSize,
DeviceCommandId_t* foundId, size_t* foundLen) { DeviceCommandId_t* foundId, size_t* foundLen) {
//helper.deSerialize(blabla); uint8_t* decodedPacket = nullptr;
//crc check size_t len = 0;
const uint8_t* helperPtr = decodedPacket;
ReturnValue_t result = helper.deSerialize(&helperPtr, &len);
if (result == ScexHelper::INVALID_CRC) {
sif::warning << "CRC invalid" << std::endl;
}
sif::info << helper << std::endl;
// crc check
*foundId = helper.getCmd(); *foundId = helper.getCmd();
*foundLen = remainingSize; *foundLen = remainingSize;
@ -106,7 +114,7 @@ ReturnValue_t ScexDeviceHandler::scanForReply(const uint8_t* start, size_t remai
} }
ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) { ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) {
//cmd auswertung (in file reinschreiben) // cmd auswertung (in file reinschreiben)
return RETURN_OK; return RETURN_OK;
} }
@ -123,6 +131,4 @@ ReturnValue_t ScexDeviceHandler::initializeLocalDataPool(localpool::DataPool& lo
return RETURN_OK; return RETURN_OK;
} }
void ScexDeviceHandler::modeChanged() {} void ScexDeviceHandler::modeChanged() {}

View File

@ -8,7 +8,9 @@
class ScexDeviceHandler : public DeviceHandlerBase { class ScexDeviceHandler : public DeviceHandlerBase {
public: public:
// ctor vervollständigen // ctor vervollständigen
ScexDeviceHandler(object_id_t objectId, ScexUartReader& reader, CookieIF* cookie); ScexDeviceHandler(object_id_t objectId, ScexUartReader &reader, CookieIF *cookie);
virtual ~ScexDeviceHandler();
private: private:
std::array<uint8_t, 64> cmdBuf = {}; std::array<uint8_t, 64> cmdBuf = {};
@ -16,10 +18,10 @@ class ScexDeviceHandler : public DeviceHandlerBase {
void doStartUp() override; void doStartUp() override;
void doShutDown() override; void doShutDown() override;
ScexHelper helper; ScexHelper helper;
ScexUartReader& reader; ScexUartReader &reader;
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override; ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override;
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override; ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override;
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData, ReturnValue_t buildCommandFromCommand(scex::Cmds deviceCommand, const uint8_t *commandData,
size_t commandDataLen) override; size_t commandDataLen) override;
void fillCommandAndReplyMap() override; void fillCommandAndReplyMap() override;
ReturnValue_t scanForReply(const uint8_t *start, size_t remainingSize, DeviceCommandId_t *foundId, ReturnValue_t scanForReply(const uint8_t *start, size_t remainingSize, DeviceCommandId_t *foundId,