-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Bleio attribute api revamp #2092
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
Conversation
…y: no orphan bleio objects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for these revisions. It's definitely valuable to ensure that everything is attached as expected.
It's still not clear to me:
- How dynamic are the links between Peripheral, Service, Characteristic and Descriptor?
- Is it possible for a service to exist on a peripheral more than once?
- Can we load knowledge of a service like DeviceInformationService separately from us producing it so that we can use it when we discover a device that has it?
I still feel a declarative approach to defining the tree would be best. It would factor out defining how everything connects with actually binding it to a device, local or remote. It would also force naming and documenting each child. Let's chat later about this.
@tannewt and I talked about the structure of the API extensively. I understand his desire to describe a service in a declarative way in a class, with attributes or dictionary lookup for characteristic values. We agreed that is a goal, probably done first in Python and then possibly moved to C. Because the native module API will continue to evolve, we are renaming We would like people to use and test BLE as it stands to help get bugs out and to try new use cases, with the understanding that things may change (for the better). @tannewt Please add comments or correct as you wish. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Looks good! Excited to start building on this!
Service
,Characteristic
, andDescriptor
now are created via a factory classmethod, which takes their parent object:So there can be no unattached attributes, and they can't be reused by accident.
The C code is cleaner and needs less error checking.
@tannewt I changed from Style B to style D, because it leaked less of the abstraction. In the other style (
peripheral.add_service(...)
), one class needed to know the args for the other class's constructor. This is more general.