Skip to content
Snippets Groups Projects
Commit 6d097e91 authored by Grigoris Pavlakis's avatar Grigoris Pavlakis
Browse files

Add missing failed start of execution notifications, change assertions to the...

Add missing failed start of execution notifications, change assertions to the more appropriate assertRequest and fix a breaking faulty assertion case (credits to @thodkatz for his help)
parent 8ec172e5
No related branches found
No related tags found
No related merge requests found
...@@ -37,12 +37,15 @@ ParameterService::ParameterService() { ...@@ -37,12 +37,15 @@ ParameterService::ParameterService() {
void ParameterService::reportParameterIds(Message paramIds) { void ParameterService::reportParameterIds(Message paramIds) {
Message reqParam(20, 2, Message::TM, 1); // empty TM[20, 2] parameter report message Message reqParam(20, 2, Message::TM, 1); // empty TM[20, 2] parameter report message
// assertion: correct message, packet and service type (at failure throws an // assertion: correct message, packet and service type (at failure throws an
// InternalError::UnacceptablePacket) // InternalError::UnacceptablePacket)
ErrorHandler::assertInternal(paramIds.packetType == Message::TC ErrorHandler::assertRequest(paramIds.packetType == Message::TC, paramIds,
&& paramIds.messageType == 1 ErrorHandler::AcceptanceErrorType::UnacceptableMessage);
&& paramIds.serviceType == 20, ErrorHandler::assertRequest(paramIds.messageType == 1, paramIds,
ErrorHandler::InternalErrorType::UnacceptablePacket); ErrorHandler::AcceptanceErrorType::UnacceptableMessage);
ErrorHandler::assertRequest(paramIds.serviceType == 20, paramIds,
ErrorHandler::AcceptanceErrorType::UnacceptableMessage);
uint16_t ids = paramIds.readUint16(); uint16_t ids = paramIds.readUint16();
reqParam.appendUint16(numOfValidIds(paramIds)); // include the number of valid IDs reqParam.appendUint16(numOfValidIds(paramIds)); // include the number of valid IDs
...@@ -52,10 +55,10 @@ void ParameterService::reportParameterIds(Message paramIds) { ...@@ -52,10 +55,10 @@ void ParameterService::reportParameterIds(Message paramIds) {
if (paramsList.find(currId) != paramsList.end()) { if (paramsList.find(currId) != paramsList.end()) {
reqParam.appendUint16(currId); reqParam.appendUint16(currId);
reqParam.appendUint32(paramsList[currId].settingData); reqParam.appendUint32(paramsList[currId].settingData);
} } else {
ErrorHandler::reportError(paramIds,
else { ErrorHandler::ExecutionStartErrorType::UnknownExecutionStartError);
continue; // generate failure of execution notification (todo) for ST[06] & ignore continue; // generate failed start of execution notification & ignore
} }
} }
...@@ -66,10 +69,14 @@ void ParameterService::setParameterIds(Message newParamValues) { ...@@ -66,10 +69,14 @@ void ParameterService::setParameterIds(Message newParamValues) {
// assertion: correct message, packet and service type (at failure throws an // assertion: correct message, packet and service type (at failure throws an
// InternalError::UnacceptablePacket which gets logged) // InternalError::UnacceptablePacket which gets logged)
ErrorHandler::assertInternal(newParamValues.packetType == Message::TC
&& newParamValues.messageType == 1 ErrorHandler::assertRequest(newParamValues.packetType == Message::TC, newParamValues,
&& newParamValues.serviceType == 20, ErrorHandler::AcceptanceErrorType::UnacceptableMessage);
ErrorHandler::InternalErrorType::UnacceptablePacket); ErrorHandler::assertRequest(newParamValues.messageType == 3, newParamValues,
ErrorHandler::AcceptanceErrorType::UnacceptableMessage);
ErrorHandler::assertRequest(newParamValues.serviceType == 20, newParamValues,
ErrorHandler::AcceptanceErrorType::UnacceptableMessage);
uint16_t ids = newParamValues.readUint16(); //get number of ID's uint16_t ids = newParamValues.readUint16(); //get number of ID's
for (int i = 0; i < ids; i++) { for (int i = 0; i < ids; i++) {
...@@ -77,10 +84,10 @@ void ParameterService::setParameterIds(Message newParamValues) { ...@@ -77,10 +84,10 @@ void ParameterService::setParameterIds(Message newParamValues) {
if (paramsList.find(currId) != paramsList.end()) { if (paramsList.find(currId) != paramsList.end()) {
paramsList[currId].settingData = newParamValues.readUint32(); paramsList[currId].settingData = newParamValues.readUint32();
} } else {
ErrorHandler::reportError(newParamValues,
else { ErrorHandler::ExecutionStartErrorType::UnknownExecutionStartError);
continue; // generate failure of execution notification (todo) for ST[06] & ignore continue; // generate failed start of execution notification & ignore
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment