Skip to content

Commit 41d930b

Browse files
committed
Bluetooth (Haiku): WIP
1 parent 5e615d1 commit 41d930b

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,7 @@ elseif(Haiku)
11341134
src/detection/cpucache/cpucache_shared.c
11351135
src/detection/cpuusage/cpuusage_haiku.c
11361136
src/detection/cursor/cursor_nosupport.c
1137-
src/detection/bluetooth/bluetooth_nosupport.c
1137+
src/detection/bluetooth/bluetooth_haiku.cpp
11381138
src/detection/bluetoothradio/bluetoothradio_nosupport.c
11391139
src/detection/disk/disk_haiku.cpp
11401140
src/detection/dns/dns_linux.c
@@ -1649,6 +1649,7 @@ elseif(Haiku)
16491649
PRIVATE "bnetapi"
16501650
PRIVATE "media"
16511651
PRIVATE "device"
1652+
PRIVATE "bluetooth"
16521653
PRIVATE "be"
16531654
PRIVATE "gnu"
16541655
)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
extern "C" {
2+
#include "bluetooth.h"
3+
}
4+
5+
#include <bluetooth/LocalDevice.h>
6+
7+
const char* ffDetectBluetooth(FF_MAYBE_UNUSED FFBluetoothOptions* options, FFlist* devices /* FFBluetoothResult */)
8+
{
9+
using namespace Bluetooth;
10+
LocalDevice* dev = LocalDevice::GetLocalDevice();
11+
if (!dev) return NULL;
12+
13+
BString devClass;
14+
dev->GetDeviceClass().DumpDeviceClass(devClass);
15+
16+
FFBluetoothResult* device = (FFBluetoothResult*) ffListAdd(devices);
17+
ffStrbufInitS(&device->name, dev->GetFriendlyName());
18+
ffStrbufInitS(&device->address, bdaddrUtils::ToString(dev->GetBluetoothAddress()).String());
19+
ffStrbufInitS(&device->type, devClass.String());
20+
device->battery = 0;
21+
device->connected = true;
22+
23+
// TODO: more devices?
24+
25+
return NULL;
26+
}

0 commit comments

Comments
 (0)