WIP: SCEX Init #272

Closed
muellerr wants to merge 62 commits from irini into develop
Showing only changes of commit b4e1451501 - Show all commits

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;
}