├── .gitignore ├── README.md ├── iBeaconCenter.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ └── iBeaconCenter.xccheckout │ └── xcuserdata │ │ └── Manish.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ └── Manish.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ ├── iBeaconCenter.xcscheme │ └── xcschememanagement.plist ├── iBeaconCenter ├── AppDelegate.h ├── AppDelegate.m ├── Base.lproj │ └── Main.storyboard ├── Images.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ └── Contents.json ├── ViewController.h ├── ViewController.m ├── en.lproj │ └── InfoPlist.strings ├── iBeaconCenter-Info.plist ├── iBeaconCenter-Prefix.pch └── main.m └── iBeaconCenterTests ├── en.lproj └── InfoPlist.strings ├── iBeaconCenterTests-Info.plist └── iBeaconCenterTests.m /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_STORE 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | iBeaconCenter 2 | ============= 3 | 4 | A very quick way to get up and running with iBeacon broadcast , monitoring and ranging. 5 | 6 | Reference - https://developer.apple.com/downloads/index.action?name=WWDC%202013#! 7 | -------------------------------------------------------------------------------- /iBeaconCenter.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 13D5F39918089ACF0020F629 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13D5F39818089ACF0020F629 /* Foundation.framework */; }; 11 | 13D5F39B18089ACF0020F629 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13D5F39A18089ACF0020F629 /* CoreGraphics.framework */; }; 12 | 13D5F39D18089ACF0020F629 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13D5F39C18089ACF0020F629 /* UIKit.framework */; }; 13 | 13D5F3A318089ACF0020F629 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 13D5F3A118089ACF0020F629 /* InfoPlist.strings */; }; 14 | 13D5F3A518089ACF0020F629 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13D5F3A418089ACF0020F629 /* main.m */; }; 15 | 13D5F3A918089ACF0020F629 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13D5F3A818089ACF0020F629 /* AppDelegate.m */; }; 16 | 13D5F3AC18089ACF0020F629 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 13D5F3AA18089ACF0020F629 /* Main.storyboard */; }; 17 | 13D5F3AF18089ACF0020F629 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 13D5F3AE18089ACF0020F629 /* ViewController.m */; }; 18 | 13D5F3B118089ACF0020F629 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13D5F3B018089ACF0020F629 /* Images.xcassets */; }; 19 | 13D5F3B818089ACF0020F629 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13D5F3B718089ACF0020F629 /* XCTest.framework */; }; 20 | 13D5F3B918089ACF0020F629 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13D5F39818089ACF0020F629 /* Foundation.framework */; }; 21 | 13D5F3BA18089ACF0020F629 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13D5F39C18089ACF0020F629 /* UIKit.framework */; }; 22 | 13D5F3C218089ACF0020F629 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 13D5F3C018089ACF0020F629 /* InfoPlist.strings */; }; 23 | 13D5F3C418089ACF0020F629 /* iBeaconCenterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 13D5F3C318089ACF0020F629 /* iBeaconCenterTests.m */; }; 24 | 13D5F3CE18089AFC0020F629 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13D5F3CD18089AFC0020F629 /* CoreLocation.framework */; }; 25 | 13D5F3D018089B020020F629 /* CoreBluetooth.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 13D5F3CF18089B020020F629 /* CoreBluetooth.framework */; }; 26 | /* End PBXBuildFile section */ 27 | 28 | /* Begin PBXContainerItemProxy section */ 29 | 13D5F3BB18089ACF0020F629 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = 13D5F38D18089ACF0020F629 /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = 13D5F39418089ACF0020F629; 34 | remoteInfo = iBeaconCenter; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 13D5F39518089ACF0020F629 /* iBeaconCenter.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iBeaconCenter.app; sourceTree = BUILT_PRODUCTS_DIR; }; 40 | 13D5F39818089ACF0020F629 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 41 | 13D5F39A18089ACF0020F629 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; 42 | 13D5F39C18089ACF0020F629 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 43 | 13D5F3A018089ACF0020F629 /* iBeaconCenter-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "iBeaconCenter-Info.plist"; sourceTree = ""; }; 44 | 13D5F3A218089ACF0020F629 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 45 | 13D5F3A418089ACF0020F629 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 46 | 13D5F3A618089ACF0020F629 /* iBeaconCenter-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "iBeaconCenter-Prefix.pch"; sourceTree = ""; }; 47 | 13D5F3A718089ACF0020F629 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 48 | 13D5F3A818089ACF0020F629 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 49 | 13D5F3AB18089ACF0020F629 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 50 | 13D5F3AD18089ACF0020F629 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 51 | 13D5F3AE18089ACF0020F629 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 52 | 13D5F3B018089ACF0020F629 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 53 | 13D5F3B618089ACF0020F629 /* iBeaconCenterTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = iBeaconCenterTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 54 | 13D5F3B718089ACF0020F629 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; }; 55 | 13D5F3BF18089ACF0020F629 /* iBeaconCenterTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "iBeaconCenterTests-Info.plist"; sourceTree = ""; }; 56 | 13D5F3C118089ACF0020F629 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; 57 | 13D5F3C318089ACF0020F629 /* iBeaconCenterTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = iBeaconCenterTests.m; sourceTree = ""; }; 58 | 13D5F3CD18089AFC0020F629 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; 59 | 13D5F3CF18089B020020F629 /* CoreBluetooth.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreBluetooth.framework; path = System/Library/Frameworks/CoreBluetooth.framework; sourceTree = SDKROOT; }; 60 | /* End PBXFileReference section */ 61 | 62 | /* Begin PBXFrameworksBuildPhase section */ 63 | 13D5F39218089ACF0020F629 /* Frameworks */ = { 64 | isa = PBXFrameworksBuildPhase; 65 | buildActionMask = 2147483647; 66 | files = ( 67 | 13D5F3D018089B020020F629 /* CoreBluetooth.framework in Frameworks */, 68 | 13D5F3CE18089AFC0020F629 /* CoreLocation.framework in Frameworks */, 69 | 13D5F39B18089ACF0020F629 /* CoreGraphics.framework in Frameworks */, 70 | 13D5F39D18089ACF0020F629 /* UIKit.framework in Frameworks */, 71 | 13D5F39918089ACF0020F629 /* Foundation.framework in Frameworks */, 72 | ); 73 | runOnlyForDeploymentPostprocessing = 0; 74 | }; 75 | 13D5F3B318089ACF0020F629 /* Frameworks */ = { 76 | isa = PBXFrameworksBuildPhase; 77 | buildActionMask = 2147483647; 78 | files = ( 79 | 13D5F3B818089ACF0020F629 /* XCTest.framework in Frameworks */, 80 | 13D5F3BA18089ACF0020F629 /* UIKit.framework in Frameworks */, 81 | 13D5F3B918089ACF0020F629 /* Foundation.framework in Frameworks */, 82 | ); 83 | runOnlyForDeploymentPostprocessing = 0; 84 | }; 85 | /* End PBXFrameworksBuildPhase section */ 86 | 87 | /* Begin PBXGroup section */ 88 | 13D5F38C18089ACF0020F629 = { 89 | isa = PBXGroup; 90 | children = ( 91 | 13D5F39E18089ACF0020F629 /* iBeaconCenter */, 92 | 13D5F3BD18089ACF0020F629 /* iBeaconCenterTests */, 93 | 13D5F39718089ACF0020F629 /* Frameworks */, 94 | 13D5F39618089ACF0020F629 /* Products */, 95 | ); 96 | sourceTree = ""; 97 | }; 98 | 13D5F39618089ACF0020F629 /* Products */ = { 99 | isa = PBXGroup; 100 | children = ( 101 | 13D5F39518089ACF0020F629 /* iBeaconCenter.app */, 102 | 13D5F3B618089ACF0020F629 /* iBeaconCenterTests.xctest */, 103 | ); 104 | name = Products; 105 | sourceTree = ""; 106 | }; 107 | 13D5F39718089ACF0020F629 /* Frameworks */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | 13D5F3CF18089B020020F629 /* CoreBluetooth.framework */, 111 | 13D5F3CD18089AFC0020F629 /* CoreLocation.framework */, 112 | 13D5F39818089ACF0020F629 /* Foundation.framework */, 113 | 13D5F39A18089ACF0020F629 /* CoreGraphics.framework */, 114 | 13D5F39C18089ACF0020F629 /* UIKit.framework */, 115 | 13D5F3B718089ACF0020F629 /* XCTest.framework */, 116 | ); 117 | name = Frameworks; 118 | sourceTree = ""; 119 | }; 120 | 13D5F39E18089ACF0020F629 /* iBeaconCenter */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | 13D5F3A718089ACF0020F629 /* AppDelegate.h */, 124 | 13D5F3A818089ACF0020F629 /* AppDelegate.m */, 125 | 13D5F3AA18089ACF0020F629 /* Main.storyboard */, 126 | 13D5F3AD18089ACF0020F629 /* ViewController.h */, 127 | 13D5F3AE18089ACF0020F629 /* ViewController.m */, 128 | 13D5F3B018089ACF0020F629 /* Images.xcassets */, 129 | 13D5F39F18089ACF0020F629 /* Supporting Files */, 130 | ); 131 | path = iBeaconCenter; 132 | sourceTree = ""; 133 | }; 134 | 13D5F39F18089ACF0020F629 /* Supporting Files */ = { 135 | isa = PBXGroup; 136 | children = ( 137 | 13D5F3A018089ACF0020F629 /* iBeaconCenter-Info.plist */, 138 | 13D5F3A118089ACF0020F629 /* InfoPlist.strings */, 139 | 13D5F3A418089ACF0020F629 /* main.m */, 140 | 13D5F3A618089ACF0020F629 /* iBeaconCenter-Prefix.pch */, 141 | ); 142 | name = "Supporting Files"; 143 | sourceTree = ""; 144 | }; 145 | 13D5F3BD18089ACF0020F629 /* iBeaconCenterTests */ = { 146 | isa = PBXGroup; 147 | children = ( 148 | 13D5F3C318089ACF0020F629 /* iBeaconCenterTests.m */, 149 | 13D5F3BE18089ACF0020F629 /* Supporting Files */, 150 | ); 151 | path = iBeaconCenterTests; 152 | sourceTree = ""; 153 | }; 154 | 13D5F3BE18089ACF0020F629 /* Supporting Files */ = { 155 | isa = PBXGroup; 156 | children = ( 157 | 13D5F3BF18089ACF0020F629 /* iBeaconCenterTests-Info.plist */, 158 | 13D5F3C018089ACF0020F629 /* InfoPlist.strings */, 159 | ); 160 | name = "Supporting Files"; 161 | sourceTree = ""; 162 | }; 163 | /* End PBXGroup section */ 164 | 165 | /* Begin PBXNativeTarget section */ 166 | 13D5F39418089ACF0020F629 /* iBeaconCenter */ = { 167 | isa = PBXNativeTarget; 168 | buildConfigurationList = 13D5F3C718089ACF0020F629 /* Build configuration list for PBXNativeTarget "iBeaconCenter" */; 169 | buildPhases = ( 170 | 13D5F39118089ACF0020F629 /* Sources */, 171 | 13D5F39218089ACF0020F629 /* Frameworks */, 172 | 13D5F39318089ACF0020F629 /* Resources */, 173 | ); 174 | buildRules = ( 175 | ); 176 | dependencies = ( 177 | ); 178 | name = iBeaconCenter; 179 | productName = iBeaconCenter; 180 | productReference = 13D5F39518089ACF0020F629 /* iBeaconCenter.app */; 181 | productType = "com.apple.product-type.application"; 182 | }; 183 | 13D5F3B518089ACF0020F629 /* iBeaconCenterTests */ = { 184 | isa = PBXNativeTarget; 185 | buildConfigurationList = 13D5F3CA18089ACF0020F629 /* Build configuration list for PBXNativeTarget "iBeaconCenterTests" */; 186 | buildPhases = ( 187 | 13D5F3B218089ACF0020F629 /* Sources */, 188 | 13D5F3B318089ACF0020F629 /* Frameworks */, 189 | 13D5F3B418089ACF0020F629 /* Resources */, 190 | ); 191 | buildRules = ( 192 | ); 193 | dependencies = ( 194 | 13D5F3BC18089ACF0020F629 /* PBXTargetDependency */, 195 | ); 196 | name = iBeaconCenterTests; 197 | productName = iBeaconCenterTests; 198 | productReference = 13D5F3B618089ACF0020F629 /* iBeaconCenterTests.xctest */; 199 | productType = "com.apple.product-type.bundle.unit-test"; 200 | }; 201 | /* End PBXNativeTarget section */ 202 | 203 | /* Begin PBXProject section */ 204 | 13D5F38D18089ACF0020F629 /* Project object */ = { 205 | isa = PBXProject; 206 | attributes = { 207 | LastUpgradeCheck = 0500; 208 | ORGANIZATIONNAME = Self; 209 | TargetAttributes = { 210 | 13D5F3B518089ACF0020F629 = { 211 | TestTargetID = 13D5F39418089ACF0020F629; 212 | }; 213 | }; 214 | }; 215 | buildConfigurationList = 13D5F39018089ACF0020F629 /* Build configuration list for PBXProject "iBeaconCenter" */; 216 | compatibilityVersion = "Xcode 3.2"; 217 | developmentRegion = English; 218 | hasScannedForEncodings = 0; 219 | knownRegions = ( 220 | en, 221 | Base, 222 | ); 223 | mainGroup = 13D5F38C18089ACF0020F629; 224 | productRefGroup = 13D5F39618089ACF0020F629 /* Products */; 225 | projectDirPath = ""; 226 | projectRoot = ""; 227 | targets = ( 228 | 13D5F39418089ACF0020F629 /* iBeaconCenter */, 229 | 13D5F3B518089ACF0020F629 /* iBeaconCenterTests */, 230 | ); 231 | }; 232 | /* End PBXProject section */ 233 | 234 | /* Begin PBXResourcesBuildPhase section */ 235 | 13D5F39318089ACF0020F629 /* Resources */ = { 236 | isa = PBXResourcesBuildPhase; 237 | buildActionMask = 2147483647; 238 | files = ( 239 | 13D5F3B118089ACF0020F629 /* Images.xcassets in Resources */, 240 | 13D5F3A318089ACF0020F629 /* InfoPlist.strings in Resources */, 241 | 13D5F3AC18089ACF0020F629 /* Main.storyboard in Resources */, 242 | ); 243 | runOnlyForDeploymentPostprocessing = 0; 244 | }; 245 | 13D5F3B418089ACF0020F629 /* Resources */ = { 246 | isa = PBXResourcesBuildPhase; 247 | buildActionMask = 2147483647; 248 | files = ( 249 | 13D5F3C218089ACF0020F629 /* InfoPlist.strings in Resources */, 250 | ); 251 | runOnlyForDeploymentPostprocessing = 0; 252 | }; 253 | /* End PBXResourcesBuildPhase section */ 254 | 255 | /* Begin PBXSourcesBuildPhase section */ 256 | 13D5F39118089ACF0020F629 /* Sources */ = { 257 | isa = PBXSourcesBuildPhase; 258 | buildActionMask = 2147483647; 259 | files = ( 260 | 13D5F3AF18089ACF0020F629 /* ViewController.m in Sources */, 261 | 13D5F3A918089ACF0020F629 /* AppDelegate.m in Sources */, 262 | 13D5F3A518089ACF0020F629 /* main.m in Sources */, 263 | ); 264 | runOnlyForDeploymentPostprocessing = 0; 265 | }; 266 | 13D5F3B218089ACF0020F629 /* Sources */ = { 267 | isa = PBXSourcesBuildPhase; 268 | buildActionMask = 2147483647; 269 | files = ( 270 | 13D5F3C418089ACF0020F629 /* iBeaconCenterTests.m in Sources */, 271 | ); 272 | runOnlyForDeploymentPostprocessing = 0; 273 | }; 274 | /* End PBXSourcesBuildPhase section */ 275 | 276 | /* Begin PBXTargetDependency section */ 277 | 13D5F3BC18089ACF0020F629 /* PBXTargetDependency */ = { 278 | isa = PBXTargetDependency; 279 | target = 13D5F39418089ACF0020F629 /* iBeaconCenter */; 280 | targetProxy = 13D5F3BB18089ACF0020F629 /* PBXContainerItemProxy */; 281 | }; 282 | /* End PBXTargetDependency section */ 283 | 284 | /* Begin PBXVariantGroup section */ 285 | 13D5F3A118089ACF0020F629 /* InfoPlist.strings */ = { 286 | isa = PBXVariantGroup; 287 | children = ( 288 | 13D5F3A218089ACF0020F629 /* en */, 289 | ); 290 | name = InfoPlist.strings; 291 | sourceTree = ""; 292 | }; 293 | 13D5F3AA18089ACF0020F629 /* Main.storyboard */ = { 294 | isa = PBXVariantGroup; 295 | children = ( 296 | 13D5F3AB18089ACF0020F629 /* Base */, 297 | ); 298 | name = Main.storyboard; 299 | sourceTree = ""; 300 | }; 301 | 13D5F3C018089ACF0020F629 /* InfoPlist.strings */ = { 302 | isa = PBXVariantGroup; 303 | children = ( 304 | 13D5F3C118089ACF0020F629 /* en */, 305 | ); 306 | name = InfoPlist.strings; 307 | sourceTree = ""; 308 | }; 309 | /* End PBXVariantGroup section */ 310 | 311 | /* Begin XCBuildConfiguration section */ 312 | 13D5F3C518089ACF0020F629 /* Debug */ = { 313 | isa = XCBuildConfiguration; 314 | buildSettings = { 315 | ALWAYS_SEARCH_USER_PATHS = NO; 316 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 317 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 318 | CLANG_CXX_LIBRARY = "libc++"; 319 | CLANG_ENABLE_MODULES = YES; 320 | CLANG_ENABLE_OBJC_ARC = YES; 321 | CLANG_WARN_BOOL_CONVERSION = YES; 322 | CLANG_WARN_CONSTANT_CONVERSION = YES; 323 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 324 | CLANG_WARN_EMPTY_BODY = YES; 325 | CLANG_WARN_ENUM_CONVERSION = YES; 326 | CLANG_WARN_INT_CONVERSION = YES; 327 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 328 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 329 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 330 | COPY_PHASE_STRIP = NO; 331 | GCC_C_LANGUAGE_STANDARD = gnu99; 332 | GCC_DYNAMIC_NO_PIC = NO; 333 | GCC_OPTIMIZATION_LEVEL = 0; 334 | GCC_PREPROCESSOR_DEFINITIONS = ( 335 | "DEBUG=1", 336 | "$(inherited)", 337 | ); 338 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 339 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 340 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 341 | GCC_WARN_UNDECLARED_SELECTOR = YES; 342 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 343 | GCC_WARN_UNUSED_FUNCTION = YES; 344 | GCC_WARN_UNUSED_VARIABLE = YES; 345 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 346 | ONLY_ACTIVE_ARCH = YES; 347 | SDKROOT = iphoneos; 348 | }; 349 | name = Debug; 350 | }; 351 | 13D5F3C618089ACF0020F629 /* Release */ = { 352 | isa = XCBuildConfiguration; 353 | buildSettings = { 354 | ALWAYS_SEARCH_USER_PATHS = NO; 355 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 356 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 357 | CLANG_CXX_LIBRARY = "libc++"; 358 | CLANG_ENABLE_MODULES = YES; 359 | CLANG_ENABLE_OBJC_ARC = YES; 360 | CLANG_WARN_BOOL_CONVERSION = YES; 361 | CLANG_WARN_CONSTANT_CONVERSION = YES; 362 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 363 | CLANG_WARN_EMPTY_BODY = YES; 364 | CLANG_WARN_ENUM_CONVERSION = YES; 365 | CLANG_WARN_INT_CONVERSION = YES; 366 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 367 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 368 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 369 | COPY_PHASE_STRIP = YES; 370 | ENABLE_NS_ASSERTIONS = NO; 371 | GCC_C_LANGUAGE_STANDARD = gnu99; 372 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 373 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 374 | GCC_WARN_UNDECLARED_SELECTOR = YES; 375 | GCC_WARN_UNINITIALIZED_AUTOS = YES; 376 | GCC_WARN_UNUSED_FUNCTION = YES; 377 | GCC_WARN_UNUSED_VARIABLE = YES; 378 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 379 | SDKROOT = iphoneos; 380 | VALIDATE_PRODUCT = YES; 381 | }; 382 | name = Release; 383 | }; 384 | 13D5F3C818089ACF0020F629 /* Debug */ = { 385 | isa = XCBuildConfiguration; 386 | buildSettings = { 387 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 388 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 389 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 390 | GCC_PREFIX_HEADER = "iBeaconCenter/iBeaconCenter-Prefix.pch"; 391 | INFOPLIST_FILE = "iBeaconCenter/iBeaconCenter-Info.plist"; 392 | PRODUCT_NAME = "$(TARGET_NAME)"; 393 | WRAPPER_EXTENSION = app; 394 | }; 395 | name = Debug; 396 | }; 397 | 13D5F3C918089ACF0020F629 /* Release */ = { 398 | isa = XCBuildConfiguration; 399 | buildSettings = { 400 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 401 | ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; 402 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 403 | GCC_PREFIX_HEADER = "iBeaconCenter/iBeaconCenter-Prefix.pch"; 404 | INFOPLIST_FILE = "iBeaconCenter/iBeaconCenter-Info.plist"; 405 | PRODUCT_NAME = "$(TARGET_NAME)"; 406 | WRAPPER_EXTENSION = app; 407 | }; 408 | name = Release; 409 | }; 410 | 13D5F3CB18089ACF0020F629 /* Debug */ = { 411 | isa = XCBuildConfiguration; 412 | buildSettings = { 413 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 414 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/iBeaconCenter.app/iBeaconCenter"; 415 | FRAMEWORK_SEARCH_PATHS = ( 416 | "$(SDKROOT)/Developer/Library/Frameworks", 417 | "$(inherited)", 418 | "$(DEVELOPER_FRAMEWORKS_DIR)", 419 | ); 420 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 421 | GCC_PREFIX_HEADER = "iBeaconCenter/iBeaconCenter-Prefix.pch"; 422 | GCC_PREPROCESSOR_DEFINITIONS = ( 423 | "DEBUG=1", 424 | "$(inherited)", 425 | ); 426 | INFOPLIST_FILE = "iBeaconCenterTests/iBeaconCenterTests-Info.plist"; 427 | PRODUCT_NAME = "$(TARGET_NAME)"; 428 | TEST_HOST = "$(BUNDLE_LOADER)"; 429 | WRAPPER_EXTENSION = xctest; 430 | }; 431 | name = Debug; 432 | }; 433 | 13D5F3CC18089ACF0020F629 /* Release */ = { 434 | isa = XCBuildConfiguration; 435 | buildSettings = { 436 | ARCHS = "$(ARCHS_STANDARD_INCLUDING_64_BIT)"; 437 | BUNDLE_LOADER = "$(BUILT_PRODUCTS_DIR)/iBeaconCenter.app/iBeaconCenter"; 438 | FRAMEWORK_SEARCH_PATHS = ( 439 | "$(SDKROOT)/Developer/Library/Frameworks", 440 | "$(inherited)", 441 | "$(DEVELOPER_FRAMEWORKS_DIR)", 442 | ); 443 | GCC_PRECOMPILE_PREFIX_HEADER = YES; 444 | GCC_PREFIX_HEADER = "iBeaconCenter/iBeaconCenter-Prefix.pch"; 445 | INFOPLIST_FILE = "iBeaconCenterTests/iBeaconCenterTests-Info.plist"; 446 | PRODUCT_NAME = "$(TARGET_NAME)"; 447 | TEST_HOST = "$(BUNDLE_LOADER)"; 448 | WRAPPER_EXTENSION = xctest; 449 | }; 450 | name = Release; 451 | }; 452 | /* End XCBuildConfiguration section */ 453 | 454 | /* Begin XCConfigurationList section */ 455 | 13D5F39018089ACF0020F629 /* Build configuration list for PBXProject "iBeaconCenter" */ = { 456 | isa = XCConfigurationList; 457 | buildConfigurations = ( 458 | 13D5F3C518089ACF0020F629 /* Debug */, 459 | 13D5F3C618089ACF0020F629 /* Release */, 460 | ); 461 | defaultConfigurationIsVisible = 0; 462 | defaultConfigurationName = Release; 463 | }; 464 | 13D5F3C718089ACF0020F629 /* Build configuration list for PBXNativeTarget "iBeaconCenter" */ = { 465 | isa = XCConfigurationList; 466 | buildConfigurations = ( 467 | 13D5F3C818089ACF0020F629 /* Debug */, 468 | 13D5F3C918089ACF0020F629 /* Release */, 469 | ); 470 | defaultConfigurationIsVisible = 0; 471 | }; 472 | 13D5F3CA18089ACF0020F629 /* Build configuration list for PBXNativeTarget "iBeaconCenterTests" */ = { 473 | isa = XCConfigurationList; 474 | buildConfigurations = ( 475 | 13D5F3CB18089ACF0020F629 /* Debug */, 476 | 13D5F3CC18089ACF0020F629 /* Release */, 477 | ); 478 | defaultConfigurationIsVisible = 0; 479 | }; 480 | /* End XCConfigurationList section */ 481 | }; 482 | rootObject = 13D5F38D18089ACF0020F629 /* Project object */; 483 | } 484 | -------------------------------------------------------------------------------- /iBeaconCenter.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /iBeaconCenter.xcodeproj/project.xcworkspace/xcshareddata/iBeaconCenter.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | ABA285FE-9DC9-4DE6-9422-19FF673C0E27 9 | IDESourceControlProjectName 10 | iBeaconCenter 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | CC1AFC8F-209C-4401-9C95-BF1985BC8466 14 | ssh://github.com/manishnath/iBeaconCenter.git 15 | 16 | IDESourceControlProjectPath 17 | iBeaconCenter.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | CC1AFC8F-209C-4401-9C95-BF1985BC8466 21 | ../.. 22 | 23 | IDESourceControlProjectURL 24 | ssh://github.com/manishnath/iBeaconCenter.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | CC1AFC8F-209C-4401-9C95-BF1985BC8466 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | CC1AFC8F-209C-4401-9C95-BF1985BC8466 36 | IDESourceControlWCCName 37 | iBeaconCenter 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /iBeaconCenter.xcodeproj/project.xcworkspace/xcuserdata/Manish.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/manishnath/iBeaconCenter/fda7ea75d660f99c551f0fd45ffae39eeb81e6e9/iBeaconCenter.xcodeproj/project.xcworkspace/xcuserdata/Manish.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /iBeaconCenter.xcodeproj/xcuserdata/Manish.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /iBeaconCenter.xcodeproj/xcuserdata/Manish.xcuserdatad/xcschemes/iBeaconCenter.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /iBeaconCenter.xcodeproj/xcuserdata/Manish.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | iBeaconCenter.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 13D5F39418089ACF0020F629 16 | 17 | primary 18 | 19 | 20 | 13D5F3B518089ACF0020F629 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /iBeaconCenter/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // iBeaconCenter 4 | // 5 | // Created by Manish on 11/10/13. 6 | // Copyright (c) 2013 Self. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /iBeaconCenter/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // iBeaconCenter 4 | // 5 | // Created by Manish on 11/10/13. 6 | // Copyright (c) 2013 Self. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @implementation AppDelegate 12 | 13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 14 | { 15 | // Override point for customization after application launch. 16 | return YES; 17 | } 18 | 19 | - (void)applicationWillResignActive:(UIApplication *)application 20 | { 21 | // 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. 22 | // 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. 23 | } 24 | 25 | - (void)applicationDidEnterBackground:(UIApplication *)application 26 | { 27 | // 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. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | - (void)applicationWillEnterForeground:(UIApplication *)application 32 | { 33 | // 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. 34 | } 35 | 36 | - (void)applicationDidBecomeActive:(UIApplication *)application 37 | { 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 | { 43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /iBeaconCenter/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 | 40 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /iBeaconCenter/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /iBeaconCenter/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } -------------------------------------------------------------------------------- /iBeaconCenter/ViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.h 3 | // ScanBeaconSample 4 | // 5 | // Created by Manish on 10/10/13. 6 | // Copyright (c) 2013 Self. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | 13 | static int broadcastpower = -59; 14 | 15 | @interface ViewController : UIViewController{ 16 | CLLocationManager *_locationManager; 17 | NSUUID *_uuid; 18 | NSNumber *_power; 19 | CLBeaconRegion *region; 20 | CBPeripheralManager *_peripheralManager; 21 | 22 | } 23 | 24 | -(IBAction)toggleRanging:(UISwitch *)rangingSwitch; 25 | -(IBAction)toggleBroadcasting:(UISwitch *)broadcastingSwitch; 26 | @end 27 | -------------------------------------------------------------------------------- /iBeaconCenter/ViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.m 3 | // ScanBeaconSample 4 | // 5 | // Created by Manish on 10/10/13. 6 | // Copyright (c) 2013 Self. All rights reserved. 7 | // 8 | 9 | #import "ViewController.h" 10 | 11 | @interface ViewController (){ 12 | BOOL turnAdvertisingOn; 13 | } 14 | 15 | @end 16 | 17 | @implementation ViewController 18 | 19 | - (void)viewDidLoad 20 | { 21 | [super viewDidLoad]; 22 | // Do any additional setup after loading the view, typically from a nib. 23 | } 24 | 25 | - (void)didReceiveMemoryWarning 26 | { 27 | [super didReceiveMemoryWarning]; 28 | // Dispose of any resources that can be recreated. 29 | } 30 | 31 | #pragma mark - Interaction 32 | 33 | -(IBAction)toggleBroadcasting:(UISwitch *)broadcastingSwitch{ 34 | BOOL flag = broadcastingSwitch.on; 35 | if (flag) { 36 | [self initiatePeripheralManagerForBeaconBroadcast]; 37 | } 38 | else{ 39 | [self stopBeaconBroadCast]; 40 | } 41 | } 42 | 43 | -(IBAction)toggleRanging:(UISwitch *)rangingSwitch{ 44 | BOOL flag = rangingSwitch.on; 45 | if (flag) { 46 | [self startRanging]; 47 | } 48 | else{ 49 | [self stopRanging]; 50 | } 51 | } 52 | 53 | 54 | #pragma mark - Beacon Range 55 | -(void)startRanging{ 56 | 57 | //Check if monitoring is available or not 58 | if (![CLLocationManager isMonitoringAvailableForClass:[CLBeaconRegion class]]) { 59 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Monitoring not available" message:nil delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles: nil]; 60 | [alert show]; 61 | return; 62 | } 63 | 64 | if (_locationManager!=nil) { 65 | if(region){ 66 | region.notifyOnEntry = YES; 67 | region.notifyOnExit = YES; 68 | region.notifyEntryStateOnDisplay = YES; 69 | [_locationManager startMonitoringForRegion:region]; 70 | [_locationManager startRangingBeaconsInRegion:region]; 71 | 72 | } 73 | else{ 74 | _uuid = [[NSUUID alloc] initWithUUIDString:@"E2C56DB5-DFFB-48D2-B060-D0F5A71096E0"]; 75 | _locationManager = [[CLLocationManager alloc] init]; 76 | _locationManager.delegate = self; 77 | region = [[CLBeaconRegion alloc] initWithProximityUUID:_uuid identifier:@"COM.SELF.ID"]; 78 | if(region){ 79 | region.notifyOnEntry = YES; 80 | region.notifyOnExit = YES; 81 | region.notifyEntryStateOnDisplay = YES; 82 | [_locationManager startMonitoringForRegion:region]; 83 | [_locationManager startRangingBeaconsInRegion:region]; 84 | 85 | } 86 | } 87 | } 88 | else{ 89 | _uuid = [[NSUUID alloc] initWithUUIDString:@"E2C56DB5-DFFB-48D2-B060-D0F5A71096E0"]; 90 | _locationManager = [[CLLocationManager alloc] init]; 91 | _locationManager.delegate = self; 92 | region = [[CLBeaconRegion alloc] initWithProximityUUID:_uuid identifier:@"COM.SELF.ID"]; 93 | if(region){ 94 | region.notifyOnEntry = YES; 95 | region.notifyOnExit = YES; 96 | region.notifyEntryStateOnDisplay = YES; 97 | [_locationManager startMonitoringForRegion:region]; 98 | [_locationManager startRangingBeaconsInRegion:region]; 99 | 100 | } 101 | } 102 | } 103 | 104 | 105 | 106 | -(void)stopRanging{ 107 | [_locationManager stopRangingBeaconsInRegion:region]; 108 | [_locationManager stopMonitoringForRegion:region]; 109 | } 110 | 111 | #pragma mark - Beacon broadcast 112 | 113 | -(void)initiatePeripheralManagerForBeaconBroadcast{ 114 | if (_peripheralManager) { 115 | [self advertiseBeacon]; 116 | return; 117 | } 118 | 119 | //This starts a check on the update state delegate to see if bluetooth is powered on or not 120 | _peripheralManager = [[CBPeripheralManager alloc] initWithDelegate:self queue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)]; 121 | turnAdvertisingOn = YES; 122 | } 123 | 124 | -(void)stopBeaconBroadCast{ 125 | if (_peripheralManager) { 126 | turnAdvertisingOn = NO; 127 | [_peripheralManager stopAdvertising]; 128 | } 129 | } 130 | 131 | - (void)peripheralManagerDidUpdateState:(CBPeripheralManager *)peripheral{ 132 | NSLog(@"peripheral %@",peripheral); 133 | 134 | //Check if the BLE state was on or not 135 | if (peripheral.state == CBPeripheralManagerStatePoweredOn && turnAdvertisingOn) { 136 | [self advertiseBeacon]; 137 | } 138 | } 139 | 140 | -(void)advertiseBeacon{ 141 | _uuid = [[NSUUID alloc] initWithUUIDString:@"E2C56DB5-DFFB-48D2-B060-D0F5A71096E0"]; 142 | _power = @(broadcastpower); 143 | CLBeaconRegion *newregion = [[CLBeaconRegion alloc] initWithProximityUUID:_uuid major:10 minor:5 identifier:@"COM.SELF.ID"]; 144 | NSMutableDictionary *peripheralData = [newregion peripheralDataWithMeasuredPower:_power]; 145 | 146 | NSLog(@"start advertising %@",peripheralData); 147 | //Advertise the same beacon region and Range the same beacon region 148 | [_peripheralManager startAdvertising:peripheralData]; 149 | 150 | } 151 | 152 | #pragma mark - set range colors 153 | 154 | -(void)setinrangeColor{ 155 | self.view.backgroundColor = [UIColor greenColor]; 156 | } 157 | 158 | -(void)setoutofrangeColor{ 159 | self.view.backgroundColor = [UIColor redColor]; 160 | 161 | } 162 | 163 | -(void)setfarrangeColor{ 164 | self.view.backgroundColor = [UIColor yellowColor]; 165 | } 166 | 167 | 168 | 169 | #pragma mark - Location manager beacon region delegate 170 | 171 | -(void)locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region{ 172 | NSLog(@"Enter Region @",region); 173 | [_locationManager startRangingBeaconsInRegion:region]; 174 | [self sendLocalNotificationForReqgionConfirmationWithText:@"REGION INSIDE"]; 175 | [self setinrangeColor]; 176 | } 177 | 178 | -(void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region{ 179 | NSLog(@"Exit Region %@",region); 180 | [self sendLocalNotificationForReqgionConfirmationWithText:@"REGION OUTSIDE"]; 181 | [_locationManager stopRangingBeaconsInRegion:region]; 182 | [self setoutofrangeColor]; 183 | } 184 | 185 | -(void)locationManager:(CLLocationManager *)manager didStartMonitoringForRegion:(CLRegion *)region{ 186 | NSLog(@"Monitoring for %@",region); 187 | //[self sendLocalNotificationForReqgionConfirmationWithText:@"MONITORING STARTED"]; 188 | 189 | } 190 | 191 | - (void)locationManager:(CLLocationManager *)manager didDetermineState:(CLRegionState)state forRegion:(CLRegion *)region{ 192 | if (state == CLRegionStateInside) { 193 | [_locationManager startRangingBeaconsInRegion:region]; 194 | [self sendLocalNotificationForReqgionConfirmationWithText:@"REGION INSIDE"]; 195 | [self setinrangeColor]; 196 | } 197 | else{ 198 | //[[BluetoothManager shared] scan]; 199 | [self sendLocalNotificationForReqgionConfirmationWithText:@"REGION OUTSIDE"]; 200 | [_locationManager stopRangingBeaconsInRegion:region]; 201 | [self setoutofrangeColor]; 202 | 203 | } 204 | //[_locationManager startRangingBeaconsInRegion:region]; 205 | 206 | } 207 | 208 | -(void)locationManager:(CLLocationManager *)manager didRangeBeacons:(NSArray *)beacons inRegion:(CLBeaconRegion *)region 209 | { 210 | 211 | NSArray *unknownBeacons = [beacons filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"proximity = %d", CLProximityUnknown]]; 212 | if([unknownBeacons count]){ 213 | NSLog(@"unknown beacons %@",unknownBeacons); 214 | [self setoutofrangeColor]; 215 | } 216 | 217 | NSArray *immediateBeacons = [beacons filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"proximity = %d", CLProximityImmediate]]; 218 | if([immediateBeacons count]){ 219 | NSLog(@"immediate beacons %@",immediateBeacons); 220 | [self setinrangeColor]; 221 | } 222 | 223 | 224 | NSArray *nearBeacons = [beacons filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"proximity = %d", CLProximityNear]]; 225 | if([nearBeacons count]){ 226 | NSLog(@"near beacons %@",nearBeacons); 227 | [self setinrangeColor]; 228 | 229 | } 230 | 231 | 232 | NSArray *farBeacons = [beacons filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"proximity = %d", CLProximityFar]]; 233 | if([farBeacons count]){ 234 | NSLog(@"far beacons %@",farBeacons); 235 | [self setfarrangeColor]; 236 | } 237 | 238 | } 239 | 240 | -(void)sendLocalNotificationForReqgionConfirmationWithText:(NSString *)text { 241 | 242 | UILocalNotification *localNotif = [[UILocalNotification alloc] init]; 243 | if (localNotif == nil) 244 | return; 245 | 246 | localNotif.timeZone = [NSTimeZone defaultTimeZone]; 247 | 248 | localNotif.alertBody = [NSString stringWithFormat:NSLocalizedString(@"%@", nil), 249 | text]; 250 | localNotif.alertAction = NSLocalizedString(@"View Details", nil); 251 | 252 | localNotif.applicationIconBadgeNumber = 1; 253 | 254 | NSDictionary *infoDict = [NSDictionary dictionaryWithObject:text forKey:@"KEY"]; 255 | localNotif.userInfo = infoDict; 256 | 257 | [[UIApplication sharedApplication] presentLocalNotificationNow:localNotif]; 258 | 259 | } 260 | 261 | - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification NS_AVAILABLE_IOS(4_0){ 262 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:notification.alertBody message:nil delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]; 263 | [alert show]; 264 | } 265 | 266 | 267 | @end 268 | -------------------------------------------------------------------------------- /iBeaconCenter/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /iBeaconCenter/iBeaconCenter-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UIBackgroundModes 6 | 7 | location 8 | bluetooth-central 9 | 10 | CFBundleDevelopmentRegion 11 | en 12 | CFBundleDisplayName 13 | ${PRODUCT_NAME} 14 | CFBundleExecutable 15 | ${EXECUTABLE_NAME} 16 | CFBundleIdentifier 17 | com.self.${PRODUCT_NAME:rfc1034identifier} 18 | CFBundleInfoDictionaryVersion 19 | 6.0 20 | CFBundleName 21 | ${PRODUCT_NAME} 22 | CFBundlePackageType 23 | APPL 24 | CFBundleShortVersionString 25 | 1.0 26 | CFBundleSignature 27 | ???? 28 | CFBundleVersion 29 | 1.0 30 | LSRequiresIPhoneOS 31 | 32 | UIMainStoryboardFile 33 | Main 34 | UIRequiredDeviceCapabilities 35 | 36 | armv7 37 | 38 | UISupportedInterfaceOrientations 39 | 40 | UIInterfaceOrientationPortrait 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /iBeaconCenter/iBeaconCenter-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /iBeaconCenter/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // iBeaconCenter 4 | // 5 | // Created by Manish on 11/10/13. 6 | // Copyright (c) 2013 Self. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /iBeaconCenterTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /iBeaconCenterTests/iBeaconCenterTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.self.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /iBeaconCenterTests/iBeaconCenterTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // iBeaconCenterTests.m 3 | // iBeaconCenterTests 4 | // 5 | // Created by Manish on 11/10/13. 6 | // Copyright (c) 2013 Self. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface iBeaconCenterTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation iBeaconCenterTests 16 | 17 | - (void)setUp 18 | { 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 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | --------------------------------------------------------------------------------