This commit is contained in:
parent
b14038e29c
commit
ace01e2742
@ -675,24 +675,24 @@ class TcCamTakePic : public TcBase {
|
||||
: 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 + CRC_SIZE);
|
||||
std::memcpy(payloadStart, commandData, commandDataLen);
|
||||
return returnvalue::OK;
|
||||
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 + CRC_SIZE);
|
||||
std::memcpy(payloadStart, commandData, commandDataLen);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
private:
|
||||
static const size_t MAX_DATA_LENGTH = 286;
|
||||
static const size_t PARAMETER_SIZE = 28;
|
||||
private:
|
||||
static const size_t MAX_DATA_LENGTH = 286;
|
||||
static const size_t PARAMETER_SIZE = 28;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -704,20 +704,20 @@ class TcSimplexSendFile : public TcBase {
|
||||
: 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 + CRC_SIZE);
|
||||
std::memcpy(payloadStart, commandData, commandDataLen);
|
||||
return returnvalue::OK;
|
||||
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 + CRC_SIZE);
|
||||
std::memcpy(payloadStart, commandData, commandDataLen);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
private:
|
||||
static const size_t MAX_DATA_LENGTH = 256;
|
||||
private:
|
||||
static const size_t MAX_DATA_LENGTH = 256;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -729,16 +729,16 @@ class TcDownlinkDataModulate : public TcBase {
|
||||
: 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 + CRC_SIZE);
|
||||
std::memcpy(payloadStart, commandData, commandDataLen);
|
||||
return returnvalue::OK;
|
||||
if (commandDataLen > MAX_DATA_LENGTH) {
|
||||
return INVALID_LENGTH;
|
||||
}
|
||||
spParams.setFullPayloadLen(commandDataLen + CRC_SIZE);
|
||||
std::memcpy(payloadStart, commandData, commandDataLen);
|
||||
return returnvalue::OK;
|
||||
}
|
||||
|
||||
private:
|
||||
static const size_t MAX_DATA_LENGTH = 11;
|
||||
private:
|
||||
static const size_t MAX_DATA_LENGTH = 11;
|
||||
};
|
||||
|
||||
class TcCamcmdSend : public TcBase {
|
||||
|
@ -260,20 +260,20 @@ ReturnValue_t PlocMPSoCHandler::buildCommandFromCommand(DeviceCommandId_t device
|
||||
break;
|
||||
}
|
||||
case (mpsoc::TC_CAM_TAKE_PIC): {
|
||||
result = prepareTcCamTakePic(commandData, commandDataLen);
|
||||
result = prepareTcCamTakePic(commandData, commandDataLen);
|
||||
break;
|
||||
}
|
||||
case (mpsoc::TC_SIMPLEX_SEND_FILE): {
|
||||
result = prepareTcSimplexSendFile(commandData, commandDataLen);
|
||||
result = prepareTcSimplexSendFile(commandData, commandDataLen);
|
||||
break;
|
||||
}
|
||||
case (mpsoc::TC_DOWNLINK_DATA_MODULATE): {
|
||||
result = prepareTcDownlinkDataModulate(commandData, commandDataLen);
|
||||
result = prepareTcDownlinkDataModulate(commandData, commandDataLen);
|
||||
break;
|
||||
}
|
||||
case (mpsoc::TC_MODE_SNAPSHOT): {
|
||||
result = prepareTcModeSnapshot();
|
||||
break;
|
||||
result = prepareTcModeSnapshot();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
sif::debug << "PlocMPSoCHandler::buildCommandFromCommand: Command not implemented"
|
||||
@ -572,7 +572,7 @@ ReturnValue_t PlocMPSoCHandler::prepareTcCamTakePic(const uint8_t* commandData,
|
||||
}
|
||||
|
||||
ReturnValue_t PlocMPSoCHandler::prepareTcSimplexSendFile(const uint8_t* commandData,
|
||||
size_t commandDataLen) {
|
||||
size_t commandDataLen) {
|
||||
ReturnValue_t result = returnvalue::OK;
|
||||
mpsoc::TcSimplexSendFile tcSimplexSendFile(spParams, sequenceCount);
|
||||
result = tcSimplexSendFile.buildPacket(commandData, commandDataLen);
|
||||
@ -1187,9 +1187,9 @@ std::string PlocMPSoCHandler::getStatusString(uint16_t status) {
|
||||
break;
|
||||
}
|
||||
default:
|
||||
std::stringstream ss;
|
||||
ss << "0x" << std::hex << status;
|
||||
return ss.str();
|
||||
std::stringstream ss;
|
||||
ss << "0x" << std::hex << status;
|
||||
return ss.str();
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
|
@ -49,7 +49,7 @@ void ActuatorCmd::cmdSpeedToRws(int32_t speedRw0, int32_t speedRw1, int32_t spee
|
||||
} else if (rwCmdSpeed[i] < -maxRwSpeed) {
|
||||
rwCmdSpeed[i] = -maxRwSpeed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ActuatorCmd::cmdDipolMtq(const double *dipolMoment, int16_t *dipolMomentActuator,
|
||||
|
Loading…
Reference in New Issue
Block a user