Add new commands to telnet protocall
New comands: setb set a Boolean value setd set a Floaring point value seti set a integer value del delete a node
This commit is contained in:
parent
43fcbd2246
commit
95e3d00a17
1 changed files with 47 additions and 11 deletions
|
@ -3,6 +3,7 @@
|
|||
//
|
||||
// Written by Curtis Olson, started September 2000.
|
||||
// Modified by Bernie Bright, May 2002.
|
||||
// Modified by Jean-Paul Anceaux, Dec 2015.
|
||||
//
|
||||
// Copyright (C) 2000 Curtis L. Olson - http://www.flightgear.org/~curt
|
||||
//
|
||||
|
@ -486,6 +487,37 @@ PropsChannel::foundTerminator()
|
|||
else
|
||||
error("No matching callback found for command:"+command);
|
||||
}
|
||||
else if ( command == "seti" ) {
|
||||
if (tokens.size() == 3) {
|
||||
node->getNode( tokens[1].c_str(), true )
|
||||
->setIntValue(atoi(tokens[2].c_str()));
|
||||
}
|
||||
const char* msg = "set init\r\n";
|
||||
push( msg );
|
||||
}
|
||||
else if ( command == "setd" ) {
|
||||
if (tokens.size() == 3) {
|
||||
node->getNode( tokens[1].c_str(), true )
|
||||
->setDoubleValue(atof(tokens[2].c_str()));
|
||||
}
|
||||
}
|
||||
else if ( command == "setb" ) {
|
||||
if (tokens.size() == 3) {
|
||||
if (tokens[2] == "false" || tokens[2] == "0") {
|
||||
node->getNode( tokens[1].c_str(), true )
|
||||
->setBoolValue(false);
|
||||
}
|
||||
if (tokens[2] == "true" || tokens[2] == "1"){
|
||||
node->getNode( tokens[1].c_str(), true )
|
||||
->setBoolValue(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( command == "del" ) {
|
||||
if (tokens.size() == 3){
|
||||
node->getNode( tokens[1].c_str(), true )->removeChild(tokens[2].c_str(),0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const char* msg = "\
|
||||
Valid commands are:\r\n\
|
||||
|
@ -500,7 +532,11 @@ prompt switch to interactive mode (default)\r\n\
|
|||
pwd display your current path\r\n\
|
||||
quit terminate connection\r\n\
|
||||
run <command> run built in command\r\n\
|
||||
set <var> <val> set <var> to a new <val>\r\n\
|
||||
set <var> <val> set String <var> to a new <val>\r\n\
|
||||
setb <var> <val> set Bool <var> to a new <val> only work with the foling value 0, 1, true, false\r\n\
|
||||
setd <var> <val> set Double <var> to a new <val>\r\n\
|
||||
seti <var> <val> set Int <var> to a new <val>\r\n\
|
||||
del <var> <nod> delete <nod> in <var>\r\n\
|
||||
subscribe <var> subscribe to property changes \r\n\
|
||||
unscubscribe <var> unscubscribe from property changes (var must be the property name/path used by subscribe)\r\n";
|
||||
push( msg );
|
||||
|
|
Loading…
Add table
Reference in a new issue