-
Notifications
You must be signed in to change notification settings - Fork 301
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
Want to use BleakClient within bleak package #582
Comments
I can understand your desire for this; I would also have liked to make Bleak more Pythonic and generate Service, Characteristic and Descriptor instances in runtime to match what the connected peripheral responds that it has. I failed when encountering multiple backends and I retreated to a lower level API instead, in order to get a cross-platform API working before moving on. I never got around to doing that. One main design criteria of Bleak is that it should always be pip-installable and importable right off the bat, and I also want it to be as simple as And, given that your Somewhere down the line you will have to get dirty with the specific implementations anyway, so I cannot see the real world value of an independent import of the A sidenote: there is an add-on package to Bleak that adds a rather large XML with specifications of services and characteristics. This might fit better in with that? Or being a separate package in a similar fashion? |
What I'm suggesting here is purely a slight structural change, with no change to the external API:
On adding the code to (And, on bleak-sigspec: I wasn't aware of it, it looks interesting. I think what I'm trying to do and that package are orthogonal. Bleak-sigspec is another source for the information in 2904 descriptors if the device doesn't provide them. But I have to experiment: I don't quite understand how bleak-sigspec finds the correct XML file based on the UUID or the BleakGattCharacteristic....) |
@jackjansen I'm the author of bleak-sigspec
See get_xml_char It uses the name of the characteristic or gets the name from characteristics uuid with
Then it parses the XML file with the same name, and unpacks data based on its specifications. (which I found to be harder than expected since some characteristics are compounds of another set of characteristics, forcing me to deal with recursion). Also I ended up defining I custom So if you need any help/ have any question I'm glad to help 👍 |
I am in favor of this from a documentation point of view. If we do this, we can document all of the os-specific quirks in one place instead of having 5 copies of the documentation for each method (base, windows, mac, linux, android). I am also in favor of this from an intellesense point of view. The MS VS Code Python tools always pick up the Windows backend no matter which OS is actually being used. |
I didn't have time to work on Bleak for more than a year (which was quite a bit longer than anticipated:-), but I'm going to pick this one up again. I hope to have a pull request shortly (presuming real work doesn't interfere again:-) Plan is to create the |
I would like to have at least
BleakClient
available within bleak, in other words: move the platform-dependent imports from__init__.py
to a new module (sayapi.py
).__init__.py
would then import them from there, but so could other modules within bleak.If you're willing accept a pull request for this let me know.
But
PythonicBleakClient
and the accessor classes are backend-independent, and I don't want to put all the functionality inBaseBleakClient
.The text was updated successfully, but these errors were encountered: