react-native-flic2 0.3.23 → 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.
Files changed (33) hide show
  1. package/index.js +5 -5
  2. package/ios/Flic2.h +1 -5
  3. package/ios/Flic2.xcodeproj/project.pbxproj +34 -8
  4. package/ios/Flic2.xcodeproj/xcshareddata/xcschemes/Flic2.xcscheme +66 -0
  5. package/ios/Flic2.xcodeproj/xcuserdata/wesdewitte.xcuserdatad/xcschemes/xcschememanagement.plist +8 -0
  6. package/ios/Flic2.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +5 -0
  7. package/ios/Flic2.xcworkspace/xcuserdata/wesdewitte.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  8. package/ios/Flic2.xcworkspace/xcuserdata/wesdewitte.xcuserdatad/WorkspaceSettings.xcsettings +14 -0
  9. package/ios/flic2lib.xcframework/Info.plist +56 -0
  10. package/ios/{Frameworks → flic2lib.xcframework/ios-arm64_armv7}/flic2lib.framework/Headers/FLICButton.h +10 -0
  11. package/ios/{Frameworks → flic2lib.xcframework/ios-arm64_armv7}/flic2lib.framework/Headers/FLICEnums.h +19 -0
  12. package/ios/{Frameworks → flic2lib.xcframework/ios-arm64_armv7}/flic2lib.framework/Info.plist +0 -0
  13. package/ios/flic2lib.xcframework/ios-arm64_armv7/flic2lib.framework/flic2lib +0 -0
  14. package/ios/flic2lib.xcframework/ios-arm64_x86_64-maccatalyst/flic2lib.framework/Versions/A/Headers/FLICButton.h +335 -0
  15. package/ios/flic2lib.xcframework/ios-arm64_x86_64-maccatalyst/flic2lib.framework/Versions/A/Headers/FLICEnums.h +315 -0
  16. package/ios/flic2lib.xcframework/ios-arm64_x86_64-maccatalyst/flic2lib.framework/Versions/A/Headers/FLICManager.h +171 -0
  17. package/ios/flic2lib.xcframework/ios-arm64_x86_64-maccatalyst/flic2lib.framework/Versions/A/Headers/flic2lib.h +19 -0
  18. package/ios/flic2lib.xcframework/ios-arm64_x86_64-maccatalyst/flic2lib.framework/Versions/A/Modules/module.modulemap +6 -0
  19. package/ios/flic2lib.xcframework/ios-arm64_x86_64-maccatalyst/flic2lib.framework/Versions/A/Resources/Info.plist +50 -0
  20. package/ios/flic2lib.xcframework/ios-arm64_x86_64-maccatalyst/flic2lib.framework/Versions/A/flic2lib +0 -0
  21. package/ios/flic2lib.xcframework/ios-arm64_x86_64-simulator/flic2lib.framework/Headers/FLICButton.h +335 -0
  22. package/ios/flic2lib.xcframework/ios-arm64_x86_64-simulator/flic2lib.framework/Headers/FLICEnums.h +315 -0
  23. package/ios/flic2lib.xcframework/ios-arm64_x86_64-simulator/flic2lib.framework/Headers/FLICManager.h +171 -0
  24. package/ios/flic2lib.xcframework/ios-arm64_x86_64-simulator/flic2lib.framework/Headers/flic2lib.h +19 -0
  25. package/ios/flic2lib.xcframework/ios-arm64_x86_64-simulator/flic2lib.framework/Info.plist +0 -0
  26. package/ios/flic2lib.xcframework/ios-arm64_x86_64-simulator/flic2lib.framework/Modules/module.modulemap +6 -0
  27. package/ios/flic2lib.xcframework/ios-arm64_x86_64-simulator/flic2lib.framework/flic2lib +0 -0
  28. package/package.json +1 -1
  29. package/react-native-flic2.podspec +2 -2
  30. package/ios/Frameworks/flic2lib.framework/flic2lib +0 -0
  31. /package/ios/{Frameworks → flic2lib.xcframework/ios-arm64_armv7}/flic2lib.framework/Headers/FLICManager.h +0 -0
  32. /package/ios/{Frameworks → flic2lib.xcframework/ios-arm64_armv7}/flic2lib.framework/Headers/flic2lib.h +0 -0
  33. /package/ios/{Frameworks → flic2lib.xcframework/ios-arm64_armv7}/flic2lib.framework/Modules/module.modulemap +0 -0
