run auto-formatter
This commit is contained in:
parent
4fba2704aa
commit
ae2f7219fd
@ -188,7 +188,10 @@ and open the documentation conveniently. Try `helper.py -h for more information.
|
|||||||
|
|
||||||
The formatting is done by the `clang-format` tool. The configuration is contained within the
|
The formatting is done by the `clang-format` tool. The configuration is contained within the
|
||||||
`.clang-format` file in the repository root. As long as `clang-format` is installed, you
|
`.clang-format` file in the repository root. As long as `clang-format` is installed, you
|
||||||
can run the `apply-clang-format.sh` helper script to format all source files consistently.
|
can run the `auto-format.sh` helper script to format all source files consistently. Furthermore cmake-format is required to format CMake files which can be installed with:
|
||||||
|
````sh
|
||||||
|
sudo pip install cmakelang
|
||||||
|
````
|
||||||
|
|
||||||
## Index
|
## Index
|
||||||
|
|
||||||
|
@ -1396,8 +1396,7 @@ uint8_t DeviceHandlerBase::getReplyDelayCycles(DeviceCommandId_t deviceCommand)
|
|||||||
DeviceReplyMap::iterator iter = deviceReplyMap.find(deviceCommand);
|
DeviceReplyMap::iterator iter = deviceReplyMap.find(deviceCommand);
|
||||||
if (iter == deviceReplyMap.end()) {
|
if (iter == deviceReplyMap.end()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
} else if (iter->second.countdown != nullptr) {
|
||||||
else if (iter->second.countdown != nullptr) {
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return iter->second.delayCycles;
|
return iter->second.delayCycles;
|
||||||
|
@ -37,8 +37,7 @@ class EventManager : public EventManagerIF, public ExecutableObjectIF, public Sy
|
|||||||
EventId_t idTo = 0, bool idInverted = false,
|
EventId_t idTo = 0, bool idInverted = false,
|
||||||
object_id_t reporterFrom = 0, object_id_t reporterTo = 0,
|
object_id_t reporterFrom = 0, object_id_t reporterTo = 0,
|
||||||
bool reporterInverted = false);
|
bool reporterInverted = false);
|
||||||
ReturnValue_t unsubscribeFromAllEvents(MessageQueueId_t listener,
|
ReturnValue_t unsubscribeFromAllEvents(MessageQueueId_t listener, object_id_t object);
|
||||||
object_id_t object);
|
|
||||||
ReturnValue_t unsubscribeFromEventRange(MessageQueueId_t listener, EventId_t idFrom = 0,
|
ReturnValue_t unsubscribeFromEventRange(MessageQueueId_t listener, EventId_t idFrom = 0,
|
||||||
EventId_t idTo = 0, bool idInverted = false,
|
EventId_t idTo = 0, bool idInverted = false,
|
||||||
object_id_t reporterFrom = 0, object_id_t reporterTo = 0,
|
object_id_t reporterFrom = 0, object_id_t reporterTo = 0,
|
||||||
|
@ -20,8 +20,7 @@ class EventManagerIF {
|
|||||||
bool forwardAllButSelected = false) = 0;
|
bool forwardAllButSelected = false) = 0;
|
||||||
virtual ReturnValue_t subscribeToEvent(MessageQueueId_t listener, EventId_t event) = 0;
|
virtual ReturnValue_t subscribeToEvent(MessageQueueId_t listener, EventId_t event) = 0;
|
||||||
virtual ReturnValue_t subscribeToAllEventsFrom(MessageQueueId_t listener, object_id_t object) = 0;
|
virtual ReturnValue_t subscribeToAllEventsFrom(MessageQueueId_t listener, object_id_t object) = 0;
|
||||||
virtual ReturnValue_t unsubscribeFromAllEvents(MessageQueueId_t listener,
|
virtual ReturnValue_t unsubscribeFromAllEvents(MessageQueueId_t listener, object_id_t object) = 0;
|
||||||
object_id_t object) = 0;
|
|
||||||
virtual ReturnValue_t subscribeToEventRange(MessageQueueId_t listener, EventId_t idFrom = 0,
|
virtual ReturnValue_t subscribeToEventRange(MessageQueueId_t listener, EventId_t idFrom = 0,
|
||||||
EventId_t idTo = 0, bool idInverted = false,
|
EventId_t idTo = 0, bool idInverted = false,
|
||||||
object_id_t reporterFrom = 0,
|
object_id_t reporterFrom = 0,
|
||||||
|
@ -6,12 +6,7 @@
|
|||||||
|
|
||||||
class FaultCounter : public HasParametersIF {
|
class FaultCounter : public HasParametersIF {
|
||||||
public:
|
public:
|
||||||
|
enum class ParameterIds { FAILURE_THRESHOLD, FAULT_COUNT, TIMEOUT };
|
||||||
enum class ParameterIds {
|
|
||||||
FAILURE_THRESHOLD,
|
|
||||||
FAULT_COUNT,
|
|
||||||
TIMEOUT
|
|
||||||
};
|
|
||||||
|
|
||||||
FaultCounter();
|
FaultCounter();
|
||||||
FaultCounter(uint32_t failureThreshold, uint32_t decrementAfterMs,
|
FaultCounter(uint32_t failureThreshold, uint32_t decrementAfterMs,
|
||||||
@ -32,8 +27,8 @@ class FaultCounter : public HasParametersIF {
|
|||||||
|
|
||||||
virtual ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId,
|
virtual ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId,
|
||||||
ParameterWrapper *parameterWrapper,
|
ParameterWrapper *parameterWrapper,
|
||||||
const ParameterWrapper *newValues = nullptr, uint16_t startAtIndex =
|
const ParameterWrapper *newValues = nullptr,
|
||||||
0);
|
uint16_t startAtIndex = 0);
|
||||||
|
|
||||||
void setParameterDomain(uint8_t domain);
|
void setParameterDomain(uint8_t domain);
|
||||||
|
|
||||||
|
@ -5,9 +5,7 @@
|
|||||||
HealthHelper::HealthHelper(HasHealthIF* owner, object_id_t objectId)
|
HealthHelper::HealthHelper(HasHealthIF* owner, object_id_t objectId)
|
||||||
: objectId(objectId), owner(owner) {}
|
: objectId(objectId), owner(owner) {}
|
||||||
|
|
||||||
HealthHelper::~HealthHelper() {
|
HealthHelper::~HealthHelper() { healthTable->removeObject(objectId); }
|
||||||
healthTable->removeObject(objectId);
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t HealthHelper::handleHealthCommand(CommandMessage* message) {
|
ReturnValue_t HealthHelper::handleHealthCommand(CommandMessage* message) {
|
||||||
switch (message->getCommand()) {
|
switch (message->getCommand()) {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "ComIFMock.h"
|
#include "ComIFMock.h"
|
||||||
|
|
||||||
#include "DeviceHandlerMock.h"
|
#include "DeviceHandlerMock.h"
|
||||||
|
|
||||||
ComIFMock::ComIFMock(object_id_t objectId) : SystemObject(objectId) {}
|
ComIFMock::ComIFMock(object_id_t objectId) : SystemObject(objectId) {}
|
||||||
@ -42,6 +43,4 @@ ReturnValue_t ComIFMock::readReceivedMessage(CookieIF *cookie, uint8_t **buffer,
|
|||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ComIFMock::setTestCase(TestCase testCase_) {
|
void ComIFMock::setTestCase(TestCase testCase_) { testCase = testCase_; }
|
||||||
testCase = testCase_;
|
|
||||||
}
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#include "CookieIFMock.h"
|
#include "CookieIFMock.h"
|
||||||
|
|
||||||
CookieIFMock::CookieIFMock() {
|
CookieIFMock::CookieIFMock() {}
|
||||||
}
|
|
||||||
|
|
||||||
CookieIFMock::~CookieIFMock() {
|
CookieIFMock::~CookieIFMock() {}
|
||||||
}
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "DeviceHandlerCommander.h"
|
#include "DeviceHandlerCommander.h"
|
||||||
|
|
||||||
#include <fsfw/ipc/QueueFactory.h>
|
#include <fsfw/ipc/QueueFactory.h>
|
||||||
|
|
||||||
DeviceHandlerCommander::DeviceHandlerCommander(object_id_t objectId)
|
DeviceHandlerCommander::DeviceHandlerCommander(object_id_t objectId)
|
||||||
@ -60,6 +61,4 @@ ReturnValue_t DeviceHandlerCommander::sendCommand(object_id_t target, ActionId_t
|
|||||||
|
|
||||||
ReturnValue_t DeviceHandlerCommander::getReplyReturnCode() { return lastReplyReturnCode; }
|
ReturnValue_t DeviceHandlerCommander::getReplyReturnCode() { return lastReplyReturnCode; }
|
||||||
|
|
||||||
void DeviceHandlerCommander::resetReplyReturnCode() {
|
void DeviceHandlerCommander::resetReplyReturnCode() { lastReplyReturnCode = RETURN_FAILED; }
|
||||||
lastReplyReturnCode = RETURN_FAILED;
|
|
||||||
}
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#ifndef TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEHANDLERCOMMANDER_H_
|
#ifndef TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEHANDLERCOMMANDER_H_
|
||||||
#define TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEHANDLERCOMMANDER_H_
|
#define TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEHANDLERCOMMANDER_H_
|
||||||
|
|
||||||
#include "fsfw/objectmanager/SystemObject.h"
|
|
||||||
#include "fsfw/action/CommandActionHelper.h"
|
#include "fsfw/action/CommandActionHelper.h"
|
||||||
#include "fsfw/action/CommandsActionsIF.h"
|
#include "fsfw/action/CommandsActionsIF.h"
|
||||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
#include "fsfw/objectmanager/SystemObject.h"
|
||||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||||
|
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||||
|
|
||||||
class DeviceHandlerCommander : public ExecutableObjectIF,
|
class DeviceHandlerCommander : public ExecutableObjectIF,
|
||||||
public SystemObject,
|
public SystemObject,
|
||||||
@ -36,7 +36,6 @@ class DeviceHandlerCommander : public ExecutableObjectIF,
|
|||||||
void resetReplyReturnCode();
|
void resetReplyReturnCode();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static const uint32_t QUEUE_SIZE = 20;
|
static const uint32_t QUEUE_SIZE = 20;
|
||||||
|
|
||||||
MessageQueueIF* commandQueue = nullptr;
|
MessageQueueIF* commandQueue = nullptr;
|
||||||
|
@ -90,10 +90,6 @@ void DeviceHandlerMock::changeSimpleCommandReplyCountdown(uint32_t timeout) {
|
|||||||
simpleCommandReplyTimeout.setTimeout(timeout);
|
simpleCommandReplyTimeout.setTimeout(timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceHandlerMock::resetPeriodicReplyState() {
|
void DeviceHandlerMock::resetPeriodicReplyState() { periodicReplyReceived = false; }
|
||||||
periodicReplyReceived = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DeviceHandlerMock::getPeriodicReplyReceived() {
|
bool DeviceHandlerMock::getPeriodicReplyReceived() { return periodicReplyReceived; }
|
||||||
return periodicReplyReceived;
|
|
||||||
}
|
|
||||||
|
@ -5,15 +5,14 @@
|
|||||||
|
|
||||||
class DeviceHandlerMock : public DeviceHandlerBase {
|
class DeviceHandlerMock : public DeviceHandlerBase {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static const DeviceCommandId_t SIMPLE_COMMAND = 1;
|
static const DeviceCommandId_t SIMPLE_COMMAND = 1;
|
||||||
static const DeviceCommandId_t PERIODIC_REPLY = 2;
|
static const DeviceCommandId_t PERIODIC_REPLY = 2;
|
||||||
|
|
||||||
static const uint8_t SIMPLE_COMMAND_DATA = 1;
|
static const uint8_t SIMPLE_COMMAND_DATA = 1;
|
||||||
static const uint8_t PERIODIC_REPLY_DATA = 2;
|
static const uint8_t PERIODIC_REPLY_DATA = 2;
|
||||||
|
|
||||||
DeviceHandlerMock(object_id_t objectId, object_id_t deviceCommunication,
|
DeviceHandlerMock(object_id_t objectId, object_id_t deviceCommunication, CookieIF *comCookie,
|
||||||
CookieIF *comCookie, FailureIsolationBase* fdirInstance);
|
FailureIsolationBase *fdirInstance);
|
||||||
virtual ~DeviceHandlerMock();
|
virtual ~DeviceHandlerMock();
|
||||||
void changePeriodicReplyCountdown(uint32_t timeout);
|
void changePeriodicReplyCountdown(uint32_t timeout);
|
||||||
void changeSimpleCommandReplyCountdown(uint32_t timeout);
|
void changeSimpleCommandReplyCountdown(uint32_t timeout);
|
||||||
@ -25,17 +24,15 @@ protected:
|
|||||||
void doShutDown() override;
|
void doShutDown() override;
|
||||||
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override;
|
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override;
|
||||||
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override;
|
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override;
|
||||||
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData,
|
||||||
const uint8_t *commandData, size_t commandDataLen) override;
|
size_t commandDataLen) override;
|
||||||
ReturnValue_t scanForReply(const uint8_t *start, size_t len,
|
ReturnValue_t scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
|
||||||
DeviceCommandId_t *foundId, size_t *foundLen) override;
|
size_t *foundLen) override;
|
||||||
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id,
|
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override;
|
||||||
const uint8_t *packet) override;
|
|
||||||
void fillCommandAndReplyMap() override;
|
void fillCommandAndReplyMap() override;
|
||||||
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Countdown simpleCommandReplyTimeout = Countdown(50);
|
Countdown simpleCommandReplyTimeout = Countdown(50);
|
||||||
Countdown periodicReplyCountdown = Countdown(10);
|
Countdown periodicReplyCountdown = Countdown(10);
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#include "fsfw_tests/unit/testcfg/objects/systemObjectList.h"
|
#include "fsfw_tests/unit/testcfg/objects/systemObjectList.h"
|
||||||
|
|
||||||
TEST_CASE("Device Handler Base", "[DeviceHandlerBase]") {
|
TEST_CASE("Device Handler Base", "[DeviceHandlerBase]") {
|
||||||
|
|
||||||
// Will be deleted with DHB destructor
|
// Will be deleted with DHB destructor
|
||||||
CookieIFMock* cookieIFMock = new CookieIFMock;
|
CookieIFMock* cookieIFMock = new CookieIFMock;
|
||||||
ComIFMock comIF(objects::COM_IF_MOCK);
|
ComIFMock comIF(objects::COM_IF_MOCK);
|
||||||
|
Loading…
Reference in New Issue
Block a user