Open ChrisHoS opened 3 years ago
Maybe that would do the trick. I was content with the protection_level=1
as a start on Windows. It is not good enough, but it points the way for future expasion at least. I also had no device to test it with...
You are free to try to get it to work, since I will not have time and energy to do it for quite some time I am afraid.
Is the winnt backend restricted to protection_level 1 still?
i'd like to follow up on @patrick-dojofive question. I am attempting to pair with protection_level 2 but the logs I get indicate that the protection level used to pair is protection_level 1(i might also just be doing something wrong). I am working with:
Here are the logs that I was able to collect( i apologize if the logs provided are not sufficient, it is what I was able to get for now but I am working on getting more logs)
2024-06-24 14:41:14 - DEBUG - bleak.backends.winrt.client :: Connecting to BLE device @ CD:5D:68:45:A0:5F
2024-06-24 14:41:14 - DEBUG - bleak.backends.winrt.client :: getting services (service_cache_mode=None, cache_mode=None)...
2024-06-24 14:41:15 - DEBUG - bleak.backends.winrt.client :: max_pdu_size_changed_handler: 251
2024-06-24 14:41:15 - DEBUG - bleak.backends.winrt.client :: session_status_changed_event_handler: id: BluetoothLE#BluetoothLE48:89:e7:29:1c:f5-cd:5d:68:45:a0:5f, error: <BluetoothError.SUCCESS: 0>, status: <GattSessionStatus.ACTIVE: 1>
2024-06-24 14:41:15 - DEBUG - bleak.backends.winrt.client :: CD:5D:68:45:A0:5F: services changed
2024-06-24 14:41:16 - DEBUG - bleak.backends.winrt.client :: CD:5D:68:45:A0:5F: services changed
2024-06-24 14:41:17 - INFO - bluetooth_controller :: Connected: True
2024-06-24 14:41:17 - DEBUG - bluetooth_controller :: 123456
2024-06-24 14:41:19 - INFO - bleak.backends.winrt.client :: device id: 'BluetoothLE#BluetoothLE48:89:e7:29:1c:f5-cd:5d:68:45:a0:5f'
2024-06-24 14:41:19 - INFO - bleak.backends.winrt.client :: protection level: <DevicePairingProtectionLevel.ENCRYPTION: 2>
2024-06-24 14:41:20 - DEBUG - bleak.backends.winrt.client :: session_status_changed_event_handler: id: BluetoothLE#BluetoothLE48:89:e7:29:1c:f5-cd:5d:68:45:a0:5f, error: <BluetoothError.SUCCESS: 0>, status: <GattSessionStatus.CLOSED: 0>
2024-06-24 14:41:20 - DEBUG - bleak.backends.winrt.client :: max_pdu_size_changed_handler: 23
2024-06-24 14:41:20 - DEBUG - bleak.backends.winrt.client :: closing requester
2024-06-24 14:41:20 - DEBUG - bleak.backends.winrt.client :: closing session
2024-06-24 14:41:20 - INFO - bleak.backends.winrt.client :: Pairing result: 0, Protection level used: 1
2024-06-24 14:41:20 - INFO - bleak.backends.winrt.client :: Paired to device with protection level <DevicePairingProtectionLevel.NONE: 1>.
After collecting some more logs, I identified that the issue was most likely due to a mismatch between the client's pairing request and the server's pairing response. Below are some key observations:
Client's(PC) Pairing Request:
Server's Pairing Response:
We are looking into how the server firmware can be configured to match the client's pairing request requirements.
As it is right now though, is there a way that one can use bleak to match the client's pairing requirements with those of the server as provided above?
bluetoothctl -v
) in case of Linux:Description
Wanted to pair to a slave with encryption level 2 / Just Works / LE Security Mode 1, Level 2
What I Did
set up the server with Nordic nRF Connect and nRF52840 Dongle![nRF_Connect_Server_with_encrypted_characteristic](https://user-images.githubusercontent.com/27783144/100634036-109aec00-332f-11eb-96af-7de6bca6ba82.png)
connected, tried to pair to slave
Comment:
I apologize for not providing a non-vendor specific example.