]> git.mxchange.org Git - flightgear.git/blobdiff - src/Network/props.cxx
NavDisplay: fix update lag when switching range or centre.
[flightgear.git] / src / Network / props.cxx
index abbf0e5d1e1bffe4034a77eeb380e0db04d5cd15..7240d5cb236bcd360f1371ce348e909479bc0df2 100644 (file)
 
 #include <sstream>
 #include <iostream>
+#include <errno.h>
 
 #include <Main/globals.hxx>
 #include <Main/viewmgr.hxx>
 
-#include <plib/netChat.h>
+#include <simgear/io/sg_netChat.hxx>
 
 #include "props.hxx"
 
@@ -54,9 +55,9 @@ using std::endl;
  * Props connection class.
  * This class represents a connection to props client.
  */
-class PropsChannel : public netChat
+class PropsChannel : public simgear::NetChat
 {
-    netBuffer buffer;
+    simgear::NetBuffer buffer;
 
     /**
      * Current property node name.
@@ -118,7 +119,7 @@ PropsChannel::collectIncomingData( const char* s, int n )
 static string
 getValueTypeString( const SGPropertyNode *node )
 {
-    using namespace simgear::props;
+    using namespace simgear;
 
     string result;
 
@@ -127,22 +128,22 @@ getValueTypeString( const SGPropertyNode *node )
         return "unknown";
     }
 
-    Type type = node->getType();
-    if ( type == UNSPECIFIED ) {
+    props::Type type = node->getType();
+    if ( type == props::UNSPECIFIED ) {
         result = "unspecified";
-    } else if ( type == NONE ) {
+    } else if ( type == props::NONE ) {
         result = "none";
-    } else if ( type == BOOL ) {
+    } else if ( type == props::BOOL ) {
         result = "bool";
-    } else if ( type == INT ) {
+    } else if ( type == props::INT ) {
         result = "int";
-    } else if ( type == LONG ) {
+    } else if ( type == props::LONG ) {
         result = "long";
-    } else if ( type == FLOAT ) {
+    } else if ( type == props::FLOAT ) {
         result = "float";
-    } else if ( type == DOUBLE ) {
+    } else if ( type == props::DOUBLE ) {
         result = "double";
-    } else if ( type == STRING ) {
+    } else if ( type == props::STRING ) {
         result = "string";
     }
 
@@ -291,7 +292,7 @@ PropsChannel::foundTerminator()
                     if ( !globals->get_commands()
                              ->execute( "reinit", &args) )
                     {
-                        SG_LOG( SG_GENERAL, SG_ALERT,
+                        SG_LOG( SG_NETWORK, SG_ALERT,
                                 "Command " << tokens[1] << " failed.");
                         if ( mode == PROMPT ) {
                             tmp += "*failed*";
@@ -356,7 +357,7 @@ PropsChannel::foundTerminator()
                     if ( !globals->get_commands()
                              ->execute(tokens[1].c_str(), &args) )
                     {
-                        SG_LOG( SG_GENERAL, SG_ALERT,
+                        SG_LOG( SG_NETWORK, SG_ALERT,
                                 "Command " << tokens[1] << " failed.");
                         if ( mode == PROMPT ) {
                             tmp += "*failed*";
@@ -449,6 +450,7 @@ FGProps::FGProps( const vector<string>& tokens )
     } else {
         throw FGProtocolConfigError( "FGProps: incorrect number of configuration arguments" );
     }
+    printf( "Property server started on port %d\n", port );
 }
 
 /**
@@ -471,9 +473,9 @@ FGProps::open()
         return false;
     }
 
-    netChannel::open();
-    netChannel::bind( "", port );
-    netChannel::listen( 5 );
+    simgear::NetChannel::open();
+    simgear::NetChannel::bind( "", port );
+    simgear::NetChannel::listen( 5 );
     SG_LOG( SG_IO, SG_INFO, "Props server started on port " << port );
 
     set_enabled( true );
@@ -496,7 +498,7 @@ FGProps::close()
 bool
 FGProps::process()
 {
-    netChannel::poll();
+    simgear::NetChannel::poll();
     return true;
 }
 
@@ -506,7 +508,7 @@ FGProps::process()
 void
 FGProps::handleAccept()
 {
-    netAddress addr;
+    simgear::IPAddress addr;
     int handle = accept( &addr );
     SG_LOG( SG_IO, SG_INFO, "Props server accepted connection from "
             << addr.getHost() << ":" << addr.getPort() );