mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-07-25 12:25:20 +00:00
Merge pull request #110 from permissionlesstech/refactor-DESCRIPTOR_UUID
chore: refactor
This commit is contained in:
@@ -32,6 +32,7 @@ class BluetoothGattClientManager(
|
|||||||
// Use exact same UUIDs as iOS version
|
// Use exact same UUIDs as iOS version
|
||||||
private val SERVICE_UUID = UUID.fromString("F47B5E2D-4A9E-4C5A-9B3F-8E1D2C3A4B5C")
|
private val SERVICE_UUID = UUID.fromString("F47B5E2D-4A9E-4C5A-9B3F-8E1D2C3A4B5C")
|
||||||
private val CHARACTERISTIC_UUID = UUID.fromString("A1B2C3D4-E5F6-4A5B-8C9D-0E1F2A3B4C5D")
|
private val CHARACTERISTIC_UUID = UUID.fromString("A1B2C3D4-E5F6-4A5B-8C9D-0E1F2A3B4C5D")
|
||||||
|
private val DESCRIPTOR_UUID = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb")
|
||||||
|
|
||||||
// RSSI monitoring constants
|
// RSSI monitoring constants
|
||||||
private const val RSSI_UPDATE_INTERVAL = 5000L // 5 seconds
|
private const val RSSI_UPDATE_INTERVAL = 5000L // 5 seconds
|
||||||
@@ -389,7 +390,7 @@ class BluetoothGattClientManager(
|
|||||||
}
|
}
|
||||||
|
|
||||||
gatt.setCharacteristicNotification(characteristic, true)
|
gatt.setCharacteristicNotification(characteristic, true)
|
||||||
val descriptor = characteristic.getDescriptor(UUID.fromString("00002902-0000-1000-8000-00805f9b34fb"))
|
val descriptor = characteristic.getDescriptor(DESCRIPTOR_UUID)
|
||||||
if (descriptor != null) {
|
if (descriptor != null) {
|
||||||
descriptor.value = BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE
|
descriptor.value = BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE
|
||||||
gatt.writeDescriptor(descriptor)
|
gatt.writeDescriptor(descriptor)
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ class BluetoothGattServerManager(
|
|||||||
// Use exact same UUIDs as iOS version
|
// Use exact same UUIDs as iOS version
|
||||||
private val SERVICE_UUID = UUID.fromString("F47B5E2D-4A9E-4C5A-9B3F-8E1D2C3A4B5C")
|
private val SERVICE_UUID = UUID.fromString("F47B5E2D-4A9E-4C5A-9B3F-8E1D2C3A4B5C")
|
||||||
private val CHARACTERISTIC_UUID = UUID.fromString("A1B2C3D4-E5F6-4A5B-8C9D-0E1F2A3B4C5D")
|
private val CHARACTERISTIC_UUID = UUID.fromString("A1B2C3D4-E5F6-4A5B-8C9D-0E1F2A3B4C5D")
|
||||||
|
private val DESCRIPTOR_UUID = UUID.fromString("00002902-0000-1000-8000-00805f9b34fb")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Core Bluetooth components
|
// Core Bluetooth components
|
||||||
@@ -253,7 +254,7 @@ class BluetoothGattServerManager(
|
|||||||
)
|
)
|
||||||
|
|
||||||
val descriptor = BluetoothGattDescriptor(
|
val descriptor = BluetoothGattDescriptor(
|
||||||
UUID.fromString("00002902-0000-1000-8000-00805f9b34fb"),
|
DESCRIPTOR_UUID,
|
||||||
BluetoothGattDescriptor.PERMISSION_READ or BluetoothGattDescriptor.PERMISSION_WRITE
|
BluetoothGattDescriptor.PERMISSION_READ or BluetoothGattDescriptor.PERMISSION_WRITE
|
||||||
)
|
)
|
||||||
characteristic?.addDescriptor(descriptor)
|
characteristic?.addDescriptor(descriptor)
|
||||||
|
|||||||
Reference in New Issue
Block a user