From 63ba551dcb9b4076fc9db9336142599ff9cf9cc4 Mon Sep 17 00:00:00 2001 From: Kyle Sunderland Date: Sat, 10 Mar 2018 16:50:46 -0500 Subject: [PATCH] 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. --- src/PlusServer/vtkPlusOpenIGTLinkServer.cxx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/PlusServer/vtkPlusOpenIGTLinkServer.cxx b/src/PlusServer/vtkPlusOpenIGTLinkServer.cxx index c84c9dbdf..ff1829b7a 100644 --- a/src/PlusServer/vtkPlusOpenIGTLinkServer.cxx +++ b/src/PlusServer/vtkPlusOpenIGTLinkServer.cxx @@ -1296,13 +1296,15 @@ igtl::MessageBase::Pointer vtkPlusOpenIGTLinkServer::CreateIgtlMessageFromComman // Send command result details both in XML and in metadata, slowly phase towards metadata std::ostringstream replyStr; - replyStr << "" << (commandResponse->GetStatus() ? "true" : "false") << ""; + replyStr << "GetCommandName() << "\""; + replyStr << " Status=\"" << (commandResponse->GetStatus() ? "SUCCESS" : "FAIL") << "\""; if (commandResponse->GetStatus() == PLUS_FAIL) { - replyStr << "" << commandResponse->GetErrorString() << ""; + replyStr << " Error=\"" << commandResponse->GetErrorString() << "\""; igtlMessage->SetMetaDataElement("Error", IANA_TYPE_US_ASCII, commandResponse->GetErrorString()); } - replyStr << "" << commandResponse->GetResultString() << ""; + replyStr << " Message=\"" << commandResponse->GetResultString() << "\">"; igtlMessage->SetMetaDataElement("Message", IANA_TYPE_US_ASCII, commandResponse->GetResultString()); igtlMessage->SetMetaDataElement("Result", IANA_TYPE_US_ASCII, (commandResponse->GetStatus() ? "true" : "false"));