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: Add a callback for notifying the previous bond state. #66

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

Conversation

chejinxian
Copy link
Contributor

bug: v/54141

@chejinxian chejinxian requested a review from hyson710 as a code owner February 19, 2025 12:23
Copy link

@HanJing755 HanJing755 left a comment

Choose a reason for hiding this comment

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

LGTM

* // Handle bond state change
* }
*/
typedef void (*on_bond_state_changed_callback_v2)(void* cookie, bt_address_t* addr, bt_transport_t transport, bond_state_t previous_state, bond_state_t current_state, bool is_ctkd);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

parameter is enough?

/* callback bonding */
CALLBACK_FOREACH(CBLIST, adapter_callbacks_t, on_bond_state_changed,
addr, BT_TRANSPORT_BREDR, BOND_STATE_BONDING, false);
CALLBACK_FOREACH(CBLIST, adapter_callbacks_t, on_bond_state_changed_v2,
addr, BT_TRANSPORT_BREDR, previous_state, BOND_STATE_BONDING, false);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. initial value;
  2. power on;
  3. recommand v2 before v1.
  4. notify bonding once or bonding to bonding.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

LE remote cancel pair

@@ -512,6 +534,7 @@ typedef struct {
on_connect_request_callback on_connect_request;
on_connection_state_changed_callback on_connection_state_changed;
on_bond_state_changed_callback on_bond_state_changed;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

client notify twice in different callback

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In order to be compatible with the way Local calls are made, the IPC message code cannot be reused.

@chejinxian chejinxian force-pushed the dev-bt branch 4 times, most recently from 42ce98e to c0a1027 Compare February 22, 2025 12:35
bug: v/54141

Signed-off-by: chejinxian1 <chejinxian1@xiaomi.com>
* @param transport - Transport type, see @ref bt_transport_t (0: LE, 1: BR/EDR).
* @param previous_state - Previous bond state, see @ref bond_state_t.
* @param current_state - Current bond state, see @ref bond_state_t.
* @param is_ctkd - Whether cross-transport key derivation is used.
Copy link
Contributor

Choose a reason for hiding this comment

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

true if cross-transport key derivation is used.

* @param current_state - Current bond state, see @ref bond_state_t.
* @param is_ctkd - Whether cross-transport key derivation is used.
*
* **Example:**
Copy link
Contributor

Choose a reason for hiding this comment

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

An empty callback is not really informative. Can remove it.

@@ -2746,11 +2774,6 @@ bt_status_t adapter_pair_request_reply(bt_address_t* addr, bool accept)
adapter_unlock();
bt_status_t status;
status = bt_sal_pair_reply(PRIMARY_ADAPTER, addr, accept ? 0 : HCI_ERR_PAIRING_NOT_ALLOWED);
if (status == BT_STATUS_SUCCESS && accept) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

keep

Copy link
Contributor Author

Choose a reason for hiding this comment

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

history

@@ -544,10 +544,16 @@ static void process_bond_state_change_evt(bt_address_t* addr, bond_state_t state
{
remote_device_properties_t remote;
bt_device_t* device;
bond_state_t old_state;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

definition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants