Skip to content
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

Bluetooth: Classic: Gap: add link mode policy handle code #83350

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Frozen935
Copy link

Add bt_conn_enter_sniff_mode/bt_conn_exit_sniff_mode api control the sniff mode, handle BT_HCI_EVT_MODE_CHANGE event to notify the host that the mode has been changed and link_mode_changed callback to notify application.

@Frozen935
Copy link
Author

Frozen935 commented Dec 24, 2024

@jhedberg In our Bluetooth service, there is a power manager module similar to Android that uses these interfaces power_manager.c

@hongshui3000
Copy link
Contributor

By the way, general classic Bluetooth products such as headphones use these interfaces to manage SOC power consumption.

Copy link
Contributor

@lylezhu2012 lylezhu2012 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is recommended to add a kConfig to control this feature.

include/zephyr/bluetooth/conn.h Outdated Show resolved Hide resolved
include/zephyr/bluetooth/conn.h Outdated Show resolved Hide resolved
subsys/bluetooth/host/classic/br.c Outdated Show resolved Hide resolved
include/zephyr/bluetooth/conn.h Outdated Show resolved Hide resolved
subsys/bluetooth/host/conn.c Outdated Show resolved Hide resolved
subsys/bluetooth/host/conn.c Outdated Show resolved Hide resolved
subsys/bluetooth/host/conn.c Outdated Show resolved Hide resolved
subsys/bluetooth/host/conn.c Show resolved Hide resolved
subsys/bluetooth/host/conn.c Outdated Show resolved Hide resolved
cp->handle = sys_cpu_to_le16(conn->handle);
cp->max_interval = sys_cpu_to_le16(max_interval);
cp->min_interval = sys_cpu_to_le16(min_interval);
cp->attempt = sys_cpu_to_le16(attempt);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The range of attempt is 1 to Tsniff÷2. I think the range of attempt also need to be checked.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tsniff(interval) is a negotiation results, here given a suggestion range from 1~0x1F3, some platform attempt is a fixed value 2 or 4.
How to deal with this more reasonably.

Add bt_conn_enter_sniff_mode/bt_conn_exit_sniff_mode api control
the sniff mode, handle BT_HCI_EVT_MODE_CHANGE event to notify
the host that the mode has been changed and link_mode_changed
callback to notify application.

Signed-off-by: fangzhenwei <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants