Initial commit

This commit is contained in:
Lukas Bachschwell 2015-11-19 22:29:13 +01:00
commit ee6dabccc6
36 changed files with 1990 additions and 0 deletions

542
BeerBox.xcodeproj/project.pbxproj Executable file
View File

@ -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 = "<group>"; };
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 = "<group>"; };
2BBC01981981879400D0BAE0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
2BBC019A1981879400D0BAE0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
2BBC019C1981879400D0BAE0 /* BeerBox-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "BeerBox-Prefix.pch"; sourceTree = "<group>"; };
2BBC019D1981879400D0BAE0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
2BBC019E1981879400D0BAE0 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
2BBC01A61981879400D0BAE0 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
2BBC01A71981879400D0BAE0 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
2BBC01A91981879500D0BAE0 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
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 = "<group>"; };
2BBC01BA1981879500D0BAE0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
2BBC01BC1981879500D0BAE0 /* BeerBoxTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BeerBoxTests.m; sourceTree = "<group>"; };
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 = "<group>"; };
2BBC01CB198187EB00D0BAE0 /* SerialGATT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SerialGATT.h; sourceTree = "<group>"; };
2BC70F0C1BD2242800330A1F /* Icon@2x copy.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon@2x copy.png"; sourceTree = "<group>"; };
2BEEF23F1BD7FAAB00003449 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
/* 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 = "<group>";
};
2BBC018C1981879400D0BAE0 /* Products */ = {
isa = PBXGroup;
children = (
2BBC018B1981879400D0BAE0 /* BeerBox.app */,
2BBC01AF1981879500D0BAE0 /* BeerBoxTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
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 = "<group>";
};
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 = "<group>";
};
2BBC01951981879400D0BAE0 /* Supporting Files */ = {
isa = PBXGroup;
children = (
2BBC01961981879400D0BAE0 /* BeerBox-Info.plist */,
2BBC01971981879400D0BAE0 /* InfoPlist.strings */,
2BBC019A1981879400D0BAE0 /* main.m */,
2BBC019C1981879400D0BAE0 /* BeerBox-Prefix.pch */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
2BBC01B61981879500D0BAE0 /* BeerBoxTests */ = {
isa = PBXGroup;
children = (
2BBC01BC1981879500D0BAE0 /* BeerBoxTests.m */,
2BBC01B71981879500D0BAE0 /* Supporting Files */,
);
path = BeerBoxTests;
sourceTree = "<group>";
};
2BBC01B71981879500D0BAE0 /* Supporting Files */ = {
isa = PBXGroup;
children = (
2BBC01B81981879500D0BAE0 /* BeerBoxTests-Info.plist */,
2BBC01B91981879500D0BAE0 /* InfoPlist.strings */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
2BBC01CD198187F500D0BAE0 /* SerialGATT */ = {
isa = PBXGroup;
children = (
2BBC01CA198187EB00D0BAE0 /* SerialGATT.m */,
2BBC01CB198187EB00D0BAE0 /* SerialGATT.h */,
);
name = SerialGATT;
sourceTree = "<group>";
};
/* 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 = "<group>";
};
2BBC01971981879400D0BAE0 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
2BBC01981981879400D0BAE0 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
2BBC01B91981879500D0BAE0 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
2BBC01BA1981879500D0BAE0 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
/* 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 */;
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:BeerBox.xcodeproj">
</FileRef>
</Workspace>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<Bucket
type = "1"
version = "2.0">
</Bucket>

View File

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2BBC018A1981879400D0BAE0"
BuildableName = "BeerBox.app"
BlueprintName = "BeerBox"
ReferencedContainer = "container:BeerBox.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2BBC01AE1981879500D0BAE0"
BuildableName = "BeerBoxTests.xctest"
BlueprintName = "BeerBoxTests"
ReferencedContainer = "container:BeerBox.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2BBC018A1981879400D0BAE0"
BuildableName = "BeerBox.app"
BlueprintName = "BeerBox"
ReferencedContainer = "container:BeerBox.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2BBC018A1981879400D0BAE0"
BuildableName = "BeerBox.app"
BlueprintName = "BeerBox"
ReferencedContainer = "container:BeerBox.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2BBC018A1981879400D0BAE0"
BuildableName = "BeerBox.app"
BlueprintName = "BeerBox"
ReferencedContainer = "container:BeerBox.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>BeerBox.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>2BBC018A1981879400D0BAE0</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>2BBC01AE1981879500D0BAE0</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>

15
BeerBox/AppDelegate.h Executable file
View File

@ -0,0 +1,15 @@
//
// AppDelegate.h
// BeerBox
//
// Created by Lukas on 24/07/14.
// Copyright (c) 2014 LBSFilm. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end

46
BeerBox/AppDelegate.m Executable file
View File

@ -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

BIN
BeerBox/Base.lproj/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="15A284" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="vXZ-lx-hvc">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="ufC-wZ-h7g">
<objects>
<viewController id="vXZ-lx-hvc" customClass="ViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="wbC-ES-JtF"/>
<viewControllerLayoutGuide type="bottom" id="ODW-V1-bRC"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="RzV-q3-whK">
<rect key="frame" x="20" y="28" width="140" height="30"/>
<animations/>
<state key="normal" title="Connect to BeerBox">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="connect:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="0eN-6F-lZb"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="n2u-Pj-bkX">
<rect key="frame" x="86" y="194" width="149" height="30"/>
<animations/>
<state key="normal" title="Create">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<connections>
<action selector="sendMsgToArduino:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="j24-Kf-P4X"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Create a new User:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gdW-7D-K7k">
<rect key="frame" x="85" y="94" width="146" height="21"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Y0c-XX-now">
<rect key="frame" x="110" y="123" width="97" height="30"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits"/>
<connections>
<action selector="dismiss:" destination="vXZ-lx-hvc" eventType="touchCancel" id="2tJ-ro-nvC"/>
</connections>
</textField>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="I56-eg-l11">
<rect key="frame" x="69" y="223" width="179" height="30"/>
<animations/>
<state key="normal" title="Check one User"/>
<connections>
<action selector="checkCount:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="Yjh-px-8Zf"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="zej-Tp-avG">
<rect key="frame" x="115" y="251" width="92" height="30"/>
<animations/>
<state key="normal" title="Remove User"/>
<connections>
<action selector="removeUser:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="MBp-Ad-5nQ"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="q10-Wt-zCw">
<rect key="frame" x="113" y="365" width="97" height="30"/>
<animations/>
<state key="normal" title="Revoke Finger"/>
<connections>
<action selector="revokeFinger:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="Qoc-9A-pkM"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Ega-iL-c02">
<rect key="frame" x="124" y="284" width="69" height="30"/>
<animations/>
<state key="normal" title="List Users"/>
<connections>
<action selector="listUsers:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="KYv-By-fPM"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6Lh-Ga-6ln">
<rect key="frame" x="100" y="339" width="122" height="30"/>
<animations/>
<state key="normal" title="Revoke RFID Chip"/>
<connections>
<action selector="revokeRFID:" destination="vXZ-lx-hvc" eventType="touchUpInside" id="U06-XH-32h"/>
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="not Connected" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8HX-K5-jdU">
<rect key="frame" x="186" y="32" width="114" height="21"/>
<animations/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/>
<connections>
<outlet property="nameEntry" destination="Y0c-XX-now" id="LPs-Of-h1P"/>
<outlet property="status" destination="8HX-K5-jdU" id="MwC-mW-kXG"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="437" y="389"/>
</scene>
</scenes>
</document>

55
BeerBox/BeerBox-Info.plist Executable file
View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>LBSFilm.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
<string>bluetooth-central</string>
<string>external-accessory</string>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main_iPhone</string>
<key>UIMainStoryboardFile~ipad</key>
<string>Main_iPad</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

16
BeerBox/BeerBox-Prefix.pch Executable file
View File

@ -0,0 +1,16 @@
//
// Prefix header
//
// The contents of this file are implicitly included at the beginning of every source file.
//
#import <Availability.h>
#ifndef __IPHONE_5_0
#warning "This project uses features only available in iOS SDK 5.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif

BIN
BeerBox/Icon@2x copy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

@ -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"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@ -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"
}
}

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="15A284" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>

59
BeerBox/SerialGATT.h Executable file
View File

@ -0,0 +1,59 @@
//
// SerialGATT.h
// HMSoft
//
// Created by HMSofts on 7/13/12.
// Copyright (c) 2012 jnhuamao.cn. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreBluetooth/CoreBluetooth.h>
#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<CBCentralManagerDelegate, CBPeripheralDelegate> {
}
@property (nonatomic, assign) id <BTSmartSensorDelegate> 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

541
BeerBox/SerialGATT.m Executable file
View File

@ -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

32
BeerBox/ViewController.h Executable file
View File

@ -0,0 +1,32 @@
//
// ViewController.h
// BeerBox
//
// Created by Lukas on 24/07/14.
// Copyright (c) 2014 LBSFilm. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "SerialGATT.h"
@interface ViewController : UIViewController<BTSmartSensorDelegate, UITextFieldDelegate>
@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

188
BeerBox/ViewController.m Executable file
View File

@ -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

View File

@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */

18
BeerBox/main.m Executable file
View File

@ -0,0 +1,18 @@
//
// main.m
// BeerBox
//
// Created by Lukas on 24/07/14.
// Copyright (c) 2014 LBSFilm. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "AppDelegate.h"
int main(int argc, char * argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>LBSFilm.${PRODUCT_NAME:rfc1034identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

34
BeerBoxTests/BeerBoxTests.m Executable file
View File

@ -0,0 +1,34 @@
//
// BeerBoxTests.m
// BeerBoxTests
//
// Created by Lukas on 24/07/14.
// Copyright (c) 2014 LBSFilm. All rights reserved.
//
#import <XCTest/XCTest.h>
@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

View File

@ -0,0 +1,2 @@
/* Localized versions of Info.plist keys */