Add repeat capability to input from files.
This commit is contained in:
parent
b4ab5242ec
commit
79e6712d7e
2 changed files with 18 additions and 7 deletions
|
@ -29,7 +29,7 @@ Generic Communication:
|
|||
params can be:
|
||||
serial port communication: serial,dir,hz,device,baud,protocol
|
||||
socket communication: socket,dir,hz,machine,port,style,protocol
|
||||
output to a file: file,dir,hz,filename,protocol
|
||||
i/o to a file: file,dir,hz,filename,protocol[,repeat]
|
||||
|
||||
See README.protocol for how to define a generic protocol.
|
||||
|
||||
|
@ -85,6 +85,11 @@ File I/O:
|
|||
|
||||
--native=file,in,10,flight1.fgfs --fdm=external
|
||||
|
||||
You can make the replay from a file loop back to the beginning
|
||||
when it reaches the end of the file with the "repeat" flag:
|
||||
|
||||
--generic=file,in,20,flight.out,playback,repeat
|
||||
|
||||
|
||||
Moving Map Example:
|
||||
|
||||
|
|
|
@ -182,10 +182,14 @@ FGIO::parse_port_config( const string& config )
|
|||
FGRUL *rul = new FGRUL;
|
||||
io = rul;
|
||||
} else if ( protocol == "generic" ) {
|
||||
int n = 6;
|
||||
if (tokens[1] == "socket") n++;
|
||||
else if (tokens[1] == "file") n--;
|
||||
FGGeneric *generic = new FGGeneric( tokens[n] );
|
||||
int configToken;
|
||||
if (tokens[1] == "socket")
|
||||
configToken = 7;
|
||||
else if (tokens[1] == "file")
|
||||
configToken = 5;
|
||||
else
|
||||
configToken = 6;
|
||||
FGGeneric *generic = new FGGeneric( tokens[configToken] );
|
||||
io = generic;
|
||||
} else if ( protocol == "multiplay" ) {
|
||||
if ( tokens.size() != 5 ) {
|
||||
|
@ -249,8 +253,10 @@ FGIO::parse_port_config( const string& config )
|
|||
|
||||
string file = tokens[4];
|
||||
SG_LOG( SG_IO, SG_INFO, " file name = " << file );
|
||||
|
||||
SGFile *ch = new SGFile( file );
|
||||
bool repeat = false;
|
||||
if (tokens.size() >= 7 && tokens[6] == "repeat")
|
||||
repeat = true;
|
||||
SGFile *ch = new SGFile( file, repeat );
|
||||
io->set_io_channel( ch );
|
||||
} else if ( medium == "socket" ) {
|
||||
if ( tokens.size() < 6) {
|
||||
|
|
Loading…
Reference in a new issue