]> git.mxchange.org Git - flightgear.git/blobdiff - src/Main/fg_io.cxx
A new comm radio and atis implementation
[flightgear.git] / src / Main / fg_io.cxx
index db6289ae30bdc66b8bd31c995a95f469c16cf66a..059bb97a23ab55cfdec71a9cd45c75fa19889b66 100644 (file)
@@ -49,9 +49,8 @@
 #include <Network/AV400WSim.hxx>
 #include <Network/garmin.hxx>
 #include <Network/httpd.hxx>
-#ifdef FG_JPEG_SERVER
-#  include <Network/jpg-httpd.hxx>
-#endif
+#include <Network/igc.hxx>
+#include <Network/jpg-httpd.hxx>
 #include <Network/joyclient.hxx>
 #include <Network/jsclient.hxx>
 #include <Network/native.hxx>
@@ -65,9 +64,8 @@
 #include <Network/ray.hxx>
 #include <Network/rul.hxx>
 #include <Network/generic.hxx>
-#include <Network/HTTPClient.hxx>
 
-#ifdef FG_HAVE_HLA
+#if FG_HAVE_HLA
 #include <Network/HLA/hla.hxx>
 #endif
 
@@ -148,16 +146,28 @@ FGIO::parse_port_config( const string& config )
         } else if ( protocol == "garmin" ) {
             FGGarmin *garmin = new FGGarmin;
             io = garmin;
+        } else if ( protocol == "igc" ) {
+            IGCProtocol *igc = new IGCProtocol;
+            io = igc;
         } else if ( protocol == "httpd" ) {
             // determine port
             string port = tokens[1];
             return new FGHttpd( atoi(port.c_str()) );
-#ifdef FG_JPEG_SERVER
         } else if ( protocol == "jpg-httpd" ) {
             // determine port
-            string port = tokens[1];
-            return new FGJpegHttpd( atoi(port.c_str()) );
-#endif
+            int port = simgear::strutils::to_int(tokens[1]);
+            int frameHz = 8; // maximum frame rate
+            string type = "jpeg";
+            
+            if (tokens.size() > 2) {
+                frameHz = simgear::strutils::to_int(tokens[2]);
+            }
+            
+            if (tokens.size() > 3) {
+                type = tokens[3];
+            }
+                
+            return new FGJpegHttpd(port, frameHz, type);
         } else if ( protocol == "joyclient" ) {
             FGJoyClient *joyclient = new FGJoyClient;
             io = joyclient;
@@ -225,10 +235,23 @@ FGIO::parse_port_config( const string& config )
 
             return NULL;
         }
-#ifdef FG_HAVE_HLA
+#if FG_HAVE_HLA
         else if ( protocol == "hla" ) {
             return new FGHLA(tokens);
         }
+        else if ( protocol == "hla-local" ) {
+            // This is just about to bring up some defaults
+            if (tokens.size() != 2) {
+                SG_LOG( SG_IO, SG_ALERT, "Ignoring invalid --hla-local option "
+                        "(one argument expected: --hla-local=<federationname>" );
+                return NULL;
+            }
+            tokens.insert(tokens.begin(), "");
+            tokens.insert(tokens.begin(), "60");
+            tokens.insert(tokens.begin(), "bi");
+            tokens.push_back("fg-local.xml");
+            return new FGHLA(tokens);
+        }
 #endif
         else {
             return NULL;
@@ -382,10 +405,6 @@ FGIO::reinit()
 void
 FGIO::update( double /* delta_time_sec */ )
 {
-    if (FGHTTPClient::haveInstance()) {
-        FGHTTPClient::instance()->update();
-    }
-    
     // use wall-clock, not simulation, delta time, so that network
     // protocols update when the simulation is paused
     // see http://code.google.com/p/flightgear-bugs/issues/detail?id=125