react-native-flic2 0.3.22 → 0.3.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/nl/xguard/flic2/service/Flic2Service.java +1 -1
- package/index.js +5 -5
- package/ios/Flic2.h +1 -5
- package/ios/Flic2.xcodeproj/project.pbxproj +34 -8
- package/ios/Flic2.xcodeproj/xcshareddata/xcschemes/Flic2.xcscheme +66 -0
- package/ios/Flic2.xcodeproj/xcuserdata/wesdewitte.xcuserdatad/xcschemes/xcschememanagement.plist +8 -0
- package/ios/Flic2.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +5 -0
- package/ios/Flic2.xcworkspace/xcuserdata/wesdewitte.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/Flic2.xcworkspace/xcuserdata/wesdewitte.xcuserdatad/WorkspaceSettings.xcsettings +14 -0
- package/ios/flic2lib.xcframework/Info.plist +56 -0
- package/ios/{Frameworks → flic2lib.xcframework/ios-arm64_armv7}/flic2lib.framework/Headers/FLICButton.h +10 -0
- package/ios/{Frameworks → flic2lib.xcframework/ios-arm64_armv7}/flic2lib.framework/Headers/FLICEnums.h +19 -0
- package/ios/{Frameworks → flic2lib.xcframework/ios-arm64_armv7}/flic2lib.framework/Info.plist +0 -0
- package/ios/flic2lib.xcframework/ios-arm64_armv7/flic2lib.framework/flic2lib +0 -0
- package/ios/flic2lib.xcframework/ios-arm64_x86_64-maccatalyst/flic2lib.framework/Versions/A/Headers/FLICButton.h +335 -0
- package/ios/flic2lib.xcframework/ios-arm64_x86_64-maccatalyst/flic2lib.framework/Versions/A/Headers/FLICEnums.h +315 -0
- package/ios/flic2lib.xcframework/ios-arm64_x86_64-maccatalyst/flic2lib.framework/Versions/A/Headers/FLICManager.h +171 -0
- package/ios/flic2lib.xcframework/ios-arm64_x86_64-maccatalyst/flic2lib.framework/Versions/A/Headers/flic2lib.h +19 -0
- package/ios/flic2lib.xcframework/ios-arm64_x86_64-maccatalyst/flic2lib.framework/Versions/A/Modules/module.modulemap +6 -0
- package/ios/flic2lib.xcframework/ios-arm64_x86_64-maccatalyst/flic2lib.framework/Versions/A/Resources/Info.plist +50 -0
- package/ios/flic2lib.xcframework/ios-arm64_x86_64-maccatalyst/flic2lib.framework/Versions/A/flic2lib +0 -0
- package/ios/flic2lib.xcframework/ios-arm64_x86_64-simulator/flic2lib.framework/Headers/FLICButton.h +335 -0
- package/ios/flic2lib.xcframework/ios-arm64_x86_64-simulator/flic2lib.framework/Headers/FLICEnums.h +315 -0
- package/ios/flic2lib.xcframework/ios-arm64_x86_64-simulator/flic2lib.framework/Headers/FLICManager.h +171 -0
- package/ios/flic2lib.xcframework/ios-arm64_x86_64-simulator/flic2lib.framework/Headers/flic2lib.h +19 -0
- package/ios/flic2lib.xcframework/ios-arm64_x86_64-simulator/flic2lib.framework/Info.plist +0 -0
- package/ios/flic2lib.xcframework/ios-arm64_x86_64-simulator/flic2lib.framework/Modules/module.modulemap +6 -0
- package/ios/flic2lib.xcframework/ios-arm64_x86_64-simulator/flic2lib.framework/flic2lib +0 -0
- package/package.json +1 -1
- package/react-native-flic2.podspec +2 -2
- package/ios/Frameworks/flic2lib.framework/flic2lib +0 -0
- /package/ios/{Frameworks → flic2lib.xcframework/ios-arm64_armv7}/flic2lib.framework/Headers/FLICManager.h +0 -0
- /package/ios/{Frameworks → flic2lib.xcframework/ios-arm64_armv7}/flic2lib.framework/Headers/flic2lib.h +0 -0
- /package/ios/{Frameworks → flic2lib.xcframework/ios-arm64_armv7}/flic2lib.framework/Modules/module.modulemap +0 -0
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
//
|
|
2
|
+
// FLICButton.h
|
|
3
|
+
// flic2lib
|
|
4
|
+
//
|
|
5
|
+
// Created by Anton Meier on 2019-04-11.
|
|
6
|
+
// Copyright © 2020 Shortcut Labs. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#import <Foundation/Foundation.h>
|
|
10
|
+
#import "FLICEnums.h"
|
|
11
|
+
|
|
12
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
13
|
+
|
|
14
|
+
@protocol FLICButtonDelegate;
|
|
15
|
+
|
|
16
|
+
/*!
|
|
17
|
+
* @class FLICButton
|
|
18
|
+
*
|
|
19
|
+
* @discussion An instance of this class represents a physical Flic.
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
@interface FLICButton : NSObject
|
|
23
|
+
|
|
24
|
+
/*!
|
|
25
|
+
* @property identifier
|
|
26
|
+
*
|
|
27
|
+
* @discussion This identifier is guaranteed to be the same for each Flic paired to a particular iOS device. Thus it can be used to identify a Flic within an app.
|
|
28
|
+
* However, If you need to identify Flics cross different apps on different iOS devices, then you should have look at the either uuid, serialNumber, or bluetoothAddress.
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
@property(readonly, nonatomic, strong, nonnull) NSUUID *identifier;
|
|
32
|
+
|
|
33
|
+
/*!
|
|
34
|
+
* @property delegate
|
|
35
|
+
*
|
|
36
|
+
* @discussion The delegate that will receive events related to this particular Flic.
|
|
37
|
+
* You can either set this delegate manually for each button, or let the manager do so automatically using the buttonDelegate as default.
|
|
38
|
+
*
|
|
39
|
+
*/
|
|
40
|
+
@property(weak, nonatomic, nullable) id<FLICButtonDelegate> delegate;
|
|
41
|
+
|
|
42
|
+
/*!
|
|
43
|
+
* @property name
|
|
44
|
+
*
|
|
45
|
+
* @discussion The bluetooth advertisement name of the Flic. This will be the same name that is shown by iOS it its bluetooth settings.
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
@property(nonatomic, readonly, strong, nullable) NSString *name;
|
|
49
|
+
|
|
50
|
+
/*!
|
|
51
|
+
* @property nickname
|
|
52
|
+
*
|
|
53
|
+
* @discussion With this property you can read out the display name that the user may change in for example the Flic app. This value can also be changed from third party apps
|
|
54
|
+
* integrating this framework (including your app). The purpose of this is to provide more human readable name that the user can use to identify its Flic's across apps.
|
|
55
|
+
* For example "Kitchen Flic" or "Bedroom Lights". The nickname has a maximum length limit of 23 bytes. Keep in mind that this is the length in bytes, and not the
|
|
56
|
+
* number of UTF8 characters (which may be up to 4 bytes long). If you write anything longer than 23 bytes then the nickname will automatically be truncated to at
|
|
57
|
+
* most 23 bytes. When truncating the string, the framework will always cut between UTF8 character, so you don't have to worry about writing half an emoji, for example.
|
|
58
|
+
*
|
|
59
|
+
*/
|
|
60
|
+
@property(nonatomic, readwrite, strong, nullable) NSString *nickname;
|
|
61
|
+
|
|
62
|
+
/*!
|
|
63
|
+
* @property bluetoothAddress
|
|
64
|
+
*
|
|
65
|
+
* @discussion The bluetooth address of the Flic. This will be a string representation of a 49 bit long address. Example: "00:80:e4:da:12:34:56"
|
|
66
|
+
*
|
|
67
|
+
*/
|
|
68
|
+
@property(nonatomic, readonly, strong, nonnull) NSString *bluetoothAddress;
|
|
69
|
+
|
|
70
|
+
/*!
|
|
71
|
+
* @property uuid
|
|
72
|
+
*
|
|
73
|
+
* @discussion This is a unique identifier string that best used to identify a Flic. This is for example used to identify Flics on all our API endpoints.
|
|
74
|
+
*
|
|
75
|
+
*/
|
|
76
|
+
@property(nonatomic, readonly, strong, nonnull) NSString *uuid;
|
|
77
|
+
|
|
78
|
+
/*!
|
|
79
|
+
* @property serialNumber
|
|
80
|
+
*
|
|
81
|
+
* @discussion The serial number is a production identifier that is printed on the backside of the Flic inside the battery hatch.
|
|
82
|
+
* This serves no other purpose than allowing a user to identify a button by manually looking at it. Can be useful in some cases.
|
|
83
|
+
*
|
|
84
|
+
*/
|
|
85
|
+
@property(nonatomic, readonly, strong, nonnull) NSString *serialNumber;
|
|
86
|
+
|
|
87
|
+
/*!
|
|
88
|
+
* @property triggerMode
|
|
89
|
+
*
|
|
90
|
+
* @discussion Use this property to let the flic2lib know what type of click events you are interested it. By default you will get Click, Double Click and Hold events.
|
|
91
|
+
* However, if you for example are only interested in Click events then you can set this property to FLICButtonTriggerModeClick. Doing so will allow the flic2lib to
|
|
92
|
+
* deliver the events quicker since it can now ignore Double Click and Hold.
|
|
93
|
+
*
|
|
94
|
+
*/
|
|
95
|
+
@property(nonatomic, readwrite) FLICButtonTriggerMode triggerMode;
|
|
96
|
+
|
|
97
|
+
/*!
|
|
98
|
+
* @property state
|
|
99
|
+
*
|
|
100
|
+
* @discussion Lets you know if the Flic is Connected, Disconnected, Connecting, or Disconnecting.
|
|
101
|
+
*
|
|
102
|
+
*/
|
|
103
|
+
@property(nonatomic, readonly) FLICButtonState state;
|
|
104
|
+
|
|
105
|
+
/*!
|
|
106
|
+
* @property pressCount
|
|
107
|
+
*
|
|
108
|
+
* @discussion The number of times the Flic has been clicked since last time it booted.
|
|
109
|
+
*
|
|
110
|
+
*/
|
|
111
|
+
@property(nonatomic, readonly) uint32_t pressCount;
|
|
112
|
+
|
|
113
|
+
/*!
|
|
114
|
+
* @property firmwareRevision
|
|
115
|
+
*
|
|
116
|
+
* @discussion The revision of the firmware currently running on the Flic.
|
|
117
|
+
*
|
|
118
|
+
*/
|
|
119
|
+
@property(nonatomic, readonly) uint32_t firmwareRevision;
|
|
120
|
+
|
|
121
|
+
/*!
|
|
122
|
+
* @property isReady
|
|
123
|
+
*
|
|
124
|
+
* @discussion When a Flic connects it will go through a quick cryptographic verification to ensure that it is both a genuine Flic and that it is the correct Flic.
|
|
125
|
+
* Once this is completed this property will be set to YES and it is not until after that that you will start receiving click events (if any). As soon as the button disconnects
|
|
126
|
+
* this will be set to NO again.
|
|
127
|
+
*
|
|
128
|
+
*/
|
|
129
|
+
@property(nonatomic, readonly) BOOL isReady;
|
|
130
|
+
|
|
131
|
+
/*!
|
|
132
|
+
* @property batteryVoltage
|
|
133
|
+
*
|
|
134
|
+
* @discussion This will be the last know battery sample taken on the Flic. If this value is 0 then you should assume that no sample has yet been taken. It is important to know that
|
|
135
|
+
* the voltage may fluctuate depending on many different factors, such as temperature and workload. For example, heavy usage of the LED will temporarily lower the voltage,
|
|
136
|
+
* but it is likely to recover shortly after. Therefore we do not recomend to exactly translate this value into a battery percentage, instead consider showing a
|
|
137
|
+
* "change the battery soon"-status in your app once the voltage goes below 2.65V.
|
|
138
|
+
*
|
|
139
|
+
*/
|
|
140
|
+
@property(nonatomic, readonly) float batteryVoltage;
|
|
141
|
+
|
|
142
|
+
/*!
|
|
143
|
+
* @property isUnpaired
|
|
144
|
+
*
|
|
145
|
+
* @discussion If this property is YES, then it means that this app's pairing with this specific Flic is no longer valid. This can for example occur if the Flic has been factory reset,
|
|
146
|
+
* or if the maximum number of pairings have been reached. In this case you will need to delete the button from the manager and then scan for it again.
|
|
147
|
+
*
|
|
148
|
+
*/
|
|
149
|
+
@property(nonatomic, readonly) BOOL isUnpaired;
|
|
150
|
+
|
|
151
|
+
/*!
|
|
152
|
+
* @property latencyMode
|
|
153
|
+
*
|
|
154
|
+
* @discussion Lets you switch between two different latency modes. For most use-cases it is recommend to keep the default FLICLatencyModeNormal.
|
|
155
|
+
* FLICLatencyModeLow should ideally only be used for foreground applications, such as games, where low latency is needed. Keep in mind that the
|
|
156
|
+
* energy consumption will be significantly higher in the low latency mode.
|
|
157
|
+
*
|
|
158
|
+
*/
|
|
159
|
+
@property(nonatomic, readwrite) FLICLatencyMode latencyMode;
|
|
160
|
+
|
|
161
|
+
/*!
|
|
162
|
+
* @method connect
|
|
163
|
+
*
|
|
164
|
+
* @discussion Attempts to connect the Flic. If the Flic is not available, due to either being out of range or not advertising, then it will be connected once it becomes
|
|
165
|
+
* available as this call does not time out. This is often called a pending connection. It can be canceled by calling disconnect.
|
|
166
|
+
*
|
|
167
|
+
*/
|
|
168
|
+
- (void)connect;
|
|
169
|
+
|
|
170
|
+
/*!
|
|
171
|
+
* @method disconnect
|
|
172
|
+
*
|
|
173
|
+
* @discussion Disconnect a currently connected Flic or cancel a pending connection.
|
|
174
|
+
*
|
|
175
|
+
*/
|
|
176
|
+
- (void)disconnect;
|
|
177
|
+
|
|
178
|
+
@end
|
|
179
|
+
|
|
180
|
+
/*!
|
|
181
|
+
* @protocol FLICButtonDelegate
|
|
182
|
+
*
|
|
183
|
+
* @discussion The delegate of a FLICButton instance must adopt the FLICButtonDelegate protocol. All calls to the delegate methods will be on the main dispatch queue.
|
|
184
|
+
*
|
|
185
|
+
*/
|
|
186
|
+
@protocol FLICButtonDelegate <NSObject>
|
|
187
|
+
|
|
188
|
+
/*!
|
|
189
|
+
* @method buttonDidConnect:
|
|
190
|
+
*
|
|
191
|
+
* @param button The FLICButton instance that the event originated from.
|
|
192
|
+
*
|
|
193
|
+
* @discussion This method is called every time the Flic establishes a new bluetooth connection. Keep in mind that you also have to wait for the buttonIsReady: before
|
|
194
|
+
* the Flic is ready to be used.
|
|
195
|
+
*
|
|
196
|
+
*/
|
|
197
|
+
- (void)buttonDidConnect:(FLICButton *)button;
|
|
198
|
+
|
|
199
|
+
/*!
|
|
200
|
+
* @method buttonIsReady:
|
|
201
|
+
*
|
|
202
|
+
* @param button The FLICButton instance that the event originated from.
|
|
203
|
+
*
|
|
204
|
+
* @discussion This method is called after each connection once the Flic has been cryptographically verified. You will not receive any click events before this is called.
|
|
205
|
+
*
|
|
206
|
+
*/
|
|
207
|
+
- (void)buttonIsReady:(FLICButton *)button;
|
|
208
|
+
|
|
209
|
+
/*!
|
|
210
|
+
* @method button:didDisconnectWithError:
|
|
211
|
+
*
|
|
212
|
+
* @param button The FLICButton instance that the event originated from.
|
|
213
|
+
* @param error This error lets you know the reason for the disconnect. An error does not necessarily mean that something went wrong.
|
|
214
|
+
*
|
|
215
|
+
* @discussion This method is called every time the bluetooth link with the Flic is lost. This can occur for several different reasons. The most common would be that
|
|
216
|
+
* the iOS device and the Flic is no longer within range of each other.
|
|
217
|
+
*
|
|
218
|
+
*/
|
|
219
|
+
- (void)button:(FLICButton *)button didDisconnectWithError:(NSError * _Nullable)error;
|
|
220
|
+
|
|
221
|
+
/*!
|
|
222
|
+
* @method button:didFailToConnectWithError:
|
|
223
|
+
*
|
|
224
|
+
* @param button The FLICButton instance that the event originated from.
|
|
225
|
+
* @param error This error lets you know why the connection attempt failed.
|
|
226
|
+
*
|
|
227
|
+
* @discussion This method is called when a connection attempt to a button fails. This indicates that something has gone wrong and that the pending connection will not be reset.
|
|
228
|
+
*
|
|
229
|
+
*/
|
|
230
|
+
- (void)button:(FLICButton *)button didFailToConnectWithError:(NSError * _Nullable)error;
|
|
231
|
+
|
|
232
|
+
@optional
|
|
233
|
+
|
|
234
|
+
/*!
|
|
235
|
+
* @method button:didReceiveButtonDown:age:
|
|
236
|
+
*
|
|
237
|
+
* @param button The FLICButton instance that the event originated from.
|
|
238
|
+
* @param queued Whether the event is a queued event that happened before the Flic connected or if it is a real time event.
|
|
239
|
+
* @param age If the event was queued, then this will let you know the age of the event rounded to the nearest second.
|
|
240
|
+
*
|
|
241
|
+
* @discussion The Flic registered a button down event.
|
|
242
|
+
*
|
|
243
|
+
*/
|
|
244
|
+
- (void)button:(FLICButton *)button didReceiveButtonDown:(BOOL)queued age:(NSInteger)age;
|
|
245
|
+
|
|
246
|
+
/*!
|
|
247
|
+
* @method button:didReceiveButtonUp:age:
|
|
248
|
+
*
|
|
249
|
+
* @param button The FLICButton instance that the event originated from.
|
|
250
|
+
* @param queued Whether the event is a queued event that happened before the Flic connected or if it is a real time event.
|
|
251
|
+
* @param age If the event was queued, then this will let you know the age of the event rounded to the nearest second.
|
|
252
|
+
*
|
|
253
|
+
* @discussion The Flic registered a button up event.
|
|
254
|
+
*
|
|
255
|
+
*/
|
|
256
|
+
- (void)button:(FLICButton *)button didReceiveButtonUp:(BOOL)queued age:(NSInteger)age;
|
|
257
|
+
|
|
258
|
+
/*!
|
|
259
|
+
* @method button:didReceiveButtonClick:age:
|
|
260
|
+
*
|
|
261
|
+
* @param button The FLICButton instance that the event originated from.
|
|
262
|
+
* @param queued Whether the event is a queued event that happened before the Flic connected or if it is a real time event.
|
|
263
|
+
* @param age If the event was queued, then this will let you know the age of the event rounded to the nearest second.
|
|
264
|
+
*
|
|
265
|
+
* @discussion The Flic registered a button click event.
|
|
266
|
+
*
|
|
267
|
+
*/
|
|
268
|
+
- (void)button:(FLICButton *)button didReceiveButtonClick:(BOOL)queued age:(NSInteger)age;
|
|
269
|
+
|
|
270
|
+
/*!
|
|
271
|
+
* @method button:didReceiveButtonDoubleClick:age:
|
|
272
|
+
*
|
|
273
|
+
* @param button The FLICButton instance that the event originated from.
|
|
274
|
+
* @param queued Whether the event is a queued event that happened before the Flic connected or if it is a real time event.
|
|
275
|
+
* @param age If the event was queued, then this will let you know the age of the event rounded to the nearest second.
|
|
276
|
+
*
|
|
277
|
+
* @discussion The Flic registered a double click event.
|
|
278
|
+
*
|
|
279
|
+
*/
|
|
280
|
+
- (void)button:(FLICButton *)button didReceiveButtonDoubleClick:(BOOL)queued age:(NSInteger)age;
|
|
281
|
+
|
|
282
|
+
/*!
|
|
283
|
+
* @method button:didReceiveButtonHold:age:
|
|
284
|
+
*
|
|
285
|
+
* @param button The FLICButton instance that the event originated from.
|
|
286
|
+
* @param queued Whether the event is a queued event that happened before the Flic connected or if it is a real time event.
|
|
287
|
+
* @param age If the event was queued, then this will let you know the age of the event rounded to the nearest second.
|
|
288
|
+
*
|
|
289
|
+
* @discussion The Flic registered a button hold event.
|
|
290
|
+
*
|
|
291
|
+
*/
|
|
292
|
+
- (void)button:(FLICButton *)button didReceiveButtonHold:(BOOL)queued age:(NSInteger)age;
|
|
293
|
+
|
|
294
|
+
/*!
|
|
295
|
+
* @method button:didUnpairWithError:
|
|
296
|
+
*
|
|
297
|
+
* @param button The FLICButton instance that the event originated from.
|
|
298
|
+
* @param error This will always be nil at this time.
|
|
299
|
+
*
|
|
300
|
+
* @discussion The app no longer has a valid pairing with the Flic button. The isUnpaired property will now be YES and all connection
|
|
301
|
+
* attempts made will immediately fail. To fix this you need to delete the button from the manager and then re-scan it again.
|
|
302
|
+
*
|
|
303
|
+
*/
|
|
304
|
+
- (void)button:(FLICButton *)button didUnpairWithError:(NSError * _Nullable)error;
|
|
305
|
+
|
|
306
|
+
/*!
|
|
307
|
+
* @method button:didUpdateBatteryVoltage:
|
|
308
|
+
*
|
|
309
|
+
* @param button The FLICButton instance that the event originated from.
|
|
310
|
+
* @param voltage Float representation of the latest battery voltage sample.
|
|
311
|
+
*
|
|
312
|
+
* @discussion This callback will be sent once the Flic button updates its battery voltage with a new value. Typically this will occurs a few seconds
|
|
313
|
+
* after the button connects. If you show a battery indicator in you app, then this would be a good place to refresh your UI. Please
|
|
314
|
+
* see the description for the batteryVoltage property for more information.
|
|
315
|
+
*
|
|
316
|
+
*/
|
|
317
|
+
- (void)button:(FLICButton *)button didUpdateBatteryVoltage:(float)voltage;
|
|
318
|
+
|
|
319
|
+
/*!
|
|
320
|
+
* @method button:didUpdateNickname:
|
|
321
|
+
*
|
|
322
|
+
* @param button The FLICButton instance that the event originated from.
|
|
323
|
+
* @param nickname The new nickname that was sent from the Flic.
|
|
324
|
+
*
|
|
325
|
+
* @discussion If the nickname is updated by another app (including the official Flic app), then you will get this callback letting you know that the
|
|
326
|
+
* name has changed. This may either be in real time (if multiple apps are connected at the same time), or a deayed event that
|
|
327
|
+
* occurs after the button connects (if the nickname was changed while your app was not active). If your app displays this nickname,
|
|
328
|
+
* then this would be a good place to refresh your UI.
|
|
329
|
+
*
|
|
330
|
+
*/
|
|
331
|
+
- (void)button:(FLICButton *)button didUpdateNickname:(NSString *)nickname;
|
|
332
|
+
|
|
333
|
+
@end
|
|
334
|
+
|
|
335
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
//
|
|
2
|
+
// FLICEnums.h
|
|
3
|
+
// fliclib
|
|
4
|
+
//
|
|
5
|
+
// Created by Anton Meier on 2019-04-18.
|
|
6
|
+
// Copyright © 2020 Shortcut Labs. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
#ifndef FLICEnums_h
|
|
10
|
+
#define FLICEnums_h
|
|
11
|
+
|
|
12
|
+
extern NSString * const FLICErrorDomain;
|
|
13
|
+
extern NSString * const FLICButtonScannerErrorDomain;
|
|
14
|
+
|
|
15
|
+
/*!
|
|
16
|
+
* @enum FLICManagerState
|
|
17
|
+
*
|
|
18
|
+
* @discussion Represents the the different states that a Flic manager can be in at any given time. These states are mostly translated values of Apple's CoreBluetooth CBManagerState enums.
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
typedef NS_ENUM(NSInteger, FLICManagerState)
|
|
22
|
+
{
|
|
23
|
+
/**
|
|
24
|
+
* State is unknown, update imminent.
|
|
25
|
+
*/
|
|
26
|
+
FLICManagerStateUnknown = 0,
|
|
27
|
+
/**
|
|
28
|
+
* The bluetooth connection with the system service was momentarily lost, update imminent.
|
|
29
|
+
*/
|
|
30
|
+
FLICManagerStateResetting,
|
|
31
|
+
/**
|
|
32
|
+
* The Flic manager can not be used on this platform.
|
|
33
|
+
*/
|
|
34
|
+
FLICManagerStateUnsupported,
|
|
35
|
+
/**
|
|
36
|
+
* The application is not authorized to use Bluetooth Low Energy.
|
|
37
|
+
*/
|
|
38
|
+
FLICManagerStateUnauthorized,
|
|
39
|
+
/**
|
|
40
|
+
* Bluetooth is currently powered off.
|
|
41
|
+
*/
|
|
42
|
+
FLICManagerStatePoweredOff,
|
|
43
|
+
/**
|
|
44
|
+
* Bluetooth is currently powered on and available to use.
|
|
45
|
+
*/
|
|
46
|
+
FLICManagerStatePoweredOn
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
/*!
|
|
50
|
+
* @enum FLICButtonScannerErrorCode
|
|
51
|
+
*
|
|
52
|
+
* @discussion Represents the different error codes that can be generated while scanning and pairing new Flics.
|
|
53
|
+
*
|
|
54
|
+
*/
|
|
55
|
+
typedef NS_ENUM(NSInteger, FLICButtonScannerErrorCode)
|
|
56
|
+
{
|
|
57
|
+
/**
|
|
58
|
+
* The scan was unsuccessful due to an unknown reason.
|
|
59
|
+
*/
|
|
60
|
+
FLICButtonScannerErrorCodeUnknown = 0,
|
|
61
|
+
/**
|
|
62
|
+
* The scan could not be started since bluetooth was not in the powered on state.
|
|
63
|
+
*/
|
|
64
|
+
FLICButtonScannerErrorCodeBluetoothNotActivated,
|
|
65
|
+
/**
|
|
66
|
+
* No button was advertising in public mode within proximity.
|
|
67
|
+
*/
|
|
68
|
+
FLICButtonScannerErrorCodeNoPublicButtonDiscovered,
|
|
69
|
+
/**
|
|
70
|
+
* The bluetooth pairing failed since the user already has paired this button before with this device.
|
|
71
|
+
* This is solved by removing the pairing from the iOS bluetooth pairing settings screen.
|
|
72
|
+
*/
|
|
73
|
+
FLICButtonScannerErrorCodeBLEPairingFailedPreviousPairingAlreadyExisting,
|
|
74
|
+
/**
|
|
75
|
+
* The bluetooth pairing failed since the user pressed cancel on the pairing dialog.
|
|
76
|
+
*/
|
|
77
|
+
FLICButtonScannerErrorCodeBLEPairingFailedUserCanceled,
|
|
78
|
+
/**
|
|
79
|
+
* The bluetooth pairing failed since iOS decided to decline the request. It is unknown why or if this can happen.
|
|
80
|
+
*/
|
|
81
|
+
FLICButtonScannerErrorCodeBLEPairingFailedUnknownReason,
|
|
82
|
+
/**
|
|
83
|
+
* Indicates that the button cannot be unlocked since it belongs to a different brand.
|
|
84
|
+
*/
|
|
85
|
+
FLICButtonScannerErrorCodeAppCredentialsDontMatch,
|
|
86
|
+
/**
|
|
87
|
+
* The scan was manually canceled using the stopScan method.
|
|
88
|
+
*/
|
|
89
|
+
FLICButtonScannerErrorCodeUserCanceled,
|
|
90
|
+
/**
|
|
91
|
+
* The Flic's certificate belongs to a different bluetooth address.
|
|
92
|
+
*/
|
|
93
|
+
FLICButtonScannerErrorCodeInvalidBluetoothAddress,
|
|
94
|
+
/**
|
|
95
|
+
* The framework was unable to pair with the Flic since it did not pass the authenticity check.
|
|
96
|
+
*/
|
|
97
|
+
FLICButtonScannerErrorCodeGenuineCheckFailed,
|
|
98
|
+
/**
|
|
99
|
+
* The discovered Flic cannot be connected since it is currently connected to a different device.
|
|
100
|
+
*/
|
|
101
|
+
FLICButtonScannerErrorCodeAlreadyConnectedToAnotherDevice,
|
|
102
|
+
/**
|
|
103
|
+
* The discovered Flic cannot be connected since the maximum number of simultaneous app connections has been reached.
|
|
104
|
+
*/
|
|
105
|
+
FLICButtonScannerErrorCodeTooManyApps,
|
|
106
|
+
/**
|
|
107
|
+
* A bluetooth specific error. The framework was unable to establish a connection to the Flic peripheral.
|
|
108
|
+
*/
|
|
109
|
+
FLICButtonScannerErrorCodeCouldNotSetBluetoothNotify,
|
|
110
|
+
/**
|
|
111
|
+
* A bluetooth specific error. The framework was unable to establish a connection to the Flic peripheral.
|
|
112
|
+
*/
|
|
113
|
+
FLICButtonScannerErrorCodeCouldNotDiscoverBluetoothServices,
|
|
114
|
+
/**
|
|
115
|
+
* The bluetooth connection was dropped during the verification process.
|
|
116
|
+
*/
|
|
117
|
+
FLICButtonScannerErrorCodeButtonDisconnectedDuringVerification,
|
|
118
|
+
/**
|
|
119
|
+
* The Flic peripheral connection was unexpectedly lost.
|
|
120
|
+
*/
|
|
121
|
+
FLICButtonScannerErrorCodeConnectionTimeout,
|
|
122
|
+
/**
|
|
123
|
+
* The bluetooth connection failed.
|
|
124
|
+
*/
|
|
125
|
+
FLICButtonScannerErrorCodeFailedToEstablish,
|
|
126
|
+
/**
|
|
127
|
+
* The iOS device reached the maximum number of allowed bluetooth peripherals.
|
|
128
|
+
*/
|
|
129
|
+
FLICButtonScannerErrorCodeConnectionLimitReached,
|
|
130
|
+
/**
|
|
131
|
+
* The signature generated by the Flic button could not be verified.
|
|
132
|
+
*/
|
|
133
|
+
FLICButtonScannerErrorCodeInvalidVerifier,
|
|
134
|
+
/**
|
|
135
|
+
* The Flic button was no longer in public mode when the verification process ran.
|
|
136
|
+
*/
|
|
137
|
+
FLICButtonScannerErrorCodeNotInPublicMode,
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
/*!
|
|
141
|
+
* @enum FLICButtonScannerStatusEvent
|
|
142
|
+
*
|
|
143
|
+
* @discussion While the scanner is running, it will send a status events to let you know what it is doing. These enums represents those events.
|
|
144
|
+
*
|
|
145
|
+
*/
|
|
146
|
+
typedef NS_ENUM(NSInteger, FLICButtonScannerStatusEvent)
|
|
147
|
+
{
|
|
148
|
+
/**
|
|
149
|
+
* A public Flic has been discovered and a connection attempt will now be made.
|
|
150
|
+
*/
|
|
151
|
+
FLICButtonScannerStatusEventDiscovered = 0,
|
|
152
|
+
/**
|
|
153
|
+
* The Flic was successfully bluetooth connected.
|
|
154
|
+
*/
|
|
155
|
+
FLICButtonScannerStatusEventConnected,
|
|
156
|
+
/**
|
|
157
|
+
* The Flic has been verified and unlocked for this app. The Flic will soon be delivered in the assigned completion handler.
|
|
158
|
+
*/
|
|
159
|
+
FLICButtonScannerStatusEventVerified,
|
|
160
|
+
/**
|
|
161
|
+
* The Flic could not be verified. The completion handler will soon run to let you know what the error was.
|
|
162
|
+
*/
|
|
163
|
+
FLICButtonScannerStatusEventVerificationFailed,
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
/*!
|
|
167
|
+
* @enum FLICError
|
|
168
|
+
*
|
|
169
|
+
* @discussion These enums represents the different error codes that can be sent from flic2lib, excluding the button scanner which has its own set of error codes.
|
|
170
|
+
*
|
|
171
|
+
*/
|
|
172
|
+
typedef NS_ENUM(NSInteger, FLICError)
|
|
173
|
+
{
|
|
174
|
+
/**
|
|
175
|
+
* An unknown error has occurred.
|
|
176
|
+
*/
|
|
177
|
+
FLICErrorUnknown = 0,
|
|
178
|
+
/**
|
|
179
|
+
* You are trying to use the manager while it has not been configured yet.
|
|
180
|
+
*/
|
|
181
|
+
FLICErrorNotConfigured,
|
|
182
|
+
/**
|
|
183
|
+
* A bluetooth specific error code. This means that something went wrong while the phone tried to establish a connection with the Flic peripheral.
|
|
184
|
+
*/
|
|
185
|
+
FLICErrorCouldNotDiscoverBluetoothServices,
|
|
186
|
+
/**
|
|
187
|
+
* The framework was unable to verify the cryptographic signature from the Flic while setting up a session.
|
|
188
|
+
*/
|
|
189
|
+
FLICErrorVerificationSignatureMismatch,
|
|
190
|
+
/**
|
|
191
|
+
* The UUID of a button is not correct.
|
|
192
|
+
*/
|
|
193
|
+
FLICErrorInvalidUuid,
|
|
194
|
+
/**
|
|
195
|
+
* While establishing a connection with the Flic the framework was unable to verify the authenticity of the button.
|
|
196
|
+
*/
|
|
197
|
+
FLICErrorGenuineCheckFailed,
|
|
198
|
+
/**
|
|
199
|
+
* The app was unable to establish a connection with the Flic button because it already had a connection with too many apps on this particular phone.
|
|
200
|
+
*/
|
|
201
|
+
FLICErrorTooManyApps,
|
|
202
|
+
/**
|
|
203
|
+
* The pairing on the Flic button has been lost so the app's pairing data is no longer valid. This typically happens if the Flic is factory reset.
|
|
204
|
+
*/
|
|
205
|
+
FLICErrorUnpaired,
|
|
206
|
+
/**
|
|
207
|
+
* The manager was unable to complete the task since the device is not running on a supported iOS version.
|
|
208
|
+
*/
|
|
209
|
+
FLICErrorUnsupportedOSVersion,
|
|
210
|
+
/**
|
|
211
|
+
* You are trying to use a FLICButton object that has already been forgotten by the manager. Please discard of your references to this object.
|
|
212
|
+
*/
|
|
213
|
+
FLICErrorAlreadyForgotten,
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
/*!
|
|
217
|
+
* @enum FLICButtonState
|
|
218
|
+
*
|
|
219
|
+
* @discussion The different states that a Flic can be in at any given time.
|
|
220
|
+
*
|
|
221
|
+
*/
|
|
222
|
+
typedef NS_ENUM(NSInteger, FLICButtonState)
|
|
223
|
+
{
|
|
224
|
+
/**
|
|
225
|
+
* The Flic is currently disconnected and a pending connection is not set. The Flic will not connect again unless you manually call the connect method.
|
|
226
|
+
*/
|
|
227
|
+
FLICButtonStateDisconnected = 0,
|
|
228
|
+
/**
|
|
229
|
+
* The Flic is currently disconnected, but a pending connection is set. The Flic will automatically connect again as soon as it becomes available.
|
|
230
|
+
*/
|
|
231
|
+
FLICButtonStateConnecting,
|
|
232
|
+
/**
|
|
233
|
+
* The Flic currently has a bluetooth connection with the phone. This does not necessarily mean that it has been verified.
|
|
234
|
+
* Please listen for the isReady event, or read the isReady property, for that information
|
|
235
|
+
*/
|
|
236
|
+
FLICButtonStateConnected,
|
|
237
|
+
/**
|
|
238
|
+
* The Flic is currently connected, but is attempting to disconnect. Typically this state will only occur for very short periods of time before either switching to
|
|
239
|
+
* the connecting or disconnected state again.
|
|
240
|
+
*/
|
|
241
|
+
FLICButtonStateDisconnecting,
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
/*!
|
|
245
|
+
* @enum FLICButtonTriggerMode
|
|
246
|
+
*
|
|
247
|
+
* @discussion The different trigger modes that you can configure the Flic button to use. Please make sure that you understand how these work.
|
|
248
|
+
* The choosen trigger mode will affect the latency on the press events coming from the Flic button.
|
|
249
|
+
*
|
|
250
|
+
*/
|
|
251
|
+
typedef NS_ENUM(NSInteger, FLICButtonTriggerMode)
|
|
252
|
+
{
|
|
253
|
+
/**
|
|
254
|
+
* Used to distinguish between only click and hold.
|
|
255
|
+
*
|
|
256
|
+
* Click will be fired when the button is released if it was pressed for maximum 1 second.
|
|
257
|
+
* Otherwise, hold will be fired 1 second after the button was pressed. Click will then not be fired upon release.
|
|
258
|
+
* Since this option will only distinguish between click and hold it does not have to take double click into consideration.
|
|
259
|
+
* This means that the click event can be sent immediately on button release rather than to wait for a possible double click.
|
|
260
|
+
*
|
|
261
|
+
* Note: this will be the default behavior.
|
|
262
|
+
*/
|
|
263
|
+
FLICButtonTriggerModeClickAndHold = 0,
|
|
264
|
+
/**
|
|
265
|
+
* Used to distinguish between only single click and double click.
|
|
266
|
+
*
|
|
267
|
+
* Double click will be registered if the time between two button down events was at most 0.5 seconds.
|
|
268
|
+
* The double click event will then be fired upon button release.
|
|
269
|
+
*
|
|
270
|
+
* If the time was more than 0.5 seconds, a single click event will be fired; either directly upon button release if the button was down
|
|
271
|
+
* for more than 0.5 seconds, or after 0.5 seconds if the button was down for less than 0.5 seconds.
|
|
272
|
+
*/
|
|
273
|
+
FLICButtonTriggerModeClickAndDoubleClick,
|
|
274
|
+
/**
|
|
275
|
+
* Used to distinguish between single click, double click and hold.
|
|
276
|
+
*
|
|
277
|
+
* If the time between the first button down and button up event was more than 1 second, a hold event will be fired.
|
|
278
|
+
* Else, double click will be fired if the time between two button down events was at most 0.5 seconds.
|
|
279
|
+
* The double click event will then be fired upon button release.
|
|
280
|
+
*
|
|
281
|
+
* If the time was more than 0.5 seconds, a single click event will be fired; either directly upon button release if the button was down
|
|
282
|
+
* for more than 0.5 seconds, or after 0.5 seconds if the button was down for less than 0.5 seconds.
|
|
283
|
+
*
|
|
284
|
+
* Note: Three fast consecutive clicks means one double click and then one single click. Four fast consecutive clicks means two double clicks.
|
|
285
|
+
*/
|
|
286
|
+
FLICButtonTriggerModeClickAndDoubleClickAndHold,
|
|
287
|
+
/**
|
|
288
|
+
* This mode will only send click and the event will be sent directly on buttonDown.
|
|
289
|
+
* This will be the same as listening for buttonDown.
|
|
290
|
+
*
|
|
291
|
+
* Note: This is optimal if your application requires the lowest latency possible.
|
|
292
|
+
*/
|
|
293
|
+
FLICButtonTriggerModeClick,
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
/*!
|
|
297
|
+
* @enum FLICButtonTriggerMode
|
|
298
|
+
*
|
|
299
|
+
* @discussion The different latency modes that you can configure the Flic button to use.
|
|
300
|
+
*
|
|
301
|
+
*/
|
|
302
|
+
typedef NS_ENUM(NSInteger, FLICLatencyMode)
|
|
303
|
+
{
|
|
304
|
+
/**
|
|
305
|
+
* This is the default mode of the button. It will give you a good compromise between click latency (less than 105 ms while connected) and current consumption.
|
|
306
|
+
*/
|
|
307
|
+
FLICLatencyModeNormal = 0,
|
|
308
|
+
/**
|
|
309
|
+
* Using this mode will give your button the lowest possible click latency (typicaly less than 30 ms while connected).
|
|
310
|
+
* This mode will significantly increase the current consumption.
|
|
311
|
+
*/
|
|
312
|
+
FLICLatencyModeLow,
|
|
313
|
+
};
|
|
314
|
+
|
|
315
|
+
#endif /* FLICEnums_h */
|