WIP: SCEX Init #272
@ -3,10 +3,13 @@
|
|||||||
#include <linux/devices/ScexHelper.h>
|
#include <linux/devices/ScexHelper.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include "fsfw/globalfunctions/CRC.h"
|
#include "fsfw/globalfunctions/CRC.h"
|
||||||
#include "mission/devices/devicedefinitions/ScexDefinitions.h"
|
#include "mission/devices/devicedefinitions/ScexDefinitions.h"
|
||||||
|
|
||||||
|
using std::ofstream;
|
||||||
|
|
||||||
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) {}
|
||||||
|
|
||||||
@ -104,8 +107,12 @@ ReturnValue_t ScexDeviceHandler::scanForReply(const uint8_t* start, size_t remai
|
|||||||
if (result == ScexHelper::INVALID_CRC) {
|
if (result == ScexHelper::INVALID_CRC) {
|
||||||
sif::warning << "CRC invalid" << std::endl;
|
sif::warning << "CRC invalid" << std::endl;
|
||||||
}
|
}
|
||||||
sif::info << helper << std::endl;
|
|
||||||
// crc check
|
// crc check
|
||||||
|
if (result == ScexHelper::INVALID_CRC) {
|
||||||
|
sif::warning << "CRC invalid" << std::endl;
|
||||||
|
}
|
||||||
|
sif::info << helper << std::endl;
|
||||||
|
|
||||||
*foundId = helper.getCmd();
|
*foundId = helper.getCmd();
|
||||||
*foundLen = remainingSize;
|
*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) {
|
ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) {
|
||||||
// cmd auswertung (in file reinschreiben)
|
// 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;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user