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
|
||||
`.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
|
||||
|
||||
|
@ -66,7 +66,7 @@ void DeviceHandlerBase::setThermalStateRequestPoolIds(lp_id_t thermalStatePoolId
|
||||
|
||||
DeviceHandlerBase::~DeviceHandlerBase() {
|
||||
if (comCookie != nullptr) {
|
||||
delete comCookie;
|
||||
delete comCookie;
|
||||
}
|
||||
if (defaultFDIRUsed) {
|
||||
delete fdirInstance;
|
||||
@ -256,7 +256,7 @@ void DeviceHandlerBase::decrementDeviceReplyMap() {
|
||||
missedReply(replyPair.first);
|
||||
timedOut = false;
|
||||
if (not replyPair.second.periodic) {
|
||||
replyPair.second.active = false;
|
||||
replyPair.second.active = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1396,8 +1396,7 @@ uint8_t DeviceHandlerBase::getReplyDelayCycles(DeviceCommandId_t deviceCommand)
|
||||
DeviceReplyMap::iterator iter = deviceReplyMap.find(deviceCommand);
|
||||
if (iter == deviceReplyMap.end()) {
|
||||
return 0;
|
||||
}
|
||||
else if (iter->second.countdown != nullptr) {
|
||||
} else if (iter->second.countdown != nullptr) {
|
||||
return 0;
|
||||
}
|
||||
return iter->second.delayCycles;
|
||||
|
@ -792,7 +792,7 @@ class DeviceHandlerBase : public DeviceHandlerIF,
|
||||
DeviceCommandMap::iterator command;
|
||||
//! Instead of using delayCycles to specify the maximum time to wait for the device reply, it
|
||||
//! is also possible specify a countdown
|
||||
Countdown* countdown = nullptr;
|
||||
Countdown *countdown = nullptr;
|
||||
//! will be set to true when reply is enabled
|
||||
bool active = false;
|
||||
};
|
||||
@ -1259,13 +1259,13 @@ class DeviceHandlerBase : public DeviceHandlerIF,
|
||||
/**
|
||||
* @brief Handles disabling of replies which use a timeout to detect missed replies.
|
||||
*/
|
||||
void disableTimeoutControlledReply(DeviceReplyInfo* info);
|
||||
void disableTimeoutControlledReply(DeviceReplyInfo *info);
|
||||
|
||||
/**
|
||||
* @brief Handles disabling of replies which use a number of maximum delay cycles to detect
|
||||
* missed replies.
|
||||
*/
|
||||
void disableDelayCyclesControlledReply(DeviceReplyInfo* info);
|
||||
void disableDelayCyclesControlledReply(DeviceReplyInfo *info);
|
||||
|
||||
/**
|
||||
* Retrive data from the #IPCStore.
|
||||
|
@ -37,8 +37,7 @@ class EventManager : public EventManagerIF, public ExecutableObjectIF, public Sy
|
||||
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);
|
||||
ReturnValue_t unsubscribeFromAllEvents(MessageQueueId_t listener, object_id_t object);
|
||||
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,
|
||||
|
@ -20,8 +20,7 @@ class EventManagerIF {
|
||||
bool forwardAllButSelected = false) = 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 unsubscribeFromAllEvents(MessageQueueId_t listener,
|
||||
object_id_t object) = 0;
|
||||
virtual ReturnValue_t unsubscribeFromAllEvents(MessageQueueId_t listener, object_id_t object) = 0;
|
||||
virtual ReturnValue_t subscribeToEventRange(MessageQueueId_t listener, EventId_t idFrom = 0,
|
||||
EventId_t idTo = 0, bool idInverted = false,
|
||||
object_id_t reporterFrom = 0,
|
||||
|
@ -15,16 +15,16 @@ FailureIsolationBase::FailureIsolationBase(object_id_t owner, object_id_t parent
|
||||
|
||||
FailureIsolationBase::~FailureIsolationBase() {
|
||||
EventManagerIF* manager = ObjectManager::instance()->get<EventManagerIF>(objects::EVENT_MANAGER);
|
||||
if (manager == nullptr) {
|
||||
if (manager == nullptr) {
|
||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||
sif::error << "FailureIsolationBase::~FailureIsolationBase: Event Manager has not"
|
||||
" been initialized!"
|
||||
<< std::endl;
|
||||
sif::error << "FailureIsolationBase::~FailureIsolationBase: Event Manager has not"
|
||||
" been initialized!"
|
||||
<< std::endl;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
manager->unsubscribeFromAllEvents(eventQueue->getId(), ownerId);
|
||||
QueueFactory::instance()->deleteMessageQueue(eventQueue);
|
||||
QueueFactory::instance()->deleteMessageQueue(eventQueue);
|
||||
}
|
||||
|
||||
ReturnValue_t FailureIsolationBase::initialize() {
|
||||
|
@ -6,12 +6,7 @@
|
||||
|
||||
class FaultCounter : public HasParametersIF {
|
||||
public:
|
||||
|
||||
enum class ParameterIds {
|
||||
FAILURE_THRESHOLD,
|
||||
FAULT_COUNT,
|
||||
TIMEOUT
|
||||
};
|
||||
enum class ParameterIds { FAILURE_THRESHOLD, FAULT_COUNT, TIMEOUT };
|
||||
|
||||
FaultCounter();
|
||||
FaultCounter(uint32_t failureThreshold, uint32_t decrementAfterMs,
|
||||
@ -30,10 +25,10 @@ class FaultCounter : public HasParametersIF {
|
||||
void setFailureThreshold(uint32_t failureThreshold);
|
||||
void setFaultDecrementTimeMs(uint32_t timeMs);
|
||||
|
||||
virtual ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId,
|
||||
ParameterWrapper *parameterWrapper,
|
||||
const ParameterWrapper *newValues = nullptr, uint16_t startAtIndex =
|
||||
0);
|
||||
virtual ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId,
|
||||
ParameterWrapper *parameterWrapper,
|
||||
const ParameterWrapper *newValues = nullptr,
|
||||
uint16_t startAtIndex = 0);
|
||||
|
||||
void setParameterDomain(uint8_t domain);
|
||||
|
||||
|
@ -5,9 +5,7 @@
|
||||
HealthHelper::HealthHelper(HasHealthIF* owner, object_id_t objectId)
|
||||
: objectId(objectId), owner(owner) {}
|
||||
|
||||
HealthHelper::~HealthHelper() {
|
||||
healthTable->removeObject(objectId);
|
||||
}
|
||||
HealthHelper::~HealthHelper() { healthTable->removeObject(objectId); }
|
||||
|
||||
ReturnValue_t HealthHelper::handleHealthCommand(CommandMessage* message) {
|
||||
switch (message->getCommand()) {
|
||||
|
@ -28,10 +28,10 @@ ReturnValue_t HealthTable::registerObject(object_id_t object,
|
||||
}
|
||||
|
||||
ReturnValue_t HealthTable::removeObject(object_id_t object) {
|
||||
mapIterator = healthMap.find(object);
|
||||
if (mapIterator == healthMap.end()) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
mapIterator = healthMap.find(object);
|
||||
if (mapIterator == healthMap.end()) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
healthMap.erase(mapIterator);
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
#include "ComIFMock.h"
|
||||
|
||||
#include "DeviceHandlerMock.h"
|
||||
|
||||
ComIFMock::ComIFMock(object_id_t objectId) : SystemObject(objectId){}
|
||||
ComIFMock::ComIFMock(object_id_t objectId) : SystemObject(objectId) {}
|
||||
|
||||
ComIFMock::~ComIFMock() {}
|
||||
|
||||
@ -19,29 +20,27 @@ ReturnValue_t ComIFMock::requestReceiveMessage(CookieIF *cookie, size_t requestL
|
||||
}
|
||||
|
||||
ReturnValue_t ComIFMock::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) {
|
||||
switch(testCase) {
|
||||
case TestCase::MISSED_REPLY: {
|
||||
*size = 0;
|
||||
return RETURN_OK;
|
||||
}
|
||||
case TestCase::SIMPLE_COMMAND_NOMINAL: {
|
||||
*size = 1;
|
||||
data = DeviceHandlerMock::SIMPLE_COMMAND_DATA;
|
||||
*buffer = &data;
|
||||
break;
|
||||
}
|
||||
case TestCase::PERIODIC_REPLY_NOMINAL: {
|
||||
*size = 1;
|
||||
data = DeviceHandlerMock::PERIODIC_REPLY_DATA;
|
||||
*buffer = &data;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (testCase) {
|
||||
case TestCase::MISSED_REPLY: {
|
||||
*size = 0;
|
||||
return RETURN_OK;
|
||||
}
|
||||
case TestCase::SIMPLE_COMMAND_NOMINAL: {
|
||||
*size = 1;
|
||||
data = DeviceHandlerMock::SIMPLE_COMMAND_DATA;
|
||||
*buffer = &data;
|
||||
break;
|
||||
}
|
||||
case TestCase::PERIODIC_REPLY_NOMINAL: {
|
||||
*size = 1;
|
||||
data = DeviceHandlerMock::PERIODIC_REPLY_DATA;
|
||||
*buffer = &data;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return RETURN_OK;
|
||||
}
|
||||
|
||||
void ComIFMock::setTestCase(TestCase testCase_) {
|
||||
testCase = testCase_;
|
||||
}
|
||||
void ComIFMock::setTestCase(TestCase testCase_) { testCase = testCase_; }
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "CookieIFMock.h"
|
||||
|
||||
CookieIFMock::CookieIFMock() {
|
||||
}
|
||||
CookieIFMock::CookieIFMock() {}
|
||||
|
||||
CookieIFMock::~CookieIFMock() {
|
||||
}
|
||||
CookieIFMock::~CookieIFMock() {}
|
||||
|
@ -1,4 +1,5 @@
|
||||
#include "DeviceHandlerCommander.h"
|
||||
|
||||
#include <fsfw/ipc/QueueFactory.h>
|
||||
|
||||
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; }
|
||||
|
||||
void DeviceHandlerCommander::resetReplyReturnCode() {
|
||||
lastReplyReturnCode = RETURN_FAILED;
|
||||
}
|
||||
void DeviceHandlerCommander::resetReplyReturnCode() { lastReplyReturnCode = RETURN_FAILED; }
|
||||
|
@ -1,16 +1,16 @@
|
||||
#ifndef 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/CommandsActionsIF.h"
|
||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||
#include "fsfw/objectmanager/SystemObject.h"
|
||||
#include "fsfw/returnvalues/HasReturnvaluesIF.h"
|
||||
#include "fsfw/tasks/ExecutableObjectIF.h"
|
||||
|
||||
class DeviceHandlerCommander : public ExecutableObjectIF,
|
||||
public SystemObject,
|
||||
public CommandsActionsIF,
|
||||
public HasReturnvaluesIF {
|
||||
public HasReturnvaluesIF {
|
||||
public:
|
||||
DeviceHandlerCommander(object_id_t objectId);
|
||||
virtual ~DeviceHandlerCommander();
|
||||
@ -36,7 +36,6 @@ class DeviceHandlerCommander : public ExecutableObjectIF,
|
||||
void resetReplyReturnCode();
|
||||
|
||||
private:
|
||||
|
||||
static const uint32_t QUEUE_SIZE = 20;
|
||||
|
||||
MessageQueueIF* commandQueue = nullptr;
|
||||
|
@ -42,13 +42,13 @@ ReturnValue_t DeviceHandlerMock::buildCommandFromCommand(DeviceCommandId_t devic
|
||||
ReturnValue_t DeviceHandlerMock::scanForReply(const uint8_t *start, size_t len,
|
||||
DeviceCommandId_t *foundId, size_t *foundLen) {
|
||||
switch (*start) {
|
||||
case SIMPLE_COMMAND_DATA: {
|
||||
*foundId = SIMPLE_COMMAND;
|
||||
*foundLen = sizeof(SIMPLE_COMMAND_DATA);
|
||||
return RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case PERIODIC_REPLY_DATA: {
|
||||
case SIMPLE_COMMAND_DATA: {
|
||||
*foundId = SIMPLE_COMMAND;
|
||||
*foundLen = sizeof(SIMPLE_COMMAND_DATA);
|
||||
return RETURN_OK;
|
||||
break;
|
||||
}
|
||||
case PERIODIC_REPLY_DATA: {
|
||||
*foundId = PERIODIC_REPLY;
|
||||
*foundLen = sizeof(PERIODIC_REPLY_DATA);
|
||||
return RETURN_OK;
|
||||
@ -64,7 +64,7 @@ ReturnValue_t DeviceHandlerMock::interpretDeviceReply(DeviceCommandId_t id, cons
|
||||
switch (id) {
|
||||
case SIMPLE_COMMAND:
|
||||
case PERIODIC_REPLY: {
|
||||
periodicReplyReceived = true;
|
||||
periodicReplyReceived = true;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -74,9 +74,9 @@ ReturnValue_t DeviceHandlerMock::interpretDeviceReply(DeviceCommandId_t id, cons
|
||||
}
|
||||
|
||||
void DeviceHandlerMock::fillCommandAndReplyMap() {
|
||||
insertInCommandAndReplyMap(SIMPLE_COMMAND, 0, nullptr, 0, false, false, 0,
|
||||
&simpleCommandReplyTimeout);
|
||||
insertInCommandAndReplyMap(PERIODIC_REPLY, 0, nullptr, 0, true, false, 0,
|
||||
insertInCommandAndReplyMap(SIMPLE_COMMAND, 0, nullptr, 0, false, false, 0,
|
||||
&simpleCommandReplyTimeout);
|
||||
insertInCommandAndReplyMap(PERIODIC_REPLY, 0, nullptr, 0, true, false, 0,
|
||||
&periodicReplyCountdown);
|
||||
}
|
||||
|
||||
@ -90,10 +90,6 @@ void DeviceHandlerMock::changeSimpleCommandReplyCountdown(uint32_t timeout) {
|
||||
simpleCommandReplyTimeout.setTimeout(timeout);
|
||||
}
|
||||
|
||||
void DeviceHandlerMock::resetPeriodicReplyState() {
|
||||
periodicReplyReceived = false;
|
||||
}
|
||||
void DeviceHandlerMock::resetPeriodicReplyState() { periodicReplyReceived = false; }
|
||||
|
||||
bool DeviceHandlerMock::getPeriodicReplyReceived() {
|
||||
return periodicReplyReceived;
|
||||
}
|
||||
bool DeviceHandlerMock::getPeriodicReplyReceived() { return periodicReplyReceived; }
|
||||
|
@ -3,45 +3,42 @@
|
||||
|
||||
#include <fsfw/devicehandlers/DeviceHandlerBase.h>
|
||||
|
||||
class DeviceHandlerMock: public DeviceHandlerBase {
|
||||
public:
|
||||
class DeviceHandlerMock : public DeviceHandlerBase {
|
||||
public:
|
||||
static const DeviceCommandId_t SIMPLE_COMMAND = 1;
|
||||
static const DeviceCommandId_t PERIODIC_REPLY = 2;
|
||||
|
||||
static const DeviceCommandId_t SIMPLE_COMMAND = 1;
|
||||
static const DeviceCommandId_t PERIODIC_REPLY = 2;
|
||||
static const uint8_t SIMPLE_COMMAND_DATA = 1;
|
||||
static const uint8_t PERIODIC_REPLY_DATA = 2;
|
||||
|
||||
static const uint8_t SIMPLE_COMMAND_DATA = 1;
|
||||
static const uint8_t PERIODIC_REPLY_DATA = 2;
|
||||
DeviceHandlerMock(object_id_t objectId, object_id_t deviceCommunication, CookieIF *comCookie,
|
||||
FailureIsolationBase *fdirInstance);
|
||||
virtual ~DeviceHandlerMock();
|
||||
void changePeriodicReplyCountdown(uint32_t timeout);
|
||||
void changeSimpleCommandReplyCountdown(uint32_t timeout);
|
||||
void resetPeriodicReplyState();
|
||||
bool getPeriodicReplyReceived();
|
||||
|
||||
DeviceHandlerMock(object_id_t objectId, object_id_t deviceCommunication,
|
||||
CookieIF *comCookie, FailureIsolationBase* fdirInstance);
|
||||
virtual ~DeviceHandlerMock();
|
||||
void changePeriodicReplyCountdown(uint32_t timeout);
|
||||
void changeSimpleCommandReplyCountdown(uint32_t timeout);
|
||||
void resetPeriodicReplyState();
|
||||
bool getPeriodicReplyReceived();
|
||||
protected:
|
||||
void doStartUp() override;
|
||||
void doShutDown() override;
|
||||
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override;
|
||||
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override;
|
||||
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData,
|
||||
size_t commandDataLen) override;
|
||||
ReturnValue_t scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId,
|
||||
size_t *foundLen) override;
|
||||
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override;
|
||||
void fillCommandAndReplyMap() override;
|
||||
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||
|
||||
protected:
|
||||
void doStartUp() override;
|
||||
void doShutDown() override;
|
||||
ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override;
|
||||
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override;
|
||||
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||
const uint8_t *commandData, size_t commandDataLen) override;
|
||||
ReturnValue_t scanForReply(const uint8_t *start, size_t len,
|
||||
DeviceCommandId_t *foundId, size_t *foundLen) override;
|
||||
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id,
|
||||
const uint8_t *packet) override;
|
||||
void fillCommandAndReplyMap() override;
|
||||
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||
private:
|
||||
Countdown simpleCommandReplyTimeout = Countdown(50);
|
||||
Countdown periodicReplyCountdown = Countdown(10);
|
||||
|
||||
private:
|
||||
uint8_t commandBuffer[1];
|
||||
|
||||
Countdown simpleCommandReplyTimeout = Countdown(50);
|
||||
Countdown periodicReplyCountdown = Countdown(10);
|
||||
|
||||
uint8_t commandBuffer[1];
|
||||
|
||||
bool periodicReplyReceived = false;
|
||||
bool periodicReplyReceived = false;
|
||||
};
|
||||
|
||||
#endif /* TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_DEVICEHANDLERMOCK_H_ */
|
||||
|
@ -8,21 +8,20 @@
|
||||
#include "fsfw_tests/unit/testcfg/objects/systemObjectList.h"
|
||||
|
||||
TEST_CASE("Device Handler Base", "[DeviceHandlerBase]") {
|
||||
|
||||
// Will be deleted with DHB destructor
|
||||
CookieIFMock* cookieIFMock = new CookieIFMock;
|
||||
ComIFMock comIF(objects::COM_IF_MOCK);
|
||||
DeviceFdirMock deviceFdirMock(objects::DEVICE_HANDLER_MOCK, objects::NO_OBJECT);
|
||||
DeviceHandlerMock deviceHandlerMock(objects::DEVICE_HANDLER_MOCK, objects::COM_IF_MOCK,
|
||||
cookieIFMock, &deviceFdirMock);
|
||||
ReturnValue_t result = deviceHandlerMock.initialize();
|
||||
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
|
||||
DeviceHandlerCommander deviceHandlerCommander(objects::DEVICE_HANDLER_COMMANDER);
|
||||
result = deviceHandlerCommander.initialize();
|
||||
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
|
||||
// Will be deleted with DHB destructor
|
||||
CookieIFMock* cookieIFMock = new CookieIFMock;
|
||||
ComIFMock comIF(objects::COM_IF_MOCK);
|
||||
DeviceFdirMock deviceFdirMock(objects::DEVICE_HANDLER_MOCK, objects::NO_OBJECT);
|
||||
DeviceHandlerMock deviceHandlerMock(objects::DEVICE_HANDLER_MOCK, objects::COM_IF_MOCK,
|
||||
cookieIFMock, &deviceFdirMock);
|
||||
ReturnValue_t result = deviceHandlerMock.initialize();
|
||||
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
|
||||
DeviceHandlerCommander deviceHandlerCommander(objects::DEVICE_HANDLER_COMMANDER);
|
||||
result = deviceHandlerCommander.initialize();
|
||||
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
|
||||
|
||||
SECTION("Commanding nominal") {
|
||||
comIF.setTestCase(ComIFMock::TestCase::SIMPLE_COMMAND_NOMINAL);
|
||||
comIF.setTestCase(ComIFMock::TestCase::SIMPLE_COMMAND_NOMINAL);
|
||||
result = deviceHandlerCommander.sendCommand(objects::DEVICE_HANDLER_MOCK,
|
||||
DeviceHandlerMock::SIMPLE_COMMAND);
|
||||
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
|
||||
@ -37,28 +36,28 @@ TEST_CASE("Device Handler Base", "[DeviceHandlerBase]") {
|
||||
}
|
||||
|
||||
SECTION("Commanding missed reply") {
|
||||
comIF.setTestCase(ComIFMock::TestCase::MISSED_REPLY);
|
||||
deviceHandlerCommander.resetReplyReturnCode();
|
||||
// Set the timeout to 0 to immediately timeout the reply
|
||||
deviceHandlerMock.changeSimpleCommandReplyCountdown(0);
|
||||
result = deviceHandlerCommander.sendCommand(objects::DEVICE_HANDLER_MOCK,
|
||||
DeviceHandlerMock::SIMPLE_COMMAND);
|
||||
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
|
||||
deviceHandlerMock.performOperation(DeviceHandlerIF::PERFORM_OPERATION);
|
||||
deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_WRITE);
|
||||
deviceHandlerMock.performOperation(DeviceHandlerIF::GET_WRITE);
|
||||
deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_READ);
|
||||
deviceHandlerMock.performOperation(DeviceHandlerIF::GET_READ);
|
||||
deviceHandlerMock.performOperation(DeviceHandlerIF::PERFORM_OPERATION);
|
||||
deviceHandlerCommander.performOperation();
|
||||
result = deviceHandlerCommander.getReplyReturnCode();
|
||||
REQUIRE(result == DeviceHandlerIF::TIMEOUT);
|
||||
uint32_t missedReplies = deviceFdirMock.getMissedReplyCount();
|
||||
REQUIRE(missedReplies == 1);
|
||||
}
|
||||
comIF.setTestCase(ComIFMock::TestCase::MISSED_REPLY);
|
||||
deviceHandlerCommander.resetReplyReturnCode();
|
||||
// Set the timeout to 0 to immediately timeout the reply
|
||||
deviceHandlerMock.changeSimpleCommandReplyCountdown(0);
|
||||
result = deviceHandlerCommander.sendCommand(objects::DEVICE_HANDLER_MOCK,
|
||||
DeviceHandlerMock::SIMPLE_COMMAND);
|
||||
REQUIRE(result == HasReturnvaluesIF::RETURN_OK);
|
||||
deviceHandlerMock.performOperation(DeviceHandlerIF::PERFORM_OPERATION);
|
||||
deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_WRITE);
|
||||
deviceHandlerMock.performOperation(DeviceHandlerIF::GET_WRITE);
|
||||
deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_READ);
|
||||
deviceHandlerMock.performOperation(DeviceHandlerIF::GET_READ);
|
||||
deviceHandlerMock.performOperation(DeviceHandlerIF::PERFORM_OPERATION);
|
||||
deviceHandlerCommander.performOperation();
|
||||
result = deviceHandlerCommander.getReplyReturnCode();
|
||||
REQUIRE(result == DeviceHandlerIF::TIMEOUT);
|
||||
uint32_t missedReplies = deviceFdirMock.getMissedReplyCount();
|
||||
REQUIRE(missedReplies == 1);
|
||||
}
|
||||
|
||||
SECTION("Periodic reply nominal") {
|
||||
comIF.setTestCase(ComIFMock::TestCase::PERIODIC_REPLY_NOMINAL);
|
||||
comIF.setTestCase(ComIFMock::TestCase::PERIODIC_REPLY_NOMINAL);
|
||||
deviceHandlerMock.performOperation(DeviceHandlerIF::PERFORM_OPERATION);
|
||||
deviceHandlerMock.performOperation(DeviceHandlerIF::SEND_WRITE);
|
||||
deviceHandlerMock.performOperation(DeviceHandlerIF::GET_WRITE);
|
||||
@ -68,7 +67,7 @@ TEST_CASE("Device Handler Base", "[DeviceHandlerBase]") {
|
||||
}
|
||||
|
||||
SECTION("Missed periodic reply") {
|
||||
comIF.setTestCase(ComIFMock::TestCase::MISSED_REPLY);
|
||||
comIF.setTestCase(ComIFMock::TestCase::MISSED_REPLY);
|
||||
// Set the timeout to 0 to immediately timeout the reply
|
||||
deviceHandlerMock.changePeriodicReplyCountdown(0);
|
||||
deviceHandlerMock.performOperation(DeviceHandlerIF::PERFORM_OPERATION);
|
||||
|
@ -31,4 +31,4 @@ enum sourceObjects : uint32_t {
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* BSP_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ */
|
||||
#endif /* BSP_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user