@neurodevs/ndx-native 7.0.1 → 7.1.0
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/build/__tests__/impl/LibndxAdapter.test.d.ts +22 -13
- package/build/__tests__/impl/LibndxAdapter.test.js +110 -49
- package/build/__tests__/impl/LibndxAdapter.test.js.map +1 -1
- package/build/impl/LibndxAdapter.d.ts +22 -10
- package/build/impl/LibndxAdapter.js +31 -9
- package/build/impl/LibndxAdapter.js.map +1 -1
- package/build/testDoubles/Libndx/FakeLibndx.d.ts +11 -7
- package/build/testDoubles/Libndx/FakeLibndx.js +24 -12
- package/build/testDoubles/Libndx/FakeLibndx.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/impl/LibndxAdapter.test.ts +138 -49
- package/src/impl/LibndxAdapter.ts +83 -19
- package/src/testDoubles/Libndx/FakeLibndx.ts +29 -13
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AddBleCharCallbacksOptions,
|
|
2
3
|
BleBackendOptions,
|
|
3
4
|
WriteBleCharacteristicOptions,
|
|
4
|
-
|
|
5
|
+
UsbBackendOptions,
|
|
6
|
+
WriteUsbBackendOptions,
|
|
5
7
|
Libndx,
|
|
6
8
|
LibndxAdapterOptions,
|
|
7
9
|
StartBleBackendOptions,
|
|
@@ -15,13 +17,15 @@ export default class FakeLibndx implements Libndx {
|
|
|
15
17
|
public static callsToDiscoverBleUuid: DiscoverBleUuidOptions[] = []
|
|
16
18
|
public static callsToCreateBleBackend: BleBackendOptions[] = []
|
|
17
19
|
public static callsToStartBleBackend: StartBleBackendOptions[] = []
|
|
20
|
+
public static callsToAddBleCharCallbacks: AddBleCharCallbacksOptions[] = []
|
|
18
21
|
public static callsToWriteBleCharacteristic: WriteBleCharacteristicOptions[] =
|
|
19
22
|
[]
|
|
20
23
|
public static callsToStopBleBackend: BleBackendOptions[] = []
|
|
21
24
|
public static callsToSetBleRssiInterval: BleRssiOptions[] = []
|
|
22
|
-
public static
|
|
23
|
-
public static
|
|
24
|
-
public static
|
|
25
|
+
public static callsToCreateUsbBackend: UsbBackendOptions[] = []
|
|
26
|
+
public static callsToStartUsbBackend: UsbBackendOptions[] = []
|
|
27
|
+
public static callsToWriteUsbBackend: WriteUsbBackendOptions[] = []
|
|
28
|
+
public static callsToStopUsbBackend: UsbBackendOptions[] = []
|
|
25
29
|
|
|
26
30
|
public static fakeResult: NativeResult = { status: 200 }
|
|
27
31
|
|
|
@@ -44,6 +48,11 @@ export default class FakeLibndx implements Libndx {
|
|
|
44
48
|
return FakeLibndx.fakeResult
|
|
45
49
|
}
|
|
46
50
|
|
|
51
|
+
public addBleCharCallbacks(options: AddBleCharCallbacksOptions) {
|
|
52
|
+
FakeLibndx.callsToAddBleCharCallbacks.push(options)
|
|
53
|
+
return FakeLibndx.fakeResult
|
|
54
|
+
}
|
|
55
|
+
|
|
47
56
|
public writeBleCharacteristic(options: WriteBleCharacteristicOptions) {
|
|
48
57
|
FakeLibndx.callsToWriteBleCharacteristic.push(options)
|
|
49
58
|
return FakeLibndx.fakeResult
|
|
@@ -59,18 +68,23 @@ export default class FakeLibndx implements Libndx {
|
|
|
59
68
|
return FakeLibndx.fakeResult
|
|
60
69
|
}
|
|
61
70
|
|
|
62
|
-
public
|
|
63
|
-
FakeLibndx.
|
|
71
|
+
public createUsbBackend(options: UsbBackendOptions) {
|
|
72
|
+
FakeLibndx.callsToCreateUsbBackend.push(options)
|
|
73
|
+
return FakeLibndx.fakeResult
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
public startUsbBackend(options: UsbBackendOptions) {
|
|
77
|
+
FakeLibndx.callsToStartUsbBackend.push(options)
|
|
64
78
|
return FakeLibndx.fakeResult
|
|
65
79
|
}
|
|
66
80
|
|
|
67
|
-
public
|
|
68
|
-
FakeLibndx.
|
|
81
|
+
public writeUsbBackend(options: WriteUsbBackendOptions) {
|
|
82
|
+
FakeLibndx.callsToWriteUsbBackend.push(options)
|
|
69
83
|
return FakeLibndx.fakeResult
|
|
70
84
|
}
|
|
71
85
|
|
|
72
|
-
public
|
|
73
|
-
FakeLibndx.
|
|
86
|
+
public stopUsbBackend(options: UsbBackendOptions) {
|
|
87
|
+
FakeLibndx.callsToStopUsbBackend.push(options)
|
|
74
88
|
return FakeLibndx.fakeResult
|
|
75
89
|
}
|
|
76
90
|
|
|
@@ -79,11 +93,13 @@ export default class FakeLibndx implements Libndx {
|
|
|
79
93
|
FakeLibndx.callsToDiscoverBleUuid = []
|
|
80
94
|
FakeLibndx.callsToCreateBleBackend = []
|
|
81
95
|
FakeLibndx.callsToStartBleBackend = []
|
|
96
|
+
FakeLibndx.callsToAddBleCharCallbacks = []
|
|
82
97
|
FakeLibndx.callsToWriteBleCharacteristic = []
|
|
83
98
|
FakeLibndx.callsToStopBleBackend = []
|
|
84
99
|
FakeLibndx.callsToSetBleRssiInterval = []
|
|
85
|
-
FakeLibndx.
|
|
86
|
-
FakeLibndx.
|
|
87
|
-
FakeLibndx.
|
|
100
|
+
FakeLibndx.callsToCreateUsbBackend = []
|
|
101
|
+
FakeLibndx.callsToStartUsbBackend = []
|
|
102
|
+
FakeLibndx.callsToWriteUsbBackend = []
|
|
103
|
+
FakeLibndx.callsToStopUsbBackend = []
|
|
88
104
|
}
|
|
89
105
|
}
|