From e084d19c4e17885437a9e71f2c3ae39ad830f5d8 Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM Signature) Date: Fri, 15 Nov 2013 12:33:21 +0800 Subject: added xcode project to define missing symbols IOBluetooth for Mac OS X 10.8+ is missing symbols referenced in Fantom. Defined stub functions for the missing symbols to keep Fantom happy. --- .gitignore | 3 + .../IOBluetooth-Compat.xcodeproj/project.pbxproj | 442 +++++++++++++++++++++ .../project.xcworkspace/contents.xcworkspacedata | 7 + .../xcshareddata/IOBluetooth-Compat.xccheckout | 41 ++ .../UserInterfaceState.xcuserstate | Bin 0 -> 51931 bytes .../tcmac.xcuserdatad/WorkspaceSettings.xcsettings | 24 ++ .../xcschemes/IOBluetooth-Compat.xcscheme | 69 ++++ .../xcschemes/xcschememanagement.plist | 27 ++ .../IOBluetooth-Compat-Prefix.pch | 9 + .../IOBluetooth-Compat/IOBluetooth_Compat.h | 236 +++++++++++ .../IOBluetooth-Compat/IOBluetooth_Compat.m | 102 +++++ .../IOBluetooth-CompatTests-Info.plist | 22 + .../IOBluetooth_CompatTests.m | 34 ++ .../en.lproj/InfoPlist.strings | 2 + README | 12 + pyfantom.py | 43 +- 16 files changed, 1062 insertions(+), 11 deletions(-) create mode 100644 IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.pbxproj create mode 100644 IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/xcshareddata/IOBluetooth-Compat.xccheckout create mode 100644 IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/xcuserdata/tcmac.xcuserdatad/UserInterfaceState.xcuserstate create mode 100644 IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/xcuserdata/tcmac.xcuserdatad/WorkspaceSettings.xcsettings create mode 100644 IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/xcuserdata/tcmac.xcuserdatad/xcschemes/IOBluetooth-Compat.xcscheme create mode 100644 IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/xcuserdata/tcmac.xcuserdatad/xcschemes/xcschememanagement.plist create mode 100644 IOBluetooth-Compat/IOBluetooth-Compat/IOBluetooth-Compat-Prefix.pch create mode 100644 IOBluetooth-Compat/IOBluetooth-Compat/IOBluetooth_Compat.h create mode 100644 IOBluetooth-Compat/IOBluetooth-Compat/IOBluetooth_Compat.m create mode 100644 IOBluetooth-Compat/IOBluetooth-CompatTests/IOBluetooth-CompatTests-Info.plist create mode 100644 IOBluetooth-Compat/IOBluetooth-CompatTests/IOBluetooth_CompatTests.m create mode 100644 IOBluetooth-Compat/IOBluetooth-CompatTests/en.lproj/InfoPlist.strings diff --git a/.gitignore b/.gitignore index 0d20b64..5afc77e 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ *.pyc +.project +# XCode related +DerivedData/ diff --git a/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.pbxproj b/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.pbxproj new file mode 100644 index 0000000..159ac79 --- /dev/null +++ b/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.pbxproj @@ -0,0 +1,442 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 43B43CE81835D78100C0D4EE /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 43B43CE71835D78100C0D4EE /* Cocoa.framework */; }; + 43B43CF21835D78100C0D4EE /* IOBluetooth_Compat.m in Sources */ = {isa = PBXBuildFile; fileRef = 43B43CF11835D78100C0D4EE /* IOBluetooth_Compat.m */; }; + 43B43CF91835D78100C0D4EE /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 43B43CF81835D78100C0D4EE /* XCTest.framework */; }; + 43B43CFA1835D78100C0D4EE /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 43B43CE71835D78100C0D4EE /* Cocoa.framework */; }; + 43B43CFD1835D78100C0D4EE /* IOBluetooth-Compat.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 43B43CE41835D78100C0D4EE /* IOBluetooth-Compat.dylib */; }; + 43B43D031835D78100C0D4EE /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 43B43D011835D78100C0D4EE /* InfoPlist.strings */; }; + 43B43D051835D78100C0D4EE /* IOBluetooth_CompatTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 43B43D041835D78100C0D4EE /* IOBluetooth_CompatTests.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 43B43CFB1835D78100C0D4EE /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 43B43CDC1835D78100C0D4EE /* Project object */; + proxyType = 1; + remoteGlobalIDString = 43B43CE31835D78100C0D4EE; + remoteInfo = "IOBluetooth-Compat"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 43B43CE41835D78100C0D4EE /* IOBluetooth-Compat.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = "IOBluetooth-Compat.dylib"; sourceTree = BUILT_PRODUCTS_DIR; }; + 43B43CE71835D78100C0D4EE /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; + 43B43CEA1835D78100C0D4EE /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 43B43CEB1835D78100C0D4EE /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; + 43B43CEC1835D78100C0D4EE /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; + 43B43CEF1835D78100C0D4EE /* IOBluetooth-Compat-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "IOBluetooth-Compat-Prefix.pch"; sourceTree = ""; }; + 43B43CF01835D78100C0D4EE /* IOBluetooth_Compat.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = IOBluetooth_Compat.h; sourceTree = ""; }; + 43B43CF11835D78100C0D4EE /* IOBluetooth_Compat.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IOBluetooth_Compat.m; sourceTree = ""; }; + 43B43CF71835D78100C0D4EE /* IOBluetooth-CompatTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "IOBluetooth-CompatTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 43B43CF81835D78100C0D4EE /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; + 43B43D001835D78100C0D4EE /* IOBluetooth-CompatTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "IOBluetooth-CompatTests-Info.plist"; sourceTree = ""; }; + 43B43D021835D78100C0D4EE /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 43B43D041835D78100C0D4EE /* IOBluetooth_CompatTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = IOBluetooth_CompatTests.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 43B43CE11835D78100C0D4EE /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 43B43CE81835D78100C0D4EE /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 43B43CF41835D78100C0D4EE /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 43B43CFD1835D78100C0D4EE /* IOBluetooth-Compat.dylib in Frameworks */, + 43B43CFA1835D78100C0D4EE /* Cocoa.framework in Frameworks */, + 43B43CF91835D78100C0D4EE /* XCTest.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 43B43CDB1835D78100C0D4EE = { + isa = PBXGroup; + children = ( + 43B43CED1835D78100C0D4EE /* IOBluetooth-Compat */, + 43B43CFE1835D78100C0D4EE /* IOBluetooth-CompatTests */, + 43B43CE61835D78100C0D4EE /* Frameworks */, + 43B43CE51835D78100C0D4EE /* Products */, + ); + sourceTree = ""; + }; + 43B43CE51835D78100C0D4EE /* Products */ = { + isa = PBXGroup; + children = ( + 43B43CE41835D78100C0D4EE /* IOBluetooth-Compat.dylib */, + 43B43CF71835D78100C0D4EE /* IOBluetooth-CompatTests.xctest */, + ); + name = Products; + sourceTree = SOURCE_ROOT; + }; + 43B43CE61835D78100C0D4EE /* Frameworks */ = { + isa = PBXGroup; + children = ( + 43B43CE71835D78100C0D4EE /* Cocoa.framework */, + 43B43CF81835D78100C0D4EE /* XCTest.framework */, + 43B43CE91835D78100C0D4EE /* Other Frameworks */, + ); + name = Frameworks; + sourceTree = ""; + }; + 43B43CE91835D78100C0D4EE /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 43B43CEA1835D78100C0D4EE /* Foundation.framework */, + 43B43CEB1835D78100C0D4EE /* CoreData.framework */, + 43B43CEC1835D78100C0D4EE /* AppKit.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + 43B43CED1835D78100C0D4EE /* IOBluetooth-Compat */ = { + isa = PBXGroup; + children = ( + 43B43CF01835D78100C0D4EE /* IOBluetooth_Compat.h */, + 43B43CF11835D78100C0D4EE /* IOBluetooth_Compat.m */, + 43B43CEE1835D78100C0D4EE /* Supporting Files */, + ); + path = "IOBluetooth-Compat"; + sourceTree = ""; + }; + 43B43CEE1835D78100C0D4EE /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 43B43CEF1835D78100C0D4EE /* IOBluetooth-Compat-Prefix.pch */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 43B43CFE1835D78100C0D4EE /* IOBluetooth-CompatTests */ = { + isa = PBXGroup; + children = ( + 43B43D041835D78100C0D4EE /* IOBluetooth_CompatTests.m */, + 43B43CFF1835D78100C0D4EE /* Supporting Files */, + ); + path = "IOBluetooth-CompatTests"; + sourceTree = ""; + }; + 43B43CFF1835D78100C0D4EE /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 43B43D001835D78100C0D4EE /* IOBluetooth-CompatTests-Info.plist */, + 43B43D011835D78100C0D4EE /* InfoPlist.strings */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 43B43CE21835D78100C0D4EE /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 43B43CE31835D78100C0D4EE /* IOBluetooth-Compat */ = { + isa = PBXNativeTarget; + buildConfigurationList = 43B43D081835D78100C0D4EE /* Build configuration list for PBXNativeTarget "IOBluetooth-Compat" */; + buildPhases = ( + 43B43CE01835D78100C0D4EE /* Sources */, + 43B43CE11835D78100C0D4EE /* Frameworks */, + 43B43CE21835D78100C0D4EE /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "IOBluetooth-Compat"; + productName = "IOBluetooth-Compat"; + productReference = 43B43CE41835D78100C0D4EE /* IOBluetooth-Compat.dylib */; + productType = "com.apple.product-type.library.dynamic"; + }; + 43B43CF61835D78100C0D4EE /* IOBluetooth-CompatTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 43B43D0B1835D78100C0D4EE /* Build configuration list for PBXNativeTarget "IOBluetooth-CompatTests" */; + buildPhases = ( + 43B43CF31835D78100C0D4EE /* Sources */, + 43B43CF41835D78100C0D4EE /* Frameworks */, + 43B43CF51835D78100C0D4EE /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 43B43CFC1835D78100C0D4EE /* PBXTargetDependency */, + ); + name = "IOBluetooth-CompatTests"; + productName = "IOBluetooth-CompatTests"; + productReference = 43B43CF71835D78100C0D4EE /* IOBluetooth-CompatTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 43B43CDC1835D78100C0D4EE /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0500; + ORGANIZATIONNAME = USM; + TargetAttributes = { + 43B43CF61835D78100C0D4EE = { + TestTargetID = 43B43CE31835D78100C0D4EE; + }; + }; + }; + buildConfigurationList = 43B43CDF1835D78100C0D4EE /* Build configuration list for PBXProject "IOBluetooth-Compat" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 43B43CDB1835D78100C0D4EE; + productRefGroup = 43B43CE51835D78100C0D4EE /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 43B43CE31835D78100C0D4EE /* IOBluetooth-Compat */, + 43B43CF61835D78100C0D4EE /* IOBluetooth-CompatTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 43B43CF51835D78100C0D4EE /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 43B43D031835D78100C0D4EE /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 43B43CE01835D78100C0D4EE /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 43B43CF21835D78100C0D4EE /* IOBluetooth_Compat.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 43B43CF31835D78100C0D4EE /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 43B43D051835D78100C0D4EE /* IOBluetooth_CompatTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 43B43CFC1835D78100C0D4EE /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 43B43CE31835D78100C0D4EE /* IOBluetooth-Compat */; + targetProxy = 43B43CFB1835D78100C0D4EE /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 43B43D011835D78100C0D4EE /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 43B43D021835D78100C0D4EE /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 43B43D061835D78100C0D4EE /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.9; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 43B43D071835D78100C0D4EE /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.9; + SDKROOT = macosx; + }; + name = Release; + }; + 43B43D091835D78100C0D4EE /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + CLANG_ENABLE_OBJC_ARC = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "IOBluetooth-Compat/IOBluetooth-Compat-Prefix.pch"; + MACOSX_DEPLOYMENT_TARGET = 10.8; + ONLY_ACTIVE_ARCH = NO; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx10.8; + }; + name = Debug; + }; + 43B43D0A1835D78100C0D4EE /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + CLANG_ENABLE_OBJC_ARC = NO; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "IOBluetooth-Compat/IOBluetooth-Compat-Prefix.pch"; + MACOSX_DEPLOYMENT_TARGET = 10.8; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx10.8; + }; + name = Release; + }; + 43B43D0C1835D78100C0D4EE /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/IOBluetooth-Compat.dylib"; + COMBINE_HIDPI_IMAGES = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(DEVELOPER_FRAMEWORKS_DIR)", + "$(inherited)", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "IOBluetooth-Compat/IOBluetooth-Compat-Prefix.pch"; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = "IOBluetooth-CompatTests/IOBluetooth-CompatTests-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUNDLE_LOADER)"; + WRAPPER_EXTENSION = xctest; + }; + name = Debug; + }; + 43B43D0D1835D78100C0D4EE /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/IOBluetooth-Compat.dylib"; + COMBINE_HIDPI_IMAGES = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(DEVELOPER_FRAMEWORKS_DIR)", + "$(inherited)", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "IOBluetooth-Compat/IOBluetooth-Compat-Prefix.pch"; + INFOPLIST_FILE = "IOBluetooth-CompatTests/IOBluetooth-CompatTests-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUNDLE_LOADER)"; + WRAPPER_EXTENSION = xctest; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 43B43CDF1835D78100C0D4EE /* Build configuration list for PBXProject "IOBluetooth-Compat" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 43B43D061835D78100C0D4EE /* Debug */, + 43B43D071835D78100C0D4EE /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 43B43D081835D78100C0D4EE /* Build configuration list for PBXNativeTarget "IOBluetooth-Compat" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 43B43D091835D78100C0D4EE /* Debug */, + 43B43D0A1835D78100C0D4EE /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; + 43B43D0B1835D78100C0D4EE /* Build configuration list for PBXNativeTarget "IOBluetooth-CompatTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 43B43D0C1835D78100C0D4EE /* Debug */, + 43B43D0D1835D78100C0D4EE /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; +/* End XCConfigurationList section */ + }; + rootObject = 43B43CDC1835D78100C0D4EE /* Project object */; +} diff --git a/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..cc02987 --- /dev/null +++ b/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/xcshareddata/IOBluetooth-Compat.xccheckout b/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/xcshareddata/IOBluetooth-Compat.xccheckout new file mode 100644 index 0000000..5986be0 --- /dev/null +++ b/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/xcshareddata/IOBluetooth-Compat.xccheckout @@ -0,0 +1,41 @@ + + + + + IDESourceControlProjectFavoriteDictionaryKey + + IDESourceControlProjectIdentifier + 402F1DA4-9EE8-42D6-8005-72CE111EE0ED + IDESourceControlProjectName + IOBluetooth-Compat + IDESourceControlProjectOriginsDictionary + + 39F9C414-00E5-4EF2-A028-8019D12E78AC + git+ssh://ssh.git.ni.fr.eu.org/pyfantom.git + + IDESourceControlProjectPath + IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace + IDESourceControlProjectRelativeInstallPathDictionary + + 39F9C414-00E5-4EF2-A028-8019D12E78AC + ../../.. + + IDESourceControlProjectURL + git+ssh://ssh.git.ni.fr.eu.org/pyfantom.git + IDESourceControlProjectVersion + 110 + IDESourceControlProjectWCCIdentifier + 39F9C414-00E5-4EF2-A028-8019D12E78AC + IDESourceControlProjectWCConfigurations + + + IDESourceControlRepositoryExtensionIdentifierKey + public.vcs.git + IDESourceControlWCCIdentifierKey + 39F9C414-00E5-4EF2-A028-8019D12E78AC + IDESourceControlWCCName + pyfantom + + + + diff --git a/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/xcuserdata/tcmac.xcuserdatad/UserInterfaceState.xcuserstate b/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/xcuserdata/tcmac.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..b0d0171 Binary files /dev/null and b/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/xcuserdata/tcmac.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/xcuserdata/tcmac.xcuserdatad/WorkspaceSettings.xcsettings b/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/xcuserdata/tcmac.xcuserdatad/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..42e1f86 --- /dev/null +++ b/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/xcuserdata/tcmac.xcuserdatad/WorkspaceSettings.xcsettings @@ -0,0 +1,24 @@ + + + + + BuildLocationStyle + CustomLocation + CustomBuildIntermediatesPath + Build/Intermediates + CustomBuildLocationType + RelativeToDerivedData + CustomBuildProductsPath + Build/Products + DerivedDataLocationStyle + Default + IssueFilterStyle + ShowActiveSchemeOnly + LiveSourceIssuesEnabled + + SnapshotAutomaticallyBeforeSignificantChanges + + SnapshotLocationStyle + Default + + diff --git a/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/xcuserdata/tcmac.xcuserdatad/xcschemes/IOBluetooth-Compat.xcscheme b/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/xcuserdata/tcmac.xcuserdatad/xcschemes/IOBluetooth-Compat.xcscheme new file mode 100644 index 0000000..fa6b2bb --- /dev/null +++ b/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/xcuserdata/tcmac.xcuserdatad/xcschemes/IOBluetooth-Compat.xcscheme @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/xcuserdata/tcmac.xcuserdatad/xcschemes/xcschememanagement.plist b/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/xcuserdata/tcmac.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..e7d6c15 --- /dev/null +++ b/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/xcuserdata/tcmac.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,27 @@ + + + + + SchemeUserState + + IOBluetooth-Compat.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + 43B43CE31835D78100C0D4EE + + primary + + + 43B43CF61835D78100C0D4EE + + primary + + + + + diff --git a/IOBluetooth-Compat/IOBluetooth-Compat/IOBluetooth-Compat-Prefix.pch b/IOBluetooth-Compat/IOBluetooth-Compat/IOBluetooth-Compat-Prefix.pch new file mode 100644 index 0000000..35d7640 --- /dev/null +++ b/IOBluetooth-Compat/IOBluetooth-Compat/IOBluetooth-Compat-Prefix.pch @@ -0,0 +1,9 @@ +// +// Prefix header +// +// The contents of this file are implicitly included at the beginning of every source file. +// + +#ifdef __OBJC__ + #import +#endif diff --git a/IOBluetooth-Compat/IOBluetooth-Compat/IOBluetooth_Compat.h b/IOBluetooth-Compat/IOBluetooth-Compat/IOBluetooth_Compat.h new file mode 100644 index 0000000..a06ed5f --- /dev/null +++ b/IOBluetooth-Compat/IOBluetooth-Compat/IOBluetooth_Compat.h @@ -0,0 +1,236 @@ +// +// IOBluetooth_Compat.h +// IOBluetooth-Compat +// +// Created by TCMac on 15/11/2013. +// Original Header is (c) Apple Inc. +// + +#import +#import +/*! @typedef IOBluetoothRFCOMMEvent + @discussion The events generated by an RFCOMM channel: + +
+ kIOBluetoothRFCOMMChannelEventTypeData: new data. +
+ kIOBluetoothRFCOMMChannelEventTypeFlowControlChanged: flow control changed. +
+ kIOBluetoothRFCOMMChannelEventTypeClosed: channel terminated. +
+ kIOBluetoothRFCOMMChannelEventTypeControlSignalsChanged: signals (like DTR, CTR) changed. (not yet supported) +
+ kIOBluetoothRFCOMMChannelEventTypeWriteComplete: write operation completed +
+ kIOBluetoothRFCOMMChannelEventTypeQueueSpaceAvailable: more room in the RFCOMM channel output queue + + Obsolete Event types: + +
+ kIOBluetoothRFCOMMNewDataEvent: new data. +
+ kIOBluetoothRFCOMMFlowControlChangedEvent: flow control changed. +
+ kIOBluetoothRFCOMMChannelTerminatedEvent: channel terminated. +
+ kIOBluetoothRFCOMMControlSignalsChangedEvent: signals (like DTR, CTR) changed. (not yet supported) +
+ + See the description of kIOBluetoothRFCOMMChannelEventTypeDataType and kIOBluetoothRFCOMMChannelEventTypeFlowControlChangedType for more + information on these events. + */ + + +typedef enum IOBluetoothRFCOMMChannelEventType { + // New event types added in 1.2 (Mac OS X 10.2.5) + kIOBluetoothRFCOMMChannelEventTypeData = 0x0000, + kIOBluetoothRFCOMMChannelEventTypeFlowControlChanged = 0x0001, + kIOBluetoothRFCOMMChannelEventTypeClosed = 0x0002, + kIOBluetoothRFCOMMChannelEventTypeOpenComplete = 0x0003, + kIOBluetoothRFCOMMChannelEventTypeControlSignalsChanged = 0x0004, + kIOBluetoothRFCOMMChannelEventTypeWriteComplete = 0x0005, + kIOBluetoothRFCOMMChannelEventTypeQueueSpaceAvailable = 0x0006, + + // Obsolete Event names: + kIOBluetoothRFCOMMNewDataEvent = 0x0000, + kIOBluetoothRFCOMMFlowControlChangedEvent = 0x0001, + kIOBluetoothRFCOMMChannelTerminatedEvent = 0x0002 +} IOBluetoothRFCOMMChannelEventType; + +// This is to keep build build. Please use the new type, this is going to be deprecated +typedef IOBluetoothRFCOMMChannelEventType IOBluetoothRFCOMMEvent; + +//-------------------------------------------------------------------------------------------------------------------------- +/*! @typedef IOBluetoothRFCOMMDataBlock + @discussion Associted to the kIOBluetoothRFCOMMNewDataEvent it carries a pointer and a size of the new incoming data. + + */ + +typedef struct IOBluetoothRFCOMMDataBlock +{ + void *dataPtr; + size_t dataSize; +} IOBluetoothRFCOMMDataBlock; + +//-------------------------------------------------------------------------------------------------------------------------- +/*! @typedef IOBluetoothRFCOMMFlowControlStatus + @discussion Related to the kIOBluetoothRFCOMMFlowControlChangedEvent it carries the status of the flow control. + For the first release of the APIs this event is generated only when flow control switches from OFF + to ON. Future releases will support the switch from ON to OFF as well. + */ + +typedef enum IOBluetoothRFCOMMFlowControlStatus { + kIOBluetoothRFCOMMChannelFlowControlStatusIsOff = 0x0000, + kIOBluetoothRFCOMMChannelFlowControlStatusIsOn = 0x0001 +} IOBluetoothRFCOMMFlowControlStatus; + +//-------------------------------------------------------------------------------------------------------------------------- +/*! @typedef IOBluetoothRFCOMMChannelEvent + @discussion Structure that holds an RFCOMM event. + */ + +typedef struct IOBluetoothRFCOMMChannelEvent { + // Caution: You cannot add any more values here for binary compatibility reasons + IOBluetoothRFCOMMChannelEventType eventType; + union + { + // Caution: An element of this union cannot grow beyond 32 bytes in size for binary compatibility reasons. + IOBluetoothRFCOMMDataBlock data; + IOBluetoothRFCOMMFlowControlStatus flowStatus; + IOBluetoothRFCOMMChannelRef terminatedChannel; + void* writeRefCon; + + UInt8 padding[32]; + + // Old name, is going to be deprecated, use data instead + IOBluetoothRFCOMMDataBlock newData; + } u; + IOReturn status; + // Add new items above this comment. +} IOBluetoothRFCOMMChannelEvent; + +@interface IOBluetooth_Compat : NSObject +/*! @typedef IOBluetoothRFCOMMChannelIncomingEventListener + @abstract Typedef for the RFCOMM channel event listener. + @param rfcommChannel (IOBluetoothRFCOMMChannelRef) RFCOMM channel which received the events. + @param refCon (void *) User-defined refCon provided upon registration. + @param event (IOBluetoothRFCOMMChannelEvent) The type of event for this notification. + @discussion This is the definition for the callback which will be invoked upon receiving data on a RFCOMM channel. + + For example an event listener function: + +
+ 
+ void rfcommEventListener (IOBluetoothRFCOMMChannelRef rfcommChannel, void *refCon, IOBluetoothRFCOMMChannelEvent *event)
+ {
+ switch (event->eventType)
+ {
+ case kIOBluetoothRFCOMMNewDataEvent:
+ // In thise case:
+ // event->u.newData.dataPtr  is a pointer to the block of data received.
+ // event->u.newData.dataSize is the size of the block of data.
+ break;
+ 
+ case kIOBluetoothRFCOMMFlowControlChangedEvent:
+ // In thise case:
+ // event->u.flowStatus       is the status of flow control (see IOBluetoothRFCOMMFlowControlStatus for current restrictions)
+ break;
+ 
+ case kIOBluetoothRFCOMMChannelTerminatedEvent:
+ // In this case:
+ // event->u.terminatedChannel is the channel that was terminated. It can be converted in an IOBluetoothRFCOMMChannel
+ // object with [IOBluetoothRFCOMMChannel withRFCOMMChannelRef:]. (see below).
+ break;
+ }
+ }
+ 
+ 
+ + rfcommChannel is the channel that generated the event and it is the channel where the callback was generated. + rfcommChannel is a IOBluetoothRFCOMMChannelRef reference, it can be converted in an Objective C IOBluetoothRFCOMMChannel + object with: + +
+ 
+ IOBluetoothRFCOMMChannel *myOBJCChannel = [IOBluetoothRFCOMMChannel withRFCOMMChannelRef:rfcommChannel];
+ 
+ 
+ */ + +typedef void (*IOBluetoothRFCOMMChannelIncomingEventListener)(IOBluetoothRFCOMMChannelRef rfcommChannel, void *refCon, IOBluetoothRFCOMMChannelEvent *event); + +/*! + @function IOBluetoothSDPServiceRecordGetRFCOMMChannelID + @abstract Allows the discovery of the RFCOMM channel ID assigned to the service. + @discussion This function will search through the ProtoclDescriptorList attribute to find an entry + with the RFCOMM UUID (UUID16: 0x0003). If one is found, it gets the second element of + the data element sequence and sets the rfcommChannelID pointer to it. The channel ID + only gets set when kIOReturnSuccess is returned. + @param serviceRecord The target IOBluetoothSDPServiceRecordRef + @param rfcommChannelID A pointer to the location that will get the found RFCOMM channel ID. + @result Returns kIOReturnSuccess if the channel ID is found. + */ + +IOReturn IOBluetoothSDPServiceRecordGetRFCOMMChannelID(IOBluetoothSDPServiceRecordRef serviceRecord, BluetoothRFCOMMChannelID *channelID); + +/*! @function IOBluetoothRFCOMMChannelGetMTU + @abstract + @param rfcommChannel (IOBluetoothRFCOMMChannelRef) The channel reference + @result Channel MTU size. + @discussion Returns the length of the largest chunk of data that this channel can carry. If the + caller wishes to use the write:length:sleep: api the length of the data can not be bigger than + the channel MTU (maximum transfer unit). + */ + +BluetoothRFCOMMMTU IOBluetoothRFCOMMChannelGetMTU( IOBluetoothRFCOMMChannelRef rfcommChannel ); + +/*! @function IOBluetoothRFCOMMChannelCloseChannel + @param rfcommChannel (IOBluetoothRFCOMMChannelRef) The channel reference + @result An error code value. 0 if successful. + @discussion + */ + +IOReturn IOBluetoothRFCOMMChannelCloseChannel(IOBluetoothRFCOMMChannelRef rfcommChannel); + +/*! @function IOBluetoothRFCOMMChannelWriteAsync + @abstract Write data to a RFCOMM channel asynchronously. + @param rfcommChannel (IOBluetoothRFCOMMChannelRef) The channel reference + @param data is a pointer to the data buffer to be sent. + @param length the length of the buffer to be sent (in bytes). + @param refcon a NON NULL value that will be contained in the return event (once the data is sent). + @result An error code value. 0 if successful. + @discussion Sends data tough the channel. The number of bytes to be sent must not exceed the channel MTU. + If the return value is an error condition none of the data was sent. + + NOTE: This function is only available in Mac OS X 10.2.5 (Bluetooth v1.2) or later. + */ + +IOReturn IOBluetoothRFCOMMChannelWriteAsync(IOBluetoothRFCOMMChannelRef rfcommChannel, void *data, UInt16 length, void *refcon); + +/*! + @function IOBluetoothDeviceOpenRFCOMMChannelAsync + @abstract Opens a new RFCOMM channel to the target device. Returns immedialty after starting the opening process. + @discussion This function will begin the process of opening a new RFCOMM channel to the target device. + The baseband connection to the device will be opened if it is not open already. The RFCOMM + channel open process will not complete until the client has registered an incoming data + listener on the new channel. + + Because a new IOBluetoothL2CAPChannelRef will be created for the client as a result of this + function, the client is responsible for releasing the resulting IOBluetoothL2CAPChannelRef + (by calling IOBluetoothObjectRelease()). + + NOTE: This function is only available in Mac OS X 10.2.5 (Bluetooth v1.2) or later. + @param btDevice The target IOBluetoothDeviceRef + @param rfcommChannel A pointer to an IOBluetoothRFCOMMChannelRef to receive the RFCOMM channel + requested to be opened. The rfcommChannel pointer will only be set if + kIOReturnSuccess is returned. + @param channelID The RFCOMM channel ID for the new channel. + @param withEventListener a IOBluetoothRFCOMMChannelIncomingEventListener where to receive events + regarding the channel (MUST be specified). + @param refCon a refcon pointer (for the callback specified above). + @result Returns kIOReturnSuccess if the open process was successfully started . + */ + +IOReturn IOBluetoothDeviceOpenRFCOMMChannelAsync(IOBluetoothDeviceRef btDevice, IOBluetoothRFCOMMChannelRef *newChannel, BluetoothRFCOMMChannelID channelID, IOBluetoothRFCOMMChannelIncomingEventListener eventListener, void *refcon); + +@end diff --git a/IOBluetooth-Compat/IOBluetooth-Compat/IOBluetooth_Compat.m b/IOBluetooth-Compat/IOBluetooth-Compat/IOBluetooth_Compat.m new file mode 100644 index 0000000..6398917 --- /dev/null +++ b/IOBluetooth-Compat/IOBluetooth-Compat/IOBluetooth_Compat.m @@ -0,0 +1,102 @@ +// +// IOBluetooth_Compat.m +// IOBluetooth-Compat +// +// Created by TCMac on 15/11/2013. +// Original Header is (c) Apple Inc. +// Copyright (c) 2013 TC Wan +// + +#import "IOBluetooth_Compat.h" + +@implementation IOBluetooth_Compat + + +/*! + @function IOBluetoothSDPServiceRecordGetRFCOMMChannelID + @abstract Allows the discovery of the RFCOMM channel ID assigned to the service. + @discussion This function will search through the ProtoclDescriptorList attribute to find an entry + with the RFCOMM UUID (UUID16: 0x0003). If one is found, it gets the second element of + the data element sequence and sets the rfcommChannelID pointer to it. The channel ID + only gets set when kIOReturnSuccess is returned. + @param serviceRecord The target IOBluetoothSDPServiceRecordRef + @param rfcommChannelID A pointer to the location that will get the found RFCOMM channel ID. + @result Returns kIOReturnSuccess if the channel ID is found. + */ + +IOReturn IOBluetoothSDPServiceRecordGetRFCOMMChannelID(IOBluetoothSDPServiceRecordRef serviceRecord, BluetoothRFCOMMChannelID *channelID) +{ + return kIOReturnError; +} + +/*! @function IOBluetoothRFCOMMChannelGetMTU + @abstract + @param rfcommChannel (IOBluetoothRFCOMMChannelRef) The channel reference + @result Channel MTU size. + @discussion Returns the length of the largest chunk of data that this channel can carry. If the + caller wishes to use the write:length:sleep: api the length of the data can not be bigger than + the channel MTU (maximum transfer unit). + */ + +BluetoothRFCOMMMTU IOBluetoothRFCOMMChannelGetMTU( IOBluetoothRFCOMMChannelRef rfcommChannel ) { + return 0; +} + +/*! @function IOBluetoothRFCOMMChannelCloseChannel + @param rfcommChannel (IOBluetoothRFCOMMChannelRef) The channel reference + @result An error code value. 0 if successful. + @discussion + */ + +IOReturn IOBluetoothRFCOMMChannelCloseChannel(IOBluetoothRFCOMMChannelRef rfcommChannel) +{ + return kIOReturnError; +} + +/*! @function IOBluetoothRFCOMMChannelWriteAsync + @abstract Write data to a RFCOMM channel asynchronously. + @param rfcommChannel (IOBluetoothRFCOMMChannelRef) The channel reference + @param data is a pointer to the data buffer to be sent. + @param length the length of the buffer to be sent (in bytes). + @param refcon a NON NULL value that will be contained in the return event (once the data is sent). + @result An error code value. 0 if successful. + @discussion Sends data tough the channel. The number of bytes to be sent must not exceed the channel MTU. + If the return value is an error condition none of the data was sent. + + NOTE: This function is only available in Mac OS X 10.2.5 (Bluetooth v1.2) or later. + */ + +IOReturn IOBluetoothRFCOMMChannelWriteAsync(IOBluetoothRFCOMMChannelRef rfcommChannel, void *data, UInt16 length, void *refcon) +{ + return kIOReturnError; +} + +/*! + @function IOBluetoothDeviceOpenRFCOMMChannelAsync + @abstract Opens a new RFCOMM channel to the target device. Returns immedialty after starting the opening process. + @discussion This function will begin the process of opening a new RFCOMM channel to the target device. + The baseband connection to the device will be opened if it is not open already. The RFCOMM + channel open process will not complete until the client has registered an incoming data + listener on the new channel. + + Because a new IOBluetoothL2CAPChannelRef will be created for the client as a result of this + function, the client is responsible for releasing the resulting IOBluetoothL2CAPChannelRef + (by calling IOBluetoothObjectRelease()). + + NOTE: This function is only available in Mac OS X 10.2.5 (Bluetooth v1.2) or later. + @param btDevice The target IOBluetoothDeviceRef + @param rfcommChannel A pointer to an IOBluetoothRFCOMMChannelRef to receive the RFCOMM channel + requested to be opened. The rfcommChannel pointer will only be set if + kIOReturnSuccess is returned. + @param channelID The RFCOMM channel ID for the new channel. + @param withEventListener a IOBluetoothRFCOMMChannelIncomingEventListener where to receive events + regarding the channel (MUST be specified). + @param refCon a refcon pointer (for the callback specified above). + @result Returns kIOReturnSuccess if the open process was successfully started . + */ + +IOReturn IOBluetoothDeviceOpenRFCOMMChannelAsync(IOBluetoothDeviceRef btDevice, IOBluetoothRFCOMMChannelRef *newChannel, BluetoothRFCOMMChannelID channelID, IOBluetoothRFCOMMChannelIncomingEventListener eventListener, void *refcon) { + return kIOReturnError; +} + +@end diff --git a/IOBluetooth-Compat/IOBluetooth-CompatTests/IOBluetooth-CompatTests-Info.plist b/IOBluetooth-Compat/IOBluetooth-CompatTests/IOBluetooth-CompatTests-Info.plist new file mode 100644 index 0000000..c4409df --- /dev/null +++ b/IOBluetooth-Compat/IOBluetooth-CompatTests/IOBluetooth-CompatTests-Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + USM.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/IOBluetooth-Compat/IOBluetooth-CompatTests/IOBluetooth_CompatTests.m b/IOBluetooth-Compat/IOBluetooth-CompatTests/IOBluetooth_CompatTests.m new file mode 100644 index 0000000..c49e840 --- /dev/null +++ b/IOBluetooth-Compat/IOBluetooth-CompatTests/IOBluetooth_CompatTests.m @@ -0,0 +1,34 @@ +// +// IOBluetooth_CompatTests.m +// IOBluetooth-CompatTests +// +// Created by TCMac on 15/11/2013. +// Copyright (c) 2013 USM. All rights reserved. +// + +#import + +@interface IOBluetooth_CompatTests : XCTestCase + +@end + +@implementation IOBluetooth_CompatTests + +- (void)setUp +{ + [super setUp]; + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown +{ + // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; +} + +- (void)testExample +{ + XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); +} + +@end diff --git a/IOBluetooth-Compat/IOBluetooth-CompatTests/en.lproj/InfoPlist.strings b/IOBluetooth-Compat/IOBluetooth-CompatTests/en.lproj/InfoPlist.strings new file mode 100644 index 0000000..477b28f --- /dev/null +++ b/IOBluetooth-Compat/IOBluetooth-CompatTests/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/README b/README index 36ce528..9beb5e6 100644 --- a/README +++ b/README @@ -33,3 +33,15 @@ If you're installing using the source package, first extract the source package, # python setup.py install inside the package directory. This should be run as root (or use sudo) + +Running pyfantom on Mac OS X Mountain Lion (10.8) and Mavericks (10.9) +====================================================================== + +Some Bluetooth related functions have been deprecated in Mac OS X +Mountain Lion and newer. This results in the Fantom framework encountering +unresolved symbol errors when attempting to load it into pyfantom. + +To work around this problem, a stub library IOBluetooth-Compat has been +created, which defines the missing symbols. Unfortunately, it means that +Bluetooth support is not available for pyfantom running on Mountain Lion +and newer releases. diff --git a/pyfantom.py b/pyfantom.py index 75d6e3a..3570479 100644 --- a/pyfantom.py +++ b/pyfantom.py @@ -3,7 +3,7 @@ # License version 2 or any later version, or the Mozilla Public License # version 2.0. # -# Copyright (C) 2011 Tat-Chee Wan +# Copyright (C) 2011-2013 Tat-Chee Wan # Copyright (C) 2011 Nicolas Schodet # # -------------- @@ -36,17 +36,20 @@ import collections kMaxFileNameLength = 101 BT_PIN = "1234" VI_ERROR_IO = -0x4000ffc2 # Equivalent to 0xBFFF003E - +MACOSX_BTMODVER = "12.0.0" +MACOSX_BTENABLE = True DEBUG = True libpath = None # Check platform. platform_type = platform.system() +platform_rel = platform.release() if DEBUG: - print "Running on %s Platform" % platform_type + print "Running on %s Platform (Rel. %s)" % (platform_type, platform_rel) if platform_type == 'Darwin': import sys + if sys.maxsize > 2**32: raise RuntimeError("fantom drivers not available in 64 bit mode.\n" "You can run python in 32 bit mode (Bash shell syntax) using:\n" @@ -55,6 +58,13 @@ if platform_type == 'Darwin': "\n\tNote: This approach will work for for both Apple's Python >= 2.6\n\t\tand MacPorts' Python >= 2.7 installation\n") #libpath = '/Library/Frameworks/Fantom.framework/Fantom' libpath = ctypes.util.find_library('fantom') + + if platform_rel >= MACOSX_BTMODVER: + print " Bluetooth Stack not supported (Rel >= %s)" % MACOSX_BTMODVER + MACOSX_BTENABLE = False + compatlibpath = './IOBluetooth-Compat.dylib' + + from AppKit import NSAutoreleasePool, NSApplication elif platform_type == 'Linux': libpath = ctypes.util.find_library('fantom') @@ -70,7 +80,15 @@ else: raise RuntimeError("Fantom Driver not found") # Load library. +if not MACOSX_BTENABLE: + print "Loading IOBluetooth-Compat Library (", compatlibpath, ")" + # Need to set DYLD_FORCE_FLAT_NAMESPACE in env + compatdll = ctypes.cdll.LoadLibrary(compatlibpath) + +# RTLD_NOW is set by ctypes and can't be overridden +# http://hg.python.org/cpython/file/2.7/Modules/_ctypes/callproc.c#l1432 dll = ctypes.cdll.LoadLibrary(libpath) + dll.nFANTOM100_createNXTIterator.argtypes = [c_ushort, c_uint, POINTER(c_int)] dll.nFANTOM100_createNXTIterator.restype = c_uint dll.nFANTOM100_destroyNXTIterator.argtypes = [c_int, POINTER(c_int)] @@ -110,12 +128,15 @@ dll.nFANTOM100_iNXT_getResourceString.argtypes = [c_uint, c_char_p, POINTER(c_int)] dll.nFANTOM100_iNXT_getResourceString.restype = None -dll.nFANTOM100_pairBluetooth.argtypes = [c_char_p, c_char_p, c_char_p, POINTER(c_int)] -dll.nFANTOM100_pairBluetooth.restype = None -dll.nFANTOM100_unpairBluetooth.argtypes = [c_char_p, POINTER(c_int)] -dll.nFANTOM100_unpairBluetooth.restype = None -dll.nFANTOM100_isPaired.argtypes = [c_char_p, POINTER(c_int)] -dll.nFANTOM100_isPaired.restype = c_ushort +if MACOSX_BTENABLE: + print "Binding Buletooth routines" + dll.nFANTOM100_pairBluetooth.argtypes = [c_char_p, c_char_p, c_char_p, POINTER(c_int)] + dll.nFANTOM100_pairBluetooth.restype = None + dll.nFANTOM100_unpairBluetooth.argtypes = [c_char_p, POINTER(c_int)] + dll.nFANTOM100_unpairBluetooth.restype = None + dll.nFANTOM100_isPaired.argtypes = [c_char_p, POINTER(c_int)] + dll.nFANTOM100_isPaired.restype = c_ushort + if DEBUG: print "Load Library Done" @@ -251,7 +272,7 @@ class StatusVar(Structure): class NXTIterator: """Interface to an iterator, to find connected NXT.""" - def __init__(self, search_bluetooth, bluetooth_search_timeout_s=5): + def __init__(self, search_bluetooth=False, bluetooth_search_timeout_s=5): """Initialize iterator.""" self.debug = DEBUG self.search_bluetooth = search_bluetooth @@ -260,7 +281,7 @@ class NXTIterator: self.stop = False self.nsapp = None self.pool = None - if platform.system() == 'Darwin': + if platform_type == 'Darwin': self.nsapp = NSApplication.sharedApplication() self.pool = NSAutoreleasePool.alloc().init() def destroy(): -- cgit v1.2.3 From 89de16e2499d94ceed70a480a093243a3e9f6853 Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM Signature) Date: Fri, 15 Nov 2013 13:12:43 +0800 Subject: removed xcode private files --- .gitignore | 2 + .../project.xcworkspace/contents.xcworkspacedata | 7 --- .../xcshareddata/IOBluetooth-Compat.xccheckout | 41 ------------ .../UserInterfaceState.xcuserstate | Bin 51931 -> 0 bytes .../tcmac.xcuserdatad/WorkspaceSettings.xcsettings | 24 ------- .../xcschemes/IOBluetooth-Compat.xcscheme | 69 --------------------- .../xcschemes/xcschememanagement.plist | 27 -------- 7 files changed, 2 insertions(+), 168 deletions(-) delete mode 100644 IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/contents.xcworkspacedata delete mode 100644 IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/xcshareddata/IOBluetooth-Compat.xccheckout delete mode 100644 IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/xcuserdata/tcmac.xcuserdatad/UserInterfaceState.xcuserstate delete mode 100644 IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/xcuserdata/tcmac.xcuserdatad/WorkspaceSettings.xcsettings delete mode 100644 IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/xcuserdata/tcmac.xcuserdatad/xcschemes/IOBluetooth-Compat.xcscheme delete mode 100644 IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/xcuserdata/tcmac.xcuserdatad/xcschemes/xcschememanagement.plist diff --git a/.gitignore b/.gitignore index 5afc77e..12b4eb3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ .project # XCode related DerivedData/ +xcuserdata/ +project.xcworkspace/ diff --git a/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index cc02987..0000000 --- a/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/xcshareddata/IOBluetooth-Compat.xccheckout b/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/xcshareddata/IOBluetooth-Compat.xccheckout deleted file mode 100644 index 5986be0..0000000 --- a/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/xcshareddata/IOBluetooth-Compat.xccheckout +++ /dev/null @@ -1,41 +0,0 @@ - - - - - IDESourceControlProjectFavoriteDictionaryKey - - IDESourceControlProjectIdentifier - 402F1DA4-9EE8-42D6-8005-72CE111EE0ED - IDESourceControlProjectName - IOBluetooth-Compat - IDESourceControlProjectOriginsDictionary - - 39F9C414-00E5-4EF2-A028-8019D12E78AC - git+ssh://ssh.git.ni.fr.eu.org/pyfantom.git - - IDESourceControlProjectPath - IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace - IDESourceControlProjectRelativeInstallPathDictionary - - 39F9C414-00E5-4EF2-A028-8019D12E78AC - ../../.. - - IDESourceControlProjectURL - git+ssh://ssh.git.ni.fr.eu.org/pyfantom.git - IDESourceControlProjectVersion - 110 - IDESourceControlProjectWCCIdentifier - 39F9C414-00E5-4EF2-A028-8019D12E78AC - IDESourceControlProjectWCConfigurations - - - IDESourceControlRepositoryExtensionIdentifierKey - public.vcs.git - IDESourceControlWCCIdentifierKey - 39F9C414-00E5-4EF2-A028-8019D12E78AC - IDESourceControlWCCName - pyfantom - - - - diff --git a/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/xcuserdata/tcmac.xcuserdatad/UserInterfaceState.xcuserstate b/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/xcuserdata/tcmac.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index b0d0171..0000000 Binary files a/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/xcuserdata/tcmac.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/xcuserdata/tcmac.xcuserdatad/WorkspaceSettings.xcsettings b/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/xcuserdata/tcmac.xcuserdatad/WorkspaceSettings.xcsettings deleted file mode 100644 index 42e1f86..0000000 --- a/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/project.xcworkspace/xcuserdata/tcmac.xcuserdatad/WorkspaceSettings.xcsettings +++ /dev/null @@ -1,24 +0,0 @@ - - - - - BuildLocationStyle - CustomLocation - CustomBuildIntermediatesPath - Build/Intermediates - CustomBuildLocationType - RelativeToDerivedData - CustomBuildProductsPath - Build/Products - DerivedDataLocationStyle - Default - IssueFilterStyle - ShowActiveSchemeOnly - LiveSourceIssuesEnabled - - SnapshotAutomaticallyBeforeSignificantChanges - - SnapshotLocationStyle - Default - - diff --git a/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/xcuserdata/tcmac.xcuserdatad/xcschemes/IOBluetooth-Compat.xcscheme b/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/xcuserdata/tcmac.xcuserdatad/xcschemes/IOBluetooth-Compat.xcscheme deleted file mode 100644 index fa6b2bb..0000000 --- a/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/xcuserdata/tcmac.xcuserdatad/xcschemes/IOBluetooth-Compat.xcscheme +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/xcuserdata/tcmac.xcuserdatad/xcschemes/xcschememanagement.plist b/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/xcuserdata/tcmac.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index e7d6c15..0000000 --- a/IOBluetooth-Compat/IOBluetooth-Compat.xcodeproj/xcuserdata/tcmac.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,27 +0,0 @@ - - - - - SchemeUserState - - IOBluetooth-Compat.xcscheme - - orderHint - 0 - - - SuppressBuildableAutocreation - - 43B43CE31835D78100C0D4EE - - primary - - - 43B43CF61835D78100C0D4EE - - primary - - - - - -- cgit v1.2.3 From d298d31111b8e81601512045ccc57fdacf8bd37a Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM Signature) Date: Fri, 15 Nov 2013 13:18:33 +0800 Subject: made compatlib path absolute wrt home directory --- pyfantom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyfantom.py b/pyfantom.py index 3570479..2e66b1f 100644 --- a/pyfantom.py +++ b/pyfantom.py @@ -48,7 +48,7 @@ if DEBUG: print "Running on %s Platform (Rel. %s)" % (platform_type, platform_rel) if platform_type == 'Darwin': - import sys + import sys, os if sys.maxsize > 2**32: raise RuntimeError("fantom drivers not available in 64 bit mode.\n" @@ -62,7 +62,7 @@ if platform_type == 'Darwin': if platform_rel >= MACOSX_BTMODVER: print " Bluetooth Stack not supported (Rel >= %s)" % MACOSX_BTMODVER MACOSX_BTENABLE = False - compatlibpath = './IOBluetooth-Compat.dylib' + compatlibpath = '%s/Library/IOBluetooth-Compat.dylib' % os.getenv("HOME") from AppKit import NSAutoreleasePool, NSApplication -- cgit v1.2.3 From 45a69802f8cd8e97ac7ef3dfb05265d10f4af4ea Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM Signature) Date: Fri, 15 Nov 2013 13:44:29 +0800 Subject: this version works without having to mess with dyld preloading By making symbols in compatdll global, we don't need to define DYLD_INSERT_LIBRARIES --- pyfantom.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyfantom.py b/pyfantom.py index 2e66b1f..daf9b17 100644 --- a/pyfantom.py +++ b/pyfantom.py @@ -83,7 +83,8 @@ else: if not MACOSX_BTENABLE: print "Loading IOBluetooth-Compat Library (", compatlibpath, ")" # Need to set DYLD_FORCE_FLAT_NAMESPACE in env - compatdll = ctypes.cdll.LoadLibrary(compatlibpath) + #compatdll = ctypes.cdll.LoadLibrary(compatlibpath) + compatdll = ctypes.CDLL(compatlibpath, ctypes.RTLD_GLOBAL) # RTLD_NOW is set by ctypes and can't be overridden # http://hg.python.org/cpython/file/2.7/Modules/_ctypes/callproc.c#l1432 -- cgit v1.2.3 From 35eeb729b54f1ae92b350b79f0334be0707519da Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM Signature) Date: Fri, 15 Nov 2013 15:42:32 +0800 Subject: improved error handling and reporting for bluetooth compat hack --- pyfantom.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pyfantom.py b/pyfantom.py index daf9b17..c65c275 100644 --- a/pyfantom.py +++ b/pyfantom.py @@ -62,8 +62,14 @@ if platform_type == 'Darwin': if platform_rel >= MACOSX_BTMODVER: print " Bluetooth Stack not supported (Rel >= %s)" % MACOSX_BTMODVER MACOSX_BTENABLE = False + if os.getenv("DYLD_FORCE_FLAT_NAMESPACE") is None: + raise RuntimeError("Bluetooth Compat Framework needed.\n" + "Enable IOBluetooth-Compat Framework using:\n" + "$ export DYLD_FORCE_FLAT_NAMESPACE=1\n") + #compatlibpath = ctypes.util.find_library('IOBluetooth-Compat.dylib') compatlibpath = '%s/Library/IOBluetooth-Compat.dylib' % os.getenv("HOME") - + if compatlibpath is None or not os.path.exists(compatlibpath): + raise RuntimeError("IOBluetooth-Compat Framework not found") from AppKit import NSAutoreleasePool, NSApplication elif platform_type == 'Linux': @@ -73,6 +79,7 @@ elif platform_type == 'Windows': else: raise RuntimeError('Unsupported platform') + if libpath is not None: if DEBUG: print "Found Fantom Library (", libpath, ")" -- cgit v1.2.3