getBluetoothDevices
getBluetoothDevices
Info
getBluetoothDevices is a synchronous query function that returns Bluetooth device information via WMI. It spawns the C# helper EXE which queries Win32_PnPEntity with PNPClass = 'Bluetooth', returning an array of BluetoothDeviceInfo objects.
Signature
function getBluetoothDevices(): BluetoothDeviceInfo[];Return Value
| Type | Description |
|---|---|
BluetoothDeviceInfo[] | Array of Bluetooth device information |
Warning
This returns all Bluetooth PnP entities — including Bluetooth radios, HCI devices, and protocol drivers — not just user-paired peripherals.
Usage
Use this function for a quick overview of Bluetooth devices on the system. For richer data (connection state, signal strength, battery level), use @eisland/windows-bluetooth-helper.
Note
This is a lightweight query using WMI, suitable for system info panels. The Bluetooth Helper plugin uses WinRT APIs for more detailed enumeration and real-time monitoring.
Tips
Filter by status === 'OK' to show only active, functioning devices.
Example
import { getBluetoothDevices } from '@eisland/windows-hardware-info-helper';
const devices = getBluetoothDevices();
const active = devices.filter(d => d.status === 'OK');
console.log(`Bluetooth devices: ${active.length} active / ${devices.length} total`);
for (const device of active) {
console.log(` ${device.name ?? 'Unknown device'}`);
}const { getBluetoothDevices } = require('@eisland/windows-hardware-info-helper');
const devices = getBluetoothDevices();
const active = devices.filter(d => d.status === 'OK');
console.log(`Bluetooth devices: ${active.length} active / ${devices.length} total`);
for (const device of active) {
console.log(` ${device.name ?? 'Unknown device'}`);
}Notes
Note
The deviceId and pnpDeviceId fields are typically identical for Bluetooth PnP entities.
Tips
For real-time Bluetooth monitoring (device connect/disconnect events), use the BluetoothMonitor class from @eisland/windows-bluetooth-helper.
Important
This function queries the Win32_PnPEntity WMI class, not the WinRT Windows.Devices.Bluetooth API. It provides a system-level view of Bluetooth stack components.
Danger Avoidance
Caution
Do not use this function as the sole source for user-facing Bluetooth device lists. It includes low-level Bluetooth stack components (radios, HCI, protocol drivers) that users don't expect to see. Filter by name patterns or use the Bluetooth Helper plugin for user-facing lists.
Changelog
bb5b2-on

