From 8e349d404610010fd538ea6073b018f0490e3599 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Mon, 27 Nov 2023 21:05:21 +0100 Subject: [PATCH] Add ioctl's for the bluetooth authentication For dive computers which are using an application specific proprietary pairing mechanism instead of the standard bluetooth pairing, we need to be able to exchange some additional information with the application. Therefore, 3 new BLE specific ioctl's are added: When a device has not been paired yet, libdivecomputer will request the PIN code from the application with DC_IOCTL_BLE_GET_PINCODE. Once the device has been paired successfully, the access code is passed back to the application with DC_IOCTL_BLE_SET_ACCESSCODE. On the next download, libdivecomputer will request this access code again from the application with DC_IOCTL_BLE_GET_ACCESSCODE. If no access code is available, the pairing procedure will start again by requesting the PIN. --- include/libdivecomputer/ble.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/libdivecomputer/ble.h b/include/libdivecomputer/ble.h index 1452873..a13fe87 100644 --- a/include/libdivecomputer/ble.h +++ b/include/libdivecomputer/ble.h @@ -33,6 +33,21 @@ extern "C" { */ #define DC_IOCTL_BLE_GET_NAME DC_IOCTL_IOR('b', 0, DC_IOCTL_SIZE_VARIABLE) +/** + * Get the bluetooth authentication PIN code. + * + * The data format is a NULL terminated string. + */ +#define DC_IOCTL_BLE_GET_PINCODE DC_IOCTL_IOR('b', 1, DC_IOCTL_SIZE_VARIABLE) + +/** + * Get/set the bluetooth authentication access code. + * + * The data format is a variable sized byte array. + */ +#define DC_IOCTL_BLE_GET_ACCESSCODE DC_IOCTL_IOR('b', 2, DC_IOCTL_SIZE_VARIABLE) +#define DC_IOCTL_BLE_SET_ACCESSCODE DC_IOCTL_IOW('b', 2, DC_IOCTL_SIZE_VARIABLE) + #ifdef __cplusplus } #endif /* __cplusplus */