Skip to content

Commit

Permalink
Bluetooth (Haiku): WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
CarterLi committed Feb 16, 2025
1 parent 5e615d1 commit 41d930b
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1649,6 +1649,7 @@ elseif(Haiku)
PRIVATE "bnetapi"
PRIVATE "media"
PRIVATE "device"
PRIVATE "bluetooth"
PRIVATE "be"
PRIVATE "gnu"
)
Expand Down
26 changes: 26 additions & 0 deletions src/detection/bluetooth/bluetooth_haiku.cpp
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit 41d930b

Please sign in to comment.