continuing on gomspace handlers
This commit is contained in:
parent
1f47c970af
commit
da2acd1fa8
@ -33,69 +33,11 @@ ReturnValue_t GomspaceDeviceHandler::buildTransitionDeviceCommand(DeviceCommandI
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReturnValue_t GomspaceDeviceHandler::handleAction(PrintSwitchVIAction* action) {
|
||||||
ReturnValue_t GomspaceDeviceHandler::handleAction(NoneAction* action) {}
|
return printStatus(action->getId());
|
||||||
ReturnValue_t GomspaceDeviceHandler::handleAction(RebootAction* action) {}
|
}
|
||||||
ReturnValue_t GomspaceDeviceHandler::handleAction(GndwdtResetAction* action) {}
|
ReturnValue_t GomspaceDeviceHandler::handleAction(PrintLatchupsAction* action) {
|
||||||
ReturnValue_t GomspaceDeviceHandler::handleAction(ParamGetAction* action) {}
|
return printStatus(action->getId());
|
||||||
ReturnValue_t GomspaceDeviceHandler::handleAction(ParamSetAction* action) {}
|
|
||||||
ReturnValue_t GomspaceDeviceHandler::handleAction(RequestHkTableAction* action) {}
|
|
||||||
ReturnValue_t GomspaceDeviceHandler::handleAction(PrintSwitchVIAction* action) {}
|
|
||||||
ReturnValue_t GomspaceDeviceHandler::handleAction(PrintLatchupsAction* action) {}
|
|
||||||
|
|
||||||
ReturnValue_t GomspaceDeviceHandler::buildCommandFromCommand(DeviceCommandId_t deviceCommand,
|
|
||||||
const uint8_t* commandData,
|
|
||||||
size_t commandDataLen) {
|
|
||||||
ReturnValue_t result = childCommandHook(deviceCommand, commandData, commandDataLen);
|
|
||||||
switch (deviceCommand) {
|
|
||||||
case (GomspaceCommands::PING): {
|
|
||||||
//result = generatePingCommand(commandData, commandDataLen);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (GomspaceCommands::REBOOT): {
|
|
||||||
generateRebootCommand();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (GomspaceCommands::PARAM_SET): {
|
|
||||||
result = generateSetParamCommand(commandData, commandDataLen);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (GomspaceCommands::PARAM_GET): {
|
|
||||||
result = generateGetParamCommand(commandData, commandDataLen);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (GomspaceCommands::GNDWDT_RESET): {
|
|
||||||
result = generateResetWatchdogCmd();
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (GomspaceCommands::PRINT_SWITCH_V_I):
|
|
||||||
case (GomspaceCommands::PRINT_LATCHUPS): {
|
|
||||||
result = printStatus(deviceCommand);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case (GomspaceCommands::REQUEST_HK_TABLE): {
|
|
||||||
result = generateRequestFullHkTableCmd(hkTableReplySize);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
|
||||||
}
|
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GomspaceDeviceHandler::fillCommandAndReplyMap() {
|
void GomspaceDeviceHandler::fillCommandAndReplyMap() {
|
||||||
@ -182,7 +124,8 @@ ReturnValue_t GomspaceDeviceHandler::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
if (*packet != PARAM_SET_OK) {
|
if (*packet != PARAM_SET_OK) {
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
setParamCallback(setParamCacher, true);
|
// TODO fix
|
||||||
|
setParamCallback(setParamCacher.getParameter(), setParamCacher.getParameter(), setParamCacher.getParameterSize(), true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (GomspaceCommands::REQUEST_HK_TABLE): {
|
case (GomspaceCommands::REQUEST_HK_TABLE): {
|
||||||
@ -197,29 +140,23 @@ ReturnValue_t GomspaceDeviceHandler::interpretDeviceReply(DeviceCommandId_t id,
|
|||||||
|
|
||||||
void GomspaceDeviceHandler::setNormalDatapoolEntriesInvalid() {}
|
void GomspaceDeviceHandler::setNormalDatapoolEntriesInvalid() {}
|
||||||
|
|
||||||
ReturnValue_t GomspaceDeviceHandler::generateSetParamCommand(const uint8_t* commandData,
|
ReturnValue_t GomspaceDeviceHandler::handleAction(ParamSetAction* action) {
|
||||||
size_t commandDataLen) {
|
|
||||||
ReturnValue_t result =
|
|
||||||
setParamCacher.deSerialize(&commandData, &commandDataLen, SerializeIF::Endianness::BIG);
|
|
||||||
// This breaks layering but I really don't want to accept this command..
|
// This breaks layering but I really don't want to accept this command..
|
||||||
if (setParamCacher.getAddress() == PDU2::CONFIG_ADDRESS_OUT_EN_Q7S and
|
if (action->address == PDU2::CONFIG_ADDRESS_OUT_EN_Q7S and
|
||||||
this->getObjectId() == objects::PDU2_HANDLER) {
|
this->getObjectId() == objects::PDU2_HANDLER) {
|
||||||
triggerEvent(power::SWITCHING_Q7S_DENIED, 0, 0);
|
triggerEvent(power::SWITCHING_Q7S_DENIED, 0, 0);
|
||||||
return HasReturnvaluesIF::RETURN_FAILED;
|
return HasReturnvaluesIF::RETURN_FAILED;
|
||||||
}
|
}
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
//cache for later use
|
||||||
sif::error << "GomspaceDeviceHandler: Failed to deserialize set parameter "
|
setParamCacher.set(action->address, action->parameter,
|
||||||
"message"
|
static_cast<uint8_t>(action->parameterSize.value));
|
||||||
<< std::endl;
|
ReturnValue_t result = setParamCallback(action->address, action->parameter,
|
||||||
return result;
|
static_cast<uint8_t>(action->parameterSize.value), false);
|
||||||
}
|
|
||||||
result = setParamCallback(setParamCacher, false);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
/* Get and check address */
|
/* Get and check address */
|
||||||
uint16_t address = setParamCacher.getAddress();
|
if (action->address > maxConfigTableAddress) {
|
||||||
if (address > maxConfigTableAddress) {
|
|
||||||
sif::error << "GomspaceDeviceHandler: Invalid address for set parameter "
|
sif::error << "GomspaceDeviceHandler: Invalid address for set parameter "
|
||||||
<< "action" << std::endl;
|
<< "action" << std::endl;
|
||||||
return INVALID_ADDRESS;
|
return INVALID_ADDRESS;
|
||||||
@ -229,13 +166,52 @@ ReturnValue_t GomspaceDeviceHandler::generateSetParamCommand(const uint8_t* comm
|
|||||||
uint16_t total = 0;
|
uint16_t total = 0;
|
||||||
/* CSP reply only contains the transaction state */
|
/* CSP reply only contains the transaction state */
|
||||||
uint16_t querySize = 1;
|
uint16_t querySize = 1;
|
||||||
const uint8_t* parameterPtr = setParamCacher.getParameter();
|
size_t parameterSize = 0;
|
||||||
uint8_t parameterSize = setParamCacher.getParameterSize();
|
uint8_t parameterBytes[4];
|
||||||
uint16_t payloadlength = sizeof(address) + parameterSize;
|
uint8_t* uselessPointer = parameterBytes;
|
||||||
|
switch (action->parameterSize.value) {
|
||||||
|
case ParamSetAction::ParameterByteSize::ONE_BYTE: {
|
||||||
|
if (action->parameter > 255) {
|
||||||
|
return INVALID_PARAMETERS;
|
||||||
|
}
|
||||||
|
uint8_t oneByte = action->parameter.value;
|
||||||
|
result = SerializeAdapter::serialize<uint8_t>(&oneByte, &uselessPointer, ¶meterSize,
|
||||||
|
sizeof(parameterBytes),
|
||||||
|
SerializeIF::Endianness::BIG);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
parameterSize = 1;
|
||||||
|
} break;
|
||||||
|
case ParamSetAction::ParameterByteSize::TWO_BYTES: {
|
||||||
|
if (action->parameter > 65535) {
|
||||||
|
return INVALID_PARAMETERS;
|
||||||
|
}
|
||||||
|
uint16_t twoBytes = action->parameter.value;
|
||||||
|
result = SerializeAdapter::serialize<uint16_t>(&twoBytes, &uselessPointer, ¶meterSize,
|
||||||
|
sizeof(parameterBytes),
|
||||||
|
SerializeIF::Endianness::BIG);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
parameterSize = 2;
|
||||||
|
} break;
|
||||||
|
case ParamSetAction::ParameterByteSize::FOUR_BYTES:
|
||||||
|
result = SerializeAdapter::serialize<uint32_t>(&(action->parameter.value), &uselessPointer,
|
||||||
|
¶meterSize, sizeof(parameterBytes),
|
||||||
|
SerializeIF::Endianness::BIG);
|
||||||
|
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
parameterSize = 4;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t payloadlength = sizeof(action->address) + parameterSize;
|
||||||
|
|
||||||
/* Generate command for CspComIF */
|
/* Generate command for CspComIF */
|
||||||
CspSetParamCommand setParamCmd(querySize, payloadlength, checksum, seq, total, address,
|
CspSetParamCommand setParamCmd(querySize, payloadlength, checksum, seq, total, action->address,
|
||||||
parameterPtr, parameterSize);
|
parameterBytes, parameterSize);
|
||||||
size_t cspPacketLen = 0;
|
size_t cspPacketLen = 0;
|
||||||
uint8_t* buffer = cspPacket;
|
uint8_t* buffer = cspPacket;
|
||||||
result = setParamCmd.serialize(&buffer, &cspPacketLen, sizeof(cspPacket),
|
result = setParamCmd.serialize(&buffer, &cspPacketLen, sizeof(cspPacket),
|
||||||
@ -259,34 +235,18 @@ ReturnValue_t GomspaceDeviceHandler::generateSetParamCommand(const uint8_t* comm
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t GomspaceDeviceHandler::generateGetParamCommand(const uint8_t* commandData,
|
ReturnValue_t GomspaceDeviceHandler::handleAction(ParamGetAction* action) {
|
||||||
size_t commandDataLen) {
|
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
/* Unpack the received action message */
|
uint8_t tableId = static_cast<uint8_t>(action->tableId.value);
|
||||||
GetParamMessageUnpacker getParamMessage;
|
|
||||||
result = getParamMessage.deSerialize(&commandData, &commandDataLen, SerializeIF::Endianness::BIG);
|
|
||||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
|
||||||
sif::error << "Failed to deserialize message to extract information "
|
|
||||||
"from get parameter message"
|
|
||||||
<< std::endl;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
/* Get an check table id to read from */
|
|
||||||
uint8_t tableId = getParamMessage.getTableId();
|
|
||||||
if (tableId != CONFIG_TABLE_ID && tableId != HK_TABLE_ID) {
|
|
||||||
sif::error << "GomspaceDeviceHandler: Invalid table id in get parameter"
|
|
||||||
" message"
|
|
||||||
<< std::endl;
|
|
||||||
return INVALID_TABLE_ID;
|
|
||||||
}
|
|
||||||
/* Get and check address */
|
/* Get and check address */
|
||||||
uint16_t address = getParamMessage.getAddress();
|
uint16_t address = action->address;
|
||||||
if (address > maxHkTableAddress && tableId == HK_TABLE_ID) {
|
if (address > maxHkTableAddress && tableId == ParamGetAction::TableId::HK_TABLE_ID) {
|
||||||
sif::error << "GomspaceDeviceHandler: Invalid address to get parameter from "
|
sif::error << "GomspaceDeviceHandler: Invalid address to get parameter from "
|
||||||
<< "housekeeping table" << std::endl;
|
<< "housekeeping table" << std::endl;
|
||||||
return INVALID_ADDRESS;
|
return INVALID_ADDRESS;
|
||||||
}
|
}
|
||||||
if (address > maxConfigTableAddress && tableId == CONFIG_TABLE_ID) {
|
if (address > maxConfigTableAddress && tableId == ParamGetAction::TableId::CONFIG_TABLE_ID) {
|
||||||
sif::error << "GomspaceDeviceHandler: Invalid address to get parameter from "
|
sif::error << "GomspaceDeviceHandler: Invalid address to get parameter from "
|
||||||
<< "configuration table" << std::endl;
|
<< "configuration table" << std::endl;
|
||||||
return INVALID_ADDRESS;
|
return INVALID_ADDRESS;
|
||||||
@ -295,12 +255,7 @@ ReturnValue_t GomspaceDeviceHandler::generateGetParamCommand(const uint8_t* comm
|
|||||||
uint16_t checksum = GOMSPACE::IGNORE_CHECKSUM;
|
uint16_t checksum = GOMSPACE::IGNORE_CHECKSUM;
|
||||||
uint16_t seq = 0;
|
uint16_t seq = 0;
|
||||||
uint16_t total = 0;
|
uint16_t total = 0;
|
||||||
uint8_t parameterSize = getParamMessage.getParameterSize();
|
uint8_t parameterSize = static_cast<uint8_t>(action->parameterSize.value);
|
||||||
if (parameterSize > sizeof(uint32_t)) {
|
|
||||||
sif::error << "GomspaceDeviceHandler: GET_PARAM: Invalid parameter "
|
|
||||||
<< "size" << std::endl;
|
|
||||||
return INVALID_PARAM_SIZE;
|
|
||||||
}
|
|
||||||
uint16_t querySize = parameterSize + GOMSPACE::GS_HDR_LENGTH;
|
uint16_t querySize = parameterSize + GOMSPACE::GS_HDR_LENGTH;
|
||||||
|
|
||||||
/* Generate the CSP command to send to the P60 Dock */
|
/* Generate the CSP command to send to the P60 Dock */
|
||||||
@ -313,12 +268,14 @@ ReturnValue_t GomspaceDeviceHandler::generateGetParamCommand(const uint8_t* comm
|
|||||||
sif::error << "GomspaceDeviceHandler: Failed to serialize command to "
|
sif::error << "GomspaceDeviceHandler: Failed to serialize command to "
|
||||||
<< "get parameter" << std::endl;
|
<< "get parameter" << std::endl;
|
||||||
}
|
}
|
||||||
if (cspPacketLen > MAX_PACKET_LEN) {
|
|
||||||
|
// checked by serialize above
|
||||||
|
/* if (cspPacketLen > MAX_PACKET_LEN) {
|
||||||
sif::error << "GomspaceDeviceHandler: Received invalid get parameter "
|
sif::error << "GomspaceDeviceHandler: Received invalid get parameter "
|
||||||
"command"
|
"command"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
return PACKET_TOO_LONG;
|
return PACKET_TOO_LONG;
|
||||||
}
|
}*/
|
||||||
rawPacket = cspPacket;
|
rawPacket = cspPacket;
|
||||||
rawPacketLen = cspPacketLen;
|
rawPacketLen = cspPacketLen;
|
||||||
rememberRequestedSize = querySize;
|
rememberRequestedSize = querySize;
|
||||||
@ -327,7 +284,7 @@ ReturnValue_t GomspaceDeviceHandler::generateGetParamCommand(const uint8_t* comm
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t GomspaceDeviceHandler::handleAction(PingAction* action) {
|
ReturnValue_t GomspaceDeviceHandler::handleAction(PingAction* action) {
|
||||||
/*CspPingCommand cspPingCommand(commandData, commandDataLen);
|
CspPingCommand cspPingCommand(&action->pingData.value, 1); // TODO array
|
||||||
size_t cspPacketLen = 0;
|
size_t cspPacketLen = 0;
|
||||||
uint8_t* buffer = cspPacket;
|
uint8_t* buffer = cspPacket;
|
||||||
ReturnValue_t result = cspPingCommand.serialize(&buffer, &cspPacketLen, sizeof(cspPacket),
|
ReturnValue_t result = cspPingCommand.serialize(&buffer, &cspPacketLen, sizeof(cspPacket),
|
||||||
@ -336,24 +293,27 @@ ReturnValue_t GomspaceDeviceHandler::handleAction(PingAction* action) {
|
|||||||
sif::error << "GomspaceDeviceHandler: Failed to serialize ping command" << std::endl;
|
sif::error << "GomspaceDeviceHandler: Failed to serialize ping command" << std::endl;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
/* Checked by the serialize function
|
||||||
if (cspPacketLen > MAX_PACKET_LEN) {
|
if (cspPacketLen > MAX_PACKET_LEN) {
|
||||||
sif::error << "GomspaceDeviceHandler: Received invalid ping message" << std::endl;
|
sif::error << "GomspaceDeviceHandler: Received invalid ping message" << std::endl;
|
||||||
return PACKET_TOO_LONG;
|
return PACKET_TOO_LONG;
|
||||||
}
|
}*/
|
||||||
rawPacket = cspPacket;
|
rawPacket = cspPacket;
|
||||||
rawPacketLen = cspPacketLen;*/
|
rawPacketLen = cspPacketLen;
|
||||||
rememberCommandId = GomspaceCommands::PING;
|
rememberCommandId = GomspaceCommands::PING;
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GomspaceDeviceHandler::generateRebootCommand() {
|
ReturnValue_t GomspaceDeviceHandler::handleAction(RebootAction* action) {
|
||||||
uint8_t cspPort = GOMSPACE::REBOOT_PORT;
|
uint8_t cspPort = GOMSPACE::REBOOT_PORT;
|
||||||
uint16_t querySize = 0;
|
uint16_t querySize = 0;
|
||||||
*cspPacket = GOMSPACE::REBOOT_PORT;
|
*cspPacket = GOMSPACE::REBOOT_PORT;
|
||||||
|
// TODO the following two lines look strange...
|
||||||
*(cspPacket + 1) = querySize;
|
*(cspPacket + 1) = querySize;
|
||||||
size_t cspPacketLen = sizeof(cspPort) + sizeof(cspPacketLen);
|
size_t cspPacketLen = sizeof(cspPort) + sizeof(cspPacketLen);
|
||||||
rawPacket = cspPacket;
|
rawPacket = cspPacket;
|
||||||
rawPacketLen = cspPacketLen;
|
rawPacketLen = cspPacketLen;
|
||||||
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t GomspaceDeviceHandler::childCommandHook(DeviceCommandId_t cmd,
|
ReturnValue_t GomspaceDeviceHandler::childCommandHook(DeviceCommandId_t cmd,
|
||||||
@ -362,8 +322,8 @@ ReturnValue_t GomspaceDeviceHandler::childCommandHook(DeviceCommandId_t cmd,
|
|||||||
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t GomspaceDeviceHandler::setParamCallback(SetParamMessageUnpacker& unpacker,
|
ReturnValue_t GomspaceDeviceHandler::setParamCallback(uint16_t address, uint32_t value,
|
||||||
bool afterExecution) {
|
uint8_t valueBytes, bool afterExecution) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -405,7 +365,7 @@ ReturnValue_t GomspaceDeviceHandler::initializePduPool(
|
|||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t GomspaceDeviceHandler::generateResetWatchdogCmd() {
|
ReturnValue_t GomspaceDeviceHandler::handleAction(GndwdtResetAction* action) {
|
||||||
WatchdogResetCommand watchdogResetCommand;
|
WatchdogResetCommand watchdogResetCommand;
|
||||||
size_t cspPacketLen = 0;
|
size_t cspPacketLen = 0;
|
||||||
uint8_t* buffer = cspPacket;
|
uint8_t* buffer = cspPacket;
|
||||||
@ -424,9 +384,9 @@ ReturnValue_t GomspaceDeviceHandler::generateResetWatchdogCmd() {
|
|||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t GomspaceDeviceHandler::generateRequestFullHkTableCmd(uint16_t hkTableReplySize) {
|
ReturnValue_t GomspaceDeviceHandler::handleAction(RequestHkTableAction* action) {
|
||||||
uint16_t querySize = hkTableReplySize;
|
uint16_t querySize = hkTableReplySize;
|
||||||
uint8_t tableId = HK_TABLE_ID;
|
uint8_t tableId = ParamGetAction::TableId::HK_TABLE_ID;
|
||||||
RequestFullTableCommand requestFullTableCommand(querySize, tableId);
|
RequestFullTableCommand requestFullTableCommand(querySize, tableId);
|
||||||
|
|
||||||
size_t cspPacketLen = 0;
|
size_t cspPacketLen = 0;
|
||||||
|
@ -49,11 +49,34 @@ class GomspaceDeviceHandler : public DeviceHandlerBase {
|
|||||||
*/
|
*/
|
||||||
void setModeNormal();
|
void setModeNormal();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Function to generate the ping command for the ComIF.
|
||||||
|
*/
|
||||||
ReturnValue_t handleAction(PingAction *action);
|
ReturnValue_t handleAction(PingAction *action);
|
||||||
ReturnValue_t handleAction(NoneAction *action);
|
|
||||||
|
/**
|
||||||
|
* @brief Function to generate the command to reboot a gomspace device
|
||||||
|
* via the ComIF.
|
||||||
|
*/
|
||||||
ReturnValue_t handleAction(RebootAction *action);
|
ReturnValue_t handleAction(RebootAction *action);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Function to generate the command to force a ground watchdog
|
||||||
|
* reset in a gomspace device.
|
||||||
|
*/
|
||||||
ReturnValue_t handleAction(GndwdtResetAction *action);
|
ReturnValue_t handleAction(GndwdtResetAction *action);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Function to generate the command to get a parameter from a
|
||||||
|
* gomspace device. Command will be sent to the ComIF over the
|
||||||
|
* rawPacket buffer.
|
||||||
|
*/
|
||||||
ReturnValue_t handleAction(ParamGetAction *action);
|
ReturnValue_t handleAction(ParamGetAction *action);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Function to generate the command to set a parameter. Command
|
||||||
|
* will be sent to the ComIF over the rawPacket buffer.
|
||||||
|
*/
|
||||||
ReturnValue_t handleAction(ParamSetAction *action);
|
ReturnValue_t handleAction(ParamSetAction *action);
|
||||||
ReturnValue_t handleAction(RequestHkTableAction *action);
|
ReturnValue_t handleAction(RequestHkTableAction *action);
|
||||||
ReturnValue_t handleAction(PrintSwitchVIAction *action);
|
ReturnValue_t handleAction(PrintSwitchVIAction *action);
|
||||||
@ -63,8 +86,6 @@ class GomspaceDeviceHandler : public DeviceHandlerBase {
|
|||||||
static const uint8_t MAX_PACKET_LEN = 36;
|
static const uint8_t MAX_PACKET_LEN = 36;
|
||||||
static const uint8_t PARAM_SET_OK = 1;
|
static const uint8_t PARAM_SET_OK = 1;
|
||||||
static const uint8_t PING_REPLY_SIZE = 2;
|
static const uint8_t PING_REPLY_SIZE = 2;
|
||||||
static const uint8_t CONFIG_TABLE_ID = 1;
|
|
||||||
static const uint8_t HK_TABLE_ID = 4;
|
|
||||||
|
|
||||||
uint8_t rememberRequestedSize = 0;
|
uint8_t rememberRequestedSize = 0;
|
||||||
uint8_t rememberCommandId = GomspaceCommands::NONE;
|
uint8_t rememberCommandId = GomspaceCommands::NONE;
|
||||||
@ -79,32 +100,24 @@ class GomspaceDeviceHandler : public DeviceHandlerBase {
|
|||||||
LocalPoolDataSetBase *hkTableDataset = nullptr;
|
LocalPoolDataSetBase *hkTableDataset = nullptr;
|
||||||
|
|
||||||
PingAction pingAction = PingAction(this);
|
PingAction pingAction = PingAction(this);
|
||||||
NoneAction noneAction = NoneAction(this);
|
RebootAction rebootAction = RebootAction(this);
|
||||||
RebootAction rebootAction = RebootAction(this);
|
GndwdtResetAction gndwdtResetAction = GndwdtResetAction(this);
|
||||||
GndwdtResetAction gndwdtResetAction = GndwdtResetAction(this);
|
ParamGetAction paramGetAction = ParamGetAction(this);
|
||||||
ParamGetAction paramGetAction = ParamGetAction(this);
|
ParamSetAction paramSetAction = ParamSetAction(this);
|
||||||
ParamSetAction paramSetAction = ParamSetAction(this);
|
RequestHkTableAction requestHkTableAction = RequestHkTableAction(this);
|
||||||
RequestHkTableAction requestHkTableAction = RequestHkTableAction(this);
|
PrintSwitchVIAction printSwitchVIAction = PrintSwitchVIAction(this);
|
||||||
PrintSwitchVIAction printSwitchVIAction = PrintSwitchVIAction(this);
|
PrintLatchupsAction printLatchupsAction = PrintLatchupsAction(this);
|
||||||
PrintLatchupsAction printLatchupsAction = PrintLatchupsAction(this);
|
|
||||||
|
|
||||||
void doStartUp() override;
|
void doStartUp() override;
|
||||||
void doShutDown() override;
|
void doShutDown() override;
|
||||||
virtual ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override;
|
virtual ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override;
|
||||||
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override;
|
ReturnValue_t buildTransitionDeviceCommand(DeviceCommandId_t *id) override;
|
||||||
virtual void fillCommandAndReplyMap() override;
|
virtual void fillCommandAndReplyMap() override;
|
||||||
ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, const uint8_t *commandData,
|
|
||||||
size_t commandDataLen) override;
|
|
||||||
ReturnValue_t scanForReply(const uint8_t *start, size_t remainingSize, DeviceCommandId_t *foundId,
|
ReturnValue_t scanForReply(const uint8_t *start, size_t remainingSize, DeviceCommandId_t *foundId,
|
||||||
size_t *foundLen) override;
|
size_t *foundLen) override;
|
||||||
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override;
|
ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override;
|
||||||
void setNormalDatapoolEntriesInvalid() override;
|
void setNormalDatapoolEntriesInvalid() override;
|
||||||
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
uint32_t getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) override;
|
||||||
/**
|
|
||||||
* @brief The command to generate a request to receive the full housekeeping table is device
|
|
||||||
* specific. Thus the child has to build this command.
|
|
||||||
*/
|
|
||||||
virtual ReturnValue_t generateRequestFullHkTableCmd(uint16_t hkTableSize);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This command handles printing the HK table to the console. This is useful for debugging
|
* This command handles printing the HK table to the console. This is useful for debugging
|
||||||
@ -138,46 +151,18 @@ PrintLatchupsAction printLatchupsAction = PrintLatchupsAction(this);
|
|||||||
std::array<uint8_t, PDU::CHANNELS_LEN> initOutEnb);
|
std::array<uint8_t, PDU::CHANNELS_LEN> initOutEnb);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SetParamMessageUnpacker setParamCacher;
|
SetParamMessageCache setParamCacher;
|
||||||
/**
|
|
||||||
* @brief Function to generate the command to set a parameter. Command
|
|
||||||
* will be sent to the ComIF over the rawPacket buffer.
|
|
||||||
*/
|
|
||||||
ReturnValue_t generateSetParamCommand(const uint8_t *commandData, size_t commandDataLen);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback is called on a parameter set command. It is called before executing it and after
|
* Callback is called on a parameter set command. It is called before executing it and
|
||||||
* after successful execution
|
* after successful execution
|
||||||
* @param unpacker Passed before
|
* @param unpacker Passed before
|
||||||
* @param beforeSet False for callback before execution, true if called after successful
|
* @param beforeSet False for callback before execution, true if called after successful
|
||||||
* execution
|
* execution
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
virtual ReturnValue_t setParamCallback(SetParamMessageUnpacker &unpacker, bool afterExecution);
|
virtual ReturnValue_t setParamCallback(uint16_t address, uint32_t value, uint8_t valueBytes,
|
||||||
|
bool afterExecution);
|
||||||
/**
|
|
||||||
* @brief Function to generate the command to get a parameter from a
|
|
||||||
* gomspace device. Command will be sent to the ComIF over the
|
|
||||||
* rawPacket buffer.
|
|
||||||
*/
|
|
||||||
ReturnValue_t generateGetParamCommand(const uint8_t *commandData, size_t commandDataLen);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Function to generate the ping command for the ComIF.
|
|
||||||
*/
|
|
||||||
//ReturnValue_t generatePingCommand(const uint8_t *commandData, size_t commandDataLen);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Function to generate the command to reboot a gomspace device
|
|
||||||
* via the ComIF.
|
|
||||||
*/
|
|
||||||
void generateRebootCommand();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Function to generate the command to force a ground watchdog
|
|
||||||
* reset in a gomspace device.
|
|
||||||
*/
|
|
||||||
ReturnValue_t generateResetWatchdogCmd();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MISSION_DEVICES_GOMSPACEDEVICEHANDLER_H_ */
|
#endif /* MISSION_DEVICES_GOMSPACEDEVICEHANDLER_H_ */
|
||||||
|
@ -29,49 +29,48 @@ void PDU1Handler::assignChannelHookFunction(GOMSPACE::ChannelSwitchHook hook, vo
|
|||||||
this->hookArgs = args;
|
this->hookArgs = args;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PDU1Handler::setParamCallback(SetParamMessageUnpacker &unpacker,
|
ReturnValue_t PDU1Handler::setParamCallback(uint16_t address, uint32_t value, uint8_t valueBytes, bool afterExecution) {
|
||||||
bool afterExecution) {
|
|
||||||
using namespace PDU1;
|
using namespace PDU1;
|
||||||
GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU1;
|
GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU1;
|
||||||
if (not afterExecution) {
|
if (not afterExecution) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
if (channelSwitchHook != nullptr and unpacker.getParameterSize() == 1) {
|
if (channelSwitchHook != nullptr and valueBytes == 1) {
|
||||||
switch (unpacker.getAddress()) {
|
switch (address) {
|
||||||
case (CONFIG_ADDRESS_OUT_EN_TCS_BOARD_3V3): {
|
case (CONFIG_ADDRESS_OUT_EN_TCS_BOARD_3V3): {
|
||||||
channelSwitchHook(pdu, 0, unpacker.getParameter()[0], hookArgs);
|
channelSwitchHook(pdu, 0, value, hookArgs);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (CONFIG_ADDRESS_OUT_EN_SYRLINKS): {
|
case (CONFIG_ADDRESS_OUT_EN_SYRLINKS): {
|
||||||
channelSwitchHook(pdu, 1, unpacker.getParameter()[0], hookArgs);
|
channelSwitchHook(pdu, 1, value, hookArgs);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (CONFIG_ADDRESS_OUT_EN_STAR_TRACKER): {
|
case (CONFIG_ADDRESS_OUT_EN_STAR_TRACKER): {
|
||||||
channelSwitchHook(pdu, 2, unpacker.getParameter()[0], hookArgs);
|
channelSwitchHook(pdu, 2, value, hookArgs);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (CONFIG_ADDRESS_OUT_EN_MGT): {
|
case (CONFIG_ADDRESS_OUT_EN_MGT): {
|
||||||
channelSwitchHook(pdu, 3, unpacker.getParameter()[0], hookArgs);
|
channelSwitchHook(pdu, 3, value, hookArgs);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (CONFIG_ADDRESS_OUT_EN_SUS_NOMINAL): {
|
case (CONFIG_ADDRESS_OUT_EN_SUS_NOMINAL): {
|
||||||
channelSwitchHook(pdu, 4, unpacker.getParameter()[0], hookArgs);
|
channelSwitchHook(pdu, 4, value, hookArgs);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (CONFIG_ADDRESS_OUT_EN_SOLAR_CELL_EXP): {
|
case (CONFIG_ADDRESS_OUT_EN_SOLAR_CELL_EXP): {
|
||||||
channelSwitchHook(pdu, 5, unpacker.getParameter()[0], hookArgs);
|
channelSwitchHook(pdu, 5, value, hookArgs);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (CONFIG_ADDRESS_OUT_EN_PLOC): {
|
case (CONFIG_ADDRESS_OUT_EN_PLOC): {
|
||||||
channelSwitchHook(pdu, 6, unpacker.getParameter()[0], hookArgs);
|
channelSwitchHook(pdu, 6, value, hookArgs);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (CONFIG_ADDRESS_OUT_EN_ACS_BOARD_SIDE_A): {
|
case (CONFIG_ADDRESS_OUT_EN_ACS_BOARD_SIDE_A): {
|
||||||
channelSwitchHook(pdu, 7, unpacker.getParameter()[0], hookArgs);
|
channelSwitchHook(pdu, 7, value, hookArgs);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (CONFIG_ADDRESS_OUT_EN_CHANNEL8): {
|
case (CONFIG_ADDRESS_OUT_EN_CHANNEL8): {
|
||||||
channelSwitchHook(pdu, 8, unpacker.getParameter()[0], hookArgs);
|
channelSwitchHook(pdu, 8, value, hookArgs);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ class PDU1Handler : public GomspaceDeviceHandler {
|
|||||||
virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t* packet) override;
|
virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t* packet) override;
|
||||||
ReturnValue_t printStatus(DeviceCommandId_t cmd) override;
|
ReturnValue_t printStatus(DeviceCommandId_t cmd) override;
|
||||||
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
||||||
ReturnValue_t setParamCallback(SetParamMessageUnpacker& unpacker, bool afterExectuion) override;
|
ReturnValue_t setParamCallback(uint16_t address, uint32_t value, uint8_t valueBytes, bool afterExecution) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr uint8_t MAX_CHANNEL_STR_WIDTH = 24;
|
static constexpr uint8_t MAX_CHANNEL_STR_WIDTH = 24;
|
||||||
|
@ -127,49 +127,48 @@ void PDU2Handler::printHkTableLatchups() {
|
|||||||
printerHelper("Payload Camera", Channels::PAYLOAD_CAMERA);
|
printerHelper("Payload Camera", Channels::PAYLOAD_CAMERA);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PDU2Handler::setParamCallback(SetParamMessageUnpacker &unpacker,
|
ReturnValue_t PDU2Handler::setParamCallback(uint16_t address, uint32_t value, uint8_t valueBytes, bool afterExecution) {
|
||||||
bool afterExecution) {
|
|
||||||
using namespace PDU2;
|
using namespace PDU2;
|
||||||
GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU2;
|
GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU2;
|
||||||
if (not afterExecution) {
|
if (not afterExecution) {
|
||||||
return HasReturnvaluesIF::RETURN_OK;
|
return HasReturnvaluesIF::RETURN_OK;
|
||||||
}
|
}
|
||||||
if (channelSwitchHook != nullptr and unpacker.getParameterSize() == 1) {
|
if (channelSwitchHook != nullptr and valueBytes == 1) {
|
||||||
switch (unpacker.getAddress()) {
|
switch (address) {
|
||||||
case (CONFIG_ADDRESS_OUT_EN_Q7S): {
|
case (CONFIG_ADDRESS_OUT_EN_Q7S): {
|
||||||
channelSwitchHook(pdu, 0, unpacker.getParameter()[0], hookArgs);
|
channelSwitchHook(pdu, 0, value, hookArgs);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (CONFIG_ADDRESS_OUT_EN_PAYLOAD_PCDU_CH1): {
|
case (CONFIG_ADDRESS_OUT_EN_PAYLOAD_PCDU_CH1): {
|
||||||
channelSwitchHook(pdu, 1, unpacker.getParameter()[0], hookArgs);
|
channelSwitchHook(pdu, 1, value, hookArgs);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (CONFIG_ADDRESS_OUT_EN_RW): {
|
case (CONFIG_ADDRESS_OUT_EN_RW): {
|
||||||
channelSwitchHook(pdu, 2, unpacker.getParameter()[0], hookArgs);
|
channelSwitchHook(pdu, 2, value, hookArgs);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (CONFIG_ADDRESS_OUT_EN_TCS_BOARD_HEATER_IN): {
|
case (CONFIG_ADDRESS_OUT_EN_TCS_BOARD_HEATER_IN): {
|
||||||
channelSwitchHook(pdu, 3, unpacker.getParameter()[0], hookArgs);
|
channelSwitchHook(pdu, 3, value, hookArgs);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (CONFIG_ADDRESS_OUT_EN_SUS_REDUNDANT): {
|
case (CONFIG_ADDRESS_OUT_EN_SUS_REDUNDANT): {
|
||||||
channelSwitchHook(pdu, 4, unpacker.getParameter()[0], hookArgs);
|
channelSwitchHook(pdu, 4, value, hookArgs);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (CONFIG_ADDRESS_OUT_EN_DEPLOYMENT_MECHANISM): {
|
case (CONFIG_ADDRESS_OUT_EN_DEPLOYMENT_MECHANISM): {
|
||||||
channelSwitchHook(pdu, 5, unpacker.getParameter()[0], hookArgs);
|
channelSwitchHook(pdu, 5, value, hookArgs);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (CONFIG_ADDRESS_OUT_EN_PAYLOAD_PCDU_CH6): {
|
case (CONFIG_ADDRESS_OUT_EN_PAYLOAD_PCDU_CH6): {
|
||||||
channelSwitchHook(pdu, 6, unpacker.getParameter()[0], hookArgs);
|
channelSwitchHook(pdu, 6, value, hookArgs);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (CONFIG_ADDRESS_OUT_EN_ACS_BOARD_SIDE_B): {
|
case (CONFIG_ADDRESS_OUT_EN_ACS_BOARD_SIDE_B): {
|
||||||
channelSwitchHook(pdu, 7, unpacker.getParameter()[0], hookArgs);
|
channelSwitchHook(pdu, 7, value, hookArgs);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case (CONFIG_ADDRESS_OUT_EN_PAYLOAD_CAMERA): {
|
case (CONFIG_ADDRESS_OUT_EN_PAYLOAD_CAMERA): {
|
||||||
channelSwitchHook(pdu, 8, unpacker.getParameter()[0], hookArgs);
|
channelSwitchHook(pdu, 8, value, hookArgs);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ class PDU2Handler : public GomspaceDeviceHandler {
|
|||||||
virtual ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
|
virtual ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
|
||||||
virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t* packet) override;
|
virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t* packet) override;
|
||||||
ReturnValue_t printStatus(DeviceCommandId_t cmd) override;
|
ReturnValue_t printStatus(DeviceCommandId_t cmd) override;
|
||||||
ReturnValue_t setParamCallback(SetParamMessageUnpacker& unpacker, bool afterExecution) override;
|
ReturnValue_t setParamCallback(uint16_t address, uint32_t value, uint8_t valueBytes, bool afterExecution) override;
|
||||||
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -332,14 +332,37 @@ class Pdu2FullTableReply : public SerialLinkedListAdapter<SerializeIF> {
|
|||||||
LinkedElement<SerializeIF> dataset;
|
LinkedElement<SerializeIF> dataset;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SetParamMessageCache {
|
||||||
|
public:
|
||||||
|
SetParamMessageCache(): address(0), parameter(0), parameterSize(1) {}
|
||||||
|
|
||||||
|
void set(uint16_t address, uint32_t parameter, uint8_t parameterSize) {
|
||||||
|
this->address = address;
|
||||||
|
this->parameter = parameter;
|
||||||
|
this->parameterSize = parameterSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t getAddress() { return address; }
|
||||||
|
|
||||||
|
uint32_t getParameter() { return parameter; }
|
||||||
|
|
||||||
|
uint8_t getParameterSize() { return parameterSize; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint16_t address;
|
||||||
|
uint32_t parameter;
|
||||||
|
uint8_t parameterSize;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This class helps to unpack information from an action message
|
* @brief This class helps to unpack information from an action message
|
||||||
* to set a parameter in gomspace devices. The action message can be
|
* to set a parameter in gomspace devices. The action message can be
|
||||||
* for example received from the PUS Service 8.
|
* for example received from the PUS Service 8.
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
class SetParamMessageUnpacker : public SerialLinkedListAdapter<SerializeIF> {
|
class SetParamMessageUnpacker : public SerialLinkedListAdapter<SerializeIF> {
|
||||||
public:
|
public:
|
||||||
/* Largest parameter is a uint32_t */
|
// Largest parameter is a uint32_t
|
||||||
static const uint32_t MAX_SIZE = 4;
|
static const uint32_t MAX_SIZE = 4;
|
||||||
|
|
||||||
SetParamMessageUnpacker() { setLinks(); }
|
SetParamMessageUnpacker() { setLinks(); }
|
||||||
@ -358,7 +381,7 @@ class SetParamMessageUnpacker : public SerialLinkedListAdapter<SerializeIF> {
|
|||||||
SetParamMessageUnpacker(const SetParamMessageUnpacker &message);
|
SetParamMessageUnpacker(const SetParamMessageUnpacker &message);
|
||||||
SerializeElement<uint16_t> address;
|
SerializeElement<uint16_t> address;
|
||||||
SerializeElement<SerialFixedArrayListAdapter<uint8_t, MAX_SIZE, uint8_t>> parameter;
|
SerializeElement<SerialFixedArrayListAdapter<uint8_t, MAX_SIZE, uint8_t>> parameter;
|
||||||
};
|
};*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This class generates a message which can be sent to the GomspaceDeviceHandler to
|
* @brief This class generates a message which can be sent to the GomspaceDeviceHandler to
|
||||||
@ -405,6 +428,7 @@ class GomspaceSetParamMessage : public SerialLinkedListAdapter<SerializeIF> {
|
|||||||
* to get a parameter from gomspace devices. The action message can be
|
* to get a parameter from gomspace devices. The action message can be
|
||||||
* for example received from the PUS Service 8.
|
* for example received from the PUS Service 8.
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
class GetParamMessageUnpacker : public SerialLinkedListAdapter<SerializeIF> {
|
class GetParamMessageUnpacker : public SerialLinkedListAdapter<SerializeIF> {
|
||||||
public:
|
public:
|
||||||
GetParamMessageUnpacker() { setLinks(); }
|
GetParamMessageUnpacker() { setLinks(); }
|
||||||
@ -424,8 +448,8 @@ class GetParamMessageUnpacker : public SerialLinkedListAdapter<SerializeIF> {
|
|||||||
}
|
}
|
||||||
SerializeElement<uint8_t> tableId;
|
SerializeElement<uint8_t> tableId;
|
||||||
SerializeElement<uint16_t> address; // The memory address offset within the table
|
SerializeElement<uint16_t> address; // The memory address offset within the table
|
||||||
/* The size of the requested value (e.g. temperature is a uint16_t value) */
|
// The size of the requested value (e.g. temperature is a uint16_t value)
|
||||||
SerializeElement<uint8_t> parameterSize;
|
SerializeElement<uint8_t> parameterSize;
|
||||||
};
|
};*/
|
||||||
|
|
||||||
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_GOMSPACEPACKETS_H_ */
|
#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_GOMSPACEPACKETS_H_ */
|
||||||
|
@ -10,11 +10,9 @@ class GomspaceDeviceHandler;
|
|||||||
class PingAction : public TemplateAction<GomspaceDeviceHandler, PingAction, GomspaceCommands> {
|
class PingAction : public TemplateAction<GomspaceDeviceHandler, PingAction, GomspaceCommands> {
|
||||||
public:
|
public:
|
||||||
PingAction(GomspaceDeviceHandler* owner) : TemplateAction(owner, GomspaceCommands::PING) {}
|
PingAction(GomspaceDeviceHandler* owner) : TemplateAction(owner, GomspaceCommands::PING) {}
|
||||||
};
|
|
||||||
|
|
||||||
class NoneAction : public TemplateAction<GomspaceDeviceHandler, NoneAction, GomspaceCommands> {
|
// TODO array
|
||||||
public:
|
Parameter<uint8_t> pingData = Parameter<uint8_t>::createParameter(this, "Ping Data");
|
||||||
NoneAction(GomspaceDeviceHandler* owner) : TemplateAction(owner, GomspaceCommands::NONE) {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class RebootAction : public TemplateAction<GomspaceDeviceHandler, RebootAction, GomspaceCommands> {
|
class RebootAction : public TemplateAction<GomspaceDeviceHandler, RebootAction, GomspaceCommands> {
|
||||||
@ -32,15 +30,33 @@ class GndwdtResetAction
|
|||||||
class ParamGetAction
|
class ParamGetAction
|
||||||
: public TemplateAction<GomspaceDeviceHandler, ParamGetAction, GomspaceCommands> {
|
: public TemplateAction<GomspaceDeviceHandler, ParamGetAction, GomspaceCommands> {
|
||||||
public:
|
public:
|
||||||
|
FSFW_ENUM(ParameterByteSize, uint8_t,
|
||||||
|
((ONE_BYTE, 1, "One Byte"))((TWO_BYTES, 2, "Two Bytes"))((FOUR_BYTES, 4, "Four Bytes")))
|
||||||
|
FSFW_ENUM(TableId, uint8_t,
|
||||||
|
((CONFIG_TABLE_ID, 1, "Config Table"))((HK_TABLE_ID, 4, "Housekeeping Table")))
|
||||||
ParamGetAction(GomspaceDeviceHandler* owner)
|
ParamGetAction(GomspaceDeviceHandler* owner)
|
||||||
: TemplateAction(owner, GomspaceCommands::PARAM_GET) {}
|
: TemplateAction(owner, GomspaceCommands::PARAM_GET) {}
|
||||||
|
|
||||||
|
Parameter<TableId> tableId =
|
||||||
|
Parameter<TableId>::createParameter(this, "Table");
|
||||||
|
Parameter<uint16_t> address = Parameter<uint16_t>::createParameter(this, "Address");
|
||||||
|
Parameter<ParameterByteSize> parameterSize =
|
||||||
|
Parameter<ParameterByteSize>::createParameter(this, "Parameter Size");
|
||||||
};
|
};
|
||||||
|
|
||||||
class ParamSetAction
|
class ParamSetAction
|
||||||
: public TemplateAction<GomspaceDeviceHandler, ParamSetAction, GomspaceCommands> {
|
: public TemplateAction<GomspaceDeviceHandler, ParamSetAction, GomspaceCommands> {
|
||||||
public:
|
public:
|
||||||
|
FSFW_ENUM(ParameterByteSize, uint8_t,
|
||||||
|
((ONE_BYTE, 1, "One Byte"))((TWO_BYTES, 2, "Two Bytes"))((FOUR_BYTES, 4, "Four Bytes")))
|
||||||
|
|
||||||
ParamSetAction(GomspaceDeviceHandler* owner)
|
ParamSetAction(GomspaceDeviceHandler* owner)
|
||||||
: TemplateAction(owner, GomspaceCommands::PARAM_SET) {}
|
: TemplateAction(owner, GomspaceCommands::PARAM_SET) {}
|
||||||
|
|
||||||
|
Parameter<uint16_t> address = Parameter<uint16_t>::createParameter(this, "Address");
|
||||||
|
Parameter<uint32_t> parameter = Parameter<uint32_t>::createParameter(this, "Parameter Value");
|
||||||
|
Parameter<ParameterByteSize> parameterSize =
|
||||||
|
Parameter<ParameterByteSize>::createParameter(this, "Parameter Size");
|
||||||
};
|
};
|
||||||
|
|
||||||
class RequestHkTableAction
|
class RequestHkTableAction
|
||||||
|
Loading…
x
Reference in New Issue
Block a user