successful change of endian swapping in p60dock param set

This commit is contained in:
Jakob Meier 2020-12-16 11:02:49 +01:00
parent 62747e83aa
commit b9151fbd6e

View File

@ -40,8 +40,7 @@ ReturnValue_t P60DockHandler::buildCommandFromCommand(
SetParamMessageUnpacker setParamMessageUnpacker(commandData, SetParamMessageUnpacker setParamMessageUnpacker(commandData,
commandDataLen); commandDataLen);
uint8_t tableId = setParamMessageUnpacker.getTableId(); uint8_t tableId = setParamMessageUnpacker.getTableId();
uint16_t address = EndianConverter::convertLittleEndian<uint16_t>( uint16_t address = setParamMessageUnpacker.getAddress();
setParamMessageUnpacker.getAddress());
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;
@ -49,26 +48,9 @@ ReturnValue_t P60DockHandler::buildCommandFromCommand(
uint16_t querySize = 1; uint16_t querySize = 1;
const uint8_t* parameterPtr = setParamMessageUnpacker.getParameter(); const uint8_t* parameterPtr = setParamMessageUnpacker.getParameter();
uint8_t parameterSize = setParamMessageUnpacker.getParameterSize(); uint8_t parameterSize = setParamMessageUnpacker.getParameterSize();
uint32_t parameter; uint16_t payloadlength = sizeof(address) + parameterSize;
parameter = *parameterPtr;
switch(parameterSize) {
case(sizeof(uint16_t)): {
parameter = EndianConverter::convertLittleEndian<uint16_t>(
(uint16_t)parameter);
break;
}
case(sizeof(uint32_t)): {
parameter = EndianConverter::convertLittleEndian<uint32_t>(
parameter);
break;
}
default:
break;
}
uint16_t payloadlength = EndianConverter::convertLittleEndian<uint16_t>(
sizeof(address) + parameterSize);
CspSetParamCommand setParamCmd(querySize, PARAM_SET, tableId, payloadlength, CspSetParamCommand setParamCmd(querySize, PARAM_SET, tableId, payloadlength,
checksum, seq, total, address, (uint8_t*) &parameter, checksum, seq, total, address, parameterPtr,
parameterSize); parameterSize);
size_t cspPacketLen = 0; size_t cspPacketLen = 0;
uint8_t* buffer = cspPacket; uint8_t* buffer = cspPacket;