react-native-flic2 2.0.0-beta.3 → 2.0.0-beta.4
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/Flic2Converter.kt +1 -2
- package/android/src/main/java/nl/xguard/flic2/Flic2Module.kt +3 -0
- package/ios/Flic2.mm +5 -5
- package/lib/module/NativeFlic2.js.map +1 -1
- package/lib/typescript/src/NativeFlic2.d.ts +19 -13
- package/lib/typescript/src/NativeFlic2.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/NativeFlic2.ts +28 -26
- 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
|
@@ -31,8 +31,7 @@ object Flic2Converter {
|
|
|
31
31
|
putInt("firmwareRevision", button.getFirmwareVersion())
|
|
32
32
|
|
|
33
33
|
// Check if ready by comparing connection state
|
|
34
|
-
|
|
35
|
-
putBoolean("isReady", isReady)
|
|
34
|
+
putBoolean("isReady", connState == Flic2Button.CONNECTION_STATE_CONNECTED_READY)
|
|
36
35
|
|
|
37
36
|
// Get battery level from BatteryLevel object
|
|
38
37
|
val batteryLevel = button.getLastKnownBatteryLevel()
|
|
@@ -294,6 +294,7 @@ class Flic2Module(reactContext: ReactApplicationContext) :
|
|
|
294
294
|
promise.resolve(Arguments.createMap().apply {
|
|
295
295
|
putBoolean("success", true)
|
|
296
296
|
putString("message", "Connection initiated")
|
|
297
|
+
putMap("button", Flic2Converter.buttonToMap(button))
|
|
297
298
|
})
|
|
298
299
|
} catch (e: Exception) {
|
|
299
300
|
Log.e(TAG, "Failed to connect button", e)
|
|
@@ -314,6 +315,7 @@ class Flic2Module(reactContext: ReactApplicationContext) :
|
|
|
314
315
|
promise.resolve(Arguments.createMap().apply {
|
|
315
316
|
putBoolean("success", true)
|
|
316
317
|
putString("message", "Disconnection initiated")
|
|
318
|
+
putMap("button", Flic2Converter.buttonToMap(button))
|
|
317
319
|
})
|
|
318
320
|
} catch (e: Exception) {
|
|
319
321
|
Log.e(TAG, "Failed to disconnect button", e)
|
|
@@ -349,6 +351,7 @@ class Flic2Module(reactContext: ReactApplicationContext) :
|
|
|
349
351
|
promise.resolve(Arguments.createMap().apply {
|
|
350
352
|
putBoolean("success", true)
|
|
351
353
|
putString("message", "Nickname set")
|
|
354
|
+
putMap("button", Flic2Converter.buttonToMap(button))
|
|
352
355
|
})
|
|
353
356
|
} catch (e: Exception) {
|
|
354
357
|
Log.e(TAG, "Failed to set nickname", e)
|
package/ios/Flic2.mm
CHANGED
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
[button connect];
|
|
176
|
-
resolve(@{@"success": @YES, @"message": @"Connection initiated"});
|
|
176
|
+
resolve(@{@"success": @YES, @"message": @"Connection initiated", @"button": [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(@{@"success": @YES, @"message": @"Disconnection initiated"});
|
|
191
|
+
resolve(@{@"success": @YES, @"message": @"Disconnection initiated", @"button": [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(@{@"success": @YES, @"message": @"Trigger mode set"});
|
|
206
|
+
resolve(@{@"success": @YES, @"message": @"Trigger mode set", @"button": [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(@{@"success": @YES, @"message": @"Latency mode set"});
|
|
221
|
+
resolve(@{@"success": @YES, @"message": @"Latency mode set", @"button": [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(@{@"success": @YES, @"message": @"Nickname set"});
|
|
236
|
+
resolve(@{@"success": @YES, @"message": @"Nickname set", @"button": [self buttonToDictionary:button]});
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
// MARK: - Helper Methods
|
|
@@ -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":[]}
|
|
@@ -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;
|
|
@@ -80,54 +81,59 @@ export type TriggerModeType = 0 | 1 | 2 | 3;
|
|
|
80
81
|
export type LatencyModeType = 0 | 1;
|
|
81
82
|
export interface Spec extends TurboModule {
|
|
82
83
|
initialize(background: boolean): Promise<{
|
|
83
|
-
success:
|
|
84
|
+
success: true;
|
|
84
85
|
message: string;
|
|
85
86
|
}>;
|
|
86
87
|
getButtons(): Promise<FlicButton[]>;
|
|
87
88
|
scanForButtons(): Promise<{
|
|
88
|
-
success:
|
|
89
|
+
success: true;
|
|
89
90
|
message: string;
|
|
90
91
|
}>;
|
|
91
92
|
stopScan(): Promise<{
|
|
92
|
-
success:
|
|
93
|
+
success: true;
|
|
93
94
|
message: string;
|
|
94
95
|
}>;
|
|
95
96
|
forgetButton(uuid: string): Promise<{
|
|
96
|
-
success:
|
|
97
|
+
success: true;
|
|
97
98
|
message: string;
|
|
98
99
|
}>;
|
|
99
100
|
connectAllKnownButtons(): Promise<{
|
|
100
|
-
success:
|
|
101
|
+
success: true;
|
|
101
102
|
message: string;
|
|
102
103
|
}>;
|
|
103
104
|
disconnectAllKnownButtons(): Promise<{
|
|
104
|
-
success:
|
|
105
|
+
success: true;
|
|
105
106
|
message: string;
|
|
106
107
|
}>;
|
|
107
108
|
forgetAllButtons(): Promise<{
|
|
108
|
-
success:
|
|
109
|
+
success: true;
|
|
109
110
|
message: string;
|
|
110
111
|
}>;
|
|
111
112
|
isScanning(): Promise<boolean>;
|
|
112
113
|
connectButton(uuid: string): Promise<{
|
|
113
|
-
success:
|
|
114
|
+
success: true;
|
|
114
115
|
message: string;
|
|
116
|
+
button: FlicButton;
|
|
115
117
|
}>;
|
|
116
118
|
disconnectButton(uuid: string): Promise<{
|
|
117
|
-
success:
|
|
119
|
+
success: true;
|
|
118
120
|
message: string;
|
|
121
|
+
button: FlicButton;
|
|
119
122
|
}>;
|
|
120
123
|
setTriggerMode(uuid: string, mode: TriggerModeType): Promise<{
|
|
121
|
-
success:
|
|
124
|
+
success: true;
|
|
122
125
|
message: string;
|
|
126
|
+
button: FlicButton;
|
|
123
127
|
}>;
|
|
124
128
|
setLatencyMode(uuid: string, mode: LatencyModeType): Promise<{
|
|
125
|
-
success:
|
|
129
|
+
success: true;
|
|
126
130
|
message: string;
|
|
131
|
+
button: FlicButton;
|
|
127
132
|
}>;
|
|
128
133
|
setNickname(uuid: string, nickname: string): Promise<{
|
|
129
|
-
success:
|
|
134
|
+
success: true;
|
|
130
135
|
message: string;
|
|
136
|
+
button: FlicButton;
|
|
131
137
|
}>;
|
|
132
138
|
readonly onManagerStateChange: CodegenTypes.EventEmitter<ManagerStateChangeEvent>;
|
|
133
139
|
readonly onScanStatusChange: CodegenTypes.EventEmitter<ScanStatusChangeEvent>;
|
|
@@ -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,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A;KAAE,CAAC,CAAC;IAGnE,QAAQ,CAAC,oBAAoB,EAAE,YAAY,CAAC,YAAY,CAAC,uBAAuB,CAAC,CAAC;IAClF,QAAQ,CAAC,kBAAkB,EAAE,YAAY,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC;IAC9E,QAAQ,CAAC,aAAa,EAAE,YAAY,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;CAChE;;AAED,wBAA+D"}
|
package/package.json
CHANGED
package/src/NativeFlic2.ts
CHANGED
|
@@ -46,22 +46,24 @@ export type ScanStatusChangeEvent = {
|
|
|
46
46
|
result?: ScanResult;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
+
export type ButtonEventName =
|
|
50
|
+
| 'discovered'
|
|
51
|
+
| 'connected'
|
|
52
|
+
| 'ready'
|
|
53
|
+
| 'disconnected'
|
|
54
|
+
| 'connectionFailed'
|
|
55
|
+
| 'buttonDown'
|
|
56
|
+
| 'buttonUp'
|
|
57
|
+
| 'click'
|
|
58
|
+
| 'doubleClick'
|
|
59
|
+
| 'hold'
|
|
60
|
+
| 'unpaired'
|
|
61
|
+
| 'batteryUpdate'
|
|
62
|
+
| 'nicknameUpdate';
|
|
63
|
+
|
|
49
64
|
export type ButtonEvent = {
|
|
50
65
|
uuid: string;
|
|
51
|
-
event:
|
|
52
|
-
| 'discovered'
|
|
53
|
-
| 'connected'
|
|
54
|
-
| 'ready'
|
|
55
|
-
| 'disconnected'
|
|
56
|
-
| 'connectionFailed'
|
|
57
|
-
| 'buttonDown'
|
|
58
|
-
| 'buttonUp'
|
|
59
|
-
| 'click'
|
|
60
|
-
| 'doubleClick'
|
|
61
|
-
| 'hold'
|
|
62
|
-
| 'unpaired'
|
|
63
|
-
| 'batteryUpdate'
|
|
64
|
-
| 'nicknameUpdate';
|
|
66
|
+
event: ButtonEventName;
|
|
65
67
|
queued?: boolean;
|
|
66
68
|
age?: number;
|
|
67
69
|
nickname?: string;
|
|
@@ -133,33 +135,33 @@ export interface Spec extends TurboModule {
|
|
|
133
135
|
// Manager methods
|
|
134
136
|
initialize(
|
|
135
137
|
background: boolean
|
|
136
|
-
): Promise<{ success:
|
|
138
|
+
): Promise<{ success: true; message: string }>;
|
|
137
139
|
getButtons(): Promise<FlicButton[]>;
|
|
138
|
-
scanForButtons(): Promise<{ success:
|
|
139
|
-
stopScan(): Promise<{ success:
|
|
140
|
-
forgetButton(uuid: string): Promise<{ success:
|
|
141
|
-
connectAllKnownButtons(): Promise<{ success:
|
|
142
|
-
disconnectAllKnownButtons(): Promise<{ success:
|
|
143
|
-
forgetAllButtons(): Promise<{ success:
|
|
140
|
+
scanForButtons(): Promise<{ success: true; message: string }>;
|
|
141
|
+
stopScan(): Promise<{ success: true; message: string }>;
|
|
142
|
+
forgetButton(uuid: string): Promise<{ success: true; message: string }>;
|
|
143
|
+
connectAllKnownButtons(): Promise<{ success: true; message: string }>;
|
|
144
|
+
disconnectAllKnownButtons(): Promise<{ success: true; message: string }>;
|
|
145
|
+
forgetAllButtons(): Promise<{ success: true; message: string }>;
|
|
144
146
|
isScanning(): Promise<boolean>;
|
|
145
147
|
|
|
146
148
|
// Button methods
|
|
147
|
-
connectButton(uuid: string): Promise<{ success:
|
|
149
|
+
connectButton(uuid: string): Promise<{ success: true; message: string; button: FlicButton }>;
|
|
148
150
|
disconnectButton(
|
|
149
151
|
uuid: string
|
|
150
|
-
): Promise<{ success:
|
|
152
|
+
): Promise<{ success: true; message: string; button: FlicButton }>;
|
|
151
153
|
setTriggerMode(
|
|
152
154
|
uuid: string,
|
|
153
155
|
mode: TriggerModeType
|
|
154
|
-
): Promise<{ success:
|
|
156
|
+
): Promise<{ success: true; message: string; button: FlicButton }>;
|
|
155
157
|
setLatencyMode(
|
|
156
158
|
uuid: string,
|
|
157
159
|
mode: LatencyModeType
|
|
158
|
-
): Promise<{ success:
|
|
160
|
+
): Promise<{ success: true; message: string; button: FlicButton }>;
|
|
159
161
|
setNickname(
|
|
160
162
|
uuid: string,
|
|
161
163
|
nickname: string
|
|
162
|
-
): Promise<{ success:
|
|
164
|
+
): Promise<{ success: true; message: string; button: FlicButton }>;
|
|
163
165
|
|
|
164
166
|
// Event emitters
|
|
165
167
|
readonly onManagerStateChange: CodegenTypes.EventEmitter<ManagerStateChangeEvent>;
|
package/lib/module/index.bak.js
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
// import type { CodegenTypes } from 'react-native';
|
|
2
|
-
// import type {
|
|
3
|
-
// MultiplyEvent,
|
|
4
|
-
// ManagerStateChangeEvent,
|
|
5
|
-
// ScanStatusChangeEvent,
|
|
6
|
-
// ButtonEvent,
|
|
7
|
-
// FlicButton,
|
|
8
|
-
// TriggerModeType,
|
|
9
|
-
// LatencyModeType,
|
|
10
|
-
// } from './NativeFlic2';
|
|
11
|
-
// import NativeFlic2 from './NativeFlic2';
|
|
12
|
-
|
|
13
|
-
// // MARK: - Example Functions (keeping for compatibility)
|
|
14
|
-
|
|
15
|
-
// export function multiply(a: number, b: number): number {
|
|
16
|
-
// return NativeFlic2.multiply(a, b);
|
|
17
|
-
// }
|
|
18
|
-
|
|
19
|
-
// export const onMultiply =
|
|
20
|
-
// NativeFlic2.onMultiply as CodegenTypes.EventEmitter<MultiplyEvent>;
|
|
21
|
-
|
|
22
|
-
// // MARK: - Manager Functions
|
|
23
|
-
|
|
24
|
-
// export function initialize(
|
|
25
|
-
// background: boolean
|
|
26
|
-
// ): Promise<{ success: boolean; message: string }> {
|
|
27
|
-
// return NativeFlic2.initialize(background);
|
|
28
|
-
// }
|
|
29
|
-
|
|
30
|
-
// export function getButtons(): Promise<FlicButton[]> {
|
|
31
|
-
// return NativeFlic2.getButtons();
|
|
32
|
-
// }
|
|
33
|
-
|
|
34
|
-
// export function scanForButtons(): Promise<{
|
|
35
|
-
// success: boolean;
|
|
36
|
-
// message: string;
|
|
37
|
-
// }> {
|
|
38
|
-
// return NativeFlic2.scanForButtons();
|
|
39
|
-
// }
|
|
40
|
-
|
|
41
|
-
// export function stopScan(): Promise<{ success: boolean; message: string }> {
|
|
42
|
-
// return NativeFlic2.stopScan();
|
|
43
|
-
// }
|
|
44
|
-
|
|
45
|
-
// export function forgetButton(
|
|
46
|
-
// uuid: string
|
|
47
|
-
// ): Promise<{ success: boolean; message: string }> {
|
|
48
|
-
// return NativeFlic2.forgetButton(uuid);
|
|
49
|
-
// }
|
|
50
|
-
|
|
51
|
-
// export function connectAllKnownButtons(): Promise<{
|
|
52
|
-
// success: boolean;
|
|
53
|
-
// message: string;
|
|
54
|
-
// }> {
|
|
55
|
-
// return NativeFlic2.connectAllKnownButtons();
|
|
56
|
-
// }
|
|
57
|
-
|
|
58
|
-
// export function disconnectAllKnownButtons(): Promise<{
|
|
59
|
-
// success: boolean;
|
|
60
|
-
// message: string;
|
|
61
|
-
// }> {
|
|
62
|
-
// return NativeFlic2.disconnectAllKnownButtons();
|
|
63
|
-
// }
|
|
64
|
-
|
|
65
|
-
// export function forgetAllButtons(): Promise<{
|
|
66
|
-
// success: boolean;
|
|
67
|
-
// message: string;
|
|
68
|
-
// }> {
|
|
69
|
-
// return NativeFlic2.forgetAllButtons();
|
|
70
|
-
// }
|
|
71
|
-
|
|
72
|
-
// export function isScanning(): Promise<boolean> {
|
|
73
|
-
// return NativeFlic2.isScanning();
|
|
74
|
-
// }
|
|
75
|
-
|
|
76
|
-
// // MARK: - Button Functions
|
|
77
|
-
|
|
78
|
-
// export function connectButton(
|
|
79
|
-
// uuid: string
|
|
80
|
-
// ): Promise<{ success: boolean; message: string }> {
|
|
81
|
-
// return NativeFlic2.connectButton(uuid);
|
|
82
|
-
// }
|
|
83
|
-
|
|
84
|
-
// export function disconnectButton(
|
|
85
|
-
// uuid: string
|
|
86
|
-
// ): Promise<{ success: boolean; message: string }> {
|
|
87
|
-
// return NativeFlic2.disconnectButton(uuid);
|
|
88
|
-
// }
|
|
89
|
-
|
|
90
|
-
// /**
|
|
91
|
-
// * Sets the trigger mode for a button.
|
|
92
|
-
// *
|
|
93
|
-
// * @platform iOS
|
|
94
|
-
// * @param uuid - Button UUID
|
|
95
|
-
// * @param mode - Trigger mode (0-3)
|
|
96
|
-
// * @returns Promise that resolves on iOS, rejects with NOT_SUPPORTED_ON_ANDROID on Android
|
|
97
|
-
// *
|
|
98
|
-
// * **Note:** This feature is only available on iOS. On Android, this will reject due to
|
|
99
|
-
// * limitations in the Android Flic2 library v1.1.0+.
|
|
100
|
-
// */
|
|
101
|
-
// export function setTriggerMode(
|
|
102
|
-
// uuid: string,
|
|
103
|
-
// mode: TriggerModeType
|
|
104
|
-
// ): Promise<{ success: boolean; message: string }> {
|
|
105
|
-
// return NativeFlic2.setTriggerMode(uuid, mode);
|
|
106
|
-
// }
|
|
107
|
-
|
|
108
|
-
// /**
|
|
109
|
-
// * Sets the latency mode for a button.
|
|
110
|
-
// *
|
|
111
|
-
// * @platform iOS
|
|
112
|
-
// * @param uuid - Button UUID
|
|
113
|
-
// * @param mode - Latency mode (0-1)
|
|
114
|
-
// * @returns Promise that resolves on iOS, rejects with NOT_SUPPORTED_ON_ANDROID on Android
|
|
115
|
-
// *
|
|
116
|
-
// * **Note:** This feature is only available on iOS. On Android, this will reject due to
|
|
117
|
-
// * limitations in the Android Flic2 library v1.1.0+.
|
|
118
|
-
// */
|
|
119
|
-
// export function setLatencyMode(
|
|
120
|
-
// uuid: string,
|
|
121
|
-
// mode: LatencyModeType
|
|
122
|
-
// ): Promise<{ success: boolean; message: string }> {
|
|
123
|
-
// return NativeFlic2.setLatencyMode(uuid, mode);
|
|
124
|
-
// }
|
|
125
|
-
|
|
126
|
-
// export function setNickname(
|
|
127
|
-
// uuid: string,
|
|
128
|
-
// nickname: string
|
|
129
|
-
// ): Promise<{ success: boolean; message: string }> {
|
|
130
|
-
// return NativeFlic2.setNickname(uuid, nickname);
|
|
131
|
-
// }
|
|
132
|
-
|
|
133
|
-
// // MARK: - Event Emitters
|
|
134
|
-
|
|
135
|
-
// export const onManagerStateChange =
|
|
136
|
-
// NativeFlic2.onManagerStateChange as CodegenTypes.EventEmitter<ManagerStateChangeEvent>;
|
|
137
|
-
|
|
138
|
-
// export const onScanStatusChange =
|
|
139
|
-
// NativeFlic2.onScanStatusChange as CodegenTypes.EventEmitter<ScanStatusChangeEvent>;
|
|
140
|
-
|
|
141
|
-
// export const onButtonEvent =
|
|
142
|
-
// NativeFlic2.onButtonEvent as CodegenTypes.EventEmitter<ButtonEvent>;
|
|
143
|
-
|
|
144
|
-
// // MARK: - Re-export Types
|
|
145
|
-
|
|
146
|
-
// export type {
|
|
147
|
-
// MultiplyEvent,
|
|
148
|
-
// ManagerStateChangeEvent,
|
|
149
|
-
// ScanStatusChangeEvent,
|
|
150
|
-
// ButtonEvent,
|
|
151
|
-
// FlicButton,
|
|
152
|
-
// FlicManagerState,
|
|
153
|
-
// FlicButtonState,
|
|
154
|
-
// FlicTriggerMode,
|
|
155
|
-
// FlicLatencyMode,
|
|
156
|
-
// FlicScannerEvent,
|
|
157
|
-
// TriggerModeType,
|
|
158
|
-
// LatencyModeType,
|
|
159
|
-
// } from './NativeFlic2';
|
|
160
|
-
"use strict";
|
|
161
|
-
//# sourceMappingURL=index.bak.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.bak.tsx"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=index.bak.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.bak.d.ts","sourceRoot":"","sources":["../../../src/index.bak.tsx"],"names":[],"mappings":""}
|
package/src/index.bak.tsx
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
// import type { CodegenTypes } from 'react-native';
|
|
2
|
-
// import type {
|
|
3
|
-
// MultiplyEvent,
|
|
4
|
-
// ManagerStateChangeEvent,
|
|
5
|
-
// ScanStatusChangeEvent,
|
|
6
|
-
// ButtonEvent,
|
|
7
|
-
// FlicButton,
|
|
8
|
-
// TriggerModeType,
|
|
9
|
-
// LatencyModeType,
|
|
10
|
-
// } from './NativeFlic2';
|
|
11
|
-
// import NativeFlic2 from './NativeFlic2';
|
|
12
|
-
|
|
13
|
-
// // MARK: - Example Functions (keeping for compatibility)
|
|
14
|
-
|
|
15
|
-
// export function multiply(a: number, b: number): number {
|
|
16
|
-
// return NativeFlic2.multiply(a, b);
|
|
17
|
-
// }
|
|
18
|
-
|
|
19
|
-
// export const onMultiply =
|
|
20
|
-
// NativeFlic2.onMultiply as CodegenTypes.EventEmitter<MultiplyEvent>;
|
|
21
|
-
|
|
22
|
-
// // MARK: - Manager Functions
|
|
23
|
-
|
|
24
|
-
// export function initialize(
|
|
25
|
-
// background: boolean
|
|
26
|
-
// ): Promise<{ success: boolean; message: string }> {
|
|
27
|
-
// return NativeFlic2.initialize(background);
|
|
28
|
-
// }
|
|
29
|
-
|
|
30
|
-
// export function getButtons(): Promise<FlicButton[]> {
|
|
31
|
-
// return NativeFlic2.getButtons();
|
|
32
|
-
// }
|
|
33
|
-
|
|
34
|
-
// export function scanForButtons(): Promise<{
|
|
35
|
-
// success: boolean;
|
|
36
|
-
// message: string;
|
|
37
|
-
// }> {
|
|
38
|
-
// return NativeFlic2.scanForButtons();
|
|
39
|
-
// }
|
|
40
|
-
|
|
41
|
-
// export function stopScan(): Promise<{ success: boolean; message: string }> {
|
|
42
|
-
// return NativeFlic2.stopScan();
|
|
43
|
-
// }
|
|
44
|
-
|
|
45
|
-
// export function forgetButton(
|
|
46
|
-
// uuid: string
|
|
47
|
-
// ): Promise<{ success: boolean; message: string }> {
|
|
48
|
-
// return NativeFlic2.forgetButton(uuid);
|
|
49
|
-
// }
|
|
50
|
-
|
|
51
|
-
// export function connectAllKnownButtons(): Promise<{
|
|
52
|
-
// success: boolean;
|
|
53
|
-
// message: string;
|
|
54
|
-
// }> {
|
|
55
|
-
// return NativeFlic2.connectAllKnownButtons();
|
|
56
|
-
// }
|
|
57
|
-
|
|
58
|
-
// export function disconnectAllKnownButtons(): Promise<{
|
|
59
|
-
// success: boolean;
|
|
60
|
-
// message: string;
|
|
61
|
-
// }> {
|
|
62
|
-
// return NativeFlic2.disconnectAllKnownButtons();
|
|
63
|
-
// }
|
|
64
|
-
|
|
65
|
-
// export function forgetAllButtons(): Promise<{
|
|
66
|
-
// success: boolean;
|
|
67
|
-
// message: string;
|
|
68
|
-
// }> {
|
|
69
|
-
// return NativeFlic2.forgetAllButtons();
|
|
70
|
-
// }
|
|
71
|
-
|
|
72
|
-
// export function isScanning(): Promise<boolean> {
|
|
73
|
-
// return NativeFlic2.isScanning();
|
|
74
|
-
// }
|
|
75
|
-
|
|
76
|
-
// // MARK: - Button Functions
|
|
77
|
-
|
|
78
|
-
// export function connectButton(
|
|
79
|
-
// uuid: string
|
|
80
|
-
// ): Promise<{ success: boolean; message: string }> {
|
|
81
|
-
// return NativeFlic2.connectButton(uuid);
|
|
82
|
-
// }
|
|
83
|
-
|
|
84
|
-
// export function disconnectButton(
|
|
85
|
-
// uuid: string
|
|
86
|
-
// ): Promise<{ success: boolean; message: string }> {
|
|
87
|
-
// return NativeFlic2.disconnectButton(uuid);
|
|
88
|
-
// }
|
|
89
|
-
|
|
90
|
-
// /**
|
|
91
|
-
// * Sets the trigger mode for a button.
|
|
92
|
-
// *
|
|
93
|
-
// * @platform iOS
|
|
94
|
-
// * @param uuid - Button UUID
|
|
95
|
-
// * @param mode - Trigger mode (0-3)
|
|
96
|
-
// * @returns Promise that resolves on iOS, rejects with NOT_SUPPORTED_ON_ANDROID on Android
|
|
97
|
-
// *
|
|
98
|
-
// * **Note:** This feature is only available on iOS. On Android, this will reject due to
|
|
99
|
-
// * limitations in the Android Flic2 library v1.1.0+.
|
|
100
|
-
// */
|
|
101
|
-
// export function setTriggerMode(
|
|
102
|
-
// uuid: string,
|
|
103
|
-
// mode: TriggerModeType
|
|
104
|
-
// ): Promise<{ success: boolean; message: string }> {
|
|
105
|
-
// return NativeFlic2.setTriggerMode(uuid, mode);
|
|
106
|
-
// }
|
|
107
|
-
|
|
108
|
-
// /**
|
|
109
|
-
// * Sets the latency mode for a button.
|
|
110
|
-
// *
|
|
111
|
-
// * @platform iOS
|
|
112
|
-
// * @param uuid - Button UUID
|
|
113
|
-
// * @param mode - Latency mode (0-1)
|
|
114
|
-
// * @returns Promise that resolves on iOS, rejects with NOT_SUPPORTED_ON_ANDROID on Android
|
|
115
|
-
// *
|
|
116
|
-
// * **Note:** This feature is only available on iOS. On Android, this will reject due to
|
|
117
|
-
// * limitations in the Android Flic2 library v1.1.0+.
|
|
118
|
-
// */
|
|
119
|
-
// export function setLatencyMode(
|
|
120
|
-
// uuid: string,
|
|
121
|
-
// mode: LatencyModeType
|
|
122
|
-
// ): Promise<{ success: boolean; message: string }> {
|
|
123
|
-
// return NativeFlic2.setLatencyMode(uuid, mode);
|
|
124
|
-
// }
|
|
125
|
-
|
|
126
|
-
// export function setNickname(
|
|
127
|
-
// uuid: string,
|
|
128
|
-
// nickname: string
|
|
129
|
-
// ): Promise<{ success: boolean; message: string }> {
|
|
130
|
-
// return NativeFlic2.setNickname(uuid, nickname);
|
|
131
|
-
// }
|
|
132
|
-
|
|
133
|
-
// // MARK: - Event Emitters
|
|
134
|
-
|
|
135
|
-
// export const onManagerStateChange =
|
|
136
|
-
// NativeFlic2.onManagerStateChange as CodegenTypes.EventEmitter<ManagerStateChangeEvent>;
|
|
137
|
-
|
|
138
|
-
// export const onScanStatusChange =
|
|
139
|
-
// NativeFlic2.onScanStatusChange as CodegenTypes.EventEmitter<ScanStatusChangeEvent>;
|
|
140
|
-
|
|
141
|
-
// export const onButtonEvent =
|
|
142
|
-
// NativeFlic2.onButtonEvent as CodegenTypes.EventEmitter<ButtonEvent>;
|
|
143
|
-
|
|
144
|
-
// // MARK: - Re-export Types
|
|
145
|
-
|
|
146
|
-
// export type {
|
|
147
|
-
// MultiplyEvent,
|
|
148
|
-
// ManagerStateChangeEvent,
|
|
149
|
-
// ScanStatusChangeEvent,
|
|
150
|
-
// ButtonEvent,
|
|
151
|
-
// FlicButton,
|
|
152
|
-
// FlicManagerState,
|
|
153
|
-
// FlicButtonState,
|
|
154
|
-
// FlicTriggerMode,
|
|
155
|
-
// FlicLatencyMode,
|
|
156
|
-
// FlicScannerEvent,
|
|
157
|
-
// TriggerModeType,
|
|
158
|
-
// LatencyModeType,
|
|
159
|
-
// } from './NativeFlic2';
|