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

@ -11,8 +11,7 @@ DleParser::DleParser(SimpleRingBuffer& decodeRingBuf, DleEncoder& decoder, BufPa
: decodeRingBuf(decodeRingBuf),
decoder(decoder),
encodedBuf(encodedBuf),
decodedBuf(decodedBuf) {
}
decodedBuf(decodedBuf) {}
ReturnValue_t DleParser::passData(const uint8_t* data, size_t len) {
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) {
ctx.setType(DleParser::ContextType::NONE);
size_t availableData = decodeRingBuf.getAvailableReadData();
if(availableData == 0) {
if (availableData == 0) {
return NO_PACKET_FOUND;
}
if (availableData > encodedBuf.second) {
@ -106,7 +105,7 @@ void DleParser::defaultFoundPacketHandler(uint8_t* packet, size_t len, void* arg
}
void DleParser::defaultErrorHandler() {
if(ctx.getType() != DleParser::ContextType::ERROR) {
if (ctx.getType() != DleParser::ContextType::ERROR) {
errorPrinter("No error");
return;
}
@ -126,7 +125,8 @@ void DleParser::defaultErrorHandler() {
case (ErrorTypes::ENCODED_BUF_TOO_SMALL):
case (ErrorTypes::DECODING_BUF_TOO_SMALL): {
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) {
errorPrinter("Encoded buf too small", opt);
} else {
@ -168,10 +168,6 @@ ReturnValue_t DleParser::confirmBytesRead(size_t bytesRead) {
return decodeRingBuf.deleteData(bytesRead);
}
const DleParser::Context& DleParser::getContext() {
return ctx;
}
const DleParser::Context& DleParser::getContext() { return ctx; }
void DleParser::reset() {
decodeRingBuf.clear();
}
void DleParser::reset() { decodeRingBuf.clear(); }

View File

@ -246,6 +246,11 @@ ReturnValue_t CCSDSTime::convertFromASCII(Clock::TimeOfDay_t* to, const uint8_t*
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) {
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,
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);
private:

View File

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

View File

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

View File

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

View File

@ -1,15 +1,14 @@
#ifndef BSP_Q7S_COMIF_UARTCOMIF_H_
#define BSP_Q7S_COMIF_UARTCOMIF_H_
#include "UartCookie.h"
#include "helper.h"
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
#include <fsfw/objectmanager/SystemObject.h>
#include <unordered_map>
#include <vector>
#include "UartCookie.h"
#include "helper.h"
/**
* @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_
#define SAM9G20_COMIF_COOKIES_UART_COOKIE_H_
#include "helper.h"
#include <fsfw/devicehandlers/CookieIF.h>
#include <fsfw/objectmanager/SystemObjectIF.h>
#include <string>
#include "helper.h"
/**
* @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 "fsfw/serviceinterface.h"
#include <sys/ioctl.h>
#include "fsfw/serviceinterface.h"
void uart::setMode(struct termios& options, UartModes mode) {
if (mode == UartModes::NON_CANONICAL) {
/* Disable canonical mode */
@ -147,4 +148,3 @@ void uart::setBaudrate(struct termios& options, UartBaudRate baud) {
int uart::readCountersAndErrors(int serialPort, serial_icounter_struct& icounter) {
return ioctl(serialPort, TIOCGICOUNT, &icounter);
}

View File

@ -1,8 +1,8 @@
#ifndef FSFW_HAL_LINUX_UART_HELPER_H_
#define FSFW_HAL_LINUX_UART_HELPER_H_
#include <termios.h>
#include <linux/serial.h>
#include <termios.h>
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);
}
} // namespace uart
#endif /* FSFW_HAL_LINUX_UART_HELPER_H_ */