Telnet usage: Difference between revisions

Jump to navigation Jump to search
1,003 bytes added ,  26 March 2013
→‎Use Case: Radio Stack: http://www.mail-archive.com/flightgear-devel@flightgear.org/msg06862.html
(→‎Use Case: Radio Stack: http://www.mail-archive.com/flightgear-devel@flightgear.org/msg06862.html)
Line 232: Line 232:
If you need to track 100 different variables at 60hz, this isn't the interface for you.
If you need to track 100 different variables at 60hz, this isn't the interface for you.
For that you should consider using a native protocol, implemented in C++ (e.g. FGNetCtrl via UDP).
For that you should consider using a native protocol, implemented in C++ (e.g. FGNetCtrl via UDP).
== Use Case: Instructor Station ==
I have just added the raw beginnings of a Java client library and trivially-simple Swing GUI demo under scripts/java/demo/FGClient/.
Here's the Java code to connect to a FlightGear process and increase the current altitude by 1000 feet:
<syntaxhighlight language="java">
  FGConnection fgfs = new FGConnection("localhost", 9000);
  double altitude = fgfs.getDouble("/position/altitude-ft");
  fgfs.setDouble("/position/altitude-ft", altitude + 1000);
  fgfs.close();
</Syntaxhighlight>
The demo application displays the current altitude, longitude, and
latitude in a small GUI window, and uses a separate thread to update
the values every second.  To use it, try these commands:
<pre>
  fgfs --telnet=9000
  java FGFSDemo localhost 9000
</pre>
I might develop this into a remote instructor's panel, a full configuration GUI, a remote-control module for weather and other
environment parameters, or any combination of these.  Contributions are welcome, of course.


== Use Case: Radio Stack ==
== Use Case: Radio Stack ==

Navigation menu