diff --git a/www/js/bluetooth/BluetoothCard.tsx b/www/js/bluetooth/BluetoothCard.tsx index 561bf9045..d3361badc 100644 --- a/www/js/bluetooth/BluetoothCard.tsx +++ b/www/js/bluetooth/BluetoothCard.tsx @@ -38,13 +38,21 @@ const BluetoothCard = ({ device, isClassic, isScanningBLE }: Props) => { } async function fakeRangeCallback() { - const deviceWithMajorMinor = { ...device }; - deviceWithMajorMinor.major = device.major | 1234; - deviceWithMajorMinor.minor = device.minor | 4567; - deviceWithMajorMinor.monitorResult = undefined; - deviceWithMajorMinor.rangeResult = undefined; + const deviceWithBeacons = { ...device }; + deviceWithBeacons.monitorResult = undefined; + deviceWithBeacons.rangeResult = undefined; + deviceWithBeacons.beacons = [ + {uuid: device.uuid, + major: device.major | 4567, + minor: device.minor | 1945, + proximity: "ProximityNear", + accuracy: Math.random() * 1.33, + rssi: Math.random() * -62} + ] + deviceWithBeacons.minor = device.minor | 4567; + deviceWithBeacons.minor = device.minor | 4567; window['cordova'].plugins.locationManager.getDelegate().didRangeBeaconsInRegion({ - region: deviceWithMajorMinor, + region: deviceWithBeacons, eventType: 'didRangeBeaconsInRegion', state: 'CLRegionStateInside', }); @@ -65,7 +73,7 @@ const BluetoothCard = ({ device, isClassic, isScanningBLE }: Props) => { {device.rangeResult} - + diff --git a/www/js/bluetooth/BluetoothScanPage.tsx b/www/js/bluetooth/BluetoothScanPage.tsx index 6e2387ad3..435a7c4de 100644 --- a/www/js/bluetooth/BluetoothScanPage.tsx +++ b/www/js/bluetooth/BluetoothScanPage.tsx @@ -90,7 +90,8 @@ const BluetoothScanPage = ({ ...props }: any) => { ...prevDevices, [uuid]: { ...prevDevices[uuid], - monitorResult: result, + monitorResult: status? result : undefined, + rangeResult: undefined, in_range: status, }, }));