diff --git a/src/platforms/app-plus/service/api/device/bluetooth.js b/src/platforms/app-plus/service/api/device/bluetooth.js index 9c4fd18e08eaed3b30bceeb984aa6a452a358e08..8aa0540066dd25dd66fd0921b0a9f042ef5cc033 100644 --- a/src/platforms/app-plus/service/api/device/bluetooth.js +++ b/src/platforms/app-plus/service/api/device/bluetooth.js @@ -1,8 +1,6 @@ import { invoke, - publish, - arrayBufferToBase64, - base64ToArrayBuffer + publish } from '../../bridge' /** @@ -53,16 +51,6 @@ function bluetoothOn (method, beforeSuccess) { return true } -function checkDevices (data) { - data.devices = data.devices.map(device => { - var advertisData = device.advertisData - if (advertisData && typeof advertisData !== 'string') { - device.advertisData = arrayBufferToBase64(advertisData) - } - return device - }) -} - var onBluetoothAdapterStateChange var onBluetoothDeviceFound var onBLEConnectionStateChange @@ -83,7 +71,7 @@ export function getBluetoothAdapterState (data, callbackId) { } export function startBluetoothDevicesDiscovery (data, callbackId) { - onBluetoothDeviceFound = onBluetoothDeviceFound || bluetoothOn('onBluetoothDeviceFound', checkDevices) + onBluetoothDeviceFound = onBluetoothDeviceFound || bluetoothOn('onBluetoothDeviceFound') bluetoothExec('startBluetoothDevicesDiscovery', callbackId, data) } @@ -92,7 +80,7 @@ export function stopBluetoothDevicesDiscovery (data, callbackId) { } export function getBluetoothDevices (data, callbackId) { - bluetoothExec('getBluetoothDevices', callbackId, {}, checkDevices) + bluetoothExec('getBluetoothDevices', callbackId, {}) } export function getConnectedBluetoothDevices (data, callbackId) { @@ -118,18 +106,12 @@ export function getBLEDeviceCharacteristics (data, callbackId) { } export function notifyBLECharacteristicValueChange (data, callbackId) { - onBLECharacteristicValueChange = onBLECharacteristicValueChange || bluetoothOn('onBLECharacteristicValueChange', - data => { - data.value = arrayBufferToBase64(data.value) - }) + onBLECharacteristicValueChange = onBLECharacteristicValueChange || bluetoothOn('onBLECharacteristicValueChange') bluetoothExec('notifyBLECharacteristicValueChange', callbackId, data) } export function notifyBLECharacteristicValueChanged (data, callbackId) { - onBLECharacteristicValueChange = onBLECharacteristicValueChange || bluetoothOn('onBLECharacteristicValueChange', - data => { - data.value = arrayBufferToBase64(data.value) - }) + onBLECharacteristicValueChange = onBLECharacteristicValueChange || bluetoothOn('onBLECharacteristicValueChange') bluetoothExec('notifyBLECharacteristicValueChanged', callbackId, data) } @@ -139,8 +121,5 @@ export function readBLECharacteristicValue (data, callbackId) { } export function writeBLECharacteristicValue (data, callbackId) { - if (typeof data.value === 'string') { - data.value = base64ToArrayBuffer(data.value) - } bluetoothExec('writeBLECharacteristicValue', callbackId, data) }