compat.bluez
BlueZ 5.88 — Linux Bluetooth protocol stack headers and libbluetooth library
mcpp add compat.bluez@5.88
用法
來自本倉庫自己的測試專案 —— CI 真的編譯並執行過,不是為了網站寫的。
#ifdef __linux__
#include <bluetooth/bluetooth.h>
#include <bluetooth/l2cap.h>
#include <bluetooth/uuid.h>
#include <cassert>
#include <cstring>
#include <iostream>
int main() {
// Positive check: address formatting and parsing via libbluetooth.
bdaddr_t addr{};
assert(str2ba("11:22:33:44:55:66", &addr) == 0);
char formatted[18]{};
assert(ba2str(&addr, formatted) == 17);
assert(std::strcmp(formatted, "11:22:33:44:55:66") == 0);
// Positive check: UUID string conversion via uuid.c + struct sockaddr_l2 layout.
bt_uuid_t uuid{};
assert(bt_string_to_uuid(&uuid, "0000180d-0000-1000-8000-00805f9b34fb") == 0);
sockaddr_l2 l2{};
// …
tests/examples/bluez/tests/bluez.cpp · 專案 tests/examples/bluez
建置
- targets
bluetooth (static)- language
c++23- C standard
c11- import std
- no
- include dirs
*/lib, */lib/bluetooth
原始檔 (4)
*/lib/bluetooth/bluetooth.c*/lib/bluetooth/hci.c*/lib/bluetooth/sdp.c*/lib/bluetooth/uuid.c