improvement for unix file guard
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
Robin Müller 2023-02-18 13:46:00 +01:00
parent cab2d00530
commit a0f4b031be
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
5 changed files with 9 additions and 9 deletions

2
fsfw

@ -1 +1 @@
Subproject commit be015b4c669995dc55bc316b006699be8542d941 Subproject commit 3568bdbecf74733970211d7ff713ad030b332a98

View File

@ -29,7 +29,7 @@ ReturnValue_t I2cTestClass::performPeriodicAction() {
void I2cTestClass::battInit() { void I2cTestClass::battInit() {
sif::info << "I2cTestClass: BPX Initialization" << std::endl; sif::info << "I2cTestClass: BPX Initialization" << std::endl;
UnixFileGuard fileHelper(i2cdev, &bpxInfo.fd, O_RDWR, "I2cTestClass::sendMessage"); UnixFileGuard fileHelper(i2cdev, bpxInfo.fd, O_RDWR, "I2cTestClass::sendMessage");
if (fileHelper.getOpenResult() != returnvalue::OK) { if (fileHelper.getOpenResult() != returnvalue::OK) {
sif::error << "Opening I2C device" << i2cdev << " failed" << std::endl; sif::error << "Opening I2C device" << i2cdev << " failed" << std::endl;
return; return;
@ -58,7 +58,7 @@ void I2cTestClass::battInit() {
} }
void I2cTestClass::battPeriodic() { void I2cTestClass::battPeriodic() {
UnixFileGuard fileHelper(i2cdev, &bpxInfo.fd, O_RDWR, "I2cTestClass::sendMessage"); UnixFileGuard fileHelper(i2cdev, bpxInfo.fd, O_RDWR, "I2cTestClass::sendMessage");
if (fileHelper.getOpenResult() != returnvalue::OK) { if (fileHelper.getOpenResult() != returnvalue::OK) {
sif::error << "Opening I2C device" << i2cdev << " failed" << std::endl; sif::error << "Opening I2C device" << i2cdev << " failed" << std::endl;
return; return;

View File

@ -94,7 +94,7 @@ void SpiTestClass::performRm3100Test(uint8_t mgmId) {
#endif #endif
int fileDescriptor = 0; int fileDescriptor = 0;
UnixFileGuard fileHelper(deviceName, &fileDescriptor, O_RDWR, "SpiComIF::initializeInterface"); UnixFileGuard fileHelper(deviceName, fileDescriptor, O_RDWR, "SpiComIF::initializeInterface");
if (fileHelper.getOpenResult()) { if (fileHelper.getOpenResult()) {
sif::error << "SpiTestClass::performRm3100Test: File descriptor could not be opened!" sif::error << "SpiTestClass::performRm3100Test: File descriptor could not be opened!"
<< std::endl; << std::endl;
@ -191,7 +191,7 @@ void SpiTestClass::performLis3MdlTest(uint8_t lis3Id) {
#endif #endif
int fileDescriptor = 0; int fileDescriptor = 0;
UnixFileGuard fileHelper(deviceName, &fileDescriptor, O_RDWR, "SpiComIF::initializeInterface"); UnixFileGuard fileHelper(deviceName, fileDescriptor, O_RDWR, "SpiComIF::initializeInterface");
if (fileHelper.getOpenResult()) { if (fileHelper.getOpenResult()) {
sif::error << "SpiTestClass::performLis3Mdl3100Test: File descriptor could not be opened!" sif::error << "SpiTestClass::performLis3Mdl3100Test: File descriptor could not be opened!"
<< std::endl; << std::endl;
@ -231,7 +231,7 @@ void SpiTestClass::performL3gTest(uint8_t l3gId) {
#endif #endif
int fileDescriptor = 0; int fileDescriptor = 0;
UnixFileGuard fileHelper(deviceName, &fileDescriptor, O_RDWR, "SpiComIF::initializeInterface"); UnixFileGuard fileHelper(deviceName, fileDescriptor, O_RDWR, "SpiComIF::initializeInterface");
if (fileHelper.getOpenResult()) { if (fileHelper.getOpenResult()) {
sif::error << "SpiTestClass::performLis3Mdl3100Test: File descriptor could not be opened!" sif::error << "SpiTestClass::performLis3Mdl3100Test: File descriptor could not be opened!"
<< std::endl; << std::endl;
@ -341,7 +341,7 @@ void SpiTestClass::performMax1227Test() {
#elif defined(TE0720_1CFA) #elif defined(TE0720_1CFA)
#endif #endif
int fd = 0; int fd = 0;
UnixFileGuard fileHelper(deviceName, &fd, O_RDWR, "SpiComIF::initializeInterface"); UnixFileGuard fileHelper(deviceName, fd, O_RDWR, "SpiComIF::initializeInterface");
if (fileHelper.getOpenResult()) { if (fileHelper.getOpenResult()) {
sif::error << "SpiTestClass::performLis3Mdl3100Test: File descriptor could not be opened!" sif::error << "SpiTestClass::performLis3Mdl3100Test: File descriptor could not be opened!"
<< std::endl; << std::endl;

View File

@ -434,7 +434,7 @@ ReturnValue_t GyroADIS1650XHandler::spiSendCallback(SpiComIF *comIf, SpiCookie *
// Prepare transfer // Prepare transfer
int fileDescriptor = 0; int fileDescriptor = 0;
std::string device = comIf->getSpiDev(); std::string device = comIf->getSpiDev();
UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR, "SpiComIF::sendMessage"); UnixFileGuard fileHelper(device, fileDescriptor, O_RDWR, "SpiComIF::sendMessage");
if (fileHelper.getOpenResult() != returnvalue::OK) { if (fileHelper.getOpenResult() != returnvalue::OK) {
return SpiComIF::OPENING_FILE_FAILED; return SpiComIF::OPENING_FILE_FAILED;
} }

View File

@ -722,7 +722,7 @@ ReturnValue_t PayloadPcduHandler::transferAsTwo(SpiComIF* comIf, SpiCookie* cook
int retval = 0; int retval = 0;
// Prepare transfer // Prepare transfer
int fileDescriptor = 0; int fileDescriptor = 0;
UnixFileGuard fileHelper(comIf->getSpiDev(), &fileDescriptor, O_RDWR, "SpiComIF::sendMessage"); UnixFileGuard fileHelper(comIf->getSpiDev(), fileDescriptor, O_RDWR, "SpiComIF::sendMessage");
if (fileHelper.getOpenResult() != returnvalue::OK) { if (fileHelper.getOpenResult() != returnvalue::OK) {
return SpiComIF::OPENING_FILE_FAILED; return SpiComIF::OPENING_FILE_FAILED;
} }