@capacitor-community/bluetooth-le
Advanced tools
Comparing version 0.6.0 to 0.6.1
@@ -5,2 +5,9 @@ # Changelog | ||
### [0.6.1](https://github.com/capacitor-community/bluetooth-le/compare/v0.6.0...v0.6.1) (2021-09-21) | ||
### Bug Fixes | ||
* **android:** make core-ktx version configurable and set default to 1.6.0 ([#194](https://github.com/capacitor-community/bluetooth-le/issues/194)) ([94ea30d](https://github.com/capacitor-community/bluetooth-le/commit/94ea30df9fe6ff34229f46e91ff9e89b12ff92ea)) | ||
## [0.6.0](https://github.com/capacitor-community/bluetooth-le/compare/v0.5.1...v0.6.0) (2021-04-10) | ||
@@ -7,0 +14,0 @@ |
@@ -1201,3 +1201,4 @@ { | ||
], | ||
"typeAliases": [] | ||
"typeAliases": [], | ||
"pluginConfigs": [] | ||
} |
@@ -15,2 +15,3 @@ 'use strict'; | ||
*/ | ||
exports.ScanMode = void 0; | ||
(function (ScanMode) { | ||
@@ -94,3 +95,3 @@ /** | ||
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
var __awaiter$2 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
@@ -105,3 +106,3 @@ return new (P || (P = Promise))(function (resolve, reject) { | ||
function runWithTimeout(promise, time, exception) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
let timer; | ||
@@ -195,7 +196,7 @@ return Promise.race([ | ||
const deviceId = event.device.id; | ||
BluetoothLe.deviceMap.set(deviceId, event.device); | ||
const isNew = !BluetoothLe.discoverdDevices.has(deviceId); | ||
if (isNew || ((_a = BluetoothLe.requestBleDeviceOptions) === null || _a === void 0 ? void 0 : _a.allowDuplicates)) { | ||
BluetoothLe.discoverdDevices.set(deviceId, true); | ||
const device = BluetoothLe.getBleDevice(event.device); | ||
BluetoothLe$1.deviceMap.set(deviceId, event.device); | ||
const isNew = !BluetoothLe$1.discoverdDevices.has(deviceId); | ||
if (isNew || ((_a = BluetoothLe$1.requestBleDeviceOptions) === null || _a === void 0 ? void 0 : _a.allowDuplicates)) { | ||
BluetoothLe$1.discoverdDevices.set(deviceId, true); | ||
const device = BluetoothLe$1.getBleDevice(event.device); | ||
const result = { | ||
@@ -210,3 +211,3 @@ device, | ||
}; | ||
BluetoothLe.notifyListeners('onScanResult', result); | ||
BluetoothLe$1.notifyListeners('onScanResult', result); | ||
} | ||
@@ -253,3 +254,3 @@ } | ||
const key = `disconnected|${deviceId}`; | ||
BluetoothLe.notifyListeners(key, null); | ||
BluetoothLe$1.notifyListeners(key, null); | ||
} | ||
@@ -325,3 +326,3 @@ createBond() { | ||
const key = `notification|${(_a = characteristic.service) === null || _a === void 0 ? void 0 : _a.device.id}|${(_b = characteristic.service) === null || _b === void 0 ? void 0 : _b.uuid}|${characteristic.uuid}`; | ||
BluetoothLe.notifyListeners(key, { | ||
BluetoothLe$1.notifyListeners(key, { | ||
value: characteristic.value, | ||
@@ -372,4 +373,4 @@ }); | ||
} | ||
const BluetoothLe = new BluetoothLeWeb(); | ||
core.registerWebPlugin(BluetoothLe); | ||
const BluetoothLe$1 = new BluetoothLeWeb(); | ||
core.registerWebPlugin(BluetoothLe$1); | ||
@@ -385,3 +386,3 @@ function getQueue(enabled) { | ||
var __awaiter$2 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
@@ -395,3 +396,3 @@ return new (P || (P = Promise))(function (resolve, reject) { | ||
}; | ||
const { BluetoothLe: BluetoothLe$1 } = core.Plugins; | ||
const { BluetoothLe } = core.Plugins; | ||
class BleClientClass { | ||
@@ -410,5 +411,5 @@ constructor() { | ||
initialize() { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
yield BluetoothLe$1.initialize(); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
yield BluetoothLe.initialize(); | ||
})); | ||
@@ -418,5 +419,5 @@ }); | ||
getEnabled() { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
const enabled = yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
const result = yield BluetoothLe$1.getEnabled(); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const enabled = yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
const result = yield BluetoothLe.getEnabled(); | ||
return result.value; | ||
@@ -428,12 +429,12 @@ })); | ||
startEnabledNotifications(callback) { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
var _a; | ||
const key = `onEnabledChanged`; | ||
yield ((_a = this.eventListeners.get(key)) === null || _a === void 0 ? void 0 : _a.remove()); | ||
const listener = yield BluetoothLe$1.addListener(key, result => { | ||
const listener = yield BluetoothLe.addListener(key, result => { | ||
callback(result.value); | ||
}); | ||
this.eventListeners.set(key, listener); | ||
yield BluetoothLe$1.startEnabledNotifications(); | ||
yield BluetoothLe.startEnabledNotifications(); | ||
})); | ||
@@ -443,8 +444,8 @@ }); | ||
stopEnabledNotifications() { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
var _a; | ||
const key = `onEnabledChanged`; | ||
yield ((_a = this.eventListeners.get(key)) === null || _a === void 0 ? void 0 : _a.remove()); | ||
yield BluetoothLe$1.stopEnabledNotifications(); | ||
yield BluetoothLe.stopEnabledNotifications(); | ||
})); | ||
@@ -454,5 +455,5 @@ }); | ||
requestDevice(options) { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
const result = yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
const device = yield BluetoothLe$1.requestDevice(options); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const result = yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
const device = yield BluetoothLe.requestDevice(options); | ||
return device; | ||
@@ -464,7 +465,7 @@ })); | ||
requestLEScan(options, callback) { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
var _a; | ||
yield ((_a = this.scanListener) === null || _a === void 0 ? void 0 : _a.remove()); | ||
this.scanListener = yield BluetoothLe$1.addListener('onScanResult', (result) => { | ||
this.scanListener = yield BluetoothLe.addListener('onScanResult', (result) => { | ||
result.manufacturerData = this.convertObject(result.manufacturerData); | ||
@@ -477,3 +478,3 @@ result.serviceData = this.convertObject(result.serviceData); | ||
}); | ||
yield BluetoothLe$1.requestLEScan(options); | ||
yield BluetoothLe.requestLEScan(options); | ||
})); | ||
@@ -483,8 +484,8 @@ }); | ||
stopLEScan() { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
var _a; | ||
yield ((_a = this.scanListener) === null || _a === void 0 ? void 0 : _a.remove()); | ||
this.scanListener = null; | ||
yield BluetoothLe$1.stopLEScan(); | ||
yield BluetoothLe.stopLEScan(); | ||
})); | ||
@@ -494,4 +495,4 @@ }); | ||
connect(deviceId, onDisconnect) { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
var _a; | ||
@@ -501,3 +502,3 @@ if (onDisconnect) { | ||
yield ((_a = this.eventListeners.get(key)) === null || _a === void 0 ? void 0 : _a.remove()); | ||
const listener = yield BluetoothLe$1.addListener(key, () => { | ||
const listener = yield BluetoothLe.addListener(key, () => { | ||
onDisconnect(deviceId); | ||
@@ -507,3 +508,3 @@ }); | ||
} | ||
yield BluetoothLe$1.connect({ deviceId }); | ||
yield BluetoothLe.connect({ deviceId }); | ||
})); | ||
@@ -513,5 +514,5 @@ }); | ||
createBond(deviceId) { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
yield BluetoothLe$1.createBond({ deviceId }); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
yield BluetoothLe.createBond({ deviceId }); | ||
})); | ||
@@ -521,5 +522,5 @@ }); | ||
isBonded(deviceId) { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
const isBonded = yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
const result = yield BluetoothLe$1.isBonded({ deviceId }); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const isBonded = yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
const result = yield BluetoothLe.isBonded({ deviceId }); | ||
return result.value; | ||
@@ -531,5 +532,5 @@ })); | ||
disconnect(deviceId) { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
yield BluetoothLe$1.disconnect({ deviceId }); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
yield BluetoothLe.disconnect({ deviceId }); | ||
})); | ||
@@ -539,5 +540,5 @@ }); | ||
read(deviceId, service, characteristic) { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
const value = yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
const result = yield BluetoothLe$1.read({ | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const value = yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
const result = yield BluetoothLe.read({ | ||
deviceId, | ||
@@ -553,4 +554,4 @@ service, | ||
write(deviceId, service, characteristic, value) { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
return this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
let writeValue = value; | ||
@@ -561,3 +562,3 @@ if (core.Capacitor.getPlatform() !== 'web') { | ||
} | ||
yield BluetoothLe$1.write({ | ||
yield BluetoothLe.write({ | ||
deviceId, | ||
@@ -572,4 +573,4 @@ service, | ||
writeWithoutResponse(deviceId, service, characteristic, value) { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
let writeValue = value; | ||
@@ -580,3 +581,3 @@ if (core.Capacitor.getPlatform() !== 'web') { | ||
} | ||
yield BluetoothLe$1.writeWithoutResponse({ | ||
yield BluetoothLe.writeWithoutResponse({ | ||
deviceId, | ||
@@ -591,12 +592,12 @@ service, | ||
startNotifications(deviceId, service, characteristic, callback) { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
var _a; | ||
const key = `notification|${deviceId}|${service}|${characteristic}`; | ||
yield ((_a = this.eventListeners.get(key)) === null || _a === void 0 ? void 0 : _a.remove()); | ||
const listener = yield BluetoothLe$1.addListener(key, (event) => { | ||
const listener = yield BluetoothLe.addListener(key, (event) => { | ||
callback(this.convertValue(event === null || event === void 0 ? void 0 : event.value)); | ||
}); | ||
this.eventListeners.set(key, listener); | ||
yield BluetoothLe$1.startNotifications({ | ||
yield BluetoothLe.startNotifications({ | ||
deviceId, | ||
@@ -610,4 +611,4 @@ service, | ||
stopNotifications(deviceId, service, characteristic) { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
var _a; | ||
@@ -617,3 +618,3 @@ const key = `notification|${service}|${characteristic}`; | ||
this.eventListeners.delete(key); | ||
yield BluetoothLe$1.stopNotifications({ | ||
yield BluetoothLe.stopNotifications({ | ||
deviceId, | ||
@@ -649,3 +650,3 @@ service, | ||
exports.BleClient = BleClient; | ||
exports.BluetoothLe = BluetoothLe; | ||
exports.BluetoothLe = BluetoothLe$1; | ||
exports.BluetoothLeWeb = BluetoothLeWeb; | ||
@@ -652,0 +653,0 @@ exports.dataViewToHexString = dataViewToHexString; |
@@ -11,2 +11,3 @@ var capacitorCommunityBluetoothLe = (function (exports, core, throat) { | ||
*/ | ||
exports.ScanMode = void 0; | ||
(function (ScanMode) { | ||
@@ -90,3 +91,3 @@ /** | ||
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
var __awaiter$2 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
@@ -101,3 +102,3 @@ return new (P || (P = Promise))(function (resolve, reject) { | ||
function runWithTimeout(promise, time, exception) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
let timer; | ||
@@ -191,7 +192,7 @@ return Promise.race([ | ||
const deviceId = event.device.id; | ||
BluetoothLe.deviceMap.set(deviceId, event.device); | ||
const isNew = !BluetoothLe.discoverdDevices.has(deviceId); | ||
if (isNew || ((_a = BluetoothLe.requestBleDeviceOptions) === null || _a === void 0 ? void 0 : _a.allowDuplicates)) { | ||
BluetoothLe.discoverdDevices.set(deviceId, true); | ||
const device = BluetoothLe.getBleDevice(event.device); | ||
BluetoothLe$1.deviceMap.set(deviceId, event.device); | ||
const isNew = !BluetoothLe$1.discoverdDevices.has(deviceId); | ||
if (isNew || ((_a = BluetoothLe$1.requestBleDeviceOptions) === null || _a === void 0 ? void 0 : _a.allowDuplicates)) { | ||
BluetoothLe$1.discoverdDevices.set(deviceId, true); | ||
const device = BluetoothLe$1.getBleDevice(event.device); | ||
const result = { | ||
@@ -206,3 +207,3 @@ device, | ||
}; | ||
BluetoothLe.notifyListeners('onScanResult', result); | ||
BluetoothLe$1.notifyListeners('onScanResult', result); | ||
} | ||
@@ -249,3 +250,3 @@ } | ||
const key = `disconnected|${deviceId}`; | ||
BluetoothLe.notifyListeners(key, null); | ||
BluetoothLe$1.notifyListeners(key, null); | ||
} | ||
@@ -321,3 +322,3 @@ createBond() { | ||
const key = `notification|${(_a = characteristic.service) === null || _a === void 0 ? void 0 : _a.device.id}|${(_b = characteristic.service) === null || _b === void 0 ? void 0 : _b.uuid}|${characteristic.uuid}`; | ||
BluetoothLe.notifyListeners(key, { | ||
BluetoothLe$1.notifyListeners(key, { | ||
value: characteristic.value, | ||
@@ -368,4 +369,4 @@ }); | ||
} | ||
const BluetoothLe = new BluetoothLeWeb(); | ||
core.registerWebPlugin(BluetoothLe); | ||
const BluetoothLe$1 = new BluetoothLeWeb(); | ||
core.registerWebPlugin(BluetoothLe$1); | ||
@@ -381,3 +382,3 @@ function getQueue(enabled) { | ||
var __awaiter$2 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
@@ -391,3 +392,3 @@ return new (P || (P = Promise))(function (resolve, reject) { | ||
}; | ||
const { BluetoothLe: BluetoothLe$1 } = core.Plugins; | ||
const { BluetoothLe } = core.Plugins; | ||
class BleClientClass { | ||
@@ -406,5 +407,5 @@ constructor() { | ||
initialize() { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
yield BluetoothLe$1.initialize(); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
yield BluetoothLe.initialize(); | ||
})); | ||
@@ -414,5 +415,5 @@ }); | ||
getEnabled() { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
const enabled = yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
const result = yield BluetoothLe$1.getEnabled(); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const enabled = yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
const result = yield BluetoothLe.getEnabled(); | ||
return result.value; | ||
@@ -424,12 +425,12 @@ })); | ||
startEnabledNotifications(callback) { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
var _a; | ||
const key = `onEnabledChanged`; | ||
yield ((_a = this.eventListeners.get(key)) === null || _a === void 0 ? void 0 : _a.remove()); | ||
const listener = yield BluetoothLe$1.addListener(key, result => { | ||
const listener = yield BluetoothLe.addListener(key, result => { | ||
callback(result.value); | ||
}); | ||
this.eventListeners.set(key, listener); | ||
yield BluetoothLe$1.startEnabledNotifications(); | ||
yield BluetoothLe.startEnabledNotifications(); | ||
})); | ||
@@ -439,8 +440,8 @@ }); | ||
stopEnabledNotifications() { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
var _a; | ||
const key = `onEnabledChanged`; | ||
yield ((_a = this.eventListeners.get(key)) === null || _a === void 0 ? void 0 : _a.remove()); | ||
yield BluetoothLe$1.stopEnabledNotifications(); | ||
yield BluetoothLe.stopEnabledNotifications(); | ||
})); | ||
@@ -450,5 +451,5 @@ }); | ||
requestDevice(options) { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
const result = yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
const device = yield BluetoothLe$1.requestDevice(options); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const result = yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
const device = yield BluetoothLe.requestDevice(options); | ||
return device; | ||
@@ -460,7 +461,7 @@ })); | ||
requestLEScan(options, callback) { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
var _a; | ||
yield ((_a = this.scanListener) === null || _a === void 0 ? void 0 : _a.remove()); | ||
this.scanListener = yield BluetoothLe$1.addListener('onScanResult', (result) => { | ||
this.scanListener = yield BluetoothLe.addListener('onScanResult', (result) => { | ||
result.manufacturerData = this.convertObject(result.manufacturerData); | ||
@@ -473,3 +474,3 @@ result.serviceData = this.convertObject(result.serviceData); | ||
}); | ||
yield BluetoothLe$1.requestLEScan(options); | ||
yield BluetoothLe.requestLEScan(options); | ||
})); | ||
@@ -479,8 +480,8 @@ }); | ||
stopLEScan() { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
var _a; | ||
yield ((_a = this.scanListener) === null || _a === void 0 ? void 0 : _a.remove()); | ||
this.scanListener = null; | ||
yield BluetoothLe$1.stopLEScan(); | ||
yield BluetoothLe.stopLEScan(); | ||
})); | ||
@@ -490,4 +491,4 @@ }); | ||
connect(deviceId, onDisconnect) { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
var _a; | ||
@@ -497,3 +498,3 @@ if (onDisconnect) { | ||
yield ((_a = this.eventListeners.get(key)) === null || _a === void 0 ? void 0 : _a.remove()); | ||
const listener = yield BluetoothLe$1.addListener(key, () => { | ||
const listener = yield BluetoothLe.addListener(key, () => { | ||
onDisconnect(deviceId); | ||
@@ -503,3 +504,3 @@ }); | ||
} | ||
yield BluetoothLe$1.connect({ deviceId }); | ||
yield BluetoothLe.connect({ deviceId }); | ||
})); | ||
@@ -509,5 +510,5 @@ }); | ||
createBond(deviceId) { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
yield BluetoothLe$1.createBond({ deviceId }); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
yield BluetoothLe.createBond({ deviceId }); | ||
})); | ||
@@ -517,5 +518,5 @@ }); | ||
isBonded(deviceId) { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
const isBonded = yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
const result = yield BluetoothLe$1.isBonded({ deviceId }); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const isBonded = yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
const result = yield BluetoothLe.isBonded({ deviceId }); | ||
return result.value; | ||
@@ -527,5 +528,5 @@ })); | ||
disconnect(deviceId) { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
yield BluetoothLe$1.disconnect({ deviceId }); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
yield BluetoothLe.disconnect({ deviceId }); | ||
})); | ||
@@ -535,5 +536,5 @@ }); | ||
read(deviceId, service, characteristic) { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
const value = yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
const result = yield BluetoothLe$1.read({ | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const value = yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
const result = yield BluetoothLe.read({ | ||
deviceId, | ||
@@ -549,4 +550,4 @@ service, | ||
write(deviceId, service, characteristic, value) { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
return this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
let writeValue = value; | ||
@@ -557,3 +558,3 @@ if (core.Capacitor.getPlatform() !== 'web') { | ||
} | ||
yield BluetoothLe$1.write({ | ||
yield BluetoothLe.write({ | ||
deviceId, | ||
@@ -568,4 +569,4 @@ service, | ||
writeWithoutResponse(deviceId, service, characteristic, value) { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
let writeValue = value; | ||
@@ -576,3 +577,3 @@ if (core.Capacitor.getPlatform() !== 'web') { | ||
} | ||
yield BluetoothLe$1.writeWithoutResponse({ | ||
yield BluetoothLe.writeWithoutResponse({ | ||
deviceId, | ||
@@ -587,12 +588,12 @@ service, | ||
startNotifications(deviceId, service, characteristic, callback) { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
var _a; | ||
const key = `notification|${deviceId}|${service}|${characteristic}`; | ||
yield ((_a = this.eventListeners.get(key)) === null || _a === void 0 ? void 0 : _a.remove()); | ||
const listener = yield BluetoothLe$1.addListener(key, (event) => { | ||
const listener = yield BluetoothLe.addListener(key, (event) => { | ||
callback(this.convertValue(event === null || event === void 0 ? void 0 : event.value)); | ||
}); | ||
this.eventListeners.set(key, listener); | ||
yield BluetoothLe$1.startNotifications({ | ||
yield BluetoothLe.startNotifications({ | ||
deviceId, | ||
@@ -606,4 +607,4 @@ service, | ||
stopNotifications(deviceId, service, characteristic) { | ||
return __awaiter$2(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter$2(this, void 0, void 0, function* () { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.queue(() => __awaiter(this, void 0, void 0, function* () { | ||
var _a; | ||
@@ -613,3 +614,3 @@ const key = `notification|${service}|${characteristic}`; | ||
this.eventListeners.delete(key); | ||
yield BluetoothLe$1.stopNotifications({ | ||
yield BluetoothLe.stopNotifications({ | ||
deviceId, | ||
@@ -645,3 +646,3 @@ service, | ||
exports.BleClient = BleClient; | ||
exports.BluetoothLe = BluetoothLe; | ||
exports.BluetoothLe = BluetoothLe$1; | ||
exports.BluetoothLeWeb = BluetoothLeWeb; | ||
@@ -648,0 +649,0 @@ exports.dataViewToHexString = dataViewToHexString; |
{ | ||
"name": "@capacitor-community/bluetooth-le", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "Capacitor plugin for Bluetooth Low Energy ", | ||
@@ -5,0 +5,0 @@ "main": "dist/plugin.cjs.js", |
@@ -26,2 +26,9 @@ <p align="center"><br><img src="https://user-images.githubusercontent.com/236501/85893648-1c92e880-b7a8-11ea-926d-95355b8175c7.png" width="128" height="128" /></p> | ||
## Versions | ||
| Plugin | Capacitor | Documentation | | ||
| ------ | --------- | --------------------------------------------------------------------------------- | | ||
| 1.x | 3.x | [README](https://github.com/capacitor-community/bluetooth-le/blob/main/README.md) | | ||
| 0.x | 2.x | [README](https://github.com/capacitor-community/bluetooth-le/blob/0.x/README.md) | | ||
## Introduction | ||
@@ -63,9 +70,4 @@ | ||
``` | ||
# for Capacitor v2 | ||
npm install @capacitor-community/bluetooth-le@latest | ||
npm install @capacitor-community/bluetooth-le | ||
npx cap sync | ||
# for Capacitor v3 | ||
npm install @capacitor-community/bluetooth-le@next | ||
npx cap sync | ||
``` | ||
@@ -72,0 +74,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 14 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12134610
147
3469
666
30