Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
B

bluetooth-battery-monitor

> 编程语言
Open source

Open source Bluetooth battery monitor for Windows

99 stars0 likes3 views
WebsiteGitHub

About

Open source Bluetooth battery monitor for Windows

Bluetooth Battery Monitor

Open source Bluetooth battery monitor for Windows

Enumerating Bluetooth devices and services

I'm not using UWP, only classic C/C++ API (check out misc directory for more C++ examples).

API calls:

  • SetupDiGetClassDevs / SetupDiEnumDeviceInfo for getting a list of all bluetooth devices.
  • SetupDiGetDeviceRegistryProperty / SPDRP_HARDWAREID for filtering by device address.
  • BluetoothGATTGetServices / BluetoothGATTGetCharacteristics for BLE properties.
  • SetupDiGetDeviceProperty / DEVPKEY_DeviceContainer_IsConnected for connection status.

UUIDs:

  • {e0cbf06c-cd8b-4647-bb8a-263b43f0f974} (Bluetooth Device) for SetupDiGetClassDevs.
  • {00001800-0000-1000-8000-00805F9B34FB} (Generic Attribute) for Appearance (0x2A01).
  • {0000180F-0000-1000-8000-00805F9B34FB} (Battery Service) for Battery Level (0x2A19).
  • {0000180A-0000-1000-8000-00805F9B34FB} (Device Information) for Manufacturer (0x2A29).

Problems and workarounds:

  • The program supports only BLE reports for now. Obtaining battery status is easy for BLE, but HID and HFP devices use their own approach (see HID Usage Tables "Battery Strength" and HFPGetBatteryLevel accordingly). HFP devices also expose HID interface, probably it's all doable with HID API or a system-wide dll hook. Will implement later.
  • BLUETOOTH_GATT_FLAG_FORCE_READ_FROM_DEVICE (0x00000004) timeouts on disconnected devices, check their status first.
  • {00001800-0000-1000-8000-00805F9B34FB} (Generic Attribute) is read only, don't use GENERIC_WRITE in CreateFile.

References

  • Simple example (desktop programming C++) for Bluetooth Low Energy devices
  • How to get connection status of bluetooth LE device
  • Universal Serial Bus (USB) - HID Usage Tables (Hut1_12v2.pdf)
  • HANDS-FREE PROFILE 1.5 (HFP 1.5_SPEC_V10.pdf)
  • HFPApi: HFPGetBatteryLevel

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C++

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言