diff --git a/www/js/bluetooth/BluetoothScanPage.tsx b/www/js/bluetooth/BluetoothScanPage.tsx index d3d34233f..bdb352946 100644 --- a/www/js/bluetooth/BluetoothScanPage.tsx +++ b/www/js/bluetooth/BluetoothScanPage.tsx @@ -40,7 +40,10 @@ const BluetoothScanPage = ({ ...props }: any) => { const [isScanningClassic, setIsScanningClassic] = useState(false); const [isScanningBLE, setIsScanningBLE] = useState(false); const [isClassic, setIsClassic] = useState(false); - const [newUUID, setNewUUID] = useState(null); + const [newUUID, setNewUUID] = useState(null); + const [newIdentifier, setNewIdentifier] = useState(null); + const [newMajor, setNewMajor] = useState(0); + const [newMinor, setNewMinor] = useState(0); const { colors } = useTheme(); // Flattens the `sampleBeacons` into an array of BLEBeaconDevices @@ -171,16 +174,20 @@ const BluetoothScanPage = ({ ...props }: any) => { }; // Add a beacon with the new UUID to the list of BLE devices to scan - function addNewUUID(newUUID: string) { + function addNewUUID(newUUID: string, newIdentifier: string, newMajor: number, newMinor: number) { console.log("Before adding UUID "+newUUID+" entries = "+sampleBLEDevices); const devicesWithAddition = {...sampleBLEDevices}; devicesWithAddition[newUUID] = { - identifier: 'Test-Beacon', - minor: 4949, - major: 3838, + identifier: newIdentifier, + minor: newMajor, + major: newMinor, in_range: false, } setSampleBLEDevices(devicesWithAddition); + setNewUUID(null); + setNewIdentifier(null); + setNewMajor(null); + setNewMinor(null); } const BluetoothCardList = ({ devices }) => { @@ -277,12 +284,28 @@ const BluetoothScanPage = ({ ...props }: any) => { - setNewUUID(t)} - /> -