Thermal controller and temperature bugfixes #266
@ -1,46 +0,0 @@
|
|||||||
#include "ComIFMock.h"
|
|
||||||
|
|
||||||
#include "DeviceHandlerMock.h"
|
|
||||||
|
|
||||||
ComIFMock::ComIFMock(object_id_t objectId) : SystemObject(objectId) {}
|
|
||||||
|
|
||||||
ComIFMock::~ComIFMock() {}
|
|
||||||
|
|
||||||
ReturnValue_t ComIFMock::initializeInterface(CookieIF *cookie) { return RETURN_OK; }
|
|
||||||
|
|
||||||
ReturnValue_t ComIFMock::sendMessage(CookieIF *cookie, const uint8_t *sendData, size_t sendLen) {
|
|
||||||
data = *sendData;
|
|
||||||
return RETURN_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnValue_t ComIFMock::getSendSuccess(CookieIF *cookie) { return RETURN_OK; }
|
|
||||||
|
|
||||||
ReturnValue_t ComIFMock::requestReceiveMessage(CookieIF *cookie, size_t requestLen) {
|
|
||||||
return RETURN_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
return RETURN_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ComIFMock::setTestCase(TestCase testCase_) { testCase = testCase_; }
|
|
@ -1,37 +0,0 @@
|
|||||||
#ifndef TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COMIFMOCK_H_
|
|
||||||
#define TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COMIFMOCK_H_
|
|
||||||
|
|
||||||
#include <fsfw/devicehandlers/DeviceCommunicationIF.h>
|
|
||||||
#include <fsfw/objectmanager/SystemObject.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief The ComIFMock supports the simulation of various device communication error cases
|
|
||||||
* like incomplete or wrong replies and can be used to test the
|
|
||||||
* DeviceHandlerBase.
|
|
||||||
*/
|
|
||||||
class ComIFMock : public DeviceCommunicationIF, public SystemObject {
|
|
||||||
public:
|
|
||||||
enum class TestCase { SIMPLE_COMMAND_NOMINAL, PERIODIC_REPLY_NOMINAL, MISSED_REPLY };
|
|
||||||
|
|
||||||
ComIFMock(object_id_t objectId);
|
|
||||||
virtual ~ComIFMock();
|
|
||||||
|
|
||||||
virtual ReturnValue_t initializeInterface(CookieIF *cookie) override;
|
|
||||||
virtual ReturnValue_t sendMessage(CookieIF *cookie, const uint8_t *sendData,
|
|
||||||
size_t sendLen) override;
|
|
||||||
virtual ReturnValue_t getSendSuccess(CookieIF *cookie) override;
|
|
||||||
virtual ReturnValue_t requestReceiveMessage(CookieIF *cookie, size_t requestLen) override;
|
|
||||||
virtual ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer,
|
|
||||||
size_t *size) override;
|
|
||||||
void setTestCase(TestCase testCase_);
|
|
||||||
|
|
||||||
private:
|
|
||||||
TestCase testCase = TestCase::SIMPLE_COMMAND_NOMINAL;
|
|
||||||
|
|
||||||
static const uint8_t SIMPLE_COMMAND_DATA = 1;
|
|
||||||
static const uint8_t PERIODIC_REPLY_DATA = 2;
|
|
||||||
|
|
||||||
uint8_t data = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COMIFMOCK_H_ */
|
|
@ -1,5 +0,0 @@
|
|||||||
#include "CookieIFMock.h"
|
|
||||||
|
|
||||||
CookieIFMock::CookieIFMock() {}
|
|
||||||
|
|
||||||
CookieIFMock::~CookieIFMock() {}
|
|
@ -1,12 +0,0 @@
|
|||||||
#ifndef TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COOKIEIFMOCK_H_
|
|
||||||
#define TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COOKIEIFMOCK_H_
|
|
||||||
|
|
||||||
#include "fsfw/devicehandlers/CookieIF.h"
|
|
||||||
|
|
||||||
class CookieIFMock : public CookieIF {
|
|
||||||
public:
|
|
||||||
CookieIFMock();
|
|
||||||
virtual ~CookieIFMock();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* TESTS_SRC_FSFW_TESTS_UNIT_DEVICEHANDLER_COOKIEIFMOCK_H_ */
|
|
Loading…
Reference in New Issue
Block a user