ScexDeviceHandler DeviceReply
EIVE/eive-obsw/pipeline/head There was a failure building this commit Details

This commit is contained in:
Irini Kosmidou 2022-05-19 10:16:46 +02:00
parent 7179d9dec3
commit b4e1451501
1 changed files with 17 additions and 1 deletions

View File

@ -3,10 +3,13 @@
#include <linux/devices/ScexHelper.h>
#include <algorithm>
#include <iostream>
#include "fsfw/globalfunctions/CRC.h"
#include "mission/devices/devicedefinitions/ScexDefinitions.h"
using std::ofstream;
ScexDeviceHandler::ScexDeviceHandler(object_id_t objectId, ScexUartReader& reader, CookieIF* cookie)
: DeviceHandlerBase(objectId, reader.getObjectId(), cookie), reader(reader) {}
@ -104,8 +107,12 @@ ReturnValue_t ScexDeviceHandler::scanForReply(const uint8_t* start, size_t remai
if (result == ScexHelper::INVALID_CRC) {
sif::warning << "CRC invalid" << std::endl;
}
sif::info << helper << std::endl;
// crc check
if (result == ScexHelper::INVALID_CRC) {
sif::warning << "CRC invalid" << std::endl;
}
sif::info << helper << std::endl;
*foundId = helper.getCmd();
*foundLen = remainingSize;
@ -115,6 +122,15 @@ 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)
using namespace scex;
if (helper.getCmd() == PING) {
ofstream out("/tmp/scex-ping.bin", ofstream::binary);
if (out.bad()) {
sif::warning << "bad" << std::endl;
}
out << helper;
}
// was alles hier rein?
return RETURN_OK;
}