-
Notifications
You must be signed in to change notification settings - Fork 78
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
Convert HCI role and transport into enums #332
base: main
Are you sure you want to change the base?
Conversation
bumble/core.py
Outdated
BT_CENTRAL_ROLE = Role.CENTRAL | ||
BT_PERIPHERAL_ROLE = Role.PERIPHERAL | ||
|
||
class Transport(enum.IntEnum): |
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.
I'd recommend naming this TransportType
, not to confuse with the Transport
object from bumble.transport.common
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.
How about BtTransport
?
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.
Mode ?
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.
Maybe PhysicalTransport
, since that's the term used in the BT spec?
bumble/core.py
Outdated
|
||
BT_CENTRAL_ROLE = Role.CENTRAL | ||
BT_PERIPHERAL_ROLE = Role.PERIPHERAL | ||
|
||
BT_BR_EDR_TRANSPORT = PhysicalTransport.BR_EDR | ||
BT_LE_TRANSPORT = PhysicalTransport.LE | ||
|
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.
what is the reason for these defines? could they be removed?
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.
That's for backward compatibility. There have been an significant usage of these primitive constants, so removing them here will be irresponsible.
As they are widely used as parameters, making them enums can significantly improve the static check.
As they are widely used as parameters, making them enums can significantly improve the static check.