@@ -0,0 +1,171 @@
1
+ //
2
+ // FLICManager.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 <CoreBluetooth/CoreBluetooth.h>
11
+ #import "FLICButton.h"
12
+
13
+ NS_ASSUME_NONNULL_BEGIN
14
+
15
+ @protocol FLICManagerDelegate;
16
+
17
+ /*!
18
+ * @class FLICManager
19
+ *
20
+ * @discussion This interface is intended to be used as a singleton. It keeps track of all the buttons that have been paired with this particular app and restores them on each
21
+ * application launch.
22
+ *
23
+ */
24
+ @interface FLICManager : NSObject
25
+
26
+ /*!
27
+ * @property delegate
28
+ *
29
+ * @discussion The delegate that all the FLICManagerDelegate events will be sent to. Usually this is configured only once when the application is first launched, using the
30
+ * configureWithDelegate:buttonDelegate:background: method.
31
+ *
32
+ */
33
+ @property(weak, nonatomic, nullable) id<FLICManagerDelegate> delegate;
34
+
35
+ /*!
36
+ * @property buttonDelegate
37
+ *
38
+ * @discussion Once set, this delegate will automatically be set to every button instance on each application launch. This will also be assigned to new buttons that are discovered
39
+ * using the scanForButtonsWithStateChangeHandler:completionHandler method. Using this delegate also ensures that the click events are delivered as fast as possible
40
+ * when an application is restored in the background.
41
+ *
42
+ */
43
+ @property(weak, nonatomic, nullable) id<FLICButtonDelegate> buttonDelegate;
44
+
45
+ /*!
46
+ * @property state
47
+ *
48
+ * @discussion This is the state of the Flic manager. This state closely resembles the CBManager state of Apple's CoreBluetooth framework. You will only be able to communicate with
49
+ * Flic buttons while the manager is in the FlicManagerStatePoweredOn state.
50
+ *
51
+ */
52
+ @property(readonly) FLICManagerState state;
53
+
54
+ /*!
55
+ * @property scanning
56
+ *
57
+ * @discussion Let's you know if a scan is currently running or not. Reading this value will not affect a scan.
58
+ *
59
+ */
60
+ @property(nonatomic, readonly) BOOL isScanning;
61
+
62
+ /*!
63
+ * @method sharedManager
64
+ *
65
+ * @discussion This class method return the singleton manager, assuming that it has been configured first using the configureWithDelegate:buttonDelegate:background: method first,
66
+ * otherwise nil is returned.
67
+ *
68
+ */
69
+ + (instancetype _Nullable)sharedManager;
70
+
71
+ /*!
72
+ * @method
73
+ *
74
+ * @param delegate The delegate to be used with the manager singleton.
75
+ * @param buttonDelegate The delegate to be automatically assigned to each FLICButton instance.
76
+ * @param background Whether or not you intend to use this application in the background.
77
+ *
78
+ * @discussion This configuration method must be called before the manager can be used. It is recommended that this is done as soon as possible after your application has launched
79
+ * in order to minimize the delay of any pending click events. The flic2lib officially only support iOS 12 and up, however, to make it easier for the developer, the framework
80
+ * is built with a target of iOS 9 and contains slices for both arm64 and armv7. This means that you will be able to include, and load, the framework in apps that support iOS 9.
81
+ * However, if you try to configure the manager on a device running iOS 11, or below, then the manager state will switch to FLICManagerStateUnsupported. A good place
82
+ * to handle this would be in the manager:didUpdateSate: method.
83
+ *
84
+ */
85
+ + (instancetype _Nullable)configureWithDelegate:(id<FLICManagerDelegate> _Nullable)delegate
86
+ buttonDelegate:(id<FLICButtonDelegate> _Nullable)buttonDelegate
87
+ background:(BOOL)background;
88
+
89
+ /*!
90
+ * @method buttons
91
+ *
92
+ * @discussion This array will contain every button that is currently paired with this application. Each button will be added to the list after a call to
93
+ * scanForButtonsWithStateChangeHandler:completionHandler: has completed without error. It is important to know that you may not try to access this list until after the
94
+ * managerDidRestoreState: method has been sent to the manager delegate.
95
+ *
96
+ */
97
+ - (NSArray<FLICButton *> *)buttons;
98
+
99
+ /*!
100
+ * @method forgetButton:
101
+ *
102
+ * @param button The button that you wish to delete from the manager.
103
+ * @param completion This returns the identifier of the button instance that was just removed along with an error, if needed.
104
+ *
105
+ * @discussion This will delete this button from the manager. After a successful call to this method you will no longer be able to communicate with the associated Flic button unless you
106
+ * pair it again using the scanForButtonsWithStateChangeHandler:completionHandler:. On completion, the button will no longer be included in the manager's buttons array.
107
+ * After a successful call to this method, you should discard of any references to that particular Flic button object. If you try to forget a button that is already forgotten, then
108
+ * you will get an error with the FLICErrorAlreadyForgotten code.
109
+ *
110
+ */
111
+ - (void)forgetButton:(FLICButton *)button completion:(void (^)(NSUUID *uuid, NSError * _Nullable error))completion;
112
+
113
+ /*!
114
+ * @method
115
+ *
116
+ * @param stateHandler This handler returns status events that lets you know what the scanner is currently doing. The purpose of this handler is to provide a predefined states where
117
+ * you may update your application UI.
118
+ * @param completion The completion handler will always run and if successful it will return a new FLICButton instance, otherwise it will provide you with an error.
119
+ *
120
+ * @discussion This method lets you add new Flic buttons to the manager. The scan flow is automated and the stateHandler will let you know what information you should provide to
121
+ * your application end user. If you try to scan for buttons while running on an iOS version below the mimimun requirement, then you will get an error with the
122
+ * FLICErrorUnsupportedOSVersion error code.
123
+ *
124
+ */
125
+ - (void)scanForButtonsWithStateChangeHandler:(void (^)(FLICButtonScannerStatusEvent event))stateHandler
126
+ completion:(void (^)(FLICButton * _Nullable button, NSError * _Nullable error))completion;
127
+
128
+ /*!
129
+ * @method stopScan
130
+ *
131
+ * @discussion Cancel an ongoing button scan. This will result in a scan completion with an error.
132
+ *
133
+ */
134
+ - (void)stopScan;
135
+
136
+ @end
137
+
138
+ /*!
139
+ * @protocol FLICManagerDelegate
140
+ *
141
+ * @discussion The delegate of a FLICManager instance must adopt the FLICManagerDelegate protocol. All calls to the delegate methods will be on the main dispatch queue.
142
+ *
143
+ */
144
+ @protocol FLICManagerDelegate <NSObject>
145
+
146
+ /*!
147
+ * @method managerDidRestoreState:
148
+ *
149
+ * @param manager The manager instance that the event originates from. Since this is intended to be used as a singleton, there should only ever be one manager instance.
150
+ *
151
+ * @discussion This is called once the manager has been restored. This means that all the FLICButton instances from your previous session are restored as well. After this method
152
+ * has been called you may start using the manager and communicate with the Flic buttons. This method will only be called once on each application launch.
153
+ *
154
+ */
155
+ - (void)managerDidRestoreState:(FLICManager *)manager;
156
+
157
+ /*!
158
+ * @method manager:didUpdateState:
159
+ *
160
+ * @param manager The manager instance that the event originates from. Since this is intended to be used as a singleton, there should only ever be one manager instance.
161
+ * @param state The state of the Flic manager singleton.
162
+ *
163
+ * @discussion Each time the state of the Flic manager changes, you will get this callback. Usually this is related to bluetooth state changes on the iOS device. It is also guaranteed to
164
+ * be called at least once after the manager has been configured.
165
+ *
166
+ */
167
+ - (void)manager:(FLICManager *)manager didUpdateState:(FLICManagerState)state;
168
+
169
+ @end
170
+
171
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,19 @@
1
+ //
2
+ // flic2lib.h
3
+ // flic2lib
4
+ //
5
+ // Created by Anton Meier on 2019-04-10.
6
+ // Copyright © 2020 Shortcut Labs. All rights reserved.
7
+ //
8
+
9
+ #import <UIKit/UIKit.h>
10
+
11
+ #import <flic2lib/FLICEnums.h>
12
+ #import <flic2lib/FLICManager.h>
13
+ #import <flic2lib/FLICButton.h>
14
+
15
+ //! Project version number for flic2lib.
16
+ FOUNDATION_EXPORT double flic2libVersionNumber;
17
+
18
+ //! Project version string for flic2lib.
19
+ FOUNDATION_EXPORT const unsigned char flic2libVersionString[];
@@ -0,0 +1,6 @@
1
+ framework module flic2lib {
2
+ umbrella header "flic2lib.h"
3
+
4
+ export *
5
+ module * { export * }
6
+ }
@@ -0,0 +1,50 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>BuildMachineOSBuild</key>
6
+ <string>20C69</string>
7
+ <key>CFBundleDevelopmentRegion</key>
8
+ <string>English</string>
9
+ <key>CFBundleExecutable</key>
10
+ <string>flic2lib</string>
11
+ <key>CFBundleIdentifier</key>
12
+ <string>com.shortcutlabs.flic2lib</string>
13
+ <key>CFBundleInfoDictionaryVersion</key>
14
+ <string>6.0</string>
15
+ <key>CFBundleName</key>
16
+ <string>flic2lib</string>
17
+ <key>CFBundlePackageType</key>
18
+ <string>FMWK</string>
19
+ <key>CFBundleShortVersionString</key>
20
+ <string>1.2.0</string>
21
+ <key>CFBundleSupportedPlatforms</key>
22
+ <array>
23
+ <string>MacOSX</string>
24
+ </array>
25
+ <key>CFBundleVersion</key>
26
+ <string>1</string>
27
+ <key>DTCompiler</key>
28
+ <string>com.apple.compilers.llvm.clang.1_0</string>
29
+ <key>DTPlatformBuild</key>
30
+ <string>12E262</string>
31
+ <key>DTPlatformName</key>
32
+ <string>macosx</string>
33
+ <key>DTPlatformVersion</key>
34
+ <string>11.3</string>
35
+ <key>DTSDKBuild</key>
36
+ <string>20E214</string>
37
+ <key>DTSDKName</key>
38
+ <string>macosx11.3</string>
39
+ <key>DTXcode</key>
40
+ <string>1250</string>
41
+ <key>DTXcodeBuild</key>
42
+ <string>12E262</string>
43
+ <key>LSMinimumSystemVersion</key>
44
+ <string>10.15</string>
45
+ <key>UIDeviceFamily</key>
46
+ <array>
47
+ <integer>2</integer>
48
+ </array>
49
+ </dict>
50
+ </plist>
@@ -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