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 <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,8 +96,16 @@ void ScexDeviceHandler::fillCommandAndReplyMap() {
ReturnValue_t ScexDeviceHandler::scanForReply(const uint8_t* start, size_t remainingSize,
DeviceCommandId_t* foundId, size_t* foundLen) {
//helper.deSerialize(blabla);
//crc check
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();
*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) {
//cmd auswertung (in file reinschreiben)
// cmd auswertung (in file reinschreiben)
return RETURN_OK;
}
@ -123,6 +131,4 @@ ReturnValue_t ScexDeviceHandler::initializeLocalDataPool(localpool::DataPool& lo
return RETURN_OK;
}
void ScexDeviceHandler::modeChanged() {}

View File

@ -8,7 +8,9 @@
class ScexDeviceHandler : public DeviceHandlerBase {
public:
// ctor vervollständigen
ScexDeviceHandler(object_id_t objectId, ScexUartReader& reader, CookieIF* cookie);
ScexDeviceHandler(object_id_t objectId, ScexUartReader &reader, CookieIF *cookie);
virtual ~ScexDeviceHandler();
private:
std::array<uint8_t, 64> cmdBuf = {};
@ -16,10 +18,10 @@ class ScexDeviceHandler : public DeviceHandlerBase {
void doStartUp() override;
void doShutDown() override;
ScexHelper helper;
ScexUartReader& reader;
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,