Bluetooth (Haiku): WIP

This commit is contained in:
Carter Li 2025-02-16 20:37:21 +08:00
parent 5e615d12d5
commit 41d930b1e1
2 changed files with 28 additions and 1 deletions

View File

@ -1134,7 +1134,7 @@ elseif(Haiku)
src/detection/cpucache/cpucache_shared.c
src/detection/cpuusage/cpuusage_haiku.c
src/detection/cursor/cursor_nosupport.c
src/detection/bluetooth/bluetooth_nosupport.c
src/detection/bluetooth/bluetooth_haiku.cpp
src/detection/bluetoothradio/bluetoothradio_nosupport.c
src/detection/disk/disk_haiku.cpp
src/detection/dns/dns_linux.c
@ -1649,6 +1649,7 @@ elseif(Haiku)
PRIVATE "bnetapi"
PRIVATE "media"
PRIVATE "device"
PRIVATE "bluetooth"
PRIVATE "be"
PRIVATE "gnu"
)

View File

@ -0,0 +1,26 @@
extern "C" {
#include "bluetooth.h"
}
#include <bluetooth/LocalDevice.h>
const char* ffDetectBluetooth(FF_MAYBE_UNUSED FFBluetoothOptions* options, FFlist* devices /* FFBluetoothResult */)
{
using namespace Bluetooth;
LocalDevice* dev = LocalDevice::GetLocalDevice();
if (!dev) return NULL;
BString devClass;
dev->GetDeviceClass().DumpDeviceClass(devClass);
FFBluetoothResult* device = (FFBluetoothResult*) ffListAdd(devices);
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;
}