deSerialize
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
This commit is contained in:
parent
f2cb43a52f
commit
7179d9dec3
@ -1,16 +1,16 @@
|
||||
#include "ScexDeviceHandler.h"
|
||||
|
||||
#include <linux/devices/ScexHelper.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "mission/devices/devicedefinitions/ScexDefinitions.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)
|
||||
: DeviceHandlerBase(objectId, reader.getObjectId(),cookie), reader(reader)
|
||||
{
|
||||
: DeviceHandlerBase(objectId, reader.getObjectId(), cookie), reader(reader) {}
|
||||
|
||||
}
|
||||
ScexDeviceHandler::~ScexDeviceHandler() {}
|
||||
|
||||
void ScexDeviceHandler::doStartUp() {
|
||||
// mode on
|
||||
@ -27,9 +27,9 @@ ReturnValue_t ScexDeviceHandler::buildTransitionDeviceCommand(DeviceCommandId_t*
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||
const uint8_t* commandData,
|
||||
size_t commandDataLen) {
|
||||
ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(
|
||||
scex::Cmds deviceCommand, // DeviceCommandId_t
|
||||
const uint8_t* commandData, size_t commandDataLen) {
|
||||
using namespace scex;
|
||||
|
||||
if (not std::find(VALID_CMDS.begin(), VALID_CMDS.end(), deviceCommand) != VALID_CMDS.end()) {
|
||||
@ -96,7 +96,15 @@ void ScexDeviceHandler::fillCommandAndReplyMap() {
|
||||
|
||||
ReturnValue_t ScexDeviceHandler::scanForReply(const uint8_t* start, size_t remainingSize,
|
||||
DeviceCommandId_t* foundId, size_t* foundLen) {
|
||||
//helper.deSerialize(blabla);
|
||||
uint8_t* decodedPacket = nullptr;
|
||||
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();
|
||||
@ -123,6 +131,4 @@ ReturnValue_t ScexDeviceHandler::initializeLocalDataPool(localpool::DataPool& lo
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ScexDeviceHandler::modeChanged() {}
|
||||
|
@ -9,6 +9,8 @@ class ScexDeviceHandler : public DeviceHandlerBase {
|
||||
public:
|
||||
// ctor vervollständigen
|
||||
ScexDeviceHandler(object_id_t objectId, ScexUartReader &reader, CookieIF *cookie);
|
||||
virtual ~ScexDeviceHandler();
|
||||
|
||||
private:
|
||||
std::array<uint8_t, 64> cmdBuf = {};
|
||||
|
||||
@ -19,7 +21,7 @@ class ScexDeviceHandler : public DeviceHandlerBase {
|
||||
ScexUartReader &reader;
|
||||
ReturnValue_t buildNormalDeviceCommand(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;
|
||||
void fillCommandAndReplyMap() override;
|
||||
ReturnValue_t scanForReply(const uint8_t *start, size_t remainingSize, DeviceCommandId_t *foundId,
|
||||
|
Loading…
Reference in New Issue
Block a user