-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Roughly implemented the bluetooth scanner into the bluetooth page. Cr…
…eated bluetoothScanner.ts which houses the plugin scan request. I then added in functionality to the BluetoothScanPage to output the data that we get from the scan function.
- Loading branch information
1 parent
4dc111f
commit 2cf7882
Showing
2 changed files
with
55 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
function gatherData(): Promise<string[]> { | ||
return new Promise((resolve, reject) => { | ||
let logs: string[] = []; | ||
|
||
window['bluetoothSerial'].discoverUnpaired( | ||
(devices) => { | ||
logs.push("Successfully scanned, results..."); | ||
devices.forEach(function (device) { | ||
logs.push("ID: " + device.id + " Name: " + device.name); | ||
}); | ||
resolve(logs); | ||
}, | ||
(failure) => { | ||
logs.push("Failed!"); | ||
logs.push("ERROR: " + failure); | ||
console.debug("ERROR: " + failure); | ||
reject(new Error(failure)); | ||
} | ||
); | ||
}); | ||
} | ||
|
||
export { gatherData }; |