react-native-ble-manager 8.7.0 → 9.0.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/README.md +96 -47
- package/android/.gradle/7.4/checksums/checksums.lock +0 -0
- package/android/.gradle/7.4/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.4/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.4/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/7.4/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.4/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.4/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/7.4/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/file-system.probe +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/.name +1 -0
- package/android/.idea/compiler.xml +6 -0
- package/android/.idea/gradle.xml +18 -0
- package/android/.idea/jarRepositories.xml +40 -0
- package/android/.idea/misc.xml +10 -0
- package/android/.idea/vcs.xml +6 -0
- package/android/build.gradle +17 -17
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/android/gradle.properties +3 -1
- package/android/gradlew +234 -0
- package/android/gradlew.bat +89 -0
- package/android/local.properties +8 -0
- package/android/src/main/java/it/innove/BleManager.java +33 -17
- package/android/src/main/java/it/innove/LegacyScanManager.java +33 -28
- package/android/src/main/java/it/innove/LollipopPeripheral.java +66 -65
- package/android/src/main/java/it/innove/LollipopScanManager.java +52 -25
- package/android/src/main/java/it/innove/Peripheral.java +889 -837
- package/android/src/main/java/it/innove/ScanManager.java +24 -23
- package/dist/cjs/index.d.ts +147 -0
- package/dist/cjs/index.js +487 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/types.d.ts +311 -0
- package/dist/cjs/types.js +110 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/index.d.ts +147 -0
- package/dist/esm/index.js +471 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types.d.ts +311 -0
- package/dist/esm/types.js +107 -0
- package/dist/esm/types.js.map +1 -0
- package/ios/BleManager.m +87 -110
- package/ios/BleManager.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/package.json +31 -4
- package/src/index.ts +569 -0
- package/src/types.ts +336 -0
- package/.github/FUNDING.yml +0 -3
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
- package/BleManager.js +0 -427
- package/index.d.ts +0 -168
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6C;AAC7C,mCAWiB;AAEjB,0CAAwB;AAExB,IAAI,UAAU,GAAG,4BAAa,CAAC,UAAU,CAAC;AAE1C,MAAM,UAAU;IACd;QACE,IAAI,CAAC,qBAAqB,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrE,CAAC;IAED;;;;;;OAMG;IACH,IAAI,CAAC,YAAoB,EAAE,WAAmB,EAAE,kBAA0B;QACxE,OAAO,IAAI,OAAO,CAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC/C,UAAU,CAAC,IAAI,CACb,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,CAAC,KAAoB,EAAE,IAAc,EAAE,EAAE;gBACvC,IAAI,KAAK,EAAE;oBACT,MAAM,CAAC,KAAK,CAAC,CAAC;iBACf;qBAAM;oBACL,OAAO,CAAC,IAAI,CAAC,CAAC;iBACf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AAC;iBACf;qBAAM;oBACL,OAAO,CAAC,GAAG,CAAC,CAAC;iBACd;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,OAAO,CAAC,IAAY;QAClB,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;CACF;AAED,kBAAe,IAAI,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* android states: https://developer.android.com/reference/android/bluetooth/BluetoothAdapter#EXTRA_STATE
|
|
3
|
+
* ios states: https://developer.apple.com/documentation/corebluetooth/cbcentralmanagerstate
|
|
4
|
+
* */
|
|
5
|
+
export declare enum BleState {
|
|
6
|
+
/**
|
|
7
|
+
* [iOS only]
|
|
8
|
+
*/
|
|
9
|
+
Unknown = "unknown",
|
|
10
|
+
/**
|
|
11
|
+
* [iOS only]
|
|
12
|
+
*/
|
|
13
|
+
Resetting = "resetting",
|
|
14
|
+
Unsupported = "unsupported",
|
|
15
|
+
/**
|
|
16
|
+
* [iOS only]
|
|
17
|
+
*/
|
|
18
|
+
Unauthorized = "unauthorized",
|
|
19
|
+
On = "on",
|
|
20
|
+
Off = "off",
|
|
21
|
+
/**
|
|
22
|
+
* [android only]
|
|
23
|
+
*/
|
|
24
|
+
TurningOn = "turning_on",
|
|
25
|
+
/**
|
|
26
|
+
* [android only]
|
|
27
|
+
*/
|
|
28
|
+
TurningOff = "turning_off"
|
|
29
|
+
}
|
|
30
|
+
export interface Peripheral {
|
|
31
|
+
id: string;
|
|
32
|
+
rssi: number;
|
|
33
|
+
name?: string;
|
|
34
|
+
advertising: AdvertisingData;
|
|
35
|
+
}
|
|
36
|
+
export interface AdvertisingData {
|
|
37
|
+
isConnectable?: boolean;
|
|
38
|
+
localName?: string;
|
|
39
|
+
manufacturerData?: CustomAdvertisingData;
|
|
40
|
+
serviceData?: CustomAdvertisingData;
|
|
41
|
+
serviceUUIDs?: string[];
|
|
42
|
+
txPowerLevel?: number;
|
|
43
|
+
}
|
|
44
|
+
export interface CustomAdvertisingData {
|
|
45
|
+
CDVType: 'ArrayBuffer';
|
|
46
|
+
/**
|
|
47
|
+
* data as an array of numbers (which can be converted back to a Uint8Array (ByteArray),
|
|
48
|
+
* using something like [Buffer.from()](https://github.com/feross/buffer))
|
|
49
|
+
*/
|
|
50
|
+
bytes: number[];
|
|
51
|
+
/**
|
|
52
|
+
* base64-encoded string of the data
|
|
53
|
+
*/
|
|
54
|
+
data: string;
|
|
55
|
+
}
|
|
56
|
+
export interface StartOptions {
|
|
57
|
+
/**
|
|
58
|
+
* [iOS only]
|
|
59
|
+
*/
|
|
60
|
+
showAlert?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* [iOS only]
|
|
63
|
+
*/
|
|
64
|
+
restoreIdentifierKey?: string;
|
|
65
|
+
/**
|
|
66
|
+
* [iOS only]
|
|
67
|
+
*/
|
|
68
|
+
queueIdentifierKey?: string;
|
|
69
|
+
/**
|
|
70
|
+
* [android only]
|
|
71
|
+
*/
|
|
72
|
+
forceLegacy?: boolean;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* [android only]
|
|
76
|
+
* https://developer.android.com/reference/android/bluetooth/le/ScanSettings
|
|
77
|
+
*/
|
|
78
|
+
export interface ScanOptions {
|
|
79
|
+
/**
|
|
80
|
+
* This will only works if a ScanFilter is active. Otherwise, may not retrieve any result.
|
|
81
|
+
* See https://developer.android.com/reference/android/bluetooth/le/ScanSettings#MATCH_NUM_FEW_ADVERTISEMENT.
|
|
82
|
+
* */
|
|
83
|
+
numberOfMatches?: BleScanMatchCount;
|
|
84
|
+
matchMode?: BleScanMatchMode;
|
|
85
|
+
/**
|
|
86
|
+
* This will only works if a ScanFilter is active. Otherwise, may not retrieve any result.
|
|
87
|
+
* See https://developer.android.com/reference/android/bluetooth/le/ScanSettings#CALLBACK_TYPE_FIRST_MATCH.
|
|
88
|
+
* Also read [this issue](https://github.com/dariuszseweryn/RxAndroidBle/issues/561#issuecomment-532295346) for a deeper understanding
|
|
89
|
+
* of the very brittle stability of ScanSettings on android.
|
|
90
|
+
* */
|
|
91
|
+
callbackType?: BleScanCallbackType;
|
|
92
|
+
scanMode?: BleScanMode;
|
|
93
|
+
/**
|
|
94
|
+
* This is supposed to push results after a certain delay.
|
|
95
|
+
* In practice it is tricky, use with caution.
|
|
96
|
+
* Do not set something below 5000ms as it will wait that long anyway before pushing the first results,
|
|
97
|
+
* or on some phones it will ignore that setting and behave just like it was set to 0.
|
|
98
|
+
* Set your minimum scan duration accordingly, otherwise you will not retrieve the batched results.
|
|
99
|
+
* https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder#setReportDelay(long)
|
|
100
|
+
*/
|
|
101
|
+
reportDelay?: number;
|
|
102
|
+
/**
|
|
103
|
+
* Does not work in conjunction with legacy scans. Setting an unsupported PHY will result in a failure to scan,
|
|
104
|
+
* use with caution.
|
|
105
|
+
* https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder#setPhy(int)
|
|
106
|
+
*/
|
|
107
|
+
phy?: BleScanPhyMode;
|
|
108
|
+
/**
|
|
109
|
+
* true by default for compatibility with older apps.
|
|
110
|
+
* In that mode, scan will only retrieve advertisements data as specified by BLE 4.2 and below.
|
|
111
|
+
* Change this if you want to benefit from the extended BLE 5 advertisement spec.
|
|
112
|
+
* https://developer.android.com/reference/android/bluetooth/le/ScanSettings.Builder#setLegacy(boolean)
|
|
113
|
+
*/
|
|
114
|
+
legacy?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* an android ScanFilter, used if present to restrict scan results to devices with a specific advertising name.
|
|
117
|
+
* This is a whole word match, not a partial search.
|
|
118
|
+
* Use with caution, it's behavior is tricky and seems to be the following:
|
|
119
|
+
* if `callbackType` is set to `AllMatches`, only the completeLocalName will be used for filtering.
|
|
120
|
+
* if `callbackType` is set to `FirstMatch`, the shortenedLocalName will be used for filtering.
|
|
121
|
+
* https://developer.android.com/reference/android/bluetooth/le/ScanFilter.Builder#setDeviceName(java.lang.String)
|
|
122
|
+
*/
|
|
123
|
+
exactAdvertisingName?: string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* [android only]
|
|
127
|
+
*/
|
|
128
|
+
export declare enum BleScanMode {
|
|
129
|
+
Opportunistic = -1,
|
|
130
|
+
LowPower = 0,
|
|
131
|
+
Balanced = 1,
|
|
132
|
+
LowLatency = 2
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* [android only]
|
|
136
|
+
*/
|
|
137
|
+
export declare enum BleScanMatchMode {
|
|
138
|
+
Aggressive = 1,
|
|
139
|
+
Sticky = 2
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* [android only]
|
|
143
|
+
*/
|
|
144
|
+
export declare enum BleScanCallbackType {
|
|
145
|
+
AllMatches = 1,
|
|
146
|
+
FirstMatch = 2,
|
|
147
|
+
MatchLost = 4
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* [android only]
|
|
151
|
+
*/
|
|
152
|
+
export declare enum BleScanMatchCount {
|
|
153
|
+
OneAdvertisement = 1,
|
|
154
|
+
FewAdvertisements = 2,
|
|
155
|
+
MaxAdvertisements = 3
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* [android only]
|
|
159
|
+
*/
|
|
160
|
+
export declare enum BleScanPhyMode {
|
|
161
|
+
LE_1M = 1,
|
|
162
|
+
LE_2M = 2,
|
|
163
|
+
LE_CODED = 3,
|
|
164
|
+
ALL_SUPPORTED = 255
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* [android only API 21+]
|
|
168
|
+
*/
|
|
169
|
+
export declare enum ConnectionPriority {
|
|
170
|
+
balanced = 0,
|
|
171
|
+
high = 1,
|
|
172
|
+
low = 2
|
|
173
|
+
}
|
|
174
|
+
export interface Service {
|
|
175
|
+
uuid: string;
|
|
176
|
+
}
|
|
177
|
+
export interface Descriptor {
|
|
178
|
+
value: string;
|
|
179
|
+
uuid: string;
|
|
180
|
+
}
|
|
181
|
+
export interface Characteristic {
|
|
182
|
+
/**
|
|
183
|
+
* See https://developer.apple.com/documentation/corebluetooth/cbcharacteristicproperties
|
|
184
|
+
*/
|
|
185
|
+
properties: {
|
|
186
|
+
Broadcast?: "Broadcast";
|
|
187
|
+
Read?: "Read";
|
|
188
|
+
WriteWithoutResponse?: "WriteWithoutResponse";
|
|
189
|
+
Write?: "Write";
|
|
190
|
+
Notify?: "Notify";
|
|
191
|
+
Indicate?: "Indicate";
|
|
192
|
+
AuthenticatedSignedWrites?: "AuthenticatedSignedWrites";
|
|
193
|
+
ExtendedProperties?: "ExtendedProperties";
|
|
194
|
+
NotifyEncryptionRequired?: "NotifyEncryptionRequired";
|
|
195
|
+
IndicateEncryptionRequired?: "IndicateEncryptionRequired";
|
|
196
|
+
};
|
|
197
|
+
characteristic: string;
|
|
198
|
+
service: string;
|
|
199
|
+
descriptors?: Descriptor[];
|
|
200
|
+
}
|
|
201
|
+
export interface PeripheralInfo extends Peripheral {
|
|
202
|
+
serviceUUIDs?: string[];
|
|
203
|
+
characteristics?: Characteristic[];
|
|
204
|
+
services?: Service[];
|
|
205
|
+
}
|
|
206
|
+
export declare enum BleEventType {
|
|
207
|
+
BleManagerDidUpdateState = "BleManagerDidUpdateState",
|
|
208
|
+
BleManagerStopScan = "BleManagerStopScan",
|
|
209
|
+
BleManagerDiscoverPeripheral = "BleManagerDiscoverPeripheral",
|
|
210
|
+
BleManagerDidUpdateValueForCharacteristic = "BleManagerDidUpdateValueForCharacteristic",
|
|
211
|
+
BleManagerConnectPeripheral = "BleManagerConnectPeripheral",
|
|
212
|
+
BleManagerDisconnectPeripheral = "BleManagerDisconnectPeripheral",
|
|
213
|
+
/**
|
|
214
|
+
* [Android only]
|
|
215
|
+
*/
|
|
216
|
+
BleManagerPeripheralDidBond = "BleManagerPeripheralDidBond",
|
|
217
|
+
/**
|
|
218
|
+
* [iOS only]
|
|
219
|
+
*/
|
|
220
|
+
BleManagerCentralManagerWillRestoreState = "BleManagerCentralManagerWillRestoreState",
|
|
221
|
+
/**
|
|
222
|
+
* [iOS only]
|
|
223
|
+
*/
|
|
224
|
+
BleManagerDidUpdateNotificationStateFor = "BleManagerDidUpdateNotificationStateFor"
|
|
225
|
+
}
|
|
226
|
+
export interface BleStopScanEvent {
|
|
227
|
+
/**
|
|
228
|
+
* [iOS only]
|
|
229
|
+
*/
|
|
230
|
+
status?: number;
|
|
231
|
+
}
|
|
232
|
+
export interface BleManagerDidUpdateStateEvent {
|
|
233
|
+
state: BleState;
|
|
234
|
+
}
|
|
235
|
+
export interface BleConnectPeripheralEvent {
|
|
236
|
+
/**
|
|
237
|
+
* peripheral id
|
|
238
|
+
*/
|
|
239
|
+
readonly peripheral: string;
|
|
240
|
+
/**
|
|
241
|
+
* [android only]
|
|
242
|
+
*/
|
|
243
|
+
readonly status?: number;
|
|
244
|
+
}
|
|
245
|
+
export type BleDiscoverPeripheralEvent = Peripheral;
|
|
246
|
+
/**
|
|
247
|
+
* [Android only]
|
|
248
|
+
*/
|
|
249
|
+
export type BleBondedPeripheralEvent = Peripheral;
|
|
250
|
+
export interface BleDisconnectPeripheralEvent {
|
|
251
|
+
/**
|
|
252
|
+
* peripheral id
|
|
253
|
+
*/
|
|
254
|
+
readonly peripheral: string;
|
|
255
|
+
/**
|
|
256
|
+
* [android only] disconnect reason.
|
|
257
|
+
*/
|
|
258
|
+
readonly status?: number;
|
|
259
|
+
/**
|
|
260
|
+
* [iOS only] disconnect error domain.
|
|
261
|
+
*/
|
|
262
|
+
readonly domain?: string;
|
|
263
|
+
/**
|
|
264
|
+
* [iOS only] disconnect error code.
|
|
265
|
+
*/
|
|
266
|
+
readonly code?: number;
|
|
267
|
+
}
|
|
268
|
+
export interface BleManagerDidUpdateValueForCharacteristicEvent {
|
|
269
|
+
/**
|
|
270
|
+
* characteristic UUID
|
|
271
|
+
*/
|
|
272
|
+
readonly characteristic: string;
|
|
273
|
+
/**
|
|
274
|
+
* peripheral id
|
|
275
|
+
*/
|
|
276
|
+
readonly peripheral: string;
|
|
277
|
+
/**
|
|
278
|
+
* service UUID
|
|
279
|
+
*/
|
|
280
|
+
readonly service: string;
|
|
281
|
+
/**
|
|
282
|
+
* data as an array of numbers (which can be converted back to a Uint8Array (ByteArray),
|
|
283
|
+
* using something like [Buffer.from()](https://github.com/feross/buffer))
|
|
284
|
+
*/
|
|
285
|
+
readonly value: number[];
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* [iOS only]
|
|
289
|
+
*/
|
|
290
|
+
export interface BleManagerDidUpdateNotificationStateForEvent {
|
|
291
|
+
/**
|
|
292
|
+
* peripheral id
|
|
293
|
+
*/
|
|
294
|
+
readonly peripheral: string;
|
|
295
|
+
/**
|
|
296
|
+
* characteristic UUID
|
|
297
|
+
*/
|
|
298
|
+
readonly characteristic: string;
|
|
299
|
+
/**
|
|
300
|
+
* is the characteristic notifying or not
|
|
301
|
+
*/
|
|
302
|
+
readonly isNotifying: boolean;
|
|
303
|
+
/**
|
|
304
|
+
* error domain
|
|
305
|
+
*/
|
|
306
|
+
readonly domain: string;
|
|
307
|
+
/**
|
|
308
|
+
* error code
|
|
309
|
+
*/
|
|
310
|
+
readonly code: number;
|
|
311
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BleEventType = exports.ConnectionPriority = exports.BleScanPhyMode = exports.BleScanMatchCount = exports.BleScanCallbackType = exports.BleScanMatchMode = exports.BleScanMode = exports.BleState = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* android states: https://developer.android.com/reference/android/bluetooth/BluetoothAdapter#EXTRA_STATE
|
|
6
|
+
* ios states: https://developer.apple.com/documentation/corebluetooth/cbcentralmanagerstate
|
|
7
|
+
* */
|
|
8
|
+
var BleState;
|
|
9
|
+
(function (BleState) {
|
|
10
|
+
/**
|
|
11
|
+
* [iOS only]
|
|
12
|
+
*/
|
|
13
|
+
BleState["Unknown"] = "unknown";
|
|
14
|
+
/**
|
|
15
|
+
* [iOS only]
|
|
16
|
+
*/
|
|
17
|
+
BleState["Resetting"] = "resetting";
|
|
18
|
+
BleState["Unsupported"] = "unsupported";
|
|
19
|
+
/**
|
|
20
|
+
* [iOS only]
|
|
21
|
+
*/
|
|
22
|
+
BleState["Unauthorized"] = "unauthorized";
|
|
23
|
+
BleState["On"] = "on";
|
|
24
|
+
BleState["Off"] = "off";
|
|
25
|
+
/**
|
|
26
|
+
* [android only]
|
|
27
|
+
*/
|
|
28
|
+
BleState["TurningOn"] = "turning_on";
|
|
29
|
+
/**
|
|
30
|
+
* [android only]
|
|
31
|
+
*/
|
|
32
|
+
BleState["TurningOff"] = "turning_off";
|
|
33
|
+
})(BleState = exports.BleState || (exports.BleState = {}));
|
|
34
|
+
/**
|
|
35
|
+
* [android only]
|
|
36
|
+
*/
|
|
37
|
+
var BleScanMode;
|
|
38
|
+
(function (BleScanMode) {
|
|
39
|
+
BleScanMode[BleScanMode["Opportunistic"] = -1] = "Opportunistic";
|
|
40
|
+
BleScanMode[BleScanMode["LowPower"] = 0] = "LowPower";
|
|
41
|
+
BleScanMode[BleScanMode["Balanced"] = 1] = "Balanced";
|
|
42
|
+
BleScanMode[BleScanMode["LowLatency"] = 2] = "LowLatency";
|
|
43
|
+
})(BleScanMode = exports.BleScanMode || (exports.BleScanMode = {}));
|
|
44
|
+
/**
|
|
45
|
+
* [android only]
|
|
46
|
+
*/
|
|
47
|
+
var BleScanMatchMode;
|
|
48
|
+
(function (BleScanMatchMode) {
|
|
49
|
+
BleScanMatchMode[BleScanMatchMode["Aggressive"] = 1] = "Aggressive";
|
|
50
|
+
BleScanMatchMode[BleScanMatchMode["Sticky"] = 2] = "Sticky";
|
|
51
|
+
})(BleScanMatchMode = exports.BleScanMatchMode || (exports.BleScanMatchMode = {}));
|
|
52
|
+
/**
|
|
53
|
+
* [android only]
|
|
54
|
+
*/
|
|
55
|
+
var BleScanCallbackType;
|
|
56
|
+
(function (BleScanCallbackType) {
|
|
57
|
+
BleScanCallbackType[BleScanCallbackType["AllMatches"] = 1] = "AllMatches";
|
|
58
|
+
BleScanCallbackType[BleScanCallbackType["FirstMatch"] = 2] = "FirstMatch";
|
|
59
|
+
BleScanCallbackType[BleScanCallbackType["MatchLost"] = 4] = "MatchLost";
|
|
60
|
+
})(BleScanCallbackType = exports.BleScanCallbackType || (exports.BleScanCallbackType = {}));
|
|
61
|
+
/**
|
|
62
|
+
* [android only]
|
|
63
|
+
*/
|
|
64
|
+
var BleScanMatchCount;
|
|
65
|
+
(function (BleScanMatchCount) {
|
|
66
|
+
BleScanMatchCount[BleScanMatchCount["OneAdvertisement"] = 1] = "OneAdvertisement";
|
|
67
|
+
BleScanMatchCount[BleScanMatchCount["FewAdvertisements"] = 2] = "FewAdvertisements";
|
|
68
|
+
BleScanMatchCount[BleScanMatchCount["MaxAdvertisements"] = 3] = "MaxAdvertisements";
|
|
69
|
+
})(BleScanMatchCount = exports.BleScanMatchCount || (exports.BleScanMatchCount = {}));
|
|
70
|
+
/**
|
|
71
|
+
* [android only]
|
|
72
|
+
*/
|
|
73
|
+
var BleScanPhyMode;
|
|
74
|
+
(function (BleScanPhyMode) {
|
|
75
|
+
BleScanPhyMode[BleScanPhyMode["LE_1M"] = 1] = "LE_1M";
|
|
76
|
+
BleScanPhyMode[BleScanPhyMode["LE_2M"] = 2] = "LE_2M";
|
|
77
|
+
BleScanPhyMode[BleScanPhyMode["LE_CODED"] = 3] = "LE_CODED";
|
|
78
|
+
BleScanPhyMode[BleScanPhyMode["ALL_SUPPORTED"] = 255] = "ALL_SUPPORTED";
|
|
79
|
+
})(BleScanPhyMode = exports.BleScanPhyMode || (exports.BleScanPhyMode = {}));
|
|
80
|
+
/**
|
|
81
|
+
* [android only API 21+]
|
|
82
|
+
*/
|
|
83
|
+
var ConnectionPriority;
|
|
84
|
+
(function (ConnectionPriority) {
|
|
85
|
+
ConnectionPriority[ConnectionPriority["balanced"] = 0] = "balanced";
|
|
86
|
+
ConnectionPriority[ConnectionPriority["high"] = 1] = "high";
|
|
87
|
+
ConnectionPriority[ConnectionPriority["low"] = 2] = "low";
|
|
88
|
+
})(ConnectionPriority = exports.ConnectionPriority || (exports.ConnectionPriority = {}));
|
|
89
|
+
var BleEventType;
|
|
90
|
+
(function (BleEventType) {
|
|
91
|
+
BleEventType["BleManagerDidUpdateState"] = "BleManagerDidUpdateState";
|
|
92
|
+
BleEventType["BleManagerStopScan"] = "BleManagerStopScan";
|
|
93
|
+
BleEventType["BleManagerDiscoverPeripheral"] = "BleManagerDiscoverPeripheral";
|
|
94
|
+
BleEventType["BleManagerDidUpdateValueForCharacteristic"] = "BleManagerDidUpdateValueForCharacteristic";
|
|
95
|
+
BleEventType["BleManagerConnectPeripheral"] = "BleManagerConnectPeripheral";
|
|
96
|
+
BleEventType["BleManagerDisconnectPeripheral"] = "BleManagerDisconnectPeripheral";
|
|
97
|
+
/**
|
|
98
|
+
* [Android only]
|
|
99
|
+
*/
|
|
100
|
+
BleEventType["BleManagerPeripheralDidBond"] = "BleManagerPeripheralDidBond";
|
|
101
|
+
/**
|
|
102
|
+
* [iOS only]
|
|
103
|
+
*/
|
|
104
|
+
BleEventType["BleManagerCentralManagerWillRestoreState"] = "BleManagerCentralManagerWillRestoreState";
|
|
105
|
+
/**
|
|
106
|
+
* [iOS only]
|
|
107
|
+
*/
|
|
108
|
+
BleEventType["BleManagerDidUpdateNotificationStateFor"] = "BleManagerDidUpdateNotificationStateFor";
|
|
109
|
+
})(BleEventType = exports.BleEventType || (exports.BleEventType = {}));
|
|
110
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";;;AAAA;;;KAGK;AACL,IAAY,QAwBX;AAxBD,WAAY,QAAQ;IAClB;;OAEG;IACH,+BAAmB,CAAA;IACnB;;OA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W,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAI7B;AAuCD,IAAY,YAmBX;AAnBD,WAAY,YAAY;IACtB,qEAAqD,CAAA;IACrD,yDAAyC,CAAA;IACzC,6EAA6D,CAAA;IAC7D,uGAAuF,CAAA;IACvF,2EAA2D,CAAA;IAC3D,iFAAiE,CAAA;IACjE;;OAEG;IACH,2EAA2D,CAAA;IAC3D;;OAEG;IACH,qGAAqF,CAAA;IACrF;;OAEG;IACH,mGAAmF,CAAA;AACrF,CAAC,EAnBW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAmBvB"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { BleState, ConnectionPriority, Peripheral, PeripheralInfo, ScanOptions, StartOptions } from './types';
|
|
2
|
+
export * from './types';
|
|
3
|
+
declare class BleManager {
|
|
4
|
+
constructor();
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param peripheralId
|
|
8
|
+
* @param serviceUUID
|
|
9
|
+
* @param characteristicUUID
|
|
10
|
+
* @returns data as an array of numbers (which can be converted back to a Uint8Array (ByteArray) using something like [Buffer.from()](https://github.com/feross/buffer))
|
|
11
|
+
*/
|
|
12
|
+
read(peripheralId: string, serviceUUID: string, characteristicUUID: string): Promise<number[]>;
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param peripheralId
|
|
16
|
+
* @returns a promise resolving with the updated RSSI (`number`) if it succeeds.
|
|
17
|
+
*/
|
|
18
|
+
readRSSI(peripheralId: string): Promise<number>;
|
|
19
|
+
/**
|
|
20
|
+
* [Android only]
|
|
21
|
+
* @param peripheralId
|
|
22
|
+
* @returns a promise that resolves to a boolean indicating if gatt was successfully refreshed or not.
|
|
23
|
+
*/
|
|
24
|
+
refreshCache(peripheralId: string): Promise<boolean>;
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @param peripheralId
|
|
28
|
+
* @param serviceUUIDs [iOS only] optional filter of services to retrieve.
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
retrieveServices(peripheralId: string, serviceUUIDs?: string[]): Promise<PeripheralInfo>;
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* @param peripheralId
|
|
35
|
+
* @param serviceUUID
|
|
36
|
+
* @param characteristicUUID
|
|
37
|
+
* @param data data to write as an array of numbers (which can be converted from a Uint8Array (ByteArray) using something like [Buffer.toJSON().data](https://github.com/feross/buffer))
|
|
38
|
+
* @param maxByteSize optional, defaults to 20
|
|
39
|
+
* @returns
|
|
40
|
+
*/
|
|
41
|
+
write(peripheralId: string, serviceUUID: string, characteristicUUID: string, data: number[], maxByteSize?: number): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
*
|
|
44
|
+
* @param peripheralId
|
|
45
|
+
* @param serviceUUID
|
|
46
|
+
* @param characteristicUUID
|
|
47
|
+
* @param data data to write as an array of numbers (which can be converted from a Uint8Array (ByteArray) using something like [Buffer.toJSON().data](https://github.com/feross/buffer))
|
|
48
|
+
* @param maxByteSize optional, defaults to 20
|
|
49
|
+
* @param queueSleepTime optional, defaults to 10. Only useful if data length is greater than maxByteSize.
|
|
50
|
+
* @returns
|
|
51
|
+
*/
|
|
52
|
+
writeWithoutResponse(peripheralId: string, serviceUUID: string, characteristicUUID: string, data: number[], maxByteSize?: number, queueSleepTime?: number): Promise<void>;
|
|
53
|
+
connect(peripheralId: string): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* [Android only]
|
|
56
|
+
* @param peripheralId
|
|
57
|
+
* @param peripheralPin optional. will be used to auto-bond if possible.
|
|
58
|
+
* @returns
|
|
59
|
+
*/
|
|
60
|
+
createBond(peripheralId: string, peripheralPin?: string | null): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* [Android only]
|
|
63
|
+
* @param peripheralId
|
|
64
|
+
* @returns
|
|
65
|
+
*/
|
|
66
|
+
removeBond(peripheralId: string): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
*
|
|
69
|
+
* @param peripheralId
|
|
70
|
+
* @param force [Android only] defaults to true.
|
|
71
|
+
* @returns
|
|
72
|
+
*/
|
|
73
|
+
disconnect(peripheralId: string, force?: boolean): Promise<void>;
|
|
74
|
+
startNotification(peripheralId: string, serviceUUID: string, characteristicUUID: string): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* [Android only]
|
|
77
|
+
* @param peripheralId
|
|
78
|
+
* @param serviceUUID
|
|
79
|
+
* @param characteristicUUID
|
|
80
|
+
* @param buffer
|
|
81
|
+
* @returns
|
|
82
|
+
*/
|
|
83
|
+
startNotificationUseBuffer(peripheralId: string, serviceUUID: string, characteristicUUID: string, buffer: number): Promise<void>;
|
|
84
|
+
stopNotification(peripheralId: string, serviceUUID: string, characteristicUUID: string): Promise<void>;
|
|
85
|
+
checkState(): Promise<BleState>;
|
|
86
|
+
start(options?: StartOptions): Promise<void>;
|
|
87
|
+
/**
|
|
88
|
+
*
|
|
89
|
+
* @param serviceUUIDs
|
|
90
|
+
* @param seconds amount of seconds to scan. if set to 0 or less, will scan until you call stopScan() or the OS stops the scan (background etc).
|
|
91
|
+
* @param allowDuplicates [iOS only]
|
|
92
|
+
* @param scanningOptions [Android only] optional map of properties to fine-tune scan behavior on android, see README.
|
|
93
|
+
* @returns
|
|
94
|
+
*/
|
|
95
|
+
scan(serviceUUIDs: string[], seconds: number, allowDuplicates?: boolean, scanningOptions?: ScanOptions): Promise<void>;
|
|
96
|
+
stopScan(): Promise<void>;
|
|
97
|
+
/**
|
|
98
|
+
* [Android only] triggers an ENABLE_REQUEST intent to the end-user to enable bluetooth.
|
|
99
|
+
* @returns
|
|
100
|
+
*/
|
|
101
|
+
enableBluetooth(): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
*
|
|
104
|
+
* @param serviceUUIDs [optional] not used on android, optional on ios.
|
|
105
|
+
* @returns
|
|
106
|
+
*/
|
|
107
|
+
getConnectedPeripherals(serviceUUIDs?: string[]): Promise<Peripheral[]>;
|
|
108
|
+
/**
|
|
109
|
+
* [Android only]
|
|
110
|
+
* @returns
|
|
111
|
+
*/
|
|
112
|
+
getBondedPeripherals(): Promise<Peripheral[]>;
|
|
113
|
+
getDiscoveredPeripherals(): Promise<Peripheral[]>;
|
|
114
|
+
/**
|
|
115
|
+
* [Android only]
|
|
116
|
+
* @param peripheralId
|
|
117
|
+
* @returns
|
|
118
|
+
*/
|
|
119
|
+
removePeripheral(peripheralId: string): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* @param peripheralId
|
|
122
|
+
* @param serviceUUIDs [optional] not used on android, optional on ios.
|
|
123
|
+
* @returns
|
|
124
|
+
*/
|
|
125
|
+
isPeripheralConnected(peripheralId: string, serviceUUIDs?: string[]): Promise<boolean>;
|
|
126
|
+
/**
|
|
127
|
+
* [Android only, API 21+]
|
|
128
|
+
* @param peripheralId
|
|
129
|
+
* @param connectionPriority
|
|
130
|
+
* @returns a promise that resolves with a boolean indicating of the connection priority was changed successfully, or rejects with an error message.
|
|
131
|
+
*/
|
|
132
|
+
requestConnectionPriority(peripheralId: string, connectionPriority: ConnectionPriority): Promise<boolean>;
|
|
133
|
+
/**
|
|
134
|
+
* [Android only, API 21+]
|
|
135
|
+
* @param peripheralId
|
|
136
|
+
* @param mtu size to be requested, in bytes.
|
|
137
|
+
* @returns a promise resolving with the negotiated MTU if it succeeded. Beware that it might not be the one requested due to device's BLE limitations on both side of the negotiation.
|
|
138
|
+
*/
|
|
139
|
+
requestMTU(peripheralId: string, mtu: number): Promise<number>;
|
|
140
|
+
/**
|
|
141
|
+
* [Android only]
|
|
142
|
+
* @param name
|
|
143
|
+
*/
|
|
144
|
+
setName(name: string): void;
|
|
145
|
+
}
|
|
146
|
+
declare const _default: BleManager;
|
|
147
|
+
export default _default;
|