百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
B

bluetooth-battery-monitor

> 编程语言
开源

开源 Windows 版蓝牙电池监控器

99 stars0 点赞3 次浏览
访问官网GitHub

工具介绍

开源 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 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C++

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

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