@@ -373,7 +373,7 @@ short sendPOSI(struct xpcSocket recfd, short ACNum, short numArgs, float valueAr
|
|||||||
|
|
||||||
short sendCTRL(struct xpcSocket recfd, short numArgs, float valueArray[])
|
short sendCTRL(struct xpcSocket recfd, short numArgs, float valueArray[])
|
||||||
{
|
{
|
||||||
char message[29] = {0};
|
char message[26] = {0};
|
||||||
int i;
|
int i;
|
||||||
short position = 5;
|
short position = 5;
|
||||||
|
|
||||||
@@ -396,12 +396,21 @@ short sendCTRL(struct xpcSocket recfd, short numArgs, float valueArray[])
|
|||||||
val = valueArray[i];
|
val = valueArray[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Float Values
|
if (i==4) // Integer-gear
|
||||||
memcpy(&message[position],&val,sizeof(float));
|
{
|
||||||
position += sizeof(float);
|
message[position] = (short int) val;
|
||||||
|
position += 1;
|
||||||
|
}
|
||||||
|
else // float
|
||||||
|
{
|
||||||
|
// Float Values
|
||||||
|
memcpy(&message[position],&val,sizeof(float));
|
||||||
|
position += sizeof(float);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sendUDP(recfd, message, 29);
|
sendUDP(recfd, message, 26);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ short sendCTRLTest() // sendCTRL test
|
|||||||
// Initialize
|
// Initialize
|
||||||
int i; // Iterator
|
int i; // Iterator
|
||||||
char DREFArray[100][100];
|
char DREFArray[100][100];
|
||||||
float CTRL[5] = {0.0};
|
float CTRL[6] = {0.0};
|
||||||
float *recDATA[100];
|
float *recDATA[100];
|
||||||
short DREFSizes[100];
|
short DREFSizes[100];
|
||||||
struct xpcSocket sendPort, recvPort;
|
struct xpcSocket sendPort, recvPort;
|
||||||
@@ -256,14 +256,16 @@ short sendCTRLTest() // sendCTRL test
|
|||||||
strcpy(DREFArray[2],"sim/cockpit2/controls/yoke_heading_ratio");
|
strcpy(DREFArray[2],"sim/cockpit2/controls/yoke_heading_ratio");
|
||||||
strcpy(DREFArray[3],"sim/flightmodel/engine/ENGN_thro");
|
strcpy(DREFArray[3],"sim/flightmodel/engine/ENGN_thro");
|
||||||
strcpy(DREFArray[4],"sim/cockpit/switches/gear_handle_status");
|
strcpy(DREFArray[4],"sim/cockpit/switches/gear_handle_status");
|
||||||
strcpy(DREFArray[5],"sim/flightmodel/controls/flaprqsts");
|
strcpy(DREFArray[5],"sim/flightmodel/controls/flaprqst");
|
||||||
for (i = 0; i < 100; i++) {
|
for (i = 0; i < 100; i++) {
|
||||||
DREFSizes[i] = (int)strlen(DREFArray[i]);
|
DREFSizes[i] = (int)strlen(DREFArray[i]);
|
||||||
}
|
}
|
||||||
CTRL[3] = 0.8; // Throttle
|
CTRL[3] = 0.8; // Throttle
|
||||||
|
CTRL[4] = 1; // Gear
|
||||||
|
CTRL[5] = 0.5; // Flaps
|
||||||
|
|
||||||
// Execute
|
// Execute
|
||||||
sendCTRL(sendPort, 4, CTRL);
|
sendCTRL(sendPort, 6, CTRL);
|
||||||
result = requestDREF(sendPort, recvPort, DREFArray, DREFSizes, 6, recDATA, DREFSizes); // Test
|
result = requestDREF(sendPort, recvPort, DREFArray, DREFSizes, 6, recDATA, DREFSizes); // Test
|
||||||
|
|
||||||
// Close
|
// Close
|
||||||
@@ -275,9 +277,9 @@ short sendCTRLTest() // sendCTRL test
|
|||||||
{
|
{
|
||||||
return -6;
|
return -6;
|
||||||
}
|
}
|
||||||
for (i=0;i<6-1;i++)
|
for (i=0;i<6;i++)
|
||||||
{
|
{
|
||||||
if (abs(recDATA[i][0]-CTRL[i])>1e-4)
|
if (fabs(recDATA[i][0]-CTRL[i])>1e-4)
|
||||||
{
|
{
|
||||||
return -i;
|
return -i;
|
||||||
}
|
}
|
||||||
@@ -343,7 +345,7 @@ short sendPOSITest() // sendPOSI test
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (abs(recDATA[i][0]-POSI[i])>1e-4)
|
if (fabs(recDATA[i][0]-POSI[i])>1e-4)
|
||||||
{
|
{
|
||||||
return -i;
|
return -i;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <cmath>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <exception>
|
#include <exception>
|
||||||
#include "xplaneconnect.h"
|
#include "xplaneconnect.h"
|
||||||
@@ -237,7 +238,7 @@ void sendCTRLTest() // sendCTRL test
|
|||||||
// Initialize
|
// Initialize
|
||||||
int i; // Iterator
|
int i; // Iterator
|
||||||
char DREFArray[100][100];
|
char DREFArray[100][100];
|
||||||
float CTRL[5] = {0.0};
|
float CTRL[6] = {0.0};
|
||||||
float *recDATA[100];
|
float *recDATA[100];
|
||||||
short DREFSizes[100];
|
short DREFSizes[100];
|
||||||
struct xpcSocket sendPort, recvPort;
|
struct xpcSocket sendPort, recvPort;
|
||||||
@@ -255,14 +256,16 @@ void sendCTRLTest() // sendCTRL test
|
|||||||
strcpy(DREFArray[2],"sim/cockpit2/controls/yoke_heading_ratio");
|
strcpy(DREFArray[2],"sim/cockpit2/controls/yoke_heading_ratio");
|
||||||
strcpy(DREFArray[3],"sim/flightmodel/engine/ENGN_thro");
|
strcpy(DREFArray[3],"sim/flightmodel/engine/ENGN_thro");
|
||||||
strcpy(DREFArray[4],"sim/cockpit/switches/gear_handle_status");
|
strcpy(DREFArray[4],"sim/cockpit/switches/gear_handle_status");
|
||||||
strcpy(DREFArray[5],"sim/flightmodel/controls/flaprqsts");
|
strcpy(DREFArray[5],"sim/flightmodel/controls/flaprqst");
|
||||||
for (i = 0; i < 100; i++) {
|
for (i = 0; i < 100; i++) {
|
||||||
DREFSizes[i] = (int)strlen(DREFArray[i]);
|
DREFSizes[i] = (int)strlen(DREFArray[i]);
|
||||||
}
|
}
|
||||||
CTRL[3] = 0.8; // Throttle
|
CTRL[3] = 0.8; // Throttle
|
||||||
|
CTRL[4] = 1.0; // Gear
|
||||||
|
CTRL[5] = 0.5; // Flaps
|
||||||
|
|
||||||
// Execute
|
// Execute
|
||||||
sendCTRL(sendPort, 4, CTRL);
|
sendCTRL(sendPort, 6, CTRL);
|
||||||
result = requestDREF(sendPort, recvPort, DREFArray, DREFSizes, 6, recDATA, DREFSizes); // Test
|
result = requestDREF(sendPort, recvPort, DREFArray, DREFSizes, 6, recDATA, DREFSizes); // Test
|
||||||
|
|
||||||
// Close
|
// Close
|
||||||
@@ -274,9 +277,9 @@ void sendCTRLTest() // sendCTRL test
|
|||||||
{
|
{
|
||||||
throw -6;
|
throw -6;
|
||||||
}
|
}
|
||||||
for (i=0;i<6-1;i++)
|
for (i=0;i<6;i++)
|
||||||
{
|
{
|
||||||
if (abs(recDATA[i][0]-CTRL[i])>1e-4)
|
if (std::abs( recDATA[i][0]-CTRL[i])>1e-4)
|
||||||
{
|
{
|
||||||
throw -i;
|
throw -i;
|
||||||
}
|
}
|
||||||
@@ -340,7 +343,7 @@ void sendPOSITest() // sendPOSI test
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (abs(recDATA[i][0]-POSI[i])>1e-4)
|
if (std::abs(recDATA[i][0]-POSI[i])>1e-4)
|
||||||
{
|
{
|
||||||
throw -i;
|
throw -i;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -755,7 +755,7 @@ int handleCTRL(char buf[])
|
|||||||
{
|
{
|
||||||
setGEAR(0, gear, 0); // Gear
|
setGEAR(0, gear, 0); // Gear
|
||||||
}
|
}
|
||||||
if ( flaps > -999.5 && flaps < -997.5 ) // Flaps
|
if ( flaps < -999.5 || flaps > -997.5 ) // Flaps
|
||||||
{
|
{
|
||||||
XPLMSetDataf(XPLMDataRefs[13][3],flaps);
|
XPLMSetDataf(XPLMDataRefs[13][3],flaps);
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
BIN
xpcPlugin/XPlaneConnect/mac.xpl
Normal file → Executable file
BIN
xpcPlugin/XPlaneConnect/mac.xpl
Normal file → Executable file
Binary file not shown.
Binary file not shown.
@@ -9,7 +9,7 @@
|
|||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
BE37D960187C8B0F0033B082 /* XPCPlugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE37D95E187C8B0F0033B082 /* XPCPlugin.cpp */; };
|
BE37D960187C8B0F0033B082 /* XPCPlugin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE37D95E187C8B0F0033B082 /* XPCPlugin.cpp */; };
|
||||||
BE5F2FF118FCA1D500AFCD17 /* xpcPluginTools.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE5F2FF018FCA1D500AFCD17 /* xpcPluginTools.cpp */; };
|
BE5F2FF118FCA1D500AFCD17 /* xpcPluginTools.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BE5F2FF018FCA1D500AFCD17 /* xpcPluginTools.cpp */; };
|
||||||
BE8361EF18C5591C00E9C923 /* xpcPlugin.xpl in CopyFiles */ = {isa = PBXBuildFile; fileRef = D607B19909A556E400699BC3 /* xpcPlugin.xpl */; };
|
BE8361EF18C5591C00E9C923 /* mac.xpl in CopyFiles */ = {isa = PBXBuildFile; fileRef = D607B19909A556E400699BC3 /* mac.xpl */; };
|
||||||
BEDC620418EDF1A7005DB364 /* xplaneConnect.c in Sources */ = {isa = PBXBuildFile; fileRef = BEDC620218EDF1A7005DB364 /* xplaneConnect.c */; };
|
BEDC620418EDF1A7005DB364 /* xplaneConnect.c in Sources */ = {isa = PBXBuildFile; fileRef = BEDC620218EDF1A7005DB364 /* xplaneConnect.c */; };
|
||||||
D6A7BDAA16A1DEA200D1426A /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D6A7BDA916A1DEA200D1426A /* OpenGL.framework */; };
|
D6A7BDAA16A1DEA200D1426A /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D6A7BDA916A1DEA200D1426A /* OpenGL.framework */; };
|
||||||
D6A7BDC116A1DEC000D1426A /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D6A7BDC016A1DEC000D1426A /* CoreFoundation.framework */; };
|
D6A7BDC116A1DEC000D1426A /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D6A7BDC016A1DEC000D1426A /* CoreFoundation.framework */; };
|
||||||
@@ -21,10 +21,10 @@
|
|||||||
BE8361EE18C5591600E9C923 /* CopyFiles */ = {
|
BE8361EE18C5591600E9C923 /* CopyFiles */ = {
|
||||||
isa = PBXCopyFilesBuildPhase;
|
isa = PBXCopyFilesBuildPhase;
|
||||||
buildActionMask = 12;
|
buildActionMask = 12;
|
||||||
dstPath = "/Applications/X-Plane 10/Resources/plugins";
|
dstPath = "/Applications/X-Plane 10/Resources/plugins/XPlaneConnect";
|
||||||
dstSubfolderSpec = 0;
|
dstSubfolderSpec = 0;
|
||||||
files = (
|
files = (
|
||||||
BE8361EF18C5591C00E9C923 /* xpcPlugin.xpl in CopyFiles */,
|
BE8361EF18C5591C00E9C923 /* mac.xpl in CopyFiles */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
BE5F2FF018FCA1D500AFCD17 /* xpcPluginTools.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xpcPluginTools.cpp; sourceTree = "<group>"; };
|
BE5F2FF018FCA1D500AFCD17 /* xpcPluginTools.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = xpcPluginTools.cpp; sourceTree = "<group>"; };
|
||||||
BEDC620218EDF1A7005DB364 /* xplaneConnect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = xplaneConnect.c; path = ../C/src/xplaneConnect.c; sourceTree = "<group>"; };
|
BEDC620218EDF1A7005DB364 /* xplaneConnect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = xplaneConnect.c; path = ../C/src/xplaneConnect.c; sourceTree = "<group>"; };
|
||||||
BEDC620318EDF1A7005DB364 /* xplaneConnect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = xplaneConnect.h; path = ../C/src/xplaneConnect.h; sourceTree = "<group>"; };
|
BEDC620318EDF1A7005DB364 /* xplaneConnect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = xplaneConnect.h; path = ../C/src/xplaneConnect.h; sourceTree = "<group>"; };
|
||||||
D607B19909A556E400699BC3 /* xpcPlugin.xpl */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = xpcPlugin.xpl; sourceTree = BUILT_PRODUCTS_DIR; };
|
D607B19909A556E400699BC3 /* mac.xpl */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = mac.xpl; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
D6A7BDA916A1DEA200D1426A /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
|
D6A7BDA916A1DEA200D1426A /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
|
||||||
D6A7BDC016A1DEC000D1426A /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
|
D6A7BDC016A1DEC000D1426A /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
|
||||||
D6A7BDF016A1DED200D1426A /* XPLM.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XPLM.framework; path = SDK/Libraries/Mac/XPLM.framework; sourceTree = "<group>"; };
|
D6A7BDF016A1DED200D1426A /* XPLM.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XPLM.framework; path = SDK/Libraries/Mac/XPLM.framework; sourceTree = "<group>"; };
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
D607B19A09A556E400699BC3 /* Products */ = {
|
D607B19A09A556E400699BC3 /* Products */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
D607B19909A556E400699BC3 /* xpcPlugin.xpl */,
|
D607B19909A556E400699BC3 /* mac.xpl */,
|
||||||
);
|
);
|
||||||
name = Products;
|
name = Products;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -117,7 +117,7 @@
|
|||||||
);
|
);
|
||||||
name = xpcPlugin;
|
name = xpcPlugin;
|
||||||
productName = StarterPlugin;
|
productName = StarterPlugin;
|
||||||
productReference = D607B19909A556E400699BC3 /* xpcPlugin.xpl */;
|
productReference = D607B19909A556E400699BC3 /* mac.xpl */;
|
||||||
productType = "com.apple.product-type.library.dynamic";
|
productType = "com.apple.product-type.library.dynamic";
|
||||||
};
|
};
|
||||||
/* End PBXNativeTarget section */
|
/* End PBXNativeTarget section */
|
||||||
@@ -165,7 +165,7 @@
|
|||||||
D607B16309A5563100699BC3 /* Debug */ = {
|
D607B16309A5563100699BC3 /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
CONFIGURATION_BUILD_DIR = ./Mac;
|
CONFIGURATION_BUILD_DIR = ./XPlaneConnect;
|
||||||
DYLIB_COMPATIBILITY_VERSION = "";
|
DYLIB_COMPATIBILITY_VERSION = "";
|
||||||
DYLIB_CURRENT_VERSION = "";
|
DYLIB_CURRENT_VERSION = "";
|
||||||
EXECUTABLE_EXTENSION = xpl;
|
EXECUTABLE_EXTENSION = xpl;
|
||||||
@@ -284,7 +284,7 @@
|
|||||||
"$(USER_LIBRARY_DIR)/Developer/Xcode/DerivedData/xplaneConnect-asdjuezcjkhojuewbyxhyhabxfwc/Build/Products/Debug",
|
"$(USER_LIBRARY_DIR)/Developer/Xcode/DerivedData/xplaneConnect-asdjuezcjkhojuewbyxhyhabxfwc/Build/Products/Debug",
|
||||||
);
|
);
|
||||||
MACH_O_TYPE = mh_bundle;
|
MACH_O_TYPE = mh_bundle;
|
||||||
PRODUCT_NAME = xpcPlugin;
|
PRODUCT_NAME = mac;
|
||||||
STRIP_INSTALLED_PRODUCT = YES;
|
STRIP_INSTALLED_PRODUCT = YES;
|
||||||
VERSIONING_SYSTEM = "apple-generic";
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
VERSION_INFO_PREFIX = XPC;
|
VERSION_INFO_PREFIX = XPC;
|
||||||
@@ -322,7 +322,7 @@
|
|||||||
"$(USER_LIBRARY_DIR)/Developer/Xcode/DerivedData/xplaneConnect-asdjuezcjkhojuewbyxhyhabxfwc/Build/Products/Debug",
|
"$(USER_LIBRARY_DIR)/Developer/Xcode/DerivedData/xplaneConnect-asdjuezcjkhojuewbyxhyhabxfwc/Build/Products/Debug",
|
||||||
);
|
);
|
||||||
MACH_O_TYPE = mh_bundle;
|
MACH_O_TYPE = mh_bundle;
|
||||||
PRODUCT_NAME = xpcPlugin;
|
PRODUCT_NAME = mac;
|
||||||
STRIP_INSTALLED_PRODUCT = YES;
|
STRIP_INSTALLED_PRODUCT = YES;
|
||||||
VERSIONING_SYSTEM = "apple-generic";
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
VERSION_INFO_PREFIX = XPC;
|
VERSION_INFO_PREFIX = XPC;
|
||||||
|
|||||||
Reference in New Issue
Block a user