retval replacements
This commit is contained in:
parent
aa0da618ca
commit
86337d8f47
@ -25,6 +25,8 @@
|
|||||||
#define RPI_TEST_GPS_HANDLER 0
|
#define RPI_TEST_GPS_HANDLER 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
using namespace returnvalue;
|
||||||
|
|
||||||
UartTestClass::UartTestClass(object_id_t objectId, ScexUartReader* reader)
|
UartTestClass::UartTestClass(object_id_t objectId, ScexUartReader* reader)
|
||||||
: TestTask(objectId), reader(reader) {
|
: TestTask(objectId), reader(reader) {
|
||||||
mode = TestModes::SCEX;
|
mode = TestModes::SCEX;
|
||||||
@ -163,7 +165,7 @@ void UartTestClass::scexInit() {
|
|||||||
uartCookie = new UartCookie(this->getObjectId(), devname, UartBaudRate::RATE_57600, 4096);
|
uartCookie = new UartCookie(this->getObjectId(), devname, UartBaudRate::RATE_57600, 4096);
|
||||||
reader->setDebugMode(false);
|
reader->setDebugMode(false);
|
||||||
ReturnValue_t result = reader->initializeInterface(uartCookie);
|
ReturnValue_t result = reader->initializeInterface(uartCookie);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != OK) {
|
||||||
sif::warning << "UartTestClass::scexInit: Initializing SCEX reader "
|
sif::warning << "UartTestClass::scexInit: Initializing SCEX reader "
|
||||||
"UART IF failed"
|
"UART IF failed"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
@ -306,7 +308,7 @@ void UartTestClass::scexSimpleInit() {
|
|||||||
|
|
||||||
void UartTestClass::scexSimplePeriodic() {
|
void UartTestClass::scexSimplePeriodic() {
|
||||||
using namespace scex;
|
using namespace scex;
|
||||||
ReturnValue_t result = RETURN_OK;
|
ReturnValue_t result = OK;
|
||||||
if (not cmdSent) {
|
if (not cmdSent) {
|
||||||
// Flush received and unread data
|
// Flush received and unread data
|
||||||
tcflush(serialPort, TCIFLUSH);
|
tcflush(serialPort, TCIFLUSH);
|
||||||
@ -315,7 +317,7 @@ void UartTestClass::scexSimplePeriodic() {
|
|||||||
sif::info << "UartTestClass::scexSimplePeriodic: Sending command to SCEX" << std::endl;
|
sif::info << "UartTestClass::scexSimplePeriodic: Sending command to SCEX" << std::endl;
|
||||||
prepareScexCmd(currCmd, false, tmpCmdBuf, &len);
|
prepareScexCmd(currCmd, false, tmpCmdBuf, &len);
|
||||||
result = dleEncoder.encode(tmpCmdBuf, len, cmdBuf.data(), cmdBuf.size(), &encodedLen, true);
|
result = dleEncoder.encode(tmpCmdBuf, len, cmdBuf.data(), cmdBuf.size(), &encodedLen, true);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != OK) {
|
||||||
sif::warning << "UartTestClass::scexSimplePeriodic: Encoding failed" << std::endl;
|
sif::warning << "UartTestClass::scexSimplePeriodic: Encoding failed" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -368,17 +370,11 @@ int UartTestClass::prepareScexCmd(scex::Cmds cmd, bool tempCheck, uint8_t* cmdBu
|
|||||||
cmdBuf[1] = 1;
|
cmdBuf[1] = 1;
|
||||||
cmdBuf[2] = 1;
|
cmdBuf[2] = 1;
|
||||||
uint16_t userDataLen = 0;
|
uint16_t userDataLen = 0;
|
||||||
tmpCmdBuf[3] = (userDataLen >> 8) & 0xff;
|
cmdBuf[3] = (userDataLen >> 8) & 0xff;
|
||||||
tmpCmdBuf[4] = userDataLen & 0xff;
|
cmdBuf[4] = userDataLen & 0xff;
|
||||||
uint16_t crc = CRC::crc16ccitt(tmpCmdBuf.data(), 5);
|
uint16_t crc = CRC::crc16ccitt(cmdBuf, 5);
|
||||||
tmpCmdBuf[5] = (crc >> 8) & 0xff;
|
cmdBuf[5] = (crc >> 8) & 0xff;
|
||||||
tmpCmdBuf[6] = crc & 0xff;
|
cmdBuf[6] = crc & 0xff;
|
||||||
ReturnValue_t result =
|
|
||||||
dleEncoder.encode(tmpCmdBuf.data(), 7, cmdBuf.data(), cmdBuf.size(), &encodedLen, true);
|
|
||||||
if (result != returnvalue::OK) {
|
|
||||||
sif::warning << "UartTestClass::scexInit: Encoding failed" << std::endl;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class UartTestClass : public TestTask {
|
|||||||
std::array<uint8_t, 64> cmdBuf = {};
|
std::array<uint8_t, 64> cmdBuf = {};
|
||||||
std::array<uint8_t, 4096> recBuf = {};
|
std::array<uint8_t, 4096> recBuf = {};
|
||||||
ScexDleParser* dleParser;
|
ScexDleParser* dleParser;
|
||||||
scex::Cmds cmdHelper;
|
scex::Cmds cmdHelper = scex::Cmds::INVALID;
|
||||||
uint8_t recvCnt = 0;
|
uint8_t recvCnt = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -4,11 +4,13 @@
|
|||||||
|
|
||||||
#include "fsfw/serviceinterface.h"
|
#include "fsfw/serviceinterface.h"
|
||||||
|
|
||||||
|
using namespace returnvalue;
|
||||||
|
|
||||||
ScexHelper::ScexHelper() {}
|
ScexHelper::ScexHelper() {}
|
||||||
|
|
||||||
ReturnValue_t ScexHelper::serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
ReturnValue_t ScexHelper::serialize(uint8_t** buffer, size_t* size, size_t maxSize,
|
||||||
Endianness streamEndianness) const {
|
Endianness streamEndianness) const {
|
||||||
return RETURN_FAILED;
|
return FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ScexHelper::getSerializedSize() const { return totalPacketLen; }
|
size_t ScexHelper::getSerializedSize() const { return totalPacketLen; }
|
||||||
@ -16,7 +18,7 @@ size_t ScexHelper::getSerializedSize() const { return totalPacketLen; }
|
|||||||
ReturnValue_t ScexHelper::deSerialize(const uint8_t** buffer, size_t* size,
|
ReturnValue_t ScexHelper::deSerialize(const uint8_t** buffer, size_t* size,
|
||||||
Endianness streamEndianness) {
|
Endianness streamEndianness) {
|
||||||
if (buffer == nullptr or size == nullptr) {
|
if (buffer == nullptr or size == nullptr) {
|
||||||
return RETURN_FAILED;
|
return FAILED;
|
||||||
}
|
}
|
||||||
if (*size < 7) {
|
if (*size < 7) {
|
||||||
return STREAM_TOO_SHORT;
|
return STREAM_TOO_SHORT;
|
||||||
@ -45,7 +47,7 @@ ReturnValue_t ScexHelper::deSerialize(const uint8_t** buffer, size_t* size,
|
|||||||
if (CRC::crc16ccitt(start, totalPacketLen) != 0) {
|
if (CRC::crc16ccitt(start, totalPacketLen) != 0) {
|
||||||
return INVALID_CRC;
|
return INVALID_CRC;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
scex::Cmds ScexHelper::getCmd() const { return cmd; }
|
scex::Cmds ScexHelper::getCmd() const { return cmd; }
|
||||||
|
@ -7,12 +7,10 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
// ScexHelper helper;
|
|
||||||
// helper.deSerialize(data, ...);
|
class ScexHelper : public SerializeIF {
|
||||||
// sif::info << helper << std::endl;
|
|
||||||
class ScexHelper : public HasReturnvaluesIF, public SerializeIF {
|
|
||||||
public:
|
public:
|
||||||
static const ReturnValue_t INVALID_CRC = HasReturnvaluesIF::makeReturnCode(0, 2);
|
static const ReturnValue_t INVALID_CRC = returnvalue::makeCode(0, 2);
|
||||||
|
|
||||||
ScexHelper();
|
ScexHelper();
|
||||||
ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize,
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
#include "OBSWConfig.h"
|
#include "OBSWConfig.h"
|
||||||
|
|
||||||
|
using namespace returnvalue;
|
||||||
|
|
||||||
ScexUartReader::ScexUartReader(object_id_t objectId)
|
ScexUartReader::ScexUartReader(object_id_t objectId)
|
||||||
: SystemObject(objectId),
|
: SystemObject(objectId),
|
||||||
decodeRingBuf(4096, true),
|
decodeRingBuf(4096, true),
|
||||||
@ -58,7 +60,7 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) {
|
|||||||
sif::info << "Received " << bytesRead
|
sif::info << "Received " << bytesRead
|
||||||
<< " bytes from the Solar Cell Experiment:" << std::endl;
|
<< " bytes from the Solar Cell Experiment:" << std::endl;
|
||||||
}
|
}
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != OK) {
|
||||||
sif::warning << "ScexUartReader::performOperation: Passing data to DLE parser failed"
|
sif::warning << "ScexUartReader::performOperation: Passing data to DLE parser failed"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
@ -67,13 +69,13 @@ ReturnValue_t ScexUartReader::performOperation(uint8_t operationCode) {
|
|||||||
// task block comes here
|
// task block comes here
|
||||||
sif::info << "task was stopped" << std::endl;
|
sif::info << "task was stopped" << std::endl;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) {
|
ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) {
|
||||||
UartCookie *uartCookie = dynamic_cast<UartCookie *>(cookie);
|
UartCookie *uartCookie = dynamic_cast<UartCookie *>(cookie);
|
||||||
if (uartCookie == nullptr) {
|
if (uartCookie == nullptr) {
|
||||||
return RETURN_FAILED;
|
return FAILED;
|
||||||
}
|
}
|
||||||
std::string devname = uartCookie->getDeviceFile();
|
std::string devname = uartCookie->getDeviceFile();
|
||||||
/* Get file descriptor */
|
/* Get file descriptor */
|
||||||
@ -81,7 +83,7 @@ ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) {
|
|||||||
if (serialPort < 0) {
|
if (serialPort < 0) {
|
||||||
sif::warning << "ScexUartReader::initializeInterface: open call failed with error [" << errno
|
sif::warning << "ScexUartReader::initializeInterface: open call failed with error [" << errno
|
||||||
<< ", " << strerror(errno) << std::endl;
|
<< ", " << strerror(errno) << std::endl;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return FAILED;
|
||||||
}
|
}
|
||||||
// Setting up UART parameters
|
// Setting up UART parameters
|
||||||
tty.c_cflag &= ~PARENB; // Clear parity bit
|
tty.c_cflag &= ~PARENB; // Clear parity bit
|
||||||
@ -111,46 +113,46 @@ ReturnValue_t ScexUartReader::initializeInterface(CookieIF *cookie) {
|
|||||||
}
|
}
|
||||||
// Flush received and unread data
|
// Flush received and unread data
|
||||||
tcflush(serialPort, TCIOFLUSH);
|
tcflush(serialPort, TCIOFLUSH);
|
||||||
return RETURN_OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ScexUartReader::sendMessage(CookieIF *cookie, const uint8_t *sendData,
|
ReturnValue_t ScexUartReader::sendMessage(CookieIF *cookie, const uint8_t *sendData,
|
||||||
size_t sendLen) {
|
size_t sendLen) {
|
||||||
if (sendData == nullptr or sendLen == 0) {
|
if (sendData == nullptr or sendLen == 0) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return FAILED;
|
||||||
}
|
}
|
||||||
lock->lockMutex();
|
lock->lockMutex();
|
||||||
if (state == States::NOT_READY or state == States::RUNNING) {
|
if (state == States::NOT_READY or state == States::RUNNING) {
|
||||||
lock->unlockMutex();
|
lock->unlockMutex();
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return FAILED;
|
||||||
}
|
}
|
||||||
state = States::RUNNING;
|
state = States::RUNNING;
|
||||||
lock->unlockMutex();
|
lock->unlockMutex();
|
||||||
size_t encodedLen = 0;
|
size_t encodedLen = 0;
|
||||||
ReturnValue_t result =
|
ReturnValue_t result =
|
||||||
dleEncoder.encode(sendData, sendLen, cmdbuf.data(), cmdbuf.size(), &encodedLen, true);
|
dleEncoder.encode(sendData, sendLen, cmdbuf.data(), cmdbuf.size(), &encodedLen, true);
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != OK) {
|
||||||
sif::warning << "ScexUartReader::sendMessage: Encoding failed" << std::endl;
|
sif::warning << "ScexUartReader::sendMessage: Encoding failed" << std::endl;
|
||||||
return RETURN_FAILED;
|
return FAILED;
|
||||||
}
|
}
|
||||||
arrayprinter::print(cmdbuf.data(), encodedLen);
|
arrayprinter::print(cmdbuf.data(), encodedLen);
|
||||||
size_t bytesWritten = write(serialPort, cmdbuf.data(), encodedLen);
|
size_t bytesWritten = write(serialPort, cmdbuf.data(), encodedLen);
|
||||||
if (bytesWritten != encodedLen) {
|
if (bytesWritten != encodedLen) {
|
||||||
sif::warning << "ScexUartReader::sendMessage: Sending ping command to solar experiment failed"
|
sif::warning << "ScexUartReader::sendMessage: Sending ping command to solar experiment failed"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return RETURN_FAILED;
|
return FAILED;
|
||||||
}
|
}
|
||||||
result = semaphore->release();
|
result = semaphore->release();
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != OK) {
|
||||||
std::cout << "ScexUartReader::sendMessage: Releasing semaphore failed" << std::endl;
|
std::cout << "ScexUartReader::sendMessage: Releasing semaphore failed" << std::endl;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ScexUartReader::getSendSuccess(CookieIF *cookie) { return RETURN_OK; }
|
ReturnValue_t ScexUartReader::getSendSuccess(CookieIF *cookie) { return OK; }
|
||||||
|
|
||||||
ReturnValue_t ScexUartReader::requestReceiveMessage(CookieIF *cookie, size_t requestLen) {
|
ReturnValue_t ScexUartReader::requestReceiveMessage(CookieIF *cookie, size_t requestLen) {
|
||||||
return RETURN_OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScexUartReader::setDebugMode(bool enable) { this->debugMode = enable; }
|
void ScexUartReader::setDebugMode(bool enable) { this->debugMode = enable; }
|
||||||
@ -158,10 +160,10 @@ void ScexUartReader::setDebugMode(bool enable) { this->debugMode = enable; }
|
|||||||
ReturnValue_t ScexUartReader::finish() {
|
ReturnValue_t ScexUartReader::finish() {
|
||||||
MutexGuard mg(lock);
|
MutexGuard mg(lock);
|
||||||
if (state == States::IDLE) {
|
if (state == States::IDLE) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return FAILED;
|
||||||
}
|
}
|
||||||
state = States::FINISH;
|
state = States::FINISH;
|
||||||
return RETURN_OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScexUartReader::foundDlePacketHandler(const ScexDleParser::Context &ctx) {
|
void ScexUartReader::foundDlePacketHandler(const ScexDleParser::Context &ctx) {
|
||||||
@ -178,11 +180,11 @@ void ScexUartReader::handleFoundDlePacket(uint8_t *packet, size_t len) {
|
|||||||
// sif::info << "Detected DLE encoded packet with decoded size " << len << std::endl;
|
// sif::info << "Detected DLE encoded packet with decoded size " << len << std::endl;
|
||||||
MutexGuard mg(lock);
|
MutexGuard mg(lock);
|
||||||
ReturnValue_t result = ipcQueue.insert(len);
|
ReturnValue_t result = ipcQueue.insert(len);
|
||||||
if (result != RETURN_OK) {
|
if (result != OK) {
|
||||||
sif::warning << "ScexUartReader::handleFoundDlePacket: IPCQueue error" << std::endl;
|
sif::warning << "ScexUartReader::handleFoundDlePacket: IPCQueue error" << std::endl;
|
||||||
}
|
}
|
||||||
result = ipcRingBuf.writeData(packet, len);
|
result = ipcRingBuf.writeData(packet, len);
|
||||||
if (result != RETURN_OK) {
|
if (result != OK) {
|
||||||
sif::warning << "ScexUartReader::handleFoundDlePacket: IPCRingBuf error" << std::endl;
|
sif::warning << "ScexUartReader::handleFoundDlePacket: IPCRingBuf error" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -192,13 +194,13 @@ ReturnValue_t ScexUartReader::readReceivedMessage(CookieIF *cookie, uint8_t **bu
|
|||||||
MutexGuard mg(lock);
|
MutexGuard mg(lock);
|
||||||
if (ipcQueue.empty()) {
|
if (ipcQueue.empty()) {
|
||||||
*size = 0;
|
*size = 0;
|
||||||
return RETURN_OK;
|
return OK;
|
||||||
}
|
}
|
||||||
ipcQueue.retrieve(size);
|
ipcQueue.retrieve(size);
|
||||||
*buffer = ipcBuffer.data();
|
*buffer = ipcBuffer.data();
|
||||||
ReturnValue_t result = ipcRingBuf.readData(ipcBuffer.data(), *size, true);
|
ReturnValue_t result = ipcRingBuf.readData(ipcBuffer.data(), *size, true);
|
||||||
if (result != RETURN_OK) {
|
if (result != OK) {
|
||||||
sif::warning << "ScexUartReader::readReceivedMessage: Reading RingBuffer failed" << std::endl;
|
sif::warning << "ScexUartReader::readReceivedMessage: Reading RingBuffer failed" << std::endl;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "mission/devices/devicedefinitions/ScexDefinitions.h"
|
#include "mission/devices/devicedefinitions/ScexDefinitions.h"
|
||||||
|
|
||||||
using std::ofstream;
|
using std::ofstream;
|
||||||
|
using namespace returnvalue;
|
||||||
|
|
||||||
ScexDeviceHandler::ScexDeviceHandler(object_id_t objectId, ScexUartReader& reader, CookieIF* cookie,
|
ScexDeviceHandler::ScexDeviceHandler(object_id_t objectId, ScexUartReader& reader, CookieIF* cookie,
|
||||||
SdCardMountedIF* sdcMan)
|
SdCardMountedIF* sdcMan)
|
||||||
@ -26,11 +27,11 @@ void ScexDeviceHandler::doStartUp() {
|
|||||||
void ScexDeviceHandler::doShutDown() { setMode(_MODE_POWER_DOWN); }
|
void ScexDeviceHandler::doShutDown() { setMode(_MODE_POWER_DOWN); }
|
||||||
|
|
||||||
ReturnValue_t ScexDeviceHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
ReturnValue_t ScexDeviceHandler::buildNormalDeviceCommand(DeviceCommandId_t* id) {
|
||||||
return RETURN_OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ScexDeviceHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
|
ReturnValue_t ScexDeviceHandler::buildTransitionDeviceCommand(DeviceCommandId_t* id) {
|
||||||
return RETURN_OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
||||||
@ -113,7 +114,7 @@ ReturnValue_t ScexDeviceHandler::buildCommandFromCommand(DeviceCommandId_t devic
|
|||||||
}
|
}
|
||||||
commandActive = true;
|
commandActive = true;
|
||||||
rawPacket = cmdBuf.data();
|
rawPacket = cmdBuf.data();
|
||||||
return RETURN_OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScexDeviceHandler::fillCommandAndReplyMap() {
|
void ScexDeviceHandler::fillCommandAndReplyMap() {
|
||||||
@ -144,14 +145,14 @@ ReturnValue_t ScexDeviceHandler::scanForReply(const uint8_t* start, size_t remai
|
|||||||
*foundId = helper.getCmd();
|
*foundId = helper.getCmd();
|
||||||
*foundLen = remainingSize;
|
*foundLen = remainingSize;
|
||||||
|
|
||||||
return RETURN_OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) {
|
ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t* packet) {
|
||||||
// cmd auswertung (in file reinschreiben)
|
// cmd auswertung (in file reinschreiben)
|
||||||
using namespace scex;
|
using namespace scex;
|
||||||
|
|
||||||
ReturnValue_t status = RETURN_OK;
|
ReturnValue_t status = OK;
|
||||||
auto oneFileHandler = [&](std::string cmdName) {
|
auto oneFileHandler = [&](std::string cmdName) {
|
||||||
fileId = random_string(6);
|
fileId = random_string(6);
|
||||||
std::ostringstream oss("/tmp/scex-", std::ostringstream::ate);
|
std::ostringstream oss("/tmp/scex-", std::ostringstream::ate);
|
||||||
@ -162,12 +163,12 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
|
|||||||
if (out.bad()) {
|
if (out.bad()) {
|
||||||
sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName
|
sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return RETURN_FAILED;
|
return FAILED;
|
||||||
}
|
}
|
||||||
if (debugMode) {
|
if (debugMode) {
|
||||||
out << helper;
|
out << helper;
|
||||||
}
|
}
|
||||||
return RETURN_OK;
|
return OK;
|
||||||
};
|
};
|
||||||
auto multiFileHandler = [&](std::string cmdName) {
|
auto multiFileHandler = [&](std::string cmdName) {
|
||||||
if ((helper.getPacketCounter() == 1) or (not fileNameSet)) {
|
if ((helper.getPacketCounter() == 1) or (not fileNameSet)) {
|
||||||
@ -181,7 +182,7 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
|
|||||||
if (out.bad()) {
|
if (out.bad()) {
|
||||||
sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName
|
sif::error << "ScexDeviceHandler::interpretDeviceReply: Could not open file " << fileName
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return RETURN_FAILED;
|
return FAILED;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ofstream out(fileName,
|
ofstream out(fileName,
|
||||||
@ -191,7 +192,7 @@ ReturnValue_t ScexDeviceHandler::interpretDeviceReply(DeviceCommandId_t id, cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return RETURN_OK;
|
return OK;
|
||||||
};
|
};
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case (PING): {
|
case (PING): {
|
||||||
@ -249,16 +250,16 @@ void ScexDeviceHandler::performOperationHook() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ScexDeviceHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) {
|
uint32_t ScexDeviceHandler::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) {
|
||||||
return RETURN_OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ScexDeviceHandler::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) {
|
ReturnValue_t ScexDeviceHandler::getSwitches(const uint8_t** switches, uint8_t* numberOfSwitches) {
|
||||||
return RETURN_OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t ScexDeviceHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
ReturnValue_t ScexDeviceHandler::initializeLocalDataPool(localpool::DataPool& localDataPoolMap,
|
||||||
LocalDataPoolManager& poolManager) {
|
LocalDataPoolManager& poolManager) {
|
||||||
return RETURN_OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ScexDeviceHandler::random_string(std::string::size_type length) {
|
std::string ScexDeviceHandler::random_string(std::string::size_type length) {
|
||||||
|
@ -17,7 +17,7 @@ ReturnValue_t scex::prepareScexCmd(Cmds cmd, std::pair<uint8_t*, size_t> cmdBufP
|
|||||||
if (cmdBuf == nullptr or (cmdBufPair.second < usrDataPair.second + HEADER_LEN + CRC_LEN) or
|
if (cmdBuf == nullptr or (cmdBufPair.second < usrDataPair.second + HEADER_LEN + CRC_LEN) or
|
||||||
(usrDataPair.second > 0 and userData == nullptr)) {
|
(usrDataPair.second > 0 and userData == nullptr)) {
|
||||||
cmdLen = 0;
|
cmdLen = 0;
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
cmdBuf[0] = createCmdByte(cmd, tempCheck);
|
cmdBuf[0] = createCmdByte(cmd, tempCheck);
|
||||||
// These two fields are the packet counter and the total packet count. Those are 1 and 1 for each
|
// These two fields are the packet counter and the total packet count. Those are 1 and 1 for each
|
||||||
@ -31,5 +31,5 @@ ReturnValue_t scex::prepareScexCmd(Cmds cmd, std::pair<uint8_t*, size_t> cmdBufP
|
|||||||
cmdBuf[usrDataPair.second + HEADER_LEN] = (crc >> 8) & 0xff;
|
cmdBuf[usrDataPair.second + HEADER_LEN] = (crc >> 8) & 0xff;
|
||||||
cmdBuf[usrDataPair.second + HEADER_LEN + 1] = crc & 0xff;
|
cmdBuf[usrDataPair.second + HEADER_LEN + 1] = crc & 0xff;
|
||||||
cmdLen = usrDataPair.second + HEADER_LEN + CRC_LEN;
|
cmdLen = usrDataPair.second + HEADER_LEN + CRC_LEN;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user