Property Tree/Web Server: Difference between revisions

m
Robot: Cosmetic changes
m (Robot: Cosmetic changes)
Line 2: Line 2:
[[FlightGear]] has a few network access protocols. These are started as a [[Command Line Parameters|command line option]].
[[FlightGear]] has a few network access protocols. These are started as a [[Command Line Parameters|command line option]].


==Web Server==  
== Web Server ==
To view the [[PropertyTree]] with a web browser, start FlightGear with the following option:
To view the [[PropertyTree]] with a web browser, start FlightGear with the following option:


Line 15: Line 15:
You can now browse the entire FG property tree "live" as the sim is running. You need to refresh the browser to see changes and you can even change values if you like. You can configure autopilot modes and even set control inputs so you could literally fly the airplane from your web browser, although it's maybe not the most convenient interface for doing that. ;-)
You can now browse the entire FG property tree "live" as the sim is running. You need to refresh the browser to see changes and you can even change values if you like. You can configure autopilot modes and even set control inputs so you could literally fly the airplane from your web browser, although it's maybe not the most convenient interface for doing that. ;-)


==Telnet Server==
== Telnet Server ==
FlightGear has a telnet server that can be used to read and set values of the [[PropertyTree]]. The telnet server is activated with the '''--telnet=port''' [[Command_Line_Parameters|command line option]], where port is the number of the listening port that will be opened.
FlightGear has a telnet server that can be used to read and set values of the [[PropertyTree]]. The telnet server is activated with the '''--telnet=port''' [[Command Line Parameters|command line option]], where port is the number of the listening port that will be opened.


A connection to the server can be done using a [[Telnet usage|telnet client]] or opening a simple socket from any program. Multiple connections (more below) are possible at the same time. Too start FG and open the port 5401 as available telnet server use this command:
A connection to the server can be done using a [[Telnet usage|telnet client]] or opening a simple socket from any program. Multiple connections (more below) are possible at the same time. Too start FG and open the port 5401 as available telnet server use this command:
Line 22: Line 22:
Using this server protocol is covered in detail on the [[Telnet usage]] page.
Using this server protocol is covered in detail on the [[Telnet usage]] page.


==Manipulate Properties==
== Manipulate Properties ==
The cool thing is that you can easily write scripts to access the --telnet=<port#> interface.
The cool thing is that you can easily write scripts to access the --telnet=<port#> interface.
  //* psuedo code
  //* psuedo code
Line 42: Line 42:
For that you need a '''[[PropertyTree:Sockets|socket]]'''.
For that you need a '''[[PropertyTree:Sockets|socket]]'''.


==Multi Servers==
== Multi Servers ==
Note that you can setup as many of these servers as you want, for instance, just to be obscene you could do:
Note that you can setup as many of these servers as you want, for instance, just to be obscene you could do:
  fgfs --httpd=5400 --httpd=5401 --httpd=5402 --telnet=5403 --telnet=5404 --telnet=5405
  fgfs --httpd=5400 --httpd=5401 --httpd=5402 --telnet=5403 --telnet=5404 --telnet=5405
Line 48: Line 48:
Now there are six network interfaces running that you can access from anywhere ;-) >> can I borrow your ipod please. why ?
Now there are six network interfaces running that you can access from anywhere ;-) >> can I borrow your ipod please. why ?


====Links====
==== Links ====
* httpd source - [http://gitorious.org/fg/flightgear/blobs/next/src/Network/httpd.cxx source/src/Network/httpd.cxx]
* httpd source - [http://gitorious.org/fg/flightgear/blobs/next/src/Network/httpd.cxx source/src/Network/httpd.cxx]
* telnet (props) source - [http://gitorious.org/fg/flightgear/blobs/next/src/Network/props.cxx source/src/Network/props.cxx]
* telnet (props) source - [http://gitorious.org/fg/flightgear/blobs/next/src/Network/props.cxx source/src/Network/props.cxx]