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 "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,17 +96,25 @@ 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;
|
||||||
|
|
||||||
*foundId = helper.getCmd();
|
const uint8_t* helperPtr = decodedPacket;
|
||||||
*foundLen = remainingSize;
|
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();
|
||||||
|
*foundLen = remainingSize;
|
||||||
|
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
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() {}
|
||||||
|
@ -7,8 +7,10 @@
|
|||||||
|
|
||||||
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,
|
||||||
|
Loading…
Reference in New Issue
Block a user