diff --git a/C/src/xplaneConnect.c b/C/src/xplaneConnect.c index f6f0a5d..9eb2f7a 100755 --- a/C/src/xplaneConnect.c +++ b/C/src/xplaneConnect.c @@ -48,6 +48,10 @@ #include #include +int sendUDP(XPCSocket sock, char buffer[], int len); +int readUDP(XPCSocket sock, char buffer[], int len); +int sendDREFRequest(XPCSocket sock, const char* drefs[], unsigned char count); +int getDREFResponse(XPCSocket sock, float* values[], unsigned char count, int sizes[]); void printError(char *functionName, char *format, ...) { va_list args; @@ -112,7 +116,7 @@ XPCSocket aopenUDP(const char *xpIP, unsigned short xpPort, unsigned short port) #else struct timeval timeout; timeout.tv_sec = 0; - timeout.tv_usec = 1000; + timeout.tv_usec = 100000; #endif if (setsockopt(sock.sock, SOL_SOCKET, SO_RCVTIMEO, (char*)&timeout, sizeof(timeout)) < 0) { diff --git a/MATLAB/+XPlaneConnect/closeUDP.m b/MATLAB/+XPlaneConnect/closeUDP.m index f49dd62..4941ae1 100644 --- a/MATLAB/+XPlaneConnect/closeUDP.m +++ b/MATLAB/+XPlaneConnect/closeUDP.m @@ -22,6 +22,10 @@ socket.close; %% Track open clients global clients; -%TODO: Remove stale clients +for i = 1:length(clients) + if socket == clients(i) + clients = [clients(1:i-1) clients(i+1:length(clients))]; + end +end end \ No newline at end of file diff --git a/MATLAB/+XPlaneConnect/sendDREF.m b/MATLAB/+XPlaneConnect/sendDREF.m index e9a1b5c..cbfacb3 100644 --- a/MATLAB/+XPlaneConnect/sendDREF.m +++ b/MATLAB/+XPlaneConnect/sendDREF.m @@ -15,4 +15,5 @@ if ~exist('socket', 'var') sendDREFs(dref, value) else sendDREFs(dref, value, socket) -end \ No newline at end of file +end +socket.sendDREF(dref, value); \ No newline at end of file diff --git a/xpcPlugin/DataManager.h b/xpcPlugin/DataManager.h index 178fb85..e5e5a50 100644 --- a/xpcPlugin/DataManager.h +++ b/xpcPlugin/DataManager.h @@ -133,7 +133,7 @@ namespace XPC DREF_MP4Alt, DREF_MP5Alt, DREF_MP6Alt, - DREF_MP7Alt, + DREF_MP7Alt }; /// Maps X-Plane dataref lines to XPC DREF values. diff --git a/xpcPlugin/XPlaneConnect/64/lin.xpl b/xpcPlugin/XPlaneConnect/64/lin.xpl index 991d757..82d335a 100755 Binary files a/xpcPlugin/XPlaneConnect/64/lin.xpl and b/xpcPlugin/XPlaneConnect/64/lin.xpl differ diff --git a/xpcPlugin/XPlaneConnect/64/win.xpl b/xpcPlugin/XPlaneConnect/64/win.xpl index e171bde..88b4c11 100644 Binary files a/xpcPlugin/XPlaneConnect/64/win.xpl and b/xpcPlugin/XPlaneConnect/64/win.xpl differ diff --git a/xpcPlugin/XPlaneConnect/lin.xpl b/xpcPlugin/XPlaneConnect/lin.xpl index e4dd997..67f6ccb 100755 Binary files a/xpcPlugin/XPlaneConnect/lin.xpl and b/xpcPlugin/XPlaneConnect/lin.xpl differ diff --git a/xpcPlugin/XPlaneConnect/mac.xpl b/xpcPlugin/XPlaneConnect/mac.xpl old mode 100755 new mode 100644 diff --git a/xpcPlugin/XPlaneConnect/win.xpl b/xpcPlugin/XPlaneConnect/win.xpl index 395ca48..30b6838 100644 Binary files a/xpcPlugin/XPlaneConnect/win.xpl and b/xpcPlugin/XPlaneConnect/win.xpl differ diff --git a/xpcPlugin/xpcPlugin.xcodeproj/project.pbxproj b/xpcPlugin/xpcPlugin.xcodeproj/project.pbxproj index 3c80015..4bca25c 100755 --- a/xpcPlugin/xpcPlugin.xcodeproj/project.pbxproj +++ b/xpcPlugin/xpcPlugin.xcodeproj/project.pbxproj @@ -207,7 +207,8 @@ D607B16309A5563100699BC3 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "c++98"; CLANG_CXX_LIBRARY = "libc++"; CONFIGURATION_BUILD_DIR = ./XPlaneConnect; DYLIB_COMPATIBILITY_VERSION = ""; @@ -246,7 +247,7 @@ PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = YES; PRODUCT_NAME = "${TARGET_NAME}"; SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = NO; - SDKROOT = macosx10.8; + SDKROOT = macosx; SYMROOT = build; XPSDK_ROOT = SDK; }; @@ -255,9 +256,10 @@ D607B16409A5563100699BC3 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "c++98"; CLANG_CXX_LIBRARY = "libc++"; - CONFIGURATION_BUILD_DIR = ./Mac; + CONFIGURATION_BUILD_DIR = ./XPlaneConnect; DYLIB_COMPATIBILITY_VERSION = ""; DYLIB_CURRENT_VERSION = ""; EXECUTABLE_EXTENSION = xpl; @@ -293,7 +295,7 @@ PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = YES; PRODUCT_NAME = "${TARGET_NAME}"; SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = NO; - SDKROOT = macosx10.8; + SDKROOT = macosx; SYMROOT = build; XPSDK_ROOT = SDK; }; @@ -331,6 +333,7 @@ ); MACH_O_TYPE = mh_bundle; PRODUCT_NAME = mac; + SDKROOT = macosx; STRIP_INSTALLED_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = XPC; @@ -368,7 +371,9 @@ "$(USER_LIBRARY_DIR)/Developer/Xcode/DerivedData/xplaneConnect-asdjuezcjkhojuewbyxhyhabxfwc/Build/Products/Debug", ); MACH_O_TYPE = mh_bundle; + ONLY_ACTIVE_ARCH = NO; PRODUCT_NAME = mac; + SDKROOT = macosx; STRIP_INSTALLED_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = XPC;