Compare commits
3 Commits
c47bed0760
...
cfc00d0260
Author | SHA1 | Date | |
---|---|---|---|
cfc00d0260 | |||
b9d0ff8fb7 | |||
227535c461 |
@@ -1,2 +1,3 @@
|
|||||||
target_sources(${LIB_FSFW_NAME} PRIVATE SourceHandler.cpp DestHandler.cpp
|
target_sources(
|
||||||
FaultHandlerBase.cpp UserBase.cpp CfdpHandler.cpp)
|
${LIB_FSFW_NAME} PRIVATE SourceHandler.cpp DestHandler.cpp
|
||||||
|
FaultHandlerBase.cpp UserBase.cpp CfdpHandler.cpp)
|
||||||
|
@@ -17,7 +17,7 @@ CfdpHandler::CfdpHandler(const FsfwHandlerParams& fsfwParams, const CfdpHandlerC
|
|||||||
cfdpCfg.userHandler, cfdpCfg.remoteCfgProvider, cfdpCfg.packetInfoList,
|
cfdpCfg.userHandler, cfdpCfg.remoteCfgProvider, cfdpCfg.packetInfoList,
|
||||||
cfdpCfg.lostSegmentsList),
|
cfdpCfg.lostSegmentsList),
|
||||||
FsfwParams(fsfwParams.packetDest, nullptr, this, fsfwParams.tcStore,
|
FsfwParams(fsfwParams.packetDest, nullptr, this, fsfwParams.tcStore,
|
||||||
fsfwParams.tmStore)) {
|
fsfwParams.tmStore)) {
|
||||||
destHandler.setMsgQueue(msgQueue);
|
destHandler.setMsgQueue(msgQueue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -12,7 +12,11 @@
|
|||||||
struct FsfwHandlerParams {
|
struct FsfwHandlerParams {
|
||||||
FsfwHandlerParams(object_id_t objectId, HasFileSystemIF& vfs, AcceptsTelemetryIF& packetDest,
|
FsfwHandlerParams(object_id_t objectId, HasFileSystemIF& vfs, AcceptsTelemetryIF& packetDest,
|
||||||
StorageManagerIF& tcStore, StorageManagerIF& tmStore, MessageQueueIF& msgQueue)
|
StorageManagerIF& tcStore, StorageManagerIF& tmStore, MessageQueueIF& msgQueue)
|
||||||
: objectId(objectId), vfs(vfs), packetDest(packetDest), tcStore(tcStore), tmStore(tmStore),
|
: objectId(objectId),
|
||||||
|
vfs(vfs),
|
||||||
|
packetDest(packetDest),
|
||||||
|
tcStore(tcStore),
|
||||||
|
tmStore(tmStore),
|
||||||
msgQueue(msgQueue) {}
|
msgQueue(msgQueue) {}
|
||||||
object_id_t objectId{};
|
object_id_t objectId{};
|
||||||
HasFileSystemIF& vfs;
|
HasFileSystemIF& vfs;
|
||||||
|
@@ -526,16 +526,16 @@ ReturnValue_t DeviceHandlerBase::updatePeriodicReply(bool enable, DeviceCommandI
|
|||||||
if (enable) {
|
if (enable) {
|
||||||
info->active = true;
|
info->active = true;
|
||||||
if (info->countdown != nullptr) {
|
if (info->countdown != nullptr) {
|
||||||
info->delayCycles = info->maxDelayCycles;
|
|
||||||
} else {
|
|
||||||
info->countdown->resetTimer();
|
info->countdown->resetTimer();
|
||||||
|
} else {
|
||||||
|
info->delayCycles = info->maxDelayCycles;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
info->active = false;
|
info->active = false;
|
||||||
if (info->countdown != nullptr) {
|
if (info->countdown != nullptr) {
|
||||||
info->delayCycles = 0;
|
|
||||||
} else {
|
|
||||||
info->countdown->timeOut();
|
info->countdown->timeOut();
|
||||||
|
} else {
|
||||||
|
info->delayCycles = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3,6 +3,8 @@
|
|||||||
#include <fsfw/serviceinterface/ServiceInterface.h>
|
#include <fsfw/serviceinterface/ServiceInterface.h>
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
DleParser::DleParser(SimpleRingBuffer& decodeRingBuf, DleEncoder& decoder, BufPair encodedBuf,
|
DleParser::DleParser(SimpleRingBuffer& decodeRingBuf, DleEncoder& decoder, BufPair encodedBuf,
|
||||||
BufPair decodedBuf, UserHandler handler, void* args)
|
BufPair decodedBuf, UserHandler handler, void* args)
|
||||||
@@ -21,143 +23,207 @@ DleParser::DleParser(SimpleRingBuffer& decodeRingBuf, DleEncoder& decoder, BufPa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t DleParser::passData(uint8_t* data, size_t len) {
|
ReturnValue_t DleParser::passData(const uint8_t* data, size_t len) {
|
||||||
if (data == nullptr or len == 0 or handler == nullptr) {
|
if (data == nullptr or len == 0 or handler == nullptr) {
|
||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
size_t copyIntoRingBufFromHere = 0;
|
return decodeRingBuf.writeData(data , len);
|
||||||
size_t copyAmount = len;
|
// std::string filename = std::string("/mnt/sd0/scex/transfer") + std::to_string(COUNTER++);
|
||||||
size_t startIdx = 0;
|
// std::ofstream of(filename);
|
||||||
ReturnValue_t result = returnvalue::OK;
|
// of.write(reinterpret_cast<const char*>(data), len);
|
||||||
bool startFoundInThisPacket = false;
|
// size_t copyIntoRingBufFromHere = 0;
|
||||||
for (size_t idx = 0; idx < len; idx++) {
|
// size_t copyAmount = len;
|
||||||
if (data[idx] == DleEncoder::STX_CHAR) {
|
// size_t startIdx = 0;
|
||||||
if (not startFound and not startFoundInThisPacket) {
|
// ReturnValue_t result = returnvalue::OK;
|
||||||
startIdx = idx;
|
// bool startFoundInThisPacket = false;
|
||||||
copyIntoRingBufFromHere = idx;
|
// for (size_t idx = 0; idx < len; idx++) {
|
||||||
copyAmount = len - idx;
|
// if (data[idx] == DleEncoder::STX_CHAR) {
|
||||||
|
// if (not startFound and not startFoundInThisPacket) {
|
||||||
|
// startIdx = idx;
|
||||||
|
// copyIntoRingBufFromHere = idx;
|
||||||
|
// copyAmount = len - idx;
|
||||||
|
// } else {
|
||||||
|
// // Maybe print warning, should not happen
|
||||||
|
// decodeRingBuf.clear();
|
||||||
|
// ErrorInfo info;
|
||||||
|
// info.len = idx;
|
||||||
|
// prepareErrorContext(ErrorTypes::CONSECUTIVE_STX_CHARS, info);
|
||||||
|
// handler(ctx);
|
||||||
|
// copyIntoRingBufFromHere = idx;
|
||||||
|
// copyAmount = len - idx;
|
||||||
|
// }
|
||||||
|
// startFound = true;
|
||||||
|
// startFoundInThisPacket = true;
|
||||||
|
// } else if (data[idx] == DleEncoder::ETX_CHAR) {
|
||||||
|
// if (startFoundInThisPacket) {
|
||||||
|
// size_t readLen = 0;
|
||||||
|
// size_t decodedLen = 0;
|
||||||
|
// result = decoder.decode(data + startIdx, idx + 1 - startIdx, &readLen, decodedBuf.first,
|
||||||
|
// decodedBuf.second, &decodedLen);
|
||||||
|
// if (result == returnvalue::OK) {
|
||||||
|
// ctx.setType(ContextType::PACKET_FOUND);
|
||||||
|
// ctx.decodedPacket.first = decodedBuf.first;
|
||||||
|
// ctx.decodedPacket.second = decodedLen;
|
||||||
|
// this->handler(ctx);
|
||||||
|
// } else if (result == DleEncoder::STREAM_TOO_SHORT) {
|
||||||
|
// ErrorInfo info;
|
||||||
|
// info.res = result;
|
||||||
|
// prepareErrorContext(ErrorTypes::DECODING_BUF_TOO_SMALL, info);
|
||||||
|
// handler(ctx);
|
||||||
|
// } else {
|
||||||
|
// ErrorInfo info;
|
||||||
|
// info.res = result;
|
||||||
|
// prepareErrorContext(ErrorTypes::DECODING_BUF_TOO_SMALL, info);
|
||||||
|
// handler(ctx);
|
||||||
|
// }
|
||||||
|
// decodeRingBuf.clear();
|
||||||
|
// if ((idx + 1) < len) {
|
||||||
|
// copyIntoRingBufFromHere = idx + 1;
|
||||||
|
// copyAmount = len - idx - 1;
|
||||||
|
// } else {
|
||||||
|
// copyAmount = 0;
|
||||||
|
// }
|
||||||
|
// } else if (startFound) {
|
||||||
|
// // ETX found but STX was found in another mini packet. Reconstruct the full packet
|
||||||
|
// // to decode it
|
||||||
|
// result = decodeRingBuf.writeData(data, idx + 1);
|
||||||
|
// if (result != returnvalue::OK) {
|
||||||
|
// ErrorInfo info;
|
||||||
|
// info.res = result;
|
||||||
|
// prepareErrorContext(ErrorTypes::RING_BUF_ERROR, info);
|
||||||
|
// handler(ctx);
|
||||||
|
// }
|
||||||
|
// size_t fullEncodedLen = decodeRingBuf.getAvailableReadData();
|
||||||
|
// if (fullEncodedLen > encodedBuf.second) {
|
||||||
|
// ErrorInfo info;
|
||||||
|
// info.len = fullEncodedLen;
|
||||||
|
// prepareErrorContext(ErrorTypes::ENCODED_BUF_TOO_SMALL, info);
|
||||||
|
// handler(ctx);
|
||||||
|
// decodeRingBuf.clear();
|
||||||
|
// } else {
|
||||||
|
// size_t decodedLen = 0;
|
||||||
|
// size_t readLen = 0;
|
||||||
|
// decodeRingBuf.readData(encodedBuf.first, fullEncodedLen, true);
|
||||||
|
// result = decoder.decode(encodedBuf.first, fullEncodedLen, &readLen, decodedBuf.first,
|
||||||
|
// decodedBuf.second, &decodedLen);
|
||||||
|
// if (result == returnvalue::OK) {
|
||||||
|
// if (this->handler != nullptr) {
|
||||||
|
// ctx.setType(ContextType::PACKET_FOUND);
|
||||||
|
// ctx.decodedPacket.first = decodedBuf.first;
|
||||||
|
// ctx.decodedPacket.second = decodedLen;
|
||||||
|
// this->handler(ctx);
|
||||||
|
// }
|
||||||
|
// } else if (result == DleEncoder::STREAM_TOO_SHORT) {
|
||||||
|
// ErrorInfo info;
|
||||||
|
// info.res = result;
|
||||||
|
// prepareErrorContext(ErrorTypes::DECODING_BUF_TOO_SMALL, info);
|
||||||
|
// handler(ctx);
|
||||||
|
// } else {
|
||||||
|
// ErrorInfo info;
|
||||||
|
// info.res = result;
|
||||||
|
// prepareErrorContext(ErrorTypes::DECODE_ERROR, info);
|
||||||
|
// handler(ctx);
|
||||||
|
// }
|
||||||
|
// decodeRingBuf.clear();
|
||||||
|
// startFound = false;
|
||||||
|
// startFoundInThisPacket = false;
|
||||||
|
// if ((idx + 1) < len) {
|
||||||
|
// copyIntoRingBufFromHere = idx + 1;
|
||||||
|
// copyAmount = len - idx - 1;
|
||||||
|
// } else {
|
||||||
|
// copyAmount = 0;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// // End data without preceeding STX
|
||||||
|
// ErrorInfo info;
|
||||||
|
// info.len = idx + 1;
|
||||||
|
// prepareErrorContext(ErrorTypes::CONSECUTIVE_ETX_CHARS, info);
|
||||||
|
// handler(ctx);
|
||||||
|
// decodeRingBuf.clear();
|
||||||
|
// if ((idx + 1) < len) {
|
||||||
|
// copyIntoRingBufFromHere = idx + 1;
|
||||||
|
// copyAmount = len - idx - 1;
|
||||||
|
// } else {
|
||||||
|
// copyAmount = 0;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// startFoundInThisPacket = false;
|
||||||
|
// startFound = false;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (copyAmount > 0) {
|
||||||
|
// result = decodeRingBuf.writeData(data + copyIntoRingBufFromHere, copyAmount);
|
||||||
|
// if (result != returnvalue::OK) {
|
||||||
|
// ErrorInfo info;
|
||||||
|
// info.res = result;
|
||||||
|
// prepareErrorContext(ErrorTypes::RING_BUF_ERROR, info);
|
||||||
|
// handler(ctx);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ReturnValue_t DleParser::parseRingBuf(size_t& readSize) {
|
||||||
|
size_t availableData = decodeRingBuf.getAvailableReadData();
|
||||||
|
if (availableData > encodedBuf.second) {
|
||||||
|
ErrorInfo info;
|
||||||
|
info.len = decodeRingBuf.getAvailableReadData();
|
||||||
|
prepareErrorContext(ErrorTypes::DECODING_BUF_TOO_SMALL, info);
|
||||||
|
handler(ctx);
|
||||||
|
}
|
||||||
|
ReturnValue_t result = decodeRingBuf.readData(encodedBuf.first, availableData);
|
||||||
|
if(result != returnvalue::OK) {
|
||||||
|
ErrorInfo info;
|
||||||
|
info.res = result;
|
||||||
|
prepareErrorContext(ErrorTypes::RING_BUF_ERROR, info);
|
||||||
|
}
|
||||||
|
bool stxFound = false;
|
||||||
|
size_t stxIdx = 0;
|
||||||
|
for (size_t vectorIdx = 0; vectorIdx < availableData; vectorIdx++) {
|
||||||
|
// handle STX char
|
||||||
|
if (encodedBuf.first[vectorIdx] == DleEncoder::STX_CHAR) {
|
||||||
|
if (not stxFound) {
|
||||||
|
stxFound = true;
|
||||||
|
stxIdx = vectorIdx;
|
||||||
} else {
|
} else {
|
||||||
// Maybe print warning, should not happen
|
// might be lost packet, so we should advance the read pointer
|
||||||
decodeRingBuf.clear();
|
// without skipping the STX
|
||||||
ErrorInfo info;
|
readSize = vectorIdx;
|
||||||
info.len = idx;
|
return POSSIBLE_PACKET_LOSS;
|
||||||
prepareErrorContext(ErrorTypes::CONSECUTIVE_STX_CHARS, info);
|
|
||||||
handler(ctx);
|
|
||||||
copyIntoRingBufFromHere = idx;
|
|
||||||
copyAmount = len - idx;
|
|
||||||
}
|
}
|
||||||
startFound = true;
|
}
|
||||||
startFoundInThisPacket = true;
|
// handle ETX char
|
||||||
} else if (data[idx] == DleEncoder::ETX_CHAR) {
|
if (encodedBuf.first[vectorIdx] == DleEncoder::ETX_CHAR) {
|
||||||
if (startFoundInThisPacket) {
|
if (stxFound) {
|
||||||
size_t readLen = 0;
|
// This is propably a packet, so we decode it.
|
||||||
size_t decodedLen = 0;
|
size_t decodedLen = 0;
|
||||||
result = decoder.decode(data + startIdx, idx + 1 - startIdx, &readLen, decodedBuf.first,
|
size_t dummy = 0;
|
||||||
decodedBuf.second, &decodedLen);
|
readSize = vectorIdx;
|
||||||
|
ReturnValue_t result = decoder.decode(&encodedBuf.first[stxIdx], availableData - stxIdx,
|
||||||
|
&dummy, decodedBuf.first, decodedBuf.second, &decodedLen);
|
||||||
if (result == returnvalue::OK) {
|
if (result == returnvalue::OK) {
|
||||||
ctx.setType(ContextType::PACKET_FOUND);
|
ctx.setType(ContextType::PACKET_FOUND);
|
||||||
ctx.decodedPacket.first = decodedBuf.first;
|
ctx.decodedPacket.first = decodedBuf.first;
|
||||||
ctx.decodedPacket.second = decodedLen;
|
ctx.decodedPacket.second = decodedLen;
|
||||||
this->handler(ctx);
|
this->handler(ctx);
|
||||||
} else if (result == DleEncoder::STREAM_TOO_SHORT) {
|
return returnvalue::OK;
|
||||||
ErrorInfo info;
|
|
||||||
info.res = result;
|
|
||||||
prepareErrorContext(ErrorTypes::DECODING_BUF_TOO_SMALL, info);
|
|
||||||
handler(ctx);
|
|
||||||
} else {
|
} else {
|
||||||
ErrorInfo info;
|
// invalid packet, skip.
|
||||||
info.res = result;
|
readSize = ++vectorIdx;
|
||||||
prepareErrorContext(ErrorTypes::DECODING_BUF_TOO_SMALL, info);
|
return POSSIBLE_PACKET_LOSS;
|
||||||
handler(ctx);
|
|
||||||
}
|
|
||||||
decodeRingBuf.clear();
|
|
||||||
if ((idx + 1) < len) {
|
|
||||||
copyIntoRingBufFromHere = idx + 1;
|
|
||||||
copyAmount = len - idx - 1;
|
|
||||||
} else {
|
|
||||||
copyAmount = 0;
|
|
||||||
}
|
|
||||||
} else if (startFound) {
|
|
||||||
// ETX found but STX was found in another mini packet. Reconstruct the full packet
|
|
||||||
// to decode it
|
|
||||||
result = decodeRingBuf.writeData(data, idx + 1);
|
|
||||||
if (result != returnvalue::OK) {
|
|
||||||
ErrorInfo info;
|
|
||||||
info.res = result;
|
|
||||||
prepareErrorContext(ErrorTypes::RING_BUF_ERROR, info);
|
|
||||||
handler(ctx);
|
|
||||||
}
|
|
||||||
size_t fullEncodedLen = decodeRingBuf.getAvailableReadData();
|
|
||||||
if (fullEncodedLen > encodedBuf.second) {
|
|
||||||
ErrorInfo info;
|
|
||||||
info.len = fullEncodedLen;
|
|
||||||
prepareErrorContext(ErrorTypes::ENCODED_BUF_TOO_SMALL, info);
|
|
||||||
handler(ctx);
|
|
||||||
decodeRingBuf.clear();
|
|
||||||
} else {
|
|
||||||
size_t decodedLen = 0;
|
|
||||||
size_t readLen = 0;
|
|
||||||
decodeRingBuf.readData(encodedBuf.first, fullEncodedLen, true);
|
|
||||||
result = decoder.decode(encodedBuf.first, fullEncodedLen, &readLen, decodedBuf.first,
|
|
||||||
decodedBuf.second, &decodedLen);
|
|
||||||
if (result == returnvalue::OK) {
|
|
||||||
if (this->handler != nullptr) {
|
|
||||||
ctx.setType(ContextType::PACKET_FOUND);
|
|
||||||
ctx.decodedPacket.first = decodedBuf.first;
|
|
||||||
ctx.decodedPacket.second = decodedLen;
|
|
||||||
this->handler(ctx);
|
|
||||||
}
|
|
||||||
} else if (result == DleEncoder::STREAM_TOO_SHORT) {
|
|
||||||
ErrorInfo info;
|
|
||||||
info.res = result;
|
|
||||||
prepareErrorContext(ErrorTypes::DECODING_BUF_TOO_SMALL, info);
|
|
||||||
handler(ctx);
|
|
||||||
} else {
|
|
||||||
ErrorInfo info;
|
|
||||||
info.res = result;
|
|
||||||
prepareErrorContext(ErrorTypes::DECODE_ERROR, info);
|
|
||||||
handler(ctx);
|
|
||||||
}
|
|
||||||
decodeRingBuf.clear();
|
|
||||||
startFound = false;
|
|
||||||
startFoundInThisPacket = false;
|
|
||||||
if ((idx + 1) < len) {
|
|
||||||
copyIntoRingBufFromHere = idx + 1;
|
|
||||||
copyAmount = len - idx - 1;
|
|
||||||
} else {
|
|
||||||
copyAmount = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// End data without preceeding STX
|
// might be lost packet, so we should advance the read pointer
|
||||||
ErrorInfo info;
|
readSize = ++vectorIdx;
|
||||||
info.len = idx + 1;
|
return POSSIBLE_PACKET_LOSS;
|
||||||
prepareErrorContext(ErrorTypes::CONSECUTIVE_ETX_CHARS, info);
|
|
||||||
handler(ctx);
|
|
||||||
decodeRingBuf.clear();
|
|
||||||
if ((idx + 1) < len) {
|
|
||||||
copyIntoRingBufFromHere = idx + 1;
|
|
||||||
copyAmount = len - idx - 1;
|
|
||||||
} else {
|
|
||||||
copyAmount = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
startFoundInThisPacket = false;
|
|
||||||
startFound = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (copyAmount > 0) {
|
|
||||||
result = decodeRingBuf.writeData(data + copyIntoRingBufFromHere, copyAmount);
|
|
||||||
if (result != returnvalue::OK) {
|
|
||||||
ErrorInfo info;
|
|
||||||
info.res = result;
|
|
||||||
prepareErrorContext(ErrorTypes::RING_BUF_ERROR, info);
|
|
||||||
handler(ctx);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DleParser::defaultFoundPacketHandler(uint8_t* packet, size_t len, void* args) {
|
void DleParser::defaultFoundPacketHandler(uint8_t* packet, size_t len, void* args) {
|
||||||
#if FSFW_VERBOSE_LEVEL >= 1
|
#if FSFW_VERBOSE_LEVEL >= 1
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
@@ -224,6 +290,10 @@ void DleParser::prepareErrorContext(ErrorTypes err, ErrorInfo info) {
|
|||||||
ctx.error.second = info;
|
ctx.error.second = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReturnValue_t DleParser::confirmBytesRead(size_t bytesRead) {
|
||||||
|
return decodeRingBuf.deleteData(bytesRead);
|
||||||
|
}
|
||||||
|
|
||||||
void DleParser::reset() {
|
void DleParser::reset() {
|
||||||
startFound = false;
|
startFound = false;
|
||||||
decodeRingBuf.clear();
|
decodeRingBuf.clear();
|
||||||
|
@@ -18,6 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
class DleParser {
|
class DleParser {
|
||||||
public:
|
public:
|
||||||
|
static constexpr ReturnValue_t NO_PACKET_FOUND = returnvalue::makeCode(1, 1);
|
||||||
|
static constexpr ReturnValue_t POSSIBLE_PACKET_LOSS = returnvalue::makeCode(1, 2);
|
||||||
using BufPair = std::pair<uint8_t*, size_t>;
|
using BufPair = std::pair<uint8_t*, size_t>;
|
||||||
|
|
||||||
enum class ContextType { PACKET_FOUND, ERROR };
|
enum class ContextType { PACKET_FOUND, ERROR };
|
||||||
@@ -88,7 +90,11 @@ class DleParser {
|
|||||||
* @param len
|
* @param len
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ReturnValue_t passData(uint8_t* data, size_t len);
|
ReturnValue_t passData(const uint8_t* data, size_t len);
|
||||||
|
|
||||||
|
ReturnValue_t parseRingBuf(size_t& bytesRead);
|
||||||
|
|
||||||
|
ReturnValue_t confirmBytesRead(size_t bytesRead);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Example found packet handler
|
* Example found packet handler
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
#include "fsfw/osal/common/TcpIpBase.h"
|
#include "fsfw/osal/common/TcpIpBase.h"
|
||||||
|
|
||||||
#include "fsfw/serviceinterface.h"
|
|
||||||
#include "fsfw/platform.h"
|
#include "fsfw/platform.h"
|
||||||
|
#include "fsfw/serviceinterface.h"
|
||||||
|
|
||||||
#ifdef PLATFORM_UNIX
|
#ifdef PLATFORM_UNIX
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@@ -1,8 +1,9 @@
|
|||||||
#include "fsfw/osal/windows/winTaskHelpers.h"
|
#include "fsfw/osal/windows/winTaskHelpers.h"
|
||||||
|
|
||||||
#include <mutex>
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
TaskPriority tasks::makeWinPriority(PriorityClass prioClass, PriorityNumber prioNumber) {
|
TaskPriority tasks::makeWinPriority(PriorityClass prioClass, PriorityNumber prioNumber) {
|
||||||
return (static_cast<uint16_t>(prioClass) << 16) | static_cast<uint16_t>(prioNumber);
|
return (static_cast<uint16_t>(prioClass) << 16) | static_cast<uint16_t>(prioNumber);
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
#define FSFW_TIMEMANAGER_TIMEREADERIF_H
|
#define FSFW_TIMEMANAGER_TIMEREADERIF_H
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#include "fsfw/platform.h"
|
#include "fsfw/platform.h"
|
||||||
|
|
||||||
#ifdef PLATFORM_WIN
|
#ifdef PLATFORM_WIN
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
*/
|
*/
|
||||||
class SpacePacketParser {
|
class SpacePacketParser {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
struct FoundPacketInfo {
|
struct FoundPacketInfo {
|
||||||
size_t startIdx = 0;
|
size_t startIdx = 0;
|
||||||
size_t sizeFound = 0;
|
size_t sizeFound = 0;
|
||||||
@@ -51,9 +50,7 @@ class SpacePacketParser {
|
|||||||
ReturnValue_t parseSpacePackets(const uint8_t** buffer, const size_t maxSize,
|
ReturnValue_t parseSpacePackets(const uint8_t** buffer, const size_t maxSize,
|
||||||
FoundPacketInfo& packetInfo);
|
FoundPacketInfo& packetInfo);
|
||||||
|
|
||||||
size_t getAmountRead() {
|
size_t getAmountRead() { return amountRead; }
|
||||||
return amountRead;
|
|
||||||
}
|
|
||||||
|
|
||||||
void reset() {
|
void reset() {
|
||||||
nextStartIdx = 0;
|
nextStartIdx = 0;
|
||||||
|
@@ -17,7 +17,7 @@ class FaultHandlerMock : public FaultHandlerBase {
|
|||||||
|
|
||||||
void noticeOfSuspensionCb(TransactionId& id, ConditionCode code) override;
|
void noticeOfSuspensionCb(TransactionId& id, ConditionCode code) override;
|
||||||
void noticeOfCancellationCb(TransactionId& id, ConditionCode code) override;
|
void noticeOfCancellationCb(TransactionId& id, ConditionCode code) override;
|
||||||
void abandonCb(TransactionId& id,ConditionCode code) override;
|
void abandonCb(TransactionId& id, ConditionCode code) override;
|
||||||
void ignoreCb(TransactionId& id, ConditionCode code) override;
|
void ignoreCb(TransactionId& id, ConditionCode code) override;
|
||||||
|
|
||||||
FaultInfo& getFhInfo(FaultHandlerCode fhCode);
|
FaultInfo& getFhInfo(FaultHandlerCode fhCode);
|
||||||
|
Reference in New Issue
Block a user