Conversation
| print() | ||
| print(color('LMP Features:', 'yellow')) | ||
| # TODO: support printing discrete enum values | ||
| print(' ', response.return_parameters.lmp_features.hex()) |
There was a problem hiding this comment.
I think it would be helpful to parse features into set or IntFlag or something else because sometimes we need to check controller capabilities for both dev and product evaluation.
There was a problem hiding this comment.
I agree. I'll try to add that in a separate PR.
f58fb83 to
00ed035
Compare
| ) | ||
| if response.return_parameters.status == HCI_SUCCESS: | ||
| if response.return_parameters.max_page_number > 0: | ||
| print() |
There was a problem hiding this comment.
Is the empty line intended?
There was a problem hiding this comment.
Yes. That's to ensure a blank line before the section.
bumble/controller.py
Outdated
|
|
||
|
|
||
| # ----------------------------------------------------------------------------- | ||
| def supported_commands_as_bytes(supported_commands): |
There was a problem hiding this comment.
| def supported_commands_as_bytes(supported_commands): | |
| def supported_commands_as_bytes(supported_commands: Sequence[HCI_Command]) -> bytes: |
bumble/controller.py
Outdated
|
|
||
|
|
||
| # ----------------------------------------------------------------------------- | ||
| def le_supported_features_as_bytes(supported_features): |
There was a problem hiding this comment.
| def le_supported_features_as_bytes(supported_features): | |
| def le_supported_features_as_bytes(supported_features: Sequence[int]) -> bytes: |
| ) | ||
| ) is None: | ||
| return bytes([HCI_UNKNOWN_ADVERTISING_IDENTIFIER_ERROR]) | ||
|
|
There was a problem hiding this comment.
nit: Add a TODO here to replace literals with Operation enums
bumble/controller.py
Outdated
| self.start_advertising_timer() | ||
| else: | ||
| self.stop_advertising() | ||
| self.legacy_advertiser.enabled = True |
There was a problem hiding this comment.
| self.legacy_advertiser.enabled = True | |
| self.legacy_advertiser.enabled = False |
bumble/controller.py
Outdated
| @property | ||
| def is_advertising(self): | ||
| return self.advertising_timer_handle is not None | ||
| # Extended advertising |
There was a problem hiding this comment.
Should all advertisers send data on each of them was scheduled?
There was a problem hiding this comment.
This is refactored now
bumble/controller.py
Outdated
| self.advertising_timer_handle = asyncio.get_running_loop().call_soon( | ||
| self.on_advertising_timer_fired | ||
| # Compute the time of the next advertisement | ||
| next_advertisement = min( |
There was a problem hiding this comment.
nit: This could be replaced with a heapq
# Advertiser
def send_advertising_data(self):
...
heappush(timer_heap, (time.time()+interval, self))
def on_advertising_timer_fired(self):
next_advertisement, advertiser = heappop(timer_heap)
advertiser.send_advertising_data()|
By the way, as RootCanal has implemented most of the feature, can we leverage the work instead of remaking the wheels? |
That’s exactly the plan: the local controller class is not intended to be compete and will not be enhanced in the future. It is only there to continue support for basic local unit testing and used by a few external users who have not moved to RootCanal yet. But now that RootCanal is available as a standalone project, the plan is to use that for any sort of full-feature need. |
23dfb1e to
d12b15b
Compare
Enables basic support for extended advertising in the virtual controller object.