Improved consistency of comment formatting.
This commit is contained in:
@@ -1,19 +1,19 @@
|
|||||||
//Copyright (c) 2013-2015 United States Government as represented by the Administrator of the
|
// Copyright (c) 2013-2015 United States Government as represented by the Administrator of the
|
||||||
//National Aeronautics and Space Administration. All Rights Reserved.
|
// National Aeronautics and Space Administration. All Rights Reserved.
|
||||||
//
|
//
|
||||||
//X-Plane API
|
// X-Plane API
|
||||||
//Copyright(c) 2008, Sandy Barbour and Ben Supnik All rights reserved.
|
// Copyright(c) 2008, Sandy Barbour and Ben Supnik All rights reserved.
|
||||||
//Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||||
//associated documentation files(the "Software"), to deal in the Software without restriction,
|
// associated documentation files(the "Software"), to deal in the Software without restriction,
|
||||||
//including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
// including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||||
//sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is
|
// sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is
|
||||||
//furnished to do so, subject to the following conditions :
|
// furnished to do so, subject to the following conditions :
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
// * Neither the names of the authors nor that of X - Plane or Laminar Research
|
// * Neither the names of the authors nor that of X - Plane or Laminar Research
|
||||||
// may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission from the authors or
|
// without specific prior written permission from the authors or
|
||||||
// Laminar Research, respectively.
|
// Laminar Research, respectively.
|
||||||
#include "DataManager.h"
|
#include "DataManager.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
|
||||||
@@ -724,7 +724,7 @@ namespace XPC
|
|||||||
{
|
{
|
||||||
// Convert to Quaternions
|
// Convert to Quaternions
|
||||||
// from: http://www.xsquawkbox.net/xpsdk/mediawiki/MovingThePlane
|
// from: http://www.xsquawkbox.net/xpsdk/mediawiki/MovingThePlane
|
||||||
// http://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19770024290.pdf
|
// http://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19770024290.pdf
|
||||||
float q[4];
|
float q[4];
|
||||||
float halfRad = 0.00872664625997F;
|
float halfRad = 0.00872664625997F;
|
||||||
orient[2] = halfRad * orient[2];
|
orient[2] = halfRad * orient[2];
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//Copyright (c) 2013-2015 United States Government as represented by the Administrator of the
|
// Copyright (c) 2013-2015 United States Government as represented by the Administrator of the
|
||||||
//National Aeronautics and Space Administration. All Rights Reserved.
|
// National Aeronautics and Space Administration. All Rights Reserved.
|
||||||
#ifndef XPCPLUGIN_DATAMANAGER_H_
|
#ifndef XPCPLUGIN_DATAMANAGER_H_
|
||||||
#define XPCPLUGIN_DATAMANAGER_H_
|
#define XPCPLUGIN_DATAMANAGER_H_
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ namespace XPC
|
|||||||
DREF_L,
|
DREF_L,
|
||||||
DREF_N,
|
DREF_N,
|
||||||
|
|
||||||
//PQR (Angular Velocities)
|
// PQR (Angular Velocities)
|
||||||
DREF_QRad = 1600,
|
DREF_QRad = 1600,
|
||||||
DREF_PRad,
|
DREF_PRad,
|
||||||
DREF_RRad,
|
DREF_RRad,
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
//Copyright (c) 2013-2015 United States Government as represented by the Administrator of the
|
// Copyright (c) 2013-2015 United States Government as represented by the Administrator of the
|
||||||
//National Aeronautics and Space Administration. All Rights Reserved.
|
// National Aeronautics and Space Administration. All Rights Reserved.
|
||||||
//
|
//
|
||||||
//X-Plane API
|
// X-Plane API
|
||||||
//Copyright(c) 2008, Sandy Barbour and Ben Supnik All rights reserved.
|
// Copyright(c) 2008, Sandy Barbour and Ben Supnik All rights reserved.
|
||||||
//Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||||
//associated documentation files(the "Software"), to deal in the Software without restriction,
|
// associated documentation files(the "Software"), to deal in the Software without restriction,
|
||||||
//including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
// including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||||
//sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is
|
// sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is
|
||||||
//furnished to do so, subject to the following conditions :
|
// furnished to do so, subject to the following conditions :
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
// * Neither the names of the authors nor that of X - Plane or Laminar Research
|
// * Neither the names of the authors nor that of X - Plane or Laminar Research
|
||||||
// may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission from the authors or
|
// without specific prior written permission from the authors or
|
||||||
// Laminar Research, respectively.
|
// Laminar Research, respectively.
|
||||||
#include "Drawing.h"
|
#include "Drawing.h"
|
||||||
|
|
||||||
#include "XPLMDisplay.h"
|
#include "XPLMDisplay.h"
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
//OpenGL includes
|
// OpenGL includes
|
||||||
#if IBM
|
#if IBM
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -31,11 +31,11 @@
|
|||||||
# include <OpenGL/gl.h>
|
# include <OpenGL/gl.h>
|
||||||
#else
|
#else
|
||||||
# include <GL/gl.h>
|
# include <GL/gl.h>
|
||||||
#endif/*__APPLE__*/
|
#endif
|
||||||
|
|
||||||
namespace XPC
|
namespace XPC
|
||||||
{
|
{
|
||||||
//Internal Structures
|
// Internal Structures
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
double x;
|
double x;
|
||||||
@@ -43,7 +43,7 @@ namespace XPC
|
|||||||
double z;
|
double z;
|
||||||
} LocalPoint;
|
} LocalPoint;
|
||||||
|
|
||||||
//Internal Memory
|
// Internal Memory
|
||||||
static const size_t MSG_MAX = 1024;
|
static const size_t MSG_MAX = 1024;
|
||||||
static const size_t MSG_LINE_MAX = MSG_MAX / 16;
|
static const size_t MSG_LINE_MAX = MSG_MAX / 16;
|
||||||
static bool msgEnabled = false;
|
static bool msgEnabled = false;
|
||||||
@@ -64,7 +64,7 @@ namespace XPC
|
|||||||
XPLMDataRef planeYref;
|
XPLMDataRef planeYref;
|
||||||
XPLMDataRef planeZref;
|
XPLMDataRef planeZref;
|
||||||
|
|
||||||
//Internal Functions
|
// Internal Functions
|
||||||
|
|
||||||
/// Comparse two size_t integers. Used by qsort in RemoveWaypoints.
|
/// Comparse two size_t integers. Used by qsort in RemoveWaypoints.
|
||||||
static int cmp(const void * a, const void * b)
|
static int cmp(const void * a, const void * b)
|
||||||
@@ -90,34 +90,34 @@ namespace XPC
|
|||||||
/// \param d The distance from the player airplane to the center of the cube.
|
/// \param d The distance from the player airplane to the center of the cube.
|
||||||
static void gl_drawCube(float x, float y, float z, float d)
|
static void gl_drawCube(float x, float y, float z, float d)
|
||||||
{
|
{
|
||||||
//tan(0.25) degrees. Should scale all markers to appear about the same size
|
// tan(0.25) degrees. Should scale all markers to appear about the same size
|
||||||
const float TAN = 0.00436335F;
|
const float TAN = 0.00436335F;
|
||||||
float h = d * TAN;
|
float h = d * TAN;
|
||||||
|
|
||||||
glBegin(GL_QUAD_STRIP);
|
glBegin(GL_QUAD_STRIP);
|
||||||
//Top
|
// Top
|
||||||
glVertex3f(x - h, y + h, z - h);
|
glVertex3f(x - h, y + h, z - h);
|
||||||
glVertex3f(x + h, y + h, z - h);
|
glVertex3f(x + h, y + h, z - h);
|
||||||
glVertex3f(x - h, y + h, z + h);
|
glVertex3f(x - h, y + h, z + h);
|
||||||
glVertex3f(x + h, y + h, z + h);
|
glVertex3f(x + h, y + h, z + h);
|
||||||
//Front
|
// Front
|
||||||
glVertex3f(x - h, y - h, z + h);
|
glVertex3f(x - h, y - h, z + h);
|
||||||
glVertex3f(x + h, y - h, z + h);
|
glVertex3f(x + h, y - h, z + h);
|
||||||
//Bottom
|
// Bottom
|
||||||
glVertex3f(x - h, y - h, z - h);
|
glVertex3f(x - h, y - h, z - h);
|
||||||
glVertex3f(x + h, y - h, z - h);
|
glVertex3f(x + h, y - h, z - h);
|
||||||
//Back
|
// Back
|
||||||
glVertex3f(x - h, y + h, z - h);
|
glVertex3f(x - h, y + h, z - h);
|
||||||
glVertex3f(x + h, y + h, z - h);
|
glVertex3f(x + h, y + h, z - h);
|
||||||
|
|
||||||
glEnd();
|
glEnd();
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
//Left
|
// Left
|
||||||
glVertex3f(x - h, y + h, z - h);
|
glVertex3f(x - h, y + h, z - h);
|
||||||
glVertex3f(x - h, y + h, z + h);
|
glVertex3f(x - h, y + h, z + h);
|
||||||
glVertex3f(x - h, y - h, z + h);
|
glVertex3f(x - h, y - h, z + h);
|
||||||
glVertex3f(x - h, y - h, z - h);
|
glVertex3f(x - h, y - h, z - h);
|
||||||
//Right
|
// Right
|
||||||
glVertex3f(x + h, y + h, z + h);
|
glVertex3f(x + h, y + h, z + h);
|
||||||
glVertex3f(x + h, y + h, z - h);
|
glVertex3f(x + h, y + h, z - h);
|
||||||
glVertex3f(x + h, y - h, z - h);
|
glVertex3f(x + h, y - h, z - h);
|
||||||
@@ -147,7 +147,7 @@ namespace XPC
|
|||||||
float py = XPLMGetDataf(planeYref);
|
float py = XPLMGetDataf(planeYref);
|
||||||
float pz = XPLMGetDataf(planeZref);
|
float pz = XPLMGetDataf(planeZref);
|
||||||
|
|
||||||
//Convert to local
|
// Convert to local
|
||||||
for (size_t i = 0; i < numWaypoints; ++i)
|
for (size_t i = 0; i < numWaypoints; ++i)
|
||||||
{
|
{
|
||||||
Waypoint* g = &waypoints[i];
|
Waypoint* g = &waypoints[i];
|
||||||
@@ -157,7 +157,7 @@ namespace XPC
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Draw posts
|
// Draw posts
|
||||||
glColor3f(1.0F, 1.0F, 1.0F);
|
glColor3f(1.0F, 1.0F, 1.0F);
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
for (size_t i = 0; i < numWaypoints; ++i)
|
for (size_t i = 0; i < numWaypoints; ++i)
|
||||||
@@ -168,7 +168,7 @@ namespace XPC
|
|||||||
}
|
}
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
//Draw route
|
// Draw route
|
||||||
glColor3f(1.0F, 0.0F, 0.0F);
|
glColor3f(1.0F, 0.0F, 0.0F);
|
||||||
glBegin(GL_LINE_STRIP);
|
glBegin(GL_LINE_STRIP);
|
||||||
for (size_t i = 0; i < numWaypoints; ++i)
|
for (size_t i = 0; i < numWaypoints; ++i)
|
||||||
@@ -178,7 +178,7 @@ namespace XPC
|
|||||||
}
|
}
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
//Draw markers
|
// Draw markers
|
||||||
glColor3f(1.0F, 1.0F, 1.0F);
|
glColor3f(1.0F, 1.0F, 1.0F);
|
||||||
for (size_t i = 0; i < numWaypoints; ++i)
|
for (size_t i = 0; i < numWaypoints; ++i)
|
||||||
{
|
{
|
||||||
@@ -192,7 +192,7 @@ namespace XPC
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Public Functions
|
// Public Functions
|
||||||
void Drawing::ClearMessage()
|
void Drawing::ClearMessage()
|
||||||
{
|
{
|
||||||
XPLMUnregisterDrawCallback(MessageDrawCallback, xplm_Phase_Window, 0, NULL);
|
XPLMUnregisterDrawCallback(MessageDrawCallback, xplm_Phase_Window, 0, NULL);
|
||||||
@@ -209,7 +209,7 @@ namespace XPC
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Set the message, location, and mark new lines.
|
// Set the message, location, and mark new lines.
|
||||||
strncpy(msgVal, msg, len + 1);
|
strncpy(msgVal, msg, len + 1);
|
||||||
newLineCount = 0;
|
newLineCount = 0;
|
||||||
for (size_t i = 0; i < len && newLineCount < MSG_LINE_MAX; ++i)
|
for (size_t i = 0; i < len && newLineCount < MSG_LINE_MAX; ++i)
|
||||||
@@ -223,7 +223,7 @@ namespace XPC
|
|||||||
msgX = x < 0 ? 10 : x;
|
msgX = x < 0 ? 10 : x;
|
||||||
msgY = y < 0 ? 600 : y;
|
msgY = y < 0 ? 600 : y;
|
||||||
|
|
||||||
//Enable drawing if necessary
|
// Enable drawing if necessary
|
||||||
if (!msgEnabled)
|
if (!msgEnabled)
|
||||||
{
|
{
|
||||||
XPLMRegisterDrawCallback(MessageDrawCallback, xplm_Phase_Window, 0, NULL);
|
XPLMRegisterDrawCallback(MessageDrawCallback, xplm_Phase_Window, 0, NULL);
|
||||||
@@ -268,7 +268,7 @@ namespace XPC
|
|||||||
|
|
||||||
void Drawing::RemoveWaypoints(Waypoint points[], size_t numPoints)
|
void Drawing::RemoveWaypoints(Waypoint points[], size_t numPoints)
|
||||||
{
|
{
|
||||||
//Build a list of indices of waypoints we should delete.
|
// Build a list of indices of waypoints we should delete.
|
||||||
size_t delPoints[WAYPOINT_MAX];
|
size_t delPoints[WAYPOINT_MAX];
|
||||||
size_t delPointsCur = 0;
|
size_t delPointsCur = 0;
|
||||||
for (size_t i = 0; i < numPoints; ++i)
|
for (size_t i = 0; i < numPoints; ++i)
|
||||||
@@ -286,10 +286,10 @@ namespace XPC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Sort the indices so that we only have to iterate them once
|
// Sort the indices so that we only have to iterate them once
|
||||||
qsort(delPoints, delPointsCur, sizeof(size_t), cmp);
|
qsort(delPoints, delPointsCur, sizeof(size_t), cmp);
|
||||||
|
|
||||||
//Copy the new array on top of the old array
|
// Copy the new array on top of the old array
|
||||||
size_t copyCur = 0;
|
size_t copyCur = 0;
|
||||||
size_t count = delPointsCur;
|
size_t count = delPointsCur;
|
||||||
delPointsCur = 0;
|
delPointsCur = 0;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//Copyright (c) 2013-2015 United States Government as represented by the Administrator of the
|
// Copyright (c) 2013-2015 United States Government as represented by the Administrator of the
|
||||||
//National Aeronautics and Space Administration. All Rights Reserved.
|
// National Aeronautics and Space Administration. All Rights Reserved.
|
||||||
#ifndef XPCPLUGIN_DRAWING_H_
|
#ifndef XPCPLUGIN_DRAWING_H_
|
||||||
#define XPCPLUGIN_DRAWING_H_
|
#define XPCPLUGIN_DRAWING_H_
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//Copyright (c) 2013-2015 United States Government as represented by the Administrator of the
|
// Copyright (c) 2013-2015 United States Government as represented by the Administrator of the
|
||||||
//National Aeronautics and Space Administration. All Rights Reserved.
|
// National Aeronautics and Space Administration. All Rights Reserved.
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
|
||||||
#include "XPLMUtilities.h"
|
#include "XPLMUtilities.h"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//Copyright (c) 2013-2015 United States Government as represented by the Administrator of the
|
// Copyright (c) 2013-2015 United States Government as represented by the Administrator of the
|
||||||
//National Aeronautics and Space Administration. All Rights Reserved.
|
// National Aeronautics and Space Administration. All Rights Reserved.
|
||||||
#ifndef XPCPLUGIN_LOG_H_
|
#ifndef XPCPLUGIN_LOG_H_
|
||||||
#define XPCPLUGIN_LOG_H_
|
#define XPCPLUGIN_LOG_H_
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//Copyright (c) 2013-2015 United States Government as represented by the Administrator of the
|
// Copyright (c) 2013-2015 United States Government as represented by the Administrator of the
|
||||||
//National Aeronautics and Space Administration. All Rights Reserved.
|
// National Aeronautics and Space Administration. All Rights Reserved.
|
||||||
#include "Message.h"
|
#include "Message.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//Copyright (c) 2013-2015 United States Government as represented by the Administrator of the
|
// Copyright (c) 2013-2015 United States Government as represented by the Administrator of the
|
||||||
//National Aeronautics and Space Administration. All Rights Reserved.
|
// National Aeronautics and Space Administration. All Rights Reserved.
|
||||||
#ifndef XPCPLUGIN_MESSAGE_H_
|
#ifndef XPCPLUGIN_MESSAGE_H_
|
||||||
#define XPCPLUGIN_MESSAGE_H_
|
#define XPCPLUGIN_MESSAGE_H_
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
//Copyright (c) 2013-2015 United States Government as represented by the Administrator of the
|
// Copyright (c) 2013-2015 United States Government as represented by the Administrator of the
|
||||||
//National Aeronautics and Space Administration. All Rights Reserved.
|
// National Aeronautics and Space Administration. All Rights Reserved.
|
||||||
//
|
//
|
||||||
//X-Plane API
|
// X-Plane API
|
||||||
//Copyright(c) 2008, Sandy Barbour and Ben Supnik All rights reserved.
|
// Copyright(c) 2008, Sandy Barbour and Ben Supnik All rights reserved.
|
||||||
//Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||||
//associated documentation files(the "Software"), to deal in the Software without restriction,
|
// associated documentation files(the "Software"), to deal in the Software without restriction,
|
||||||
//including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
// including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||||
//sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is
|
// sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is
|
||||||
//furnished to do so, subject to the following conditions :
|
// furnished to do so, subject to the following conditions :
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
// * Neither the names of the authors nor that of X - Plane or Laminar Research
|
// * Neither the names of the authors nor that of X - Plane or Laminar Research
|
||||||
// may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission from the authors or
|
// without specific prior written permission from the authors or
|
||||||
// Laminar Research, respectively.
|
// Laminar Research, respectively.
|
||||||
#include "MessageHandlers.h"
|
#include "MessageHandlers.h"
|
||||||
#include "DataManager.h"
|
#include "DataManager.h"
|
||||||
#include "Drawing.h"
|
#include "Drawing.h"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//Copyright (c) 2013-2015 United States Government as represented by the Administrator of the
|
// Copyright (c) 2013-2015 United States Government as represented by the Administrator of the
|
||||||
//National Aeronautics and Space Administration. All Rights Reserved.
|
// National Aeronautics and Space Administration. All Rights Reserved.
|
||||||
#ifndef XPCPLUGIN_MESSAGEHANDLERS_H_
|
#ifndef XPCPLUGIN_MESSAGEHANDLERS_H_
|
||||||
#define XPCPLUGIN_MESSAGEHANDLERS_H_
|
#define XPCPLUGIN_MESSAGEHANDLERS_H_
|
||||||
#include "Message.h"
|
#include "Message.h"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//Copyright (c) 2013-2015 United States Government as represented by the Administrator of the
|
// Copyright (c) 2013-2015 United States Government as represented by the Administrator of the
|
||||||
//National Aeronautics and Space Administration. All Rights Reserved.
|
// National Aeronautics and Space Administration. All Rights Reserved.
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "UDPSocket.h"
|
#include "UDPSocket.h"
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ namespace XPC
|
|||||||
localAddr.sin_addr.s_addr = INADDR_ANY;
|
localAddr.sin_addr.s_addr = INADDR_ANY;
|
||||||
localAddr.sin_port = htons(recvPort);
|
localAddr.sin_port = htons(recvPort);
|
||||||
|
|
||||||
//Create and bind the socket
|
// Create and bind the socket
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
WSADATA wsa;
|
WSADATA wsa;
|
||||||
int startResult = WSAStartup(MAKEWORD(2, 2), &wsa);
|
int startResult = WSAStartup(MAKEWORD(2, 2), &wsa);
|
||||||
@@ -56,7 +56,7 @@ namespace XPC
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Set Timout
|
// Set Timout
|
||||||
int usTimeOut = 500;
|
int usTimeOut = 500;
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@@ -68,8 +68,8 @@ namespace XPC
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
tv.tv_sec = 0; /* Sec Timeout */
|
tv.tv_sec = 0;
|
||||||
tv.tv_usec = usTimeOut; // Microsec Timeout
|
tv.tv_usec = usTimeOut;
|
||||||
setsockopt(this->sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(struct timeval));
|
setsockopt(this->sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(struct timeval));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -103,8 +103,8 @@ namespace XPC
|
|||||||
FD_SET(sock, &stReadFDS);
|
FD_SET(sock, &stReadFDS);
|
||||||
FD_ZERO(&stExceptFDS);
|
FD_ZERO(&stExceptFDS);
|
||||||
FD_SET(sock, &stExceptFDS);
|
FD_SET(sock, &stExceptFDS);
|
||||||
tv.tv_sec = 0; /* Sec Timeout */
|
tv.tv_sec = 0;
|
||||||
tv.tv_usec = 250; // Microsec Timeout
|
tv.tv_usec = 250;
|
||||||
|
|
||||||
// Select Command
|
// Select Command
|
||||||
int result = select(-1, &stReadFDS, (FD_SET *)0, &stExceptFDS, &tv);
|
int result = select(-1, &stReadFDS, (FD_SET *)0, &stExceptFDS, &tv);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//Copyright (c) 2013-2015 United States Government as represented by the Administrator of the
|
// Copyright (c) 2013-2015 United States Government as represented by the Administrator of the
|
||||||
//National Aeronautics and Space Administration. All Rights Reserved.
|
// National Aeronautics and Space Administration. All Rights Reserved.
|
||||||
#ifndef XPCPLUGIN_SOCKET_H_
|
#ifndef XPCPLUGIN_SOCKET_H_
|
||||||
#define XPCPLUGIN_SOCKET_H_
|
#define XPCPLUGIN_SOCKET_H_
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include <ws2tcpip.h>
|
#include <ws2tcpip.h>
|
||||||
#pragma comment(lib, "ws2_32.lib") //Winsock Library
|
#pragma comment(lib, "ws2_32.lib") // Winsock Library
|
||||||
#elif (__APPLE__ || __linux)
|
#elif (__APPLE__ || __linux)
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
@@ -45,9 +45,9 @@ namespace XPC
|
|||||||
/// \param buffer The array to copy the data into.
|
/// \param buffer The array to copy the data into.
|
||||||
/// \param size The number of bytes to read.
|
/// \param size The number of bytes to read.
|
||||||
/// \param remoteAddr When at least one byte is read, contains the address
|
/// \param remoteAddr When at least one byte is read, contains the address
|
||||||
/// of the remote host.
|
/// of the remote host.
|
||||||
/// \returns The number of bytes read, or a negative number if
|
/// \returns The number of bytes read, or a negative number if
|
||||||
/// an error occurs.
|
/// an error occurs.
|
||||||
int Read(unsigned char* buffer, int size, sockaddr* remoteAddr) const;
|
int Read(unsigned char* buffer, int size, sockaddr* remoteAddr) const;
|
||||||
|
|
||||||
/// Sends data to the specified remote endpoint.
|
/// Sends data to the specified remote endpoint.
|
||||||
|
|||||||
@@ -1,58 +1,58 @@
|
|||||||
//Copyright (c) 2013-2015 United States Government as represented by the Administrator of the
|
// Copyright (c) 2013-2015 United States Government as represented by the Administrator of the
|
||||||
//National Aeronautics and Space Administration. All Rights Reserved.
|
// National Aeronautics and Space Administration. All Rights Reserved.
|
||||||
//
|
//
|
||||||
//DISCLAIMERS
|
// DISCLAIMERS
|
||||||
// No Warranty: THE SUBJECT SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY OF ANY KIND,
|
// No Warranty: THE SUBJECT SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY OF ANY KIND,
|
||||||
// EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY THAT
|
// EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY THAT
|
||||||
// THE SUBJECT SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF
|
// THE SUBJECT SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF
|
||||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR FREEDOM FROM INFRINGEMENT, ANY WARRANTY
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR FREEDOM FROM INFRINGEMENT, ANY WARRANTY
|
||||||
// THAT THE SUBJECT SOFTWARE WILL BE ERROR FREE, OR ANY WARRANTY THAT DOCUMENTATION, IF PROVIDED,
|
// THAT THE SUBJECT SOFTWARE WILL BE ERROR FREE, OR ANY WARRANTY THAT DOCUMENTATION, IF PROVIDED,
|
||||||
// WILL CONFORM TO THE SUBJECT SOFTWARE. THIS AGREEMENT DOES NOT, IN ANY MANNER, CONSTITUTE AN
|
// WILL CONFORM TO THE SUBJECT SOFTWARE. THIS AGREEMENT DOES NOT, IN ANY MANNER, CONSTITUTE AN
|
||||||
// ENDORSEMENT BY GOVERNMENT AGENCY OR ANY PRIOR RECIPIENT OF ANY RESULTS, RESULTING DESIGNS,
|
// ENDORSEMENT BY GOVERNMENT AGENCY OR ANY PRIOR RECIPIENT OF ANY RESULTS, RESULTING DESIGNS,
|
||||||
// HARDWARE, SOFTWARE PRODUCTS OR ANY OTHER APPLICATIONS RESULTING FROM USE OF THE SUBJECT
|
// HARDWARE, SOFTWARE PRODUCTS OR ANY OTHER APPLICATIONS RESULTING FROM USE OF THE SUBJECT
|
||||||
// SOFTWARE. FURTHER, GOVERNMENT AGENCY DISCLAIMS ALL WARRANTIES AND LIABILITIES REGARDING
|
// SOFTWARE. FURTHER, GOVERNMENT AGENCY DISCLAIMS ALL WARRANTIES AND LIABILITIES REGARDING
|
||||||
// THIRD-PARTY SOFTWARE, IF PRESENT IN THE ORIGINAL SOFTWARE, AND DISTRIBUTES IT "AS IS."
|
// THIRD-PARTY SOFTWARE, IF PRESENT IN THE ORIGINAL SOFTWARE, AND DISTRIBUTES IT "AS IS."
|
||||||
//
|
//
|
||||||
// Waiver and Indemnity: RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS AGAINST THE UNITED STATES
|
// Waiver and Indemnity: RECIPIENT AGREES TO WAIVE ANY AND ALL CLAIMS AGAINST THE UNITED STATES
|
||||||
// GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT. IF
|
// GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT. IF
|
||||||
// RECIPIENT'S USE OF THE SUBJECT SOFTWARE RESULTS IN ANY LIABILITIES, DEMANDS, DAMAGES, EXPENSES
|
// RECIPIENT'S USE OF THE SUBJECT SOFTWARE RESULTS IN ANY LIABILITIES, DEMANDS, DAMAGES, EXPENSES
|
||||||
// OR LOSSES ARISING FROM SUCH USE, INCLUDING ANY DAMAGES FROM PRODUCTS BASED ON, OR RESULTING
|
// OR LOSSES ARISING FROM SUCH USE, INCLUDING ANY DAMAGES FROM PRODUCTS BASED ON, OR RESULTING
|
||||||
// FROM, RECIPIENT'S USE OF THE SUBJECT SOFTWARE, RECIPIENT SHALL INDEMNIFY AND HOLD HARMLESS THE
|
// FROM, RECIPIENT'S USE OF THE SUBJECT SOFTWARE, RECIPIENT SHALL INDEMNIFY AND HOLD HARMLESS THE
|
||||||
// UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT,
|
// UNITED STATES GOVERNMENT, ITS CONTRACTORS AND SUBCONTRACTORS, AS WELL AS ANY PRIOR RECIPIENT,
|
||||||
// TO THE EXTENT PERMITTED BY LAW. RECIPIENT'S SOLE REMEDY FOR ANY SUCH MATTER SHALL BE THE
|
// TO THE EXTENT PERMITTED BY LAW. RECIPIENT'S SOLE REMEDY FOR ANY SUCH MATTER SHALL BE THE
|
||||||
// IMMEDIATE, UNILATERAL TERMINATION OF THIS AGREEMENT.
|
// IMMEDIATE, UNILATERAL TERMINATION OF THIS AGREEMENT.
|
||||||
//
|
//
|
||||||
//X-Plane API
|
// X-Plane API
|
||||||
//Copyright(c) 2008, Sandy Barbour and Ben Supnik All rights reserved.
|
// Copyright(c) 2008, Sandy Barbour and Ben Supnik All rights reserved.
|
||||||
//Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
|
||||||
//associated documentation files(the "Software"), to deal in the Software without restriction,
|
// associated documentation files(the "Software"), to deal in the Software without restriction,
|
||||||
//including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
// including without limitation the rights to use, copy, modify, merge, publish, distribute,
|
||||||
//sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is
|
// sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is
|
||||||
//furnished to do so, subject to the following conditions :
|
// furnished to do so, subject to the following conditions :
|
||||||
// * Redistributions of source code must retain the above copyright notice,
|
// * Redistributions of source code must retain the above copyright notice,
|
||||||
// this list of conditions and the following disclaimer.
|
// this list of conditions and the following disclaimer.
|
||||||
// * Neither the names of the authors nor that of X - Plane or Laminar Research
|
// * Neither the names of the authors nor that of X - Plane or Laminar Research
|
||||||
// may be used to endorse or promote products derived from this software
|
// may be used to endorse or promote products derived from this software
|
||||||
// without specific prior written permission from the authors or
|
// without specific prior written permission from the authors or
|
||||||
// Laminar Research, respectively.
|
// Laminar Research, respectively.
|
||||||
|
|
||||||
|
|
||||||
// X-Plane Connect Plugin
|
// X-Plane Connect Plugin
|
||||||
//
|
//
|
||||||
// DESCRIPTION
|
// DESCRIPTION
|
||||||
// XPCPlugin Facilitates Communication to and from the XPlane
|
// XPCPlugin Facilitates Communication to and from the XPlane
|
||||||
//
|
//
|
||||||
// INSTRUCTIONS
|
// INSTRUCTIONS
|
||||||
// See Readme.md in the root of this repository or the wiki hosted on GitHub at
|
// See Readme.md in the root of this repository or the wiki hosted on GitHub at
|
||||||
// https://github.com/nasa/XPlaneConnect/wiki for requirements, installation instructions,
|
// https://github.com/nasa/XPlaneConnect/wiki for requirements, installation instructions,
|
||||||
// and detailed documentation.
|
// and detailed documentation.
|
||||||
//
|
//
|
||||||
// CONTACT
|
// CONTACT
|
||||||
// For questions email Christopher Teubert (christopher.a.teubert@nasa.gov)
|
// For questions email Christopher Teubert (christopher.a.teubert@nasa.gov)
|
||||||
//
|
//
|
||||||
// CONTRIBUTORS
|
// CONTRIBUTORS
|
||||||
// CT: Christopher Teubert (christopher.a.teubert@nasa.gov)
|
// CT: Christopher Teubert (christopher.a.teubert@nasa.gov)
|
||||||
// JW: Jason Watkins (jason.w.watkins@nasa.gov)
|
// JW: Jason Watkins (jason.w.watkins@nasa.gov)
|
||||||
|
|
||||||
// XPC Includes
|
// XPC Includes
|
||||||
#include "DataManager.h"
|
#include "DataManager.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user