Not catching insufficient authentication error in an aioble characteristic read #13573
-
I have the following method to read the Model number characteristic of the Device Information Service:
If the characteristic is not secured, the read works fine. But using another health device that secures the DIS characteristics, an over-the-air sniff shows that the read invokes an insufficient authentication error which, by spec, means I need to invoke pairing and then re-do the operation. At least I know the answer to one question I posted, the library does not handle insufficient authentication errors so the application must. However, I am unable to capture the error. Looking at the source code for the characteristic read in the file aioble.client.py, it appears that an error should raise a GattError exception. However, my code above does not capture that error. Instead the await char.read() never returns though I see the number '15' printed to the screen after the 'got here 2' is printed. I do not know where that 15 comes from. What am I doing wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It turns out the GattError is being raised. I got confused by the fact that I expected more than just the error number when doing print(err) and the value being sent by the peripheral is wrong. The correct value for this situation is insufficient authentication 5 not insufficient encryption 15. It turns out the value being evented is decimal. It is not typed so I do not know if it is a string or an integer. |
Beta Was this translation helpful? Give feedback.
It turns out the GattError is being raised. I got confused by the fact that I expected more than just the error number when doing print(err) and the value being sent by the peripheral is wrong. The correct value for this situation is insufficient authentication 5 not insufficient encryption 15. It turns out the value being evented is decimal. It is not typed so I do not know if it is a string or an integer.