From d05bc67d02b1d820ca3f5f3c3eb82054cb2be6f3 Mon Sep 17 00:00:00 2001 From: ndeadly <24677491+ndeadly@users.noreply.github.com> Date: Tue, 20 Oct 2026 23:40:48 +0200 Subject: [PATCH] btdrv: add enums for ble event fields --- nx/include/switch/services/btdrv.h | 10 ++++---- nx/include/switch/services/btdrv_types.h | 29 ++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/nx/include/switch/services/btdrv.h b/nx/include/switch/services/btdrv.h index c35289fa9..9a5e40aab 100644 --- a/nx/include/switch/services/btdrv.h +++ b/nx/include/switch/services/btdrv.h @@ -361,7 +361,7 @@ typedef struct { struct { u32 result; ///< 0 for success, non-zero for error. - u8 status; ///< Connection status. 0 = Connected, 2 = Disconnected + u8 status; ///< \ref BtdrvBleConnectionStatus u8 client_if; ///< Client interface handle u8 pad[2]; ///< Padding u32 conn_id; ///< Connection ID @@ -371,7 +371,7 @@ typedef struct { struct { u32 result; ///< 0 for success, non-zero for error. - u8 status; ///< Connection status. 0 = Connected, 2 = Disconnected + u8 status; ///< \ref BtdrvBleConnectionStatus u8 server_if; ///< Server interface handle u8 pad[2]; ///< Padding u32 conn_id; ///< Connection ID @@ -381,9 +381,9 @@ typedef struct { struct { u32 result; ///< 0 for success, non-zero for error. - u8 status; ///< BLE scan status. 1 = Scan complete, 2 = New device found, 0xFF = Scan started - u8 device_type; ///< Device type. 0 = BD/EDR, 1 = BLE, 2 = Dual Mode - u8 ble_addr_type; ///< BLE address type. 0 = Public, 1 = Random, 2 = Public ID, 3 = Random ID + u8 status; ///< \ref BtdrvBleScanStatus + u8 device_type; ///< \ref BtdrvBluetoothDeviceType + u8 ble_addr_type; ///< \ref BtdrvBleAddressType BtdrvAddress address; ///< Device address BtdrvBleAdvertisement ad_list[10]; ///< BLE Advertisement list \ref BtdrvBleAdvertisement u8 count; ///< Number of entries above diff --git a/nx/include/switch/services/btdrv_types.h b/nx/include/switch/services/btdrv_types.h index 7a97f631d..98efb0e6c 100644 --- a/nx/include/switch/services/btdrv_types.h +++ b/nx/include/switch/services/btdrv_types.h @@ -63,6 +63,13 @@ typedef enum { BtdrvConnectionEventType_Suspended = 2, ///< ACL Link is now Suspended. } BtdrvConnectionEventType; +/// BluetoothDeviceType +typedef enum { + BtdrvBluetoothDeviceType_BdEdr = 0, ///< BD/EDR device. + BtdrvBluetoothDeviceType_Ble = 1, ///< BLE device. + BtdrvBluetoothDeviceType_DualMode = 2, ///< Dual mode device. +} BtdrvBluetoothDeviceType; + /// ExtEventType [1.0.0-11.0.1] typedef enum { BtdrvExtEventType_SetTsi = 0, ///< SetTsi (\ref btdrvSetTsi) @@ -141,6 +148,28 @@ typedef enum { BtdrvBleEventType_ServerAttributeOperation = 13, ///< GATT server attribute operation. } BtdrvBleEventType; +/// BleConnectionStatus +typedef enum { + BtdrvBleConnectionStatus_Opened = 0, ///< Connection opened. + BtdrvBleConnectionStatus_Cancelled = 1, ///< Connection cancelled. + BtdrvBleConnectionStatus_Closed = 2, ///< Connection closed. +} BtdrvBleConnectionStatus; + +/// BleScanStatus +typedef enum { + BtdrvBleScanStatus_ScanCompleted = 1, ///< Scan completed. + BtdrvBleScanStatus_DeviceFound = 2, ///< New device found. + BtdrvBleScanStatus_ScanStarted = 255, ///< Scan started. +} BtdrvBleScanStatus; + +/// BleAddressType +typedef enum { + BtdrvBleAddressType_Public = 0, ///< Public address. + BtdrvBleAddressType_Random = 1, ///< Random address. + BtdrvBleAddressType_PublicId = 2, ///< Public identity. + BtdrvBleAddressType_RandomId = 3, ///< Random identity. +} BtdrvBleAddressType; + /// BleScanFilterAction typedef enum { BtdrvBleScanFilterAction_Add = 0,