1
0
Fork 0

Add repeat capability to input from files.

This commit is contained in:
timoore 2008-07-19 16:23:05 +00:00
parent b4ab5242ec
commit 79e6712d7e
2 changed files with 18 additions and 7 deletions

View file

@ -29,7 +29,7 @@ Generic Communication:
params can be: params can be:
serial port communication: serial,dir,hz,device,baud,protocol serial port communication: serial,dir,hz,device,baud,protocol
socket communication: socket,dir,hz,machine,port,style,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. 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 --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: Moving Map Example:

View file

@ -182,10 +182,14 @@ FGIO::parse_port_config( const string& config )
FGRUL *rul = new FGRUL; FGRUL *rul = new FGRUL;
io = rul; io = rul;
} else if ( protocol == "generic" ) { } else if ( protocol == "generic" ) {
int n = 6; int configToken;
if (tokens[1] == "socket") n++; if (tokens[1] == "socket")
else if (tokens[1] == "file") n--; configToken = 7;
FGGeneric *generic = new FGGeneric( tokens[n] ); else if (tokens[1] == "file")
configToken = 5;
else
configToken = 6;
FGGeneric *generic = new FGGeneric( tokens[configToken] );
io = generic; io = generic;
} else if ( protocol == "multiplay" ) { } else if ( protocol == "multiplay" ) {
if ( tokens.size() != 5 ) { if ( tokens.size() != 5 ) {
@ -249,8 +253,10 @@ FGIO::parse_port_config( const string& config )
string file = tokens[4]; string file = tokens[4];
SG_LOG( SG_IO, SG_INFO, " file name = " << file ); SG_LOG( SG_IO, SG_INFO, " file name = " << file );
bool repeat = false;
SGFile *ch = new SGFile( file ); if (tokens.size() >= 7 && tokens[6] == "repeat")
repeat = true;
SGFile *ch = new SGFile( file, repeat );
io->set_io_channel( ch ); io->set_io_channel( ch );
} else if ( medium == "socket" ) { } else if ( medium == "socket" ) {
if ( tokens.size() < 6) { if ( tokens.size() < 6) {