Uniform reply behaviour of FGInputSocket::Read #109
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR comes from issue #63, where part of the discussion concerns the behaviour of JSBSim when used as an input server responding synchronously to an external application connected via socket.
In that discussion I refer to an example of use where a client app
get
command to JSBSim,set
command, which succeedsAll commands sent as string by the example client application to JSBSim through the input socket are digested by JSBSim's
FGInputSocket::Read
. This function parses the string checking the validity of the command, eg.:get <property>
set <property> <value>
hold
resume
iterate <int>
quit
info
help
and finally calls
Reply
that sends back through the socket a string message to the client.In the current version of
FGInputSocket::Read
, for some commands like a successfulset <property>
JSBSim replies with an empty string followed by the promptJSBSim>
. No new line character. See FGInputSocket.cpp, line 173. The same behaviour is implemented forhold
,resume
,iterate
, andquit
.In the present PR I've changed the reply messages in case of successful
set
,hold
,resume
,iterate
, andquit
prepending to the"JSBSim> "
prompt a confirmation message terminated by a new line character\n
. For instance:or
or
and so on.
This harmless change
\n
plus the prompt stringJSBSim>
\n
character and throw away the remaining ones.