react-native-bluebreeze 0.0.1 → 0.0.3
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/build.gradle +8 -17
- package/android/generated/java/com/bluebreeze/NativeBlueBreezeSpec.java +17 -9
- package/android/generated/jni/RNBlueBreezeSpec-generated.cpp +21 -14
- package/android/generated/jni/react/renderer/components/RNBlueBreezeSpec/RNBlueBreezeSpecJSI-generated.cpp +19 -12
- package/android/generated/jni/react/renderer/components/RNBlueBreezeSpec/RNBlueBreezeSpecJSI.h +279 -53
- package/android/gradle.properties +5 -5
- package/android/src/main/java/com/bluebreeze/BlueBreezeModule.kt +632 -16
- package/android/src/main/java/com/bluebreeze/BlueBreezePackage.kt +0 -1
- package/ios/BlueBreezeImpl.swift +92 -84
- package/ios/Bluebreeze.mm +52 -25
- package/ios/generated/RNBlueBreezeSpec/RNBlueBreezeSpec-generated.mm +30 -18
- package/ios/generated/RNBlueBreezeSpec/RNBlueBreezeSpec.h +12 -7
- package/ios/generated/RNBlueBreezeSpecJSI-generated.cpp +19 -12
- package/ios/generated/RNBlueBreezeSpecJSI.h +279 -53
- package/lib/commonjs/NativeBlueBreeze.js +11 -0
- package/lib/commonjs/NativeBlueBreeze.js.map +1 -0
- package/lib/commonjs/implementation/bluebreeze_characteristic.js +29 -0
- package/lib/commonjs/implementation/bluebreeze_characteristic.js.map +1 -0
- package/lib/commonjs/implementation/bluebreeze_device.js +31 -0
- package/lib/commonjs/implementation/bluebreeze_device.js.map +1 -0
- package/lib/commonjs/implementation/bluebreeze_scan_result.js +20 -0
- package/lib/commonjs/implementation/bluebreeze_scan_result.js.map +1 -0
- package/lib/commonjs/implementation/bluebreeze_service.js +15 -0
- package/lib/commonjs/implementation/bluebreeze_service.js.map +1 -0
- package/lib/commonjs/implementation/emitters.js +32 -0
- package/lib/commonjs/implementation/emitters.js.map +1 -0
- package/lib/commonjs/index.js +171 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/NativeBlueBreeze.js +10 -0
- package/lib/module/NativeBlueBreeze.js.map +1 -0
- package/lib/module/implementation/bluebreeze_characteristic.js +23 -0
- package/lib/module/implementation/bluebreeze_characteristic.js.map +1 -0
- package/lib/module/implementation/bluebreeze_device.js +25 -0
- package/lib/module/implementation/bluebreeze_device.js.map +1 -0
- package/lib/module/implementation/bluebreeze_scan_result.js +15 -0
- package/lib/module/implementation/bluebreeze_scan_result.js.map +1 -0
- package/lib/module/implementation/bluebreeze_service.js +10 -0
- package/lib/module/implementation/bluebreeze_service.js.map +1 -0
- package/lib/module/implementation/emitters.js +25 -0
- package/lib/module/implementation/emitters.js.map +1 -0
- package/lib/module/index.js +168 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/NativeBlueBreeze.d.ts +86 -0
- package/lib/typescript/commonjs/src/NativeBlueBreeze.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/implementation/bluebreeze_characteristic.d.ts +14 -0
- package/lib/typescript/commonjs/src/implementation/bluebreeze_characteristic.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/implementation/bluebreeze_device.d.ts +15 -0
- package/lib/typescript/commonjs/src/implementation/bluebreeze_device.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/implementation/bluebreeze_scan_result.d.ts +13 -0
- package/lib/typescript/commonjs/src/implementation/bluebreeze_scan_result.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/implementation/bluebreeze_service.d.ts +8 -0
- package/lib/typescript/commonjs/src/implementation/bluebreeze_service.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/implementation/emitters.d.ts +12 -0
- package/lib/typescript/commonjs/src/implementation/emitters.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +30 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/NativeBlueBreeze.d.ts +86 -0
- package/lib/typescript/module/src/NativeBlueBreeze.d.ts.map +1 -0
- package/lib/typescript/module/src/implementation/bluebreeze_characteristic.d.ts +14 -0
- package/lib/typescript/module/src/implementation/bluebreeze_characteristic.d.ts.map +1 -0
- package/lib/typescript/module/src/implementation/bluebreeze_device.d.ts +15 -0
- package/lib/typescript/module/src/implementation/bluebreeze_device.d.ts.map +1 -0
- package/lib/typescript/module/src/implementation/bluebreeze_scan_result.d.ts +13 -0
- package/lib/typescript/module/src/implementation/bluebreeze_scan_result.d.ts.map +1 -0
- package/lib/typescript/module/src/implementation/bluebreeze_service.d.ts +8 -0
- package/lib/typescript/module/src/implementation/bluebreeze_service.d.ts.map +1 -0
- package/lib/typescript/module/src/implementation/emitters.d.ts +12 -0
- package/lib/typescript/module/src/implementation/emitters.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +30 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/package.json +25 -21
- package/react-native-bluebreeze.podspec +1 -1
- package/src/NativeBlueBreeze.ts +83 -104
- package/src/implementation/bluebreeze_characteristic.ts +40 -0
- package/src/implementation/bluebreeze_device.ts +40 -0
- package/src/implementation/bluebreeze_scan_result.ts +32 -0
- package/src/implementation/bluebreeze_service.ts +17 -0
- package/src/implementation/emitters.ts +28 -0
- package/src/index.tsx +289 -81
package/android/generated/jni/react/renderer/components/RNBlueBreezeSpec/RNBlueBreezeSpecJSI.h
CHANGED
|
@@ -140,19 +140,126 @@ struct NativeBlueBreezeBBDeviceCharacteristicNotifyEnabledEventBridging {
|
|
|
140
140
|
|
|
141
141
|
|
|
142
142
|
|
|
143
|
-
#pragma mark -
|
|
143
|
+
#pragma mark - NativeBlueBreezeSpecDevice
|
|
144
144
|
|
|
145
145
|
template <typename P0, typename P1>
|
|
146
|
-
struct
|
|
146
|
+
struct NativeBlueBreezeSpecDevice {
|
|
147
|
+
P0 id;
|
|
148
|
+
P1 name;
|
|
149
|
+
bool operator==(const NativeBlueBreezeSpecDevice &other) const {
|
|
150
|
+
return id == other.id && name == other.name;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
template <typename T>
|
|
155
|
+
struct NativeBlueBreezeSpecDeviceBridging {
|
|
156
|
+
static T types;
|
|
157
|
+
|
|
158
|
+
static T fromJs(
|
|
159
|
+
jsi::Runtime &rt,
|
|
160
|
+
const jsi::Object &value,
|
|
161
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
162
|
+
T result{
|
|
163
|
+
bridging::fromJs<decltype(types.id)>(rt, value.getProperty(rt, "id"), jsInvoker),
|
|
164
|
+
bridging::fromJs<decltype(types.name)>(rt, value.getProperty(rt, "name"), jsInvoker)};
|
|
165
|
+
return result;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
#ifdef DEBUG
|
|
169
|
+
static jsi::String idToJs(jsi::Runtime &rt, decltype(types.id) value) {
|
|
170
|
+
return bridging::toJs(rt, value);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
static jsi::String nameToJs(jsi::Runtime &rt, decltype(types.name) value) {
|
|
174
|
+
return bridging::toJs(rt, value);
|
|
175
|
+
}
|
|
176
|
+
#endif
|
|
177
|
+
|
|
178
|
+
static jsi::Object toJs(
|
|
179
|
+
jsi::Runtime &rt,
|
|
180
|
+
const T &value,
|
|
181
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
182
|
+
auto result = facebook::jsi::Object(rt);
|
|
183
|
+
result.setProperty(rt, "id", bridging::toJs(rt, value.id, jsInvoker));
|
|
184
|
+
if (value.name) {
|
|
185
|
+
result.setProperty(rt, "name", bridging::toJs(rt, value.name.value(), jsInvoker));
|
|
186
|
+
}
|
|
187
|
+
return result;
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
#pragma mark - NativeBlueBreezeSpecDeviceCharacteristic
|
|
194
|
+
|
|
195
|
+
template <typename P0, typename P1, typename P2>
|
|
196
|
+
struct NativeBlueBreezeSpecDeviceCharacteristic {
|
|
197
|
+
P0 id;
|
|
198
|
+
P1 name;
|
|
199
|
+
P2 properties;
|
|
200
|
+
bool operator==(const NativeBlueBreezeSpecDeviceCharacteristic &other) const {
|
|
201
|
+
return id == other.id && name == other.name && properties == other.properties;
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
template <typename T>
|
|
206
|
+
struct NativeBlueBreezeSpecDeviceCharacteristicBridging {
|
|
207
|
+
static T types;
|
|
208
|
+
|
|
209
|
+
static T fromJs(
|
|
210
|
+
jsi::Runtime &rt,
|
|
211
|
+
const jsi::Object &value,
|
|
212
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
213
|
+
T result{
|
|
214
|
+
bridging::fromJs<decltype(types.id)>(rt, value.getProperty(rt, "id"), jsInvoker),
|
|
215
|
+
bridging::fromJs<decltype(types.name)>(rt, value.getProperty(rt, "name"), jsInvoker),
|
|
216
|
+
bridging::fromJs<decltype(types.properties)>(rt, value.getProperty(rt, "properties"), jsInvoker)};
|
|
217
|
+
return result;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
#ifdef DEBUG
|
|
221
|
+
static jsi::String idToJs(jsi::Runtime &rt, decltype(types.id) value) {
|
|
222
|
+
return bridging::toJs(rt, value);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
static jsi::String nameToJs(jsi::Runtime &rt, decltype(types.name) value) {
|
|
226
|
+
return bridging::toJs(rt, value);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
static jsi::Array propertiesToJs(jsi::Runtime &rt, decltype(types.properties) value) {
|
|
230
|
+
return bridging::toJs(rt, value);
|
|
231
|
+
}
|
|
232
|
+
#endif
|
|
233
|
+
|
|
234
|
+
static jsi::Object toJs(
|
|
235
|
+
jsi::Runtime &rt,
|
|
236
|
+
const T &value,
|
|
237
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
238
|
+
auto result = facebook::jsi::Object(rt);
|
|
239
|
+
result.setProperty(rt, "id", bridging::toJs(rt, value.id, jsInvoker));
|
|
240
|
+
if (value.name) {
|
|
241
|
+
result.setProperty(rt, "name", bridging::toJs(rt, value.name.value(), jsInvoker));
|
|
242
|
+
}
|
|
243
|
+
result.setProperty(rt, "properties", bridging::toJs(rt, value.properties, jsInvoker));
|
|
244
|
+
return result;
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
#pragma mark - NativeBlueBreezeSpecDeviceConnectionStatus
|
|
251
|
+
|
|
252
|
+
template <typename P0, typename P1>
|
|
253
|
+
struct NativeBlueBreezeSpecDeviceConnectionStatus {
|
|
147
254
|
P0 id;
|
|
148
255
|
P1 value;
|
|
149
|
-
bool operator==(const
|
|
256
|
+
bool operator==(const NativeBlueBreezeSpecDeviceConnectionStatus &other) const {
|
|
150
257
|
return id == other.id && value == other.value;
|
|
151
258
|
}
|
|
152
259
|
};
|
|
153
260
|
|
|
154
261
|
template <typename T>
|
|
155
|
-
struct
|
|
262
|
+
struct NativeBlueBreezeSpecDeviceConnectionStatusBridging {
|
|
156
263
|
static T types;
|
|
157
264
|
|
|
158
265
|
static T fromJs(
|
|
@@ -188,19 +295,19 @@ struct NativeBlueBreezeBBDeviceConnectionStatusEventBridging {
|
|
|
188
295
|
|
|
189
296
|
|
|
190
297
|
|
|
191
|
-
#pragma mark -
|
|
298
|
+
#pragma mark - NativeBlueBreezeSpecDeviceMTU
|
|
192
299
|
|
|
193
300
|
template <typename P0, typename P1>
|
|
194
|
-
struct
|
|
301
|
+
struct NativeBlueBreezeSpecDeviceMTU {
|
|
195
302
|
P0 id;
|
|
196
303
|
P1 value;
|
|
197
|
-
bool operator==(const
|
|
304
|
+
bool operator==(const NativeBlueBreezeSpecDeviceMTU &other) const {
|
|
198
305
|
return id == other.id && value == other.value;
|
|
199
306
|
}
|
|
200
307
|
};
|
|
201
308
|
|
|
202
309
|
template <typename T>
|
|
203
|
-
struct
|
|
310
|
+
struct NativeBlueBreezeSpecDeviceMTUBridging {
|
|
204
311
|
static T types;
|
|
205
312
|
|
|
206
313
|
static T fromJs(
|
|
@@ -236,19 +343,76 @@ struct NativeBlueBreezeBBDeviceMTUEventBridging {
|
|
|
236
343
|
|
|
237
344
|
|
|
238
345
|
|
|
239
|
-
#pragma mark -
|
|
346
|
+
#pragma mark - NativeBlueBreezeSpecDeviceService
|
|
347
|
+
|
|
348
|
+
template <typename P0, typename P1, typename P2>
|
|
349
|
+
struct NativeBlueBreezeSpecDeviceService {
|
|
350
|
+
P0 id;
|
|
351
|
+
P1 name;
|
|
352
|
+
P2 characteristics;
|
|
353
|
+
bool operator==(const NativeBlueBreezeSpecDeviceService &other) const {
|
|
354
|
+
return id == other.id && name == other.name && characteristics == other.characteristics;
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
template <typename T>
|
|
359
|
+
struct NativeBlueBreezeSpecDeviceServiceBridging {
|
|
360
|
+
static T types;
|
|
361
|
+
|
|
362
|
+
static T fromJs(
|
|
363
|
+
jsi::Runtime &rt,
|
|
364
|
+
const jsi::Object &value,
|
|
365
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
366
|
+
T result{
|
|
367
|
+
bridging::fromJs<decltype(types.id)>(rt, value.getProperty(rt, "id"), jsInvoker),
|
|
368
|
+
bridging::fromJs<decltype(types.name)>(rt, value.getProperty(rt, "name"), jsInvoker),
|
|
369
|
+
bridging::fromJs<decltype(types.characteristics)>(rt, value.getProperty(rt, "characteristics"), jsInvoker)};
|
|
370
|
+
return result;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
#ifdef DEBUG
|
|
374
|
+
static jsi::String idToJs(jsi::Runtime &rt, decltype(types.id) value) {
|
|
375
|
+
return bridging::toJs(rt, value);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
static jsi::String nameToJs(jsi::Runtime &rt, decltype(types.name) value) {
|
|
379
|
+
return bridging::toJs(rt, value);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
static jsi::Array characteristicsToJs(jsi::Runtime &rt, decltype(types.characteristics) value) {
|
|
383
|
+
return bridging::toJs(rt, value);
|
|
384
|
+
}
|
|
385
|
+
#endif
|
|
386
|
+
|
|
387
|
+
static jsi::Object toJs(
|
|
388
|
+
jsi::Runtime &rt,
|
|
389
|
+
const T &value,
|
|
390
|
+
const std::shared_ptr<CallInvoker> &jsInvoker) {
|
|
391
|
+
auto result = facebook::jsi::Object(rt);
|
|
392
|
+
result.setProperty(rt, "id", bridging::toJs(rt, value.id, jsInvoker));
|
|
393
|
+
if (value.name) {
|
|
394
|
+
result.setProperty(rt, "name", bridging::toJs(rt, value.name.value(), jsInvoker));
|
|
395
|
+
}
|
|
396
|
+
result.setProperty(rt, "characteristics", bridging::toJs(rt, value.characteristics, jsInvoker));
|
|
397
|
+
return result;
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
#pragma mark - NativeBlueBreezeSpecDeviceServices
|
|
240
404
|
|
|
241
405
|
template <typename P0, typename P1>
|
|
242
|
-
struct
|
|
406
|
+
struct NativeBlueBreezeSpecDeviceServices {
|
|
243
407
|
P0 id;
|
|
244
408
|
P1 value;
|
|
245
|
-
bool operator==(const
|
|
409
|
+
bool operator==(const NativeBlueBreezeSpecDeviceServices &other) const {
|
|
246
410
|
return id == other.id && value == other.value;
|
|
247
411
|
}
|
|
248
412
|
};
|
|
249
413
|
|
|
250
414
|
template <typename T>
|
|
251
|
-
struct
|
|
415
|
+
struct NativeBlueBreezeSpecDeviceServicesBridging {
|
|
252
416
|
static T types;
|
|
253
417
|
|
|
254
418
|
static T fromJs(
|
|
@@ -284,20 +448,25 @@ struct NativeBlueBreezeBBDeviceServicesEventBridging {
|
|
|
284
448
|
|
|
285
449
|
|
|
286
450
|
|
|
287
|
-
#pragma mark -
|
|
451
|
+
#pragma mark - NativeBlueBreezeSpecScanResult
|
|
288
452
|
|
|
289
|
-
template <typename P0, typename P1, typename P2>
|
|
290
|
-
struct
|
|
453
|
+
template <typename P0, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7>
|
|
454
|
+
struct NativeBlueBreezeSpecScanResult {
|
|
291
455
|
P0 id;
|
|
292
456
|
P1 name;
|
|
293
|
-
P2
|
|
294
|
-
|
|
295
|
-
|
|
457
|
+
P2 rssi;
|
|
458
|
+
P3 connectable;
|
|
459
|
+
P4 advertisedServices;
|
|
460
|
+
P5 manufacturerId;
|
|
461
|
+
P6 manufacturerName;
|
|
462
|
+
P7 manufacturerData;
|
|
463
|
+
bool operator==(const NativeBlueBreezeSpecScanResult &other) const {
|
|
464
|
+
return id == other.id && name == other.name && rssi == other.rssi && connectable == other.connectable && advertisedServices == other.advertisedServices && manufacturerId == other.manufacturerId && manufacturerName == other.manufacturerName && manufacturerData == other.manufacturerData;
|
|
296
465
|
}
|
|
297
466
|
};
|
|
298
467
|
|
|
299
468
|
template <typename T>
|
|
300
|
-
struct
|
|
469
|
+
struct NativeBlueBreezeSpecScanResultBridging {
|
|
301
470
|
static T types;
|
|
302
471
|
|
|
303
472
|
static T fromJs(
|
|
@@ -307,7 +476,12 @@ struct NativeBlueBreezeBBServiceBridging {
|
|
|
307
476
|
T result{
|
|
308
477
|
bridging::fromJs<decltype(types.id)>(rt, value.getProperty(rt, "id"), jsInvoker),
|
|
309
478
|
bridging::fromJs<decltype(types.name)>(rt, value.getProperty(rt, "name"), jsInvoker),
|
|
310
|
-
bridging::fromJs<decltype(types.
|
|
479
|
+
bridging::fromJs<decltype(types.rssi)>(rt, value.getProperty(rt, "rssi"), jsInvoker),
|
|
480
|
+
bridging::fromJs<decltype(types.connectable)>(rt, value.getProperty(rt, "connectable"), jsInvoker),
|
|
481
|
+
bridging::fromJs<decltype(types.advertisedServices)>(rt, value.getProperty(rt, "advertisedServices"), jsInvoker),
|
|
482
|
+
bridging::fromJs<decltype(types.manufacturerId)>(rt, value.getProperty(rt, "manufacturerId"), jsInvoker),
|
|
483
|
+
bridging::fromJs<decltype(types.manufacturerName)>(rt, value.getProperty(rt, "manufacturerName"), jsInvoker),
|
|
484
|
+
bridging::fromJs<decltype(types.manufacturerData)>(rt, value.getProperty(rt, "manufacturerData"), jsInvoker)};
|
|
311
485
|
return result;
|
|
312
486
|
}
|
|
313
487
|
|
|
@@ -320,7 +494,27 @@ struct NativeBlueBreezeBBServiceBridging {
|
|
|
320
494
|
return bridging::toJs(rt, value);
|
|
321
495
|
}
|
|
322
496
|
|
|
323
|
-
static
|
|
497
|
+
static double rssiToJs(jsi::Runtime &rt, decltype(types.rssi) value) {
|
|
498
|
+
return bridging::toJs(rt, value);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
static bool connectableToJs(jsi::Runtime &rt, decltype(types.connectable) value) {
|
|
502
|
+
return bridging::toJs(rt, value);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
static jsi::Array advertisedServicesToJs(jsi::Runtime &rt, decltype(types.advertisedServices) value) {
|
|
506
|
+
return bridging::toJs(rt, value);
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
static double manufacturerIdToJs(jsi::Runtime &rt, decltype(types.manufacturerId) value) {
|
|
510
|
+
return bridging::toJs(rt, value);
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
static jsi::String manufacturerNameToJs(jsi::Runtime &rt, decltype(types.manufacturerName) value) {
|
|
514
|
+
return bridging::toJs(rt, value);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
static jsi::Array manufacturerDataToJs(jsi::Runtime &rt, decltype(types.manufacturerData) value) {
|
|
324
518
|
return bridging::toJs(rt, value);
|
|
325
519
|
}
|
|
326
520
|
#endif
|
|
@@ -334,7 +528,18 @@ struct NativeBlueBreezeBBServiceBridging {
|
|
|
334
528
|
if (value.name) {
|
|
335
529
|
result.setProperty(rt, "name", bridging::toJs(rt, value.name.value(), jsInvoker));
|
|
336
530
|
}
|
|
337
|
-
result.setProperty(rt, "
|
|
531
|
+
result.setProperty(rt, "rssi", bridging::toJs(rt, value.rssi, jsInvoker));
|
|
532
|
+
result.setProperty(rt, "connectable", bridging::toJs(rt, value.connectable, jsInvoker));
|
|
533
|
+
result.setProperty(rt, "advertisedServices", bridging::toJs(rt, value.advertisedServices, jsInvoker));
|
|
534
|
+
if (value.manufacturerId) {
|
|
535
|
+
result.setProperty(rt, "manufacturerId", bridging::toJs(rt, value.manufacturerId.value(), jsInvoker));
|
|
536
|
+
}
|
|
537
|
+
if (value.manufacturerName) {
|
|
538
|
+
result.setProperty(rt, "manufacturerName", bridging::toJs(rt, value.manufacturerName.value(), jsInvoker));
|
|
539
|
+
}
|
|
540
|
+
if (value.manufacturerData) {
|
|
541
|
+
result.setProperty(rt, "manufacturerData", bridging::toJs(rt, value.manufacturerData.value(), jsInvoker));
|
|
542
|
+
}
|
|
338
543
|
return result;
|
|
339
544
|
}
|
|
340
545
|
};
|
|
@@ -344,12 +549,13 @@ protected:
|
|
|
344
549
|
NativeBlueBreezeCxxSpecJSI(std::shared_ptr<CallInvoker> jsInvoker);
|
|
345
550
|
|
|
346
551
|
public:
|
|
552
|
+
virtual jsi::String state(jsi::Runtime &rt) = 0;
|
|
347
553
|
virtual jsi::String authorizationStatus(jsi::Runtime &rt) = 0;
|
|
348
554
|
virtual void authorizationRequest(jsi::Runtime &rt) = 0;
|
|
349
|
-
virtual
|
|
350
|
-
virtual bool
|
|
351
|
-
virtual void
|
|
352
|
-
virtual void
|
|
555
|
+
virtual void authorizationOpenSettings(jsi::Runtime &rt) = 0;
|
|
556
|
+
virtual bool scanEnabled(jsi::Runtime &rt) = 0;
|
|
557
|
+
virtual void scanStart(jsi::Runtime &rt) = 0;
|
|
558
|
+
virtual void scanStop(jsi::Runtime &rt) = 0;
|
|
353
559
|
virtual jsi::Array devices(jsi::Runtime &rt) = 0;
|
|
354
560
|
virtual jsi::Array deviceServices(jsi::Runtime &rt, jsi::String id) = 0;
|
|
355
561
|
virtual jsi::String deviceConnectionStatus(jsi::Runtime &rt, jsi::String id) = 0;
|
|
@@ -370,8 +576,12 @@ public:
|
|
|
370
576
|
template <typename T>
|
|
371
577
|
class JSI_EXPORT NativeBlueBreezeCxxSpec : public TurboModule {
|
|
372
578
|
public:
|
|
373
|
-
jsi::Value
|
|
374
|
-
return delegate_.
|
|
579
|
+
jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
580
|
+
return delegate_.create(rt, propName);
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
|
|
584
|
+
return delegate_.getPropertyNames(runtime);
|
|
375
585
|
}
|
|
376
586
|
|
|
377
587
|
static constexpr std::string_view kModuleName = "BlueBreeze";
|
|
@@ -381,6 +591,13 @@ protected:
|
|
|
381
591
|
: TurboModule(std::string{NativeBlueBreezeCxxSpec::kModuleName}, jsInvoker),
|
|
382
592
|
delegate_(reinterpret_cast<T*>(this), jsInvoker) {}
|
|
383
593
|
|
|
594
|
+
template <typename StateEmitterType> void emitStateEmitter(StateEmitterType value) {
|
|
595
|
+
static_assert(bridging::supportsFromJs<StateEmitterType, jsi::String>, "value cannnot be converted to jsi::String");
|
|
596
|
+
static_cast<AsyncEventEmitter<jsi::Value>&>(*delegate_.eventEmitterMap_["stateEmitter"]).emit([jsInvoker = jsInvoker_, eventValue = value](jsi::Runtime& rt) -> jsi::Value {
|
|
597
|
+
return bridging::toJs(rt, eventValue, jsInvoker);
|
|
598
|
+
});
|
|
599
|
+
}
|
|
600
|
+
|
|
384
601
|
template <typename AuthorizationStatusEmitterType> void emitAuthorizationStatusEmitter(AuthorizationStatusEmitterType value) {
|
|
385
602
|
static_assert(bridging::supportsFromJs<AuthorizationStatusEmitterType, jsi::String>, "value cannnot be converted to jsi::String");
|
|
386
603
|
static_cast<AsyncEventEmitter<jsi::Value>&>(*delegate_.eventEmitterMap_["authorizationStatusEmitter"]).emit([jsInvoker = jsInvoker_, eventValue = value](jsi::Runtime& rt) -> jsi::Value {
|
|
@@ -388,16 +605,16 @@ protected:
|
|
|
388
605
|
});
|
|
389
606
|
}
|
|
390
607
|
|
|
391
|
-
template <typename
|
|
392
|
-
static_assert(bridging::supportsFromJs<
|
|
393
|
-
static_cast<AsyncEventEmitter<jsi::Value>&>(*delegate_.eventEmitterMap_["
|
|
608
|
+
template <typename ScanEnabledEmitterType> void emitScanEnabledEmitter(ScanEnabledEmitterType value) {
|
|
609
|
+
static_assert(bridging::supportsFromJs<ScanEnabledEmitterType, bool>, "value cannnot be converted to bool");
|
|
610
|
+
static_cast<AsyncEventEmitter<jsi::Value>&>(*delegate_.eventEmitterMap_["scanEnabledEmitter"]).emit([jsInvoker = jsInvoker_, eventValue = value](jsi::Runtime& rt) -> jsi::Value {
|
|
394
611
|
return bridging::toJs(rt, eventValue, jsInvoker);
|
|
395
612
|
});
|
|
396
613
|
}
|
|
397
614
|
|
|
398
|
-
template <typename
|
|
399
|
-
static_assert(bridging::supportsFromJs<
|
|
400
|
-
static_cast<AsyncEventEmitter<jsi::Value>&>(*delegate_.eventEmitterMap_["
|
|
615
|
+
template <typename ScanResultEmitterType> void emitScanResultEmitter(ScanResultEmitterType value) {
|
|
616
|
+
static_assert(bridging::supportsFromJs<ScanResultEmitterType, jsi::Object>, "value cannnot be converted to jsi::Object");
|
|
617
|
+
static_cast<AsyncEventEmitter<jsi::Value>&>(*delegate_.eventEmitterMap_["scanResultEmitter"]).emit([jsInvoker = jsInvoker_, eventValue = value](jsi::Runtime& rt) -> jsi::Value {
|
|
401
618
|
return bridging::toJs(rt, eventValue, jsInvoker);
|
|
402
619
|
});
|
|
403
620
|
}
|
|
@@ -449,9 +666,10 @@ private:
|
|
|
449
666
|
public:
|
|
450
667
|
Delegate(T *instance, std::shared_ptr<CallInvoker> jsInvoker) :
|
|
451
668
|
NativeBlueBreezeCxxSpecJSI(std::move(jsInvoker)), instance_(instance) {
|
|
452
|
-
eventEmitterMap_["authorizationStatusEmitter"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
|
|
453
669
|
eventEmitterMap_["stateEmitter"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
|
|
454
|
-
eventEmitterMap_["
|
|
670
|
+
eventEmitterMap_["authorizationStatusEmitter"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
|
|
671
|
+
eventEmitterMap_["scanEnabledEmitter"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
|
|
672
|
+
eventEmitterMap_["scanResultEmitter"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
|
|
455
673
|
eventEmitterMap_["devicesEmitter"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
|
|
456
674
|
eventEmitterMap_["deviceServicesEmitter"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
|
|
457
675
|
eventEmitterMap_["deviceConnectionStatusEmitter"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
|
|
@@ -460,6 +678,14 @@ private:
|
|
|
460
678
|
eventEmitterMap_["deviceCharacteristicNotifyEnabledEmitter"] = std::make_shared<AsyncEventEmitter<jsi::Value>>();
|
|
461
679
|
}
|
|
462
680
|
|
|
681
|
+
jsi::String state(jsi::Runtime &rt) override {
|
|
682
|
+
static_assert(
|
|
683
|
+
bridging::getParameterCount(&T::state) == 1,
|
|
684
|
+
"Expected state(...) to have 1 parameters");
|
|
685
|
+
|
|
686
|
+
return bridging::callFromJs<jsi::String>(
|
|
687
|
+
rt, &T::state, jsInvoker_, instance_);
|
|
688
|
+
}
|
|
463
689
|
jsi::String authorizationStatus(jsi::Runtime &rt) override {
|
|
464
690
|
static_assert(
|
|
465
691
|
bridging::getParameterCount(&T::authorizationStatus) == 1,
|
|
@@ -476,37 +702,37 @@ private:
|
|
|
476
702
|
return bridging::callFromJs<void>(
|
|
477
703
|
rt, &T::authorizationRequest, jsInvoker_, instance_);
|
|
478
704
|
}
|
|
479
|
-
|
|
705
|
+
void authorizationOpenSettings(jsi::Runtime &rt) override {
|
|
480
706
|
static_assert(
|
|
481
|
-
bridging::getParameterCount(&T::
|
|
482
|
-
"Expected
|
|
707
|
+
bridging::getParameterCount(&T::authorizationOpenSettings) == 1,
|
|
708
|
+
"Expected authorizationOpenSettings(...) to have 1 parameters");
|
|
483
709
|
|
|
484
|
-
return bridging::callFromJs<
|
|
485
|
-
rt, &T::
|
|
710
|
+
return bridging::callFromJs<void>(
|
|
711
|
+
rt, &T::authorizationOpenSettings, jsInvoker_, instance_);
|
|
486
712
|
}
|
|
487
|
-
bool
|
|
713
|
+
bool scanEnabled(jsi::Runtime &rt) override {
|
|
488
714
|
static_assert(
|
|
489
|
-
bridging::getParameterCount(&T::
|
|
490
|
-
"Expected
|
|
715
|
+
bridging::getParameterCount(&T::scanEnabled) == 1,
|
|
716
|
+
"Expected scanEnabled(...) to have 1 parameters");
|
|
491
717
|
|
|
492
718
|
return bridging::callFromJs<bool>(
|
|
493
|
-
rt, &T::
|
|
719
|
+
rt, &T::scanEnabled, jsInvoker_, instance_);
|
|
494
720
|
}
|
|
495
|
-
void
|
|
721
|
+
void scanStart(jsi::Runtime &rt) override {
|
|
496
722
|
static_assert(
|
|
497
|
-
bridging::getParameterCount(&T::
|
|
498
|
-
"Expected
|
|
723
|
+
bridging::getParameterCount(&T::scanStart) == 1,
|
|
724
|
+
"Expected scanStart(...) to have 1 parameters");
|
|
499
725
|
|
|
500
726
|
return bridging::callFromJs<void>(
|
|
501
|
-
rt, &T::
|
|
727
|
+
rt, &T::scanStart, jsInvoker_, instance_);
|
|
502
728
|
}
|
|
503
|
-
void
|
|
729
|
+
void scanStop(jsi::Runtime &rt) override {
|
|
504
730
|
static_assert(
|
|
505
|
-
bridging::getParameterCount(&T::
|
|
506
|
-
"Expected
|
|
731
|
+
bridging::getParameterCount(&T::scanStop) == 1,
|
|
732
|
+
"Expected scanStop(...) to have 1 parameters");
|
|
507
733
|
|
|
508
734
|
return bridging::callFromJs<void>(
|
|
509
|
-
rt, &T::
|
|
735
|
+
rt, &T::scanStop, jsInvoker_, instance_);
|
|
510
736
|
}
|
|
511
737
|
jsi::Array devices(jsi::Runtime &rt) override {
|
|
512
738
|
static_assert(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
BlueBreeze_kotlinVersion=
|
|
2
|
-
BlueBreeze_minSdkVersion=
|
|
3
|
-
BlueBreeze_targetSdkVersion=
|
|
4
|
-
BlueBreeze_compileSdkVersion=
|
|
5
|
-
|
|
1
|
+
BlueBreeze_kotlinVersion=2.0.21
|
|
2
|
+
BlueBreeze_minSdkVersion=24
|
|
3
|
+
BlueBreeze_targetSdkVersion=34
|
|
4
|
+
BlueBreeze_compileSdkVersion=35
|
|
5
|
+
BlueBreeze_ndkVersion=27.1.12297006
|