Files
fastfetch/src/detection/bluetooth/bluetooth_haiku.cpp
T

31 lines
825 B
C++
Raw Normal View History

2025-02-16 20:37:21 +08:00
extern "C" {
#include "bluetooth.h"
2026-01-06 09:48:38 +08:00
#include "common/io.h"
2025-02-16 20:37:21 +08:00
}
#include <bluetooth/LocalDevice.h>
2026-04-09 16:20:59 +08:00
const char* ffDetectBluetooth(FF_A_UNUSED FFBluetoothOptions* options, FFlist* devices /* FFBluetoothResult */) {
2025-02-16 20:37:21 +08:00
using namespace Bluetooth;
FF_SUPPRESS_IO();
2025-02-16 20:37:21 +08:00
LocalDevice* dev = LocalDevice::GetLocalDevice();
2026-03-29 09:28:49 +08:00
if (!dev) {
return NULL;
}
2025-02-16 20:37:21 +08:00
BString devClass;
dev->GetDeviceClass().DumpDeviceClass(devClass);
2026-04-14 10:41:18 +08:00
FFBluetoothResult* device = FF_LIST_ADD(FFBluetoothResult, *devices);
2025-02-16 20:37:21 +08:00
ffStrbufInitS(&device->name, dev->GetFriendlyName());
ffStrbufInitS(&device->address, bdaddrUtils::ToString(dev->GetBluetoothAddress()).String());
ffStrbufInitS(&device->type, devClass.String());
device->battery = 0;
device->connected = true;
// TODO: more devices?
return NULL;
}