]> git.mxchange.org Git - flightgear.git/blobdiff - utils/GPSsmooth/gps_main.cxx
Fix compilation.
[flightgear.git] / utils / GPSsmooth / gps_main.cxx
index cb70e3bc09b9be3037e4c48b42832c4a9f81c7e1..d28f8f1f4c58b7613ed6e874c2b32e3f615a88a5 100644 (file)
@@ -2,13 +2,19 @@
 #  include <config.h>
 #endif
 
+#ifdef HAVE_WINDOWS_H
+#  include <windows.h>
+#else
+#  include <netinet/in.h>       // htonl() ntohl()
+#endif
+
 #include <iostream>
 #include <string>
 
-#include <plib/net.h>
 #include <plib/sg.h>
 
 #include <simgear/io/lowlevel.hxx> // endian tests
+#include <simgear/io/raw_socket.hxx>
 #include <simgear/timing/timestamp.hxx>
 
 #include <Network/net_ctrls.hxx>
@@ -23,7 +29,7 @@ using std::string;
 
 
 // Network channels
-static netSocket fdm_sock, ctrls_sock;
+static simgear::Socket fdm_sock, ctrls_sock;
 
 // gps data
 GPSTrack track;
@@ -54,15 +60,15 @@ bool inited = false;
 // point value.  By doing the BIG_ENDIAN test, I can optimize the
 // routine for big-endian processors so it can be as efficient as
 // possible
-static void htond (double &x)  
+static void htond (double &x)
 {
     if ( sgIsLittleEndian() ) {
         int    *Double_Overlay;
         int     Holding_Buffer;
-    
+
         Double_Overlay = (int *) &x;
         Holding_Buffer = Double_Overlay [0];
-    
+
         Double_Overlay [0] = htonl (Double_Overlay [1]);
         Double_Overlay [1] = htonl (Holding_Buffer);
     } else {
@@ -71,15 +77,15 @@ static void htond (double &x)
 }
 
 // Float version
-static void htonf (float &x)   
+static void htonf (float &x)
 {
     if ( sgIsLittleEndian() ) {
         int    *Float_Overlay;
         int     Holding_Buffer;
-    
+
         Float_Overlay = (int *) &x;
         Holding_Buffer = Float_Overlay [0];
-    
+
         Float_Overlay [0] = htonl (Holding_Buffer);
     } else {
         return;
@@ -275,8 +281,7 @@ static void gps2fg( const GPSPoint p, FGNetFDM *fdm, FGNetCtrls *ctrls )
 
 
 static void send_data( const GPSPoint p ) {
-    int len;
-    int ctrlsize = sizeof( FGNetCtrls );
+//    int ctrlsize = sizeof( FGNetCtrls );
     int fdmsize = sizeof( FGNetFDM );
 
     // cout << "Running main loop" << endl;
@@ -285,7 +290,7 @@ static void send_data( const GPSPoint p ) {
     FGNetCtrls fgctrls;
 
     gps2fg( p, &fgfdm, &fgctrls );
-    len = fdm_sock.send(&fgfdm, fdmsize, 0);
+    fdm_sock.send(&fgfdm, fdmsize, 0);
 }
 
 
@@ -369,7 +374,7 @@ int main( int argc, char **argv ) {
 
     // Setup up outgoing network connections
 
-    netInit( &argc,argv ); // We must call this before any other net stuff
+    simgear::Socket::initSockets(); // We must call this before any other net stuff
 
     if ( ! fdm_sock.open( false ) ) {  // open a UDP socket
         cout << "error opening fdm output socket" << endl;
@@ -425,7 +430,7 @@ int main( int argc, char **argv ) {
 
     GPSPoint p, p0, p1;
     p0 = p1 = track.get_point( 0 );
-    
+
     while ( current_time < end_time ) {
         // cout << "current_time = " << current_time << " end_time = "
         //      << end_time << endl;