├── .gitignore ├── BLETemperatureReader ├── BLETemperatureReader.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata ├── BLETemperatureReader │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ ├── LaunchScreen.xib │ │ └── Main.storyboard │ ├── Constants.h │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-29@2x.png │ │ │ ├── Icon-29@3x.png │ │ │ ├── Icon-40@2x.png │ │ │ ├── Icon-40@3x.png │ │ │ ├── Icon-60@2x.png │ │ │ └── Icon-60@3x.png │ │ ├── Contents.json │ │ ├── temp-10.imageset │ │ │ ├── 10s.png │ │ │ ├── 10s@2x.png │ │ │ ├── 10s@3x.png │ │ │ └── Contents.json │ │ ├── temp-100.imageset │ │ │ ├── 100s.png │ │ │ ├── 100s@2x.png │ │ │ ├── 100s@3x.png │ │ │ └── Contents.json │ │ ├── temp-20.imageset │ │ │ ├── 20s.png │ │ │ ├── 20s@2x.png │ │ │ ├── 20s@3x.png │ │ │ └── Contents.json │ │ ├── temp-30.imageset │ │ │ ├── 30s.png │ │ │ ├── 30s@2x.png │ │ │ ├── 30s@3x.png │ │ │ └── Contents.json │ │ ├── temp-40.imageset │ │ │ ├── 40s.png │ │ │ ├── 40s@2x.png │ │ │ ├── 40s@3x.png │ │ │ └── Contents.json │ │ ├── temp-50.imageset │ │ │ ├── 50s.png │ │ │ ├── 50s@2x.png │ │ │ ├── 50s@3x.png │ │ │ └── Contents.json │ │ ├── temp-60.imageset │ │ │ ├── 60s.png │ │ │ ├── 60s@2x.png │ │ │ ├── 60s@3x.png │ │ │ └── Contents.json │ │ ├── temp-70.imageset │ │ │ ├── 70s.png │ │ │ ├── 70s@2x.png │ │ │ ├── 70s@3x.png │ │ │ └── Contents.json │ │ ├── temp-80.imageset │ │ │ ├── 80s.png │ │ │ ├── 80s@2x.png │ │ │ ├── 80s@3x.png │ │ │ └── Contents.json │ │ └── temp-90.imageset │ │ │ ├── 90s.png │ │ │ ├── 90s@2x.png │ │ │ ├── 90s@3x.png │ │ │ └── Contents.json │ ├── Images │ │ └── sea-sky-beach-holiday.jpg │ ├── Info.plist │ ├── TemperatureViewController.h │ ├── TemperatureViewController.m │ └── main.m └── BLETemperatureReaderTests │ ├── BLETemperatureReaderTests.m │ └── Info.plist └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | build/ 4 | *.pbxuser 5 | !default.pbxuser 6 | *.mode1v3 7 | !default.mode1v3 8 | *.mode2v3 9 | !default.mode2v3 10 | *.perspectivev3 11 | !default.perspectivev3 12 | xcuserdata 13 | *.xccheckout 14 | *.moved-aside 15 | DerivedData 16 | *.hmap 17 | *.ipa 18 | *.xcuserstate 19 | 20 | # CocoaPods 21 | # 22 | # We recommend against adding the Pods directory to your .gitignore. However 23 | # you should judge for yourself, the pros and cons are mentioned at: 24 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 25 | # 26 | #Pods/ 27 | -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | C870EF1D1B754467004E3C59 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C870EF1C1B754467004E3C59 /* main.m */; }; 11 | C870EF201B754467004E3C59 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C870EF1F1B754467004E3C59 /* AppDelegate.m */; }; 12 | C870EF261B754467004E3C59 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C870EF241B754467004E3C59 /* Main.storyboard */; }; 13 | C870EF281B754467004E3C59 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C870EF271B754467004E3C59 /* Images.xcassets */; }; 14 | C870EF2B1B754467004E3C59 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C870EF291B754467004E3C59 /* LaunchScreen.xib */; }; 15 | C870EF371B754467004E3C59 /* BLETemperatureReaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C870EF361B754467004E3C59 /* BLETemperatureReaderTests.m */; }; 16 | C870EF421B7554D6004E3C59 /* TemperatureViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C870EF411B7554D6004E3C59 /* TemperatureViewController.m */; }; 17 | C870EF4A1B75561E004E3C59 /* CoreBluetooth.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C870EF491B75561E004E3C59 /* CoreBluetooth.framework */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXContainerItemProxy section */ 21 | C870EF311B754467004E3C59 /* PBXContainerItemProxy */ = { 22 | isa = PBXContainerItemProxy; 23 | containerPortal = C870EF0F1B754467004E3C59 /* Project object */; 24 | proxyType = 1; 25 | remoteGlobalIDString = C870EF161B754467004E3C59; 26 | remoteInfo = BLETemperatureReader; 27 | }; 28 | /* End PBXContainerItemProxy section */ 29 | 30 | /* Begin PBXFileReference section */ 31 | C870EF171B754467004E3C59 /* BLETemperatureReader.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BLETemperatureReader.app; sourceTree = BUILT_PRODUCTS_DIR; }; 32 | C870EF1B1B754467004E3C59 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 33 | C870EF1C1B754467004E3C59 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 34 | C870EF1E1B754467004E3C59 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 35 | C870EF1F1B754467004E3C59 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 36 | C870EF251B754467004E3C59 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 37 | C870EF271B754467004E3C59 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 38 | C870EF2A1B754467004E3C59 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; 39 | C870EF301B754467004E3C59 /* BLETemperatureReaderTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BLETemperatureReaderTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | C870EF351B754467004E3C59 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 41 | C870EF361B754467004E3C59 /* BLETemperatureReaderTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BLETemperatureReaderTests.m; sourceTree = ""; }; 42 | C870EF401B7554D6004E3C59 /* TemperatureViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TemperatureViewController.h; sourceTree = ""; }; 43 | C870EF411B7554D6004E3C59 /* TemperatureViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = TemperatureViewController.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 44 | C870EF491B75561E004E3C59 /* CoreBluetooth.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreBluetooth.framework; path = System/Library/Frameworks/CoreBluetooth.framework; sourceTree = SDKROOT; }; 45 | C870EF4B1B756D18004E3C59 /* Constants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = Constants.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 46 | /* End PBXFileReference section */ 47 | 48 | /* Begin PBXFrameworksBuildPhase section */ 49 | C870EF141B754467004E3C59 /* Frameworks */ = { 50 | isa = PBXFrameworksBuildPhase; 51 | buildActionMask = 2147483647; 52 | files = ( 53 | C870EF4A1B75561E004E3C59 /* CoreBluetooth.framework in Frameworks */, 54 | ); 55 | runOnlyForDeploymentPostprocessing = 0; 56 | }; 57 | C870EF2D1B754467004E3C59 /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | ); 62 | runOnlyForDeploymentPostprocessing = 0; 63 | }; 64 | /* End PBXFrameworksBuildPhase section */ 65 | 66 | /* Begin PBXGroup section */ 67 | C844FD041BB2139300905C7F /* Frameworks */ = { 68 | isa = PBXGroup; 69 | children = ( 70 | C870EF491B75561E004E3C59 /* CoreBluetooth.framework */, 71 | ); 72 | name = Frameworks; 73 | sourceTree = ""; 74 | }; 75 | C870EF0E1B754467004E3C59 = { 76 | isa = PBXGroup; 77 | children = ( 78 | C870EF191B754467004E3C59 /* BLETemperatureReader */, 79 | C870EF331B754467004E3C59 /* BLETemperatureReaderTests */, 80 | C844FD041BB2139300905C7F /* Frameworks */, 81 | C870EF181B754467004E3C59 /* Products */, 82 | ); 83 | sourceTree = ""; 84 | }; 85 | C870EF181B754467004E3C59 /* Products */ = { 86 | isa = PBXGroup; 87 | children = ( 88 | C870EF171B754467004E3C59 /* BLETemperatureReader.app */, 89 | C870EF301B754467004E3C59 /* BLETemperatureReaderTests.xctest */, 90 | ); 91 | name = Products; 92 | sourceTree = ""; 93 | }; 94 | C870EF191B754467004E3C59 /* BLETemperatureReader */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | C870EF4B1B756D18004E3C59 /* Constants.h */, 98 | C870EF1E1B754467004E3C59 /* AppDelegate.h */, 99 | C870EF1F1B754467004E3C59 /* AppDelegate.m */, 100 | C870EF401B7554D6004E3C59 /* TemperatureViewController.h */, 101 | C870EF411B7554D6004E3C59 /* TemperatureViewController.m */, 102 | C870EF241B754467004E3C59 /* Main.storyboard */, 103 | C870EF291B754467004E3C59 /* LaunchScreen.xib */, 104 | C870EF271B754467004E3C59 /* Images.xcassets */, 105 | C870EF1A1B754467004E3C59 /* Supporting Files */, 106 | ); 107 | path = BLETemperatureReader; 108 | sourceTree = ""; 109 | }; 110 | C870EF1A1B754467004E3C59 /* Supporting Files */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | C870EF1B1B754467004E3C59 /* Info.plist */, 114 | C870EF1C1B754467004E3C59 /* main.m */, 115 | ); 116 | name = "Supporting Files"; 117 | sourceTree = ""; 118 | }; 119 | C870EF331B754467004E3C59 /* BLETemperatureReaderTests */ = { 120 | isa = PBXGroup; 121 | children = ( 122 | C870EF361B754467004E3C59 /* BLETemperatureReaderTests.m */, 123 | C870EF341B754467004E3C59 /* Supporting Files */, 124 | ); 125 | path = BLETemperatureReaderTests; 126 | sourceTree = ""; 127 | }; 128 | C870EF341B754467004E3C59 /* Supporting Files */ = { 129 | isa = PBXGroup; 130 | children = ( 131 | C870EF351B754467004E3C59 /* Info.plist */, 132 | ); 133 | name = "Supporting Files"; 134 | sourceTree = ""; 135 | }; 136 | /* End PBXGroup section */ 137 | 138 | /* Begin PBXNativeTarget section */ 139 | C870EF161B754467004E3C59 /* BLETemperatureReader */ = { 140 | isa = PBXNativeTarget; 141 | buildConfigurationList = C870EF3A1B754467004E3C59 /* Build configuration list for PBXNativeTarget "BLETemperatureReader" */; 142 | buildPhases = ( 143 | C870EF131B754467004E3C59 /* Sources */, 144 | C870EF141B754467004E3C59 /* Frameworks */, 145 | C870EF151B754467004E3C59 /* Resources */, 146 | ); 147 | buildRules = ( 148 | ); 149 | dependencies = ( 150 | ); 151 | name = BLETemperatureReader; 152 | productName = BLETemperatureReader; 153 | productReference = C870EF171B754467004E3C59 /* BLETemperatureReader.app */; 154 | productType = "com.apple.product-type.application"; 155 | }; 156 | C870EF2F1B754467004E3C59 /* BLETemperatureReaderTests */ = { 157 | isa = PBXNativeTarget; 158 | buildConfigurationList = C870EF3D1B754467004E3C59 /* Build configuration list for PBXNativeTarget "BLETemperatureReaderTests" */; 159 | buildPhases = ( 160 | C870EF2C1B754467004E3C59 /* Sources */, 161 | C870EF2D1B754467004E3C59 /* Frameworks */, 162 | C870EF2E1B754467004E3C59 /* Resources */, 163 | ); 164 | buildRules = ( 165 | ); 166 | dependencies = ( 167 | C870EF321B754467004E3C59 /* PBXTargetDependency */, 168 | ); 169 | name = BLETemperatureReaderTests; 170 | productName = BLETemperatureReaderTests; 171 | productReference = C870EF301B754467004E3C59 /* BLETemperatureReaderTests.xctest */; 172 | productType = "com.apple.product-type.bundle.unit-test"; 173 | }; 174 | /* End PBXNativeTarget section */ 175 | 176 | /* Begin PBXProject section */ 177 | C870EF0F1B754467004E3C59 /* Project object */ = { 178 | isa = PBXProject; 179 | attributes = { 180 | LastUpgradeCheck = 0640; 181 | ORGANIZATIONNAME = "Cloud City"; 182 | TargetAttributes = { 183 | C870EF161B754467004E3C59 = { 184 | CreatedOnToolsVersion = 6.4; 185 | }; 186 | C870EF2F1B754467004E3C59 = { 187 | CreatedOnToolsVersion = 6.4; 188 | TestTargetID = C870EF161B754467004E3C59; 189 | }; 190 | }; 191 | }; 192 | buildConfigurationList = C870EF121B754467004E3C59 /* Build configuration list for PBXProject "BLETemperatureReader" */; 193 | compatibilityVersion = "Xcode 3.2"; 194 | developmentRegion = English; 195 | hasScannedForEncodings = 0; 196 | knownRegions = ( 197 | en, 198 | Base, 199 | ); 200 | mainGroup = C870EF0E1B754467004E3C59; 201 | productRefGroup = C870EF181B754467004E3C59 /* Products */; 202 | projectDirPath = ""; 203 | projectRoot = ""; 204 | targets = ( 205 | C870EF161B754467004E3C59 /* BLETemperatureReader */, 206 | C870EF2F1B754467004E3C59 /* BLETemperatureReaderTests */, 207 | ); 208 | }; 209 | /* End PBXProject section */ 210 | 211 | /* Begin PBXResourcesBuildPhase section */ 212 | C870EF151B754467004E3C59 /* Resources */ = { 213 | isa = PBXResourcesBuildPhase; 214 | buildActionMask = 2147483647; 215 | files = ( 216 | C870EF261B754467004E3C59 /* Main.storyboard in Resources */, 217 | C870EF2B1B754467004E3C59 /* LaunchScreen.xib in Resources */, 218 | C870EF281B754467004E3C59 /* Images.xcassets in Resources */, 219 | ); 220 | runOnlyForDeploymentPostprocessing = 0; 221 | }; 222 | C870EF2E1B754467004E3C59 /* Resources */ = { 223 | isa = PBXResourcesBuildPhase; 224 | buildActionMask = 2147483647; 225 | files = ( 226 | ); 227 | runOnlyForDeploymentPostprocessing = 0; 228 | }; 229 | /* End PBXResourcesBuildPhase section */ 230 | 231 | /* Begin PBXSourcesBuildPhase section */ 232 | C870EF131B754467004E3C59 /* Sources */ = { 233 | isa = PBXSourcesBuildPhase; 234 | buildActionMask = 2147483647; 235 | files = ( 236 | C870EF201B754467004E3C59 /* AppDelegate.m in Sources */, 237 | C870EF1D1B754467004E3C59 /* main.m in Sources */, 238 | C870EF421B7554D6004E3C59 /* TemperatureViewController.m in Sources */, 239 | ); 240 | runOnlyForDeploymentPostprocessing = 0; 241 | }; 242 | C870EF2C1B754467004E3C59 /* Sources */ = { 243 | isa = PBXSourcesBuildPhase; 244 | buildActionMask = 2147483647; 245 | files = ( 246 | C870EF371B754467004E3C59 /* BLETemperatureReaderTests.m in Sources */, 247 | ); 248 | runOnlyForDeploymentPostprocessing = 0; 249 | }; 250 | /* End PBXSourcesBuildPhase section */ 251 | 252 | /* Begin PBXTargetDependency section */ 253 | C870EF321B754467004E3C59 /* PBXTargetDependency */ = { 254 | isa = PBXTargetDependency; 255 | target = C870EF161B754467004E3C59 /* BLETemperatureReader */; 256 | targetProxy = C870EF311B754467004E3C59 /* PBXContainerItemProxy */; 257 | }; 258 | /* End PBXTargetDependency section */ 259 | 260 | /* Begin PBXVariantGroup section */ 261 | C870EF241B754467004E3C59 /* Main.storyboard */ = { 262 | isa = PBXVariantGroup; 263 | children = ( 264 | C870EF251B754467004E3C59 /* Base */, 265 | ); 266 | name = Main.storyboard; 267 | sourceTree = ""; 268 | }; 269 | C870EF291B754467004E3C59 /* LaunchScreen.xib */ = { 270 | isa = PBXVariantGroup; 271 | children = ( 272 | C870EF2A1B754467004E3C59 /* Base */, 273 | ); 274 | name = LaunchScreen.xib; 275 | sourceTree = ""; 276 | }; 277 | /* End PBXVariantGroup section */ 278 | 279 | /* Begin XCBuildConfiguration section */ 280 | C870EF381B754467004E3C59 /* Debug */ = { 281 | isa = XCBuildConfiguration; 282 | buildSettings = { 283 | ALWAYS_SEARCH_USER_PATHS = NO; 284 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 285 | CLANG_CXX_LIBRARY = "libc++"; 286 | CLANG_ENABLE_MODULES = YES; 287 | CLANG_ENABLE_OBJC_ARC = YES; 288 | CLANG_WARN_BOOL_CONVERSION = YES; 289 | CLANG_WARN_CONSTANT_CONVERSION = YES; 290 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 291 | CLANG_WARN_EMPTY_BODY = YES; 292 | CLANG_WARN_ENUM_CONVERSION = YES; 293 | CLANG_WARN_INT_CONVERSION = YES; 294 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 295 | CLANG_WARN_UNREACHABLE_CODE = YES; 296 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 297 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 298 | COPY_PHASE_STRIP = NO; 299 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 300 | ENABLE_STRICT_OBJC_MSGSEND = YES; 301 | GCC_C_LANGUAGE_STANDARD = gnu99; 302 | GCC_DYNAMIC_NO_PIC = NO; 303 | GCC_NO_COMMON_BLOCKS = YES; 304 | GCC_OPTIMIZATION_LEVEL = 0; 305 | GCC_PREPROCESSOR_DEFINITIONS = ( 306 | "DEBUG=1", 307 | "$(inherited)", 308 | ); 309 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 310 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 311 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 312 | GCC_WARN_UNDECLARED_SELECTOR = YES; 313 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 314 | GCC_WARN_UNUSED_FUNCTION = YES; 315 | GCC_WARN_UNUSED_VARIABLE = YES; 316 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 317 | MTL_ENABLE_DEBUG_INFO = YES; 318 | ONLY_ACTIVE_ARCH = YES; 319 | SDKROOT = iphoneos; 320 | }; 321 | name = Debug; 322 | }; 323 | C870EF391B754467004E3C59 /* Release */ = { 324 | isa = XCBuildConfiguration; 325 | buildSettings = { 326 | ALWAYS_SEARCH_USER_PATHS = NO; 327 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 328 | CLANG_CXX_LIBRARY = "libc++"; 329 | CLANG_ENABLE_MODULES = YES; 330 | CLANG_ENABLE_OBJC_ARC = YES; 331 | CLANG_WARN_BOOL_CONVERSION = YES; 332 | CLANG_WARN_CONSTANT_CONVERSION = YES; 333 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 334 | CLANG_WARN_EMPTY_BODY = YES; 335 | CLANG_WARN_ENUM_CONVERSION = YES; 336 | CLANG_WARN_INT_CONVERSION = YES; 337 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 338 | CLANG_WARN_UNREACHABLE_CODE = YES; 339 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 340 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 341 | COPY_PHASE_STRIP = NO; 342 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 343 | ENABLE_NS_ASSERTIONS = NO; 344 | ENABLE_STRICT_OBJC_MSGSEND = YES; 345 | GCC_C_LANGUAGE_STANDARD = gnu99; 346 | GCC_NO_COMMON_BLOCKS = YES; 347 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 348 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 349 | GCC_WARN_UNDECLARED_SELECTOR = YES; 350 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 351 | GCC_WARN_UNUSED_FUNCTION = YES; 352 | GCC_WARN_UNUSED_VARIABLE = YES; 353 | IPHONEOS_DEPLOYMENT_TARGET = 8.4; 354 | MTL_ENABLE_DEBUG_INFO = NO; 355 | SDKROOT = iphoneos; 356 | VALIDATE_PRODUCT = YES; 357 | }; 358 | name = Release; 359 | }; 360 | C870EF3B1B754467004E3C59 /* Debug */ = { 361 | isa = XCBuildConfiguration; 362 | buildSettings = { 363 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 364 | INFOPLIST_FILE = BLETemperatureReader/Info.plist; 365 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 366 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 367 | PRODUCT_BUNDLE_IDENTIFIER = io.cloudcity.BLETemperatureReader; 368 | PRODUCT_NAME = "$(TARGET_NAME)"; 369 | }; 370 | name = Debug; 371 | }; 372 | C870EF3C1B754467004E3C59 /* Release */ = { 373 | isa = XCBuildConfiguration; 374 | buildSettings = { 375 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 376 | INFOPLIST_FILE = BLETemperatureReader/Info.plist; 377 | IPHONEOS_DEPLOYMENT_TARGET = 8.1; 378 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 379 | PRODUCT_BUNDLE_IDENTIFIER = io.cloudcity.BLETemperatureReader; 380 | PRODUCT_NAME = "$(TARGET_NAME)"; 381 | }; 382 | name = Release; 383 | }; 384 | C870EF3E1B754467004E3C59 /* Debug */ = { 385 | isa = XCBuildConfiguration; 386 | buildSettings = { 387 | BUNDLE_LOADER = "$(TEST_HOST)"; 388 | FRAMEWORK_SEARCH_PATHS = ( 389 | "$(SDKROOT)/Developer/Library/Frameworks", 390 | "$(inherited)", 391 | ); 392 | GCC_PREPROCESSOR_DEFINITIONS = ( 393 | "DEBUG=1", 394 | "$(inherited)", 395 | ); 396 | INFOPLIST_FILE = BLETemperatureReaderTests/Info.plist; 397 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 398 | PRODUCT_NAME = "$(TARGET_NAME)"; 399 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/BLETemperatureReader.app/BLETemperatureReader"; 400 | }; 401 | name = Debug; 402 | }; 403 | C870EF3F1B754467004E3C59 /* Release */ = { 404 | isa = XCBuildConfiguration; 405 | buildSettings = { 406 | BUNDLE_LOADER = "$(TEST_HOST)"; 407 | FRAMEWORK_SEARCH_PATHS = ( 408 | "$(SDKROOT)/Developer/Library/Frameworks", 409 | "$(inherited)", 410 | ); 411 | INFOPLIST_FILE = BLETemperatureReaderTests/Info.plist; 412 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; 413 | PRODUCT_NAME = "$(TARGET_NAME)"; 414 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/BLETemperatureReader.app/BLETemperatureReader"; 415 | }; 416 | name = Release; 417 | }; 418 | /* End XCBuildConfiguration section */ 419 | 420 | /* Begin XCConfigurationList section */ 421 | C870EF121B754467004E3C59 /* Build configuration list for PBXProject "BLETemperatureReader" */ = { 422 | isa = XCConfigurationList; 423 | buildConfigurations = ( 424 | C870EF381B754467004E3C59 /* Debug */, 425 | C870EF391B754467004E3C59 /* Release */, 426 | ); 427 | defaultConfigurationIsVisible = 0; 428 | defaultConfigurationName = Release; 429 | }; 430 | C870EF3A1B754467004E3C59 /* Build configuration list for PBXNativeTarget "BLETemperatureReader" */ = { 431 | isa = XCConfigurationList; 432 | buildConfigurations = ( 433 | C870EF3B1B754467004E3C59 /* Debug */, 434 | C870EF3C1B754467004E3C59 /* Release */, 435 | ); 436 | defaultConfigurationIsVisible = 0; 437 | defaultConfigurationName = Release; 438 | }; 439 | C870EF3D1B754467004E3C59 /* Build configuration list for PBXNativeTarget "BLETemperatureReaderTests" */ = { 440 | isa = XCConfigurationList; 441 | buildConfigurations = ( 442 | C870EF3E1B754467004E3C59 /* Debug */, 443 | C870EF3F1B754467004E3C59 /* Release */, 444 | ); 445 | defaultConfigurationIsVisible = 0; 446 | defaultConfigurationName = Release; 447 | }; 448 | /* End XCConfigurationList section */ 449 | }; 450 | rootObject = C870EF0F1B754467004E3C59 /* Project object */; 451 | } 452 | -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // BLETemperatureReader 4 | // 5 | // Created by Evan Stone on 8/7/15. 6 | // Copyright (c) 2015 Cloud City. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // BLETemperatureReader 4 | // 5 | // Created by Evan Stone on 8/7/15. 6 | // Copyright (c) 2015 Cloud City. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // 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. 25 | // 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. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // 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. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // 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. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // 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. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 47 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Constants.h: -------------------------------------------------------------------------------- 1 | // 2 | // Constants.h 3 | // BLETemperatureReader 4 | // 5 | // Created by Evan Stone on 8/7/15. 6 | // Copyright (c) 2015 Cloud City. All rights reserved. 7 | // 8 | 9 | #ifndef BLETemperatureReader_Constants_h 10 | #define BLETemperatureReader_Constants_h 11 | 12 | //------------------------------------------------------------------------ 13 | // Information about Texas Instruments SensorTag UUIDs can be found at: 14 | // http://processors.wiki.ti.com/index.php/SensorTag_User_Guide#Sensors 15 | //------------------------------------------------------------------------ 16 | // Per the TI documentation: 17 | // The TI Base 128-bit UUID is: F0000000-0451-4000-B000-000000000000. 18 | // 19 | // All sensor services use 128-bit UUIDs, but for practical reasons only 20 | // the 16-bit part is listed in this document. 21 | // 22 | // It is embedded in the 128-bit UUID as shown by example below. 23 | // 24 | // Base 128-bit UUID: F0000000-0451-4000-B000-000000000000 25 | // "0xAA01" maps as: F000AA01-0451-4000-B000-000000000000 26 | // ^--^ 27 | //------------------------------------------------------------------------ 28 | 29 | // Temp UUIDs 30 | #define UUID_TEMPERATURE_SERVICE @"F000AA00-0451-4000-B000-000000000000" 31 | #define UUID_TEMPERATURE_DATA @"F000AA01-0451-4000-B000-000000000000" 32 | #define UUID_TEMPERATURE_CONFIG @"F000AA02-0451-4000-B000-000000000000" 33 | 34 | // Humidity 35 | #define UUID_HUMIDITY_SERVICE @"F000AA20-0451-4000-B000-000000000000" 36 | #define UUID_HUMIDITY_DATA @"F000AA21-0451-4000-B000-000000000000" 37 | #define UUID_HUMIDITY_CONFIG @"F000AA22-0451-4000-B000-000000000000" 38 | 39 | 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "29x29", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-29@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "29x29", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-29@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "40x40", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-40@2x.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "40x40", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-40@3x.png", 25 | "scale" : "3x" 26 | }, 27 | { 28 | "size" : "60x60", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-60@2x.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "size" : "60x60", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-60@3x.png", 37 | "scale" : "3x" 38 | } 39 | ], 40 | "info" : { 41 | "version" : 1, 42 | "author" : "xcode" 43 | } 44 | } -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/AppIcon.appiconset/Icon-29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/AppIcon.appiconset/Icon-29@2x.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/AppIcon.appiconset/Icon-29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/AppIcon.appiconset/Icon-29@3x.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/AppIcon.appiconset/Icon-40@2x.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/AppIcon.appiconset/Icon-40@3x.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-10.imageset/10s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-10.imageset/10s.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-10.imageset/10s@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-10.imageset/10s@2x.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-10.imageset/10s@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-10.imageset/10s@3x.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-10.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "10s.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "10s@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "10s@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-100.imageset/100s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-100.imageset/100s.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-100.imageset/100s@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-100.imageset/100s@2x.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-100.imageset/100s@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-100.imageset/100s@3x.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-100.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "100s.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "100s@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "100s@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-20.imageset/20s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-20.imageset/20s.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-20.imageset/20s@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-20.imageset/20s@2x.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-20.imageset/20s@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-20.imageset/20s@3x.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-20.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "20s.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "20s@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "20s@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-30.imageset/30s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-30.imageset/30s.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-30.imageset/30s@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-30.imageset/30s@2x.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-30.imageset/30s@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-30.imageset/30s@3x.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-30.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "30s.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "30s@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "30s@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-40.imageset/40s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-40.imageset/40s.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-40.imageset/40s@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-40.imageset/40s@2x.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-40.imageset/40s@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-40.imageset/40s@3x.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-40.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "40s.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "40s@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "40s@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-50.imageset/50s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-50.imageset/50s.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-50.imageset/50s@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-50.imageset/50s@2x.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-50.imageset/50s@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-50.imageset/50s@3x.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-50.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "50s.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "50s@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "50s@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-60.imageset/60s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-60.imageset/60s.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-60.imageset/60s@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-60.imageset/60s@2x.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-60.imageset/60s@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-60.imageset/60s@3x.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-60.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "60s.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "60s@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "60s@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-70.imageset/70s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-70.imageset/70s.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-70.imageset/70s@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-70.imageset/70s@2x.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-70.imageset/70s@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-70.imageset/70s@3x.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-70.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "70s.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "70s@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "70s@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-80.imageset/80s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-80.imageset/80s.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-80.imageset/80s@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-80.imageset/80s@2x.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-80.imageset/80s@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-80.imageset/80s@3x.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-80.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "80s.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "80s@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "80s@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-90.imageset/90s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-90.imageset/90s.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-90.imageset/90s@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-90.imageset/90s@2x.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-90.imageset/90s@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-90.imageset/90s@3x.png -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images.xcassets/temp-90.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "90s.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "90s@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "90s@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Images/sea-sky-beach-holiday.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cloudcity/ZeroToBLE-Part2/8ef12f10fe172193a01876467f9a79c10c5dfc18/BLETemperatureReader/BLETemperatureReader/Images/sea-sky-beach-holiday.jpg -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | CFBundleDisplayName 30 | BLE Temp 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/TemperatureViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // TemperatureViewController.h 3 | // BLETemperatureReader 4 | // 5 | // Created by Evan Stone on 8/7/15. 6 | // Copyright (c) 2015 Cloud City. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TemperatureViewController : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/TemperatureViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // TemperatureViewController.m 3 | // BLETemperatureReader 4 | // 5 | // Created by Evan Stone on 8/7/15. 6 | // Copyright (c) 2015 Cloud City. All rights reserved. 7 | // 8 | 9 | #import "TemperatureViewController.h" 10 | #import 11 | #import "Constants.h" 12 | 13 | #define TIMER_PAUSE_INTERVAL 10.0 14 | #define TIMER_SCAN_INTERVAL 2.0 15 | 16 | #define SENSOR_DATA_INDEX_TEMP_INFRARED 0 17 | #define SENSOR_DATA_INDEX_TEMP_AMBIENT 1 18 | #define SENSOR_DATA_INDEX_HUMIDITY_TEMP 0 19 | #define SENSOR_DATA_INDEX_HUMIDITY 1 20 | 21 | // This could be simplified to "SensorTag" and check if it's a substring... 22 | #define SENSOR_TAG_NAME @"CC2650 SensorTag" 23 | 24 | 25 | @interface TemperatureViewController () 26 | 27 | // Properties for Background Swapping 28 | @property (weak, nonatomic) IBOutlet UIImageView *backgroundImageView1; 29 | @property (weak, nonatomic) IBOutlet UIImageView *backgroundImageView2; 30 | @property (nonatomic, strong) NSArray *backgroundImageViews; 31 | @property (nonatomic, assign) NSInteger visibleBackgroundIndex; 32 | @property (nonatomic, assign) NSInteger invisibleBackgroundIndex; 33 | @property (nonatomic, assign) NSInteger lastTemperatureTens; 34 | 35 | @property (weak, nonatomic) IBOutlet UIView *controlContainerView; 36 | @property (weak, nonatomic) IBOutlet UIView *circleView; 37 | @property (weak, nonatomic) IBOutlet UILabel *captionLabel; 38 | @property (weak, nonatomic) IBOutlet UILabel *temperatureLabel; 39 | @property (weak, nonatomic) IBOutlet UILabel *humidityLabel; 40 | 41 | @property (nonatomic, strong) CBCentralManager *centralManager; 42 | @property (nonatomic, strong) CBPeripheral *sensorTag; 43 | @property (nonatomic, assign) BOOL keepScanning; 44 | 45 | @end 46 | 47 | @implementation TemperatureViewController { 48 | BOOL circleDrawn; 49 | } 50 | 51 | - (void)viewDidLoad { 52 | [super viewDidLoad]; 53 | // Create the CBCentralManager. 54 | // NOTE: Creating the CBCentralManager with initWithDelegate will immediately call centralManagerDidUpdateState. 55 | self.centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil options:nil]; 56 | 57 | // configure our initial UI 58 | self.captionLabel.hidden = YES; 59 | self.temperatureLabel.font = [UIFont fontWithName:@"HelveticaNeue-Thin" size:56]; 60 | self.temperatureLabel.text = @"Searching"; 61 | self.humidityLabel.text = @""; 62 | 63 | circleDrawn = NO; 64 | self.circleView.hidden = YES; 65 | self.lastTemperatureTens = 0; 66 | self.visibleBackgroundIndex = 0; 67 | self.invisibleBackgroundIndex = 1; 68 | self.backgroundImageViews = [NSArray arrayWithObjects:self.backgroundImageView1, self.backgroundImageView2, nil]; 69 | [self.view bringSubviewToFront:(UIView *)self.backgroundImageViews[self.visibleBackgroundIndex]]; 70 | ((UIView *)self.backgroundImageViews[self.visibleBackgroundIndex]).alpha = 1; 71 | ((UIView *)self.backgroundImageViews[self.invisibleBackgroundIndex]).alpha = 0; 72 | [self.view bringSubviewToFront:self.controlContainerView]; 73 | } 74 | 75 | - (void)pauseScan { 76 | // Scanning uses up battery on phone, so pause the scan process for the designated interval. 77 | NSLog(@"*** PAUSING SCAN..."); 78 | [NSTimer scheduledTimerWithTimeInterval:TIMER_PAUSE_INTERVAL target:self selector:@selector(resumeScan) userInfo:nil repeats:NO]; 79 | [self.centralManager stopScan]; 80 | } 81 | 82 | - (void)resumeScan { 83 | if (self.keepScanning) { 84 | // Start scanning again... 85 | NSLog(@"*** RESUMING SCAN!"); 86 | [NSTimer scheduledTimerWithTimeInterval:TIMER_SCAN_INTERVAL target:self selector:@selector(pauseScan) userInfo:nil repeats:NO]; 87 | [self.centralManager scanForPeripheralsWithServices:nil options:nil]; 88 | } 89 | } 90 | 91 | - (void)cleanup { 92 | [_centralManager cancelPeripheralConnection:self.sensorTag]; 93 | } 94 | 95 | 96 | #pragma mark - Updating UI 97 | 98 | - (void)displayTemperature:(NSData *)dataBytes { 99 | if (!circleDrawn) { 100 | [self drawCircle]; 101 | } 102 | 103 | // get the data's length - divide by two since we're creating an array that holds 16-bit (two-byte) values... 104 | NSUInteger dataLength = dataBytes.length / 2; 105 | 106 | // create an array to contain the 16-bit values 107 | uint16_t dataArray[dataLength]; 108 | for (int i = 0; i < dataLength; i++) { 109 | dataArray[i] = 0; 110 | } 111 | 112 | // extract the data from the dataBytes object 113 | [dataBytes getBytes:&dataArray length:dataLength * sizeof(uint16_t)]; 114 | uint16_t rawAmbientTemp = dataArray[SENSOR_DATA_INDEX_TEMP_AMBIENT]; 115 | 116 | // get the ambient temperature 117 | double ambientTempC = ((double)rawAmbientTemp)/128; 118 | double ambientTempF = [self fahrenheitFromCelsius:ambientTempC]; 119 | NSLog(@"*** AMBIENT TEMPERATURE SENSOR (C/F): 2.0%f/2.0%f", ambientTempC, ambientTempF); 120 | 121 | // Use the Ambient Temperature reading for our label 122 | NSInteger temp = (NSInteger)ambientTempF; 123 | [self setBackgroundImageForTemperature:temp]; 124 | self.captionLabel.hidden = NO; 125 | self.temperatureLabel.font = [UIFont fontWithName:@"HelveticaNeue-Thin" size:81]; 126 | self.temperatureLabel.text = [NSString stringWithFormat:@" %ld°", (long)temp]; 127 | } 128 | 129 | - (void)drawCircle { 130 | self.circleView.hidden = NO; 131 | CAShapeLayer *circleLayer = [CAShapeLayer layer]; 132 | [circleLayer setPath:[[UIBezierPath bezierPathWithOvalInRect:CGRectMake(0, 0, self.circleView.bounds.size.width, self.circleView.bounds.size.height)] CGPath]]; 133 | [[self.circleView layer] addSublayer:circleLayer]; 134 | [circleLayer setLineWidth:2]; 135 | [circleLayer setStrokeColor:[UIColor whiteColor].CGColor]; 136 | [circleLayer setFillColor:[UIColor clearColor].CGColor]; 137 | circleDrawn = YES; 138 | } 139 | 140 | - (void)setBackgroundImageForTemperature:(NSInteger)temperature { 141 | NSInteger temperatureToTens = 10; 142 | if (temperature > 19) { 143 | if (temperature > 99) { 144 | temperatureToTens = 100; 145 | } else { 146 | temperatureToTens = 10 * floor( temperature / 10 + 0.5 ); 147 | } 148 | } 149 | 150 | if (temperatureToTens != self.lastTemperatureTens) { 151 | NSString *temperatureFilename = [NSString stringWithFormat:@"temp-%ld", temperatureToTens]; 152 | NSLog(@"*** BACKGROUND FILENAME: %@", temperatureFilename); 153 | 154 | // fade out old, fade in new. 155 | UIImageView *visibleBackground = self.backgroundImageViews[self.visibleBackgroundIndex]; 156 | UIImageView *invisibleBackground = self.backgroundImageViews[self.invisibleBackgroundIndex]; 157 | invisibleBackground.image = [UIImage imageNamed:temperatureFilename]; 158 | invisibleBackground.alpha = 0; 159 | [self.view bringSubviewToFront:invisibleBackground]; 160 | [self.view bringSubviewToFront:self.controlContainerView]; 161 | 162 | [UIView animateWithDuration:0.5 animations:^{ 163 | // "crossfade" the two images 164 | invisibleBackground.alpha = 1; 165 | } completion:^(BOOL finished) { 166 | // rotate the indices: if it was 1 before now it's 0 and vice versa... 167 | visibleBackground.alpha = 0; 168 | NSInteger indexTemp = self.visibleBackgroundIndex; 169 | self.visibleBackgroundIndex = self.invisibleBackgroundIndex; 170 | self.invisibleBackgroundIndex = indexTemp; 171 | NSLog(@"**** NEW INDICES - visible: %ld - invisible: %ld", (long)self.visibleBackgroundIndex, (long)self.invisibleBackgroundIndex); 172 | }]; 173 | } 174 | } 175 | 176 | - (void)displayHumidity:(NSData *)dataBytes { 177 | // get the data's length - divide by two since we're creating an array that holds 16-bit (two-byte) values... 178 | // NOTE: Technically, because we have the documentation (http://processors.wiki.ti.com/index.php/SensorTag_User_Guide#Humidity_Sensor_2) 179 | // we already know that it's 2 16-bit integers, but this feels a bit more flexible. 180 | NSUInteger dataLength = dataBytes.length / 2; 181 | 182 | // create an array to contain the 16-bit values 183 | uint16_t dataArray[dataLength]; 184 | for (int i = 0; i < dataLength; i++) { 185 | dataArray[i] = 0; 186 | } 187 | 188 | // extract the data from the dataBytes object 189 | [dataBytes getBytes:&dataArray length:dataLength * sizeof(uint16_t)]; 190 | uint16_t rawHumidity = dataArray[SENSOR_DATA_INDEX_HUMIDITY]; 191 | double calculatedHumidity = calculateRelativeHumidity(rawHumidity); 192 | NSLog(@"*** HUMIDITY SENSOR: %f%%", calculatedHumidity); 193 | self.humidityLabel.text = [NSString stringWithFormat:@"Humidity: %.01f%%", calculatedHumidity]; 194 | 195 | // // Humidity sensor also retrieves a temperature, which we don't use. 196 | // // However, for instructional purposes, here's how to get at it to compare to the ambient sensor: 197 | // uint16_t rawHumidityTemp = dataArray[SENSOR_DATA_INDEX_HUMIDITY_TEMP]; 198 | // double calculatedTemperature = calcHumidityTemperature(rawHumidityTemp); 199 | // NSLog(@"*** HUMIDITY SENSOR - TEMPERATURE: %f", calculatedTemperature); 200 | } 201 | 202 | 203 | #pragma mark - Utility Methods 204 | 205 | - (double)fahrenheitFromCelsius:(double)celsius { 206 | double fahrenheit = (celsius * 1.8) + 32; 207 | return fahrenheit; 208 | } 209 | 210 | 211 | /* Conversion algorithm, temperature */ 212 | double calcHumidityTemperature(uint16_t rawT) { 213 | double v; 214 | //-- calculate temperature [deg C] -- 215 | v = -46.85 + 175.72/65536 *(double)(uint16_t)rawT; 216 | return v; 217 | } 218 | 219 | /* Conversion algorithm, humidity */ 220 | double calculateRelativeHumidity(uint16_t rawH) { 221 | double v; 222 | rawH &= ~0x0003; // clear bits [1..0] (status bits) 223 | //-- calculate relative humidity [%RH] -- 224 | v = -6.0 + 125.0/65536 * (double)rawH; // RH= -6 + 125 * SRH/2^16 225 | return v; 226 | } 227 | 228 | 229 | #pragma mark - CBCentralManagerDelegate methods 230 | 231 | - (void)centralManagerDidUpdateState:(CBCentralManager *)central { 232 | BOOL showAlert = YES; 233 | NSString *state = @""; 234 | switch ([central state]) 235 | { 236 | case CBCentralManagerStateUnsupported: 237 | state = @"This device does not support Bluetooth Low Energy."; 238 | break; 239 | case CBCentralManagerStateUnauthorized: 240 | state = @"This app is not authorized to use Bluetooth Low Energy."; 241 | break; 242 | case CBCentralManagerStatePoweredOff: 243 | state = @"Bluetooth on this device is currently powered off."; 244 | break; 245 | case CBCentralManagerStateResetting: 246 | state = @"The BLE Manager is resetting; a state update is pending."; 247 | break; 248 | case CBCentralManagerStatePoweredOn: 249 | showAlert = NO; 250 | state = @"Bluetooth LE is turned on and ready for communication."; 251 | NSLog(@"%@", state); 252 | self.keepScanning = YES; 253 | [NSTimer scheduledTimerWithTimeInterval:TIMER_SCAN_INTERVAL target:self selector:@selector(pauseScan) userInfo:nil repeats:NO]; 254 | [self.centralManager scanForPeripheralsWithServices:nil options:nil]; 255 | break; 256 | case CBCentralManagerStateUnknown: 257 | state = @"The state of the BLE Manager is unknown."; 258 | break; 259 | default: 260 | state = @"The state of the BLE Manager is unknown."; 261 | } 262 | 263 | if (showAlert) { 264 | UIAlertController *ac = [UIAlertController alertControllerWithTitle:@"Central Manager State" message:state preferredStyle:UIAlertControllerStyleAlert]; 265 | UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleCancel handler:nil]; 266 | [ac addAction:okAction]; 267 | [self presentViewController:ac animated:YES completion:nil]; 268 | } 269 | 270 | } 271 | 272 | - (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI { 273 | // Retrieve the peripheral name from the advertisement data using the "kCBAdvDataLocalName" key 274 | NSString *peripheralName = [advertisementData objectForKey:@"kCBAdvDataLocalName"]; 275 | NSLog(@"NEXT PERIPHERAL: %@ (%@)", peripheralName, peripheral.identifier.UUIDString); 276 | if (peripheralName) { 277 | if ([peripheralName isEqualToString:SENSOR_TAG_NAME]) { 278 | self.keepScanning = NO; 279 | 280 | // save a reference to the sensor tag 281 | self.sensorTag = peripheral; 282 | self.sensorTag.delegate = self; 283 | 284 | // Request a connection to the peripheral 285 | [self.centralManager connectPeripheral:self.sensorTag options:nil]; 286 | } 287 | } 288 | } 289 | 290 | - (void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPeripheral *)peripheral { 291 | NSLog(@"**** SUCCESSFULLY CONNECTED TO SENSOR TAG!!!"); 292 | self.temperatureLabel.font = [UIFont fontWithName:@"HelveticaNeue-Thin" size:56]; 293 | self.temperatureLabel.text = @"Connected"; 294 | 295 | // Now that we've successfully connected to the SensorTag, let's discover the services. 296 | // - NOTE: we pass nil here to request ALL services be discovered. 297 | // If there was a subset of services we were interested in, we could pass the UUIDs here. 298 | // Doing so saves batter life and saves time. 299 | [peripheral discoverServices:nil]; 300 | } 301 | 302 | - (void)centralManager:(CBCentralManager *)central didFailToConnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error { 303 | NSLog(@"**** CONNECTION FAILED!!!"); 304 | } 305 | 306 | - (void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error { 307 | NSLog(@"**** DISCONNECTED FROM SENSOR TAG!!!"); 308 | } 309 | 310 | 311 | #pragma mark - CBPeripheralDelegate methods 312 | 313 | // When the specified services are discovered, the peripheral calls the peripheral:didDiscoverServices: method of its delegate object. 314 | - (void)peripheral:(CBPeripheral *)peripheral didDiscoverServices:(NSError *)error { 315 | // Core Bluetooth creates an array of CBService objects —- one for each service that is discovered on the peripheral. 316 | for (CBService *service in peripheral.services) { 317 | NSLog(@"Discovered service: %@", service); 318 | if (([service.UUID isEqual:[CBUUID UUIDWithString:UUID_TEMPERATURE_SERVICE]]) || 319 | ([service.UUID isEqual:[CBUUID UUIDWithString:UUID_HUMIDITY_SERVICE]])) { 320 | [peripheral discoverCharacteristics:nil forService:service]; 321 | } 322 | } 323 | } 324 | 325 | - (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error { 326 | for (CBCharacteristic *characteristic in service.characteristics) { 327 | uint8_t enableValue = 1; 328 | NSData *enableBytes = [NSData dataWithBytes:&enableValue length:sizeof(uint8_t)]; 329 | 330 | // Temperature 331 | if ([characteristic.UUID isEqual:[CBUUID UUIDWithString:UUID_TEMPERATURE_DATA]]) { 332 | // Enable Temperature Sensor notification 333 | [self.sensorTag setNotifyValue:YES forCharacteristic:characteristic]; 334 | } 335 | 336 | if ([characteristic.UUID isEqual:[CBUUID UUIDWithString:UUID_TEMPERATURE_CONFIG]]) { 337 | // Enable Temperature Sensor 338 | [self.sensorTag writeValue:enableBytes forCharacteristic:characteristic type:CBCharacteristicWriteWithResponse]; 339 | } 340 | 341 | 342 | // Humidity 343 | if ([characteristic.UUID isEqual:[CBUUID UUIDWithString:UUID_HUMIDITY_DATA]]) { 344 | // Enable Humidity Sensor notification 345 | [self.sensorTag setNotifyValue:YES forCharacteristic:characteristic]; 346 | } 347 | 348 | if ([characteristic.UUID isEqual:[CBUUID UUIDWithString:UUID_HUMIDITY_CONFIG]]) { 349 | // Enable Humidity Sensor 350 | [self.sensorTag writeValue:enableBytes forCharacteristic:characteristic type:CBCharacteristicWriteWithResponse]; 351 | } 352 | } 353 | } 354 | 355 | 356 | - (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error { 357 | if (error) { 358 | NSLog(@"Error changing notification state: %@", [error localizedDescription]); 359 | } else { 360 | // extract the data from the characteristic's value property and display the value based on the characteristic type 361 | NSData *dataBytes = characteristic.value; 362 | if ([characteristic.UUID isEqual:[CBUUID UUIDWithString:UUID_TEMPERATURE_DATA]]) { 363 | [self displayTemperature:dataBytes]; 364 | } else if ([characteristic.UUID isEqual:[CBUUID UUIDWithString:UUID_HUMIDITY_DATA]]) { 365 | [self displayHumidity:dataBytes]; 366 | } 367 | } 368 | } 369 | 370 | @end 371 | -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReader/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // BLETemperatureReader 4 | // 5 | // Created by Evan Stone on 8/7/15. 6 | // Copyright (c) 2015 Cloud City. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReaderTests/BLETemperatureReaderTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // BLETemperatureReaderTests.m 3 | // BLETemperatureReaderTests 4 | // 5 | // Created by Evan Stone on 8/7/15. 6 | // Copyright (c) 2015 Cloud City. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface BLETemperatureReaderTests : XCTestCase 13 | 14 | @end 15 | 16 | @implementation BLETemperatureReaderTests 17 | 18 | - (void)setUp { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown { 24 | // Put teardown code here. This method is called after the invocation of each test method in the class. 25 | [super tearDown]; 26 | } 27 | 28 | - (void)testExample { 29 | // This is an example of a functional test case. 30 | XCTAssert(YES, @"Pass"); 31 | } 32 | 33 | - (void)testPerformanceExample { 34 | // This is an example of a performance test case. 35 | [self measureBlock:^{ 36 | // Put the code you want to measure the time of here. 37 | }]; 38 | } 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /BLETemperatureReader/BLETemperatureReaderTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | net.interactivelogic.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ZeroToBLE-Part2 2 | Demonstration iOS project to accompany [Part Two](http://blog.cloudcity.io/2015/06/11/zero-to-ble-on-ios-part-two/) of the Cloud City Development Blog series, *Zero to BLE*. 3 | --------------------------------------------------------------------------------