Skip to content

Conversation

@chengkai15
Copy link
Contributor

@chengkai15 chengkai15 commented Sep 26, 2025

Bluetooth: Classic: add power mode control with sniff mode

Summary

This PR implements power mode control for Bluetooth Classic connections, adding support for sniff mode to enable power saving while maintaining connectivity. The feature includes comprehensive APIs, event handling, and shell commands for testing and configuration.

Changes

  • Power Mode APIs: Add bt_conn_br_enter_sniff_mode() and bt_conn_br_exit_sniff_mode() APIs with parameter validation
  • Mode Change Notification: Implement HCI mode change event handling and br_mode_changed callback for application notification
  • Shell Integration: Add set_sniff_mode shell command for testing power mode transitions
  • Configuration Option: Introduce CONFIG_BT_POWER_MODE_CONTROL Kconfig option to enable the feature

Technical Details

  • Supports configurable sniff mode parameters: min/max interval, attempt count, and timeout
  • Handles mode transitions between active and sniff modes with proper state tracking
  • Implements comprehensive parameter validation according to Bluetooth specification
  • Provides real-time callback notifications for mode changes including interval information
  • Maintains connection state consistency during power mode transitions

Features

  • Fine-grained Control: Applications can optimize power consumption based on use case requirements
  • Event-driven Notifications: Applications receive callbacks when connection mode changes
  • Shell Testing: Complete shell integration for development and testing purposes
  • Backward Compatibility: Maintains existing functionality when feature is disabled

Testing

  • Verified sniff mode entry/exit functionality via shell commands
  • Tested parameter validation with various valid and invalid inputs
  • Confirmed mode change callback notifications work correctly
  • Validated state consistency during mode transitions
  • Tested interoperability with remote Bluetooth devices

Impact

  • Enables significant power savings for Bluetooth Classic applications
  • Provides foundation for advanced power management features
  • Maintains full Bluetooth specification compliance
  • No impact on existing functionality when disabled via Kconfig

This power mode control feature is essential for battery-powered Bluetooth Classic devices requiring optimized power consumption while maintaining reliable connections.

@zephyrbot zephyrbot added area: Bluetooth area: Bluetooth Classic Bluetooth Classic (BR/EDR) area: Bluetooth Host Bluetooth Host (excluding BR/EDR) labels Sep 26, 2025
@chengkai15 chengkai15 changed the title Blueototh: add sniff mode feature Blueototh: Classic: add sniff mode feature Sep 26, 2025
@hermabe hermabe removed their request for review September 26, 2025 11:54
@Thalley Thalley removed their request for review September 26, 2025 11:56
@HaavardRei HaavardRei removed their request for review September 30, 2025 13:12
@cvinayak cvinayak removed their request for review October 15, 2025 06:42
gzh-terry
gzh-terry previously approved these changes Oct 21, 2025
@jhedberg
Copy link
Member

@chengkai15 please fix the typo in the commit message title (s/Blueototh/Bluetooth/)

@chengkai15 chengkai15 changed the title Blueototh: Classic: add sniff mode feature Bluetooth: Classic: add power mode control with sniff mode Oct 21, 2025
gzh-terry
gzh-terry previously approved these changes Oct 22, 2025
Implement BR/EDR power mode control with sniff mode functionality.
Adds APIs bt_conn_br_enter_sniff_mode() and bt_conn_br_exit_sniff_mode()
to manage power saving modes. Includes parameter validation and HCI
command handling for sniff mode configuration with min/max intervals,
attempt count, and timeout parameters.

Signed-off-by: Kai Cheng <[email protected]>
Implement mode change event handling and callback notification for
BR/EDR power mode transitions. Adds br_mode_changed callback to
notify applications when connection switches between active and
sniff modes. Handles HCI mode change events and propagates mode
and interval information to registered callbacks.

Signed-off-by: Kai Cheng <[email protected]>
Add shell command for testing BR/EDR power mode control. Supports
entering sniff mode with configurable parameters (min/max interval,
attempt, timeout) and exiting back to active mode. Provides real-time
feedback on mode change requests and status.

Signed-off-by: Kai Cheng <[email protected]>
@sonarqubecloud
Copy link

@jhedberg jhedberg merged commit 1de17dc into zephyrproject-rtos:main Oct 22, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Bluetooth Classic Bluetooth Classic (BR/EDR) area: Bluetooth Host Bluetooth Host (excluding BR/EDR) area: Bluetooth

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants