clang -Weverything -Wno-gnu-anonymous-struct
This commit is contained in:
parent
9589d702dd
commit
bc312243df
@ -472,8 +472,12 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
set(FSFW_WARNING_FLAGS -Weverything -Wno-gnu-anonymous-struct)
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
set(COMPILER_FLAGS "/permissive-")
|
||||
set(COMPILER_FLAGS "/permissive-" "/Wall")
|
||||
add_compile_definitions(NOMINMAX not=! and=&& or=||)
|
||||
endif()
|
||||
|
||||
|
@ -21,7 +21,7 @@ struct FileSize : public SerializeIF {
|
||||
this->largeFile = isLarge;
|
||||
return serialize(buffer, size, maxSize, streamEndianness);
|
||||
}
|
||||
|
||||
using SerializeIF::serialize;
|
||||
ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
||||
Endianness streamEndianness) const override {
|
||||
if (not largeFile) {
|
||||
|
@ -53,6 +53,7 @@ class VarLenField : public SerializeIF {
|
||||
#endif
|
||||
|
||||
private:
|
||||
using SerializeIF::deSerialize;
|
||||
ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
|
||||
Endianness streamEndianness) override;
|
||||
|
||||
|
@ -23,6 +23,7 @@ class EntityIdTlv : public TlvIF {
|
||||
*/
|
||||
ReturnValue_t deSerialize(cfdp::Tlv& tlv, Endianness endianness);
|
||||
|
||||
using SerializeIF::deSerialize;
|
||||
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||
Endianness streamEndianness) override;
|
||||
|
||||
|
@ -26,6 +26,7 @@ class FilestoreRequestTlv : public cfdp::FilestoreTlvBase {
|
||||
*/
|
||||
ReturnValue_t deSerialize(cfdp::Tlv &tlv, Endianness endianness);
|
||||
|
||||
using SerializeIF::deSerialize;
|
||||
ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
|
||||
Endianness streamEndianness) override;
|
||||
|
||||
|
@ -29,6 +29,7 @@ class FilestoreResponseTlv : public cfdp::FilestoreTlvBase {
|
||||
*/
|
||||
ReturnValue_t deSerialize(const cfdp::Tlv& tlv, Endianness endianness);
|
||||
|
||||
using SerializeIF::deSerialize;
|
||||
ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||
Endianness streamEndianness) override;
|
||||
|
||||
|
@ -364,6 +364,10 @@ class LocalDataPoolManager : public ProvidesDataPoolSubscriptionIF, public Acces
|
||||
void printWarningOrError(sif::OutputTypes outputType, const char* functionName,
|
||||
ReturnValue_t errorCode = returnvalue::FAILED,
|
||||
const char* errorPrint = nullptr);
|
||||
|
||||
private:
|
||||
using ProvidesDataPoolSubscriptionIF::subscribeForPeriodicPacket;
|
||||
using ProvidesDataPoolSubscriptionIF::subscribeForUpdatePacket;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
|
@ -206,9 +206,9 @@ class DeviceHandlerBase : public DeviceHandlerIF,
|
||||
|
||||
Mode_t getTransitionSourceMode() const;
|
||||
Submode_t getTransitionSourceSubMode() const;
|
||||
virtual void getMode(Mode_t *mode, Submode_t *submode);
|
||||
HealthState getHealth();
|
||||
ReturnValue_t setHealth(HealthState health);
|
||||
virtual void getMode(Mode_t *mode, Submode_t *submode) override;
|
||||
HealthState getHealth() override;
|
||||
ReturnValue_t setHealth(HealthState health) override;
|
||||
virtual ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId,
|
||||
ParameterWrapper *parameterWrapper,
|
||||
const ParameterWrapper *newValues,
|
||||
@ -1073,7 +1073,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
|
||||
bool forceDirectTm = false);
|
||||
|
||||
virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode,
|
||||
uint32_t *msToReachTheMode);
|
||||
uint32_t *msToReachTheMode) override;
|
||||
|
||||
virtual ReturnValue_t letChildHandleMessage(CommandMessage *message);
|
||||
|
||||
|
@ -28,22 +28,23 @@ class EventManager : public EventManagerIF, public ExecutableObjectIF, public Sy
|
||||
|
||||
void setMutexTimeout(MutexIF::TimeoutType timeoutType, uint32_t timeoutMs);
|
||||
|
||||
MessageQueueId_t getEventReportQueue();
|
||||
MessageQueueId_t getEventReportQueue() override;
|
||||
|
||||
ReturnValue_t registerListener(MessageQueueId_t listener, bool forwardAllButSelected = false);
|
||||
ReturnValue_t registerListener(MessageQueueId_t listener,
|
||||
bool forwardAllButSelected = false) override;
|
||||
ReturnValue_t unregisterListener(MessageQueueId_t listener) override;
|
||||
ReturnValue_t subscribeToEvent(MessageQueueId_t listener, EventId_t event);
|
||||
ReturnValue_t subscribeToAllEventsFrom(MessageQueueId_t listener, object_id_t object);
|
||||
ReturnValue_t subscribeToEvent(MessageQueueId_t listener, EventId_t event) override;
|
||||
ReturnValue_t subscribeToAllEventsFrom(MessageQueueId_t listener, object_id_t object) override;
|
||||
ReturnValue_t subscribeToEventRange(MessageQueueId_t listener, EventId_t idFrom = 0,
|
||||
EventId_t idTo = 0, bool idInverted = false,
|
||||
object_id_t reporterFrom = 0, object_id_t reporterTo = 0,
|
||||
bool reporterInverted = false);
|
||||
ReturnValue_t unsubscribeFromAllEvents(MessageQueueId_t listener, object_id_t object);
|
||||
bool reporterInverted = false) override;
|
||||
ReturnValue_t unsubscribeFromAllEvents(MessageQueueId_t listener, object_id_t object) override;
|
||||
ReturnValue_t unsubscribeFromEventRange(MessageQueueId_t listener, EventId_t idFrom = 0,
|
||||
EventId_t idTo = 0, bool idInverted = false,
|
||||
object_id_t reporterFrom = 0, object_id_t reporterTo = 0,
|
||||
bool reporterInverted = false);
|
||||
ReturnValue_t performOperation(uint8_t opCode);
|
||||
bool reporterInverted = false) override;
|
||||
ReturnValue_t performOperation(uint8_t opCode) override;
|
||||
|
||||
protected:
|
||||
MessageQueueIF* eventReportQueue = nullptr;
|
||||
|
@ -55,7 +55,7 @@ class HousekeepingSnapshot : public SerializeIF {
|
||||
: timeStamp(timeStamp), timeStampSize(timeStampSize), updateData(dataSetPtr){};
|
||||
|
||||
virtual ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
||||
Endianness streamEndianness) const {
|
||||
Endianness streamEndianness) const override {
|
||||
if (timeStamp != nullptr) {
|
||||
/* Endianness will always be MACHINE, so we can simply use memcpy
|
||||
here. */
|
||||
@ -70,7 +70,7 @@ class HousekeepingSnapshot : public SerializeIF {
|
||||
return updateData->serialize(buffer, size, maxSize, streamEndianness);
|
||||
}
|
||||
|
||||
virtual size_t getSerializedSize() const {
|
||||
virtual size_t getSerializedSize() const override {
|
||||
if (updateData == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ class AbsLimitMonitor : public MonitorBase<T> {
|
||||
violationEvent(violationEvent),
|
||||
aboveIsViolation(aboveIsViolation) {}
|
||||
virtual ~AbsLimitMonitor() {}
|
||||
virtual ReturnValue_t checkSample(T sample, T *crossedLimit) {
|
||||
ReturnValue_t checkSample(T sample, T *crossedLimit) override {
|
||||
*crossedLimit = limit;
|
||||
if (aboveIsViolation) {
|
||||
if ((std::abs(sample) > limit)) {
|
||||
@ -32,9 +32,9 @@ class AbsLimitMonitor : public MonitorBase<T> {
|
||||
return returnvalue::OK; // We're not out of range.
|
||||
}
|
||||
|
||||
virtual ReturnValue_t getParameter(uint8_t domainId, uint16_t parameterId,
|
||||
ParameterWrapper *parameterWrapper,
|
||||
const ParameterWrapper *newValues, uint16_t startAtIndex) {
|
||||
ReturnValue_t getParameter(uint8_t domainId, uint8_t parameterId,
|
||||
ParameterWrapper *parameterWrapper, const ParameterWrapper *newValues,
|
||||
uint16_t startAtIndex) override {
|
||||
ReturnValue_t result = this->MonitorBase<T>::getParameter(
|
||||
domainId, parameterId, parameterWrapper, newValues, startAtIndex);
|
||||
// We'll reuse the DOMAIN_ID of MonitorReporter,
|
||||
@ -61,7 +61,7 @@ class AbsLimitMonitor : public MonitorBase<T> {
|
||||
void setLimit(T value) { limit = value; }
|
||||
|
||||
protected:
|
||||
void sendTransitionEvent(T currentValue, ReturnValue_t state) {
|
||||
void sendTransitionEvent(T currentValue, ReturnValue_t state) override {
|
||||
switch (state) {
|
||||
case MonitoringIF::OUT_OF_RANGE:
|
||||
EventManagerIF::triggerEvent(this->reportingId, violationEvent, this->globalPoolId.objectId,
|
||||
|
@ -116,7 +116,7 @@ class TcpTmTcServer : public SystemObject, public TcpIpBase, public ExecutableOb
|
||||
|
||||
ReceptionModes receptionMode;
|
||||
TcpConfig tcpConfig;
|
||||
struct sockaddr tcpAddress = {};
|
||||
// struct sockaddr tcpAddress = {};
|
||||
socket_t listenerTcpSocket = 0;
|
||||
|
||||
MessageQueueId_t targetTcDestination = MessageQueueIF::NO_QUEUE;
|
||||
|
@ -45,6 +45,7 @@ class ParameterWrapper : public SerializeIF {
|
||||
|
||||
virtual size_t getSerializedSize() const override;
|
||||
|
||||
using SerializeIF::deSerialize;
|
||||
virtual ReturnValue_t deSerialize(const uint8_t **buffer, size_t *size,
|
||||
Endianness streamEndianness) override;
|
||||
|
||||
|
@ -62,13 +62,13 @@ class Fuse : public SystemObject,
|
||||
SerializeIF::Endianness streamEndianness) override;
|
||||
void setAllMonitorsToUnchecked();
|
||||
ReturnValue_t performOperation(uint8_t opCode);
|
||||
MessageQueueId_t getCommandQueue() const;
|
||||
MessageQueueId_t getCommandQueue() const override;
|
||||
void setDataPoolEntriesInvalid();
|
||||
ReturnValue_t setHealth(HealthState health);
|
||||
HasHealthIF::HealthState getHealth();
|
||||
ReturnValue_t setHealth(HealthState health) override;
|
||||
HasHealthIF::HealthState getHealth() override;
|
||||
|
||||
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ParameterWrapper *parameterWrapper,
|
||||
const ParameterWrapper *newValues, uint16_t startAtIndex);
|
||||
const ParameterWrapper *newValues, uint16_t startAtIndex) override;
|
||||
|
||||
private:
|
||||
uint8_t oldFuseState;
|
||||
|
@ -10,15 +10,15 @@ class PowerComponent : public PowerComponentIF {
|
||||
PowerComponent(object_id_t setId, uint8_t moduleId, float minPower, float maxPower,
|
||||
uint8_t switchId1, bool twoSwitches = false, uint8_t switchId2 = 0xFF);
|
||||
|
||||
virtual object_id_t getDeviceObjectId();
|
||||
object_id_t getDeviceObjectId() override;
|
||||
|
||||
virtual uint8_t getSwitchId1();
|
||||
virtual uint8_t getSwitchId2();
|
||||
uint8_t getSwitchId1() override;
|
||||
uint8_t getSwitchId2() override;
|
||||
|
||||
bool hasTwoSwitches();
|
||||
bool hasTwoSwitches() override;
|
||||
|
||||
float getMin();
|
||||
float getMax();
|
||||
float getMin() override;
|
||||
float getMax() override;
|
||||
|
||||
ReturnValue_t serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
||||
Endianness streamEndianness) const override;
|
||||
@ -29,7 +29,7 @@ class PowerComponent : public PowerComponentIF {
|
||||
Endianness streamEndianness) override;
|
||||
|
||||
ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, ParameterWrapper* parameterWrapper,
|
||||
const ParameterWrapper* newValues, uint16_t startAtIndex);
|
||||
const ParameterWrapper* newValues, uint16_t startAtIndex) override;
|
||||
|
||||
private:
|
||||
const object_id_t deviceObjectId = objects::NO_OBJECT;
|
||||
|
@ -13,7 +13,7 @@ Service1TelecommandVerification::Service1TelecommandVerification(object_id_t obj
|
||||
uint16_t messageQueueDepth,
|
||||
TimeWriterIF* timeStamper)
|
||||
: SystemObject(objectId),
|
||||
apid(apid),
|
||||
// apid(apid),
|
||||
serviceId(serviceId),
|
||||
targetDestination(targetDestination),
|
||||
storeHelper(apid),
|
||||
|
@ -72,7 +72,7 @@ class Service1TelecommandVerification : public AcceptsVerifyMessageIF,
|
||||
ReturnValue_t initialize() override;
|
||||
|
||||
private:
|
||||
uint16_t apid = 0;
|
||||
// uint16_t apid = 0;
|
||||
uint8_t serviceId = 0;
|
||||
|
||||
object_id_t targetDestination = objects::NO_OBJECT;
|
||||
|
@ -69,7 +69,7 @@ class FailureReport : public SerializeIF { //!< [EXPORT] : [SUBSERVICE] 2, 4, 6
|
||||
return result;
|
||||
}
|
||||
|
||||
virtual size_t getSerializedSize() const {
|
||||
virtual size_t getSerializedSize() const override {
|
||||
size_t size = 0;
|
||||
size += SerializeAdapter::getSerializedSize(&packetId);
|
||||
size += sizeof(packetSequenceControl);
|
||||
|
@ -109,7 +109,8 @@ ReturnValue_t LocalPool::deleteData(uint8_t* ptr, size_t size, store_address_t*
|
||||
ReturnValue_t result = ILLEGAL_ADDRESS;
|
||||
for (uint16_t n = 0; n < NUMBER_OF_SUBPOOLS; n++) {
|
||||
// Not sure if new allocates all stores in order. so better be careful.
|
||||
if ((store[n].data() <= ptr) and (&store[n][numberOfElements[n] * elementSizes[n] - 1] >= ptr)) {
|
||||
if ((store[n].data() <= ptr) and
|
||||
(&store[n][numberOfElements[n] * elementSizes[n] - 1] >= ptr)) {
|
||||
localId.poolIndex = n;
|
||||
uint32_t deltaAddress = ptr - store[n].data();
|
||||
// Getting any data from the right "block" is ok.
|
||||
|
@ -585,7 +585,12 @@ void Subsystem::sendSerializablesAsCommandMessage(Command_t command, SerializeIF
|
||||
return;
|
||||
}
|
||||
for (uint8_t i = 0; i < count; i++) {
|
||||
elements[i]->serialize(&storeBuffer, &size, maxSize, SerializeIF::Endianness::BIG);
|
||||
result = elements[i]->serialize(&storeBuffer, &size, maxSize, SerializeIF::Endianness::BIG);
|
||||
if (result != returnvalue::OK) {
|
||||
replyToCommand(result, 0);
|
||||
IPCStore->deleteData(address);
|
||||
return;
|
||||
}
|
||||
}
|
||||
CommandMessage reply;
|
||||
ModeSequenceMessage::setModeSequenceMessage(&reply, command, address);
|
||||
|
@ -9,7 +9,6 @@ class FixedTimeslotTaskBase : public FixedTimeslotTaskIF {
|
||||
public:
|
||||
explicit FixedTimeslotTaskBase(TaskPeriod period, TaskDeadlineMissedFunction dlmFunc = nullptr);
|
||||
~FixedTimeslotTaskBase() override = default;
|
||||
;
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
@ -196,7 +196,7 @@ void Heater::setSwitch(uint8_t number, ReturnValue_t state, uint32_t* uptimeOfSw
|
||||
if (powerSwitcher->getSwitchState(number) == state) {
|
||||
*uptimeOfSwitching = INVALID_UPTIME;
|
||||
} else {
|
||||
if ((*uptimeOfSwitching == INVALID_UPTIME)) {
|
||||
if (*uptimeOfSwitching == INVALID_UPTIME) {
|
||||
powerSwitcher->sendSwitchCommand(number, state);
|
||||
*uptimeOfSwitching = Clock::getUptime_ms();
|
||||
} else {
|
||||
|
@ -1,4 +1,9 @@
|
||||
target_sources(
|
||||
${LIB_FSFW_NAME}
|
||||
PRIVATE CCSDSTime.cpp Countdown.cpp Stopwatch.cpp TimeMessage.cpp
|
||||
CdsShortTimeStamper.cpp ClockCommon.cpp boost_timegm.cpp)
|
||||
PRIVATE CCSDSTime.cpp
|
||||
Countdown.cpp
|
||||
Stopwatch.cpp
|
||||
TimeMessage.cpp
|
||||
CdsShortTimeStamper.cpp
|
||||
ClockCommon.cpp
|
||||
boost_timegm.cpp)
|
||||
|
@ -2,7 +2,6 @@
|
||||
#include <ctime>
|
||||
|
||||
#include "boost_timegm.h"
|
||||
|
||||
#include "fsfw/ipc/MutexGuard.h"
|
||||
#include "fsfw/timemanager/Clock.h"
|
||||
|
||||
|
@ -1,17 +1,19 @@
|
||||
#ifndef FSFW_TIMEMANAGER_TIMEREADERIF_H
|
||||
#define FSFW_TIMEMANAGER_TIMEREADERIF_H
|
||||
|
||||
#include <ctime>
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
|
||||
#include "fsfw/platform.h"
|
||||
|
||||
#ifdef PLATFORM_WIN
|
||||
// wtf? Required for timeval!
|
||||
// Thanks, windows
|
||||
// clang-format off
|
||||
#include <winsock2.h>
|
||||
#include <winsock.h>
|
||||
// clang-format off
|
||||
#endif
|
||||
|
||||
#include "TimeStampIF.h"
|
||||
|
@ -17,12 +17,10 @@
|
||||
// on chrono i/o to Boost and some functions from libc++/locale to emulate the missing
|
||||
// time_get::get()
|
||||
|
||||
|
||||
#include "boost_timegm.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
int32_t is_leap(int32_t year) {
|
||||
if (year % 400 == 0) return 1;
|
||||
if (year % 100 == 0) return 0;
|
||||
@ -44,7 +42,6 @@ int32_t days_from_1jan(int32_t year, int32_t month, int32_t day) {
|
||||
return days[is_leap(year)][month - 1] + day - 1;
|
||||
}
|
||||
|
||||
|
||||
time_t internal_timegm(std::tm const *t) {
|
||||
int year = t->tm_year + 1900;
|
||||
int month = t->tm_mon;
|
||||
|
@ -1,5 +1,3 @@
|
||||
#include <ctime>
|
||||
|
||||
|
||||
|
||||
time_t internal_timegm(std::tm const *t);
|
@ -72,7 +72,7 @@ class MgmLIS3MDLHandler : public DeviceHandlerBase {
|
||||
|
||||
uint32_t transitionDelay;
|
||||
// Single SPI command has 2 bytes, first for adress, second for content
|
||||
size_t singleComandSize = 2;
|
||||
// size_t singleComandSize = 2;
|
||||
// Has the size for all adresses of the lis3mdl + the continous write bit
|
||||
uint8_t commandBuffer[MGMLIS3MDL::NR_OF_DATA_AND_CFG_REGISTERS + 1];
|
||||
|
||||
@ -87,7 +87,7 @@ class MgmLIS3MDLHandler : public DeviceHandlerBase {
|
||||
*/
|
||||
uint8_t registers[MGMLIS3MDL::NR_OF_CTRL_REGISTERS];
|
||||
|
||||
uint8_t statusRegister = 0;
|
||||
// uint8_t statusRegister = 0;
|
||||
bool goToNormalMode = false;
|
||||
|
||||
enum class InternalState {
|
||||
|
@ -329,8 +329,8 @@ ReturnValue_t MgmRM3100Handler::handleDataReadout(const uint8_t *packet) {
|
||||
|
||||
// Now scale to physical value in microtesla
|
||||
float fieldStrengthX = fieldStrengthRawX * scaleFactorX;
|
||||
float fieldStrengthY = fieldStrengthRawY * scaleFactorX;
|
||||
float fieldStrengthZ = fieldStrengthRawZ * scaleFactorX;
|
||||
float fieldStrengthY = fieldStrengthRawY * scaleFactorY;
|
||||
float fieldStrengthZ = fieldStrengthRawZ * scaleFactorZ;
|
||||
|
||||
if (periodicPrintout) {
|
||||
if (debugDivider.checkAndIncrement()) {
|
||||
|
@ -72,7 +72,7 @@ class MgmRM3100Handler : public DeviceHandlerBase {
|
||||
RM3100::Rm3100PrimaryDataset primaryDataset;
|
||||
|
||||
uint8_t commandBuffer[10];
|
||||
uint8_t commandBufferLen = 0;
|
||||
// uint8_t commandBufferLen = 0;
|
||||
|
||||
uint8_t cmmRegValue = RM3100::CMM_VALUE;
|
||||
uint8_t tmrcRegValue = RM3100::TMRC_DEFAULT_VALUE;
|
||||
|
@ -69,8 +69,7 @@ ReturnValue_t HostFilesystem::createFile(FilesystemParams params, const uint8_t
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t HostFilesystem::removeFile(const char *path_,
|
||||
FileSystemArgsIF *args) {
|
||||
ReturnValue_t HostFilesystem::removeFile(const char *path_, FileSystemArgsIF *args) {
|
||||
if (path_ == nullptr) {
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
|
@ -15,12 +15,10 @@ class HostFilesystem : public HasFileSystemIF {
|
||||
ReturnValue_t readFromFile(FileOpParams fileOpInfo, uint8_t **buffer, size_t &readSize,
|
||||
size_t maxSize) override;
|
||||
ReturnValue_t createFile(FilesystemParams params, const uint8_t *data, size_t size) override;
|
||||
ReturnValue_t removeFile(const char *path,
|
||||
FileSystemArgsIF *args) override;
|
||||
ReturnValue_t removeFile(const char *path, FileSystemArgsIF *args) override;
|
||||
ReturnValue_t createDirectory(FilesystemParams params, bool createParentDirs) override;
|
||||
ReturnValue_t removeDirectory(FilesystemParams params, bool deleteRecurively) override;
|
||||
ReturnValue_t rename(const char *oldPath, const char *newPath,
|
||||
FileSystemArgsIF *args) override;
|
||||
ReturnValue_t rename(const char *oldPath, const char *newPath, FileSystemArgsIF *args) override;
|
||||
|
||||
std::error_code errorCode;
|
||||
using HasFileSystemIF::createDirectory;
|
||||
|
@ -146,8 +146,9 @@ ReturnValue_t testserialize::test_autoserialization() {
|
||||
}
|
||||
|
||||
// These epsilon values were just guessed.. It appears to work though.
|
||||
if (abs(tv_float - tv::tv_float) > 0.0001 or abs(tv_double - tv::tv_double) > 0.01 or
|
||||
abs(tv_sfloat - tv::tv_sfloat) > 0.0001 or abs(tv_sdouble - tv::tv_sdouble) > 0.01) {
|
||||
if (std::abs(tv_float - tv::tv_float) > 0.0001 or std::abs(tv_double - tv::tv_double) > 0.01 or
|
||||
std::abs(tv_sfloat - tv::tv_sfloat) > 0.0001 or
|
||||
std::abs(tv_sdouble - tv::tv_sdouble) > 0.01) {
|
||||
return unitt::put_error(id);
|
||||
}
|
||||
|
||||
|
@ -69,8 +69,8 @@ TEST_CASE("File Data PDU", "[cfdp][pdu]") {
|
||||
// Bit 4: Segment metadata flag is set
|
||||
// Bit 5 to seven: length of transaction seq num is 2
|
||||
REQUIRE(fileDataBuffer[3] == 0b10101010);
|
||||
REQUIRE((fileDataBuffer[10] >> 6) &
|
||||
0b11 == cfdp::RecordContinuationState::CONTAINS_START_AND_END);
|
||||
REQUIRE(((fileDataBuffer[10] >> 6) & 0b11) ==
|
||||
cfdp::RecordContinuationState::CONTAINS_START_AND_END);
|
||||
// Segment metadata length
|
||||
REQUIRE((fileDataBuffer[10] & 0x3f) == 10);
|
||||
buffer = fileDataBuffer.data() + 11;
|
||||
|
@ -14,7 +14,7 @@ class DeviceHandlerCommander : public ExecutableObjectIF,
|
||||
DeviceHandlerCommander(object_id_t objectId);
|
||||
virtual ~DeviceHandlerCommander();
|
||||
|
||||
ReturnValue_t performOperation(uint8_t operationCode = 0);
|
||||
ReturnValue_t performOperation(uint8_t operationCode = 0) override;
|
||||
ReturnValue_t initialize() override;
|
||||
MessageQueueIF* getCommandQueuePtr() override;
|
||||
void stepSuccessfulReceived(ActionId_t actionId, uint8_t step) override;
|
||||
|
@ -19,7 +19,7 @@ using namespace std;
|
||||
* - To be safe, whenever there is a path object to be passed as C string into the FSFW API,
|
||||
* it needs to be converted to std::string and then .c_str() can be used to get a C string
|
||||
* Note: path.string().c_string() does not work as it is returning a pointer to a temporary
|
||||
*/
|
||||
*/
|
||||
|
||||
TEST_CASE("Host Filesystem", "[hal][host]") {
|
||||
namespace fs = filesystem;
|
||||
@ -226,8 +226,7 @@ TEST_CASE("Host Filesystem", "[hal][host]") {
|
||||
CHECK(fs::is_regular_file(fileInDir0));
|
||||
// See note at the top
|
||||
std::string dir0_string = dir0.string();
|
||||
REQUIRE(hostFs.removeDirectory(FilesystemParams(dir0_string.c_str()), true) ==
|
||||
returnvalue::OK);
|
||||
REQUIRE(hostFs.removeDirectory(FilesystemParams(dir0_string.c_str()), true) == returnvalue::OK);
|
||||
CHECK(not fs::is_directory(dir0));
|
||||
CHECK(not fs::is_regular_file(fileInDir0));
|
||||
}
|
||||
|
@ -6,8 +6,7 @@
|
||||
|
||||
ReturnValue_t FilesystemMock::feedFile(const std::string &filename, std::ifstream &file) {
|
||||
// not multibyte encoding safe!
|
||||
std::filesystem::path::string_type native_filename(filename.begin(),
|
||||
filename.end());
|
||||
std::filesystem::path::string_type native_filename(filename.begin(), filename.end());
|
||||
|
||||
if (not std::filesystem::exists(native_filename)) {
|
||||
return returnvalue::FAILED;
|
||||
@ -58,8 +57,7 @@ ReturnValue_t FilesystemMock::createFile(FilesystemParams params, const uint8_t
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t FilesystemMock::removeFile(const char *path,
|
||||
FileSystemArgsIF *args) {
|
||||
ReturnValue_t FilesystemMock::removeFile(const char *path, FileSystemArgsIF *args) {
|
||||
std::string filename_c(path);
|
||||
std::filesystem::path::string_type filename(filename_c.cbegin(), filename_c.cend());
|
||||
|
||||
@ -88,8 +86,7 @@ ReturnValue_t FilesystemMock::removeDirectory(FilesystemParams params, bool dele
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
ReturnValue_t FilesystemMock::rename(const char *oldPath,
|
||||
const char *newPath,
|
||||
ReturnValue_t FilesystemMock::rename(const char *oldPath, const char *newPath,
|
||||
FileSystemArgsIF *args) {
|
||||
renameQueue.push(RenameInfo(oldPath, newPath));
|
||||
return returnvalue::OK;
|
||||
|
@ -1,12 +1,12 @@
|
||||
#ifndef FSFW_MOCKS_FILESYSTEMMOCK_H
|
||||
#define FSFW_MOCKS_FILESYSTEMMOCK_H
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <map>
|
||||
#include <queue>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <filesystem>
|
||||
|
||||
#include "fsfw/filesystem.h"
|
||||
|
||||
@ -21,8 +21,8 @@
|
||||
class FilesystemMock : public HasFileSystemIF {
|
||||
public:
|
||||
struct FileWriteInfo {
|
||||
FileWriteInfo(std::filesystem::path::string_type filename, size_t offset,
|
||||
const uint8_t *data, size_t len)
|
||||
FileWriteInfo(std::filesystem::path::string_type filename, size_t offset, const uint8_t *data,
|
||||
size_t len)
|
||||
: offset(offset) {
|
||||
this->filename = filename;
|
||||
this->data.insert(this->data.end(), data, data + len);
|
||||
@ -49,14 +49,14 @@ class FilesystemMock : public HasFileSystemIF {
|
||||
std::map<std::filesystem::path::string_type, DirInfo> dirMap;
|
||||
|
||||
struct RenameInfo {
|
||||
RenameInfo(const char* oldName, const char *newName)
|
||||
RenameInfo(const char *oldName, const char *newName)
|
||||
: oldName(std::move(oldName)), newName(std::move(newName)) {}
|
||||
|
||||
const char *oldName;
|
||||
const char *newName;
|
||||
};
|
||||
std::queue<RenameInfo> renameQueue;
|
||||
const char* truncateCalledOnFile;
|
||||
const char *truncateCalledOnFile;
|
||||
ReturnValue_t feedFile(const std::string &filename, std::ifstream &file);
|
||||
|
||||
bool fileExists(FilesystemParams params) override;
|
||||
@ -66,13 +66,10 @@ class FilesystemMock : public HasFileSystemIF {
|
||||
ReturnValue_t readFromFile(FileOpParams params, uint8_t **buffer, size_t &readSize,
|
||||
size_t maxSize) override;
|
||||
ReturnValue_t createFile(FilesystemParams params, const uint8_t *data, size_t size) override;
|
||||
ReturnValue_t removeFile(const char *path,
|
||||
FileSystemArgsIF *args) override;
|
||||
ReturnValue_t removeFile(const char *path, FileSystemArgsIF *args) override;
|
||||
ReturnValue_t createDirectory(FilesystemParams params, bool createParentDirs) override;
|
||||
ReturnValue_t removeDirectory(FilesystemParams params, bool deleteRecurively) override;
|
||||
ReturnValue_t rename(const char *oldPath,
|
||||
const char *newPath,
|
||||
FileSystemArgsIF *args) override;
|
||||
ReturnValue_t rename(const char *oldPath, const char *newPath, FileSystemArgsIF *args) override;
|
||||
|
||||
void reset();
|
||||
|
||||
|
@ -13,7 +13,7 @@ ReturnValue_t pst::pollingSequenceInitDefault(FixedTimeslotTaskIF *thisSequence)
|
||||
|
||||
/* Add polling sequence table here */
|
||||
thisSequence->addSlot(objects::TEST_DEVICE, 0, DeviceHandlerIF::PERFORM_OPERATION);
|
||||
thisSequence->addSlot(objects::TEST_DEVICE, 0.3, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::TEST_DEVICE, 0.3 * length, DeviceHandlerIF::SEND_WRITE);
|
||||
thisSequence->addSlot(objects::TEST_DEVICE, 0.45 * length, DeviceHandlerIF::GET_WRITE);
|
||||
thisSequence->addSlot(objects::TEST_DEVICE, 0.6 * length, DeviceHandlerIF::SEND_READ);
|
||||
thisSequence->addSlot(objects::TEST_DEVICE, 0.8 * length, DeviceHandlerIF::GET_READ);
|
||||
|
Loading…
x
Reference in New Issue
Block a user