motion-sensoro 0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,132 @@
1
+ //
2
+ // SBKBeaconID.h
3
+ // Sensoro Beacon Kit
4
+ //
5
+ // Created by Blankwonder on 6/13/14.
6
+ // Copyright (c) 2014 Sensoro Inc. All rights reserved.
7
+ //
8
+
9
+ #import <Foundation/Foundation.h>
10
+ #import <CoreLocation/CoreLocation.h>
11
+
12
+ extern NSUUID * SBKSensoroDefaultProximityUUID;
13
+
14
+ /**
15
+ * SBKBeaconID instance is an obejct to specify a beacon’s identity. The proximityUUID property will never be nil, major and minor are optional.
16
+ */
17
+
18
+
19
+ @interface SBKBeaconID : NSObject <NSCopying>
20
+
21
+ /**---------------------------------------------------------------------------------------
22
+ * @name Initializing the Beacon ID
23
+ * ---------------------------------------------------------------------------------------
24
+ */
25
+
26
+ /**
27
+ * Initializes and returns a SBKBeaconID object that targets a beacon with the specified proximity ID
28
+ *
29
+ * @param proximityUUID The unique ID of the beacons being targeted. This value must not be nil.
30
+ *
31
+ * @return An initialized SBKBeaconID object.
32
+ */
33
+ + (instancetype)beaconIDWithProximityUUID:(NSUUID *)proximityUUID;
34
+
35
+ /**
36
+ * Initializes and returns a SBKBeaconID object that targets a beacon with the specified proximity ID
37
+ *
38
+ * @param proximityUUID The unique ID of the beacons being targeted. This value must not be nil.
39
+ * @param major The major value that you use to identify one or more beacons.
40
+ *
41
+ * @return An initialized SBKBeaconID object.
42
+ */
43
+ + (instancetype)beaconIDWithProximityUUID:(NSUUID *)proximityUUID major:(CLBeaconMajorValue)major;
44
+
45
+ /**
46
+ * Initializes and returns a SBKBeaconID object that targets a beacon with the specified proximity ID
47
+ *
48
+ * @param proximityUUID The unique ID of the beacons being targeted. This value must not be nil.
49
+ * @param major The major value that you use to identify one or more beacons.
50
+ * @param minor The minor value that you use to identify a specific beacon.
51
+ *
52
+ * @return An initialized SBKBeaconID object.
53
+ */
54
+ + (instancetype)beaconIDWithProximityUUID:(NSUUID *)proximityUUID major:(CLBeaconMajorValue)major minor:(CLBeaconMinorValue)minor;
55
+
56
+ /**---------------------------------------------------------------------------------------
57
+ * @name Comparing Beacon IDs
58
+ * ---------------------------------------------------------------------------------------
59
+ */
60
+
61
+ /**
62
+ * Returns a Boolean value that indicates whether the receiver and a given beacon id are equal.
63
+ *
64
+ * @param aBeaconID The beacon id with which to compare the receiver.
65
+ *
66
+ * @return YES if the receiver and aBeaconID are equal, otherwise NO.
67
+ */
68
+ - (BOOL)isEqualToBeaconID:(SBKBeaconID *)aBeaconID;
69
+
70
+ /**---------------------------------------------------------------------------------------
71
+ * @name Accessing the Attributes
72
+ * ---------------------------------------------------------------------------------------
73
+ */
74
+
75
+ /**
76
+ * The unique ID of the beacons being targeted. (read-only)
77
+ */
78
+ @property (readonly, nonatomic) NSUUID *proximityUUID;
79
+
80
+ /**
81
+ * The value identifying a group of beacons. (read-only)
82
+ */
83
+ @property (readonly, nonatomic) NSNumber *major;
84
+
85
+ /**
86
+ * The value identifying a specific beacon within a group. (read-only)
87
+ */
88
+ @property (readonly, nonatomic) NSNumber *minor;
89
+
90
+ /**---------------------------------------------------------------------------------------
91
+ * @name Bridge to Core Bluetooth
92
+ * ---------------------------------------------------------------------------------------
93
+ */
94
+
95
+ /**
96
+ * Convert a SBKBeaconID object to a CLBeaconRegion object.
97
+ *
98
+ * @return A CLBeaconRegion object.
99
+ */
100
+ - (CLBeaconRegion *)CLBeaconRegion;
101
+
102
+ /**
103
+ * Convert a CLBeaconRegion object to a SBKBeaconID object.
104
+ *
105
+ * @param region A CLBeaconRegion object.
106
+ *
107
+ * @return A SBKBeaconID object.
108
+ */
109
+ + (instancetype)beaconIDFromCLBeaconRegion:(CLBeaconRegion *)region;
110
+
111
+ /**---------------------------------------------------------------------------------------
112
+ * @name Bridge to String
113
+ * ---------------------------------------------------------------------------------------
114
+ */
115
+
116
+ /**
117
+ * Returns a string representation of the receiver.
118
+ *
119
+ * @return The string representation of the receiver.
120
+ */
121
+ - (NSString *)stringRepresentation;
122
+
123
+ /**
124
+ * Initializes and returns a SBKBeaconID object provided in a string representation.
125
+ *
126
+ * @param string A string that is in one of the formats returned by the stringRepresentation method.
127
+ *
128
+ * @return An initialized SBKBeaconID object.
129
+ */
130
+ + (instancetype)beaconIDWithString:(NSString *)string;
131
+
132
+ @end
@@ -0,0 +1,15 @@
1
+ //
2
+ // SBKBeaconManager.h
3
+ // SensoroCloud
4
+ //
5
+ // Created by David Yang on 14/12/22.
6
+ // Copyright (c) 2014年 Sensoro. All rights reserved.
7
+ //
8
+
9
+ #import "SBKBeaconManager.h"
10
+
11
+ @interface SBKBeaconManager (Cloud)
12
+
13
+ - (void)setCloudServiceEnable:(BOOL)set;
14
+
15
+ @end
@@ -0,0 +1,273 @@
1
+ //
2
+ // SBKBeaconManager.h
3
+ // Sensoro Beacon Kit
4
+ //
5
+ // Created by Blankwonder on 6/13/14.
6
+ // Copyright (c) 2014 Sensoro Inc. All rights reserved.
7
+ //
8
+
9
+ #import <Foundation/Foundation.h>
10
+ #import "SBKBeacon.h"
11
+
12
+ typedef enum : NSUInteger {
13
+ SBKBeacon_Appear,
14
+ } SBKBeacon_Action;
15
+
16
+ /// the block as a callback when a beacon do some action;
17
+ typedef void(^SBKBeaconWatcher)(SBKBeacon* beacon, SBKBeacon_Action action);
18
+
19
+ @protocol SBKBeaconManagerDelegate;
20
+
21
+ /**
22
+ * The SBKBeaconManager class defines the interface for configuring the delivery of beacon-related events to your application. You use an instance of this class to get SBKBeacon objects, and establish the parameters that determine which beacon's events should be delivered.
23
+ *
24
+ * You should always use the shared instance. Creating own instance is not allowed.
25
+ */
26
+ @interface SBKBeaconManager : NSObject
27
+
28
+ /**---------------------------------------------------------------------------------------
29
+ * @name Getting the Instance
30
+ * ---------------------------------------------------------------------------------------
31
+ */
32
+
33
+ /**
34
+ * Returns the shared instance of the SBKBeaconManager class. Users are not allowed to create own instance.
35
+ */
36
+ + (SBKBeaconManager *)sharedInstance;
37
+
38
+ /**---------------------------------------------------------------------------------------
39
+ * @name Setting and Getting the Delegate
40
+ * ---------------------------------------------------------------------------------------
41
+ */
42
+
43
+ /**
44
+ * The delegate of the app object.
45
+ */
46
+ @property (nonatomic, weak) id <SBKBeaconManagerDelegate> delegate;
47
+
48
+ /**---------------------------------------------------------------------------------------
49
+ * @name Initiating Beacon Ranging
50
+ * ---------------------------------------------------------------------------------------
51
+ */
52
+
53
+ /**
54
+ * Requests permission to use location services whenever the app is running.
55
+ *
56
+ * @discussion When the current authorization status is kCLAuthorizationStatusNotDetermined, calling this method prompts the user to grant permission to the app to use location services.The user prompt contains the text from the NSLocationAlwaysUsageDescription key in your app’s Info.plist file, and the presence of that key is required when calling this method. You must call this method or the requestWhenInUseAuthorization method prior to using location services. If the current authorization status is anything other than kCLAuthorizationStatusNotDetermined, this method does nothing.
57
+ * for detail [Apple's requestAlwaysAuthorization](https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/index.html#//apple_ref/occ/instm/CLLocationManager/requestAlwaysAuthorization)
58
+ *
59
+ */
60
+ - (void)requestAlwaysAuthorization;
61
+
62
+ /**
63
+ * Requests permission to use location services while the app is in the foreground.
64
+ *
65
+ * When the current authorization status is kCLAuthorizationStatusNotDetermined, calling this method prompts the user to grant permission to the app to use location services. The user prompt contains the text from the NSLocationWhenInUseUsageDescription key in your app’s Info.plist file, and the presence of that key is required when calling this method. You must call this method or the requestAlwaysAuthorization method prior to using location services. If the current authorization status is anything other than kCLAuthorizationStatusNotDetermined, this method does nothing.
66
+ * for detail [Apple's requestWhenInUseAuthorization](https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/index.html#//apple_ref/occ/instm/CLLocationManager/requestWhenInUseAuthorization)
67
+ *
68
+ */
69
+ - (void)requestWhenInUseAuthorization;
70
+
71
+ /**
72
+ * Starts the delivery of notifications for beacons with specified id.
73
+ *
74
+ * @param beaconID Using SBKBeaconID object to identify the beacons.
75
+ * @param wakeUpApplication Wake up your application in background when those beacons being ranged.
76
+ */
77
+ - (void)startRangingBeaconsWithID:(SBKBeaconID *)beaconID wakeUpApplication:(BOOL)wakeUpApplication;
78
+
79
+ /**
80
+ * Stops the delivery of notifications for beacons with specified id.
81
+ *
82
+ * @param beaconID Using SBKBeaconID object to identify the beacons.
83
+ */
84
+ - (void)stopRangingBeaconsWithID:(SBKBeaconID *)beaconID;
85
+
86
+ /**
87
+ * Stops the delivery of notifications for all beacons.
88
+ */
89
+ - (void)stopRangingAllBeacons;
90
+
91
+ /**
92
+ * Set the secret info to decrypt the broadcast info.
93
+ *
94
+ * @param secretInfo the secret info.
95
+ */
96
+ - (BOOL)addBroadcastKey:(NSString *)secretInfo;
97
+
98
+
99
+ /**
100
+ * Regiser a watcher to do something for new beacon.
101
+ *
102
+ * @param identifier serial number or uuid, major, minor (UUID|MAJOR|MINOR).
103
+ *
104
+ * @param type identifier's type, 0: serial number, 1: uuid, major, minor.
105
+ *
106
+ * @param watcher call this method when beacon will appear.
107
+ *
108
+ * @discussion Regiser a watcher to do something for new beacon that need setting before call didRangeNewBeacon,
109
+ * for example set beacon's inRangeMinimumRssiWhileEntering. for every indentifier in lifetime just call once.
110
+ * To call didRangeNewBeacon for a beacon may be many times, because you can enter a beacon many times;
111
+ */
112
+ - (void)registerBeaconAppearWatcher:(NSString *)identifier
113
+ type: (u_int8_t) type
114
+ watcher:(SBKBeaconWatcher) watcher;
115
+
116
+ /**
117
+ * The set of SBKBeaconID currently being ranged.
118
+ *
119
+ * @return The objects in the set are instances of the SBKBeaconID class
120
+ */
121
+ - (NSSet *)rangedBeaconIDs;
122
+
123
+ /**---------------------------------------------------------------------------------------
124
+ * @name Getting the Instance of Beacons
125
+ * ---------------------------------------------------------------------------------------
126
+ */
127
+
128
+ /**
129
+ * Get the beacon instance with SBKBeaconID object.
130
+ *
131
+ * @param beaconID Using SBKBeaconID object to identify the beacon you want.
132
+ *
133
+ * @return Beacon instance.
134
+ *
135
+ * @discussion This mehtod will return nil if the beacon has not been ranged. The beacon with same ID will only have one instance.
136
+ *
137
+ * @warning The SBKBeaconID object must have major and minor properties.
138
+ */
139
+ - (SBKBeacon *)beaconWithID:(SBKBeaconID *)beaconID;
140
+
141
+ /**
142
+ * Get the beacon instance with CLBeacon object.
143
+ *
144
+ * @param beacon Using CLBeacon's uuid major minor to identify the sensoro beacon you want.
145
+ *
146
+ * @return SBKBeacon instance.
147
+ *
148
+ * @discussion This mehtod will return a sensoso beacon corresponding CLBeacon object. if this beacon is not a sensoro beacon, it will return nil. if there is a SBKBeacon with same uuid, major, minor, it will return this SBKBeacon.
149
+ */
150
+ - (SBKBeacon *)beaconWithCLBeacon:(CLBeacon *)beacon;
151
+
152
+ /**
153
+ * Get the beacon instances in range now.
154
+ *
155
+ * @return Beacon instances in array, sorted by accuracy.
156
+ */
157
+ - (NSArray *)beaconsInRange;
158
+ /**
159
+ * Get all the beacon instances.
160
+ *
161
+ * @return Beacon instances in array.
162
+ */
163
+ - (NSArray *)allBeacons;
164
+
165
+ /**
166
+ * Disable the alert that was showed when BLE was power off. Defualt was show the alert dialog.
167
+ * You can call this method to disable this alert, before call other method.
168
+ *
169
+ */
170
+ - (void) disableBLEPowerAlert;
171
+
172
+ /**---------------------------------------------------------------------------------------
173
+ * @name Configuration
174
+ * ---------------------------------------------------------------------------------------
175
+ */
176
+
177
+ /**
178
+ * Delay out of range notifications delivering.
179
+ *
180
+ * @discussion In order to prevent notifications delivering too frequently, beacon will not be marked out of range immediately. Default value is 8 seconds, means a beacon will be marked out of range if it can not be ranged in last 8 seconds.
181
+ */
182
+ @property (readwrite, nonatomic) NSTimeInterval outOfRangeDelay;
183
+
184
+ /**
185
+ * return current SDK version.
186
+ *
187
+ */
188
+ @property (readonly, nonatomic) NSString* version;
189
+
190
+ /**
191
+ * Set whether enable duplicate key for scanning device in background mode.
192
+ * default is NO,To set this property before call startRangingBeaconsWithID.
193
+ *
194
+ * @discussion if set this property to YES, the SDK will continuously receive packet from device,
195
+ but this increase the power consumption, NO, SDK will receive one packet from device unless this packet was changed.
196
+ */
197
+ @property (readwrite, nonatomic) BOOL duplicateKeyBLE;
198
+
199
+ - (void)setDebugModeActive:(BOOL)active;
200
+
201
+ @end
202
+
203
+ /**
204
+ * The SBKBeaconManagerDelegate protocol defines the methods used to receive beacon updates from a SBKBeaconManager object.
205
+ */
206
+ @protocol SBKBeaconManagerDelegate <NSObject>
207
+
208
+ @optional
209
+
210
+ /**---------------------------------------------------------------------------------------
211
+ * @name Responding to beacon ranging
212
+ * ---------------------------------------------------------------------------------------
213
+ */
214
+
215
+ /**
216
+ * Tells the delegate that ranged a new beacon.
217
+ *
218
+ * @param beaconManager The beacon manager object reporting the event.
219
+ * @param beacon The beacon instance just be ranged.
220
+ */
221
+ - (void)beaconManager:(SBKBeaconManager *)beaconManager didRangeNewBeacon:(SBKBeacon *)beacon;
222
+
223
+ /**
224
+ * Tells the delegate that a beacon has been out of range.
225
+ *
226
+ * @param beaconManager The beacon manager object reporting the event.
227
+ * @param beacon The beacon instance just be out of range.
228
+ */
229
+ - (void)beaconManager:(SBKBeaconManager *)beaconManager beaconDidGone:(SBKBeacon *)beacon;
230
+
231
+ /**
232
+ * Tells the delegate that if one or more beacons are in range. This method will be called approximate every one second, even there is not beacon around.
233
+ *
234
+ * @param beaconManager The beacon manager object reporting the event.
235
+ * @param beacons An array of SBKBeacon objects representing the beacons currently in range. You can use the information in these objects to determine the range of each beacon and its identifying information.
236
+ */
237
+ - (void)beaconManager:(SBKBeaconManager *)beaconManager scanDidFinishWithBeacons:(NSArray *)beacons;
238
+
239
+ /**
240
+ * Tells the delegate that if one or more beacons are in range. those beacons include sensoro's beacons.
241
+ *
242
+ * @param beaconManager The beacon manager object reporting the event.
243
+ * @param beacons An array of CLBeacon objects representing the beacons currently in range. You can use the information in these objects to determine the range of each beacon and its identifying information.
244
+ * @param region The region beacons belong to.
245
+ * @discussion you can use beaconWithCLBeacon: of SBKBeaconManager to know whether this beacon is a sensoro beacon. because of ble scan delay, it is possible that a beacon is not sensoro beacon at first, after a little time, it become a sensoro beacon.
246
+ *
247
+ */
248
+ - (void)beaconManager:(SBKBeaconManager *)beaconManager didRangeBeacons:(NSArray *)beacons inRegion:(SBKBeaconID*) region;
249
+
250
+ /**
251
+ * Tells the delegate that the authorization status for the application changed.
252
+ *
253
+ * @param beaconManager The beacon manager object reporting the event.
254
+ * @param status The new authorization status for the application.
255
+ * @discussion This method is called whenever the application’s ability to use location services changes. Changes can occur because the user allowed or denied the use of location services for your application or for the system as a whole.
256
+ */
257
+ - (void)beaconManager:(SBKBeaconManager *)beaconManager didChangeAuthorizationStatus:(CLAuthorizationStatus)status;
258
+
259
+ /**
260
+ * It is same with locationManager:didDetermineState:forRegion: of CLLocationManagerDelegate
261
+ * Tells the delegate about the state of the specified region.
262
+ *
263
+ * @param beaconManager The beacon manager object reporting the event.
264
+ * @param state The state of the specified region. For a list of possible values, see the SBKRegionState type.
265
+ * @param region The region whose state was determined.
266
+ *
267
+ * @discussion see locationManager:didDetermineState:forRegion: of CLLocationManagerDelegate, When a app waked up by a region,
268
+ * The system will call SDK, SDK will call this delegate method.
269
+ */
270
+ - (void)beaconManager:(SBKBeaconManager *)beaconManager didDetermineState:(SBKRegionState) state forRegion:(SBKBeaconID*) region;
271
+
272
+
273
+ @end
@@ -0,0 +1,394 @@
1
+ //
2
+ // SBKConstants.h
3
+ // Sensoro Beacon Kit
4
+ //
5
+ // Created by Blankwonder on 8/23/14.
6
+ // Copyright (c) 2014 Sensoro Inc. All rights reserved.
7
+ //
8
+
9
+ /**
10
+ * Constants to indicate radio transmit power level.
11
+
12
+ * For Yunzi (A0):
13
+ * SBKBeaconTransmitPowerLevel0, instead of SBKBeaconTransmitPowerMin
14
+ * SBKBeaconTransmitPowerLevel1, instead of SBKBeaconTransmitPowerMedium
15
+ * SBKBeaconTransmitPowerLevel2, instead of SBKBeaconTransmitPowerMax
16
+
17
+ * For Yunzi (B0):
18
+ * SBKBeaconTransmitPowerLevel0
19
+ * SBKBeaconTransmitPowerLevel1
20
+ * SBKBeaconTransmitPowerLevel2
21
+ * SBKBeaconTransmitPowerLevel3
22
+ * SBKBeaconTransmitPowerLevel4
23
+ * SBKBeaconTransmitPowerLevel5
24
+ * SBKBeaconTransmitPowerLevel6
25
+ * SBKBeaconTransmitPowerLevel7
26
+
27
+ * For Yunzi (C0 double Antenna):
28
+ * SBKBeaconTransmitPowerLevel0
29
+ * SBKBeaconTransmitPowerLevel1
30
+ * SBKBeaconTransmitPowerLevel2
31
+ * SBKBeaconTransmitPowerLevel3
32
+ * SBKBeaconTransmitPowerLevel4
33
+ * SBKBeaconTransmitPowerLevel5
34
+ * SBKBeaconTransmitPowerLevel6
35
+ * SBKBeaconTransmitPowerLevel7
36
+ * SBKBeaconTransmitPowerLevel8
37
+ * SBKBeaconTransmitPowerLevel9
38
+ * SBKBeaconTransmitPowerLevel10
39
+ * SBKBeaconTransmitPowerLevel11
40
+
41
+ */
42
+ typedef NS_ENUM(int, SBKBeaconTransmitPower) {
43
+ /**
44
+ * The level is unknown.
45
+ */
46
+ SBKBeaconTransmitPowerUnknown = 0xff,
47
+
48
+ /**
49
+ * power level Leve0.
50
+ */
51
+ SBKBeaconTransmitPowerLevel0 = 0x00,
52
+ /**
53
+ * power level Leve1.
54
+ */
55
+ SBKBeaconTransmitPowerLevel1 = 0x01,
56
+ /**
57
+ * power level Leve2.
58
+ */
59
+ SBKBeaconTransmitPowerLevel2 = 0x02,
60
+ /**
61
+ * power level Leve3.
62
+ */
63
+ SBKBeaconTransmitPowerLevel3 = 0x03,
64
+ /**
65
+ * power level Leve4.
66
+ */
67
+ SBKBeaconTransmitPowerLevel4 = 0x04,
68
+ /**
69
+ * power level Leve5.
70
+ */
71
+ SBKBeaconTransmitPowerLevel5 = 0x05,
72
+ /**
73
+ * power level Leve6.
74
+ */
75
+ SBKBeaconTransmitPowerLevel6 = 0x06,
76
+ /**
77
+ * power level Leve7.
78
+ */
79
+ SBKBeaconTransmitPowerLevel7 = 0x07,
80
+
81
+ /**
82
+ * power level Leve8.
83
+ */
84
+ SBKBeaconTransmitPowerLevel8 = 0x08,
85
+ /**
86
+ * power level Leve9.
87
+ */
88
+ SBKBeaconTransmitPowerLevel9 = 0x09,
89
+ /**
90
+ * power level Leve10.
91
+ */
92
+ SBKBeaconTransmitPowerLevel10 = 0x0A,
93
+ /**
94
+ * power level Leve11.
95
+ */
96
+ SBKBeaconTransmitPowerLevel11 = 0x0B,
97
+ };
98
+
99
+ #define SBKBeaconTransmitPowerDefault SBKBeaconTransmitPowerLevel2
100
+
101
+ /**
102
+ * Constants to indicate advertising interval.
103
+ */
104
+ typedef NS_ENUM(int, SBKBeaconAdvertisingInterval) {
105
+ /**
106
+ * Unknown advertising interval.
107
+ */
108
+ SBKBeaconAdvertisingIntervalUnknown = 0xff,
109
+ /**
110
+ * The advertising interval is 100ms.
111
+ */
112
+ SBKBeaconAdvertisingInterval_100 = 0x00,
113
+ /**
114
+ * The advertising interval is 152.5ms.
115
+ */
116
+ SBKBeaconAdvertisingInterval_152_5 = 0x01,
117
+ /**
118
+ * The advertising interval is 211.25ms.
119
+ */
120
+ SBKBeaconAdvertisingInterval_211_25 = 0x02,
121
+ /**
122
+ * The advertising interval is 318.75ms.
123
+ */
124
+ SBKBeaconAdvertisingInterval_318_75 = 0x03,
125
+ /**
126
+ * The advertising interval is 417.5ms.
127
+ */
128
+ SBKBeaconAdvertisingInterval_417_5 = 0x04,
129
+ /**
130
+ * The advertising interval is 546.25ms.
131
+ */
132
+ SBKBeaconAdvertisingInterval_546_25 = 0x05,
133
+ /**
134
+ * The advertising interval is 760ms.
135
+ */
136
+ SBKBeaconAdvertisingInterval_760 = 0x06,
137
+ /**
138
+ * The advertising interval is 852.5ms.
139
+ */
140
+ SBKBeaconAdvertisingInterval_852_5 = 0x07,
141
+ /**
142
+ * The advertising interval is 1022.5ms.
143
+ */
144
+ SBKBeaconAdvertisingInterval_1022_5 = 0x08,
145
+ /**
146
+ * The advertising interval is 1285ms.
147
+ */
148
+ SBKBeaconAdvertisingInterval_1285 = 0x09
149
+ };
150
+
151
+ #define SBKBeaconAdvertisingIntervalDefault SBKBeaconAdvertisingInterval_417_5
152
+
153
+ /**
154
+ * Constants to indicate accelerometer sensitivity.
155
+ */
156
+ typedef NS_ENUM(int, SBKBeaconAccelerometerSensitivity) {
157
+ /**
158
+ * The accelerometer is unknown.
159
+ */
160
+ SBKBeaconAccelerometerSensitivityUnknown = 0xff,
161
+ /**
162
+ * The accelerometer is disabled.
163
+ */
164
+ SBKBeaconAccelerometerSensitivityDisabled = 0x00,
165
+ /**
166
+ * The accelerometer sensitivity is low.
167
+ */
168
+ SBKBeaconAccelerometerSensitivityLow,
169
+ /**
170
+ * The accelerometer sensitivity is medium.
171
+ */
172
+ SBKBeaconAccelerometerSensitivityMedium,
173
+ /**
174
+ * The accelerometer sensitivity is high.
175
+ */
176
+ SBKBeaconAccelerometerSensitivityHigh
177
+ };
178
+
179
+ #define SBKBeaconAccelerometerSensitivityDefault SBKBeaconAccelerometerSensitivityDisabled
180
+
181
+ /**
182
+ * Constants to indicate connection status.
183
+ */
184
+ typedef NS_ENUM(int, SBKBeaconConnectionStatus){
185
+ /**
186
+ * The connection is disconnected.
187
+ */
188
+ SBKBeaconConnectionStatusDisconnected = 0,
189
+ /**
190
+ * The connection is connecting.
191
+ */
192
+ SBKBeaconConnectionStatusConnecting,
193
+ /**
194
+ * The connection is connected.
195
+ */
196
+ SBKBeaconConnectionStatusConnected
197
+ };
198
+
199
+ /**
200
+ * Constants to indicate authorization status.
201
+ */
202
+ typedef NS_ENUM(int, SBKBeaconWritePermissionStatus){
203
+ /**
204
+ * The authorization status is unknown.
205
+ */
206
+ SBKBeaconWritePermissionStatusUnknown = 0xff,
207
+ /**
208
+ * This application is authorized to write value to the beacon.
209
+ */
210
+ SBKBeaconWritePermissionStatusAuthorized = 0x00,
211
+ /**
212
+ * This application is not authorized to write value to the beacon.
213
+ */
214
+ SBKBeaconWritePermissionStatusRestricted
215
+ };
216
+
217
+ /**
218
+ * Constants to indicate energy saving mode.
219
+ */
220
+ typedef NS_OPTIONS(int, SBKBeaconEnergySavingMode) {
221
+ /**
222
+ * Do not use any energy saving mode.
223
+ */
224
+ SBKBeaconEnergySavingModeNone = 0,
225
+ /**
226
+ * Automatically reduce advertising frequency when ambient light level is dark.
227
+ */
228
+ SBKBeaconEnergySavingModeLightSensor = 1 << 0
229
+ };
230
+
231
+
232
+ /**
233
+ * Constants to indicate secure broadcast change interval.
234
+ */
235
+ typedef NS_OPTIONS(int, SBKBeaconSecureBroadcastInterval) {
236
+ /**
237
+ * THe secure broadcast is unknown.
238
+ */
239
+ SBKBeaconSecureBroadcastIntervalUnknown = -1,
240
+ /**
241
+ * Do not use secure broadcast.
242
+ */
243
+ SBKBeaconSecureBroadcastIntervalNone = 0x00,
244
+ /**
245
+ * The secure broadcast interval is 5s.
246
+ */
247
+ SBKBeaconSecureBroadcastInterval_5s = 0x01,
248
+ /**
249
+ * The secure broadcast interval is 1 minute.
250
+ */
251
+ SBKBeaconSecureBroadcastInterval_1min = 0x02,
252
+ /**
253
+ * The secure broadcast interval is 1 hour.
254
+ */
255
+ SBKBeaconSecureBroadcastInterval_1hour = 0x03,
256
+ /**
257
+ * The secure broadcast interval is 1 day.
258
+ */
259
+ SBKBeaconSecureBroadcastInterval_1day = 0x04,
260
+ /**
261
+ * The secure broadcast interval is a week.
262
+ */
263
+ SBKBeaconSecureBroadcastInterval_7days = 0x05,
264
+ /**
265
+ * The secure broadcast interval is 30 days.
266
+ */
267
+ SBKBeaconSecureBroadcastInterval_30days = 0x06,
268
+ };
269
+
270
+ /**
271
+ * Constants to indicate work model of a beacon.
272
+ */
273
+ typedef NS_OPTIONS(int, SBKBeaconWorkMode) {
274
+ /**
275
+ * The work mode is unknown.
276
+ */
277
+ SBKBeaconWorkModeUnknown = -1,
278
+ /**
279
+ * The work model is mode 1 of a beacon B0 ( frimware version after 3.0 (include)) or A0
280
+ */
281
+ SBKBeaconWorkMode1 = 0x01,
282
+ /**
283
+ * The work mode is mode 2 of a beacon B0 ( frimware version after 3.0 (include)).
284
+ */
285
+ SBKBeaconWorkMode2 = 0x02,
286
+ /**
287
+ * The work mode is mode 3 of a beacon B0 ( frimware version after 3.0 (include)). or B0 (firmware version before 2.3 (include))
288
+ */
289
+ SBKBeaconWorkMode3 = 0x03,
290
+ /**
291
+ * The work mode is mode 4 of a beacon B0 ( frimware version after 3.0 (include)).
292
+ */
293
+ SBKBeaconWorkMode4 = 0x04,
294
+ };
295
+
296
+ /**
297
+ * Common command to flash the light. In comment belllow, '-' is on and '_' is off, one bit countinue 0.5s.
298
+ *
299
+ * You can use repeat parameter of 'flashLightWithCommand:repeat:completion:' to replay the command.
300
+ */
301
+ typedef NS_OPTIONS(u_int8_t, SBKCommonLigthFlashCommand) {
302
+ /**
303
+ * -_-_-_-_
304
+ */
305
+ SBKCommonFlashLightCommand_Normal = 0xAA,
306
+ /**
307
+ * --__--__
308
+ */
309
+ SBKCommonFlashLightCommand_22 = 0xCC,
310
+ /**
311
+ * -___-___
312
+ */
313
+ SBKCommonFlashLightCommand_13 = 0x88,
314
+ /**
315
+ * ---_---_
316
+ */
317
+ SBKCommonFlashLightCommand_31 = 0xEE,
318
+ /**
319
+ * ----____
320
+ */
321
+ SBKCommonFlashLightCommand_40 = 0xF0,
322
+ /**
323
+ * -----___
324
+ */
325
+ SBKCommonFlashLightCommand_53 = 0xF8
326
+ };
327
+
328
+ /**
329
+ * Report the state for region.
330
+ */
331
+ typedef NS_ENUM(int, SBKRegionState) {
332
+ /**
333
+ * the state was unknown.
334
+ */
335
+ SBKRegionStateUnknown,
336
+ /**
337
+ * enter a region.
338
+ */
339
+ SBKRegionStateEnter,
340
+ /**
341
+ * leave a region.
342
+ */
343
+ SBKRegionStateLeave
344
+ };
345
+
346
+ /**
347
+ * Package type for Eddystone.
348
+ */
349
+ typedef NS_ENUM(int, EddystonePackageType) {
350
+ /**
351
+ * Eddystone UID package.
352
+ */
353
+ EDDYSTONE_PACKAGE_UID = 0,
354
+ /**
355
+ * Eddystone URL package.
356
+ */
357
+ EDDYSTONE_PACKAGE_URL = 1,
358
+ /**
359
+ * Eddystone TLM package.
360
+ */
361
+ EDDYSTONE_PACKAGE_TLM = 2
362
+ };
363
+
364
+ /**
365
+ * The interval of eddystone's TLM package.
366
+ */
367
+ typedef NS_ENUM(int8_t, EddystoneTLMInterval) {
368
+
369
+ /**
370
+ * unknown type.
371
+ */
372
+ EDDYSTONE_TLM_INTERVAL_UNKNOWN = -1,
373
+
374
+ /**
375
+ * broadcast a eddystone TLM package per UID or URL package.
376
+ */
377
+ EDDYSTONE_TLM_INTERVAL_OnePerOne = 0x00,
378
+ /**
379
+ * broadcast a eddystone TLM package per five UID or URL package.
380
+ */
381
+ EDDYSTONE_TLM_INTERVAL_OnePerFive = 0x01,
382
+ /**
383
+ * broadcast a eddystone TLM package per ten UID or URL package.
384
+ */
385
+ EDDYSTONE_TLM_INTERVAL_OnePerTen = 0x02,
386
+ /**
387
+ * broadcast a eddystone TLM package per hundred UID or URL package.
388
+ */
389
+ EDDYSTONE_TLM_INTERVAL_OnePerHundred = 0x03
390
+ };
391
+
392
+
393
+
394
+