One last update; remember whether input or output is requested. This will make sure FlightGear isn't communicating in both directions all the time.
This commit is contained in:
parent
aeefd12522
commit
1fa48722b4
2 changed files with 16 additions and 12 deletions
src/Network
|
@ -62,10 +62,11 @@ FGGeneric::FGGeneric(vector<string> tokens) : exitOnError(false)
|
||||||
|
|
||||||
string config = tokens[ configToken ];
|
string config = tokens[ configToken ];
|
||||||
file_name = config+".xml";
|
file_name = config+".xml";
|
||||||
|
direction = tokens[2];
|
||||||
|
|
||||||
if (tokens[2] != "in" && tokens[2] != "out") {
|
if (direction != "in" && direction != "out") {
|
||||||
SG_LOG(SG_GENERAL, SG_ALERT, "Unsuported protocol direction: "
|
SG_LOG(SG_GENERAL, SG_ALERT, "Unsuported protocol direction: "
|
||||||
<< tokens[2]);
|
<< direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
reinit();
|
reinit();
|
||||||
|
@ -533,16 +534,18 @@ FGGeneric::reinit()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SGPropertyNode *output = root.getNode("generic/output");
|
if (direction == "out") {
|
||||||
if (output) {
|
SGPropertyNode *output = root.getNode("generic/output");
|
||||||
_out_message.clear();
|
if (output) {
|
||||||
read_config(output, _out_message);
|
_out_message.clear();
|
||||||
}
|
read_config(output, _out_message);
|
||||||
|
}
|
||||||
SGPropertyNode *input = root.getNode("generic/input");
|
} else if (direction == "in") {
|
||||||
if (input) {
|
SGPropertyNode *input = root.getNode("generic/input");
|
||||||
_in_message.clear();
|
if (input) {
|
||||||
read_config(input, _in_message);
|
_in_message.clear();
|
||||||
|
read_config(input, _in_message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,7 @@ protected:
|
||||||
private:
|
private:
|
||||||
|
|
||||||
string file_name;
|
string file_name;
|
||||||
|
string direction;
|
||||||
|
|
||||||
int length;
|
int length;
|
||||||
char buf[ FG_MAX_MSG_SIZE ];
|
char buf[ FG_MAX_MSG_SIZE ];
|
||||||
|
|
Loading…
Add table
Reference in a new issue