UNPKG

@iotize/device-com-ble.cordova

Version:

Bluetooth Low Energy (BLE) for IoTize modules Plugin

26 lines 717 B
import { CordovaBLEError } from "./cordova-ble-error"; export function getIoTizeBleCordovaPlugin() { if (typeof iotizeBLE !== "object") { throw CordovaBLEError.iotizeBLEMissing(); } return iotizeBLE; } export function getScanRecordsFromBytes(bytes) { //LTV encoding const records = []; for (let i = 0; i < bytes.length; i++) { //first byte is length let size = bytes[i]; if (size == 0) { break; } let type = bytes[i + 1]; records.push({ type, data: bytes.slice(i + 2, i + size + 1) }); i += size; } return records; } //# sourceMappingURL=utility.js.map