add prototype for new ToAscii CCSDSTime function

This commit is contained in:
Robin Müller 2022-10-25 18:20:48 +02:00
parent 096af44e39
commit 819a2bfac4
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
12 changed files with 66 additions and 66 deletions

View File

@ -1603,12 +1603,12 @@ void DeviceHandlerBase::disableCommandsAndReplies() {
} }
ReturnValue_t DeviceHandlerBase::finishAction(bool success, DeviceCommandId_t action, ReturnValue_t DeviceHandlerBase::finishAction(bool success, DeviceCommandId_t action,
ReturnValue_t result) { ReturnValue_t result) {
auto commandIter = deviceCommandMap.find(action); auto commandIter = deviceCommandMap.find(action);
if (commandIter == deviceCommandMap.end()) { if (commandIter == deviceCommandMap.end()) {
return MessageQueueIF::NO_QUEUE; return MessageQueueIF::NO_QUEUE;
} }
commandIter->second.isExecuting = false; commandIter->second.isExecuting = false;
actionHelper.finish(success, commandIter->second.sendReplyTo, action, result); actionHelper.finish(success, commandIter->second.sendReplyTo, action, result);
return returnvalue::OK; return returnvalue::OK;
} }

View File

@ -11,8 +11,7 @@ DleParser::DleParser(SimpleRingBuffer& decodeRingBuf, DleEncoder& decoder, BufPa
: decodeRingBuf(decodeRingBuf), : decodeRingBuf(decodeRingBuf),
decoder(decoder), decoder(decoder),
encodedBuf(encodedBuf), encodedBuf(encodedBuf),
decodedBuf(decodedBuf) { decodedBuf(decodedBuf) {}
}
ReturnValue_t DleParser::passData(const uint8_t* data, size_t len) { ReturnValue_t DleParser::passData(const uint8_t* data, size_t len) {
if (data == nullptr or len == 0) { if (data == nullptr or len == 0) {
@ -24,7 +23,7 @@ ReturnValue_t DleParser::passData(const uint8_t* data, size_t len) {
ReturnValue_t DleParser::parseRingBuf(size_t& readSize) { ReturnValue_t DleParser::parseRingBuf(size_t& readSize) {
ctx.setType(DleParser::ContextType::NONE); ctx.setType(DleParser::ContextType::NONE);
size_t availableData = decodeRingBuf.getAvailableReadData(); size_t availableData = decodeRingBuf.getAvailableReadData();
if(availableData == 0) { if (availableData == 0) {
return NO_PACKET_FOUND; return NO_PACKET_FOUND;
} }
if (availableData > encodedBuf.second) { if (availableData > encodedBuf.second) {
@ -106,7 +105,7 @@ void DleParser::defaultFoundPacketHandler(uint8_t* packet, size_t len, void* arg
} }
void DleParser::defaultErrorHandler() { void DleParser::defaultErrorHandler() {
if(ctx.getType() != DleParser::ContextType::ERROR) { if (ctx.getType() != DleParser::ContextType::ERROR) {
errorPrinter("No error"); errorPrinter("No error");
return; return;
} }
@ -126,7 +125,8 @@ void DleParser::defaultErrorHandler() {
case (ErrorTypes::ENCODED_BUF_TOO_SMALL): case (ErrorTypes::ENCODED_BUF_TOO_SMALL):
case (ErrorTypes::DECODING_BUF_TOO_SMALL): { case (ErrorTypes::DECODING_BUF_TOO_SMALL): {
char opt[64]; char opt[64];
snprintf(opt, sizeof(opt), ": Too small for packet with length %zu", ctx.decodedPacket.second); snprintf(opt, sizeof(opt), ": Too small for packet with length %zu",
ctx.decodedPacket.second);
if (ctx.error.first == ErrorTypes::ENCODED_BUF_TOO_SMALL) { if (ctx.error.first == ErrorTypes::ENCODED_BUF_TOO_SMALL) {
errorPrinter("Encoded buf too small", opt); errorPrinter("Encoded buf too small", opt);
} else { } else {
@ -168,10 +168,6 @@ ReturnValue_t DleParser::confirmBytesRead(size_t bytesRead) {
return decodeRingBuf.deleteData(bytesRead); return decodeRingBuf.deleteData(bytesRead);
} }
const DleParser::Context& DleParser::getContext() { const DleParser::Context& DleParser::getContext() { return ctx; }
return ctx;
}
void DleParser::reset() { void DleParser::reset() { decodeRingBuf.clear(); }
decodeRingBuf.clear();
}

View File

@ -246,6 +246,11 @@ ReturnValue_t CCSDSTime::convertFromASCII(Clock::TimeOfDay_t* to, const uint8_t*
return UNSUPPORTED_TIME_FORMAT; return UNSUPPORTED_TIME_FORMAT;
} }
ReturnValue_t CCSDSTime::convertToASCII(int8_t* to, const Clock::TimeOfDay_t* from,
uint8_t length) {
return returnvalue::OK;
}
ReturnValue_t CCSDSTime::checkCcs(const uint8_t* time, uint8_t length) { ReturnValue_t CCSDSTime::checkCcs(const uint8_t* time, uint8_t length) {
const Ccs_mseconds* time_struct = reinterpret_cast<const Ccs_mseconds*>(time); const Ccs_mseconds* time_struct = reinterpret_cast<const Ccs_mseconds*>(time);

View File

@ -207,7 +207,7 @@ class CCSDSTime {
static ReturnValue_t convertFromASCII(Clock::TimeOfDay_t *to, uint8_t const *from, static ReturnValue_t convertFromASCII(Clock::TimeOfDay_t *to, uint8_t const *from,
uint8_t length); uint8_t length);
static ReturnValue_t convertToASCII(int8_t *to, const Clock::TimeOfDay_t *from, uint8_t length);
static uint32_t subsecondsToMicroseconds(uint16_t subseconds); static uint32_t subsecondsToMicroseconds(uint16_t subseconds);
private: private:

View File

@ -4,12 +4,11 @@
#include <fsfw/ipc/messageQueueDefinitions.h> #include <fsfw/ipc/messageQueueDefinitions.h>
class TmStoreFrontendSimpleIF { class TmStoreFrontendSimpleIF {
public: public:
virtual ~TmStoreFrontendSimpleIF() = default; virtual ~TmStoreFrontendSimpleIF() = default;
private:
private:
virtual MessageQueueId_t getCommandQueue() const = 0; virtual MessageQueueId_t getCommandQueue() const = 0;
}; };
#endif /* FSFW_SRC_FSFW_TMSTORAGE_TMSTOREBACKENDSIMPLEIF_H_ */ #endif /* FSFW_SRC_FSFW_TMSTORAGE_TMSTOREBACKENDSIMPLEIF_H_ */

View File

@ -2,6 +2,9 @@
#define FSFW_TMSTORAGE_TMSTOREPACKETS_H_ #define FSFW_TMSTORAGE_TMSTOREPACKETS_H_
#include <fsfw/tmtcpacket/pus/tm/PusTmReader.h> #include <fsfw/tmtcpacket/pus/tm/PusTmReader.h>
#include <vector>
#include "fsfw/globalfunctions/timevalOperations.h" #include "fsfw/globalfunctions/timevalOperations.h"
#include "fsfw/serialize/SerialBufferAdapter.h" #include "fsfw/serialize/SerialBufferAdapter.h"
#include "fsfw/serialize/SerialFixedArrayListAdapter.h" #include "fsfw/serialize/SerialFixedArrayListAdapter.h"
@ -12,8 +15,6 @@
#include "fsfw/tmtcpacket/pus/tm/PusTmMinimal.h" #include "fsfw/tmtcpacket/pus/tm/PusTmMinimal.h"
#include "tmStorageConf.h" #include "tmStorageConf.h"
#include <vector>
class ServiceSubservice : public SerialLinkedListAdapter<SerializeIF> { class ServiceSubservice : public SerialLinkedListAdapter<SerializeIF> {
public: public:
SerializeElement<uint8_t> service; SerializeElement<uint8_t> service;
@ -65,8 +66,9 @@ class ChangeSelectionDefinition : public SerialLinkedListAdapter<SerializeIF> {
class TmPacketInformation : public SerializeIF { class TmPacketInformation : public SerializeIF {
public: public:
TmPacketInformation(PusTmReader* packet, size_t timestampLen) TmPacketInformation(PusTmReader* packet, size_t timestampLen) : rawTimestamp(timestampLen) {
: rawTimestamp(timestampLen) { setContent(packet); } setContent(packet);
}
TmPacketInformation(size_t timestampLen) TmPacketInformation(size_t timestampLen)
: apid(ccsds::LIMIT_APID), : apid(ccsds::LIMIT_APID),
sourceSequenceCount(0), sourceSequenceCount(0),
@ -90,30 +92,31 @@ class TmPacketInformation : public SerializeIF {
subCounter = packet->getMessageTypeCounter(); subCounter = packet->getMessageTypeCounter();
memset(rawTimestamp.data(), 0, rawTimestamp.size()); memset(rawTimestamp.data(), 0, rawTimestamp.size());
// TODO: Fix all of this // TODO: Fix all of this
//const uint8_t* pField = NULL; // const uint8_t* pField = NULL;
//uint32_t size = 0; // uint32_t size = 0;
//auto* timeReader = packet->getTimeReader(); // auto* timeReader = packet->getTimeReader();
//ReturnValue_t result = packet->getPacketTimeRaw(&pField, &size); // ReturnValue_t result = packet->getPacketTimeRaw(&pField, &size);
//if (result != returnvalue::OK) { // if (result != returnvalue::OK) {
// return; // return;
//} //}
//if (*pField == CCSDSTime::P_FIELD_CDS_SHORT && size <= TimeStamperIF::MISSION_TIMESTAMP_SIZE) { // if (*pField == CCSDSTime::P_FIELD_CDS_SHORT && size <= TimeStamperIF::MISSION_TIMESTAMP_SIZE)
// Shortcut to avoid converting CDS back and forth. // {
// TODO: Fix // Shortcut to avoid converting CDS back and forth.
//memcpy(rawTimestamp, pField, size); // TODO: Fix
// return; // memcpy(rawTimestamp, pField, size);
// } // return;
// timeval time = {0, 0}; // }
// result = packet->getPacketTime(&time); // timeval time = {0, 0};
// if (result != returnvalue::OK) { // result = packet->getPacketTime(&time);
// return; // if (result != returnvalue::OK) {
// } // return;
// // }
// CCSDSTime::CDS_short cdsFormat; //
// result = CCSDSTime::convertToCcsds(&cdsFormat, &time); // CCSDSTime::CDS_short cdsFormat;
// if (result != returnvalue::OK) { // result = CCSDSTime::convertToCcsds(&cdsFormat, &time);
// return; // if (result != returnvalue::OK) {
// } // return;
// }
// TODO: Fix // TODO: Fix
// memcpy(rawTimestamp, &cdsFormat, sizeof(cdsFormat)); // memcpy(rawTimestamp, &cdsFormat, sizeof(cdsFormat));
} }

View File

@ -23,7 +23,9 @@ class AcceptsTelemetryIF {
*/ */
[[nodiscard]] virtual MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel) const = 0; [[nodiscard]] virtual MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel) const = 0;
[[nodiscard]] virtual MessageQueueId_t getReportReceptionQueue() const { return getReportReceptionQueue(0); } [[nodiscard]] virtual MessageQueueId_t getReportReceptionQueue() const {
return getReportReceptionQueue(0);
}
}; };
#endif /* FSFW_TMTCSERVICES_ACCEPTSTELEMETRYIF_H_ */ #endif /* FSFW_TMTCSERVICES_ACCEPTSTELEMETRYIF_H_ */

View File

@ -1,4 +1,5 @@
#include "UartComIF.h" #include "UartComIF.h"
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <termios.h> #include <termios.h>
@ -458,5 +459,3 @@ ReturnValue_t UartComIF::flushUartTxAndRxBuf(CookieIF* cookie) {
} }
return returnvalue::FAILED; return returnvalue::FAILED;
} }

View File

@ -1,15 +1,14 @@
#ifndef BSP_Q7S_COMIF_UARTCOMIF_H_ #ifndef BSP_Q7S_COMIF_UARTCOMIF_H_
#define BSP_Q7S_COMIF_UARTCOMIF_H_ #define BSP_Q7S_COMIF_UARTCOMIF_H_
#include "UartCookie.h"
#include "helper.h"
#include <fsfw/devicehandlers/DeviceCommunicationIF.h> #include <fsfw/devicehandlers/DeviceCommunicationIF.h>
#include <fsfw/objectmanager/SystemObject.h> #include <fsfw/objectmanager/SystemObject.h>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include "UartCookie.h"
#include "helper.h"
/** /**
* @brief This is the communication interface to access serial ports on linux based operating * @brief This is the communication interface to access serial ports on linux based operating

View File

@ -1,14 +1,12 @@
#ifndef SAM9G20_COMIF_COOKIES_UART_COOKIE_H_ #ifndef SAM9G20_COMIF_COOKIES_UART_COOKIE_H_
#define SAM9G20_COMIF_COOKIES_UART_COOKIE_H_ #define SAM9G20_COMIF_COOKIES_UART_COOKIE_H_
#include "helper.h"
#include <fsfw/devicehandlers/CookieIF.h> #include <fsfw/devicehandlers/CookieIF.h>
#include <fsfw/objectmanager/SystemObjectIF.h> #include <fsfw/objectmanager/SystemObjectIF.h>
#include <string> #include <string>
#include "helper.h"
/** /**
* @brief Cookie for the UartComIF. There are many options available to configure the UART driver. * @brief Cookie for the UartComIF. There are many options available to configure the UART driver.

View File

@ -1,8 +1,9 @@
#include "helper.h" #include "helper.h"
#include "fsfw/serviceinterface.h"
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include "fsfw/serviceinterface.h"
void uart::setMode(struct termios& options, UartModes mode) { void uart::setMode(struct termios& options, UartModes mode) {
if (mode == UartModes::NON_CANONICAL) { if (mode == UartModes::NON_CANONICAL) {
/* Disable canonical mode */ /* Disable canonical mode */
@ -145,6 +146,5 @@ void uart::setBaudrate(struct termios& options, UartBaudRate baud) {
} }
int uart::readCountersAndErrors(int serialPort, serial_icounter_struct& icounter) { int uart::readCountersAndErrors(int serialPort, serial_icounter_struct& icounter) {
return ioctl(serialPort, TIOCGICOUNT, &icounter); return ioctl(serialPort, TIOCGICOUNT, &icounter);
} }

View File

@ -1,8 +1,8 @@
#ifndef FSFW_HAL_LINUX_UART_HELPER_H_ #ifndef FSFW_HAL_LINUX_UART_HELPER_H_
#define FSFW_HAL_LINUX_UART_HELPER_H_ #define FSFW_HAL_LINUX_UART_HELPER_H_
#include <termios.h>
#include <linux/serial.h> #include <linux/serial.h>
#include <termios.h>
enum class Parity { NONE, EVEN, ODD }; enum class Parity { NONE, EVEN, ODD };
@ -56,7 +56,6 @@ void setBaudrate(struct termios& options, UartBaudRate baud);
int readCountersAndErrors(int serialPort, serial_icounter_struct& icounter); int readCountersAndErrors(int serialPort, serial_icounter_struct& icounter);
} } // namespace uart
#endif /* FSFW_HAL_LINUX_UART_HELPER_H_ */ #endif /* FSFW_HAL_LINUX_UART_HELPER_H_ */