commit ee6dabccc6eef6c6d5e2a6c38062d417ef612446 Author: Lukas Bachschwell Date: Thu Nov 19 22:29:13 2015 +0100 Initial commit diff --git a/BeerBox.xcodeproj/project.pbxproj b/BeerBox.xcodeproj/project.pbxproj new file mode 100755 index 0000000..d96b75c --- /dev/null +++ b/BeerBox.xcodeproj/project.pbxproj @@ -0,0 +1,542 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 2B08A22F1BB48CF300B0B8B1 /* Main_iPhone.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2B08A22D1BB48CF300B0B8B1 /* Main_iPhone.storyboard */; settings = {ASSET_TAGS = (); }; }; + 2BBC018F1981879400D0BAE0 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BBC018E1981879400D0BAE0 /* Foundation.framework */; }; + 2BBC01911981879400D0BAE0 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BBC01901981879400D0BAE0 /* CoreGraphics.framework */; }; + 2BBC01931981879400D0BAE0 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BBC01921981879400D0BAE0 /* UIKit.framework */; }; + 2BBC01991981879400D0BAE0 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 2BBC01971981879400D0BAE0 /* InfoPlist.strings */; }; + 2BBC019B1981879400D0BAE0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BBC019A1981879400D0BAE0 /* main.m */; }; + 2BBC019F1981879400D0BAE0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BBC019E1981879400D0BAE0 /* AppDelegate.m */; }; + 2BBC01A81981879400D0BAE0 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BBC01A71981879400D0BAE0 /* ViewController.m */; }; + 2BBC01AA1981879500D0BAE0 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2BBC01A91981879500D0BAE0 /* Images.xcassets */; }; + 2BBC01B11981879500D0BAE0 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BBC01B01981879500D0BAE0 /* XCTest.framework */; }; + 2BBC01B21981879500D0BAE0 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BBC018E1981879400D0BAE0 /* Foundation.framework */; }; + 2BBC01B31981879500D0BAE0 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BBC01921981879400D0BAE0 /* UIKit.framework */; }; + 2BBC01BB1981879500D0BAE0 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 2BBC01B91981879500D0BAE0 /* InfoPlist.strings */; }; + 2BBC01BD1981879500D0BAE0 /* BeerBoxTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BBC01BC1981879500D0BAE0 /* BeerBoxTests.m */; }; + 2BBC01C7198187B600D0BAE0 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BBC01C6198187B600D0BAE0 /* AudioToolbox.framework */; }; + 2BBC01C9198187C300D0BAE0 /* CoreBluetooth.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BBC01C8198187C300D0BAE0 /* CoreBluetooth.framework */; }; + 2BBC01CC198187EB00D0BAE0 /* SerialGATT.m in Sources */ = {isa = PBXBuildFile; fileRef = 2BBC01CA198187EB00D0BAE0 /* SerialGATT.m */; }; + 2BC70F0D1BD2242800330A1F /* Icon@2x copy.png in Resources */ = {isa = PBXBuildFile; fileRef = 2BC70F0C1BD2242800330A1F /* Icon@2x copy.png */; settings = {ASSET_TAGS = (); }; }; + 2BEEF2401BD7FAAB00003449 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2BEEF23F1BD7FAAB00003449 /* LaunchScreen.storyboard */; settings = {ASSET_TAGS = (); }; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 2B870D8D19819C5200911BCD /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 2BBC01831981879400D0BAE0 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 2BBC018A1981879400D0BAE0; + remoteInfo = BeerBox; + }; + 2B870D8F19819C5200911BCD /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 2BBC01831981879400D0BAE0 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 2BBC018A1981879400D0BAE0; + remoteInfo = BeerBox; + }; + 2BBC01B41981879500D0BAE0 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 2BBC01831981879400D0BAE0 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 2BBC018A1981879400D0BAE0; + remoteInfo = BeerBox; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 2B08A22E1BB48CF300B0B8B1 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main_iPhone.storyboard; sourceTree = ""; }; + 2BBC018B1981879400D0BAE0 /* BeerBox.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BeerBox.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 2BBC018E1981879400D0BAE0 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 2BBC01901981879400D0BAE0 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 2BBC01921981879400D0BAE0 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + 2BBC01961981879400D0BAE0 /* BeerBox-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "BeerBox-Info.plist"; sourceTree = ""; }; + 2BBC01981981879400D0BAE0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 2BBC019A1981879400D0BAE0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 2BBC019C1981879400D0BAE0 /* BeerBox-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "BeerBox-Prefix.pch"; sourceTree = ""; }; + 2BBC019D1981879400D0BAE0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 2BBC019E1981879400D0BAE0 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 2BBC01A61981879400D0BAE0 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + 2BBC01A71981879400D0BAE0 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + 2BBC01A91981879500D0BAE0 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + 2BBC01AF1981879500D0BAE0 /* BeerBoxTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BeerBoxTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 2BBC01B01981879500D0BAE0 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; + 2BBC01B81981879500D0BAE0 /* BeerBoxTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "BeerBoxTests-Info.plist"; sourceTree = ""; }; + 2BBC01BA1981879500D0BAE0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + 2BBC01BC1981879500D0BAE0 /* BeerBoxTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BeerBoxTests.m; sourceTree = ""; }; + 2BBC01C6198187B600D0BAE0 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; + 2BBC01C8198187C300D0BAE0 /* CoreBluetooth.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreBluetooth.framework; path = System/Library/Frameworks/CoreBluetooth.framework; sourceTree = SDKROOT; }; + 2BBC01CA198187EB00D0BAE0 /* SerialGATT.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SerialGATT.m; sourceTree = ""; }; + 2BBC01CB198187EB00D0BAE0 /* SerialGATT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SerialGATT.h; sourceTree = ""; }; + 2BC70F0C1BD2242800330A1F /* Icon@2x copy.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon@2x copy.png"; sourceTree = ""; }; + 2BEEF23F1BD7FAAB00003449 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 2BBC01881981879400D0BAE0 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 2BBC01C9198187C300D0BAE0 /* CoreBluetooth.framework in Frameworks */, + 2BBC01C7198187B600D0BAE0 /* AudioToolbox.framework in Frameworks */, + 2BBC01911981879400D0BAE0 /* CoreGraphics.framework in Frameworks */, + 2BBC01931981879400D0BAE0 /* UIKit.framework in Frameworks */, + 2BBC018F1981879400D0BAE0 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2BBC01AC1981879500D0BAE0 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 2BBC01B11981879500D0BAE0 /* XCTest.framework in Frameworks */, + 2BBC01B31981879500D0BAE0 /* UIKit.framework in Frameworks */, + 2BBC01B21981879500D0BAE0 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 2BBC01821981879400D0BAE0 = { + isa = PBXGroup; + children = ( + 2BBC01941981879400D0BAE0 /* BeerBox */, + 2BBC01B61981879500D0BAE0 /* BeerBoxTests */, + 2BBC018D1981879400D0BAE0 /* Frameworks */, + 2BBC018C1981879400D0BAE0 /* Products */, + ); + sourceTree = ""; + }; + 2BBC018C1981879400D0BAE0 /* Products */ = { + isa = PBXGroup; + children = ( + 2BBC018B1981879400D0BAE0 /* BeerBox.app */, + 2BBC01AF1981879500D0BAE0 /* BeerBoxTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 2BBC018D1981879400D0BAE0 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 2BBC01C8198187C300D0BAE0 /* CoreBluetooth.framework */, + 2BBC01C6198187B600D0BAE0 /* AudioToolbox.framework */, + 2BBC018E1981879400D0BAE0 /* Foundation.framework */, + 2BBC01901981879400D0BAE0 /* CoreGraphics.framework */, + 2BBC01921981879400D0BAE0 /* UIKit.framework */, + 2BBC01B01981879500D0BAE0 /* XCTest.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 2BBC01941981879400D0BAE0 /* BeerBox */ = { + isa = PBXGroup; + children = ( + 2BC70F0C1BD2242800330A1F /* Icon@2x copy.png */, + 2B08A22D1BB48CF300B0B8B1 /* Main_iPhone.storyboard */, + 2BBC019D1981879400D0BAE0 /* AppDelegate.h */, + 2BBC019E1981879400D0BAE0 /* AppDelegate.m */, + 2BEEF23F1BD7FAAB00003449 /* LaunchScreen.storyboard */, + 2BBC01CD198187F500D0BAE0 /* SerialGATT */, + 2BBC01A61981879400D0BAE0 /* ViewController.h */, + 2BBC01A71981879400D0BAE0 /* ViewController.m */, + 2BBC01A91981879500D0BAE0 /* Images.xcassets */, + 2BBC01951981879400D0BAE0 /* Supporting Files */, + ); + path = BeerBox; + sourceTree = ""; + }; + 2BBC01951981879400D0BAE0 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 2BBC01961981879400D0BAE0 /* BeerBox-Info.plist */, + 2BBC01971981879400D0BAE0 /* InfoPlist.strings */, + 2BBC019A1981879400D0BAE0 /* main.m */, + 2BBC019C1981879400D0BAE0 /* BeerBox-Prefix.pch */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 2BBC01B61981879500D0BAE0 /* BeerBoxTests */ = { + isa = PBXGroup; + children = ( + 2BBC01BC1981879500D0BAE0 /* BeerBoxTests.m */, + 2BBC01B71981879500D0BAE0 /* Supporting Files */, + ); + path = BeerBoxTests; + sourceTree = ""; + }; + 2BBC01B71981879500D0BAE0 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 2BBC01B81981879500D0BAE0 /* BeerBoxTests-Info.plist */, + 2BBC01B91981879500D0BAE0 /* InfoPlist.strings */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 2BBC01CD198187F500D0BAE0 /* SerialGATT */ = { + isa = PBXGroup; + children = ( + 2BBC01CA198187EB00D0BAE0 /* SerialGATT.m */, + 2BBC01CB198187EB00D0BAE0 /* SerialGATT.h */, + ); + name = SerialGATT; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 2BBC018A1981879400D0BAE0 /* BeerBox */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2BBC01C01981879500D0BAE0 /* Build configuration list for PBXNativeTarget "BeerBox" */; + buildPhases = ( + 2BBC01871981879400D0BAE0 /* Sources */, + 2BBC01881981879400D0BAE0 /* Frameworks */, + 2BBC01891981879400D0BAE0 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = BeerBox; + productName = BeerBox; + productReference = 2BBC018B1981879400D0BAE0 /* BeerBox.app */; + productType = "com.apple.product-type.application"; + }; + 2BBC01AE1981879500D0BAE0 /* BeerBoxTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2BBC01C31981879500D0BAE0 /* Build configuration list for PBXNativeTarget "BeerBoxTests" */; + buildPhases = ( + 2BBC01AB1981879500D0BAE0 /* Sources */, + 2BBC01AC1981879500D0BAE0 /* Frameworks */, + 2BBC01AD1981879500D0BAE0 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 2BBC01B51981879500D0BAE0 /* PBXTargetDependency */, + 2B870D8E19819C5200911BCD /* PBXTargetDependency */, + 2B870D9019819C5200911BCD /* PBXTargetDependency */, + ); + name = BeerBoxTests; + productName = BeerBoxTests; + productReference = 2BBC01AF1981879500D0BAE0 /* BeerBoxTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 2BBC01831981879400D0BAE0 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0510; + ORGANIZATIONNAME = LBSFilm; + TargetAttributes = { + 2BBC018A1981879400D0BAE0 = { + SystemCapabilities = { + com.apple.BackgroundModes = { + enabled = 1; + }; + }; + }; + 2BBC01AE1981879500D0BAE0 = { + TestTargetID = 2BBC018A1981879400D0BAE0; + }; + }; + }; + buildConfigurationList = 2BBC01861981879400D0BAE0 /* Build configuration list for PBXProject "BeerBox" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 2BBC01821981879400D0BAE0; + productRefGroup = 2BBC018C1981879400D0BAE0 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 2BBC018A1981879400D0BAE0 /* BeerBox */, + 2BBC01AE1981879500D0BAE0 /* BeerBoxTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 2BBC01891981879400D0BAE0 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2B08A22F1BB48CF300B0B8B1 /* Main_iPhone.storyboard in Resources */, + 2BC70F0D1BD2242800330A1F /* Icon@2x copy.png in Resources */, + 2BEEF2401BD7FAAB00003449 /* LaunchScreen.storyboard in Resources */, + 2BBC01AA1981879500D0BAE0 /* Images.xcassets in Resources */, + 2BBC01991981879400D0BAE0 /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2BBC01AD1981879500D0BAE0 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2BBC01BB1981879500D0BAE0 /* InfoPlist.strings in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 2BBC01871981879400D0BAE0 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2BBC01A81981879400D0BAE0 /* ViewController.m in Sources */, + 2BBC019F1981879400D0BAE0 /* AppDelegate.m in Sources */, + 2BBC019B1981879400D0BAE0 /* main.m in Sources */, + 2BBC01CC198187EB00D0BAE0 /* SerialGATT.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2BBC01AB1981879500D0BAE0 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2BBC01BD1981879500D0BAE0 /* BeerBoxTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 2B870D8E19819C5200911BCD /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2BBC018A1981879400D0BAE0 /* BeerBox */; + targetProxy = 2B870D8D19819C5200911BCD /* PBXContainerItemProxy */; + }; + 2B870D9019819C5200911BCD /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2BBC018A1981879400D0BAE0 /* BeerBox */; + targetProxy = 2B870D8F19819C5200911BCD /* PBXContainerItemProxy */; + }; + 2BBC01B51981879500D0BAE0 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2BBC018A1981879400D0BAE0 /* BeerBox */; + targetProxy = 2BBC01B41981879500D0BAE0 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 2B08A22D1BB48CF300B0B8B1 /* Main_iPhone.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 2B08A22E1BB48CF300B0B8B1 /* Base */, + ); + name = Main_iPhone.storyboard; + sourceTree = ""; + }; + 2BBC01971981879400D0BAE0 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 2BBC01981981879400D0BAE0 /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + 2BBC01B91981879500D0BAE0 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + 2BBC01BA1981879500D0BAE0 /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 2BBC01BE1981879500D0BAE0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + 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; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + 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_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 7.1; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 2BBC01BF1981879500D0BAE0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + 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; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + 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_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 7.1; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 2BBC01C11981879500D0BAE0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer: Lukas Bachschwell (4GM2CZLHA5)"; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "BeerBox/BeerBox-Prefix.pch"; + INFOPLIST_FILE = "BeerBox/BeerBox-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = 1; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + 2BBC01C21981879500D0BAE0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CODE_SIGN_IDENTITY = "iPhone Developer: Lukas Bachschwell (4GM2CZLHA5)"; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "BeerBox/BeerBox-Prefix.pch"; + INFOPLIST_FILE = "BeerBox/BeerBox-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + PRODUCT_NAME = "$(TARGET_NAME)"; + TARGETED_DEVICE_FAMILY = 1; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; + 2BBC01C41981879500D0BAE0 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/BeerBox.app/BeerBox"; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + "$(DEVELOPER_FRAMEWORKS_DIR)", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "BeerBox/BeerBox-Prefix.pch"; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = "BeerBoxTests/BeerBoxTests-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUNDLE_LOADER)"; + WRAPPER_EXTENSION = xctest; + }; + name = Debug; + }; + 2BBC01C51981879500D0BAE0 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/BeerBox.app/BeerBox"; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + "$(DEVELOPER_FRAMEWORKS_DIR)", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "BeerBox/BeerBox-Prefix.pch"; + INFOPLIST_FILE = "BeerBoxTests/BeerBoxTests-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUNDLE_LOADER)"; + WRAPPER_EXTENSION = xctest; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 2BBC01861981879400D0BAE0 /* Build configuration list for PBXProject "BeerBox" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2BBC01BE1981879500D0BAE0 /* Debug */, + 2BBC01BF1981879500D0BAE0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2BBC01C01981879500D0BAE0 /* Build configuration list for PBXNativeTarget "BeerBox" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2BBC01C11981879500D0BAE0 /* Debug */, + 2BBC01C21981879500D0BAE0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2BBC01C31981879500D0BAE0 /* Build configuration list for PBXNativeTarget "BeerBoxTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2BBC01C41981879500D0BAE0 /* Debug */, + 2BBC01C51981879500D0BAE0 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 2BBC01831981879400D0BAE0 /* Project object */; +} diff --git a/BeerBox.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/BeerBox.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100755 index 0000000..6af34aa --- /dev/null +++ b/BeerBox.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/BeerBox.xcodeproj/project.xcworkspace/xcuserdata/LB.xcuserdatad/UserInterfaceState.xcuserstate b/BeerBox.xcodeproj/project.xcworkspace/xcuserdata/LB.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100755 index 0000000..e764614 Binary files /dev/null and b/BeerBox.xcodeproj/project.xcworkspace/xcuserdata/LB.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/BeerBox.xcodeproj/xcuserdata/LB.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/BeerBox.xcodeproj/xcuserdata/LB.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..fe2b454 --- /dev/null +++ b/BeerBox.xcodeproj/xcuserdata/LB.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,5 @@ + + + diff --git a/BeerBox.xcodeproj/xcuserdata/LB.xcuserdatad/xcschemes/BeerBox.xcscheme b/BeerBox.xcodeproj/xcuserdata/LB.xcuserdatad/xcschemes/BeerBox.xcscheme new file mode 100755 index 0000000..b0567ce --- /dev/null +++ b/BeerBox.xcodeproj/xcuserdata/LB.xcuserdatad/xcschemes/BeerBox.xcscheme @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BeerBox.xcodeproj/xcuserdata/LB.xcuserdatad/xcschemes/xcschememanagement.plist b/BeerBox.xcodeproj/xcuserdata/LB.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100755 index 0000000..068d7ed --- /dev/null +++ b/BeerBox.xcodeproj/xcuserdata/LB.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,27 @@ + + + + + SchemeUserState + + BeerBox.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + 2BBC018A1981879400D0BAE0 + + primary + + + 2BBC01AE1981879500D0BAE0 + + primary + + + + + diff --git a/BeerBox/AppDelegate.h b/BeerBox/AppDelegate.h new file mode 100755 index 0000000..eac8f05 --- /dev/null +++ b/BeerBox/AppDelegate.h @@ -0,0 +1,15 @@ +// +// AppDelegate.h +// BeerBox +// +// Created by Lukas on 24/07/14. +// Copyright (c) 2014 LBSFilm. All rights reserved. +// + +#import + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + +@end diff --git a/BeerBox/AppDelegate.m b/BeerBox/AppDelegate.m new file mode 100755 index 0000000..6cb90e9 --- /dev/null +++ b/BeerBox/AppDelegate.m @@ -0,0 +1,46 @@ +// +// AppDelegate.m +// BeerBox +// +// Created by Lukas on 24/07/14. +// Copyright (c) 2014 LBSFilm. All rights reserved. +// + +#import "AppDelegate.h" + +@implementation AppDelegate + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions +{ + // Override point for customization after application launch. + return YES; +} + +- (void)applicationWillResignActive:(UIApplication *)application +{ + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. +} + +- (void)applicationDidEnterBackground:(UIApplication *)application +{ + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. +} + +- (void)applicationWillEnterForeground:(UIApplication *)application +{ + // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. +} + +- (void)applicationDidBecomeActive:(UIApplication *)application +{ + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. +} + +- (void)applicationWillTerminate:(UIApplication *)application +{ + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. +} + +@end diff --git a/BeerBox/Base.lproj/.DS_Store b/BeerBox/Base.lproj/.DS_Store new file mode 100644 index 0000000..605d4db Binary files /dev/null and b/BeerBox/Base.lproj/.DS_Store differ diff --git a/BeerBox/Base.lproj/Main_iPhone.storyboard b/BeerBox/Base.lproj/Main_iPhone.storyboard new file mode 100755 index 0000000..b32a19b --- /dev/null +++ b/BeerBox/Base.lproj/Main_iPhone.storyboard @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BeerBox/BeerBox-Info.plist b/BeerBox/BeerBox-Info.plist new file mode 100755 index 0000000..257f51e --- /dev/null +++ b/BeerBox/BeerBox-Info.plist @@ -0,0 +1,55 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + LBSFilm.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + UIBackgroundModes + + audio + bluetooth-central + external-accessory + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main_iPhone + UIMainStoryboardFile~ipad + Main_iPad + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/BeerBox/BeerBox-Prefix.pch b/BeerBox/BeerBox-Prefix.pch new file mode 100755 index 0000000..82a2bb4 --- /dev/null +++ b/BeerBox/BeerBox-Prefix.pch @@ -0,0 +1,16 @@ +// +// Prefix header +// +// The contents of this file are implicitly included at the beginning of every source file. +// + +#import + +#ifndef __IPHONE_5_0 +#warning "This project uses features only available in iOS SDK 5.0 and later." +#endif + +#ifdef __OBJC__ + #import + #import +#endif diff --git a/BeerBox/Icon@2x copy.png b/BeerBox/Icon@2x copy.png new file mode 100644 index 0000000..857c251 Binary files /dev/null and b/BeerBox/Icon@2x copy.png differ diff --git a/BeerBox/Images.xcassets/AppIcon.appiconset/Contents.json b/BeerBox/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..72875c4 --- /dev/null +++ b/BeerBox/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,80 @@ +{ + "images" : [ + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-Small@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-Small@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-60@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-Small.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-Small@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-40.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-76.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-76@2x.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-40.png b/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-40.png new file mode 100644 index 0000000..e11e8da Binary files /dev/null and b/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-40.png differ diff --git a/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png b/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png new file mode 100644 index 0000000..499dc5b Binary files /dev/null and b/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png differ diff --git a/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png b/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png new file mode 100644 index 0000000..d851124 Binary files /dev/null and b/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png differ diff --git a/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png b/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png new file mode 100644 index 0000000..d851124 Binary files /dev/null and b/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png differ diff --git a/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png b/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png new file mode 100644 index 0000000..08a4e00 Binary files /dev/null and b/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png differ diff --git a/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-76.png b/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-76.png new file mode 100644 index 0000000..6898406 Binary files /dev/null and b/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-76.png differ diff --git a/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png b/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png new file mode 100644 index 0000000..4135216 Binary files /dev/null and b/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-76@2x.png differ diff --git a/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-Small.png b/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-Small.png new file mode 100644 index 0000000..f47fbab Binary files /dev/null and b/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-Small.png differ diff --git a/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png b/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png new file mode 100644 index 0000000..63f63cc Binary files /dev/null and b/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png differ diff --git a/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-Small@3x.png b/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-Small@3x.png new file mode 100644 index 0000000..ce01186 Binary files /dev/null and b/BeerBox/Images.xcassets/AppIcon.appiconset/Icon-Small@3x.png differ diff --git a/BeerBox/Images.xcassets/Contents.json b/BeerBox/Images.xcassets/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/BeerBox/Images.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/BeerBox/Images.xcassets/LaunchImage.launchimage/Contents.json b/BeerBox/Images.xcassets/LaunchImage.launchimage/Contents.json new file mode 100755 index 0000000..6da7c45 --- /dev/null +++ b/BeerBox/Images.xcassets/LaunchImage.launchimage/Contents.json @@ -0,0 +1,51 @@ +{ + "images" : [ + { + "orientation" : "portrait", + "idiom" : "iphone", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "iphone", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "subtype" : "retina4", + "scale" : "2x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "1x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "1x" + }, + { + "orientation" : "portrait", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + }, + { + "orientation" : "landscape", + "idiom" : "ipad", + "extent" : "full-screen", + "minimum-system-version" : "7.0", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/BeerBox/LaunchScreen.storyboard b/BeerBox/LaunchScreen.storyboard new file mode 100644 index 0000000..f2afbe5 --- /dev/null +++ b/BeerBox/LaunchScreen.storyboard @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BeerBox/SerialGATT.h b/BeerBox/SerialGATT.h new file mode 100755 index 0000000..4a80f59 --- /dev/null +++ b/BeerBox/SerialGATT.h @@ -0,0 +1,59 @@ +// +// SerialGATT.h +// HMSoft +// +// Created by HMSofts on 7/13/12. +// Copyright (c) 2012 jnhuamao.cn. All rights reserved. +// + +#import +#import + +#define SERVICE_UUID 0xFFE0 +#define CHAR_UUID 0xFFE1 + +@protocol BTSmartSensorDelegate + +@optional +- (void) peripheralFound:(CBPeripheral *)peripheral; +- (void) serialGATTCharValueUpdated: (NSString *)UUID value: (NSData *)data; +- (void) setConnect; +- (void) setDisconnect; +@end + +@interface SerialGATT : NSObject { + +} + +@property (nonatomic, assign) id delegate; +@property (strong, nonatomic) NSMutableArray *peripherals; +@property (strong, nonatomic) CBCentralManager *manager; +@property (strong, nonatomic) CBPeripheral *activePeripheral; + + +#pragma mark - Methods for controlling the HMSoft Sensor +-(void) setup; //controller setup +-(void) stopScan; + +-(int) findHMSoftPeripherals:(int)timeout; +-(void) scanTimer: (NSTimer *)timer; + +-(void) connect: (CBPeripheral *)peripheral; +-(void) disconnect: (CBPeripheral *)peripheral; + +-(void) write:(CBPeripheral *)peripheral data:(NSData *)data; +-(void) read:(CBPeripheral *)peripheral; +-(void) notify:(CBPeripheral *)peripheral on:(BOOL)on; + + +- (void) printPeripheralInfo:(CBPeripheral*)peripheral; + +-(void) notification:(int)serviceUUID characteristicUUID:(int)characteristicUUID p:(CBPeripheral *)p on:(BOOL)on; +-(UInt16) swap:(UInt16)s; + +-(CBService *) findServiceFromUUIDEx:(CBUUID *)UUID p:(CBPeripheral *)p; +-(CBCharacteristic *) findCharacteristicFromUUIDEx:(CBUUID *)UUID service:(CBService*)service; +-(void) writeValue:(int)serviceUUID characteristicUUID:(int)characteristicUUID p:(CBPeripheral *)p data:(NSData *)data; +-(void) readValue: (int)serviceUUID characteristicUUID:(int)characteristicUUID p:(CBPeripheral *)p; + +@end diff --git a/BeerBox/SerialGATT.m b/BeerBox/SerialGATT.m new file mode 100755 index 0000000..119c3d0 --- /dev/null +++ b/BeerBox/SerialGATT.m @@ -0,0 +1,541 @@ +// +// SerialGATT.m +// HMSoft +// +// Created by HMSofts on 7/13/12. +// Copyright (c) 2012 jnhuamao.cn. All rights reserved. +// + +#import "SerialGATT.h" + +@implementation SerialGATT + +@synthesize delegate; +@synthesize peripherals; +@synthesize manager; +@synthesize activePeripheral; + + +/*! + * @method swap: + * + * @param s Uint16 value to byteswap + * + * @discussion swap byteswaps a UInt16 + * + * @return Byteswapped UInt16 + */ + +-(UInt16) swap:(UInt16)s { + UInt16 temp = s << 8; + temp |= (s >> 8); + return temp; +} + +/* + * (void) setup + * enable CoreBluetooth CentralManager and set the delegate for SerialGATT + * + */ + +-(void) setup +{ + manager = [[CBCentralManager alloc] initWithDelegate:self queue:nil]; +} + +/* + * -(int) findHMSoftPeripherals:(int)timeout + * + */ +-(int) findHMSoftPeripherals:(int)timeout +{ + if ([manager state] != CBCentralManagerStatePoweredOn) { + NSLog(@"CoreBluetooth is not correctly initialized !"); + return -1; + } + + [NSTimer scheduledTimerWithTimeInterval:(float)timeout target:self selector:@selector(scanTimer:) userInfo:nil repeats:NO]; + + //[manager scanForPeripheralsWithServices:[NSArray arrayWithObject:serviceUUID] options:0]; // start Scanning + [manager scanForPeripheralsWithServices:nil options:0]; + return 0; +} + +/* + * scanTimer + * when findHMSoftPeripherals is timeout, this function will be called + * + */ +-(void) scanTimer:(NSTimer *)timer +{ + [manager stopScan]; +} + +/* + * @method printPeripheralInfo: + * + * @param peripheral Peripheral to print info of + * + * @discussion printPeripheralInfo prints detailed info about peripheral + * + */ +- (void) printPeripheralInfo:(CBPeripheral*)peripheral { + CFStringRef s = CFUUIDCreateString(NULL, (__bridge CFUUIDRef )peripheral.identifier); + printf("------------------------------------\r\n"); + printf("Peripheral Info :\r\n"); + printf("UUID : %s\r\n",CFStringGetCStringPtr(s, 0)); + printf("RSSI : %d\r\n",[peripheral.RSSI intValue]); + printf("Name : %s\r\n",[peripheral.name cStringUsingEncoding:NSStringEncodingConversionAllowLossy]); + printf("isConnected : %d\r\n",peripheral.state == CBPeripheralStateConnected); + printf("-------------------------------------\r\n"); + +} + +/* + * connect + * connect to a given peripheral + * + */ +-(void) connect:(CBPeripheral *)peripheral +{ + if (!(peripheral.state == CBPeripheralStateConnected)) { + [manager connectPeripheral:peripheral options:nil]; + } +} + +-(void) stopScan +{ + [manager stopScan]; +} + +/* + * disconnect + * disconnect to a given peripheral + * + */ +-(void) disconnect:(CBPeripheral *)peripheral +{ + [manager cancelPeripheralConnection:peripheral]; +} + + +#pragma mark - basic operations for SerialGATT service +-(void) write:(CBPeripheral *)peripheral data:(NSData *)data +{ + [self writeValue:SERVICE_UUID characteristicUUID:CHAR_UUID p:peripheral data:data]; +} + +-(void) read:(CBPeripheral *)peripheral +{ + printf("begin reading\n"); + //[peripheral readValueForCharacteristic:dataRecvrCharacteristic]; + printf("now can reading......\n"); +} + +-(void) notify: (CBPeripheral *)peripheral on:(BOOL)on +{ + [self notification:SERVICE_UUID characteristicUUID:CHAR_UUID p:peripheral on:YES]; +} + + +#pragma mark - CBCentralManager Delegates + +- (void)centralManagerDidUpdateState:(CBCentralManager *)central +{ + //TODO: to handle the state updates +} + +- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI +{ + printf("Now we found device\n"); + if (!peripherals) { + peripherals = [[NSMutableArray alloc] initWithObjects:peripheral, nil]; + for (int i = 0; i < [peripherals count]; i++) { + [delegate peripheralFound: peripheral]; + } + } + + { + if((__bridge CFUUIDRef )peripheral.identifier == NULL) return; + //if(peripheral.name == NULL) return; + //if(peripheral.name == nil) return; + if(peripheral.name.length < 1) return; + // Add the new peripheral to the peripherals array + for (int i = 0; i < [peripherals count]; i++) { + CBPeripheral *p = [peripherals objectAtIndex:i]; + if((__bridge CFUUIDRef )p.identifier == NULL) continue; + CFUUIDBytes b1 = CFUUIDGetUUIDBytes((__bridge CFUUIDRef )p.identifier); + CFUUIDBytes b2 = CFUUIDGetUUIDBytes((__bridge CFUUIDRef )peripheral.identifier); + if (memcmp(&b1, &b2, 16) == 0) { + // these are the same, and replace the old peripheral information + [peripherals replaceObjectAtIndex:i withObject:peripheral]; + printf("Duplicated peripheral is found...\n"); + //[delegate peripheralFound: peripheral]; + return; + } + } + printf("New peripheral is found...\n"); + [peripherals addObject:peripheral]; + [delegate peripheralFound:peripheral]; + return; + } + printf("%s\n", __FUNCTION__); +} + +-(void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPeripheral *)peripheral +{ + activePeripheral = peripheral; + activePeripheral.delegate = self; + + [activePeripheral discoverServices:nil]; + //[self notify:peripheral on:YES]; + + [self printPeripheralInfo:peripheral]; + + printf("connected to the active peripheral\n"); +} + +-(void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error +{ + printf("disconnected to the active peripheral\n"); + if(activePeripheral != nil) + [delegate setDisconnect]; + activePeripheral = nil; +} + +-(void)centralManager:(CBCentralManager *)central didFailToConnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error +{ + NSLog(@"failed to connect to peripheral %@: %@\n", [peripheral name], [error localizedDescription]); +} + +#pragma mark - CBPeripheral delegates + +-(void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error +{ + printf("in updateValueForCharacteristic function\n"); + + if (error) { + printf("updateValueForCharacteristic failed\n"); + return; + } + [delegate serialGATTCharValueUpdated:@"FFE1" value:characteristic.value]; + + +} + +////////////////////////////////////////////////////////////////////////////////////////////// + +- (void)peripheral:(CBPeripheral *)peripheral didWriteValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error +{ + +} + +- (void)peripheral:(CBPeripheral *)peripheral didWriteValueForDescriptor:(CBDescriptor *)descriptor error:(NSError *)error +{ + +} + +- (void)peripheralDidUpdateRSSI:(CBPeripheral *)peripheral error:(NSError *)error +{ + +} + +/* + * @method getAllCharacteristicsFromKeyfob + * + * @param p Peripheral to scan + * + * + * @discussion getAllCharacteristicsFromKeyfob starts a characteristics discovery on a peripheral + * pointed to by p + * + */ +-(void) getAllCharacteristicsFromKeyfob:(CBPeripheral *)p{ + for (int i=0; i < p.services.count; i++) { + CBService *s = [p.services objectAtIndex:i]; + printf("Fetching characteristics for service with UUID : %s\r\n",[self CBUUIDToString:s.UUID]); + [p discoverCharacteristics:nil forService:s]; + } +} + +/* + * @method didDiscoverServices + * + * @param peripheral Pheripheral that got updated + * @error error Error message if something went wrong + * + * @discussion didDiscoverServices is called when CoreBluetooth has discovered services on a + * peripheral after the discoverServices routine has been called on the peripheral + * + */ + +- (void)peripheral:(CBPeripheral *)peripheral didDiscoverServices:(NSError *)error { + if (!error) { + printf("Services of peripheral with UUID : %s found\r\n",[self UUIDToString:(__bridge CFUUIDRef )peripheral.identifier]); + [self getAllCharacteristicsFromKeyfob:peripheral]; + } + else { + printf("Service discovery was unsuccessfull !\r\n"); + } +} + +/* + * @method didDiscoverCharacteristicsForService + * + * @param peripheral Pheripheral that got updated + * @param service Service that characteristics where found on + * @error error Error message if something went wrong + * + * @discussion didDiscoverCharacteristicsForService is called when CoreBluetooth has discovered + * characteristics on a service, on a peripheral after the discoverCharacteristics routine has been called on the service + * + */ + +- (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error { + if (!error) { + printf("Characteristics of service with UUID : %s found\r\n",[self CBUUIDToString:service.UUID]); + for(int i = 0; i < service.characteristics.count; i++) { //Show every one + CBCharacteristic *c = [service.characteristics objectAtIndex:i]; + printf("Found characteristic %s\r\n",[ self CBUUIDToString:c.UUID]); + } + + char t[16]; + t[0] = (SERVICE_UUID >> 8) & 0xFF; + t[1] = SERVICE_UUID & 0xFF; + NSData *data = [[NSData alloc] initWithBytes:t length:16]; + CBUUID *uuid = [CBUUID UUIDWithData:data]; + //CBService *s = [peripheral.services objectAtIndex:(peripheral.services.count - 1)]; + if([self compareCBUUID:service.UUID UUID2:uuid]) { + printf("Try to open notify\n"); + [self notify:peripheral on:YES]; + } + } + else { + printf("Characteristic discorvery unsuccessfull !\r\n"); + } +} + + + +- (void)peripheral:(CBPeripheral *)peripheral didUpdateNotificationStateForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error +{ + if (!error) { + printf("Updated notification state for characteristic with UUID %s on service with UUID %s on peripheral with UUID %s\r\n",[self CBUUIDToString:characteristic.UUID],[self CBUUIDToString:characteristic.service.UUID],[self UUIDToString:(__bridge CFUUIDRef )peripheral.identifier]); + [delegate setConnect]; + } + else { + printf("Error in setting notification state for characteristic with UUID %s on service with UUID %s on peripheral with UUID %s\r\n",[self CBUUIDToString:characteristic.UUID],[self CBUUIDToString:characteristic.service.UUID],[self UUIDToString:(__bridge CFUUIDRef )peripheral.identifier]); + printf("Error code was %s\r\n",[[error description] cStringUsingEncoding:NSStringEncodingConversionAllowLossy]); + } +} + +/* + * @method CBUUIDToString + * + * @param UUID UUID to convert to string + * + * @returns Pointer to a character buffer containing UUID in string representation + * + * @discussion CBUUIDToString converts the data of a CBUUID class to a character pointer for easy printout using printf() + * + */ +-(const char *) CBUUIDToString:(CBUUID *) UUID { + return [[UUID.data description] cStringUsingEncoding:NSStringEncodingConversionAllowLossy]; +} + + +/* + * @method UUIDToString + * + * @param UUID UUID to convert to string + * + * @returns Pointer to a character buffer containing UUID in string representation + * + * @discussion UUIDToString converts the data of a CFUUIDRef class to a character pointer for easy printout using printf() + * + */ +-(const char *) UUIDToString:(CFUUIDRef)UUID { + if (!UUID) return "NULL"; + CFStringRef s = CFUUIDCreateString(NULL, UUID); + return CFStringGetCStringPtr(s, 0); + +} + +/* + * @method compareCBUUID + * + * @param UUID1 UUID 1 to compare + * @param UUID2 UUID 2 to compare + * + * @returns 1 (equal) 0 (not equal) + * + * @discussion compareCBUUID compares two CBUUID's to each other and returns 1 if they are equal and 0 if they are not + * + */ + +-(int) compareCBUUID:(CBUUID *) UUID1 UUID2:(CBUUID *)UUID2 { + char b1[16]; + char b2[16]; + [UUID1.data getBytes:b1]; + [UUID2.data getBytes:b2]; + if (memcmp(b1, b2, UUID1.data.length) == 0)return 1; + else return 0; +} + + +/* + * @method findServiceFromUUID: + * + * @param UUID CBUUID to find in service list + * @param p Peripheral to find service on + * + * @return pointer to CBService if found, nil if not + * + * @discussion findServiceFromUUID searches through the services list of a peripheral to find a + * service with a specific UUID + * + */ +-(CBService *) findServiceFromUUIDEx:(CBUUID *)UUID p:(CBPeripheral *)p { + for(int i = 0; i < p.services.count; i++) { + CBService *s = [p.services objectAtIndex:i]; + if ([self compareCBUUID:s.UUID UUID2:UUID]) return s; + } + return nil; //Service not found on this peripheral +} + +/* + * @method findCharacteristicFromUUID: + * + * @param UUID CBUUID to find in Characteristic list of service + * @param service Pointer to CBService to search for charateristics on + * + * @return pointer to CBCharacteristic if found, nil if not + * + * @discussion findCharacteristicFromUUID searches through the characteristic list of a given service + * to find a characteristic with a specific UUID + * + */ +-(CBCharacteristic *) findCharacteristicFromUUIDEx:(CBUUID *)UUID service:(CBService*)service { + for(int i=0; i < service.characteristics.count; i++) { + CBCharacteristic *c = [service.characteristics objectAtIndex:i]; + if ([self compareCBUUID:c.UUID UUID2:UUID]) return c; + } + return nil; //Characteristic not found on this service +} + + +/*! + * @method notification: + * + * @param serviceUUID Service UUID to read from (e.g. 0x2400) + * @param characteristicUUID Characteristic UUID to read from (e.g. 0x2401) + * @param p CBPeripheral to read from + * + * @discussion Main routine for enabling and disabling notification services. It converts integers + * into CBUUID's used by CoreBluetooth. It then searches through the peripherals services to find a + * suitable service, it then checks that there is a suitable characteristic on this service. + * If this is found, the notfication is set. + * + */ +-(void) notification:(int)serviceUUID characteristicUUID:(int)characteristicUUID p:(CBPeripheral *)p on:(BOOL)on { + UInt16 s = [self swap:serviceUUID]; + UInt16 c = [self swap:characteristicUUID]; + NSData *sd = [[NSData alloc] initWithBytes:(char *)&s length:2]; + NSData *cd = [[NSData alloc] initWithBytes:(char *)&c length:2]; + CBUUID *su = [CBUUID UUIDWithData:sd]; + CBUUID *cu = [CBUUID UUIDWithData:cd]; + CBService *service = [self findServiceFromUUIDEx:su p:p]; + if (!service) { + printf("Could not find service with UUID %s on peripheral with UUID %s\r\n",[self CBUUIDToString:su],[self UUIDToString:(__bridge CFUUIDRef )p.identifier]); + return; + } + CBCharacteristic *characteristic = [self findCharacteristicFromUUIDEx:cu service:service]; + if (!characteristic) { + printf("Could not find characteristic with UUID %s on service with UUID %s on peripheral with UUID %s\r\n",[self CBUUIDToString:cu],[self CBUUIDToString:su],[self UUIDToString:(__bridge CFUUIDRef )p.identifier]); + return; + } + [p setNotifyValue:on forCharacteristic:characteristic]; +} + + +/*! + * @method writeValue: + * + * @param serviceUUID Service UUID to write to (e.g. 0x2400) + * @param characteristicUUID Characteristic UUID to write to (e.g. 0x2401) + * @param data Data to write to peripheral + * @param p CBPeripheral to write to + * + * @discussion Main routine for writeValue request, writes without feedback. It converts integer into + * CBUUID's used by CoreBluetooth. It then searches through the peripherals services to find a + * suitable service, it then checks that there is a suitable characteristic on this service. + * If this is found, value is written. If not nothing is done. + * + */ + +-(void) writeValue:(int)serviceUUID characteristicUUID:(int)characteristicUUID p:(CBPeripheral *)p data:(NSData *)data { + UInt16 s = [self swap:serviceUUID]; + UInt16 c = [self swap:characteristicUUID]; + NSData *sd = [[NSData alloc] initWithBytes:(char *)&s length:2]; + NSData *cd = [[NSData alloc] initWithBytes:(char *)&c length:2]; + CBUUID *su = [CBUUID UUIDWithData:sd]; + CBUUID *cu = [CBUUID UUIDWithData:cd]; + CBService *service = [self findServiceFromUUIDEx:su p:p]; + if (!service) { + printf("Could not find service with UUID %s on peripheral with UUID %s\r\n",[self CBUUIDToString:su],[self UUIDToString:(__bridge CFUUIDRef )p.identifier]); + return; + } + CBCharacteristic *characteristic = [self findCharacteristicFromUUIDEx:cu service:service]; + if (!characteristic) { + printf("Could not find characteristic with UUID %s on service with UUID %s on peripheral with UUID %s\r\n",[self CBUUIDToString:cu],[self CBUUIDToString:su],[self UUIDToString:(__bridge CFUUIDRef )p.identifier]); + return; + } + + if(characteristic.properties & CBCharacteristicPropertyWriteWithoutResponse) + { + [p writeValue:data forCharacteristic:characteristic type:CBCharacteristicWriteWithoutResponse]; + }else + { + [p writeValue:data forCharacteristic:characteristic type:CBCharacteristicWriteWithResponse]; + } +} + + +/*! + * @method readValue: + * + * @param serviceUUID Service UUID to read from (e.g. 0x2400) + * @param characteristicUUID Characteristic UUID to read from (e.g. 0x2401) + * @param p CBPeripheral to read from + * + * @discussion Main routine for read value request. It converts integers into + * CBUUID's used by CoreBluetooth. It then searches through the peripherals services to find a + * suitable service, it then checks that there is a suitable characteristic on this service. + * If this is found, the read value is started. When value is read the didUpdateValueForCharacteristic + * routine is called. + * + * @see didUpdateValueForCharacteristic + */ + +-(void) readValue: (int)serviceUUID characteristicUUID:(int)characteristicUUID p:(CBPeripheral *)p { + printf("In read Value"); + UInt16 s = [self swap:serviceUUID]; + UInt16 c = [self swap:characteristicUUID]; + NSData *sd = [[NSData alloc] initWithBytes:(char *)&s length:2]; + NSData *cd = [[NSData alloc] initWithBytes:(char *)&c length:2]; + CBUUID *su = [CBUUID UUIDWithData:sd]; + CBUUID *cu = [CBUUID UUIDWithData:cd]; + CBService *service = [self findServiceFromUUIDEx:su p:p]; + if (!service) { + printf("Could not find service with UUID %s on peripheral with UUID %s\r\n",[self CBUUIDToString:su],[self UUIDToString:(__bridge CFUUIDRef )p.identifier]); + return; + } + CBCharacteristic *characteristic = [self findCharacteristicFromUUIDEx:cu service:service]; + if (!characteristic) { + printf("Could not find characteristic with UUID %s on service with UUID %s on peripheral with UUID %s\r\n",[self CBUUIDToString:cu],[self CBUUIDToString:su],[self UUIDToString:(__bridge CFUUIDRef )p.identifier]); + return; + } + [p readValueForCharacteristic:characteristic]; +} + +@end diff --git a/BeerBox/ViewController.h b/BeerBox/ViewController.h new file mode 100755 index 0000000..3649426 --- /dev/null +++ b/BeerBox/ViewController.h @@ -0,0 +1,32 @@ +// +// ViewController.h +// BeerBox +// +// Created by Lukas on 24/07/14. +// Copyright (c) 2014 LBSFilm. All rights reserved. +// + +#import + +#import "SerialGATT.h" + +@interface ViewController : UIViewController + +@property (strong, nonatomic) SerialGATT *btControl; +@property (strong, nonatomic) CBPeripheral *box; + +- (IBAction)connect:(id)sender; +- (IBAction)sendMsgToArduino:(id)sender; +- (IBAction)checkCount:(id)sender; + +- (IBAction)removeUser:(id)sender; +- (IBAction)listUsers:(id)sender; + + +- (IBAction)revokeRFID:(id)sender; +- (IBAction)revokeFinger:(id)sender; + +@property (weak, nonatomic) IBOutlet UILabel *status; +@property (weak, nonatomic) IBOutlet UITextField *nameEntry; + +@end diff --git a/BeerBox/ViewController.m b/BeerBox/ViewController.m new file mode 100755 index 0000000..d0a34c8 --- /dev/null +++ b/BeerBox/ViewController.m @@ -0,0 +1,188 @@ +// +// ViewController.m +// BeerBox +// +// Created by Lukas on 24/07/14. +// Copyright (c) 2014 LBSFilm. All rights reserved. +// + +#import "ViewController.h" + +@interface ViewController () + +@end + +@implementation ViewController + +@synthesize btControl, box, status; + +- (void)viewDidLoad +{ + [super viewDidLoad]; + // Do any additional setup after loading the view, typically from a nib. + + btControl = [[SerialGATT alloc] init]; + [btControl setup]; + btControl.delegate = self; + + [_nameEntry setDelegate:self]; + +} + +- (void)didReceiveMemoryWarning +{ + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (IBAction)connect:(id)sender { + + [btControl findHMSoftPeripherals:8]; + [NSTimer scheduledTimerWithTimeInterval:8 target:self selector:@selector(scanTimer:) userInfo:nil repeats:NO]; +} + +-(void) scanTimer:(NSTimer *)timer +{ + + if(box == nil) [[[UIAlertView alloc] initWithTitle:@"Error" message:@"BeerBox not found!" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil] show]; +} + + +-(void) peripheralFound:(CBPeripheral *)peripheral +{ + if([peripheral.name isEqual: @"LBsKeys"]) + { + box = peripheral; + [btControl connect:box]; + } +} + +-(void) serialGATTCharValueUpdated:(NSString *)UUID value:(NSData *)data +{ + NSString *value = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding]; + [[[UIAlertView alloc] initWithTitle:@"RCV!" message:value delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil] show]; + +} + +- (IBAction)sendMsgToArduino:(id)sender { + + NSString *sendString = [NSString stringWithFormat:@"!%@;",_nameEntry.text]; + NSData *data = [sendString dataUsingEncoding:[NSString defaultCStringEncoding]]; + + if(data.length > 20) + { + int i = 0; + int nIndex = 0; + while ((i + 1) * 20 <= data.length) { + nIndex = i * 20; + if(nIndex > 0) + nIndex--; + NSData *dataSend = [data subdataWithRange:NSMakeRange(nIndex, 20)]; + [btControl write:box data:dataSend]; + i++; + } + i = data.length % 20; + if(i > 0) + { + NSData *dataSend = [data subdataWithRange:NSMakeRange(data.length - i, i)]; + [btControl write:box data:dataSend]; + } + + }else + { + //NSData *data = [MsgToArduino.text dataUsingEncoding:[NSString defaultCStringEncoding]]; + [btControl write:box data:data]; + } +} + +- (IBAction)removeUser:(id)sender { +} + +- (IBAction)listUsers:(id)sender { +} + + +- (IBAction)revokeRFID:(id)sender { + + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Revoke RFID" message:@"Enter an ID" delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles:@"Add", nil]; + alert.alertViewStyle = UIAlertViewStylePlainTextInput; + [alert show]; + [alert setDelegate:self]; + [[alert textFieldAtIndex:0] setDelegate:self]; + [[alert textFieldAtIndex:0] resignFirstResponder]; + [[alert textFieldAtIndex:0] setKeyboardType:UIKeyboardTypePhonePad]; + [[alert textFieldAtIndex:0] becomeFirstResponder]; + + +} + +- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ + // The user created a new item, add it + NSLog(@"Recall!"); + if (buttonIndex == 1) { + // Get the input text + NSString *newItem = [[alertView textFieldAtIndex:0] text]; + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Number" message:newItem delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:@"Add", nil]; + [alert show]; + } +} + +- (IBAction)revokeFinger:(id)sender { +} + + + +- (IBAction)checkCount:(id)sender { + + NSString *sendString = [NSString stringWithFormat:@"!%@;",_nameEntry.text]; + NSData *data = [sendString dataUsingEncoding:[NSString defaultCStringEncoding]]; + + if(data.length > 20) + { + int i = 0; + int nIndex = 0; + while ((i + 1) * 20 <= data.length) { + nIndex = i * 20; + if(nIndex > 0) + nIndex--; + NSData *dataSend = [data subdataWithRange:NSMakeRange(nIndex, 20)]; + [btControl write:box data:dataSend]; + i++; + } + i = data.length % 20; + if(i > 0) + { + NSData *dataSend = [data subdataWithRange:NSMakeRange(data.length - i, i)]; + [btControl write:box data:dataSend]; + } + + }else + { + //NSData *data = [MsgToArduino.text dataUsingEncoding:[NSString defaultCStringEncoding]]; + [btControl write:box data:data]; + } +} + + + +-(void)setConnect +{ + [[[UIAlertView alloc] initWithTitle:@"Found!" message:@"BeerBox found!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil] show]; + status.text=@"Connected!"; +} + +-(void)setDisconnect +{ + [[[UIAlertView alloc] initWithTitle:@"Lost!" message:@"BeerBox lost :-(" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil] show]; + status.text=@"not Connected"; +} + + +- (BOOL)textFieldShouldReturn:(UITextField *)textField { + [textField resignFirstResponder]; + return NO; +} + +@end + + diff --git a/BeerBox/en.lproj/InfoPlist.strings b/BeerBox/en.lproj/InfoPlist.strings new file mode 100755 index 0000000..477b28f --- /dev/null +++ b/BeerBox/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/BeerBox/main.m b/BeerBox/main.m new file mode 100755 index 0000000..0dcafa1 --- /dev/null +++ b/BeerBox/main.m @@ -0,0 +1,18 @@ +// +// main.m +// BeerBox +// +// Created by Lukas on 24/07/14. +// Copyright (c) 2014 LBSFilm. All rights reserved. +// + +#import + +#import "AppDelegate.h" + +int main(int argc, char * argv[]) +{ + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/BeerBoxTests/BeerBoxTests-Info.plist b/BeerBoxTests/BeerBoxTests-Info.plist new file mode 100755 index 0000000..c56255c --- /dev/null +++ b/BeerBoxTests/BeerBoxTests-Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + LBSFilm.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/BeerBoxTests/BeerBoxTests.m b/BeerBoxTests/BeerBoxTests.m new file mode 100755 index 0000000..14acac4 --- /dev/null +++ b/BeerBoxTests/BeerBoxTests.m @@ -0,0 +1,34 @@ +// +// BeerBoxTests.m +// BeerBoxTests +// +// Created by Lukas on 24/07/14. +// Copyright (c) 2014 LBSFilm. All rights reserved. +// + +#import + +@interface BeerBoxTests : XCTestCase + +@end + +@implementation BeerBoxTests + +- (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/BeerBoxTests/en.lproj/InfoPlist.strings b/BeerBoxTests/en.lproj/InfoPlist.strings new file mode 100755 index 0000000..477b28f --- /dev/null +++ b/BeerBoxTests/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ +