├── .DS_Store ├── BrightSDK.podspec ├── BrightSDK ├── .DS_Store ├── include │ ├── .DS_Store │ ├── AntiLose.h │ ├── BRTBeacon.h │ ├── BRTBeaconDefinitions.h │ ├── BRTBeaconManager.h │ ├── BRTBeaconRegion.h │ ├── BRTBeaconSDK.h │ ├── BRTTools.h │ ├── CBeacon.h │ └── OpenUDIDIOS7.h └── libBrightSDK.a ├── Demo ├── .DS_Store ├── Demo.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ ├── Demo.xcscmblueprint │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcuserdata │ │ │ ├── apple.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ │ │ ├── hetao.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ │ │ └── thomasho.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ ├── apple.xcuserdatad │ │ └── xcschemes │ │ │ └── xcschememanagement.plist │ │ ├── hetao.xcuserdatad │ │ ├── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ │ └── xcschememanagement.plist │ │ └── thomasho.xcuserdatad │ │ ├── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ ├── Demo.xcscheme │ │ └── xcschememanagement.plist └── Demo │ ├── .DS_Store │ ├── AdjustCell.h │ ├── AdjustCell.m │ ├── AdjustCell.xib │ ├── AdjustVC.h │ ├── AdjustVC.m │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── LaunchImage.launchimage │ │ └── Contents.json │ └── ic_beacon.imageset │ │ ├── Contents.json │ │ └── ic_beacon@2x.png │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── BeaconVC.h │ ├── BeaconVC.m │ ├── ConfigDetailVC.h │ ├── ConfigDetailVC.m │ ├── ConfigVC.h │ ├── ConfigVC.m │ ├── DemoVC.h │ ├── DemoVC.m │ ├── Info.plist │ ├── RegionAddVC.h │ ├── RegionAddVC.m │ ├── RegionHander.h │ ├── RegionHander.m │ ├── RegionVC.h │ ├── RegionVC.m │ ├── SVProgessHUD │ ├── SVProgressHUD-Prefix.pch │ ├── SVProgressHUD.bundle │ │ ├── error-black.png │ │ ├── error-black@2x.png │ │ ├── error.png │ │ ├── error@2x.png │ │ ├── success-black.png │ │ ├── success-black@2x.png │ │ ├── success.png │ │ └── success@2x.png │ ├── SVProgressHUD.h │ └── SVProgressHUD.m │ ├── ScanInBackground.h │ ├── ScanInBackground.m │ ├── VirtualVC.h │ ├── VirtualVC.m │ └── main.m ├── README.md └── docs ├── .DS_Store ├── Blocks ├── BRTCompletionBlock.html ├── BRTDataCompletionBlock.html ├── RangingiBeaconsCompletionBlock.html ├── ScanBlesCompletionBlock.html └── locBlock.html ├── Classes ├── BRTBeacon.html ├── BRTBeaconManager.html ├── BRTBeaconRegion.html ├── BRTBeaconSDK.html └── BRTTools.html ├── Constants ├── BroadcastMode.html ├── BrtSupports.html ├── DevelopPublishMode.html └── ErrorCode.html ├── Protocols ├── BRTBeaconDelegate.html ├── BRTBeaconManagerDelegate.html └── BRTBeaconRegionDelegate.html ├── css ├── scss │ ├── _index.scss │ ├── _layout.scss │ ├── _normalize.scss │ ├── _object.scss │ ├── _print.scss │ ├── _variables.scss │ ├── _xcode.scss │ └── style.scss └── style.css ├── hierarchy.html ├── img ├── button_bar_background.png ├── disclosure.png ├── disclosure_open.png ├── library_background.png └── title_background.png ├── index.html └── js └── script.js /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_iOS_SDK/fa3459eb71d7bad33e9cdda261c3ebe9b5aaef6a/.DS_Store -------------------------------------------------------------------------------- /BrightSDK.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "BrightSDK" 3 | s.version = "3.5.2" 4 | s.summary = "iOS library for BrightBeacon devices" 5 | s.homepage = "http://www.brtbeacon.com" 6 | s.author = { "BrightBeacon" => "o2owlkj@163.com" } 7 | s.platform = :ios 8 | s.source = { :git => "https://github.com/BrightBeacon/BrightBeacon_iOS_SDK.git", :tag => "3.5.2"} 9 | s.source_files = 'BrightSDK/**/*.h' 10 | s.preserve_paths = 'BrightSDK/libBrightSDK.a' 11 | s.vendored_libraries = 'BrightSDK/libBrightSDK.a' 12 | s.ios.deployment_target = '7.0' 13 | s.frameworks = 'UIKit', 'Foundation','CoreLocation', 'CoreBluetooth' 14 | s.requires_arc = true 15 | s.xcconfig = { 'LIBRARY_SEARCH_PATHS' => '"$(PODS_ROOT)/BrightSDK"', 16 | 'HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/BrightSDK/include"' } 17 | s.license = { 18 | :type => 'Copyright', 19 | :text => <<-LICENSE 20 | Copyright 2020 BrightBeacon All rights reserved. 21 | LICENSE 22 | } 23 | end -------------------------------------------------------------------------------- /BrightSDK/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_iOS_SDK/fa3459eb71d7bad33e9cdda261c3ebe9b5aaef6a/BrightSDK/.DS_Store -------------------------------------------------------------------------------- /BrightSDK/include/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_iOS_SDK/fa3459eb71d7bad33e9cdda261c3ebe9b5aaef6a/BrightSDK/include/.DS_Store -------------------------------------------------------------------------------- /BrightSDK/include/AntiLose.h: -------------------------------------------------------------------------------- 1 | // 2 | // AntiLose.h 3 | // BrightSDK 4 | // 5 | // Created by thomasho on 15-4-24. 6 | // Copyright (c) 2015年 thomasho. All rights reserved. 7 | // 8 | 9 | #ifndef BrightSDK_AntiLose_h 10 | #define BrightSDK_AntiLose_h 11 | 12 | typedef enum : int 13 | { 14 | AL_IB_Service=0, 15 | AL_IB_UUID16_Major2_Minor2, 16 | AL_IB_Name20, 17 | AL_IB_Key16,//key 18 | AL_IB_Battery1_Temperature1, 19 | AL_IB_Mode2_Tx1_MPower1_Interval2_BateryInterval2_TempInterval2,//_LightInterval2_swInterval2_userdata2_reserved1 20 | AL_IB_Reserved20, 21 | AL_IB_SerialData 22 | } AL_IBeacon; 23 | 24 | typedef enum : int 25 | { 26 | AL_P_Service=0, 27 | AL_P1_Distance3_Press4_PressLong5_AutoAnti6_Speaker7, 28 | AL_P_Time2, 29 | AL_P_Data8 30 | } AL_Proximity; 31 | 32 | typedef enum : int 33 | { 34 | AL_DFU_Service = 0, 35 | AL_DFU_Ver4_Status4 = 1, 36 | AL_DFU_Data20 = 2 37 | } AL_DFU; 38 | 39 | #define AL_SERVICE_IBeacon(x) [NSString stringWithFormat:@"E204915%d-4645-417C-8125-983EC406D54A",x] 40 | #define AL_SERVICE_Proximity(x) [NSString stringWithFormat:@"BB008B5%d-EC80-40BA-A6D2-4CE9D5BA5585",x] 41 | #define AL_SERVICE_DFU(x) [NSString stringWithFormat:@"D2F17AA%d-3C68-4BD5-AAEA-57CC05371F86",x] 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /BrightSDK/include/BRTBeaconDefinitions.h: -------------------------------------------------------------------------------- 1 | // 2 | // BRTBeaconDefinitions.h 3 | // BrightSDK 4 | // 5 | // Version : 1.0.0 6 | // Created by Bright Beacon on 19/04/14. 7 | // Copyright (c) 2014 Bright. All rights reserved. 8 | // 9 | 10 | #import 11 | //////////////////////////////////////////////////////////////////// 12 | // Type and class definitions 13 | /** 14 | * 更新日志 15 | * 16 | * 3.5.2 默认使用CLBeaconIdentityConstraint 17 | * 3.5.1 修复连接超时不回调 18 | * 3.5.0 修复IOS13读取 19 | * 3.4.9 修复brtBeacons 20 | * 3.4.8 分离蓝牙扫描、iBeacon扫描 21 | * 3.4.7 优化区域监听(regionHander) 22 | * 23 | */ 24 | #define SDK_VERSION @"3.5.2" 25 | 26 | //////////////////////////////////////////////////////////////////// 27 | // 可用的配置参数列表(用于writeBeaconValues:) 28 | #define B_NAME @"name" 29 | #define B_UUID @"uuid" 30 | #define B_MAJOR @"major" 31 | #define B_MINOR @"minor" 32 | #define B_MEASURED @"mPower" 33 | #define B_MPOWER @"mPower" 34 | #define B_INTERVAL @"txInterval" 35 | #define B_TX @"txPower" 36 | #define B_MODE @"pMode" 37 | #define B_BATTERY_INTERVAL @"batteryInterval" 38 | #define B_TEMPERATURE_INTERVAL @"temperatureInterval" 39 | #define B_LIGHT_INTERVAL @"lightInterval" 40 | #define B_LIGHT_SLEEP @"lightSleep" 41 | //Anti 42 | #define B_Reserved @"Reserved" 43 | #define B_InRange @"InRange" 44 | #define B_AutoAlarm @"AutoAlarm" 45 | #define B_ActiveFind @"ActiveFind" 46 | #define B_ButtonAlarm @"ButtonAlarm" 47 | #define B_AutoAlarmTimeOut @"autoalarmtimeout" 48 | 49 | //阿里轮播模式 50 | #define B_Ali_Switch @"AliSw" 51 | #define B_AliUUID_Switch @"AliUUIDsw" 52 | #define B_AliUUID @"Reserved" 53 | 54 | //Eddystone (0304-9新增) 55 | #define B_BroadcastMode @"BroadcastMode" 56 | #define B_EddystoneURL @"Reserved" 57 | 58 | //新增用户自定义4byte广播数据(>030x-10,031x-4,040x) 59 | #define B_UserData @"userData" 60 | 61 | //040x版本串口数据 62 | #define B_SerialData @"serialData" 63 | 64 | //0313及以后 注:至少保持一个广播频点,如果设置全部关闭,默认2402 65 | #define B_Off2402 @"off2402" 66 | #define B_Off2426 @"off2426" 67 | #define B_Off2480 @"off2480" 68 | 69 | //050x版本广播切换间隔 70 | #define B_BROADCAT_INTERVAL @"broadcatInterval" 71 | 72 | 73 | /////恢复默认参数列表 74 | #define DEFAULT_KEY @"00000000000000000000000000000000" //32-0 75 | #define DEFAULT_UUID @"E2C56DB5-DFFB-48D2-B060-D0F5A71096E0" 76 | #define DEFAULT_MAJOR 0 77 | #define DEFAULT_MINOR 0 78 | #define DEFAULT_MEASURED -65 79 | //间隔(ms) 80 | #define DEFAULT_INTERVAL 852 81 | #define DEFAULT_BCHECK_INTERVAL 3600 82 | #define DEFAULT_TCHECK_INTERVAL 0 83 | #define DEFAULT_LCHECK_INTERVAL 0 84 | 85 | /* 86 | * 发送功率(dbm) 87 | * TI芯片 -23 -6 0 +4 88 | * Nordic -40 -30 -20 -16 -12 -8 -4 0 +4 89 | */ 90 | //所有设备,请直接使用功率数值。 91 | #define DEFAULT_TX_EX 0 92 | 93 | #define DEFAULT_NAME @"BrightBeacon" 94 | #define DEFAULT_MODE 0 95 | #define DEFAULT_LIGHT_SLEEP 0 96 | 97 | #define kNotifyConnect @"kNotifyConnect" 98 | #define kNotifyCancelConnect @"kNotifyCancelConnect" 99 | #define kNotifyDisconnect @"kNotifyDisconnect" 100 | 101 | #ifndef I2N 102 | #define I2N(x) [NSNumber numberWithInt:x] 103 | #define F2N(x) [NSNumber numberWithFloat:x] 104 | #define L2N(x) [NSNumber numberWithInteger:x] 105 | 106 | #define I2S(x) [I2N(x) stringValue] 107 | #define F2S(x) [F2N(x) stringValue] 108 | #define L2S(x) [L2N(x) stringValue] 109 | #endif 110 | 111 | typedef NS_OPTIONS(NSUInteger, BrtSupports) { 112 | BrtSupportsCC254x = 1 << 0,//TI系列 113 | BrtSupportsNordic = 1 << 1,//Nordic系列 114 | BrtSupportsLight = 1 << 2,//光感支持 115 | BrtSupportsCombineCharacteristic = 1 << 3,//组合特征 116 | BrtSupportsAntiLose = 1 << 4,//已废弃,防丢器 117 | BrtSupports16Key = 1 << 5,//加密模式 118 | BrtSupportsUpdateName = 1 << 6,//设备名轮播 119 | BrtSupportsAli = 1 << 7,//已废弃,替换为eddystone 120 | BrtSupportsEddystone = BrtSupportsAli,//Google Eddystone协议 121 | BrtSupportsSerialData = 1 << 8,//串口数据收发 122 | BrtSupportsAdvRFOff = 1 << 9,//广播频点配置 123 | BrtSupportsUserData = 1 << 10,//广播自定义数据 124 | BrtSupportsExtension = 1 << 11,//自定义扩展 125 | BrtSupportsEncrypt = 1 << 12,//广播加密 126 | BrtSupportsAB = 1 << 13//AB芯片 127 | }; 128 | 129 | typedef NS_ENUM(NSInteger,DevelopPublishMode) 130 | { 131 | DevelopMode=0, //开发模式 132 | PublishMode, //部署模式 133 | }; 134 | 135 | typedef NS_ENUM(NSInteger,BroadcastMode) 136 | { 137 | Broadcast_iBeacon_Only=0, //只广播iBeacon 0 0 x 138 | Broadcast_eddystone_Uid_Only=2, //只广播Uid 0 1 0 139 | Broadcast_eddystone_Url_Only=3, //只广播Url 0 1 1 140 | Broadcast_iBeacon_eddystone_Uid=4,//广播iBeacon 和Uid 1 0 0 141 | Broadcast_iBeacon_eddystone_Url=5,//广播iBeacon 和Url 1 0 1 142 | Broadcast_eddystone_Url_Uid=6, //广播Url 和Uid 1 1 x 143 | }; 144 | 145 | typedef NS_ENUM(NSInteger,ErrorCode) 146 | { 147 | ErrorCodeUnKnown = 0, //未知错误(发起连接失败、蓝牙信道拥塞) 148 | CBErrorCode1 = 1, //参数无效 149 | CBErrorCode2 = 2, //指定属性无效 150 | CBErrorCode3 = 3, //设备未连入 151 | CBErrorCode4 = 4, //设备空间资源耗尽 152 | CBErrorCode5 = 5, //操作被取消 153 | CBErrorCode6 = 6, //连接超时 154 | CBErrorCode7 = 7, //设备被断开(连接错误、AppKey不正确) 155 | CBErrorCode8 = 8, //指定的UUID不允许 156 | CBErrorCode9 = 9, //设备正在广播 157 | CBErrorCode10 = 10, //设备连接失败(信号中断等) 158 | 159 | ErrorCode100 = 100, //APP KEY不正确 160 | ErrorCode101 = 101, //未识别的设备(未检测到peripheral或非BrightBeacon设备) 161 | ErrorCode102 = 102, //网络连接失败 162 | ErrorCode103 = 103, //未检测到传感器(读取传感器特征失败) 163 | ErrorCode104 = 104, //未检测到传感器、读取数据有误(读取传感器特征失败) 164 | ErrorCode105 = 105, //当前版本固件不支持更新 165 | ErrorCode106 = 106, //暂无版本更新,或未执行版本检测:checkFirmwareUpdateWithCompletion: 166 | ErrorCode107 = 107, //固件下载失败,请重试 167 | ErrorCode108 = 108, //固件数据有误 168 | ErrorCode109 = 109, //固件更新中断 169 | ErrorCode110 = 110, //unuse 170 | } ; 171 | 172 | typedef void(^BRTCompletionBlock)(BOOL complete, NSError* error); 173 | typedef void (^BRTDataCompletionBlock)(id data,NSError *error); 174 | 175 | 176 | //////////////////////////////////////////////////////////////////// 177 | // Interface definition 178 | 179 | @interface BRTBeaconDefinitions : NSObject 180 | 181 | @end 182 | -------------------------------------------------------------------------------- /BrightSDK/include/BRTBeaconManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // BRTBeaconManager.h 3 | // BrightSDK 4 | // 5 | // Version : 1.0.0 6 | // Created by Bright Beacon on 19/04/14. 7 | // Copyright (c) 2014 Bright. All rights reserved. 8 | // 9 | 10 | #import 11 | #import 12 | #import 13 | 14 | @class BRTBeaconRegion; 15 | @class BRTBeacon; 16 | @class BRTBeaconManager; 17 | 18 | /** 19 | 20 | BRTBeaconManagerDelegate协议定义了区域监听回调方法来响应关联的事件,必须在随APP启动的指定类中(如:AppDelegate)实现,否则无法后台响应区域监听回调事件. 21 | */ 22 | 23 | @protocol BRTBeaconRegionDelegate 24 | 25 | /** 26 | * 需要在随APP启动的指定类中(如:AppDelegate)实现,区域监听自动启动APP,才能回调成功到指定类中事件 27 | * 28 | * 区域监听失败触发的回调方法,以及关联的错误信息 29 | * 30 | * @param manager Beacon 管理器 31 | * @param region Beacon 区域 32 | * @param error 错误信息 33 | * 34 | */ 35 | -(void)beaconManager:(BRTBeaconManager *)manager 36 | monitoringDidFailForRegion:(BRTBeaconRegion *)region 37 | withError:(NSError *)error; 38 | /** 39 | * 需要在随APP启动的指定类中(如:AppDelegate)实现,区域监听自动启动APP,才能回调成功到指定类中事件 40 | * 41 | * 在区域监听中,iOS设备进入beacon设备区域触发该方法 42 | * 43 | * @param manager Beacon 管理器 44 | * @param region Beacon 区域 45 | * 46 | */ 47 | -(void)beaconManager:(BRTBeaconManager *)manager 48 | didEnterRegion:(BRTBeaconRegion *)region; 49 | 50 | 51 | /** 52 | * 需要在随APP启动的指定类中(如:AppDelegate)实现,区域监听自动启动APP,才能回调成功到指定类中事件 53 | * 54 | * 在区域监听中,iOS设备离开beacon设备区域触发该方法 55 | * 56 | * @param manager Beacon 管理器 57 | * @param region Beacon 区域 58 | * 59 | */ 60 | -(void)beaconManager:(BRTBeaconManager *)manager 61 | didExitRegion:(BRTBeaconRegion *)region; 62 | 63 | /** 64 | * 需要在随APP启动的指定类中(如:AppDelegate)实现,区域监听自动启动APP,才能回调成功到指定类中事件 65 | * 66 | * 在调用startMonitoringForRegion:方法,当beacon区域状态变化会触发该方法 67 | * 68 | * @param manager Beacon 管理器 69 | * @param state Beacon 区域状态 70 | * @param region Beacon 区域 71 | * 72 | */ 73 | -(void)beaconManager:(BRTBeaconManager *)manager 74 | didDetermineState:(CLRegionState)state 75 | forRegion:(BRTBeaconRegion *)region; 76 | 77 | /** 78 | * 当设备模拟iBeacon广播信息,调用该方法. 79 | * 80 | * @param manager Beacon 管理器 81 | * @param error 错误描述信息 82 | * 83 | */ 84 | -(void)beaconManagerDidStartAdvertising:(BRTBeaconManager *)manager 85 | error:(NSError *)error; 86 | 87 | 88 | @end 89 | 90 | 91 | /** 92 | 93 | BRTBeaconManagerDelegate协议定义了回调方法来响应关联的事件. 94 | */ 95 | 96 | @protocol BRTBeaconManagerDelegate 97 | 98 | @optional 99 | 100 | 101 | /** 102 | 蓝牙开关状态监听回调 103 | 104 | @param state 蓝牙管理器状态 105 | */ 106 | - (void)beaconManagerDidUpdateState:(CBManagerState)state; 107 | 108 | /** 109 | 定位权限状态回调 110 | 111 | @param status 定位管理器权限状态 112 | */ 113 | - (void)locationManagerAuthorStatus:(CLAuthorizationStatus)status; 114 | 115 | /** 116 | * 范围扫描触发的回调方法 117 | * 检索出所有的beacon设备,每个设备都是一个CLBeacon实例. 118 | * 119 | * @param manager Beacon 管理器 120 | * @param beacons 所有的beacon设备,即CLBeacon实体 121 | * @param region Beacon 区域 122 | * 123 | */ 124 | - (void)beaconManager:(BRTBeaconManager *)manager 125 | didRangeBeacons:(NSArray *)beacons 126 | inRegion:(BRTBeaconRegion *)region; 127 | 128 | /** 129 | * 范围扫描失败触发的回调方法,已经关联的错误信息 130 | * 131 | * @param manager Beacon 管理器 132 | * @param region Beacon 区域 133 | * @param error 错误信息 134 | * 135 | */ 136 | -(void)beaconManager:(BRTBeaconManager *)manager 137 | rangingBeaconsDidFailForRegion:(BRTBeaconRegion *)region 138 | withError:(NSError *)error; 139 | 140 | /** 141 | * 在该区域使用CoreBluetooth framework发现BRTBeacon将回调该方法 142 | * 143 | * @param manager Beacon 管理器 144 | * @param beacon BRTBeacon 实体 145 | * 146 | */ 147 | - (void)beaconManager:(BRTBeaconManager *)manager 148 | didDiscoverBeacon:(BRTBeacon *)beacon; 149 | 150 | /** 151 | * 当使用CoreBluetooth扫描产生错误回调该方法 152 | * 153 | * @param manager Beacon 管理器 154 | * 155 | */ 156 | - (void)beaconManagerDidFailDiscovery:(BRTBeaconManager *)manager; 157 | 158 | @end 159 | 160 | /** 161 | 162 | BRTBeaconManager 类定义了操作Beacon、配置Bright Beacon,以及获取相关事件通知应用程序的接口。使用本类的实例来建立参数描述每个Beacon设备,你也可以检索范围内所有的beacon设备。 163 | 164 | 一个管理器提供支持以下位置相关的活动: 165 | 166 | * 监测不同感兴趣的区域和生成定位事件当用户进入或离开这些区域(在后台模式)。 167 | * 提供范围附近的Beacon设备和它的距离。 168 | 169 | */ 170 | 171 | @interface BRTBeaconManager : NSObject 172 | 173 | @property (nonatomic, weak) id delegate; 174 | @property (nonatomic, weak) id regionDelegate; 175 | 176 | @property (nonatomic,readonly) CBCentralManager *centralManager; 177 | @property (nonatomic,readonly) CLLocationManager *locManager; 178 | @property (nonatomic,readonly) CBPeripheralManager *peripheralManager; 179 | 180 | @property (nonatomic,assign) CLLocationCoordinate2D userCoordinate; 181 | @property (nonatomic,strong) CLPlacemark *userPlacemark; 182 | 183 | /* 184 | * monitoredRegions 185 | * 186 | * 目前监测的所有区域。 187 | */ 188 | - (NSSet*)monitoredRegions; 189 | 190 | /** 191 | * rangedRegions 192 | * 193 | * 目前检测到正活跃的区域 194 | * @return NSSet 195 | */ 196 | - (NSSet*)rangedRegions; 197 | 198 | /// @name CoreLocation based iBeacon monitoring and ranging methods 199 | 200 | /** 201 | * 范围扫描所有的可见的Beacon设备. 202 | * 检索Beacon设备,通过回调函数beaconManager:didRangeBeacons:inRegion: 203 | * 返回一个NSArray包含的 204 | * BRTBeacon 对象。 205 | * 206 | * @param region bright beacon 区域 207 | * 208 | */ 209 | -(void)startRangingBeaconsInRegion:(BRTBeaconRegion*)region API_AVAILABLE(ios(7.0)); 210 | 211 | /** 212 | * 开始监测区域Start monitoring for particular region. 213 | * 该功能在后台也能够工作.(需要定位权限始终并打开蓝牙) 214 | * 只要你进入或者离开区域,都会回调: beaconManager:didEnterRegtion: 215 | * 或 beaconManager:didExitRegion: 216 | * 217 | * @param region bright beacon 区域 218 | * 219 | */ 220 | -(void)startMonitoringForRegion:(BRTBeaconRegion*)region API_AVAILABLE(ios(7.0)); 221 | 222 | /** 223 | * 停止范围扫描beacon设备. 224 | * 225 | * @param region beacon 区域 226 | * 227 | */ 228 | -(void)stopRangingBeaconsInRegion:(BRTBeaconRegion*)region API_AVAILABLE(ios(7.0)); 229 | 230 | /** 231 | * 注销程序iOS区域检测 232 | * 233 | * @param region Bright beacon region 234 | * 235 | */ 236 | -(void)stopMonitoringForRegion:(BRTBeaconRegion *)region API_AVAILABLE(ios(7.0)); 237 | 238 | /** 239 | * 允许为特定区域验证当前状态 240 | * 241 | * @param region Bright beacon 区域 242 | * 243 | */ 244 | -(void)requestStateForRegion:(BRTBeaconRegion *)region API_AVAILABLE(ios(7.0)); 245 | 246 | /// @name 转换设备为 iBeacon 247 | 248 | /** 249 | * 设备模拟成 iBeacon.使用此方法必须保持程序一直在前台运行。可以使用检测状态[[BRTBeaconSDK BRTBeaconManager] isAdvertising] 250 | * 251 | * @param proximityUUID beacon设备UUID值 252 | * @param major beacon设备major值 253 | * @param minor beacon设备minor值 254 | * @param identifier 唯一的区域标识 255 | * @param power 测量功率(1米处的RSSI值) 256 | * 257 | */ 258 | -(void)startAdvertisingWithProximityUUID:(NSUUID *)proximityUUID 259 | major:(CLBeaconMajorValue)major 260 | minor:(CLBeaconMinorValue)minor 261 | identifier:(NSString*)identifier 262 | power:(NSNumber *)power; 263 | /** 264 | * 是否正在模拟beacon广播 265 | * 266 | */ 267 | -(BOOL)isAdvertising; 268 | 269 | /** 270 | * 停止模拟beacon广播 271 | * 272 | */ 273 | -(void)stopAdvertising; 274 | 275 | 276 | /// @name 基于蓝牙CoreBluetooth方法 277 | 278 | 279 | /** 280 | * 开始蓝牙扫描,基于CoreBluetooth framework. 该方法用于扫描对应服务的蓝牙设备. 281 | * 282 | * @prama services 蓝牙广播服务 283 | */ 284 | -(void)scanBleServices:(NSArray *)services; 285 | 286 | 287 | /** 288 | * 停止蓝牙扫描. 289 | * 290 | */ 291 | -(void)stopScan; 292 | 293 | /** 294 | * 获取定位权限:允许后台定位,可以支持后台区域推送,网络数据传输等 295 | */ 296 | - (void)requestAlwaysAuthorization; 297 | 298 | /** 299 | * 获取定位权限:只允许APP运行期间定位,不支持后台区域感知 300 | */ 301 | - (void)requestWhenInUseAuthorization; 302 | 303 | /** 304 | * 获取用户位置信息 305 | * 306 | * @param location 当前位置信息 307 | * @param placemark 反转之后的地址信息 308 | * @param error 错误信息 309 | */ 310 | typedef void(^locBlock)(CLLocation *location, CLPlacemark *placemark, NSError *error); 311 | /** 312 | * 开始获取用户GPS 313 | * 314 | * @param block GPS 315 | */ 316 | - (void)startUpdateLocations:(locBlock)block; 317 | /** 318 | * 停止获取定位 319 | */ 320 | - (void)stopUpdatingLocation; 321 | 322 | @end 323 | 324 | -------------------------------------------------------------------------------- /BrightSDK/include/BRTBeaconRegion.h: -------------------------------------------------------------------------------- 1 | // 2 | // BRTBeaconRegion.h 3 | // BrightSDK 4 | // 5 | // Version : 1.0.0 6 | // Created by Bright Beacon on 20/04/14. 7 | // Copyright (c) 2014 Bright. All rights reserved. 8 | // 9 | 10 | #import 11 | #import 12 | 13 | 14 | 15 | /** 16 | 17 | BRTBeaconRegion定义了一类区域,是基于蓝牙设备,而不是一个地理位置。beacon区域寻找设备的识别信息匹配您提供的信息,当一个设备范围,该区域触发一个适当的通知 18 | 19 | 您可以监视信标区域在两个方面。设备进入或退出时接收通知附近的beacon,使用startMonitoringForRegion:你的位置管理器对象的方法。当beacon在范围内,你也可以调用startRangingBeaconsInRegion:方法开始时接收通知的相对的距离变化. 20 | 21 | BRTBeaconRegion 扩展了基本的CLBeaconRegion类(IOS13及以上已使用了initWithUUID:)。 22 | 23 | */ 24 | @interface BRTBeaconRegion : CLBeaconRegion 25 | 26 | /* 27 | * initWithProximityUUID:identifier: 28 | * 29 | * Discussion: 30 | * Initialize a beacon region with a UUID. Major and minor values will be wildcarded. 31 | * 32 | */ 33 | - (instancetype)initWithProximityUUID:(NSUUID *)uuid identifier:(NSString *)identifier API_AVAILABLE(ios(7.0)); 34 | 35 | /* 36 | * initWithProximityUUID:major:identifier: 37 | * 38 | * Discussion: 39 | * Initialize a beacon region with a UUID and major value. Minor value will be wildcarded. 40 | * 41 | */ 42 | - (instancetype)initWithProximityUUID:(NSUUID *)uuid major:(CLBeaconMajorValue)major identifier:(NSString *)identifier API_AVAILABLE(ios(7.0)); 43 | 44 | /* 45 | * initWithProximityUUID:major:minor:identifier: 46 | * 47 | * Discussion: 48 | * Initialize a beacon region identified by a UUID, major and minor values. 49 | * 50 | */ 51 | - (instancetype)initWithProximityUUID:(NSUUID *)uuid major:(CLBeaconMajorValue)major minor:(CLBeaconMinorValue)minor identifier:(NSString *)identifier API_AVAILABLE(ios(7.0)); 52 | @end 53 | -------------------------------------------------------------------------------- /BrightSDK/include/BRTBeaconSDK.h: -------------------------------------------------------------------------------- 1 | // 2 | // BRTBeaconSDK.h 3 | // BrightSDK 4 | // 5 | // Created by thomasho on 14-6-19. 6 | // Copyright (c) 2014年 thomasho. All rights reserved. 7 | // 8 | #import "BRTBeaconManager.h" 9 | #import "BRTBeaconRegion.h" 10 | #import "BRTBeacon.h" 11 | #import "BRTTools.h" 12 | 13 | //////////////////////////////////////////////////////////////////// 14 | // Type and class definitions 15 | 16 | typedef void(^ScanBlesCompletionBlock)(NSArray* beacons,NSError* error); 17 | typedef void(^RangingiBeaconsCompletionBlock)(NSArray* beacons, BRTBeaconRegion* region, NSError* error); 18 | 19 | //////////////////////////////////////////////////////////////////// 20 | // Interface definition 21 | 22 | /** 23 | 24 | * BRTBeaconSDK类定义了快捷操作BrightBeacon方法,如需自定义或使用回调方式,请直接使用BRTBeaconManager 25 | * 26 | * IOS8.0以后,至少需在plist配置普通定位权限描述:NSLocationWhenInUseUsageDescription 27 | * 28 | * 如需最高权限,额外添加以下2个描述。 29 | * IOS8.0~IOS9.0,更高权限需添加:NSLocationAlwaysUsageDescription 30 | * IOS10.0以后,更高权限需添加:NSLocationAlwaysAndWhenInUseUsageDescription 31 | * 使用[CLLocationManager authorizationStatus]获取定位状态 32 | */ 33 | 34 | @interface BRTBeaconSDK : NSObject 35 | 36 | /** 37 | * 单例 38 | */ 39 | + (BRTBeaconSDK*) Share; 40 | 41 | 42 | /// @name beacon快捷扫描BrightBeacon相关的方法 43 | 44 | /** 45 | * 注册并验证开发者appKey,申请地址:http://open.brtbeacon.com 46 | * 47 | * @param appKey BrightBeacon AppKey 48 | * @param completion 验证appKey有效性状态,用于设备连接 49 | * 50 | */ 51 | + (void)registerApp:(NSString *)appKey onCompletion:(BRTCompletionBlock)completion; 52 | 53 | 54 | /** 55 | 设置超时移除BrightBeacon时间,与硬件发射频率设置配合,默认3s未收到信号移除; 56 | 57 | @param invalidTime beacon信号丢失移除间隔 58 | */ 59 | + (void)setInvalidTime:(NSTimeInterval)invalidTime; 60 | 61 | 62 | /** 63 | 调节扫描BrightBeacon返回调用频率,默认1s 64 | 65 | @param scanResponseTime block回调间隔 66 | */ 67 | + (void)setScanResponseTime:(NSTimeInterval)scanResponseTime; 68 | 69 | /** 70 | * BrightBeacon管理类,控制Beacon扫描、蓝牙扫描、区域检测、本地消息提醒 71 | * 72 | * @return BRTBeaconManager 73 | */ 74 | + (BRTBeaconManager*) BRTBeaconManager; 75 | 76 | /** 77 | * BrightBeacon设备数组 78 | * 79 | * @return NSSet 80 | */ 81 | + (NSSet *)brtBeacons; 82 | 83 | 84 | /** 85 | * 扫描BrightBeacon蓝牙设备(支持蓝牙连接读取参数,支持获取BrightBeacon额外参数,不需要定位权限,广播数据中无法获取设备UUID) 86 | * 87 | * @param services 蓝牙广播服务特征,默认为nil,扫描所有服务,不支持后台扫描。(BrightBeacon包含@[[CBUUID UUIDWithString:@"180a"]] 特征) 88 | * @param completion 蓝牙扫描回调(默认1秒/次) 89 | * 90 | */ 91 | 92 | + (void) scanBleServices:(NSArray *)services onCompletion:(ScanBlesCompletionBlock)completion NS_AVAILABLE_IOS(6_0); 93 | 94 | 95 | /** 96 | 停止扫描BrightBeacon蓝牙设备 97 | */ 98 | + (void) stopScan; 99 | 100 | /** 101 | * 扫描iBeacon设备(需要定位权限,不支持蓝牙连接,仅能获取iBeacon参数:参见CLBeacon),IOS7以上,感知对应UUID的iBeacon设备 102 | * @param regions 区域数组 103 | * @param completion iBeacon扫描回调(1秒/次) 104 | * 105 | */ 106 | + (void) startRangingBeaconsInRegions:(NSArray *)regions onCompletion:(RangingiBeaconsCompletionBlock)completion NS_AVAILABLE_IOS(7_0); 107 | 108 | /** 109 | * 停止扫描iBeacon设备 110 | * 111 | */ 112 | + (void) stopRangingBeacons; 113 | 114 | /** 115 | * 116 | *用于初始化接收后台区域监听回调类,此函数以及handler实体类都必须是与AppDelegate随同启动,否则无法接收到后台beacon推送 117 | * 118 | * 以下是在后台监听区域的回调函数,请拷贝需要的回调到AppDelegate或对应的handler类 119 | *
监听失败回调 120 | *
-(void)beaconManager:(BRTBeaconManager *)manager monitoringDidFailForRegion:(BRTBeaconRegion *)region withError:(NSError *)error; 121 | *
进入区域回调 122 | *
-(void)beaconManager:(BRTBeaconManager *)manager didEnterRegion:(BRTBeaconRegion *)region; 123 | *
离开区域回调 124 | *
-(void)beaconManager:(BRTBeaconManager *)manager didExitRegion:(BRTBeaconRegion *)region; 125 | *
锁屏区域检测、requestStateForRegions回调 126 | *
-(void)beaconManager:(BRTBeaconManager *)manager didDetermineState:(CLRegionState)state forRegion:(BRTBeaconRegion *)region; 127 | *
模拟iBeacon回调 128 | *
- (void)peripheralManagerDidStartAdvertising:(CBPeripheralManager *)peripheral error:(NSError *)error; 129 | * 130 | * @param handler 用于接收后台区域监听回调函数的类。传入的handler类用作接收回调(该类务必随程序的启动即初始化,否则无法接收到回调,默认handler为AppDelegate) 131 | * 132 | */ 133 | + (void)regionHander:(id)handler; 134 | 135 | /** 136 | * 请求监听状态,仅支持IOS7以上,IOS6始终返回nil 137 | * 138 | * @param dict 需要请求的区域标识,uuid必须传人,major或minor按实际情况选传 示例:{uuid:...,major:@0} 139 | * 140 | * @return 区域监听状态 nil为无监听 示例:{in:@YES,out:@NO,display:@YES} 141 | */ 142 | + (NSDictionary*)isMonitoring:(NSDictionary*)dict NS_AVAILABLE_IOS(7_0); 143 | 144 | /** 145 | * 开启区域监听要求IOS7以上系统; 146 | * 如果需要程序退出后持续监听,需要提醒用户打开位置权限->始终;并需在AppDelegate启动时调用{@link regionHandler:} 147 | * IOS8另需请求允许后台定位,requestAlwaysAuthorization 148 | * 检查状态:CLLocationManager.authorizationStatus==kCLAuthorizationStatusAuthorizedAlways. 149 | * 注:SDK默认只请求一直定位,可以通过BRTBeaconDefinitions.h中isLocationAlways来配置 150 | * 151 | * 状态会默认回调到appDelegate中(或自定义的handler中{@link regionHandler:}): 152 | *
-(void)beaconManager:(BRTBeaconManager *)manager didEnterRegion:(BRTBeaconRegion *)region; 153 | * 154 | *
-(void)beaconManager:(BRTBeaconManager *)manager didExitRegion:(BRTBeaconRegion *)region; 155 | * 156 | *
-(void)beaconManager:(BRTBeaconManager *)manager didDetermineState:(CLRegionState)state forRegion:(BRTBeaconRegion *)region; 157 | * 158 | * @param regions @[region1,region2] 159 | * 160 | */ 161 | + (void) startMonitoringForRegions:(NSArray *)regions NS_AVAILABLE_IOS(7_0); 162 | 163 | /** 164 | * 立即查询是否位于指定区域;状态会回调到appDelegate中: 165 | * 166 | *-(void)beaconManager:(BRTBeaconManager *)manager didDetermineState:(CLRegionState)state forRegion:(BRTBeaconRegion *)region; 167 | * 168 | * @param regions @[region1,region2] 169 | * 170 | */ 171 | + (void) requestStateForRegions:(NSArray *)regions NS_AVAILABLE_IOS(7_0); 172 | 173 | /** 174 | * 停止扫描、监测,if(regions==nil)停止所有当前监听区域 175 | * 176 | * @param regions @[region1,region2] 177 | * 178 | */ 179 | + (void) stopMonitoringForRegions:(NSArray *)regions; 180 | 181 | @end 182 | -------------------------------------------------------------------------------- /BrightSDK/include/BRTTools.h: -------------------------------------------------------------------------------- 1 | // 2 | // BRTTools.h 3 | // BrightSDK 4 | // 5 | // Created by thomasho on 16/9/18. 6 | // Copyright © 2016年 thomasho. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #define subString(str,loc,len) [str substringWithRange:NSMakeRange(loc, len)] 12 | 13 | @class CBUUID; 14 | @interface BRTTools : NSObject 15 | 16 | + (NSData *)hex2data:(NSString *)hex; 17 | + (NSString *)data2hex:(NSData *)data; 18 | + (NSString *)data2UTF8:(NSData *)data; 19 | 20 | //小端模式(little-endian) 0x0100 = 0001 21 | + (int32_t)data2Integer:(NSData *)data; 22 | + (NSData *)integer2data:(int32_t )value; 23 | + (NSData *)uinteger2data:(uint32_t )value; 24 | 25 | + (NSString *)toString:(CBUUID *)uuid; 26 | 27 | + (NSData *)number2leftPaddingZeroData:(NSNumber *)number withSize:(NSInteger)size; 28 | + (NSData *)hex2leftPaddingZeroData:(NSString *)data withSize:(NSInteger)size; 29 | 30 | /** 31 | * 转换Url为eddystone模式NSData 32 | * 参考:https://github.com/google/eddystone/tree/master/eddystone-url 33 | * 34 | * @param url 例(https://www.brtbeacon.com)->() 35 | * 36 | * @return NSData 37 | */ 38 | + (NSData *)eddystoneFromUrl:(NSString *)url; 39 | 40 | /** 41 | * 将eddystone模式下的Url字符串转换为普通url 42 | * 43 | * @param eddystoneUrl eddystone-URL字符串 44 | * 45 | * @return NSString 46 | */ 47 | + (NSString *)urlFromEddystone:(NSString *)eddyUrl; 48 | 49 | /** 50 | 距离估算方法,用于衡量不同设备距离差值,相对实际距离可能有误差 51 | 52 | @param rssi 接收信号强度 53 | @param mpower 1米处信号强度 54 | @return 估算距离值 55 | */ 56 | + (double)distanceByRssi:(NSInteger)rssi oneMeterRssi:(NSInteger)mpower; 57 | @end 58 | -------------------------------------------------------------------------------- /BrightSDK/include/CBeacon.h: -------------------------------------------------------------------------------- 1 | // 2 | // BrightC.h 3 | // BrightSDK 4 | // 5 | // Created by thomasho on 16/1/13. 6 | // Copyright © 2016年 thomasho. All rights reserved. 7 | // 8 | 9 | #ifndef CBright_h 10 | #define CBright_h 11 | 12 | #define CBDataLen 23 13 | typedef enum : int 14 | { 15 | CB_Service=0, 16 | CB_RWData, 17 | CB_RData 18 | } CB_IBeacon; 19 | 20 | #define CB_SERVICE_IBeacon(x) [NSString stringWithFormat:@"E24BF79%d-334A-4F2B-AFA5-A5C960C29C06",x] 21 | 22 | #endif /* BrightC_h */ 23 | -------------------------------------------------------------------------------- /BrightSDK/include/OpenUDIDIOS7.h: -------------------------------------------------------------------------------- 1 | // 2 | // OpenUDID.h 3 | // openudid 4 | // 5 | // initiated by Yann Lechelle (cofounder @Appsfire) on 8/28/11. 6 | // Copyright 2011 OpenUDID.org 7 | // 8 | // Main branches 9 | // iOS code: https://github.com/ylechelle/OpenUDID 10 | // 11 | 12 | /* 13 | !!! IMPORTANT !!! 14 | 15 | IF YOU ARE GOING TO INTEGRATE OpenUDID INSIDE A (STATIC) LIBRARY, 16 | PLEASE MAKE SURE YOU REFACTOR THE OpenUDID CLASS WITH A PREFIX OF YOUR OWN, 17 | E.G. ACME_OpenUDID. THIS WILL AVOID CONFUSION BY DEVELOPERS WHO ARE ALSO 18 | USING OpenUDID IN THEIR OWN CODE. 19 | 20 | !!! IMPORTANT !!! 21 | 22 | */ 23 | 24 | /* 25 | http://en.wikipedia.org/wiki/Zlib_License 26 | 27 | This software is provided 'as-is', without any express or implied 28 | warranty. In no event will the authors be held liable for any damages 29 | arising from the use of this software. 30 | 31 | Permission is granted to anyone to use this software for any purpose, 32 | including commercial applications, and to alter it and redistribute it 33 | freely, subject to the following restrictions: 34 | 35 | 1. The origin of this software must not be misrepresented; you must not 36 | claim that you wrote the original software. If you use this software 37 | in a product, an acknowledgment in the product documentation would be 38 | appreciated but is not required. 39 | 40 | 2. Altered source versions must be plainly marked as such, and must not be 41 | misrepresented as being the original software. 42 | 43 | 3. This notice may not be removed or altered from any source 44 | distribution. 45 | */ 46 | 47 | #import 48 | 49 | // 50 | // Usage: 51 | // #include "OpenUDID.h" 52 | // NSString* openUDID = [OpenUDID value]; 53 | // 54 | 55 | #define kOpenUDIDErrorNone 0 56 | #define kOpenUDIDErrorOptedOut 1 57 | #define kOpenUDIDErrorCompromised 2 58 | #define kOpenUDIDErrorMultiple 3 59 | 60 | @interface OpenUDIDIOS7 : NSObject { 61 | } 62 | + (NSString*) value; 63 | + (NSString*) valueWithError:(NSError**)error; 64 | + (void) setOptOut:(BOOL)optOutValue; 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /BrightSDK/libBrightSDK.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_iOS_SDK/fa3459eb71d7bad33e9cdda261c3ebe9b5aaef6a/BrightSDK/libBrightSDK.a -------------------------------------------------------------------------------- /Demo/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_iOS_SDK/fa3459eb71d7bad33e9cdda261c3ebe9b5aaef6a/Demo/.DS_Store -------------------------------------------------------------------------------- /Demo/Demo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Demo/Demo.xcodeproj/project.xcworkspace/xcshareddata/Demo.xcscmblueprint: -------------------------------------------------------------------------------- 1 | { 2 | "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "354F6BD7A201C120CD861E2C39395155A916CDFB", 3 | "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { 4 | 5 | }, 6 | "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { 7 | "B155FC082677C5D95CE47F8D36B25CEF93F8E8F7" : 9223372036854775807, 8 | "354F6BD7A201C120CD861E2C39395155A916CDFB" : 9223372036854775807 9 | }, 10 | "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "590AE748-B565-4665-B769-78097EABFC74", 11 | "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { 12 | "B155FC082677C5D95CE47F8D36B25CEF93F8E8F7" : "..\/..\/works\/git\/BrightSDK", 13 | "354F6BD7A201C120CD861E2C39395155A916CDFB" : "BrightBeacon_iOS_SDK\/" 14 | }, 15 | "DVTSourceControlWorkspaceBlueprintNameKey" : "Demo", 16 | "DVTSourceControlWorkspaceBlueprintVersion" : 204, 17 | "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "Demo\/Demo.xcodeproj", 18 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ 19 | { 20 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/BrightBeacon\/BrightBeacon_iOS_SDK.git", 21 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 22 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "354F6BD7A201C120CD861E2C39395155A916CDFB" 23 | }, 24 | { 25 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/git.oschina.net\/thomasho\/BrightSDK.git", 26 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 27 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "B155FC082677C5D95CE47F8D36B25CEF93F8E8F7" 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /Demo/Demo.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Demo/Demo.xcodeproj/project.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_iOS_SDK/fa3459eb71d7bad33e9cdda261c3ebe9b5aaef6a/Demo/Demo.xcodeproj/project.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Demo/Demo.xcodeproj/project.xcworkspace/xcuserdata/hetao.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_iOS_SDK/fa3459eb71d7bad33e9cdda261c3ebe9b5aaef6a/Demo/Demo.xcodeproj/project.xcworkspace/xcuserdata/hetao.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Demo/Demo.xcodeproj/project.xcworkspace/xcuserdata/thomasho.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_iOS_SDK/fa3459eb71d7bad33e9cdda261c3ebe9b5aaef6a/Demo/Demo.xcodeproj/project.xcworkspace/xcuserdata/thomasho.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /Demo/Demo.xcodeproj/xcuserdata/apple.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Demo.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Demo/Demo.xcodeproj/xcuserdata/hetao.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 9 | 21 | 22 | 23 | 25 | 37 | 38 | 39 | 41 | 53 | 54 | 55 | 57 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /Demo/Demo.xcodeproj/xcuserdata/hetao.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Demo.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Demo/Demo.xcodeproj/xcuserdata/thomasho.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 20 | 21 | 22 | 24 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /Demo/Demo.xcodeproj/xcuserdata/thomasho.xcuserdatad/xcschemes/Demo.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Demo/Demo.xcodeproj/xcuserdata/thomasho.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Demo.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 58597D531E60115A00D1CF23 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Demo/Demo/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_iOS_SDK/fa3459eb71d7bad33e9cdda261c3ebe9b5aaef6a/Demo/Demo/.DS_Store -------------------------------------------------------------------------------- /Demo/Demo/AdjustCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // AdjustCell.h 3 | // Demo 4 | // 5 | // Created by thomasho on 17/3/8. 6 | // Copyright © 2017年 brightbeacon. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AdjustCell : UITableViewCell 12 | 13 | @property (nonatomic,weak) IBOutlet UILabel *lblName; 14 | @property (nonatomic,weak) IBOutlet UILabel *lblMac; 15 | @property (nonatomic,weak) IBOutlet UILabel *lblRSSI; 16 | @property (nonatomic,weak) IBOutlet UILabel *lblTimes; 17 | 18 | - (void)startAnimating; 19 | - (void)stopAnimating; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Demo/Demo/AdjustCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // AdjustCell.m 3 | // Demo 4 | // 5 | // Created by thomasho on 17/3/8. 6 | // Copyright © 2017年 brightbeacon. All rights reserved. 7 | // 8 | 9 | #import "AdjustCell.h" 10 | 11 | @interface AdjustCell () 12 | 13 | @property (nonatomic,weak) IBOutlet UIActivityIndicatorView *ActivityIndicator; 14 | 15 | @end 16 | 17 | @implementation AdjustCell 18 | 19 | - (void)awakeFromNib { 20 | [super awakeFromNib]; 21 | // Initialization code 22 | } 23 | 24 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 25 | [super setSelected:selected animated:animated]; 26 | 27 | // Configure the view for the selected state 28 | } 29 | 30 | - (void)startAnimating { 31 | self.ActivityIndicator.hidden = NO; 32 | [self.ActivityIndicator startAnimating]; 33 | } 34 | 35 | - (void)stopAnimating { 36 | self.ActivityIndicator.hidden = YES; 37 | [self.ActivityIndicator stopAnimating]; 38 | } 39 | @end 40 | -------------------------------------------------------------------------------- /Demo/Demo/AdjustCell.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 31 | 37 | 43 | 44 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /Demo/Demo/AdjustVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // AdjustViewController.h 3 | // BRTExample 4 | // 5 | // Created by thomasho on 14-7-31. 6 | // Copyright (c) 2014年 thomasho. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AdjustVC : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Demo/Demo/AdjustVC.m: -------------------------------------------------------------------------------- 1 | // 2 | // AdjustViewController.m 3 | // BRTExample 4 | // 5 | // Created by thomasho on 14-7-31. 6 | // Copyright (c) 2014年 thomasho. All rights reserved. 7 | // 8 | 9 | #import "AdjustVC.h" 10 | #import "BRTBeaconSDK.h" 11 | #import "AdjustCell.h" 12 | 13 | @interface AdjustVC (){ 14 | 15 | BOOL isStarting; 16 | 17 | } 18 | 19 | @property (nonatomic,weak) IBOutlet UISegmentedControl *sgCtlSort; 20 | 21 | @property (nonatomic, strong) NSMutableSet *beaconSet; 22 | @property (nonatomic, strong) NSArray *beaconSorted; 23 | @property (nonatomic,strong) BRTBeacon *brtbeacon; 24 | 25 | @property (assign, nonatomic) NSInteger totalRssi; 26 | @property (assign, nonatomic) NSInteger totalCount; 27 | 28 | @end 29 | 30 | @implementation AdjustVC 31 | 32 | - (void)viewDidLoad { 33 | [super viewDidLoad]; 34 | [self.tableView registerNib:[UINib nibWithNibName:@"AdjustCell" bundle:nil] forCellReuseIdentifier:@"cell"]; 35 | self.refreshControl = [UIRefreshControl new]; 36 | [self.refreshControl addTarget:self action:@selector(scanBeacon) forControlEvents:UIControlEventValueChanged]; 37 | } 38 | 39 | - (void)viewWillDisappear:(BOOL)animated 40 | { 41 | [super viewWillDisappear:animated]; 42 | [BRTBeaconSDK stopScan]; 43 | } 44 | 45 | - (void)viewDidAppear:(BOOL)animated 46 | { 47 | [super viewDidAppear:animated]; 48 | self.beaconSet = [NSMutableSet set]; 49 | [self scanBeacon]; 50 | } 51 | 52 | - (void)scanBeacon 53 | { 54 | [self.refreshControl endRefreshing]; 55 | [BRTBeaconSDK setInvalidTime:1]; 56 | [BRTBeaconSDK setScanResponseTime:1]; 57 | [BRTBeaconSDK scanBleServices:nil onCompletion:^(NSArray *beacons, NSError *error){ 58 | [self.beaconSet addObjectsFromArray:beacons]; 59 | if (isStarting) { 60 | [self beaconAdjust:beacons]; 61 | } 62 | [self sgValueChanged:self.sgCtlSort]; 63 | }]; 64 | } 65 | 66 | - (IBAction)sgValueChanged:(UISegmentedControl*)sender 67 | { 68 | if (sender.selectedSegmentIndex) { 69 | NSSortDescriptor *sortMajor = [NSSortDescriptor sortDescriptorWithKey:@"major" ascending:NO]; 70 | NSSortDescriptor *sortMinor = [NSSortDescriptor sortDescriptorWithKey:@"minor" ascending:NO]; 71 | self.beaconSorted = [self.beaconSet sortedArrayUsingDescriptors:@[sortMajor,sortMinor]]; 72 | }else{ 73 | NSSortDescriptor *sortRSSI = [NSSortDescriptor sortDescriptorWithKey:@"rssi" ascending:NO]; 74 | self.beaconSorted = [self.beaconSet sortedArrayUsingDescriptors:@[sortRSSI]]; 75 | } 76 | [self.tableView reloadData]; 77 | } 78 | - (void)beaconAdjust:(NSArray *)beacons 79 | { 80 | BRTBeacon *beacon = nil; 81 | for (beacon in beacons) { 82 | if ([beacon.macAddress isEqualToString:self.brtbeacon.macAddress]) { 83 | break; 84 | } 85 | } 86 | NSLog(@"%lf,%ld",beacon.invalidTime,beacon.rssi); 87 | //仅使用最新扫描到的有效rssi 88 | if (beacon.rssi>=0) { 89 | return; 90 | } 91 | self.totalRssi += beacon.rssi; 92 | self.totalCount += 1; 93 | //20次校准一次 94 | if (self.totalCount%20==0) { 95 | isStarting = NO; 96 | CGFloat avgrssi = self.totalRssi/self.totalCount; 97 | NSLog(@"校准测量功率(1米处rssi):%f",avgrssi); 98 | [[BRTBeaconSDK BRTBeaconManager] stopScan]; 99 | if (self.brtbeacon.measuredPower.integerValue != (NSInteger)avgrssi) { 100 | __unsafe_unretained typeof(self) weakself = self; 101 | [self.brtbeacon connectToBeaconWithCompletion:^(BOOL connected, NSError *error) { 102 | if (connected) { 103 | [weakself writeMpower:avgrssi]; 104 | }else{ 105 | [[[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:NSLocalizedString(@"校准失败,连接设备不成功。Er:%ld",nil),(long)error.code] message:nil delegate:self cancelButtonTitle:NSLocalizedString(@"取消",nil) otherButtonTitles:NSLocalizedString(@"重试",nil), nil] show]; 106 | [beacon disconnectBeacon]; 107 | } 108 | }]; 109 | }else{ 110 | //如果计算结果一致,无需写入。 111 | [self disconnect]; 112 | } 113 | } 114 | } 115 | - (void)writeMpower:(NSInteger)mpower 116 | { 117 | __unsafe_unretained typeof(self) weakself = self; 118 | [self.brtbeacon writeBeaconValues:@{B_MEASURED: [NSNumber numberWithInteger:mpower]} withCompletion:^(BOOL complete,NSError *error) { 119 | if (error) { 120 | [[[UIAlertView alloc] initWithTitle:error.domain message:nil delegate:self cancelButtonTitle:NSLocalizedString(@"取消",nil) otherButtonTitles:NSLocalizedString(@"重试",nil), nil] show]; 121 | }else{ 122 | [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"距离校准完成",nil) message:nil delegate:nil cancelButtonTitle:NSLocalizedString(@"确定",nil) otherButtonTitles:nil] show]; 123 | [weakself disconnect]; 124 | } 125 | }]; 126 | } 127 | - (void)disconnect 128 | { 129 | [self.brtbeacon disconnectBeacon]; 130 | [self scanBeacon]; 131 | } 132 | - (void)dealloc 133 | { 134 | 135 | } 136 | 137 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 138 | { 139 | return self.beaconSorted.count; 140 | } 141 | //fix iPad Cell BackGroundColor 142 | - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{ 143 | cell.backgroundColor = [UIColor clearColor]; 144 | } 145 | - (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 146 | { 147 | static NSString *identify = @"cell"; 148 | AdjustCell *cell = [tableView dequeueReusableCellWithIdentifier:identify]; 149 | BRTBeacon *beacon = [self.beaconSorted objectAtIndex:indexPath.row]; 150 | cell.lblName.text = beacon.name; 151 | cell.lblMac.text = [NSString stringWithFormat:@"%@,%@ MAC%@", beacon.major, beacon.minor, beacon.macAddress]; 152 | cell.lblRSSI.text = [NSString stringWithFormat:@"%.2f米", beacon.accuracy]; 153 | if (isStarting&&[beacon isEqual:self.brtbeacon]) { 154 | [cell startAnimating]; 155 | NSInteger remaining = 19 - self.totalCount; 156 | cell.lblTimes.text = remaining==0?@"":[NSString stringWithFormat:@"%ld",19-self.totalCount]; 157 | }else{ 158 | [cell stopAnimating]; 159 | cell.lblTimes.text = @""; 160 | } 161 | return cell; 162 | } 163 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 164 | { 165 | if (isStarting) { 166 | [self.brtbeacon disconnectBeacon]; 167 | self.brtbeacon = nil; 168 | isStarting = NO; 169 | }else{ 170 | self.brtbeacon = self.beaconSorted[indexPath.row]; 171 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"距离校准说明", nil) message:[NSString stringWithFormat:NSLocalizedString(@"请将您的手机静置离'%@'在期望距离1米处,然后点击->开始校准",nil),self.brtbeacon.name] delegate:self cancelButtonTitle:NSLocalizedString(@"取消",nil) otherButtonTitles:NSLocalizedString(@"开始校准",nil), nil]; 172 | alert.tag = indexPath.row+1; 173 | [alert show]; 174 | 175 | } 176 | } 177 | - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex 178 | { 179 | if (buttonIndex!= alertView.cancelButtonIndex) { 180 | isStarting = YES; 181 | self.totalCount = 0; 182 | self.totalRssi = 0; 183 | //兼容重试,需要重新开启扫描 184 | [self scanBeacon]; 185 | } 186 | } 187 | 188 | @end 189 | -------------------------------------------------------------------------------- /Demo/Demo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // Demo 4 | // 5 | // Created by thomasho on 17/2/24. 6 | // Copyright © 2017年 brightbeacon. 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 | -------------------------------------------------------------------------------- /Demo/Demo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // Demo 4 | // 5 | // Created by thomasho on 17/2/24. 6 | // Copyright © 2017年 brightbeacon. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import "BRTBeaconSDK.h" 11 | #import "RegionHander.h" 12 | 13 | @interface AppDelegate () 14 | @property (nonatomic,strong) RegionHander *handler; 15 | @end 16 | 17 | @implementation AppDelegate 18 | 19 | 20 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 21 | // Override point for customization after application launch. 22 | /* APP未启动,点击推送消息的情况下 iOS10遗弃UIApplicationLaunchOptionsLocalNotificationKey, 23 | 使用代理UNUserNotificationCenterDelegate方法didReceiveNotificationResponse:withCompletionHandler:获取本地推送 24 | */ 25 | UILocalNotification *notification = launchOptions[UIApplicationLaunchOptionsLocalNotificationKey]; 26 | if (notification) { 27 | NSLog(@"localUserInfo:%@",notification); 28 | //APP未启动,点击推送消息 29 | [self application:application didReceiveLocalNotification:notification]; 30 | } 31 | 32 | //设置appkey,连接、加密设备,后台管理所需 33 | [BRTBeaconSDK registerApp:DEFAULT_KEY onCompletion:^(BOOL complete, NSError *error) { 34 | NSLog(@"注册appKey:%@",error); 35 | }]; 36 | 37 | //如需后台监听区域,必须在随App启动的类中调用regionHander: 38 | //并且hander也必须启动自行初始化,保证监听到区域自启动软件时,能成功回调该类的Region相关函数。 39 | self.handler = [RegionHander new]; 40 | [BRTBeaconSDK regionHander:self.handler]; 41 | 42 | if ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground) { 43 | //后台唤醒APP操作。 44 | } 45 | return YES; 46 | } 47 | 48 | - (void)application:(UIApplication *)application didReceiveLocalNotification:(id)notification { 49 | NSString *className = NSStringFromClass([notification class]); 50 | if ([notification isKindOfClass:[UILocalNotification class]]) { 51 | NSLog(@"IOS9软件运行中,滑动通知内容:%@",notification); 52 | //((UILocalNotification*)notification).userInfo 53 | }else if([className isEqualToString:@"UNNotification"]) { 54 | NSLog(@"IOS10软件运行中,滑动通知内容:%@",notification); 55 | //((UNNotification*)notification).request.content.userInfo 56 | } 57 | } 58 | @end 59 | -------------------------------------------------------------------------------- /Demo/Demo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "scale" : "1x", 46 | "size" : "20x20" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "scale" : "2x", 51 | "size" : "20x20" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "scale" : "1x", 56 | "size" : "29x29" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "scale" : "2x", 61 | "size" : "29x29" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "scale" : "1x", 66 | "size" : "40x40" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "scale" : "2x", 71 | "size" : "40x40" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "scale" : "1x", 76 | "size" : "76x76" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "scale" : "2x", 81 | "size" : "76x76" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "scale" : "2x", 86 | "size" : "83.5x83.5" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "scale" : "1x", 91 | "size" : "1024x1024" 92 | } 93 | ], 94 | "info" : { 95 | "author" : "xcode", 96 | "version" : 1 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /Demo/Demo/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /Demo/Demo/Assets.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "ipad", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "1x" 9 | }, 10 | { 11 | "orientation" : "landscape", 12 | "idiom" : "ipad", 13 | "extent" : "full-screen", 14 | "minimum-system-version" : "7.0", 15 | "scale" : "1x" 16 | }, 17 | { 18 | "orientation" : "portrait", 19 | "idiom" : "ipad", 20 | "extent" : "full-screen", 21 | "minimum-system-version" : "7.0", 22 | "scale" : "2x" 23 | }, 24 | { 25 | "orientation" : "landscape", 26 | "idiom" : "ipad", 27 | "extent" : "full-screen", 28 | "minimum-system-version" : "7.0", 29 | "scale" : "2x" 30 | } 31 | ], 32 | "info" : { 33 | "version" : 1, 34 | "author" : "xcode" 35 | } 36 | } -------------------------------------------------------------------------------- /Demo/Demo/Assets.xcassets/ic_beacon.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "filename" : "ic_beacon@2x.png", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /Demo/Demo/Assets.xcassets/ic_beacon.imageset/ic_beacon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_iOS_SDK/fa3459eb71d7bad33e9cdda261c3ebe9b5aaef6a/Demo/Demo/Assets.xcassets/ic_beacon.imageset/ic_beacon@2x.png -------------------------------------------------------------------------------- /Demo/Demo/Base.lproj/LaunchScreen.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 | -------------------------------------------------------------------------------- /Demo/Demo/BeaconVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // BeaconVC.h 3 | // Demo 4 | // 5 | // Created by thomasho on 17/2/24. 6 | // Copyright © 2017年 brightbeacon. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface BeaconVC : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Demo/Demo/BeaconVC.m: -------------------------------------------------------------------------------- 1 | // 2 | // BeaconVC.m 3 | // Demo 4 | // 5 | // Created by thomasho on 17/2/24. 6 | // Copyright © 2017年 brightbeacon. All rights reserved. 7 | // 8 | 9 | #import "BeaconVC.h" 10 | #import "BRTBeaconSDK.h" 11 | 12 | @interface BeaconVC () 13 | 14 | @property (nonatomic,strong) NSMutableDictionary *dataDict; 15 | 16 | @end 17 | 18 | @implementation BeaconVC 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | 23 | //IOS8.0以后,需在plist配置获得定位权限描述NSLocationAlwaysUsageDescription定位用途提示 24 | if ([CLLocationManager authorizationStatus] <= kCLAuthorizationStatusDenied) { 25 | if ([UIDevice currentDevice].systemVersion.floatValue < 8.0) { 26 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"请打开您的定位" message:nil delegate:nil cancelButtonTitle:@"确定" otherButtonTitles: nil]; 27 | [alert show]; 28 | }else{ 29 | UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"请打开您的定位" message:nil preferredStyle:UIAlertControllerStyleAlert]; 30 | [alertVC addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { 31 | [alertVC dismissViewControllerAnimated:YES completion:nil]; 32 | }]]; 33 | [self presentViewController:alertVC animated:YES completion:nil]; 34 | } 35 | } 36 | 37 | self.dataDict = [NSMutableDictionary dictionary]; 38 | 39 | //智石默认UUID 40 | NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:DEFAULT_UUID]; 41 | BRTBeaconRegion *region = [[BRTBeaconRegion alloc] initWithProximityUUID:uuid identifier:@"test1ID"]; 42 | //测试UUID 43 | NSUUID *uuid3 = [[NSUUID alloc] initWithUUIDString:@"E2C56DB5-DFFB-48D2-B060-D0F5A71096E1"]; 44 | BRTBeaconRegion *region3 = [[BRTBeaconRegion alloc] initWithProximityUUID:uuid3 identifier:@"testxID"]; 45 | 46 | //微信常用UUID 47 | uuid = [[NSUUID alloc] initWithUUIDString:@"FDA50693-A4E2-4FB1-AFCF-C6EB07647825"]; 48 | BRTBeaconRegion *region2 = [[BRTBeaconRegion alloc] initWithProximityUUID:uuid identifier:@"test2ID"]; 49 | 50 | NSArray *regions = @[region,region2,region3]; 51 | if ([CLLocationManager isRangingAvailable]) { 52 | [BRTBeaconSDK startRangingBeaconsInRegions:regions onCompletion:^(NSArray *beacons, BRTBeaconRegion *region, NSError *error) { 53 | NSLog(@"%@",beacons); 54 | if (beacons.count) { 55 | [self.dataDict setObject:[beacons sortedArrayUsingDescriptors:@[[NSSortDescriptor sortDescriptorWithKey:@"rssi" ascending:NO]]] forKey:region.proximityUUID.UUIDString]; 56 | }else{ 57 | [self.dataDict removeObjectForKey:region.proximityUUID.UUIDString]; 58 | } 59 | [self.tableView reloadData]; 60 | }]; 61 | }else{ 62 | NSLog(@"设备不支持"); 63 | } 64 | } 65 | - (void)viewWillDisappear:(BOOL)animated { 66 | [super viewWillDisappear:animated]; 67 | [BRTBeaconSDK stopRangingBeacons]; 68 | } 69 | 70 | #pragma mark - Table view data source 71 | 72 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 73 | return self.dataDict.allKeys.count; 74 | } 75 | 76 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 77 | return [self.dataDict[self.dataDict.allKeys[section]] count]; 78 | } 79 | 80 | - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { 81 | NSString *key = self.dataDict.allKeys[section]; 82 | NSArray *arr = [self.dataDict valueForKey:key]; 83 | return [NSString stringWithFormat:@"(%ld)%@-...-%@",arr.count,[key substringToIndex:8],[key substringFromIndex:24]]; 84 | } 85 | 86 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 87 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath]; 88 | 89 | NSString *key = self.dataDict.allKeys[indexPath.section]; 90 | BRTBeacon *beacon = [self.dataDict valueForKey:key][indexPath.row]; 91 | 92 | cell.textLabel.text = [NSString stringWithFormat:@"Major:%@ Minor:%@",beacon.major,beacon.minor]; 93 | cell.detailTextLabel.text = [NSString stringWithFormat:@"%ld,%.1fm",(long)beacon.rssi,beacon.accuracy?:-1]; 94 | 95 | return cell; 96 | } 97 | 98 | @end 99 | -------------------------------------------------------------------------------- /Demo/Demo/ConfigDetailVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // ConfigDetailVC.h 3 | // Demo 4 | // 5 | // Created by thomasho on 17/2/24. 6 | // Copyright © 2017年 brightbeacon. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "BRTBeaconSDK.h" 11 | 12 | @interface ConfigDetailVC : UITableViewController 13 | 14 | @property (nonatomic,strong) BRTBeacon *beacon; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Demo/Demo/ConfigDetailVC.m: -------------------------------------------------------------------------------- 1 | // 2 | // ConfigDetailVC.m 3 | // Demo 4 | // 5 | // Created by thomasho on 17/2/24. 6 | // Copyright © 2017年 brightbeacon. All rights reserved. 7 | // 8 | 9 | #import "ConfigDetailVC.h" 10 | 11 | typedef NS_ENUM(NSUInteger, SettingType) { 12 | SettingTypeTX, 13 | SettingTypeTXINTERVAL, 14 | SettingTypeMPOWER, 15 | }; 16 | 17 | @interface ConfigDetailVC () 18 | 19 | @property (nonatomic,strong) UIPickerView* valuePicker; 20 | @property (nonatomic,strong) UIToolbar* toolBar; 21 | 22 | @end 23 | 24 | @implementation ConfigDetailVC 25 | 26 | - (void)viewDidLoad { 27 | [super viewDidLoad]; 28 | [self refreshButtonClicked]; 29 | } 30 | 31 | - (void)viewWillDisappear:(BOOL)animated { 32 | [super viewWillDisappear:animated]; 33 | [self.beacon disconnectBeacon]; 34 | } 35 | - (void)dealloc { 36 | NSLog(@"dealloc"); 37 | } 38 | #pragma mark - **************** 刷新读取按钮 39 | 40 | - (IBAction)refreshButtonClicked { 41 | [self.beacon readBeaconValuesCompletion:^(BRTBeacon *beacon, NSError *error) { 42 | [self.tableView reloadData]; 43 | }]; 44 | } 45 | #pragma mark - **************** Getter 46 | - (UIPickerView *)valuePicker { 47 | if (!_valuePicker) { 48 | _valuePicker = [[UIPickerView alloc]init]; 49 | _valuePicker.delegate = self; 50 | _valuePicker.dataSource = self; 51 | _valuePicker.showsSelectionIndicator = YES; 52 | _valuePicker.backgroundColor = [UIColor whiteColor]; 53 | } 54 | return _valuePicker; 55 | } 56 | 57 | - (UIToolbar *)toolBar { 58 | if (!_toolBar) { 59 | UIToolbar *foodToolBar=[[UIToolbar alloc]init]; 60 | foodToolBar.barTintColor=[UIColor grayColor]; 61 | foodToolBar.frame=CGRectMake(0, 0, 320, 38); 62 | UIBarButtonItem *doneBtn=[[UIBarButtonItem alloc]initWithTitle:@"完成" style:UIBarButtonItemStylePlain target:self action:@selector(doneButtonClicked:)]; 63 | [doneBtn setTintColor:[UIColor whiteColor]]; 64 | UIBarButtonItem *spaceBtn=[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; 65 | foodToolBar.items=@[spaceBtn,doneBtn]; 66 | _toolBar = foodToolBar; 67 | } 68 | return _toolBar; 69 | } 70 | 71 | #pragma mark - **************** PickerView 72 | 73 | -(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView 74 | { 75 | return 1; 76 | } 77 | -(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component 78 | { 79 | switch (pickerView.tag) { 80 | case SettingTypeTX:return 8; 81 | case SettingTypeTXINTERVAL:return 12; 82 | case SettingTypeMPOWER:return 80; 83 | } 84 | return 0; 85 | } 86 | -(NSString*)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { 87 | switch (pickerView.tag) { 88 | case SettingTypeTX: 89 | return @[@"-30dBm",@"-20dBm",@"-16dBm",@"-12dBm",@"-8dBm",@"-4dBm",@"0dBm",@"+4dBm"][row];//@"发射功率越大,信号越强"; 90 | case SettingTypeTXINTERVAL: 91 | return @[@"100ms",@"152.5ms()",@"211.25ms()",@"318.75ms()",@"417.5ms()",@"546.25ms()",@"760ms()",@"852.5ms()",@"1022.5ms()",@"2000ms(2s)",@"4000ms(4s)",@"10000ms(10s)"][row];//@"发射间隔越小,信号越稳定"; 92 | case SettingTypeMPOWER: 93 | return [NSString stringWithFormat:@"%ld",-90+row];//@"测量功率是iBeacon距离标尺(1米处RSSI)"; 94 | } 95 | return @""; 96 | } 97 | 98 | #pragma mark - **************** TextField 99 | 100 | - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField { 101 | self.valuePicker.tag = textField.tag; 102 | [self.valuePicker reloadAllComponents]; 103 | return YES; 104 | } 105 | 106 | #pragma mark - **************** TextField Done 107 | 108 | - (IBAction)doneButtonClicked:(id)sender { 109 | [self.view endEditing:YES]; 110 | NSInteger row = [self.valuePicker selectedRowInComponent:0]; 111 | NSDictionary *dicForWrite = nil; 112 | switch (self.valuePicker.tag) { 113 | case SettingTypeTX:{ 114 | NSString *value = @[@"-30dBm",@"-20dBm",@"-16dBm",@"-12dBm",@"-8dBm",@"-4dBm",@"0dBm",@"+4dBm"][row]; 115 | dicForWrite = @{B_TX:@(value.integerValue) }; 116 | } 117 | break; 118 | case SettingTypeTXINTERVAL:{ 119 | NSString *value = @[@"100ms",@"152.5ms()",@"211.25ms()",@"318.75ms()",@"417.5ms()",@"546.25ms()",@"760ms()",@"852.5ms()",@"1022.5ms()",@"2000ms(2s)",@"4000ms(4s)",@"10000ms(10s)"][row]; 120 | dicForWrite = @{B_INTERVAL:@(value.integerValue)}; 121 | } 122 | break; 123 | case SettingTypeMPOWER:{ 124 | dicForWrite = @{B_MEASURED:@(-90+row)}; 125 | } 126 | break; 127 | } 128 | [self.beacon writeBeaconValues:dicForWrite withCompletion:^(BOOL complete, NSError *error) { 129 | if (complete) { 130 | [SVProgressHUD showSuccessWithStatus:@"修改成功"]; 131 | }else{ 132 | [SVProgressHUD showErrorWithStatus:error.description]; 133 | } 134 | }]; 135 | } 136 | #pragma mark - **************** TableView 137 | 138 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 139 | return 10; 140 | } 141 | 142 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 143 | UITableViewCell *cell = nil; 144 | if (indexPath.row == 4||indexPath.row == 5 || indexPath.row == 6) { 145 | cell = [tableView dequeueReusableCellWithIdentifier:@"cellwithtext" forIndexPath:indexPath]; 146 | }else{ 147 | cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath]; 148 | } 149 | UITextField *tf = (UITextField *)cell.accessoryView; 150 | if (tf) { 151 | tf.delegate = self; 152 | tf.inputAccessoryView = self.toolBar; 153 | tf.inputView = self.valuePicker; 154 | } 155 | switch (indexPath.row) { 156 | case 0: 157 | cell.textLabel.text = @"UUID"; 158 | cell.detailTextLabel.text = self.beacon.proximityUUID.UUIDString; 159 | break; 160 | case 1: 161 | cell.textLabel.text = @"Major"; 162 | cell.detailTextLabel.text = self.beacon.major.stringValue; 163 | break; 164 | case 2: 165 | cell.textLabel.text = @"Minor"; 166 | cell.detailTextLabel.text = self.beacon.minor.stringValue; 167 | break; 168 | case 3: 169 | cell.textLabel.text = @"名称"; 170 | cell.detailTextLabel.text = self.beacon.name; 171 | break; 172 | case 4: 173 | cell.textLabel.text = @"发射功率"; 174 | tf.text = self.beacon.power.stringValue; 175 | tf.tag = SettingTypeTX; 176 | break; 177 | case 5: 178 | cell.textLabel.text = @"发射间隔"; 179 | tf.text = self.beacon.advInterval.stringValue; 180 | tf.tag = SettingTypeTXINTERVAL; 181 | break; 182 | case 6: 183 | cell.textLabel.text = @"测量功率"; 184 | tf.text = self.beacon.measuredPower.stringValue; 185 | tf.tag = SettingTypeMPOWER; 186 | break; 187 | case 7: 188 | cell.textLabel.text = @"电量"; 189 | cell.detailTextLabel.text = self.beacon.battery.stringValue; 190 | break; 191 | case 8: 192 | cell.textLabel.text = @"温度"; 193 | cell.detailTextLabel.text = self.beacon.temperature.stringValue; 194 | break; 195 | case 9: 196 | cell.textLabel.text = @"加密部署"; 197 | cell.detailTextLabel.text = @(self.beacon.mode).stringValue; 198 | break; 199 | 200 | default: 201 | break; 202 | } 203 | 204 | return cell; 205 | } 206 | 207 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 208 | switch (indexPath.row) { 209 | case 0: 210 | case 1: 211 | case 2: 212 | case 3: 213 | case 9: 214 | { 215 | BOOL isMode = indexPath.row == 9; 216 | UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; 217 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:cell.textLabel.text message:isMode?@"必须设置您的appKey,才能修改加密部署。":nil delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"保存", nil]; 218 | alert.tag = indexPath.row; 219 | if (!isMode) { 220 | alert.alertViewStyle = UIAlertViewStylePlainTextInput; 221 | [[alert textFieldAtIndex:0] setText:cell.detailTextLabel.text]; 222 | } 223 | [alert show]; 224 | } 225 | break; 226 | } 227 | } 228 | 229 | - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset { 230 | if (velocity.y<0) { 231 | [self.view endEditing:YES]; 232 | } 233 | } 234 | 235 | #pragma mark - **************** AlertView 236 | 237 | - (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex { 238 | if (buttonIndex == alertView.cancelButtonIndex) { 239 | return; 240 | } 241 | [SVProgressHUD showWithStatus:@"正在写入..."]; 242 | NSString *value = [alertView textFieldAtIndex:0].text; 243 | NSDictionary *dicForWrite = nil; 244 | switch (alertView.tag) { 245 | case 0:dicForWrite = @{B_UUID:value};break; 246 | case 1:dicForWrite = @{B_MAJOR:value};break; 247 | case 2:dicForWrite = @{B_MINOR:value};break; 248 | case 3:dicForWrite = @{B_NAME:value};break; 249 | case 4:dicForWrite = @{B_TX:value}; break; 250 | case 5:dicForWrite = @{B_INTERVAL:value}; break; 251 | case 6:dicForWrite = @{B_MEASURED:value}; break; 252 | case 9:dicForWrite = @{B_MODE:@(1-self.beacon.mode)}; break; 253 | default:break; 254 | } 255 | [self.beacon writeBeaconValues:dicForWrite withCompletion:^(BOOL complete, NSError *error) { 256 | if (complete) { 257 | [SVProgressHUD showSuccessWithStatus:@"修改成功"]; 258 | }else{ 259 | [SVProgressHUD showErrorWithStatus:error.description]; 260 | } 261 | }]; 262 | } 263 | 264 | @end 265 | -------------------------------------------------------------------------------- /Demo/Demo/ConfigVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // ConfigVC.h 3 | // Demo 4 | // 5 | // Created by thomasho on 17/2/24. 6 | // Copyright © 2017年 brightbeacon. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface ConfigVC : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Demo/Demo/ConfigVC.m: -------------------------------------------------------------------------------- 1 | // 2 | // ConfigVC.m 3 | // Demo 4 | // 5 | // Created by thomasho on 17/2/24. 6 | // Copyright © 2017年 brightbeacon. All rights reserved. 7 | // 8 | 9 | #import "ConfigVC.h" 10 | #import "BRTBeaconSDK.h" 11 | #import "ConfigDetailVC.h" 12 | 13 | @interface ConfigVC () { 14 | UIRefreshControl *rf; 15 | } 16 | 17 | @property (nonatomic,strong) NSMutableSet *dataSet; 18 | @property (nonatomic,strong) NSArray *beaconSortByRSSI; 19 | @property (nonatomic,strong) BRTBeacon *beaconHold; 20 | 21 | @end 22 | 23 | @implementation ConfigVC 24 | 25 | - (void)viewDidLoad { 26 | [super viewDidLoad]; 27 | 28 | self.dataSet = [NSMutableSet set]; 29 | 30 | [self refesh]; 31 | 32 | rf = [[UIRefreshControl alloc] init]; 33 | [rf addTarget:self action:@selector(refesh) forControlEvents:UIControlEventValueChanged]; 34 | [self.tableView addSubview:rf]; 35 | } 36 | 37 | - (void)viewWillDisappear:(BOOL)animated { 38 | [super viewWillDisappear:animated]; 39 | [BRTBeaconSDK stopScan]; 40 | } 41 | 42 | - (void)refesh{ 43 | [rf endRefreshing]; 44 | //这里的UUID用于开启GPS扫描iBeacon融合所需。 45 | //蓝牙扫描能获取智石设备的mac地址等额外设备数据,并支持连接配置。 46 | CBUUID *uuid = [CBUUID UUIDWithString:@"180a"]; 47 | [BRTBeaconSDK scanBleServices:@[uuid] onCompletion:^(NSArray *beacons, NSError *error) { 48 | NSLog(@"ble:%@",beacons.firstObject.macAddress); 49 | [self.dataSet addObjectsFromArray:beacons]; 50 | static NSInteger count = 0; 51 | if (count%5) { 52 | self.beaconSortByRSSI = [self.dataSet.allObjects sortedArrayUsingComparator:^NSComparisonResult(BRTBeacon *obj1, BRTBeacon *obj2) { 53 | return obj1.rssi 10 | 11 | @interface DemoVC : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Demo/Demo/DemoVC.m: -------------------------------------------------------------------------------- 1 | // 2 | // DemoVC.m 3 | // Demo 4 | // 5 | // Created by thomasho on 17/2/24. 6 | // Copyright © 2017年 brightbeacon. All rights reserved. 7 | // 8 | 9 | #import "DemoVC.h" 10 | #import "BRTBeaconSDK.h" 11 | 12 | @interface DemoVC () 13 | 14 | 15 | @end 16 | 17 | @implementation DemoVC 18 | 19 | - (void)viewDidLoad { 20 | [super viewDidLoad]; 21 | self.title = [NSString stringWithFormat:@"演示(%@)",SDK_VERSION]; 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /Demo/Demo/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 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | NSBluetoothAlwaysUsageDescription 24 | 用于扫描蓝牙设备 25 | NSBluetoothPeripheralUsageDescription 26 | 用于感应Beacon设备、打开区域推送功能 27 | NSLocationAlwaysAndWhenInUseUsageDescription 28 | 用于IOS11感应Beacon设备、打开区域推送功能 29 | NSLocationAlwaysUsageDescription 30 | 用于扫描iBeacon、监听iBeacon区域 31 | NSLocationWhenInUseUsageDescription 32 | 用于扫描iBeacon、监听iBeacon区域 33 | UIBackgroundModes 34 | 35 | bluetooth-central 36 | fetch 37 | location 38 | processing 39 | 40 | UILaunchStoryboardName 41 | LaunchScreen 42 | UIMainStoryboardFile 43 | Main 44 | UIRequiredDeviceCapabilities 45 | 46 | armv7 47 | 48 | UISupportedInterfaceOrientations 49 | 50 | UIInterfaceOrientationPortrait 51 | UIInterfaceOrientationLandscapeLeft 52 | UIInterfaceOrientationLandscapeRight 53 | 54 | UISupportedInterfaceOrientations~ipad 55 | 56 | UIInterfaceOrientationPortrait 57 | UIInterfaceOrientationPortraitUpsideDown 58 | UIInterfaceOrientationLandscapeLeft 59 | UIInterfaceOrientationLandscapeRight 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /Demo/Demo/RegionAddVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // RegionAddVC.h 3 | // Demo 4 | // 5 | // Created by thomasho on 17/2/24. 6 | // Copyright © 2017年 brightbeacon. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RegionAddVC : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Demo/Demo/RegionAddVC.m: -------------------------------------------------------------------------------- 1 | // 2 | // RegionAddVC.m 3 | // Demo 4 | // 5 | // Created by thomasho on 17/2/24. 6 | // Copyright © 2017年 brightbeacon. All rights reserved. 7 | // 8 | 9 | #import "RegionAddVC.h" 10 | #import "BRTBeaconSDK.h" 11 | 12 | @interface RegionAddVC () 13 | 14 | @property (weak, nonatomic) IBOutlet UITextField *TFUUID; 15 | @property (weak, nonatomic) IBOutlet UITextField *TFMAJOR; 16 | @property (weak, nonatomic) IBOutlet UITextField *TFMINOR; 17 | @property (weak, nonatomic) IBOutlet UISwitch *SWIN; 18 | @property (weak, nonatomic) IBOutlet UISwitch *SWOUT; 19 | @property (weak, nonatomic) IBOutlet UISwitch *SWDISPLAY; 20 | 21 | 22 | @end 23 | 24 | @implementation RegionAddVC 25 | 26 | - (void)viewDidLoad { 27 | [super viewDidLoad]; 28 | 29 | self.TFUUID.text = DEFAULT_UUID; 30 | } 31 | 32 | - (IBAction)saveButtonClicked:(id)sender { 33 | BRTBeaconRegion *region = nil; 34 | NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:self.TFUUID.text]; 35 | NSString *regionID = uuid.UUIDString; 36 | if (self.TFMAJOR.text.length) { 37 | NSNumber *major = @(self.TFMAJOR.text.integerValue); 38 | if (self.TFMINOR.text.length) { 39 | regionID = [regionID stringByAppendingFormat:@"%@,%@",self.TFMAJOR.text,self.TFMINOR.text]; 40 | NSNumber *minor = @(self.TFMINOR.text.integerValue); 41 | region = [[BRTBeaconRegion alloc] initWithProximityUUID:uuid major:major.integerValue minor:minor.integerValue identifier:regionID]; 42 | }else{ 43 | regionID = [regionID stringByAppendingFormat:@"%@",self.TFMAJOR.text]; 44 | region = [[BRTBeaconRegion alloc] initWithProximityUUID:uuid major:major.integerValue identifier:regionID]; 45 | } 46 | }else{ 47 | region = [[BRTBeaconRegion alloc] initWithProximityUUID:uuid identifier:regionID]; 48 | } 49 | region.notifyOnEntry = self.SWIN.isOn; 50 | region.notifyOnExit = self.SWOUT.isOn; 51 | region.notifyEntryStateOnDisplay = self.SWDISPLAY.isOn; 52 | [BRTBeaconSDK startMonitoringForRegions:@[region]]; 53 | [self.navigationController popViewControllerAnimated:YES]; 54 | } 55 | @end 56 | -------------------------------------------------------------------------------- /Demo/Demo/RegionHander.h: -------------------------------------------------------------------------------- 1 | // 2 | // RegionHander.h 3 | // Demo 4 | // 5 | // Created by thomasho on 17/3/6. 6 | // Copyright © 2017年 brightbeacon. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "BRTBeaconSDK.h" 11 | 12 | @interface RegionHander : NSObject 13 | //通知权限申请 14 | + (void)registerNotification; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Demo/Demo/RegionHander.m: -------------------------------------------------------------------------------- 1 | // 2 | // RegionHander.m 3 | // Demo 4 | // 5 | // Created by thomasho on 17/3/6. 6 | // Copyright © 2017年 brightbeacon. All rights reserved. 7 | // 8 | 9 | #import "RegionHander.h" 10 | 11 | #ifdef NSFoundationVersionNumber_iOS_9_x_Max 12 | #import 13 | #endif 14 | 15 | #ifdef NSFoundationVersionNumber_iOS_9_x_Max 16 | @interface RegionHander () 17 | #else 18 | @interface RegionHander () 19 | #endif 20 | @end 21 | 22 | @implementation RegionHander 23 | 24 | //如需测试完全关闭app:可以通过XCode->Windows->Devices->选中调试的iPhone查看NSLog信息 25 | //也可以先获取本地通知权限,直接发本地通知 26 | -(void)beaconManager:(BRTBeaconManager *)manager didEnterRegion:(BRTBeaconRegion *)region { 27 | NSLog(@"进入区域:%@",region); 28 | [self sendLocalNotification:NSLocalizedString(@"您已经进入了Beacon体验区",nil)]; 29 | } 30 | -(void)beaconManager:(BRTBeaconManager *)manager didExitRegion:(BRTBeaconRegion *)region { 31 | NSLog(@"离开区域:%@",region); 32 | [self sendLocalNotification:NSLocalizedString(@"您已经离开",nil)]; 33 | } 34 | 35 | -(void)beaconManager:(BRTBeaconManager *)manager didDetermineState:(CLRegionState)state forRegion:(BRTBeaconRegion *)region { 36 | NSLog(@"触发:1、锁屏点亮 2、requestState: 3、伴随didEnterRegion:/didExitRegion:%@->%ld",region,(long)state); 37 | NSString *msg = [NSString stringWithFormat:NSLocalizedString(@"你监听的Beacon区域状态:%@,锁屏点亮屏幕会收到此推送",nil),(state==CLRegionStateUnknown)?@"未知":(state=CLRegionStateInside)?@"区域内":@"区域外"]; 38 | [self sendLocalNotification:msg]; 39 | // [BRTBeaconSDK startRangingBeaconsInRegions:@[region] onCompletion:^(NSArray *beacons, BRTBeaconRegion *region, NSError *error) { 40 | // NSLog(@"进入区域启动iBeacon扫描:%ld",beacons.count); 41 | // }]; 42 | // [BRTBeaconSDK scanBleServices:@[[CBUUID UUIDWithString:@"180a"]] onCompletion:^(NSArray *beacons, NSError *error) { 43 | // NSLog(@"进入区域启动蓝牙扫描(需要与iBeacon扫描同时启动):%@",beacons.firstObject.macAddress); 44 | // }]; 45 | } 46 | 47 | - (void)beaconManager:(BRTBeaconManager *)manager monitoringDidFailForRegion:(BRTBeaconRegion *)region withError:(NSError *)error { 48 | NSLog(@"区域监听失败:%@ error:%@",region,error); 49 | } 50 | 51 | - (void)beaconManagerDidStartAdvertising:(BRTBeaconManager *)manager error:(NSError *)error { 52 | //广播iBeacon回调 53 | } 54 | 55 | //通知权限申请 56 | + (void)registerNotification { 57 | //IOS8.0以后 推送必须询求用户同意,来触发通知(按你程序所需) 58 | UIApplication *application = [UIApplication sharedApplication]; 59 | if (@available(iOS 10.0, *)) { 60 | UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; 61 | [center requestAuthorizationWithOptions:(UNAuthorizationOptionBadge | UNAuthorizationOptionSound | UNAuthorizationOptionAlert) completionHandler:^(BOOL granted, NSError * _Nullable error) { 62 | if (!error) { 63 | NSLog(@"推送权限:succeeded!"); 64 | } 65 | }]; 66 | } else if (@available(iOS 8.0, *)){//iOS8-iOS10 67 | UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeBadge | UIUserNotificationTypeAlert | UIUserNotificationTypeSound) categories:nil]; 68 | [application registerUserNotificationSettings:settings]; 69 | [application registerForRemoteNotifications]; 70 | } else {//iOS8以下 71 | [application registerForRemoteNotificationTypes: UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound]; 72 | } 73 | } 74 | 75 | //发送本地通知 76 | - (void)sendLocalNotification:(NSString*)msg 77 | { 78 | static NSTimeInterval time = 0; 79 | if(CFAbsoluteTimeGetCurrent() - time < 1){ 80 | NSLog(@"%@ 本地通知太频繁,可能导致部分推送看不到",msg); 81 | return; 82 | }else{ 83 | time = CFAbsoluteTimeGetCurrent(); 84 | } 85 | if (@available(iOS 10.0, *)) { 86 | [self addlocalNotificationForNewVersion:msg sub:NSLocalizedString(@"查看更多",nil) info:nil]; 87 | }else{ 88 | [self addLocalNotificationForOldVersion:msg sub:NSLocalizedString(@"查看更多",nil) info:nil]; 89 | } 90 | } 91 | 92 | /** 93 | iOS 10以前版本添加本地通知 94 | */ 95 | - (void)addLocalNotificationForOldVersion:(NSString *)msg sub:(NSString *)subtitle info:(NSDictionary *) info __IOS_AVAILABLE(4.0){ 96 | 97 | //定义本地通知对象 98 | UILocalNotification *notification = [[UILocalNotification alloc] init]; 99 | //设置调用时间 100 | // notification.timeZone = [NSTimeZone localTimeZone]; 101 | // notification.fireDate = [NSDate dateWithTimeIntervalSinceNow:3.0];//通知触发的时间,1s以后 102 | // notification.repeatInterval = 1;//通知重复次数 103 | // notification.repeatCalendar=[NSCalendar currentCalendar];//当前日历,使用前最好设置时区等信息以便能够自动同步时间 104 | 105 | //设置通知属性 106 | notification.alertBody = msg;//[NSString stringWithFormat:@"Agent-%d",arc4random()%100]; //通知主体 107 | notification.applicationIconBadgeNumber += 1;//应用程序图标右上角显示的消息数 108 | notification.alertAction = subtitle; //待机界面的滑动动作提示 109 | notification.alertLaunchImage = @"Default";//通过点击通知打开应用时的启动图片,这里使用程序启动图片 110 | notification.soundName = UILocalNotificationDefaultSoundName;//收到通知时播放的声音,默认消息声音 111 | // notification.soundName=@"msg.caf";//通知声音(需要真机才能听到声音) 112 | 113 | //设置用户信息 114 | notification.userInfo = info;//绑定到通知上的其他附加信息 115 | 116 | //调用通知,按fireDate 117 | // [[UIApplication sharedApplication] scheduleLocalNotification:notification]; 118 | //直接立即触发 119 | [[UIApplication sharedApplication] presentLocalNotificationNow:notification]; 120 | } 121 | 122 | /** 123 | iOS 10以后的本地通知 124 | */ 125 | - (void)addlocalNotificationForNewVersion:(NSString *)msg sub:(NSString *)subtitle info:(NSDictionary *)info __IOS_AVAILABLE(10.0){ 126 | UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter]; 127 | center.delegate = self; 128 | UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init]; 129 | content.title = [NSString localizedUserNotificationStringForKey:msg arguments:nil]; 130 | content.body = [NSString localizedUserNotificationStringForKey:subtitle arguments:nil]; 131 | content.sound = [UNNotificationSound defaultSound]; 132 | content.userInfo = info; 133 | 134 | //UNTimeIntervalNotificationTrigger (本地通知) 一定时间之后,重复或者不重复推送通知。我们可以设置timeInterval(时间间隔>0)和repeats(是否重复)。 135 | UNTimeIntervalNotificationTrigger *trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:0.001 repeats:NO]; 136 | UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:@"OXNotification" content:content trigger:trigger]; 137 | 138 | [center addNotificationRequest:request withCompletionHandler:^(NSError *_Nullable error) { 139 | NSLog(@"成功添加推送"); 140 | }]; 141 | } 142 | 143 | #pragma mark - UNUserNotificationCenterDelegate 144 | // The method will be called on the delegate only if the application is in the foreground. If the method is not implemented or the handler is not called in a timely manner then the notification will not be presented. The application can choose to have the notification presented as a sound, badge, alert and/or in the notification list. This decision should be based on whether the information in the notification is otherwise visible to the user. 145 | // iOS 10收到前台通知 146 | - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler __IOS_AVAILABLE(10.0) { 147 | 148 | NSDictionary * userInfo = notification.request.content.userInfo; 149 | UNNotificationRequest *request = notification.request; // 收到推送的请求 150 | UNNotificationContent *content = request.content; // 收到推送的消息内容 151 | NSNumber *badge = content.badge; // 推送消息的角标 152 | NSString *body = content.body; // 推送消息体 153 | UNNotificationSound *sound = content.sound; // 推送消息的声音 154 | NSString *subtitle = content.subtitle; // 推送消息的副标题 155 | NSString *title = content.title; // 推送消息的标题 156 | 157 | if([notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) { 158 | NSLog(@"iOS10 前台收到远程通知:%@", body); 159 | } else { 160 | // 判断为本地通知 161 | NSLog(@"iOS10 前台收到本地通知:{\\\\nbody:%@,\\\\ntitle:%@,\\\\nsubtitle:%@,\\\\nbadge:%@,\\\\nsound:%@,\\\\nuserInfo:%@\\\\n}",body,title,subtitle,badge,sound,userInfo); 162 | [[UIApplication sharedApplication].delegate application:[UIApplication sharedApplication] didReceiveLocalNotification:(id)notification]; 163 | } 164 | completionHandler(UNNotificationPresentationOptionBadge|UNNotificationPresentationOptionSound|UNNotificationPresentationOptionAlert); // 需要执行这个方法,选择是否提醒用户,有Badge、Sound、Alert三种类型可以设置 165 | } 166 | // The method will be called on the delegate when the user responded to the notification by opening the application, dismissing the notification or choosing a UNNotificationAction. The delegate must be set before the application returns from application:didFinishLaunchingWithOptions:. 167 | // iOS 10后台点击通知后调用 168 | - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler __IOS_AVAILABLE(10.0) { 169 | [[UIApplication sharedApplication].delegate application:[UIApplication sharedApplication] didReceiveLocalNotification:(id)response.notification]; 170 | completionHandler(); 171 | } 172 | @end 173 | -------------------------------------------------------------------------------- /Demo/Demo/RegionVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // RegionVC.h 3 | // Demo 4 | // 5 | // Created by thomasho on 17/2/24. 6 | // Copyright © 2017年 brightbeacon. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface RegionVC : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Demo/Demo/RegionVC.m: -------------------------------------------------------------------------------- 1 | // 2 | // RegionVC.m 3 | // Demo 4 | // 5 | // Created by thomasho on 17/2/24. 6 | // Copyright © 2017年 brightbeacon. All rights reserved. 7 | // 8 | 9 | #import "RegionVC.h" 10 | #import "BRTBeaconSDK.h" 11 | #import "RegionHander.h" 12 | 13 | @interface RegionVC () 14 | 15 | @property (nonatomic,strong) NSSet *regions; 16 | 17 | @end 18 | 19 | @implementation RegionVC 20 | 21 | - (void)viewDidAppear:(BOOL)animated { 22 | [super viewDidAppear:animated]; 23 | self.regions = [[BRTBeaconSDK BRTBeaconManager] monitoredRegions]; 24 | [self.tableView reloadData]; 25 | 26 | //注册通知服务 27 | [RegionHander registerNotification]; 28 | } 29 | 30 | - (void)didReceiveMemoryWarning { 31 | [super didReceiveMemoryWarning]; 32 | // Dispose of any resources that can be recreated. 33 | } 34 | 35 | #pragma mark - Table view data source 36 | 37 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 38 | return self.regions.count; 39 | } 40 | 41 | 42 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 43 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath]; 44 | 45 | BRTBeaconRegion *region = self.regions.allObjects[indexPath.row]; 46 | cell.textLabel.text = region.proximityUUID.UUIDString; 47 | NSMutableDictionary *mdict = [NSMutableDictionary dictionaryWithObject:region.proximityUUID.UUIDString forKey:@"uuid"]; 48 | NSString *detail = @""; 49 | if (region.major) { 50 | detail = [NSString stringWithFormat:@"major:%@",region.major]; 51 | [mdict setObject:region.major forKey:@"major"]; 52 | if (region.minor){ 53 | detail = [NSString stringWithFormat:@"major:%@,minor:%@",region.major,region.minor]; 54 | [mdict setObject:region.minor forKey:@"minor"]; 55 | } 56 | } 57 | NSDictionary *dict = [BRTBeaconSDK isMonitoring:mdict]; 58 | detail = [NSString stringWithFormat:@"%@ 进入:%@ 离开:%@ 锁屏点亮:%@",detail,dict[@"in"]?:@"0",dict[@"out"]?:@"0",dict[@"display"]?:@"0"]; 59 | cell.detailTextLabel.text = detail; 60 | [((UISwitch *)cell.accessoryView) setOn:!!dict]; 61 | 62 | return cell; 63 | } 64 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 65 | BRTBeaconRegion *region = self.regions.allObjects[indexPath.row]; 66 | UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; 67 | UISwitch *sw = (UISwitch *)cell.accessoryView; 68 | if (sw.isOn) { 69 | [BRTBeaconSDK stopMonitoringForRegions:@[region]]; 70 | }else{ 71 | [BRTBeaconSDK startMonitoringForRegions:@[region]]; 72 | } 73 | [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationAutomatic]; 74 | } 75 | 76 | @end 77 | -------------------------------------------------------------------------------- /Demo/Demo/SVProgessHUD/SVProgressHUD-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'SVProgressHUD' target in the 'SVProgressHUD' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #import "SVProgressHUD.h" 8 | #endif 9 | -------------------------------------------------------------------------------- /Demo/Demo/SVProgessHUD/SVProgressHUD.bundle/error-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_iOS_SDK/fa3459eb71d7bad33e9cdda261c3ebe9b5aaef6a/Demo/Demo/SVProgessHUD/SVProgressHUD.bundle/error-black.png -------------------------------------------------------------------------------- /Demo/Demo/SVProgessHUD/SVProgressHUD.bundle/error-black@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_iOS_SDK/fa3459eb71d7bad33e9cdda261c3ebe9b5aaef6a/Demo/Demo/SVProgessHUD/SVProgressHUD.bundle/error-black@2x.png -------------------------------------------------------------------------------- /Demo/Demo/SVProgessHUD/SVProgressHUD.bundle/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_iOS_SDK/fa3459eb71d7bad33e9cdda261c3ebe9b5aaef6a/Demo/Demo/SVProgessHUD/SVProgressHUD.bundle/error.png -------------------------------------------------------------------------------- /Demo/Demo/SVProgessHUD/SVProgressHUD.bundle/error@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_iOS_SDK/fa3459eb71d7bad33e9cdda261c3ebe9b5aaef6a/Demo/Demo/SVProgessHUD/SVProgressHUD.bundle/error@2x.png -------------------------------------------------------------------------------- /Demo/Demo/SVProgessHUD/SVProgressHUD.bundle/success-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_iOS_SDK/fa3459eb71d7bad33e9cdda261c3ebe9b5aaef6a/Demo/Demo/SVProgessHUD/SVProgressHUD.bundle/success-black.png -------------------------------------------------------------------------------- /Demo/Demo/SVProgessHUD/SVProgressHUD.bundle/success-black@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_iOS_SDK/fa3459eb71d7bad33e9cdda261c3ebe9b5aaef6a/Demo/Demo/SVProgessHUD/SVProgressHUD.bundle/success-black@2x.png -------------------------------------------------------------------------------- /Demo/Demo/SVProgessHUD/SVProgressHUD.bundle/success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_iOS_SDK/fa3459eb71d7bad33e9cdda261c3ebe9b5aaef6a/Demo/Demo/SVProgessHUD/SVProgressHUD.bundle/success.png -------------------------------------------------------------------------------- /Demo/Demo/SVProgessHUD/SVProgressHUD.bundle/success@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_iOS_SDK/fa3459eb71d7bad33e9cdda261c3ebe9b5aaef6a/Demo/Demo/SVProgessHUD/SVProgressHUD.bundle/success@2x.png -------------------------------------------------------------------------------- /Demo/Demo/SVProgessHUD/SVProgressHUD.h: -------------------------------------------------------------------------------- 1 | // 2 | // SVProgressHUD.h 3 | // 4 | // Created by Sam Vermette on 27.03.11. 5 | // Copyright 2011 Sam Vermette. All rights reserved. 6 | // 7 | // https://github.com/samvermette/SVProgressHUD 8 | // 9 | 10 | #import 11 | #import 12 | 13 | extern NSString * const SVProgressHUDDidReceiveTouchEventNotification; 14 | extern NSString * const SVProgressHUDWillDisappearNotification; 15 | extern NSString * const SVProgressHUDDidDisappearNotification; 16 | extern NSString * const SVProgressHUDWillAppearNotification; 17 | extern NSString * const SVProgressHUDDidAppearNotification; 18 | 19 | extern NSString * const SVProgressHUDStatusUserInfoKey; 20 | 21 | enum { 22 | SVProgressHUDMaskTypeNil, 23 | SVProgressHUDMaskTypeNone = 1, // allow user interactions while HUD is displayed 24 | SVProgressHUDMaskTypeClear, // don't allow 25 | SVProgressHUDMaskTypeBlack, // don't allow and dim the UI in the back of the HUD 26 | SVProgressHUDMaskTypeGradient // don't allow and dim the UI with a a-la-alert-view bg gradient 27 | }; 28 | 29 | typedef NSUInteger SVProgressHUDMaskType; 30 | 31 | @interface SVProgressHUD : UIView 32 | 33 | #if __IPHONE_OS_VERSION_MIN_REQUIRED >= 50000 34 | @property (readwrite, nonatomic, retain) UIColor *hudBackgroundColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; 35 | @property (readwrite, nonatomic, retain) UIColor *hudForegroundColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; 36 | @property (readwrite, nonatomic, retain) UIColor *hudStatusShadowColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; 37 | @property (readwrite, nonatomic, retain) UIColor *hudRingBackgroundColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; 38 | @property (readwrite, nonatomic, retain) UIColor *hudRingForegroundColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; 39 | @property (readwrite, nonatomic, retain) UIFont *hudFont NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; 40 | @property (readwrite, nonatomic, retain) UIImage *hudSuccessImage NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; 41 | @property (readwrite, nonatomic, retain) UIImage *hudErrorImage NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; 42 | #endif 43 | 44 | + (void)setOffsetFromCenter:(UIOffset)offset; 45 | + (void)resetOffsetFromCenter; 46 | 47 | + (void)show; 48 | + (void)showWithMaskType:(SVProgressHUDMaskType)maskType; 49 | + (void)showWithStatus:(NSString*)status; 50 | + (void)showWithStatus:(NSString*)status maskType:(SVProgressHUDMaskType)maskType; 51 | 52 | + (void)showProgress:(float)progress; 53 | + (void)showProgress:(float)progress status:(NSString*)status; 54 | + (void)showProgress:(float)progress status:(NSString*)status maskType:(SVProgressHUDMaskType)maskType; 55 | 56 | + (void)setStatus:(NSString*)string; // change the HUD loading status while it's showing 57 | 58 | // stops the activity indicator, shows a glyph + status, and dismisses HUD 1s later 59 | + (void)showSuccessWithStatus:(NSString*)string; 60 | + (void)showErrorWithStatus:(NSString *)string; 61 | + (void)showImage:(UIImage*)image status:(NSString*)status; // use 28x28 white pngs 62 | 63 | + (void)popActivity; 64 | + (void)dismiss; 65 | 66 | + (BOOL)isVisible; 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /Demo/Demo/ScanInBackground.h: -------------------------------------------------------------------------------- 1 | // 2 | // ScanInBackground.h 3 | // Demo 4 | // 5 | // Created by thomasho on 2020/3/27. 6 | // Copyright © 2020 brightbeacon. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | NS_ASSUME_NONNULL_BEGIN 13 | 14 | @interface ScanInBackground : UIViewController 15 | 16 | @property (nonatomic,strong) CLLocationManager *locationManager; 17 | 18 | @end 19 | 20 | NS_ASSUME_NONNULL_END 21 | -------------------------------------------------------------------------------- /Demo/Demo/ScanInBackground.m: -------------------------------------------------------------------------------- 1 | // 2 | // ScanInBackground.m 3 | // Demo 4 | // 5 | // Created by thomasho on 2020/3/27. 6 | // Copyright © 2020 brightbeacon. All rights reserved. 7 | // 8 | 9 | #import "ScanInBackground.h" 10 | #import "BRTBeaconSDK.h" 11 | 12 | @implementation ScanInBackground 13 | 14 | - (void)viewDidLoad { 15 | self.locationManager = [[CLLocationManager alloc] init]; 16 | self.locationManager.delegate = self; 17 | [self.locationManager requestAlwaysAuthorization]; 18 | self.locationManager.desiredAccuracy = kCLLocationAccuracyBestForNavigation; 19 | if (@available(iOS 9.0, *)) 20 | self.locationManager.allowsBackgroundLocationUpdates = YES; 21 | self.locationManager.pausesLocationUpdatesAutomatically = NO; 22 | [self.locationManager startUpdatingLocation]; 23 | 24 | //扫描iBeacon参数:(UUID major minor accuracy rssi等参见CLBeacon参数列表) 25 | [BRTBeaconSDK startRangingBeaconsInRegions:@[DEFAULT_UUID] onCompletion:^(NSArray *beacons, BRTBeaconRegion *region, NSError *error) { 26 | NSLog(@"后台扫描到iBeacon:%@",beacons); 27 | }]; 28 | //扫描BrightBeacon(后台扫描需指定服务特征180a)参数,(major minor rssi macAddress measurePower等参见不需要连接参数列表) 29 | [BRTBeaconSDK scanBleServices:@[[CBUUID UUIDWithString:@"180a"]] onCompletion:^(NSArray *beacons, NSError *error) { 30 | NSLog(@"后台蓝牙扫描(需要与iBeacon扫描同启):%@",beacons.firstObject.macAddress); 31 | }]; 32 | } 33 | 34 | #pragma mark 定位成功 35 | -(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations{ 36 | CLLocation *newLocation = [locations lastObject]; 37 | double lat = newLocation.coordinate.latitude; 38 | double lon = newLocation.coordinate.longitude; 39 | NSLog(@"后台定位,用于常驻后台:lat:%f,lon:%f",lat,lon); 40 | } 41 | 42 | #pragma mark 定位失败 43 | -(void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error{ 44 | NSLog(@"error:%@",error); 45 | } 46 | @end 47 | -------------------------------------------------------------------------------- /Demo/Demo/VirtualVC.h: -------------------------------------------------------------------------------- 1 | // 2 | // VirtualViewController.h 3 | // BRTExample 4 | // 5 | // Created by thomasho on 14-12-31. 6 | // Copyright (c) 2014年 thomasho. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface VirtualVC : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /Demo/Demo/VirtualVC.m: -------------------------------------------------------------------------------- 1 | // 2 | // VirtualViewController.m 3 | // BRTExample 4 | // 5 | // Created by thomasho on 14-12-31. 6 | // Copyright (c) 2014年 thomasho. All rights reserved. 7 | // 8 | 9 | #import "VirtualVC.h" 10 | #import "BRTBeaconSDK.h" 11 | 12 | @interface VirtualVC () 13 | 14 | @property (weak, nonatomic) IBOutlet UITextField *Uuid; 15 | @property (weak, nonatomic) IBOutlet UITextField *Major; 16 | @property (weak, nonatomic) IBOutlet UITextField *Minor; 17 | @property (weak, nonatomic) IBOutlet UIButton *Button; 18 | @property (weak, nonatomic) IBOutlet UIImageView *ImageView; 19 | 20 | @end 21 | 22 | @implementation VirtualVC 23 | 24 | - (void)viewDidLoad { 25 | [super viewDidLoad]; 26 | 27 | NSString *uuidmm = [[NSUserDefaults standardUserDefaults] valueForKey:@"virtualBeacon"]; 28 | self.Button.selected = !!uuidmm; 29 | if (uuidmm) { 30 | NSArray *array = [uuidmm componentsSeparatedByString:@":"]; 31 | self.Uuid.text = array[0]; 32 | self.Major.text = array[1]; 33 | self.Minor.text = array[2]; 34 | }else{ 35 | self.Uuid.text = DEFAULT_UUID; 36 | } 37 | } 38 | 39 | - (IBAction)virtualButtonClicked:(UIButton*)sender { 40 | if (sender.selected) { 41 | [[BRTBeaconSDK BRTBeaconManager] stopAdvertising]; 42 | [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"virtualBeacon"]; 43 | [self.ImageView.layer removeAllAnimations]; 44 | self.ImageView.transform = CGAffineTransformIdentity; 45 | } else { 46 | [[BRTBeaconSDK BRTBeaconManager] startAdvertisingWithProximityUUID:[[NSUUID alloc] initWithUUIDString:self.Uuid.text] major:self.Major.text.integerValue minor:self.Minor.text.integerValue identifier:@"virtualBeacon" power:@-65]; 47 | 48 | NSString *UUIDMAJORMINOR = [NSString stringWithFormat:@"%@:%@:%@",self.Uuid.text,self.Major.text,self.Minor.text]; 49 | [[NSUserDefaults standardUserDefaults] setValue:UUIDMAJORMINOR forKey:@"virtualBeacon"]; 50 | 51 | [UIView animateWithDuration:2 delay:0 options:UIViewAnimationOptionRepeat animations:^{ 52 | self.ImageView.transform = CGAffineTransformMakeScale(5, 5); 53 | } completion:^(BOOL finished) { 54 | }]; 55 | } 56 | [[NSUserDefaults standardUserDefaults] synchronize]; 57 | sender.selected = !sender.selected; 58 | } 59 | 60 | - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 61 | { 62 | [self.view endEditing:YES]; 63 | } 64 | @end 65 | -------------------------------------------------------------------------------- /Demo/Demo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Demo 4 | // 5 | // Created by thomasho on 17/2/24. 6 | // Copyright © 2017年 brightbeacon. 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | iOS-SDK 2 | ======= 3 | 4 | ## BrightSDK 5 | ### 概述 6 | 7 | 智石开发包(BrightSDK)符合苹果的iBeacon协议、Google的eddystone协议,提供了扫描iBeacon、eddystone协议设备、配置BrightBeacon设备参数、模拟iBeacon等API。你可以访问[智石官网(http://www.brtbeacon.com)](http://www.brtbeacon.com)了解更多设备信息,或前往我们的[开发者社区(http://bbs.brtbeacon.com)](http://bbs.brtbeacon.com)交流和找到我们软硬件相关问题。 8 | 9 | 智石开发包需要手持设备硬件支持蓝牙4.0及其以上,并要求系统版本IOS7及其以上。 10 | 附:支持的IOS设备列表 11 | iphone4s及以上、 12 | itouch5及以上、 13 | iPad3及以上、 14 | iPad mini均可以 15 | 详情见:[http://en.wikipedia.org/wiki/List_of_iOS_devices](http://en.wikipedia.org/wiki/List_of_iOS_devices) 16 | 17 | ## 更新日志 18 | 19 | * 3.5.2 默认使用BeaconConstraints扫描iBeacon(2020.10) 20 | * 3.5.1 修复默认值设置(2020.04) 21 | * 3.5.0 修复IOS13读取,功率设定(2020.03) 22 | * 3.4.9 修复brtBeacons等API(2017.10) 23 | * 3.4.8 分离蓝牙、iBeacon扫描、区域监听回调API(2017.9) 24 | * 3.4.7 优化区域监听,请使用regionHander:(2017.3) 25 | 26 | ## 如何集成(任选其一) 27 | ### 一、使用CocoaPods集成 28 | 添加以下代码到您Pod项目的Podfile文件: 29 | 30 | ``` 31 | pod 'BrightSDK' 32 | ``` 33 | 在Podfile文件目录运行命令: 34 | (PS:请事先更新你本地的CocoaPods库:pod repo update,并pod install) 35 | 36 | ``` 37 | pod update 38 | ``` 39 | 40 | ### 二、使用常规集成 41 | 42 | 使用如下步骤手动集成: 43 | 44 | - 如果您还尚未下载SDK,请 [点击这里下载](https://github.com/BrightBeacon/BrightBeacon_iOS_SDK),或在GitHub搜索BrightBeacon。 45 | - 将下载的SDK文件解压,拖动里面的BrightSDK文件夹(内含include文件夹和.a库文件)到工程中 46 | - 拖到工程中后,弹出以下对话框,勾选"Copy items into destination group's folder(if needed)",并点击“Finish“按钮, 47 | 48 | 注意:请务必在上述步骤中选择“Create groups for any added folders”单选按钮组。如果你选择“Create folder references for any added folders”,一个蓝色的文件夹引用将被添加到项目并且将无法找到它的资源。 49 | 50 | 51 | 52 | - 注意:如果出现头文件无法找到,前往 project settings 的 build settings,搜索Header Search Paths. 添加"$(SRCROOT)/../BrightSDK/include",并检查实际目录地址。 53 | 54 | ## 三、IOS8以上配置定位权限 55 | * 打开Info.plist添加使用期间“WhenInUse”定位描述说明:NSLocationWhenInUseUsageDescription,(填写描述如:用于扫描iBeacon设备) 56 | * 若应用需要区域监听功能,需使用后台及使用期间定位权限“Always”(含“WhenInUse”),需添加3项以支持不同IOS版本:NSLocationAlwaysAndWhenInUseUsageDescription、NSLocationAlwaysUsageDescription和NSLocationWhenInUseUsageDescription 57 | 58 | ## 如何调用 59 | `1、注册APPKEY`
60 | 61 | - 登录BrightSDK的官方网站添加应用并获取 APPKEY。如果尚未注册,[请点击这里注册并创建应用 APPKEY](http://open.brtbeacon.com) 62 | 63 | ``` 64 | #import "BRTBeaconSDK.h" 65 | 66 | //如需配置设备,请注册appKey. 67 | [BRTBeaconSDK registerApp:(NSString *)appKey onCompletion:(BRTCompletionBlock)completion]; 68 | ``` 69 | `2、常见的API调用`
70 | 71 | - 扫描Regions内所有iBeacon设备(IOS7及以上,需要定位权限,并打开蓝牙,传入扫描UUID)。 72 | 73 | 通过BRTBeaconRegion扫描iBeacon设备(可扫描到参数proximityUUID、Major、Minor、proximity、accuracy、rssi),建议用于iBeacon定位、签到、区域推送等场景。 74 | 75 | ``` 76 | regions为BRTBeaconRegion数组(默认使用:E2C56DB5-DFFB-48D2-B060-D0F5A71096E0) 77 | [BRTBeaconSDK startRangingBeaconsInRegions:regions onCompletion:^(NSArray *beacons, BRTBeaconRegion *region, NSError *error){ 78 | }]; 79 | //停止扫描iBeacons 80 | [BRTBeaconSDK stopRangingBeacons]; 81 | ``` 82 | - 扫描BrightBeacon蓝牙设备(仅需打开蓝牙,支持配置BrightBeacon设备)。 83 | IOS6及以上,蓝牙设备扫描(允许连接配置、获取蓝牙参数如mac地址、电量等功能,无法获取iBeacon的proximityUUID、proximity),建议需要用于设备连接配置、巡检等场景。 84 | (如需后台扫描,必须限定扫描的服务,例如180a) 85 | 86 | ``` 87 | uuid: 88 | CBUUID数组,(设备广播数据中的服务,例:[[CBUUID alloc] initWithString:@"180a"];留空时能扫描所有服务,但不支持后台扫描。) 89 | [BRTBeaconSDK scanBleServices:(NSArray *)services onCompletion:^(NSArray *beacons, BRTBeaconRegion *region, NSError *error){ 90 | }]; 91 | //停止扫描BrightBeacon 92 | [BRTBeaconSDK stopScan]; 93 | ``` 94 | 95 | - 监听区域方法(IOS7及以上,需要定位权限,并打开蓝牙) 96 | 97 | //如需后台监听区域,请在随App启动的类(如:appDelegate的didFinishLaunch方法)中调用regionHandler;并且handler也必须启动自行初始化,保证监听到区域自启动软件时,handler能成功回调区域相关函数。简约使用时,可以直接使用appDelegate类。 98 | 99 | ``` 100 | [BRTBeaconSDK regionHandler:handler]; 101 | ``` 102 | 103 | * 以下是在前台运行、后台或完全退出程序监听区域的回调函数,请拷贝需要的回调到handler类 104 | 105 | ``` 106 | 进入区域回调 107 | -(void)beaconManager:(BRTBeaconManager *)manager didEnterRegion:(BRTBeaconRegion *)region{ 108 | } 109 | 离开区域回调 110 | -(void)beaconManager:(BRTBeaconManager *)manager didExitRegion:(BRTBeaconRegion *)region{ 111 | } 112 | 屏幕点亮区域检测、requestStateForRegions回调 113 | -(void)beaconManager:(BRTBeaconManager *)manager didDetermineState:(CLRegionState)state forRegion:(BRTBeaconRegion *)region{ 114 | } 115 | ``` 116 | - 启动监听区域 117 | 118 | region:需要监听的区域,支持后台监听(<=20),当进入、离开区域时,APP会后台自启动,你有约10s处理相关逻辑。在IOS8以上startMonitoringForRegions内会调取系统获取定位权限。你也可以自行控制调取弹窗时机或权限类型。 119 | 120 | ``` 121 | //ios8以上自行获取权限方式 122 | [[[BRTBeaconSDK Share] brtmanager] requestAlwaysAuthorization]; 123 | ``` 124 | 125 | ``` 126 | //监听区域示例 127 | BRTBeaconRegion *region = [[BRTBeaconRegion alloc] initWithProximityUUID:@"这里传人需要监听的iBeacon设备的UUID" identifier:@"区域唯一标识符,会覆盖已有相同id的区域"]; 128 | region.notifyOnEntry = YES;//监听进入区域 129 | region.notifyOnExit = YES;//离开区域时回调 130 | region.notifyEntryStateOnDisplay = YES;//是否锁屏唤醒时,监测区域状态 131 | [BRTBeaconSDK startMonitoringForRegions:@[region]]; 132 | ``` 133 | 134 | - 立即监测区域状态 135 | 136 | ``` 137 | [BRTBeaconSDK requestStateForRegions:@[region]]; 138 | ``` 139 | - 监听的所有区域;当前活跃的区域 140 | 141 | ``` 142 | [[[BRTBeaconSDK Share] brtmanager] monitoredRegions]; 143 | [[[BRTBeaconSDK Share] brtmanager] rangedRegions]; 144 | ``` 145 | ## 相关文档或网站 146 | * [关于后台区域监听(必读)](https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/LocationAwarenessPG/RegionMonitoring/RegionMonitoring.html#//apple_ref/doc/uid/TP40009497-CH9-SW1) 147 | * [区域监听回调相关描述](https://developer.apple.com/documentation/corelocation/cllocationmanagerdelegate/1423570-locationmanager) 148 | * [集成文档](https://github.com/BrightBeacon/BrightBeacon_iOS_SDK) 149 | * [API文档](http://brightbeacon.github.io/BrightBeacon_iOS_SDK) 150 | * [开发者社区](http://bbs.brtbeacon.com) 151 | * [智石官网](http://www.brtbeacon.com) 152 | -------------------------------------------------------------------------------- /docs/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_iOS_SDK/fa3459eb71d7bad33e9cdda261c3ebe9b5aaef6a/docs/.DS_Store -------------------------------------------------------------------------------- /docs/Blocks/BRTCompletionBlock.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | BRTCompletionBlock Block Reference 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | 16 |

17 | BRTBeaconSDK 18 |

19 | 20 |

21 | 智石科技 22 |

23 | 24 |
25 |
26 | 27 | 57 | 58 |
59 |
60 |
61 |
62 |

BRTCompletionBlock Block Reference

63 | 64 | 65 |
66 | 67 | 68 | 69 | 70 |
Declared inBRTBeaconDefinitions.h
71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 |

Block Definition

82 |

BRTCompletionBlock

83 | 84 | 85 | typedef void (^BRTCompletionBlock) (BOOL complete, NSError *error) 86 | 87 | 88 | 89 | 90 | 91 |
92 | 93 |
94 | 102 |
103 |
104 |
105 |
106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /docs/Blocks/BRTDataCompletionBlock.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | BRTDataCompletionBlock Block Reference 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | 16 |

17 | BRTBeaconSDK 18 |

19 | 20 |

21 | 智石科技 22 |

23 | 24 |
25 |
26 | 27 | 57 | 58 |
59 |
60 |
61 |
62 |

BRTDataCompletionBlock Block Reference

63 | 64 | 65 |
66 | 67 | 68 | 69 | 70 |
Declared inBRTBeaconDefinitions.h
71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 |

Block Definition

82 |

BRTDataCompletionBlock

83 | 84 | 85 | typedef void (^BRTDataCompletionBlock) (id data, NSError *error) 86 | 87 | 88 | 89 | 90 | 91 |
92 | 93 |
94 | 102 |
103 |
104 |
105 |
106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /docs/Blocks/RangingiBeaconsCompletionBlock.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | RangingiBeaconsCompletionBlock Block Reference 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | 16 |

17 | BRTBeaconSDK 18 |

19 | 20 |

21 | 智石科技 22 |

23 | 24 |
25 |
26 | 27 | 57 | 58 |
59 |
60 |
61 |
62 |

RangingiBeaconsCompletionBlock Block Reference

63 | 64 | 65 |
66 | 67 | 68 | 69 | 70 |
Declared inBRTBeaconSDK.h
71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 |

Block Definition

82 |

RangingiBeaconsCompletionBlock

83 | 84 | 85 | typedef void (^RangingiBeaconsCompletionBlock) (NSArray *beacons, BRTBeaconRegion *region, NSError *error) 86 | 87 | 88 | 89 | 90 | 91 |
92 | 93 |
94 | 102 |
103 |
104 |
105 |
106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /docs/Blocks/ScanBlesCompletionBlock.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ScanBlesCompletionBlock Block Reference 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | 16 |

17 | BRTBeaconSDK 18 |

19 | 20 |

21 | 智石科技 22 |

23 | 24 |
25 |
26 | 27 | 57 | 58 |
59 |
60 |
61 |
62 |

ScanBlesCompletionBlock Block Reference

63 | 64 | 65 |
66 | 67 | 68 | 69 | 70 |
Declared inBRTBeaconSDK.h
71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 |

Block Definition

82 |

ScanBlesCompletionBlock

83 | 84 | 85 | typedef void (^ScanBlesCompletionBlock) (NSArray *beacons, NSError *error) 86 | 87 | 88 | 89 | 90 | 91 |
92 | 93 |
94 | 102 |
103 |
104 |
105 |
106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /docs/Blocks/locBlock.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | locBlock Block Reference 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | 16 |

17 | BRTBeaconSDK 18 |

19 | 20 |

21 | 智石科技 22 |

23 | 24 |
25 |
26 | 27 | 57 | 58 |
59 |
60 |
61 |
62 |

locBlock Block Reference

63 | 64 | 65 |
66 | 67 | 68 | 69 | 70 |
Declared inBRTBeaconManager.h
71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 |

Block Definition

82 |

locBlock

83 | 84 | 85 |
86 |

获取用户位置信息

87 |
88 | 89 | 90 | 91 | typedef void (^locBlock) (CLLocation *location, CLPlacemark *placemark, NSError *error) 92 | 93 | 94 | 95 |
96 |

Discussion

97 |

获取用户位置信息

98 |
99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 |
109 |

Declared In

110 | BRTBeaconManager.h
111 |
112 | 113 | 114 | 115 |
116 | 117 |
118 | 126 |
127 |
128 |
129 |
130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /docs/Classes/BRTBeaconRegion.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | BRTBeaconRegion Class Reference 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | 16 |

17 | BRTBeaconSDK 18 |

19 | 20 |

21 | 智石科技 22 |

23 | 24 |
25 |
26 | 27 | 67 | 68 |
69 |
70 |
71 |
72 |

BRTBeaconRegion Class Reference

73 | 74 | 75 |
76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 |
Inherits fromCLBeaconRegion
Declared inBRTBeaconRegion.h
84 | 85 | 86 | 87 | 88 |
89 | 90 |

Overview

91 |

BRTBeaconRegion定义了一类区域,是基于蓝牙设备,而不是一个地理位置。beacon区域寻找设备的识别信息匹配您提供的信息,当一个设备范围,该区域触发一个适当的通知

92 | 93 |

您可以监视信标区域在两个方面。设备进入或退出时接收通知附近的beacon,使用startMonitoringForRegion:你的位置管理器对象的方法。当beacon在范围内,你也可以调用startRangingBeaconsInRegion:方法开始时接收通知的相对的距离变化.

94 | 95 |

BRTBeaconRegion 扩展了基本的CLBeaconRegion类(IOS13及以上已使用了initWithUUID:)。

96 |
97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 |
108 | 109 |
110 | 118 |
119 |
120 |
121 |
122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /docs/Classes/BRTTools.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | BRTTools Class Reference 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | 16 |

17 | BRTBeaconSDK 18 |

19 | 20 |

21 | 智石科技 22 |

23 | 24 |
25 |
26 | 27 | 77 | 78 |
79 |
80 |
81 |
82 |

BRTTools Class Reference

83 | 84 | 85 |
86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 |
Inherits fromNSObject
Declared inBRTTools.h
94 | 95 | 96 | 97 | 98 | 99 | 100 |
101 | 102 | 103 | 104 | 105 | 106 | 107 |
108 |
109 | 110 |

+ eddystoneFromUrl: 111 |

112 | 113 |
114 |
115 | 116 |
117 | 118 | 119 |
120 |

转换Url为eddystone模式NSData 121 | 参考:https://github.com/google/eddystone/tree/master/eddystone-url

122 |
123 | 124 | 125 | 126 |
+ (NSData *)eddystoneFromUrl:(NSString *)url
127 | 128 | 129 | 130 |
131 |

Parameters

132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 |
url

例(https://www.brtbeacon.com)->()

140 |
141 | 142 | 143 | 144 |
145 |

Return Value

146 |

NSData

147 |
148 | 149 | 150 | 151 | 152 | 153 |
154 |

Discussion

155 |

转换Url为eddystone模式NSData 156 | 参考:https://github.com/google/eddystone/tree/master/eddystone-url

157 |
158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 |
166 |

Declared In

167 |

BRTTools.h

168 |
169 | 170 | 171 |
172 |
173 |
174 | 175 |

+ urlFromEddystone: 176 |

177 | 178 |
179 |
180 | 181 |
182 | 183 | 184 |
185 |

将eddystone模式下的Url字符串转换为普通url

186 |
187 | 188 | 189 | 190 |
+ (NSString *)urlFromEddystone:(NSString *)eddyUrl
191 | 192 | 193 | 194 |
195 |

Parameters

196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 |
eddystoneUrl

eddystone-URL字符串

204 |
205 | 206 | 207 | 208 |
209 |

Return Value

210 |

NSString

211 |
212 | 213 | 214 | 215 | 216 | 217 |
218 |

Discussion

219 |

将eddystone模式下的Url字符串转换为普通url

220 |
221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 |
229 |

Declared In

230 |

BRTTools.h

231 |
232 | 233 | 234 |
235 |
236 |
237 | 238 |

+ distanceByRssi:oneMeterRssi: 239 |

240 | 241 |
242 |
243 | 244 |
245 | 246 | 247 |
248 |

距离估算方法,用于衡量不同设备距离差值,相对实际距离可能有误差

249 |
250 | 251 | 252 | 253 |
+ (double)distanceByRssi:(NSInteger)rssi oneMeterRssi:(NSInteger)mpower
254 | 255 | 256 | 257 |
258 |

Parameters

259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 |
rssi

接收信号强度

mpower

1米处信号强度

272 |
273 | 274 | 275 | 276 |
277 |

Return Value

278 |

估算距离值

279 |
280 | 281 | 282 | 283 | 284 | 285 |
286 |

Discussion

287 |

距离估算方法,用于衡量不同设备距离差值,相对实际距离可能有误差

288 |
289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 |
297 |

Declared In

298 |

BRTTools.h

299 |
300 | 301 | 302 |
303 |
304 |
305 |
306 | 307 |
308 | 309 | 310 | 311 | 312 | 313 | 314 |
315 | 316 |
317 | 325 |
326 |
327 |
328 |
329 | 330 | 331 | 332 | -------------------------------------------------------------------------------- /docs/Constants/BroadcastMode.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | BroadcastMode Constants Reference 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | 16 |

17 | BRTBeaconSDK 18 |

19 | 20 |

21 | 智石科技 22 |

23 | 24 |
25 |
26 | 27 | 57 | 58 |
59 |
60 |
61 |
62 |

BroadcastMode Constants Reference

63 | 64 | 65 |
66 | 67 | 68 | 69 | 70 |
Declared inBRTBeaconDefinitions.h
71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 |

BroadcastMode

79 | 80 |
81 | 82 | 83 |

Definition

84 | typedef NS_ENUM(NSInteger, BroadcastMode ) {
85 | 86 |    Broadcast_iBeacon_Only = 0,
87 | 88 |    Broadcast_eddystone_Uid_Only = 2,
89 | 90 |    Broadcast_eddystone_Url_Only = 3,
91 | 92 |    Broadcast_iBeacon_eddystone_Uid = 4,
93 | 94 |    Broadcast_iBeacon_eddystone_Url = 5,
95 | 96 |    Broadcast_eddystone_Url_Uid = 6,
97 | 98 | };
99 | 100 |
101 | 102 |
103 |

Constants

104 |
105 | 106 |
Broadcast_iBeacon_Only
107 |
108 | 109 | 110 |

111 | Declared In BRTBeaconDefinitions.h. 112 |

113 | 114 |
115 | 116 |
Broadcast_eddystone_Uid_Only
117 |
118 | 119 | 120 |

121 | Declared In BRTBeaconDefinitions.h. 122 |

123 | 124 |
125 | 126 |
Broadcast_eddystone_Url_Only
127 |
128 | 129 | 130 |

131 | Declared In BRTBeaconDefinitions.h. 132 |

133 | 134 |
135 | 136 |
Broadcast_iBeacon_eddystone_Uid
137 |
138 | 139 | 140 |

141 | Declared In BRTBeaconDefinitions.h. 142 |

143 | 144 |
145 | 146 |
Broadcast_iBeacon_eddystone_Url
147 |
148 | 149 | 150 |

151 | Declared In BRTBeaconDefinitions.h. 152 |

153 | 154 |
155 | 156 |
Broadcast_eddystone_Url_Uid
157 |
158 | 159 | 160 |

161 | Declared In BRTBeaconDefinitions.h. 162 |

163 | 164 |
165 | 166 |
167 |
168 | 169 | 170 | 171 | 172 | 173 | 174 |
175 | 176 |
177 | 185 |
186 |
187 |
188 |
189 | 190 | 191 | 192 | -------------------------------------------------------------------------------- /docs/Constants/BrtSupports.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | BrtSupports Constants Reference 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | 16 |

17 | BRTBeaconSDK 18 |

19 | 20 |

21 | 智石科技 22 |

23 | 24 |
25 |
26 | 27 | 57 | 58 |
59 |
60 |
61 |
62 |

BrtSupports Constants Reference

63 | 64 | 65 |
66 | 67 | 68 | 69 | 70 |
Declared inBRTBeaconDefinitions.h
71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 |

BrtSupports

79 | 80 | 81 |
82 |

//恢复默认参数列表

83 |
84 | 85 | 86 |
87 | 88 | 89 |

Definition

90 | typedef NS_OPTIONS(NSUInteger, BrtSupports ) {
91 | 92 |    BrtSupportsCC254x = 1 < < 0,
93 | 94 |    BrtSupportsNordic = 1 < < 1,
95 | 96 |    BrtSupportsLight = 1 < < 2,
97 | 98 |    BrtSupportsCombineCharacteristic = 1 < < 3,
99 | 100 |    BrtSupportsAntiLose = 1 < < 4,
101 | 102 |    BrtSupports16Key = 1 < < 5,
103 | 104 |    BrtSupportsUpdateName = 1 < < 6,
105 | 106 |    BrtSupportsAli = 1 < < 7,
107 | 108 |    BrtSupportsEddystone = BrtSupportsAli,
109 | 110 |    BrtSupportsSerialData = 1 < < 8,
111 | 112 |    BrtSupportsAdvRFOff = 1 < < 9,
113 | 114 |    BrtSupportsUserData = 1 < < 10,
115 | 116 |    BrtSupportsExtension = 1 < < 11,
117 | 118 |    BrtSupportsEncrypt = 1 < < 12,
119 | 120 |    BrtSupportsAB = 1 < < 13,
121 | 122 | };
123 | 124 |
125 | 126 |
127 |

Constants

128 |
129 | 130 |
BrtSupportsCC254x
131 |
132 | 133 | 134 |

//恢复默认参数列表

135 | 136 | 137 | 138 | 139 | 140 | 141 |

142 | Declared In BRTBeaconDefinitions.h. 143 |

144 | 145 |
146 | 147 |
BrtSupportsNordic
148 |
149 | 150 | 151 |

//恢复默认参数列表

152 | 153 | 154 | 155 | 156 | 157 | 158 |

159 | Declared In BRTBeaconDefinitions.h. 160 |

161 | 162 |
163 | 164 |
BrtSupportsLight
165 |
166 | 167 | 168 |

//恢复默认参数列表

169 | 170 | 171 | 172 | 173 | 174 | 175 |

176 | Declared In BRTBeaconDefinitions.h. 177 |

178 | 179 |
180 | 181 |
BrtSupportsCombineCharacteristic
182 |
183 | 184 | 185 |

//恢复默认参数列表

186 | 187 | 188 | 189 | 190 | 191 | 192 |

193 | Declared In BRTBeaconDefinitions.h. 194 |

195 | 196 |
197 | 198 |
BrtSupportsAntiLose
199 |
200 | 201 | 202 |

//恢复默认参数列表

203 | 204 | 205 | 206 | 207 | 208 | 209 |

210 | Declared In BRTBeaconDefinitions.h. 211 |

212 | 213 |
214 | 215 |
BrtSupports16Key
216 |
217 | 218 | 219 |

//恢复默认参数列表

220 | 221 | 222 | 223 | 224 | 225 | 226 |

227 | Declared In BRTBeaconDefinitions.h. 228 |

229 | 230 |
231 | 232 |
BrtSupportsUpdateName
233 |
234 | 235 | 236 |

//恢复默认参数列表

237 | 238 | 239 | 240 | 241 | 242 | 243 |

244 | Declared In BRTBeaconDefinitions.h. 245 |

246 | 247 |
248 | 249 |
BrtSupportsAli
250 |
251 | 252 | 253 |

//恢复默认参数列表

254 | 255 | 256 | 257 | 258 | 259 | 260 |

261 | Declared In BRTBeaconDefinitions.h. 262 |

263 | 264 |
265 | 266 |
BrtSupportsEddystone
267 |
268 | 269 | 270 |

//恢复默认参数列表

271 | 272 | 273 | 274 | 275 | 276 | 277 |

278 | Declared In BRTBeaconDefinitions.h. 279 |

280 | 281 |
282 | 283 |
BrtSupportsSerialData
284 |
285 | 286 | 287 |

//恢复默认参数列表

288 | 289 | 290 | 291 | 292 | 293 | 294 |

295 | Declared In BRTBeaconDefinitions.h. 296 |

297 | 298 |
299 | 300 |
BrtSupportsAdvRFOff
301 |
302 | 303 | 304 |

//恢复默认参数列表

305 | 306 | 307 | 308 | 309 | 310 | 311 |

312 | Declared In BRTBeaconDefinitions.h. 313 |

314 | 315 |
316 | 317 |
BrtSupportsUserData
318 |
319 | 320 | 321 |

//恢复默认参数列表

322 | 323 | 324 | 325 | 326 | 327 | 328 |

329 | Declared In BRTBeaconDefinitions.h. 330 |

331 | 332 |
333 | 334 |
BrtSupportsExtension
335 |
336 | 337 | 338 |

//恢复默认参数列表

339 | 340 | 341 | 342 | 343 | 344 | 345 |

346 | Declared In BRTBeaconDefinitions.h. 347 |

348 | 349 |
350 | 351 |
BrtSupportsEncrypt
352 |
353 | 354 | 355 |

//恢复默认参数列表

356 | 357 | 358 | 359 | 360 | 361 | 362 |

363 | Declared In BRTBeaconDefinitions.h. 364 |

365 | 366 |
367 | 368 |
BrtSupportsAB
369 |
370 | 371 | 372 |

//恢复默认参数列表

373 | 374 | 375 | 376 | 377 | 378 | 379 |

380 | Declared In BRTBeaconDefinitions.h. 381 |

382 | 383 |
384 | 385 |
386 |
387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 |
396 |

Declared In

397 |

BRTBeaconDefinitions.h

398 |
399 | 400 | 401 | 402 | 403 | 404 |
405 | 406 |
407 | 415 |
416 |
417 |
418 |
419 | 420 | 421 | 422 | -------------------------------------------------------------------------------- /docs/Constants/DevelopPublishMode.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | DevelopPublishMode Constants Reference 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | 16 |

17 | BRTBeaconSDK 18 |

19 | 20 |

21 | 智石科技 22 |

23 | 24 |
25 |
26 | 27 | 57 | 58 |
59 |
60 |
61 |
62 |

DevelopPublishMode Constants Reference

63 | 64 | 65 |
66 | 67 | 68 | 69 | 70 |
Declared inBRTBeaconDefinitions.h
71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 |

DevelopPublishMode

79 | 80 |
81 | 82 | 83 |

Definition

84 | typedef NS_ENUM(NSInteger, DevelopPublishMode ) {
85 | 86 |    DevelopMode = 0,
87 | 88 |    PublishMode,
89 | 90 | };
91 | 92 |
93 | 94 |
95 |

Constants

96 |
97 | 98 |
DevelopMode
99 |
100 | 101 | 102 |

103 | Declared In BRTBeaconDefinitions.h. 104 |

105 | 106 |
107 | 108 |
PublishMode
109 |
110 | 111 | 112 |

113 | Declared In BRTBeaconDefinitions.h. 114 |

115 | 116 |
117 | 118 |
119 |
120 | 121 | 122 | 123 | 124 | 125 | 126 |
127 | 128 |
129 | 137 |
138 |
139 |
140 |
141 | 142 | 143 | 144 | -------------------------------------------------------------------------------- /docs/Constants/ErrorCode.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | ErrorCode Constants Reference 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | 16 |

17 | BRTBeaconSDK 18 |

19 | 20 |

21 | 智石科技 22 |

23 | 24 |
25 |
26 | 27 | 57 | 58 |
59 |
60 |
61 |
62 |

ErrorCode Constants Reference

63 | 64 | 65 |
66 | 67 | 68 | 69 | 70 |
Declared inBRTBeaconDefinitions.h
71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 |

ErrorCode

79 | 80 |
81 | 82 | 83 |

Definition

84 | typedef NS_ENUM(NSInteger, ErrorCode ) {
85 | 86 |    ErrorCodeUnKnown = 0,
87 | 88 |    CBErrorCode1 = 1,
89 | 90 |    CBErrorCode2 = 2,
91 | 92 |    CBErrorCode3 = 3,
93 | 94 |    CBErrorCode4 = 4,
95 | 96 |    CBErrorCode5 = 5,
97 | 98 |    CBErrorCode6 = 6,
99 | 100 |    CBErrorCode7 = 7,
101 | 102 |    CBErrorCode8 = 8,
103 | 104 |    CBErrorCode9 = 9,
105 | 106 |    CBErrorCode10 = 10,
107 | 108 |    ErrorCode100 = 100,
109 | 110 |    ErrorCode101 = 101,
111 | 112 |    ErrorCode102 = 102,
113 | 114 |    ErrorCode103 = 103,
115 | 116 |    ErrorCode104 = 104,
117 | 118 |    ErrorCode105 = 105,
119 | 120 |    ErrorCode106 = 106,
121 | 122 |    ErrorCode107 = 107,
123 | 124 |    ErrorCode108 = 108,
125 | 126 |    ErrorCode109 = 109,
127 | 128 |    ErrorCode110 = 110,
129 | 130 | };
131 | 132 |
133 | 134 |
135 |

Constants

136 |
137 | 138 |
ErrorCodeUnKnown
139 |
140 | 141 | 142 |

143 | Declared In BRTBeaconDefinitions.h. 144 |

145 | 146 |
147 | 148 |
CBErrorCode1
149 |
150 | 151 | 152 |

153 | Declared In BRTBeaconDefinitions.h. 154 |

155 | 156 |
157 | 158 |
CBErrorCode2
159 |
160 | 161 | 162 |

163 | Declared In BRTBeaconDefinitions.h. 164 |

165 | 166 |
167 | 168 |
CBErrorCode3
169 |
170 | 171 | 172 |

173 | Declared In BRTBeaconDefinitions.h. 174 |

175 | 176 |
177 | 178 |
CBErrorCode4
179 |
180 | 181 | 182 |

183 | Declared In BRTBeaconDefinitions.h. 184 |

185 | 186 |
187 | 188 |
CBErrorCode5
189 |
190 | 191 | 192 |

193 | Declared In BRTBeaconDefinitions.h. 194 |

195 | 196 |
197 | 198 |
CBErrorCode6
199 |
200 | 201 | 202 |

203 | Declared In BRTBeaconDefinitions.h. 204 |

205 | 206 |
207 | 208 |
CBErrorCode7
209 |
210 | 211 | 212 |

213 | Declared In BRTBeaconDefinitions.h. 214 |

215 | 216 |
217 | 218 |
CBErrorCode8
219 |
220 | 221 | 222 |

223 | Declared In BRTBeaconDefinitions.h. 224 |

225 | 226 |
227 | 228 |
CBErrorCode9
229 |
230 | 231 | 232 |

233 | Declared In BRTBeaconDefinitions.h. 234 |

235 | 236 |
237 | 238 |
CBErrorCode10
239 |
240 | 241 | 242 |

243 | Declared In BRTBeaconDefinitions.h. 244 |

245 | 246 |
247 | 248 |
ErrorCode100
249 |
250 | 251 | 252 |

253 | Declared In BRTBeaconDefinitions.h. 254 |

255 | 256 |
257 | 258 |
ErrorCode101
259 |
260 | 261 | 262 |

263 | Declared In BRTBeaconDefinitions.h. 264 |

265 | 266 |
267 | 268 |
ErrorCode102
269 |
270 | 271 | 272 |

273 | Declared In BRTBeaconDefinitions.h. 274 |

275 | 276 |
277 | 278 |
ErrorCode103
279 |
280 | 281 | 282 |

283 | Declared In BRTBeaconDefinitions.h. 284 |

285 | 286 |
287 | 288 |
ErrorCode104
289 |
290 | 291 | 292 |

293 | Declared In BRTBeaconDefinitions.h. 294 |

295 | 296 |
297 | 298 |
ErrorCode105
299 |
300 | 301 | 302 |

303 | Declared In BRTBeaconDefinitions.h. 304 |

305 | 306 |
307 | 308 |
ErrorCode106
309 |
310 | 311 | 312 |

313 | Declared In BRTBeaconDefinitions.h. 314 |

315 | 316 |
317 | 318 |
ErrorCode107
319 |
320 | 321 | 322 |

323 | Declared In BRTBeaconDefinitions.h. 324 |

325 | 326 |
327 | 328 |
ErrorCode108
329 |
330 | 331 | 332 |

333 | Declared In BRTBeaconDefinitions.h. 334 |

335 | 336 |
337 | 338 |
ErrorCode109
339 |
340 | 341 | 342 |

343 | Declared In BRTBeaconDefinitions.h. 344 |

345 | 346 |
347 | 348 |
ErrorCode110
349 |
350 | 351 | 352 |

353 | Declared In BRTBeaconDefinitions.h. 354 |

355 | 356 |
357 | 358 |
359 |
360 | 361 | 362 | 363 | 364 | 365 | 366 |
367 | 368 |
369 | 377 |
378 |
379 |
380 |
381 | 382 | 383 | 384 | -------------------------------------------------------------------------------- /docs/Protocols/BRTBeaconDelegate.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | BRTBeaconDelegate Protocol Reference 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | 16 |

17 | BRTBeaconSDK 18 |

19 | 20 |

21 | 智石科技 22 |

23 | 24 |
25 |
26 | 27 | 79 | 80 |
81 |
82 |
83 |
84 |

BRTBeaconDelegate Protocol Reference

85 | 86 | 87 |
88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 |
Conforms toNSObject
Declared inBRTBeacon.h
96 | 97 | 98 | 99 | 100 |
101 | 102 |

Overview

103 |

BRTBeaconDelegate 定义了 beacon 连接相关的委托方法,beacon 的连接是一个异步操作,因此你只需要实现例如beaconDidDisconnect:相关方法,它们会被自动回调.

104 |
105 | 106 | 107 | 108 | 109 | 110 |
111 | 112 | 113 | 114 | 115 | 116 | 117 |
118 |
119 | 120 |

– beaconConnection:withError: 121 |

122 | 123 |
124 |
125 | 126 |
127 | 128 | 129 |
130 |

beacon连接产生错误回调该方法.

131 |
132 | 133 | 134 | 135 |
- (void)beaconConnection:(BRTBeacon *)beacon withError:(NSError *)error
136 | 137 | 138 | 139 |
140 |

Parameters

141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 |
beacon

关联的beacon实体

error

错误的描述信息

154 |
155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 |
163 |

Discussion

164 |

beacon连接产生错误回调该方法.

165 |
166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 |
174 |

Declared In

175 |

BRTBeacon.h

176 |
177 | 178 | 179 |
180 |
181 |
182 | 183 |

– beaconDidDisconnect:withError: 184 |

185 | 186 |
187 |
188 | 189 |
190 | 191 | 192 |
193 |

beacon与设备已经断开连接回调该方法

194 |
195 | 196 | 197 | 198 |
- (void)beaconDidDisconnect:(BRTBeacon *)beacon withError:(NSError *)error
199 | 200 | 201 | 202 |
203 |

Parameters

204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 |
beacon

关联的beacon实体

error

错误的描述信息

217 |
218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 |
226 |

Discussion

227 |

beacon与设备已经断开连接回调该方法

228 |
229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 |
237 |

Declared In

238 |

BRTBeacon.h

239 |
240 | 241 | 242 |
243 |
244 |
245 | 246 |

– beacon:didUpdateValue:error: 247 |

248 | 249 |
250 |
251 | 252 |
253 | 254 | 255 |
256 |

beacon 050x读写参数回调

257 |
258 | 259 | 260 | 261 |
- (void)beacon:(BRTBeacon *)beacon didUpdateValue:(NSData *)value error:(NSError *)error
262 | 263 | 264 | 265 |
266 |

Parameters

267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 |
beacon

关联的beacon实体

error

返回错误信息

data

返回数据信息

285 |
286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 |
294 |

Discussion

295 |

beacon 050x读写参数回调

296 |
297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 |
305 |

Declared In

306 |

BRTBeacon.h

307 |
308 | 309 | 310 |
311 |
312 |
313 |
314 | 315 |
316 | 317 | 318 | 319 | 320 | 321 | 322 |
323 | 324 |
325 | 333 |
334 |
335 |
336 |
337 | 338 | 339 | 340 | -------------------------------------------------------------------------------- /docs/css/scss/_index.scss: -------------------------------------------------------------------------------- 1 | .index-container { 2 | -webkit-flex-direction: column; 3 | flex-direction: column; 4 | 5 | @media (min-width: $desktop-min-width) { 6 | display: flex; 7 | -webkit-flex-direction: row; 8 | flex-direction: row; 9 | -webkit-flex-wrap: wrap; 10 | flex-wrap: wrap; 11 | } 12 | 13 | .index-column { 14 | -webkit-flex: 1 1 33%; 15 | flex: 1 1 33%; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /docs/css/scss/_layout.scss: -------------------------------------------------------------------------------- 1 | * { 2 | box-sizing: border-box; 3 | } 4 | 5 | .clear { 6 | clear: both; 7 | } 8 | 9 | .clearfix { 10 | &:before, &:after { 11 | clear: both; 12 | display: table; 13 | content: ""; 14 | } 15 | } 16 | 17 | .xcode .hide-in-xcode { 18 | display: none; 19 | } 20 | 21 | body { 22 | font: 62.5% $body-font; 23 | background: $body-background; 24 | 25 | @media (max-width: $mobile-max-width) { 26 | background-color: $content-background; 27 | } 28 | } 29 | 30 | h1, h2, h3 { 31 | font-weight: 300; 32 | color: #808080; 33 | } 34 | 35 | h1 { 36 | font-size: 2em; 37 | color: #000; 38 | } 39 | 40 | h4 { 41 | font-size: 13px; 42 | line-height: 1.5; 43 | margin: 21px 0 0 0; 44 | } 45 | 46 | a { 47 | color: $tint-color; 48 | text-decoration: none; 49 | } 50 | 51 | pre, code { 52 | font-family: $code-font; 53 | word-wrap: break-word; 54 | } 55 | 56 | pre > code, .method-declaration code { 57 | display: inline-block; 58 | font-size: .85em; 59 | padding: 4px 0 4px 10px; 60 | border-left: 5px solid rgba(0, 155, 51, .2); 61 | 62 | &:before { 63 | content: "Objective-C"; 64 | display: block; 65 | 66 | font: 9px/1 $body-font; 67 | color: #009b33; 68 | text-transform: uppercase; 69 | letter-spacing: 2px; 70 | padding-bottom: 6px; 71 | } 72 | } 73 | 74 | pre > code { 75 | font-size: inherit; 76 | } 77 | 78 | table, th, td { 79 | border: 1px solid #e9e9e9; 80 | } 81 | 82 | table { 83 | width: 100%; 84 | } 85 | 86 | th, td { 87 | padding: 7px; 88 | 89 | > :first-child { 90 | margin-top: 0; 91 | } 92 | 93 | > :last-child { 94 | margin-bottom: 0; 95 | } 96 | } 97 | 98 | .container { 99 | @extend .clearfix; 100 | 101 | max-width: 980px; 102 | padding: 0 10px; 103 | margin: 0 auto; 104 | 105 | @media (max-width: $mobile-max-width) { 106 | padding: 0; 107 | } 108 | } 109 | 110 | header { 111 | position: fixed; 112 | top: 0; 113 | left: 0; 114 | width: 100%; 115 | z-index: 2; 116 | 117 | background: #414141; 118 | color: #fff; 119 | font-size: 1.1em; 120 | line-height: 25px; 121 | letter-spacing: .05em; 122 | 123 | #library-title { 124 | float: left; 125 | } 126 | 127 | #developer-home { 128 | float: right; 129 | } 130 | 131 | h1 { 132 | font-size: inherit; 133 | font-weight: inherit; 134 | margin: 0; 135 | } 136 | 137 | p { 138 | margin: 0; 139 | } 140 | 141 | h1, a { 142 | color: inherit; 143 | } 144 | 145 | @media (max-width: $mobile-max-width) { 146 | .container { 147 | padding: 0 10px; 148 | } 149 | } 150 | } 151 | 152 | aside { 153 | position: fixed; 154 | top: 25px; 155 | left: 0; 156 | width: 100%; 157 | height: 25px; 158 | z-index: 2; 159 | 160 | font-size: 1.1em; 161 | 162 | #header-buttons { 163 | background: rgba(255, 255, 255, .8); 164 | margin: 0 1px; 165 | padding: 0; 166 | list-style: none; 167 | text-align: right; 168 | line-height: 32px; 169 | 170 | li { 171 | display: inline-block; 172 | cursor: pointer; 173 | padding: 0 10px; 174 | } 175 | 176 | label, select { 177 | cursor: inherit; 178 | } 179 | 180 | #on-this-page { 181 | position: relative; 182 | 183 | .chevron { 184 | display: inline-block; 185 | width: 14px; 186 | height: 4px; 187 | position: relative; 188 | 189 | .chevy { 190 | background: #878787; 191 | height: 2px; 192 | position: absolute; 193 | width: 10px; 194 | 195 | &.chevron-left { 196 | left: 0; 197 | transform: rotateZ(45deg) scale(0.6); 198 | } 199 | 200 | &.chevron-right { 201 | right: 0; 202 | transform: rotateZ(-45deg) scale(0.6); 203 | } 204 | } 205 | } 206 | 207 | #jump-to { 208 | opacity: 0; 209 | font-size: 16px; 210 | 211 | position: absolute; 212 | top: 5px; 213 | left: 0; 214 | width: 100%; 215 | height: 100%; 216 | } 217 | } 218 | } 219 | } 220 | 221 | article { 222 | margin-top: 25px; 223 | 224 | #content { 225 | @extend .clearfix; 226 | 227 | background: $content-background; 228 | border: 1px solid $content-border; 229 | padding: 15px 25px 30px 25px; 230 | 231 | font-size: 1.4em; 232 | line-height: 1.45; 233 | 234 | position: relative; 235 | 236 | @media (max-width: $mobile-max-width) { 237 | padding: 15px 10px 20px 10px; 238 | border: none; 239 | } 240 | 241 | .navigation-top { 242 | position: absolute; 243 | top: 15px; 244 | right: 25px; 245 | } 246 | 247 | .title { 248 | margin: 21px 0 0 0; 249 | padding: 15px 0; 250 | } 251 | 252 | p { 253 | color: #414141; 254 | margin: 0 0 15px 0; 255 | } 256 | 257 | th, td { 258 | p:last-child { 259 | margin-bottom: 0; 260 | } 261 | } 262 | 263 | main { 264 | ul { 265 | list-style: none; 266 | margin-left: 24px; 267 | margin-bottom: 12px; 268 | padding: 0; 269 | 270 | li { 271 | position: relative; 272 | padding-left: 1.3em; 273 | 274 | &:before { 275 | content: "\02022"; 276 | 277 | color: #414141; 278 | font-size: 1.08em; 279 | line-height: 1; 280 | 281 | position: absolute; 282 | left: 0; 283 | padding-top: 2px; 284 | } 285 | } 286 | } 287 | } 288 | 289 | footer { 290 | @extend .clearfix; 291 | 292 | .footer-copyright { 293 | margin: 70px 25px 10px 0; 294 | } 295 | 296 | p { 297 | font-size: .71em; 298 | color: #a0a0a0; 299 | } 300 | } 301 | } 302 | } 303 | -------------------------------------------------------------------------------- /docs/css/scss/_object.scss: -------------------------------------------------------------------------------- 1 | .section-specification { 2 | table { 3 | width: auto; 4 | 5 | th { 6 | text-align: left; 7 | } 8 | } 9 | } 10 | 11 | .method-title { 12 | margin-left: -15px; 13 | margin-bottom: 8px; 14 | transition: margin-left .3s ease-out; 15 | 16 | .section-method.hide & { 17 | margin-left: 0; 18 | } 19 | 20 | code { 21 | font-weight: 400; 22 | font-size: .85em; 23 | } 24 | } 25 | 26 | .method-info { 27 | background: $object-background; 28 | border-bottom: 1px solid $object-border; 29 | margin: 0 -25px; 30 | padding: 20px 25px 0 25px; 31 | transition: height .3s ease-out; 32 | 33 | position: relative; 34 | 35 | .pointy-thing { 36 | background: $content-background; 37 | height: 10px; 38 | border-bottom: 1px solid $object-border; 39 | margin: -20px -25px 16px -25px; 40 | 41 | &:before { 42 | display: inline-block; 43 | content: ""; 44 | 45 | background: $object-background; 46 | border: 1px solid $object-border; 47 | border-bottom: 0; 48 | border-right: 0; 49 | 50 | position: absolute; 51 | left: 21px; 52 | top: 3px; 53 | width: 12px; 54 | height: 12px; 55 | transform: rotate(45deg); 56 | } 57 | } 58 | 59 | .method-subsection { 60 | margin-bottom: 15px; 61 | 62 | .argument-name { 63 | width: 1px; 64 | text-align: right; 65 | 66 | code { 67 | color: #808080; 68 | font-style: italic; 69 | font-weight: 400; 70 | } 71 | } 72 | } 73 | } 74 | 75 | .section-method { 76 | &.hide .method-info { 77 | height: 0 !important; 78 | overflow: hidden; 79 | display: none; 80 | } 81 | 82 | &.hide.animating .method-info { 83 | display: block; 84 | } 85 | 86 | &.animating .method-info { 87 | overflow: hidden; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /docs/css/scss/_print.scss: -------------------------------------------------------------------------------- 1 | @media print { 2 | body { 3 | background: #fff; 4 | padding: 8px; 5 | } 6 | 7 | header { 8 | position: static; 9 | background: #fff; 10 | color: #000; 11 | } 12 | 13 | aside { 14 | display: none; 15 | } 16 | 17 | .container { 18 | max-width: none; 19 | padding: 0; 20 | } 21 | 22 | article { 23 | margin-top: 0; 24 | 25 | #content { 26 | border: 0; 27 | background: #fff; 28 | padding: 15px 0 0 0; 29 | 30 | .title { 31 | margin-top: 0; 32 | padding-top: 0; 33 | } 34 | } 35 | } 36 | 37 | .method-info { 38 | &, & .pointy-thing { 39 | background: #fff; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /docs/css/scss/_variables.scss: -------------------------------------------------------------------------------- 1 | $body-font: -apple-system-font, "Helvetica Neue", Helvetica, sans-serif; 2 | $code-font: "Source Code Pro", Monaco, Menlo, Consolas, monospace; 3 | 4 | $body-background: #f2f2f2; 5 | $content-background: #fff; 6 | $content-border: #e9e9e9; 7 | $tint-color: #08c; 8 | $object-background: #f9f9f9; 9 | $object-border: #e9e9e9; 10 | 11 | $mobile-max-width: 650px; 12 | $desktop-min-width: 768px; -------------------------------------------------------------------------------- /docs/css/scss/_xcode.scss: -------------------------------------------------------------------------------- 1 | .xcode { 2 | header, aside { 3 | display: none; 4 | } 5 | 6 | .container { 7 | padding: 0; 8 | } 9 | 10 | article { 11 | margin-top: 0; 12 | 13 | #content { 14 | border: 0; 15 | margin: 0; 16 | } 17 | } 18 | 19 | .method-info { 20 | &, .section-method.hide & { 21 | max-height: auto; 22 | overflow: visible; 23 | 24 | &.hiding { 25 | display: block; 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /docs/css/scss/style.scss: -------------------------------------------------------------------------------- 1 | @import "variables", "normalize", "layout", "index", "object", "print", "xcode"; 2 | -------------------------------------------------------------------------------- /docs/css/style.css: -------------------------------------------------------------------------------- 1 | html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}h1{font-size:2em;margin:0.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace, monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}input[type="number"]::-webkit-inner-spin-button,input[type="number"]::-webkit-outer-spin-button{height:auto}input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:bold}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}*{box-sizing:border-box}.clear{clear:both}.clearfix:before,.container:before,article #content:before,article #content footer:before,.clearfix:after,.container:after,article #content:after,article #content footer:after{clear:both;display:table;content:""}.xcode .hide-in-xcode{display:none}body{font:62.5% -apple-system-font,"Helvetica Neue",Helvetica,sans-serif;background:#f2f2f2}@media (max-width: 650px){body{background-color:#fff}}h1,h2,h3{font-weight:300;color:#808080}h1{font-size:2em;color:#000}h4{font-size:13px;line-height:1.5;margin:21px 0 0 0}a{color:#08c;text-decoration:none}pre,code{font-family:"Source Code Pro",Monaco,Menlo,Consolas,monospace;word-wrap:break-word}pre>code,.method-declaration code{display:inline-block;font-size:.85em;padding:4px 0 4px 10px;border-left:5px solid rgba(0,155,51,0.2)}pre>code:before,.method-declaration code:before{content:"Objective-C";display:block;font:9px/1 -apple-system-font,"Helvetica Neue",Helvetica,sans-serif;color:#009b33;text-transform:uppercase;letter-spacing:2px;padding-bottom:6px}pre>code{font-size:inherit}table,th,td{border:1px solid #e9e9e9}table{width:100%}th,td{padding:7px}th>:first-child,td>:first-child{margin-top:0}th>:last-child,td>:last-child{margin-bottom:0}.container{max-width:980px;padding:0 10px;margin:0 auto}@media (max-width: 650px){.container{padding:0}}header{position:fixed;top:0;left:0;width:100%;z-index:2;background:#414141;color:#fff;font-size:1.1em;line-height:25px;letter-spacing:.05em}header #library-title{float:left}header #developer-home{float:right}header h1{font-size:inherit;font-weight:inherit;margin:0}header p{margin:0}header h1,header a{color:inherit}@media (max-width: 650px){header .container{padding:0 10px}}aside{position:fixed;top:25px;left:0;width:100%;height:25px;z-index:2;font-size:1.1em}aside #header-buttons{background:rgba(255,255,255,0.8);margin:0 1px;padding:0;list-style:none;text-align:right;line-height:32px}aside #header-buttons li{display:inline-block;cursor:pointer;padding:0 10px}aside #header-buttons label,aside #header-buttons select{cursor:inherit}aside #header-buttons #on-this-page{position:relative}aside #header-buttons #on-this-page .chevron{display:inline-block;width:14px;height:4px;position:relative}aside #header-buttons #on-this-page .chevron .chevy{background:#878787;height:2px;position:absolute;width:10px}aside #header-buttons #on-this-page .chevron .chevy.chevron-left{left:0;transform:rotateZ(45deg) scale(0.6)}aside #header-buttons #on-this-page .chevron .chevy.chevron-right{right:0;transform:rotateZ(-45deg) scale(0.6)}aside #header-buttons #on-this-page #jump-to{opacity:0;font-size:16px;position:absolute;top:5px;left:0;width:100%;height:100%}article{margin-top:25px}article #content{background:#fff;border:1px solid #e9e9e9;padding:15px 25px 30px 25px;font-size:1.4em;line-height:1.45;position:relative}@media (max-width: 650px){article #content{padding:15px 10px 20px 10px;border:none}}article #content .navigation-top{position:absolute;top:15px;right:25px}article #content .title{margin:21px 0 0 0;padding:15px 0}article #content p{color:#414141;margin:0 0 15px 0}article #content th p:last-child,article #content td p:last-child{margin-bottom:0}article #content main ul{list-style:none;margin-left:24px;margin-bottom:12px;padding:0}article #content main ul li{position:relative;padding-left:1.3em}article #content main ul li:before{content:"\02022";color:#414141;font-size:1.08em;line-height:1;position:absolute;left:0;padding-top:2px}article #content footer .footer-copyright{margin:70px 25px 10px 0}article #content footer p{font-size:.71em;color:#a0a0a0}.index-container{-webkit-flex-direction:column;flex-direction:column}@media (min-width: 768px){.index-container{display:flex;-webkit-flex-direction:row;flex-direction:row;-webkit-flex-wrap:wrap;flex-wrap:wrap}}.index-container .index-column{-webkit-flex:1 1 33%;flex:1 1 33%}.section-specification table{width:auto}.section-specification table th{text-align:left}.method-title{margin-left:-15px;margin-bottom:8px;transition:margin-left .3s ease-out}.section-method.hide .method-title{margin-left:0}.method-title code{font-weight:400;font-size:.85em}.method-info{background:#f9f9f9;border-bottom:1px solid #e9e9e9;margin:0 -25px;padding:20px 25px 0 25px;transition:height .3s ease-out;position:relative}.method-info .pointy-thing{background:#fff;height:10px;border-bottom:1px solid #e9e9e9;margin:-20px -25px 16px -25px}.method-info .pointy-thing:before{display:inline-block;content:"";background:#f9f9f9;border:1px solid #e9e9e9;border-bottom:0;border-right:0;position:absolute;left:21px;top:3px;width:12px;height:12px;-webkit-transform:rotate(45deg);transform:rotate(45deg) }.method-info .method-subsection{margin-bottom:15px}.method-info .method-subsection .argument-name{width:1px;text-align:right}.method-info .method-subsection .argument-name code{color:#808080;font-style:italic;font-weight:400}.section-method.hide .method-info{height:0 !important;overflow:hidden;display:none}.section-method.hide.animating .method-info{display:block}.section-method.animating .method-info{overflow:hidden}@media print{body{background:#fff;padding:8px}header{position:static;background:#fff;color:#000}aside{display:none}.container{max-width:none;padding:0}article{margin-top:0}article #content{border:0;background:#fff;padding:15px 0 0 0}article #content .title{margin-top:0;padding-top:0}.method-info,.method-info .pointy-thing{background:#fff}}.xcode header,.xcode aside{display:none}.xcode .container{padding:0}.xcode article{margin-top:0}.xcode article #content{border:0;margin:0}.xcode .method-info,.section-method.hide .xcode .method-info{max-height:auto;overflow:visible}.xcode .method-info.hiding,.section-method.hide .xcode .method-info.hiding{display:block} 2 | 3 | -------------------------------------------------------------------------------- /docs/hierarchy.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | BRTBeaconSDK Hierarchy 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | 16 |

17 | BRTBeaconSDK 18 |

19 | 20 |

21 | 智石科技 22 |

23 | 24 |
25 |
26 | 27 | 36 | 37 |
38 |
39 |
40 |
41 |

BRTBeaconSDK Hierarchy

42 | 43 | 44 |
45 |

Class Hierarchy

46 | 47 | 72 | 73 |
74 | 75 | 76 | 77 |
78 | 79 |

Protocol References

80 | 89 | 90 | 91 |

Constant References

92 | 103 | 104 | 105 |
106 | 107 | 108 |
109 | 117 |
118 |
119 |
120 |
121 |
122 | 123 | 124 | 125 | -------------------------------------------------------------------------------- /docs/img/button_bar_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_iOS_SDK/fa3459eb71d7bad33e9cdda261c3ebe9b5aaef6a/docs/img/button_bar_background.png -------------------------------------------------------------------------------- /docs/img/disclosure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_iOS_SDK/fa3459eb71d7bad33e9cdda261c3ebe9b5aaef6a/docs/img/disclosure.png -------------------------------------------------------------------------------- /docs/img/disclosure_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_iOS_SDK/fa3459eb71d7bad33e9cdda261c3ebe9b5aaef6a/docs/img/disclosure_open.png -------------------------------------------------------------------------------- /docs/img/library_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_iOS_SDK/fa3459eb71d7bad33e9cdda261c3ebe9b5aaef6a/docs/img/library_background.png -------------------------------------------------------------------------------- /docs/img/title_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BrightBeacon/BrightBeacon_iOS_SDK/fa3459eb71d7bad33e9cdda261c3ebe9b5aaef6a/docs/img/title_background.png -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | BRTBeaconSDK Reference 7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 |
15 | 16 |

17 | BRTBeaconSDK 18 |

19 | 20 |

21 | 智石科技 22 |

23 | 24 |
25 |
26 | 27 | 36 | 37 |
38 |
39 |
40 |
41 |

BRTBeaconSDK Reference

42 | 43 | 44 | 45 |
46 | 47 | 48 | 49 |
50 |

Class References

51 | 64 |
65 | 66 | 67 | 68 |
69 | 70 |

Protocol References

71 | 80 | 81 | 82 | 83 |

Constant References

84 | 95 | 96 | 97 | 98 |
99 | 100 |
101 | 102 |
103 | 111 |
112 |
113 |
114 |
115 |
116 | 117 | 118 | 119 | -------------------------------------------------------------------------------- /docs/js/script.js: -------------------------------------------------------------------------------- 1 | function $() { 2 | return document.querySelector.apply(document, arguments); 3 | } 4 | 5 | if (navigator.userAgent.indexOf("Xcode") != -1) { 6 | document.documentElement.classList.add("xcode"); 7 | } 8 | 9 | var jumpTo = $("#jump-to"); 10 | 11 | if (jumpTo) { 12 | jumpTo.addEventListener("change", function(e) { 13 | location.hash = this.options[this.selectedIndex].value; 14 | }); 15 | } 16 | 17 | function hashChanged() { 18 | if (/^#\/\/api\//.test(location.hash)) { 19 | var element = document.querySelector("a[name='" + location.hash.substring(1) + "']"); 20 | 21 | if (!element) { 22 | return; 23 | } 24 | 25 | element = element.parentNode; 26 | 27 | element.classList.remove("hide"); 28 | fixScrollPosition(element); 29 | } 30 | } 31 | 32 | function fixScrollPosition(element) { 33 | var scrollTop = element.offsetTop - 150; 34 | document.documentElement.scrollTop = scrollTop; 35 | document.body.scrollTop = scrollTop; 36 | } 37 | 38 | [].forEach.call(document.querySelectorAll(".section-method"), function(element) { 39 | element.classList.add("hide"); 40 | 41 | element.querySelector(".method-title a").addEventListener("click", function(e) { 42 | var info = element.querySelector(".method-info"), 43 | infoContainer = element.querySelector(".method-info-container"); 44 | 45 | element.classList.add("animating"); 46 | info.style.height = (infoContainer.clientHeight + 40) + "px"; 47 | fixScrollPosition(element); 48 | element.classList.toggle("hide"); 49 | if (element.classList.contains("hide")) { 50 | e.preventDefault(); 51 | } 52 | setTimeout(function() { 53 | element.classList.remove("animating"); 54 | }, 300); 55 | }); 56 | }); 57 | 58 | window.addEventListener("hashchange", hashChanged); 59 | hashChanged(); 60 | --------------------------------------------------------------------------------