28 lines
718 B
JavaScript
28 lines
718 B
JavaScript
"use strict";
|
|
|
|
import { NativeModules, Platform } from 'react-native';
|
|
const {
|
|
BplScale
|
|
} = NativeModules;
|
|
|
|
/**
|
|
* Scan BLE devices and return weight and impedance.
|
|
* @param scanDurationMs Duration of scan in milliseconds
|
|
* @returns Promise resolving to a list of BLE devices with weight & impedance
|
|
*/
|
|
export const scanDevices = async scanDurationMs => {
|
|
if (Platform.OS !== 'android') {
|
|
throw new Error('BplScale module is only supported on Android.');
|
|
}
|
|
try {
|
|
const devices = await BplScale.scanDevices(scanDurationMs);
|
|
return devices;
|
|
} catch (error) {
|
|
console.error('BLE Scan Error:', error);
|
|
throw error;
|
|
}
|
|
};
|
|
export default {
|
|
scanDevices
|
|
};
|
|
//# sourceMappingURL=index.js.map
|