2022-05-16 11:10:35 +02:00
|
|
|
#include "ComIFMock.h"
|
2022-06-06 11:55:42 +02:00
|
|
|
|
2022-06-05 12:52:55 +02:00
|
|
|
#include "DeviceHandlerMock.h"
|
2022-05-16 11:10:35 +02:00
|
|
|
|
2022-06-06 11:55:42 +02:00
|
|
|
ComIFMock::ComIFMock(object_id_t objectId) : SystemObject(objectId) {}
|
2022-05-16 11:10:35 +02:00
|
|
|
|
|
|
|
ComIFMock::~ComIFMock() {}
|
|
|
|
|
|
|
|
ReturnValue_t ComIFMock::initializeInterface(CookieIF *cookie) { return RETURN_OK; }
|
|
|
|
|
|
|
|
ReturnValue_t ComIFMock::sendMessage(CookieIF *cookie, const uint8_t *sendData, size_t sendLen) {
|
2022-06-05 12:52:55 +02:00
|
|
|
data = *sendData;
|
2022-05-16 11:10:35 +02:00
|
|
|
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) {
|
2022-06-06 11:55:42 +02:00
|
|
|
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;
|
|
|
|
}
|
2022-05-16 11:10:35 +02:00
|
|
|
return RETURN_OK;
|
|
|
|
}
|
2022-06-05 12:52:55 +02:00
|
|
|
|
2022-06-06 11:55:42 +02:00
|
|
|
void ComIFMock::setTestCase(TestCase testCase_) { testCase = testCase_; }
|