Skip to content

Commit 63ba551

Browse files
committed
Store server command response messages in attributes, instead of between tags (#341)
It was already handled this way for old (V1/V2) OpenIGTLink commands. This changes the current current V3 commands to use the a similar message format. Also adds command name and status attributes to response.
1 parent d3024ea commit 63ba551

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/PlusServer/vtkPlusOpenIGTLinkServer.cxx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,13 +1296,15 @@ igtl::MessageBase::Pointer vtkPlusOpenIGTLinkServer::CreateIgtlMessageFromComman
12961296

12971297
// Send command result details both in XML and in metadata, slowly phase towards metadata
12981298
std::ostringstream replyStr;
1299-
replyStr << "<Command><Result>" << (commandResponse->GetStatus() ? "true" : "false") << "</Result>";
1299+
replyStr << "<CommandReply";
1300+
replyStr << " Name=\"" << commandResponse->GetCommandName() << "\"";
1301+
replyStr << " Status=\"" << (commandResponse->GetStatus() ? "SUCCESS" : "FAIL") << "\"";
13001302
if (commandResponse->GetStatus() == PLUS_FAIL)
13011303
{
1302-
replyStr << "<Error>" << commandResponse->GetErrorString() << "</Error>";
1304+
replyStr << " Error=\"" << commandResponse->GetErrorString() << "\"";
13031305
igtlMessage->SetMetaDataElement("Error", IANA_TYPE_US_ASCII, commandResponse->GetErrorString());
13041306
}
1305-
replyStr << "<Message>" << commandResponse->GetResultString() << "</Message></Command>";
1307+
replyStr << " Message=\"" << commandResponse->GetResultString() << "\"></CommandReply>";
13061308
igtlMessage->SetMetaDataElement("Message", IANA_TYPE_US_ASCII, commandResponse->GetResultString());
13071309

13081310
igtlMessage->SetMetaDataElement("Result", IANA_TYPE_US_ASCII, (commandResponse->GetStatus() ? "true" : "false"));

0 commit comments

Comments
 (0)