Added the following MPSoC commands:
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

* TcCamTakePic
* TcSimplexSendFile
* TcDownlinkDataModulate
Pending: Test commands with MPSoC
This commit is contained in:
Jakob Meier 2023-02-13 13:28:13 +01:00
parent 4958fa73d1
commit 0bc7ddf38e
3 changed files with 134 additions and 1 deletions

View File

@ -31,6 +31,9 @@ static const DeviceCommandId_t TC_MODE_IDLE = 18;
static const DeviceCommandId_t TM_CAM_CMD_RPT = 19;
static const DeviceCommandId_t SET_UART_TX_TRISTATE = 20;
static const DeviceCommandId_t RELEASE_UART_TX = 21;
static const DeviceCommandId_t TC_CAM_TAKE_PIC = 22;
static const DeviceCommandId_t TC_SIMPLEX_SEND_FILE = 23;
static const DeviceCommandId_t TC_DOWNLINK_DATA_MODULATE = 24;
// Will reset the sequence count of the OBSW
static const DeviceCommandId_t OBSW_RESET_SEQ_COUNT = 50;
@ -50,14 +53,18 @@ static const uint16_t TC_REPLAY_WRITE_SEQUENCE = 0x112;
static const uint16_t TC_DOWNLINK_PWR_ON = 0x113;
static const uint16_t TC_MEM_WRITE = 0x114;
static const uint16_t TC_MEM_READ = 0x115;
static const uint16_t TC_CAM_TAKE_PIC = 0x116;
static const uint16_t TC_FLASHWRITE = 0x117;
static const uint16_t TC_FLASHFOPEN = 0x119;
static const uint16_t TC_FLASHFCLOSE = 0x11A;
static const uint16_t TC_FLASHDELETE = 0x11C;
static const uint16_t TC_MODE_REPLAY = 0x11F;
static const uint16_t TC_MODE_IDLE = 0x11E;
static const uint16_t TC_MODE_REPLAY = 0x11F;
static const uint16_t TC_MODE_SNAPSHOT = 0x120;
static const uint16_t TC_DOWNLINK_DATA_MODULATE = 0x121;
static const uint16_t TC_DOWNLINK_PWR_OFF = 0x124;
static const uint16_t TC_CAM_CMD_SEND = 0x12C;
static const uint16_t TC_SIMPLEX_SEND_FILE = 0x130;
static const uint16_t TM_MEMORY_READ_REPORT = 0x404;
static const uint16_t ACK_SUCCESS = 0x400;
static const uint16_t ACK_FAILURE = 0x401;
@ -646,6 +653,81 @@ class TcModeIdle : public TcBase {
: TcBase(params, apid::TC_MODE_IDLE, sequenceCount) {}
};
/**
* @brief Class to build camera take picture command
*/
class TcCamTakePic : public TcBase {
public:
TcCamTakePic(ploc::SpTcParams params, uint16_t sequenceCount)
: TcBase(params, apid::TC_CAM_TAKE_PIC, sequenceCount) {}
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) override {
if (commandDataLen > MAX_DATA_LENGTH) {
return INVALID_LENGTH;
}
std::string fileName(reinterpret_cast<const char*>(commandData));
if (fileName.size() + sizeof(NULL_TERMINATOR) > MAX_FILENAME_SIZE) {
return FILENAME_TOO_LONG;
}
if (commandDataLen - (fileName.size() + sizeof(NULL_TERMINATOR)) != PARAMETER_SIZE) {
return INVALID_LENGTH;
}
spParams.setFullPayloadLen(commandDataLen);
std::memcpy(payloadStart, commandData, commandDataLen);
return returnvalue::OK;
}
private:
static const size_t MAX_DATA_LENGTH = 286;
static const size_t PARAMETER_SIZE = 35;
};
/**
* @brief Class to build simplex send file command
*/
class TcSimplexSendFile : public TcBase {
public:
TcSimplexSendFile(ploc::SpTcParams params, uint16_t sequenceCount)
: TcBase(params, apid::TC_SIMPLEX_SEND_FILE, sequenceCount) {}
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) override {
if (commandDataLen > MAX_DATA_LENGTH) {
return INVALID_LENGTH;
}
std::string fileName(reinterpret_cast<const char*>(commandData));
if (fileName.size() + sizeof(NULL_TERMINATOR) > MAX_FILENAME_SIZE) {
return FILENAME_TOO_LONG;
}
spParams.setFullPayloadLen(commandDataLen);
std::memcpy(payloadStart, commandData, commandDataLen);
return returnvalue::OK;
}
private:
static const size_t MAX_DATA_LENGTH = 256;
};
/**
* @brief Class to build downlink data modulate command
*/
class TcDownlinkDataModulate : public TcBase {
public:
TcDownlinkDataModulate(ploc::SpTcParams params, uint16_t sequenceCount)
: TcBase(params, apid::TC_DOWNLINK_DATA_MODULATE, sequenceCount) {}
ReturnValue_t initPacket(const uint8_t* commandData, size_t commandDataLen) override {
if (commandDataLen > MAX_DATA_LENGTH) {
return INVALID_LENGTH;
}
spParams.setFullPayloadLen(commandDataLen);
std::memcpy(payloadStart, commandData, commandDataLen);
return returnvalue::OK;
}
private:
static const size_t MAX_DATA_LENGTH = 11;
};
class TcCamcmdSend : public TcBase {
public:
TcCamcmdSend(ploc::SpTcParams params, uint16_t sequenceCount)

View File

@ -257,6 +257,18 @@ ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand(DeviceCommandId_t device
result = prepareTcCamCmdSend(commandData, commandDataLen);
break;
}
case (mpsoc::TC_CAM_TAKE_PIC): {
result = prepareTcCamTakePic(commandData, commandDataLen);
break;
}
case (mpsoc::TC_SIMPLEX_SEND_FILE): {
result = prepareTcSimplexSendFile(commandData, commandDataLen);
break;
}
case (mpsoc::TC_DOWNLINK_DATA_MODULATE): {
result = prepareTcDownlinkDataModulate(commandData, commandDataLen);
break;
}
default:
sif::debug << "PlocMPSoCHandler::buildCommandFromCommand: Command not implemented"
<< std::endl;
@ -537,6 +549,42 @@ ReturnValue_t PlocMPSoCHandler::prepareTcCamCmdSend(const uint8_t* commandData,
return returnvalue::OK;
}
ReturnValue_t PlocMPSoCHandler::prepareTcCamTakePic(const uint8_t* commandData,
size_t commandDataLen) {
ReturnValue_t result = returnvalue::OK;
mpsoc::TcCamTakePic tcCamTakePic(spParams, sequenceCount);
result = tcCamTakePic.buildPacket(commandData, commandDataLen);
if (result != returnvalue::OK) {
return result;
}
finishTcPrep(tcCamTakePic.getFullPacketLen());
return returnvalue::OK;
}
ReturnValue_t PlocMPSoCHandler::prepareTcSimplexSendFile(const uint8_t* commandData,
size_t commandDataLen) {
ReturnValue_t result = returnvalue::OK;
mpsoc::TcSimplexSendFile tcSimplexSendFile(spParams, sequenceCount);
result = tcSimplexSendFile.buildPacket(commandData, commandDataLen);
if (result != returnvalue::OK) {
return result;
}
finishTcPrep(tcSimplexSendFile.getFullPacketLen());
return returnvalue::OK;
}
ReturnValue_t PlocMPSoCHandler::prepareTcDownlinkDataModulate(const uint8_t* commandData,
size_t commandDataLen) {
ReturnValue_t result = returnvalue::OK;
mpsoc::TcDownlinkDataModulate tcDownlinkDataModulate(spParams, sequenceCount);
result = tcDownlinkDataModulate.buildPacket(commandData, commandDataLen);
if (result != returnvalue::OK) {
return result;
}
finishTcPrep(tcDownlinkDataModulate.getFullPacketLen());
return returnvalue::OK;
}
void PlocMPSoCHandler::finishTcPrep(size_t packetLen) {
nextReplyId = mpsoc::ACK_REPORT;
rawPacket = commandBuffer;

View File

@ -169,6 +169,9 @@ class PlocMPSoCHandler : public DeviceHandlerBase, public CommandsActionsIF {
ReturnValue_t prepareTcReplayWriteSequence(const uint8_t* commandData, size_t commandDataLen);
ReturnValue_t prepareTcCamCmdSend(const uint8_t* commandData, size_t commandDataLen);
ReturnValue_t prepareTcModeIdle();
ReturnValue_t prepareTcCamTakePic(const uint8_t* commandData, size_t commandDataLen);
ReturnValue_t prepareTcSimplexSendFile(const uint8_t* commandData, size_t commandDataLen);
ReturnValue_t prepareTcDownlinkDataModulate(const uint8_t* commandData, size_t commandDataLen);
void finishTcPrep(size_t packetLen);
/**