react-native-flic2 2.0.0-beta.1 → 2.0.0-beta.11
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/README.md +85 -22
- package/ios/Flic2.mm +12 -12
- package/lib/module/NativeFlic2.js.map +1 -1
- package/lib/module/index.js +6 -14
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/NativeFlic2.d.ts +14 -49
- package/lib/typescript/src/NativeFlic2.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +17 -52
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +23 -23
- package/src/NativeFlic2.ts +30 -28
- package/src/index.ts +18 -40
- package/android/build.gradle +0 -81
- package/android/gradle.properties +0 -5
- package/android/src/main/AndroidManifest.xml +0 -27
- package/android/src/main/java/com/flic2/Flic2ButtonListener.kt +0 -128
- package/android/src/main/java/com/flic2/Flic2Converter.kt +0 -103
- package/android/src/main/java/com/flic2/Flic2Module.kt +0 -481
- package/android/src/main/java/com/flic2/Flic2Package.kt +0 -33
- package/android/src/main/java/com/flic2/Flic2Service.kt +0 -112
- package/lib/module/index.bak.js +0 -161
- package/lib/module/index.bak.js.map +0 -1
- package/lib/typescript/src/index.bak.d.ts +0 -1
- package/lib/typescript/src/index.bak.d.ts.map +0 -1
- package/src/index.bak.tsx +0 -159
package/README.md
CHANGED
|
@@ -66,6 +66,65 @@ The library automatically includes the necessary permissions in `AndroidManifest
|
|
|
66
66
|
|
|
67
67
|
You'll need to request these permissions before scanning for buttons. Use a library like `react-native-permissions` or implement permission requests manually.
|
|
68
68
|
|
|
69
|
+
#### Customizing the Foreground Service Notification (Android)
|
|
70
|
+
|
|
71
|
+
The library runs a foreground service to keep Flic2 buttons connected in the background. You can customize the notification appearance by adding metadata to your app's `AndroidManifest.xml`:
|
|
72
|
+
|
|
73
|
+
```xml
|
|
74
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
75
|
+
<application>
|
|
76
|
+
<!-- Your existing application configuration -->
|
|
77
|
+
|
|
78
|
+
<!-- Customize Flic2 foreground service notification -->
|
|
79
|
+
<meta-data
|
|
80
|
+
android:name="nl.xguard.flic2.notification_title"
|
|
81
|
+
android:value="My Flic2 Service" />
|
|
82
|
+
<meta-data
|
|
83
|
+
android:name="nl.xguard.flic2.notification_text"
|
|
84
|
+
android:value="Flic2 buttons are active" />
|
|
85
|
+
<meta-data
|
|
86
|
+
android:name="nl.xguard.flic2.notification_icon"
|
|
87
|
+
android:resource="@drawable/ic_notification" />
|
|
88
|
+
<meta-data
|
|
89
|
+
android:name="nl.xguard.flic2.notification_channel_name"
|
|
90
|
+
android:value="Flic2 Notifications" />
|
|
91
|
+
<meta-data
|
|
92
|
+
android:name="nl.xguard.flic2.notification_channel_description"
|
|
93
|
+
android:value="Notifications for Flic2 button connections" />
|
|
94
|
+
<meta-data
|
|
95
|
+
android:name="nl.xguard.flic2.notification_id"
|
|
96
|
+
android:value="123321" />
|
|
97
|
+
<meta-data
|
|
98
|
+
android:name="nl.xguard.flic2.notification_channel_id"
|
|
99
|
+
android:value="my_custom_channel_id" />
|
|
100
|
+
</application>
|
|
101
|
+
</manifest>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Available Configuration Options:**
|
|
105
|
+
|
|
106
|
+
- `nl.xguard.flic2.notification_title` - Notification title (default: "Flic 2")
|
|
107
|
+
- `nl.xguard.flic2.notification_text` - Notification text (default: "Flic 2 service is running")
|
|
108
|
+
- `nl.xguard.flic2.notification_icon` - Notification icon resource ID (default: system info icon)
|
|
109
|
+
- Use `@drawable/your_icon_name` or `@mipmap/your_icon_name` format
|
|
110
|
+
- `nl.xguard.flic2.notification_channel_name` - Notification channel name (default: "Flic2Channel")
|
|
111
|
+
- `nl.xguard.flic2.notification_channel_description` - Notification channel description (default: "Flic2Channel")
|
|
112
|
+
- `nl.xguard.flic2.notification_id` - Notification ID integer (default: 123321)
|
|
113
|
+
- `nl.xguard.flic2.notification_channel_id` - Notification channel ID string (default: "Notification_Channel_Flic2Service")
|
|
114
|
+
|
|
115
|
+
**Example with Custom Icon:**
|
|
116
|
+
|
|
117
|
+
1. Add your notification icon to `android/app/src/main/res/drawable/` (e.g., `ic_flic2_notification.png`)
|
|
118
|
+
|
|
119
|
+
2. Add metadata to `AndroidManifest.xml`:
|
|
120
|
+
```xml
|
|
121
|
+
<meta-data
|
|
122
|
+
android:name="nl.xguard.flic2.notification_icon"
|
|
123
|
+
android:resource="@drawable/ic_flic2_notification" />
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
**Note:** The notification icon must be a white/transparent icon suitable for Android notifications. If you don't specify a custom icon, the system default info icon will be used.
|
|
127
|
+
|
|
69
128
|
## Basic Usage
|
|
70
129
|
|
|
71
130
|
### 1. Initialize the Library (Global Setup)
|
|
@@ -390,7 +449,7 @@ export default Flic2Example;
|
|
|
390
449
|
|
|
391
450
|
### Initialization
|
|
392
451
|
|
|
393
|
-
#### `initialize(): Promise<
|
|
452
|
+
#### `initialize(): Promise<void>`
|
|
394
453
|
|
|
395
454
|
Initialize the Flic2 manager. This must be called before using any other methods.
|
|
396
455
|
|
|
@@ -400,7 +459,7 @@ await Flic2.initialize();
|
|
|
400
459
|
|
|
401
460
|
### Scanning
|
|
402
461
|
|
|
403
|
-
#### `startScan(): Promise<
|
|
462
|
+
#### `startScan(): Promise<void>`
|
|
404
463
|
|
|
405
464
|
Start scanning for new Flic2 buttons. The scan will emit `scanStatusChange` events.
|
|
406
465
|
|
|
@@ -408,7 +467,7 @@ Start scanning for new Flic2 buttons. The scan will emit `scanStatusChange` even
|
|
|
408
467
|
await Flic2.startScan();
|
|
409
468
|
```
|
|
410
469
|
|
|
411
|
-
#### `stopScan(): Promise<
|
|
470
|
+
#### `stopScan(): Promise<void>`
|
|
412
471
|
|
|
413
472
|
Stop an ongoing scan.
|
|
414
473
|
|
|
@@ -442,7 +501,7 @@ Get a specific button by UUID.
|
|
|
442
501
|
const button = await Flic2.getButton('button-uuid');
|
|
443
502
|
```
|
|
444
503
|
|
|
445
|
-
#### `connectAllKnownButtons(): Promise<
|
|
504
|
+
#### `connectAllKnownButtons(): Promise<void>`
|
|
446
505
|
|
|
447
506
|
Connect to all previously known buttons.
|
|
448
507
|
|
|
@@ -450,7 +509,7 @@ Connect to all previously known buttons.
|
|
|
450
509
|
await Flic2.connectAllKnownButtons();
|
|
451
510
|
```
|
|
452
511
|
|
|
453
|
-
#### `disconnectAllKnownButtons(): Promise<
|
|
512
|
+
#### `disconnectAllKnownButtons(): Promise<void>`
|
|
454
513
|
|
|
455
514
|
Disconnect all connected buttons.
|
|
456
515
|
|
|
@@ -458,7 +517,7 @@ Disconnect all connected buttons.
|
|
|
458
517
|
await Flic2.disconnectAllKnownButtons();
|
|
459
518
|
```
|
|
460
519
|
|
|
461
|
-
#### `forgetButton(uuid: string): Promise<
|
|
520
|
+
#### `forgetButton(uuid: string): Promise<void>`
|
|
462
521
|
|
|
463
522
|
Forget (unpair) a specific button.
|
|
464
523
|
|
|
@@ -466,7 +525,7 @@ Forget (unpair) a specific button.
|
|
|
466
525
|
await Flic2.forgetButton('button-uuid');
|
|
467
526
|
```
|
|
468
527
|
|
|
469
|
-
#### `forgetAllButtons(): Promise<
|
|
528
|
+
#### `forgetAllButtons(): Promise<void>`
|
|
470
529
|
|
|
471
530
|
Forget all buttons.
|
|
472
531
|
|
|
@@ -476,50 +535,54 @@ await Flic2.forgetAllButtons();
|
|
|
476
535
|
|
|
477
536
|
### Button Configuration
|
|
478
537
|
|
|
479
|
-
#### `buttonConnect(uuid: string): Promise<
|
|
538
|
+
#### `buttonConnect(uuid: string): Promise<FlicButton>`
|
|
480
539
|
|
|
481
|
-
Connect to a specific button.
|
|
540
|
+
Connect to a specific button. Returns the button object.
|
|
482
541
|
|
|
483
542
|
```tsx
|
|
484
|
-
await Flic2.buttonConnect('button-uuid');
|
|
543
|
+
const button = await Flic2.buttonConnect('button-uuid');
|
|
485
544
|
```
|
|
486
545
|
|
|
487
|
-
#### `buttonDisconnect(uuid: string): Promise<
|
|
546
|
+
#### `buttonDisconnect(uuid: string): Promise<FlicButton>`
|
|
488
547
|
|
|
489
|
-
Disconnect a specific button.
|
|
548
|
+
Disconnect a specific button. Returns the button object.
|
|
490
549
|
|
|
491
550
|
```tsx
|
|
492
|
-
await Flic2.buttonDisconnect('button-uuid');
|
|
551
|
+
const button = await Flic2.buttonDisconnect('button-uuid');
|
|
493
552
|
```
|
|
494
553
|
|
|
495
|
-
#### `buttonSetNickname(uuid: string, nickname: string): Promise<
|
|
554
|
+
#### `buttonSetNickname(uuid: string, nickname: string): Promise<FlicButton>`
|
|
496
555
|
|
|
497
|
-
Set a custom nickname for a button.
|
|
556
|
+
Set a custom nickname for a button. Returns the updated button object.
|
|
498
557
|
|
|
499
558
|
```tsx
|
|
500
|
-
await Flic2.buttonSetNickname('button-uuid', 'My Button');
|
|
559
|
+
const button = await Flic2.buttonSetNickname('button-uuid', 'My Button');
|
|
501
560
|
```
|
|
502
561
|
|
|
503
|
-
#### `buttonSetTriggerMode(uuid: string, mode: TriggerModeType): Promise<
|
|
562
|
+
#### `buttonSetTriggerMode(uuid: string, mode: TriggerModeType): Promise<FlicButton>`
|
|
504
563
|
|
|
505
|
-
Set the trigger mode for a button. Modes:
|
|
564
|
+
Set the trigger mode for a button. Returns the updated button object. Modes:
|
|
506
565
|
- `0`: Click and Hold
|
|
507
566
|
- `1`: Click and Double Click
|
|
508
567
|
- `2`: Click and Double Click and Hold
|
|
509
568
|
- `3`: Click only
|
|
510
569
|
|
|
570
|
+
**Note:** This method is only supported on iOS. On Android, it will reject with an error.
|
|
571
|
+
|
|
511
572
|
```tsx
|
|
512
|
-
await Flic2.buttonSetTriggerMode('button-uuid', 3); // Click only
|
|
573
|
+
const button = await Flic2.buttonSetTriggerMode('button-uuid', 3); // Click only
|
|
513
574
|
```
|
|
514
575
|
|
|
515
|
-
#### `buttonSetLatencyMode(uuid: string, mode: LatencyModeType): Promise<
|
|
576
|
+
#### `buttonSetLatencyMode(uuid: string, mode: LatencyModeType): Promise<FlicButton>`
|
|
516
577
|
|
|
517
|
-
Set the latency mode for a button. Modes:
|
|
578
|
+
Set the latency mode for a button. Returns the updated button object. Modes:
|
|
518
579
|
- `0`: Normal latency
|
|
519
580
|
- `1`: Low latency
|
|
520
581
|
|
|
582
|
+
**Note:** This method is only supported on iOS. On Android, it will reject with an error.
|
|
583
|
+
|
|
521
584
|
```tsx
|
|
522
|
-
await Flic2.buttonSetLatencyMode('button-uuid', 1); // Low latency
|
|
585
|
+
const button = await Flic2.buttonSetLatencyMode('button-uuid', 1); // Low latency
|
|
523
586
|
```
|
|
524
587
|
|
|
525
588
|
#### `getBatteryHealth(uuid: string): Promise<boolean>`
|
package/ios/Flic2.mm
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
FLICManager *manager = [FLICManager configureWithDelegate:self buttonDelegate:self background:background];
|
|
19
19
|
|
|
20
20
|
if (manager) {
|
|
21
|
-
resolve(
|
|
21
|
+
resolve(nil);
|
|
22
22
|
} else {
|
|
23
23
|
reject(@"INIT_ERROR", @"Failed to initialize FLICManager", nil);
|
|
24
24
|
}
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
}];
|
|
115
115
|
|
|
116
116
|
// Return immediately - scan results will come through events
|
|
117
|
-
resolve(
|
|
117
|
+
resolve(nil);
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
- (void)stopScan:(RCTPromiseResolveBlock)resolve
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
NSLog(@"Stopping scan");
|
|
129
129
|
[[FLICManager sharedManager] stopScan];
|
|
130
130
|
|
|
131
|
-
resolve(
|
|
131
|
+
resolve(nil);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
- (void)forgetButton:(NSString *)uuid
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
if (error) {
|
|
155
155
|
reject(@"FORGET_ERROR", error.localizedDescription, error);
|
|
156
156
|
} else {
|
|
157
|
-
resolve(
|
|
157
|
+
resolve(nil);
|
|
158
158
|
}
|
|
159
159
|
}];
|
|
160
160
|
}
|
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
[button connect];
|
|
176
|
-
resolve(
|
|
176
|
+
resolve([self buttonToDictionary:button]);
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
- (void)disconnectButton:(NSString *)uuid
|
|
@@ -188,7 +188,7 @@
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
[button disconnect];
|
|
191
|
-
resolve(
|
|
191
|
+
resolve([self buttonToDictionary:button]);
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
- (void)setTriggerMode:(NSString *)uuid mode:(NSInteger)mode
|
|
@@ -203,7 +203,7 @@
|
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
button.triggerMode = (FLICButtonTriggerMode)mode;
|
|
206
|
-
resolve(
|
|
206
|
+
resolve([self buttonToDictionary:button]);
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
- (void)setLatencyMode:(NSString *)uuid mode:(NSInteger)mode
|
|
@@ -218,7 +218,7 @@
|
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
button.latencyMode = (FLICLatencyMode)mode;
|
|
221
|
-
resolve(
|
|
221
|
+
resolve([self buttonToDictionary:button]);
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
- (void)setNickname:(NSString *)uuid nickname:(NSString *)nickname
|
|
@@ -233,7 +233,7 @@
|
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
button.nickname = nickname;
|
|
236
|
-
resolve(
|
|
236
|
+
resolve([self buttonToDictionary:button]);
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
// MARK: - Helper Methods
|
|
@@ -254,7 +254,7 @@
|
|
|
254
254
|
[button connect];
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
-
resolve(
|
|
257
|
+
resolve(nil);
|
|
258
258
|
}
|
|
259
259
|
|
|
260
260
|
- (void)disconnectAllKnownButtons:(RCTPromiseResolveBlock)resolve
|
|
@@ -272,7 +272,7 @@
|
|
|
272
272
|
[button disconnect];
|
|
273
273
|
}
|
|
274
274
|
|
|
275
|
-
resolve(
|
|
275
|
+
resolve(nil);
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
- (void)forgetAllButtons:(RCTPromiseResolveBlock)resolve
|
|
@@ -292,7 +292,7 @@
|
|
|
292
292
|
}];
|
|
293
293
|
}
|
|
294
294
|
|
|
295
|
-
resolve(
|
|
295
|
+
resolve(nil);
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
- (void)isScanning:(RCTPromiseResolveBlock)resolve
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TurboModuleRegistry","ScanResult","getEnforcing"],"sourceRoot":"../../src","sources":["NativeFlic2.ts"],"mappings":";;AAAA,SACEA,mBAAmB,QAGd,cAAc;;AAErB;;AASA,WAAYC,UAAU,0BAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA;;
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","ScanResult","getEnforcing"],"sourceRoot":"../../src","sources":["NativeFlic2.ts"],"mappings":";;AAAA,SACEA,mBAAmB,QAGd,cAAc;;AAErB;;AASA,WAAYC,UAAU,0BAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAVA,UAAU,CAAVA,UAAU;EAAA,OAAVA,UAAU;AAAA;;AA+DtB;;AAgDA;;AAKA;;AAwCA,eAAeD,mBAAmB,CAACE,YAAY,CAAO,OAAO,CAAC","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -11,10 +11,6 @@ class Flic2 {
|
|
|
11
11
|
* @version 2.0.0
|
|
12
12
|
*/
|
|
13
13
|
constructor() {
|
|
14
|
-
// generate a random session ID for the instance
|
|
15
|
-
this.sessionId = Math.random().toString(36).substring(2, 15);
|
|
16
|
-
console.log('Created new Flic2 instance with sessionId', this.sessionId);
|
|
17
|
-
|
|
18
14
|
// create event emitter
|
|
19
15
|
this.eventEmitter = new TypedEmitter();
|
|
20
16
|
|
|
@@ -37,12 +33,8 @@ class Flic2 {
|
|
|
37
33
|
}
|
|
38
34
|
|
|
39
35
|
// initialize the Flic2 manager in background
|
|
40
|
-
|
|
41
|
-
if (!result.success) {
|
|
42
|
-
throw new Error(result.message);
|
|
43
|
-
}
|
|
36
|
+
await NativeFlic2.initialize(true);
|
|
44
37
|
this.onInitialized();
|
|
45
|
-
return true;
|
|
46
38
|
}
|
|
47
39
|
|
|
48
40
|
/**
|
|
@@ -130,7 +122,7 @@ class Flic2 {
|
|
|
130
122
|
* Connect a button.
|
|
131
123
|
*
|
|
132
124
|
* @param uuid - The UUID of the button to connect.
|
|
133
|
-
* @returns A promise that resolves
|
|
125
|
+
* @returns A promise that resolves with the button when the connection is initiated.
|
|
134
126
|
*/
|
|
135
127
|
buttonConnect(uuid) {
|
|
136
128
|
return NativeFlic2.connectButton(uuid);
|
|
@@ -140,7 +132,7 @@ class Flic2 {
|
|
|
140
132
|
* Disconnect a button.
|
|
141
133
|
*
|
|
142
134
|
* @param uuid - The UUID of the button to disconnect.
|
|
143
|
-
* @returns A promise that resolves
|
|
135
|
+
* @returns A promise that resolves with the button when the disconnection is initiated.
|
|
144
136
|
*/
|
|
145
137
|
buttonDisconnect(uuid) {
|
|
146
138
|
return NativeFlic2.disconnectButton(uuid);
|
|
@@ -151,7 +143,7 @@ class Flic2 {
|
|
|
151
143
|
*
|
|
152
144
|
* @param uuid - The UUID of the button to set the trigger mode of.
|
|
153
145
|
* @param mode - The trigger mode to set.
|
|
154
|
-
* @returns A promise that resolves when the trigger mode is set.
|
|
146
|
+
* @returns A promise that resolves with the button when the trigger mode is set.
|
|
155
147
|
*/
|
|
156
148
|
buttonSetTriggerMode(uuid, mode) {
|
|
157
149
|
return NativeFlic2.setTriggerMode(uuid, mode);
|
|
@@ -162,7 +154,7 @@ class Flic2 {
|
|
|
162
154
|
*
|
|
163
155
|
* @param uuid - The UUID of the button to set the latency mode of.
|
|
164
156
|
* @param mode - The latency mode to set.
|
|
165
|
-
* @returns A promise that resolves when the latency mode is set.
|
|
157
|
+
* @returns A promise that resolves with the button when the latency mode is set.
|
|
166
158
|
*/
|
|
167
159
|
buttonSetLatencyMode(uuid, mode) {
|
|
168
160
|
return NativeFlic2.setLatencyMode(uuid, mode);
|
|
@@ -173,7 +165,7 @@ class Flic2 {
|
|
|
173
165
|
*
|
|
174
166
|
* @param uuid - The UUID of the button to set the nickname of.
|
|
175
167
|
* @param nickname - The nickname to set.
|
|
176
|
-
* @returns A promise that resolves when the nickname is set.
|
|
168
|
+
* @returns A promise that resolves with the button when the nickname is set.
|
|
177
169
|
*/
|
|
178
170
|
buttonSetNickname(uuid, nickname) {
|
|
179
171
|
return NativeFlic2.setNickname(uuid, nickname);
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TypedEmitter","NativeFlic2","Flic2","isFlic2ManagerInitialized","constructor","
|
|
1
|
+
{"version":3,"names":["TypedEmitter","NativeFlic2","Flic2","isFlic2ManagerInitialized","constructor","eventEmitter","onButtonEvent","onNativeButtonEvent","bind","onManagerStateChange","onNativeManagerStateChange","onScanStatusChange","onNativeScanStatusChange","initialize","isInitialized","Error","onInitialized","startScan","scanForButtons","stopScan","connectAllKnownButtons","disconnectAllKnownButtons","forgetAllButtons","isScanning","forgetButton","uuid","buttonConnect","connectButton","buttonDisconnect","disconnectButton","buttonSetTriggerMode","mode","setTriggerMode","buttonSetLatencyMode","setLatencyMode","buttonSetNickname","nickname","setNickname","getButtons","getButton","buttons","button","find","item","getBatteryHealth","isBatteryVoltageOk","batteryVoltage","voltage","event","enrichedEvent","batteryVoltageOk","emit"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,YAAY,QAAQ,4BAAyB;AACtD,OAAOC,WAAW,MAOX,kBAAe;AAEtB,MAAMC,KAAK,CAAC;EAEFC,yBAAyB,GAAY,KAAK;EAQlD;AACF;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAAA,EAAG;IAEZ;IACA,IAAI,CAACC,YAAY,GAAG,IAAIL,YAAY,CAIjC,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C3C,YAAY,CAAC8C,IAAI,CAAC,oBAAoB,EAAEH,KAAK,CAAC;EAErD;;EAEA;AACF;AACA;AACA;AACA;EACUpC,wBAAwBA,CAACoC,KAA4B,EAAQ;IAEnE,IAAI,CAAC3C,YAAY,CAAC8C,IAAI,CAAC,kBAAkB,EAAEH,KAAK,CAAC;EAEnD;AAEF;;AAEA;AACA,eAAe,IAAI9C,KAAK,CAAC,CAAC;;AAE1B","ignoreList":[]}
|
|
@@ -35,9 +35,10 @@ export type ScanStatusChangeEvent = {
|
|
|
35
35
|
eventName: ScanStatus;
|
|
36
36
|
result?: ScanResult;
|
|
37
37
|
};
|
|
38
|
+
export type ButtonEventName = 'discovered' | 'connected' | 'ready' | 'disconnected' | 'connectionFailed' | 'buttonDown' | 'buttonUp' | 'click' | 'doubleClick' | 'hold' | 'unpaired' | 'batteryUpdate' | 'nicknameUpdate';
|
|
38
39
|
export type ButtonEvent = {
|
|
39
40
|
uuid: string;
|
|
40
|
-
event:
|
|
41
|
+
event: ButtonEventName;
|
|
41
42
|
queued?: boolean;
|
|
42
43
|
age?: number;
|
|
43
44
|
nickname?: string;
|
|
@@ -79,56 +80,20 @@ export type FlicLatencyMode = 'normal' | 'low';
|
|
|
79
80
|
export type TriggerModeType = 0 | 1 | 2 | 3;
|
|
80
81
|
export type LatencyModeType = 0 | 1;
|
|
81
82
|
export interface Spec extends TurboModule {
|
|
82
|
-
initialize(background: boolean): Promise<
|
|
83
|
-
success: boolean;
|
|
84
|
-
message: string;
|
|
85
|
-
}>;
|
|
83
|
+
initialize(background: boolean): Promise<void>;
|
|
86
84
|
getButtons(): Promise<FlicButton[]>;
|
|
87
|
-
scanForButtons(): Promise<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
message: string;
|
|
94
|
-
}>;
|
|
95
|
-
forgetButton(uuid: string): Promise<{
|
|
96
|
-
success: boolean;
|
|
97
|
-
message: string;
|
|
98
|
-
}>;
|
|
99
|
-
connectAllKnownButtons(): Promise<{
|
|
100
|
-
success: boolean;
|
|
101
|
-
message: string;
|
|
102
|
-
}>;
|
|
103
|
-
disconnectAllKnownButtons(): Promise<{
|
|
104
|
-
success: boolean;
|
|
105
|
-
message: string;
|
|
106
|
-
}>;
|
|
107
|
-
forgetAllButtons(): Promise<{
|
|
108
|
-
success: boolean;
|
|
109
|
-
message: string;
|
|
110
|
-
}>;
|
|
85
|
+
scanForButtons(): Promise<void>;
|
|
86
|
+
stopScan(): Promise<void>;
|
|
87
|
+
forgetButton(uuid: string): Promise<void>;
|
|
88
|
+
connectAllKnownButtons(): Promise<void>;
|
|
89
|
+
disconnectAllKnownButtons(): Promise<void>;
|
|
90
|
+
forgetAllButtons(): Promise<void>;
|
|
111
91
|
isScanning(): Promise<boolean>;
|
|
112
|
-
connectButton(uuid: string): Promise<
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
success: boolean;
|
|
118
|
-
message: string;
|
|
119
|
-
}>;
|
|
120
|
-
setTriggerMode(uuid: string, mode: TriggerModeType): Promise<{
|
|
121
|
-
success: boolean;
|
|
122
|
-
message: string;
|
|
123
|
-
}>;
|
|
124
|
-
setLatencyMode(uuid: string, mode: LatencyModeType): Promise<{
|
|
125
|
-
success: boolean;
|
|
126
|
-
message: string;
|
|
127
|
-
}>;
|
|
128
|
-
setNickname(uuid: string, nickname: string): Promise<{
|
|
129
|
-
success: boolean;
|
|
130
|
-
message: string;
|
|
131
|
-
}>;
|
|
92
|
+
connectButton(uuid: string): Promise<FlicButton>;
|
|
93
|
+
disconnectButton(uuid: string): Promise<FlicButton>;
|
|
94
|
+
setTriggerMode(uuid: string, mode: number): Promise<FlicButton>;
|
|
95
|
+
setLatencyMode(uuid: string, mode: number): Promise<FlicButton>;
|
|
96
|
+
setNickname(uuid: string, nickname: string): Promise<FlicButton>;
|
|
132
97
|
readonly onManagerStateChange: CodegenTypes.EventEmitter<ManagerStateChangeEvent>;
|
|
133
98
|
readonly onScanStatusChange: CodegenTypes.EventEmitter<ScanStatusChangeEvent>;
|
|
134
99
|
readonly onButtonEvent: CodegenTypes.EventEmitter<ButtonEvent>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NativeFlic2.d.ts","sourceRoot":"","sources":["../../../src/NativeFlic2.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,cAAc,CAAC;AAItB,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,UAAU,GAAG,cAAc,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,oBAAY,UAAU;IACpB,OAAO,IAAI;IACX,eAAe,IAAI;IACnB,uBAAuB,IAAI;IAC3B,OAAO,IAAI;IACX,2BAA2B,IAAI;IAC/B,mCAAmC,IAAI;IACvC,kBAAkB,IAAI;IACtB,gBAAgB,IAAI;IACpB,oDAAoD,IAAI;IACxD,gCAAgC,IAAI;IACpC,iCAAiC,KAAK;IACtC,0BAA0B,KAAK;IAC/B,aAAa,KAAK;IAClB,yBAAyB,KAAK;IAC9B,oBAAoB,KAAK;IACzB,aAAa,KAAK;IAClB,8BAA8B,KAAK;IACnC,qCAAqC,KAAK;IAC1C,uCAAuC,KAAK;IAC5C,mBAAmB,KAAK;IACxB,wBAAwB,KAAK;IAC7B,kBAAkB,KAAK;CACxB;AAED,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,YAAY,CAAC;AAElD,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,UAAU,CAAC;IAClB,SAAS,EAAE,UAAU,CAAC;IACtB,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"NativeFlic2.d.ts","sourceRoot":"","sources":["../../../src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YAAY,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC;IAC9E,QAAQ,CAAC,aAAa,EAAE,YAAY,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;CAChE;;AAED,wBAA+D"}
|
|
@@ -2,12 +2,10 @@ import { TypedEmitter } from './lib/typedEventEmitter';
|
|
|
2
2
|
import { type ButtonEvent, type FlicButton, type LatencyModeType, type ManagerStateChangeEvent, type ScanStatusChangeEvent, type TriggerModeType } from './NativeFlic2';
|
|
3
3
|
declare class Flic2 {
|
|
4
4
|
private isFlic2ManagerInitialized;
|
|
5
|
-
private sessionId;
|
|
6
5
|
eventEmitter: TypedEmitter<{
|
|
7
6
|
buttonEvent: (event: ButtonEvent) => void;
|
|
8
7
|
managerStateChange: (event: ManagerStateChangeEvent) => void;
|
|
9
8
|
scanStatusChange: (event: ScanStatusChangeEvent) => void;
|
|
10
|
-
managerInitialized: () => void;
|
|
11
9
|
}>;
|
|
12
10
|
/**
|
|
13
11
|
* Constructor.
|
|
@@ -21,25 +19,19 @@ declare class Flic2 {
|
|
|
21
19
|
*
|
|
22
20
|
* @returns A promise that resolves when the Flic2 manager is initialized.
|
|
23
21
|
*/
|
|
24
|
-
initialize(): Promise<
|
|
22
|
+
initialize(): Promise<void>;
|
|
25
23
|
/**
|
|
26
24
|
* Scan for buttons.
|
|
27
25
|
*
|
|
28
26
|
* @returns A promise that resolves when the scan is started. Events will be emitted for the scan process.
|
|
29
27
|
*/
|
|
30
|
-
startScan(): Promise<
|
|
31
|
-
success: boolean;
|
|
32
|
-
message: string;
|
|
33
|
-
}>;
|
|
28
|
+
startScan(): Promise<void>;
|
|
34
29
|
/**
|
|
35
30
|
* Stop the scan.
|
|
36
31
|
*
|
|
37
32
|
* @returns A promise that resolves when the scan is stopped.
|
|
38
33
|
*/
|
|
39
|
-
stopScan(): Promise<
|
|
40
|
-
success: boolean;
|
|
41
|
-
message: string;
|
|
42
|
-
}>;
|
|
34
|
+
stopScan(): Promise<void>;
|
|
43
35
|
/**
|
|
44
36
|
* Called when the Flic2 manager is initialized.
|
|
45
37
|
*/
|
|
@@ -55,28 +47,19 @@ declare class Flic2 {
|
|
|
55
47
|
*
|
|
56
48
|
* @returns A promise that resolves when the all known buttons are connected.
|
|
57
49
|
*/
|
|
58
|
-
connectAllKnownButtons(): Promise<
|
|
59
|
-
success: boolean;
|
|
60
|
-
message: string;
|
|
61
|
-
}>;
|
|
50
|
+
connectAllKnownButtons(): Promise<void>;
|
|
62
51
|
/**
|
|
63
52
|
* Disconnect all known buttons.
|
|
64
53
|
*
|
|
65
54
|
* @returns A promise that resolves when the all known buttons are disconnected.
|
|
66
55
|
*/
|
|
67
|
-
disconnectAllKnownButtons(): Promise<
|
|
68
|
-
success: boolean;
|
|
69
|
-
message: string;
|
|
70
|
-
}>;
|
|
56
|
+
disconnectAllKnownButtons(): Promise<void>;
|
|
71
57
|
/**
|
|
72
58
|
* Forget all buttons.
|
|
73
59
|
*
|
|
74
60
|
* @returns A promise that resolves when the all buttons are forgotten.
|
|
75
61
|
*/
|
|
76
|
-
forgetAllButtons(): Promise<
|
|
77
|
-
success: boolean;
|
|
78
|
-
message: string;
|
|
79
|
-
}>;
|
|
62
|
+
forgetAllButtons(): Promise<void>;
|
|
80
63
|
/**
|
|
81
64
|
* Check if a scan is currently running.
|
|
82
65
|
*
|
|
@@ -89,63 +72,45 @@ declare class Flic2 {
|
|
|
89
72
|
* @param uuid - The UUID of the button to forget.
|
|
90
73
|
* @returns A promise that resolves when the button is forgotten.
|
|
91
74
|
*/
|
|
92
|
-
forgetButton(uuid: string): Promise<
|
|
93
|
-
success: boolean;
|
|
94
|
-
message: string;
|
|
95
|
-
}>;
|
|
75
|
+
forgetButton(uuid: string): Promise<void>;
|
|
96
76
|
/**
|
|
97
77
|
* Connect a button.
|
|
98
78
|
*
|
|
99
79
|
* @param uuid - The UUID of the button to connect.
|
|
100
|
-
* @returns A promise that resolves
|
|
80
|
+
* @returns A promise that resolves with the button when the connection is initiated.
|
|
101
81
|
*/
|
|
102
|
-
buttonConnect(uuid: string): Promise<
|
|
103
|
-
success: boolean;
|
|
104
|
-
message: string;
|
|
105
|
-
}>;
|
|
82
|
+
buttonConnect(uuid: string): Promise<FlicButton>;
|
|
106
83
|
/**
|
|
107
84
|
* Disconnect a button.
|
|
108
85
|
*
|
|
109
86
|
* @param uuid - The UUID of the button to disconnect.
|
|
110
|
-
* @returns A promise that resolves
|
|
87
|
+
* @returns A promise that resolves with the button when the disconnection is initiated.
|
|
111
88
|
*/
|
|
112
|
-
buttonDisconnect(uuid: string): Promise<
|
|
113
|
-
success: boolean;
|
|
114
|
-
message: string;
|
|
115
|
-
}>;
|
|
89
|
+
buttonDisconnect(uuid: string): Promise<FlicButton>;
|
|
116
90
|
/**
|
|
117
91
|
* Set the trigger mode of a button.
|
|
118
92
|
*
|
|
119
93
|
* @param uuid - The UUID of the button to set the trigger mode of.
|
|
120
94
|
* @param mode - The trigger mode to set.
|
|
121
|
-
* @returns A promise that resolves when the trigger mode is set.
|
|
95
|
+
* @returns A promise that resolves with the button when the trigger mode is set.
|
|
122
96
|
*/
|
|
123
|
-
buttonSetTriggerMode(uuid: string, mode: TriggerModeType): Promise<
|
|
124
|
-
success: boolean;
|
|
125
|
-
message: string;
|
|
126
|
-
}>;
|
|
97
|
+
buttonSetTriggerMode(uuid: string, mode: TriggerModeType): Promise<FlicButton>;
|
|
127
98
|
/**
|
|
128
99
|
* Set the latency mode of a button.
|
|
129
100
|
*
|
|
130
101
|
* @param uuid - The UUID of the button to set the latency mode of.
|
|
131
102
|
* @param mode - The latency mode to set.
|
|
132
|
-
* @returns A promise that resolves when the latency mode is set.
|
|
103
|
+
* @returns A promise that resolves with the button when the latency mode is set.
|
|
133
104
|
*/
|
|
134
|
-
buttonSetLatencyMode(uuid: string, mode: LatencyModeType): Promise<
|
|
135
|
-
success: boolean;
|
|
136
|
-
message: string;
|
|
137
|
-
}>;
|
|
105
|
+
buttonSetLatencyMode(uuid: string, mode: LatencyModeType): Promise<FlicButton>;
|
|
138
106
|
/**
|
|
139
107
|
* Set the nickname of a button.
|
|
140
108
|
*
|
|
141
109
|
* @param uuid - The UUID of the button to set the nickname of.
|
|
142
110
|
* @param nickname - The nickname to set.
|
|
143
|
-
* @returns A promise that resolves when the nickname is set.
|
|
111
|
+
* @returns A promise that resolves with the button when the nickname is set.
|
|
144
112
|
*/
|
|
145
|
-
buttonSetNickname(uuid: string, nickname: string): Promise<
|
|
146
|
-
success: boolean;
|
|
147
|
-
message: string;
|
|
148
|
-
}>;
|
|
113
|
+
buttonSetNickname(uuid: string, nickname: string): Promise<FlicButton>;
|
|
149
114
|
/**
|
|
150
115
|
* Get all buttons.
|
|
151
116
|
*
|