-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Address validation in MacOS #26
Comments
I've started to debug and made a utility function (in def get_address_or_uuid(sensor):
"""Return MAC (Windows, Linux) or UUID (macOS)."""
system = platform.system()
if system in ["Linux", "Windows"]:
return sensor.address().toString()
elif system == "Darwin":
return sensor.deviceUuid().toString()[1:-1] # slice to strip off curly braces This replaces use of the However, this regex: Line 17 in 89eef2c
does not match with the uuid of my polar H10. The culprit seems to be this part: [089ab][0-9a-f]{3} (second to last grouping between dashes).Is there a document that this particular regex comes from? I assume it's trying to validate that it's a Polar device? |
I suspect I took the regex from this SO post (can't say for sure though): https://stackoverflow.com/questions/7905929/how-to-test-valid-uuid-guid. The regex should capture UUIDs according to the RFC 4122 specification, which should be compatible with the format that Apple devices seem to use when interacting with Bluetooth peripherals. |
Nice. Posting the respective Qt docs here for future reference: https://doc.qt.io/qt-6/qbluetoothdeviceinfo.html#address |
The call to Calling Line 69 in 89eef2c
See https://doc.qt.io/qt-6/qlowenergycontroller.html#remoteAddress vs https://doc.qt.io/qt-6/qlowenergycontroller.html#remoteDeviceUuid Looks like it'd be good to centralize the logic that handles the platform-specific sensor identification (per MAC or UUID). |
Nice. I guess this means implementing a second utility function |
As far as I can tell, my H10 is returning a non-compliant uuid. (second to last grouping begins with Is there a reason to require that the uuid be compliant with standards. Would it be ok to simply require a pseudo-UUID to be formatted with the correct number of hex characters and dashes? |
I'm also on MacOS with Polar H10. I can see my device but can't connect. Invalid sensor address: cd818013-47f2-e83e-dc7c-05f6a924a5ad. |
Bluetooth address validation fails on MacOS when the
connect
button is pressed. The address returned by theQBluetoothDeviceInfo.address()
function is all zeros.The text was updated successfully, but these errors were encountered: