v1.9.0 #175

Merged
muellerr merged 623 commits from develop into main 2022-03-08 10:32:41 +01:00
6 changed files with 28 additions and 12 deletions
Showing only changes of commit ded92fdf7a - Show all commits

View File

@ -170,6 +170,7 @@ 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);
break; break;
} }
case (GOMSPACE::REQUEST_HK_TABLE): { case (GOMSPACE::REQUEST_HK_TABLE): {
@ -186,8 +187,7 @@ void GomspaceDeviceHandler::setNormalDatapoolEntriesInvalid() {}
ReturnValue_t GomspaceDeviceHandler::generateSetParamCommand(const uint8_t* commandData, ReturnValue_t GomspaceDeviceHandler::generateSetParamCommand(const uint8_t* commandData,
size_t commandDataLen) { size_t commandDataLen) {
SetParamMessageUnpacker setParamMessageUnpacker; ReturnValue_t result = setParamCacher.deSerialize(&commandData, &commandDataLen,
ReturnValue_t result = setParamMessageUnpacker.deSerialize(&commandData, &commandDataLen,
SerializeIF::Endianness::BIG); SerializeIF::Endianness::BIG);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
sif::error << "GomspaceDeviceHandler: Failed to deserialize set parameter " sif::error << "GomspaceDeviceHandler: Failed to deserialize set parameter "
@ -195,12 +195,12 @@ ReturnValue_t GomspaceDeviceHandler::generateSetParamCommand(const uint8_t* comm
<< std::endl; << std::endl;
return result; return result;
} }
result = setParamCallback(setParamMessageUnpacker); 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 = setParamMessageUnpacker.getAddress(); uint16_t address = setParamCacher.getAddress();
if (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;
@ -211,8 +211,8 @@ 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 = setParamMessageUnpacker.getParameter(); const uint8_t* parameterPtr = setParamCacher.getParameter();
uint8_t parameterSize = setParamMessageUnpacker.getParameterSize(); uint8_t parameterSize = setParamCacher.getParameterSize();
uint16_t payloadlength = sizeof(address) + parameterSize; uint16_t payloadlength = sizeof(address) + parameterSize;
/* Generate command for CspComIF */ /* Generate command for CspComIF */
@ -345,7 +345,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(SetParamMessageUnpacker& unpacker,
bool afterExecution) {
return HasReturnvaluesIF::RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} }

View File

@ -111,13 +111,22 @@ class GomspaceDeviceHandler : public DeviceHandlerBase {
size_t commandDataLen); size_t commandDataLen);
private: private:
SetParamMessageUnpacker setParamCacher;
/** /**
* @brief Function to generate the command to set a parameter. Command * @brief Function to generate the command to set a parameter. Command
* will be sent to the ComIF over the rawPacket buffer. * will be sent to the ComIF over the rawPacket buffer.
*/ */
ReturnValue_t generateSetParamCommand(const uint8_t *commandData, size_t commandDataLen); ReturnValue_t generateSetParamCommand(const uint8_t *commandData, size_t commandDataLen);
virtual ReturnValue_t setParamCallback(SetParamMessageUnpacker &unpacker); /**
* Callback is called on a parameter set command. It is called before executing it and after
* after successful execution
* @param unpacker Passed before
* @param beforeSet False for callback before execution, true if called after successful
* execution
* @return
*/
virtual ReturnValue_t setParamCallback(SetParamMessageUnpacker& unpacker, bool afterExecution);
/** /**
* @brief Function to generate the command to get a parameter from a * @brief Function to generate the command to get a parameter from a

View File

@ -73,9 +73,12 @@ void PDU1Handler::assignChannelHookFunction(GOMSPACE::ChannelSwitchHook hook, vo
this->hookArgs = args; this->hookArgs = args;
} }
ReturnValue_t PDU1Handler::setParamCallback(SetParamMessageUnpacker &unpacker) { ReturnValue_t PDU1Handler::setParamCallback(SetParamMessageUnpacker &unpacker, bool afterExecution) {
using namespace PDU1; using namespace PDU1;
GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU1; GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU1;
if(not afterExecution) {
return HasReturnvaluesIF::RETURN_OK;
}
if (channelSwitchHook != nullptr and unpacker.getParameterSize() == 1) { if (channelSwitchHook != nullptr and unpacker.getParameterSize() == 1) {
switch (unpacker.getAddress()) { switch (unpacker.getAddress()) {
case (CONFIG_ADDRESS_OUT_EN_TCS_BOARD_3V3): { case (CONFIG_ADDRESS_OUT_EN_TCS_BOARD_3V3): {

View File

@ -37,7 +37,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;
ReturnValue_t setParamCallback(SetParamMessageUnpacker& unpacker) override; ReturnValue_t setParamCallback(SetParamMessageUnpacker& unpacker, bool afterExectuion) override;
private: private:
/** Dataset for the housekeeping table of the PDU1 */ /** Dataset for the housekeeping table of the PDU1 */

View File

@ -427,9 +427,12 @@ void PDU2Handler::printHkTable() {
<< std::endl; << std::endl;
} }
ReturnValue_t PDU2Handler::setParamCallback(SetParamMessageUnpacker &unpacker) { ReturnValue_t PDU2Handler::setParamCallback(SetParamMessageUnpacker &unpacker, bool afterExecution) {
using namespace PDU2; using namespace PDU2;
GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU2; GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU2;
if(not afterExecution) {
return HasReturnvaluesIF::RETURN_OK;
}
if (channelSwitchHook != nullptr and unpacker.getParameterSize() == 1) { if (channelSwitchHook != nullptr and unpacker.getParameterSize() == 1) {
switch (unpacker.getAddress()) { switch (unpacker.getAddress()) {
case (CONFIG_ADDRESS_OUT_EN_Q7S): { case (CONFIG_ADDRESS_OUT_EN_Q7S): {

View File

@ -35,7 +35,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) override; ReturnValue_t setParamCallback(SetParamMessageUnpacker& unpacker, bool afterExecution) override;
private: private:
/** Dataset for the housekeeping table of the PDU2 */ /** Dataset for the housekeeping table of the PDU2 */