start extending p60 module code
All checks were successful
EIVE/eive-obsw/pipeline/head This commit looks good

This commit is contained in:
2022-08-25 18:19:33 +02:00
parent 86b4747249
commit c0a78e6fef
5 changed files with 107 additions and 115 deletions

View File

@ -7,6 +7,34 @@
#include <fsfw/serialize/SerializeElement.h>
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
class CspParamRequestBase : public SerialLinkedListAdapter<SerializeIF> {
public:
CspParamRequestBase(uint16_t querySize, uint8_t tableId): querySize(querySize), tableId(tableId) {
setLinks();
}
protected:
void setLinks() {
setStart(&cspPort);
cspPort.setNext(&querySize);
querySize.setNext(&action);
action.setNext(&tableId);
tableId.setNext(&payloadlength);
payloadlength.setNext(&checksum);
checksum.setNext(&seq);
seq.setNext(&total);
}
SerializeElement<uint8_t> cspPort = GOMSPACE::PARAM_PORT;
SerializeElement<uint16_t> querySize;
SerializeElement<uint8_t> action = GOMSPACE::ParamRequestIds::GET;
SerializeElement<uint8_t> tableId;
// Default value 0: Fetch whole table.
SerializeElement<uint16_t> payloadlength = 0;
SerializeElement<uint16_t> checksum = GOMSPACE::IGNORE_CHECKSUM;
SerializeElement<uint16_t> seq = 0;
SerializeElement<uint16_t> total = 0;
};
/**
* @brief This class can be used to generated the command for the CspComIF
* to reset the watchdog in a gomspace device.
@ -74,46 +102,22 @@ class CspPingCommand : public SerialLinkedListAdapter<SerializeIF> {
* gomspace device but are required for the CspComIF to get the port
* and the size to query.
*/
class CspSetParamCommand : public SerialLinkedListAdapter<SerializeIF> {
class CspSetParamCommand : public CspParamRequestBase {
public:
CspSetParamCommand(uint16_t querySize_, uint16_t payloadlength_, uint16_t checksum_,
uint16_t seq_, uint16_t total_, uint16_t addr_, const uint8_t *parameter_,
uint8_t parameterCount_)
: querySize(querySize_),
payloadlength(payloadlength_),
checksum(checksum_),
seq(seq_),
total(total_),
CspSetParamCommand(uint16_t querySize_, uint16_t payloadlength_,
uint16_t addr_, const uint8_t *parameter_,
uint8_t parameterCount_, uint8_t tableId = 1)
: CspParamRequestBase(querySize_, tableId),
addr(addr_),
parameter(parameter_, parameterCount_) {
setLinks();
}
private:
CspSetParamCommand(const CspSetParamCommand &command);
void setLinks() {
setStart(&cspPort);
cspPort.setNext(&querySize);
querySize.setNext(&action);
action.setNext(&tableId);
tableId.setNext(&payloadlength);
payloadlength.setNext(&checksum);
checksum.setNext(&seq);
seq.setNext(&total);
total.setNext(&addr);
addr.setNext(&parameter);
CspParamRequestBase::payloadlength = payloadlength_;
CspParamRequestBase::action = GOMSPACE::ParamRequestIds::SET;
}
SerializeElement<uint8_t> cspPort = GOMSPACE::PARAM_PORT;
/* Only a parameter will be set. No data will be queried with this command */
SerializeElement<uint16_t> querySize;
SerializeElement<uint8_t> action = 0xFF; // param set
/* We will never set a parameter in a table other than the configuration
* table */
SerializeElement<uint8_t> tableId = 1;
SerializeElement<uint16_t> payloadlength;
SerializeElement<uint16_t> checksum;
SerializeElement<uint16_t> seq;
SerializeElement<uint16_t> total;
CspSetParamCommand(const CspSetParamCommand &command) = delete;
private:
SerializeElement<uint16_t> addr;
SerializeElement<SerialBufferAdapter<uint8_t>> parameter;
};
@ -126,48 +130,22 @@ class CspSetParamCommand : public SerialLinkedListAdapter<SerializeIF> {
* @note cspPort and querySize only serve as information for the CspComIF
* and will not be transmitted physically to the target device.
*/
class CspGetParamCommand : public SerialLinkedListAdapter<SerializeIF> {
class CspGetParamCommand : public CspParamRequestBase {
public:
/* The size of the header of a gomspace CSP packet. */
static const uint8_t GS_HDR_LENGTH = 12;
CspGetParamCommand(uint16_t querySize_, uint8_t tableId_, uint16_t addresslength_,
uint16_t checksum_, uint16_t seq_, uint16_t total_, uint16_t addr_)
: querySize(querySize_),
tableId(tableId_),
addresslength(addresslength_),
checksum(checksum_),
seq(seq_),
total(total_),
uint16_t addr_)
: CspParamRequestBase(querySize_, tableId_),
addr(addr_) {
fixedValuesInit();
setLinks();
}
private:
CspGetParamCommand(const CspGetParamCommand &command);
void setLinks() {
setStart(&cspPort);
cspPort.setNext(&querySize);
querySize.setNext(&action);
action.setNext(&tableId);
tableId.setNext(&addresslength);
addresslength.setNext(&checksum);
checksum.setNext(&seq);
seq.setNext(&total);
total.setNext(&addr);
CspParamRequestBase::tableId = tableId_;
CspParamRequestBase::payloadlength = addresslength_;
}
void fixedValuesInit() { cspPort.entry = GOMSPACE::PARAM_PORT; }
SerializeElement<uint8_t> cspPort;
SerializeElement<uint16_t> querySize; // size of bytes to query
/* Following information will also be physically transmitted to the target
* device*/
SerializeElement<uint8_t> action = 0x00; // get param
SerializeElement<uint8_t> tableId;
SerializeElement<uint16_t> addresslength;
SerializeElement<uint16_t> checksum;
SerializeElement<uint16_t> seq;
SerializeElement<uint16_t> total;
CspGetParamCommand(const CspGetParamCommand &command) = delete;
private:
SerializeElement<uint16_t> addr;
};
@ -179,37 +157,14 @@ class CspGetParamCommand : public SerialLinkedListAdapter<SerializeIF> {
* @note cspPort and querySize only serve as information for the CspComIF
* and will not be transmitted physically to the target device.
*/
class RequestFullTableCommand : public SerialLinkedListAdapter<SerializeIF> {
class RequestFullTableCommand : public CspParamRequestBase {
public:
RequestFullTableCommand(uint16_t querySize_, uint8_t tableId_)
: querySize(querySize_), tableId(tableId_) {
setLinks();
}
: CspParamRequestBase(querySize_, tableId_) {}
RequestFullTableCommand(const RequestFullTableCommand &command) = delete;
private:
RequestFullTableCommand(const RequestFullTableCommand &command);
void setLinks() {
setStart(&cspPort);
cspPort.setNext(&querySize);
querySize.setNext(&action);
action.setNext(&tableId);
tableId.setNext(&addresslength);
addresslength.setNext(&checksum);
checksum.setNext(&seq);
seq.setNext(&total);
}
SerializeElement<uint8_t> cspPort = GOMSPACE::PARAM_PORT;
/** Size of bytes to query (size of csp header + size of table) */
SerializeElement<uint16_t> querySize;
/* Following information will also be physically transmitted to the target
* device*/
SerializeElement<uint8_t> action = 0x00; // get param
SerializeElement<uint8_t> tableId;
/* Size of address. Set to 0 to get full table */
SerializeElement<uint16_t> addresslength = 0;
SerializeElement<uint16_t> checksum = GOMSPACE::IGNORE_CHECKSUM;
SerializeElement<uint16_t> seq = 0;
SerializeElement<uint16_t> total = 0;
};
/**