EIVE upstream #29

Merged
muellerr merged 693 commits from use-eive-upstream into develop 2023-06-30 15:44:39 +02:00
11 changed files with 34 additions and 25 deletions
Showing only changes of commit de2d4da161 - Show all commits

View File

@ -46,9 +46,9 @@ class GpioIF : public HasReturnvaluesIF {
* an ouput or input gpio.
*
* @param gpioId A unique number which specifies the GPIO to read.
* @param gpioState State of GPIO will be written to this pointer.
* @param gpioState State of GPIO will be written to this reference
*/
virtual ReturnValue_t readGpio(gpioId_t gpioId, int* gpioState) = 0;
virtual ReturnValue_t readGpio(gpioId_t gpioId, gpio::Levels& gpioState) = 0;
};
#endif /* COMMON_GPIO_GPIOIF_H_ */

View File

@ -9,7 +9,7 @@ using gpioId_t = uint16_t;
namespace gpio {
enum class Levels : int { LOW = 0, HIGH = 1, NONE = 99 };
enum class Levels : int { LOW = 0, HIGH = 1, FAILED = -1, NONE = 99 };
enum class Direction : int { IN = 0, OUT = 1 };

View File

@ -280,7 +280,7 @@ ReturnValue_t LinuxLibgpioIF::driveGpio(gpioId_t gpioId, GpiodRegularBase& regul
return RETURN_OK;
}
ReturnValue_t LinuxLibgpioIF::readGpio(gpioId_t gpioId, int* gpioState) {
ReturnValue_t LinuxLibgpioIF::readGpio(gpioId_t gpioId, gpio::Levels& gpioState) {
gpioMapIter = gpioMap.find(gpioId);
if (gpioMapIter == gpioMap.end()) {
#if FSFW_CPP_OSTREAM_ENABLED == 1
@ -299,7 +299,10 @@ ReturnValue_t LinuxLibgpioIF::readGpio(gpioId_t gpioId, int* gpioState) {
if (regularGpio == nullptr) {
return GPIO_TYPE_FAILURE;
}
*gpioState = gpiod_line_get_value(regularGpio->lineHandle);
gpioState = static_cast<gpio::Levels>(gpiod_line_get_value(regularGpio->lineHandle));
if (gpioState == gpio::Levels::FAILED) {
return GPIO_GET_VALUE_FAILED;
}
} else {
auto gpioCallback = dynamic_cast<GpioCallback*>(gpioMapIter->second);
if (gpioCallback->callback == nullptr) {

View File

@ -31,14 +31,16 @@ class LinuxLibgpioIF : public GpioIF, public SystemObject {
HasReturnvaluesIF::makeReturnCode(gpioRetvalId, 5);
static constexpr ReturnValue_t GPIO_INIT_FAILED =
HasReturnvaluesIF::makeReturnCode(gpioRetvalId, 6);
// Will be returned if getting the line value failed. Error type will be set to errno in this case
static constexpr ReturnValue_t GPIO_GET_VALUE_FAILED =
HasReturnvaluesIF::makeReturnCode(gpioRetvalId, 7);
LinuxLibgpioIF(object_id_t objectId);
virtual ~LinuxLibgpioIF();
ReturnValue_t addGpios(GpioCookie* gpioCookie) override;
ReturnValue_t pullHigh(gpioId_t gpioId) override;
ReturnValue_t pullLow(gpioId_t gpioId) override;
ReturnValue_t readGpio(gpioId_t gpioId, int* gpioState) override;
ReturnValue_t readGpio(gpioId_t gpioId, gpio::Levels& gpioState) override;
private:
static const size_t MAX_CHIPNAME_LENGTH = 11;

View File

@ -170,18 +170,20 @@ ReturnValue_t I2cComIF::requestReceiveMessage(CookieIF* cookie, size_t requestLe
int readLen = read(fd, replyBuffer, requestLen);
if (readLen != static_cast<int>(requestLen)) {
#if FSFW_VERBOSE_LEVEL >= 1 and FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "I2cComIF::requestReceiveMessage: Reading from I2C "
<< "device failed with error code " << errno << ". Description"
<< " of error: " << strerror(errno) << std::endl;
sif::error << "I2cComIF::requestReceiveMessage: Read only " << readLen << " from " << requestLen
<< " bytes" << std::endl;
#if FSFW_VERBOSE_LEVEL >= 1
#if FSFW_CPP_OSTREAM_ENABLED == 1
if (readLen < 0) {
sif::warning << "I2cComIF::requestReceiveMessage: Reading from I2C "
<< "device failed with error code " << errno << " | " << strerror(errno)
<< std::endl;
} else {
sif::warning << "I2cComIF::requestReceiveMessage: Read only " << readLen << " from "
<< requestLen << " bytes" << std::endl;
}
#else
#endif
#endif
i2cDeviceMapIter->second.replyLen = 0;
#if FSFW_CPP_OSTREAM_ENABLED == 1
sif::debug << "I2cComIF::requestReceiveMessage: Read " << readLen << " of " << requestLen
<< " bytes" << std::endl;
#endif
return HasReturnvaluesIF::RETURN_FAILED;
}

View File

@ -1084,7 +1084,8 @@ class DeviceHandlerBase : public DeviceHandlerIF,
/**
* Same as triggerEvent, but for forwarding if object is used as proxy.
*/
virtual void forwardEvent(Event event, uint32_t parameter1 = 0, uint32_t parameter2 = 0) const override;
virtual void forwardEvent(Event event, uint32_t parameter1 = 0,
uint32_t parameter2 = 0) const override;
/**
* Checks if current mode is transitional mode.

View File

@ -50,7 +50,8 @@ class SystemObject : public SystemObjectIF {
virtual ReturnValue_t initialize() override;
virtual ReturnValue_t checkObjectConnections() override;
virtual void forwardEvent(Event event, uint32_t parameter1 = 0, uint32_t parameter2 = 0) const override;
virtual void forwardEvent(Event event, uint32_t parameter1 = 0,
uint32_t parameter2 = 0) const override;
};
#endif /* FSFW_OBJECTMANAGER_SYSTEMOBJECT_H_ */

View File

@ -154,7 +154,7 @@ void UdpTcPollingTask::setTimeout(double timeoutSeconds) {
#endif
}
#elif defined(PLATFORM_UNIX)
timeval tval {};
timeval tval{};
tval = timevalOperations::toTimeval(timeoutSeconds);
int result = setsockopt(serverSocket, SOL_SOCKET, SO_RCVTIMEO, &tval, sizeof(receptionTimeout));
if (result == -1) {

View File

@ -20,7 +20,7 @@
const std::string UdpTmTcBridge::DEFAULT_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT;
UdpTmTcBridge::UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination,
const std::string& udpServerPort_, object_id_t tmStoreId,
const std::string &udpServerPort_, object_id_t tmStoreId,
object_id_t tcStoreId)
: TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) {
if (udpServerPort_.empty()) {

View File

@ -29,8 +29,8 @@ class UdpTmTcBridge : public TmTcBridge, public TcpIpBase {
/* The ports chosen here should not be used by any other process. */
static const std::string DEFAULT_SERVER_PORT;
UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination, const std::string& udpServerPort = "",
object_id_t tmStoreId = objects::TM_STORE,
UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination,
const std::string& udpServerPort = "", object_id_t tmStoreId = objects::TM_STORE,
object_id_t tcStoreId = objects::TC_STORE);
~UdpTmTcBridge() override;