v1.9.0 #175
@ -170,6 +170,7 @@ ReturnValue_t GomspaceDeviceHandler::interpretDeviceReply(DeviceCommandId_t id,
|
||||
if (*packet != PARAM_SET_OK) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
setParamCallback(setParamCacher, true);
|
||||
break;
|
||||
}
|
||||
case (GOMSPACE::REQUEST_HK_TABLE): {
|
||||
@ -186,8 +187,7 @@ void GomspaceDeviceHandler::setNormalDatapoolEntriesInvalid() {}
|
||||
|
||||
ReturnValue_t GomspaceDeviceHandler::generateSetParamCommand(const uint8_t* commandData,
|
||||
size_t commandDataLen) {
|
||||
SetParamMessageUnpacker setParamMessageUnpacker;
|
||||
ReturnValue_t result = setParamMessageUnpacker.deSerialize(&commandData, &commandDataLen,
|
||||
ReturnValue_t result = setParamCacher.deSerialize(&commandData, &commandDataLen,
|
||||
SerializeIF::Endianness::BIG);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
sif::error << "GomspaceDeviceHandler: Failed to deserialize set parameter "
|
||||
@ -195,12 +195,12 @@ ReturnValue_t GomspaceDeviceHandler::generateSetParamCommand(const uint8_t* comm
|
||||
<< std::endl;
|
||||
return result;
|
||||
}
|
||||
result = setParamCallback(setParamMessageUnpacker);
|
||||
result = setParamCallback(setParamCacher, false);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
/* Get and check address */
|
||||
uint16_t address = setParamMessageUnpacker.getAddress();
|
||||
uint16_t address = setParamCacher.getAddress();
|
||||
if (address > maxConfigTableAddress) {
|
||||
sif::error << "GomspaceDeviceHandler: Invalid address for set parameter "
|
||||
<< "action" << std::endl;
|
||||
@ -211,8 +211,8 @@ ReturnValue_t GomspaceDeviceHandler::generateSetParamCommand(const uint8_t* comm
|
||||
uint16_t total = 0;
|
||||
/* CSP reply only contains the transaction state */
|
||||
uint16_t querySize = 1;
|
||||
const uint8_t* parameterPtr = setParamMessageUnpacker.getParameter();
|
||||
uint8_t parameterSize = setParamMessageUnpacker.getParameterSize();
|
||||
const uint8_t* parameterPtr = setParamCacher.getParameter();
|
||||
uint8_t parameterSize = setParamCacher.getParameterSize();
|
||||
uint16_t payloadlength = sizeof(address) + parameterSize;
|
||||
|
||||
/* Generate command for CspComIF */
|
||||
@ -345,7 +345,8 @@ ReturnValue_t GomspaceDeviceHandler::childCommandHook(DeviceCommandId_t cmd,
|
||||
return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
ReturnValue_t GomspaceDeviceHandler::setParamCallback(SetParamMessageUnpacker& unpacker) {
|
||||
ReturnValue_t GomspaceDeviceHandler::setParamCallback(SetParamMessageUnpacker& unpacker,
|
||||
bool afterExecution) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
|
@ -111,13 +111,22 @@ class GomspaceDeviceHandler : public DeviceHandlerBase {
|
||||
size_t commandDataLen);
|
||||
|
||||
private:
|
||||
SetParamMessageUnpacker 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);
|
||||
|
||||
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
|
||||
|
@ -73,9 +73,12 @@ void PDU1Handler::assignChannelHookFunction(GOMSPACE::ChannelSwitchHook hook, vo
|
||||
this->hookArgs = args;
|
||||
}
|
||||
|
||||
ReturnValue_t PDU1Handler::setParamCallback(SetParamMessageUnpacker &unpacker) {
|
||||
ReturnValue_t PDU1Handler::setParamCallback(SetParamMessageUnpacker &unpacker, bool afterExecution) {
|
||||
using namespace PDU1;
|
||||
GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU1;
|
||||
if(not afterExecution) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
if (channelSwitchHook != nullptr and unpacker.getParameterSize() == 1) {
|
||||
switch (unpacker.getAddress()) {
|
||||
case (CONFIG_ADDRESS_OUT_EN_TCS_BOARD_3V3): {
|
||||
|
@ -37,7 +37,7 @@ class PDU1Handler : public GomspaceDeviceHandler {
|
||||
virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t* packet) override;
|
||||
ReturnValue_t printStatus(DeviceCommandId_t cmd) override;
|
||||
|
||||
ReturnValue_t setParamCallback(SetParamMessageUnpacker& unpacker) override;
|
||||
ReturnValue_t setParamCallback(SetParamMessageUnpacker& unpacker, bool afterExectuion) override;
|
||||
|
||||
private:
|
||||
/** Dataset for the housekeeping table of the PDU1 */
|
||||
|
@ -427,9 +427,12 @@ void PDU2Handler::printHkTable() {
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
ReturnValue_t PDU2Handler::setParamCallback(SetParamMessageUnpacker &unpacker) {
|
||||
ReturnValue_t PDU2Handler::setParamCallback(SetParamMessageUnpacker &unpacker, bool afterExecution) {
|
||||
using namespace PDU2;
|
||||
GOMSPACE::Pdu pdu = GOMSPACE::Pdu::PDU2;
|
||||
if(not afterExecution) {
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
if (channelSwitchHook != nullptr and unpacker.getParameterSize() == 1) {
|
||||
switch (unpacker.getAddress()) {
|
||||
case (CONFIG_ADDRESS_OUT_EN_Q7S): {
|
||||
|
@ -35,7 +35,7 @@ class PDU2Handler : public GomspaceDeviceHandler {
|
||||
virtual ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t* id) override;
|
||||
virtual void letChildHandleHkReply(DeviceCommandId_t id, const uint8_t* packet) override;
|
||||
ReturnValue_t printStatus(DeviceCommandId_t cmd) override;
|
||||
ReturnValue_t setParamCallback(SetParamMessageUnpacker& unpacker) override;
|
||||
ReturnValue_t setParamCallback(SetParamMessageUnpacker& unpacker, bool afterExecution) override;
|
||||
|
||||
private:
|
||||
/** Dataset for the housekeeping table of the PDU2 */
|
||||
|
Loading…
Reference in New Issue
Block a user