-
Notifications
You must be signed in to change notification settings - Fork 17
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
base: dev
Are you sure you want to change the base?
Conversation
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.
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); |
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.
parameter is enough?
service/src/adapter_service.c
Outdated
/* 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); |
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.
- initial value;
- power on;
- recommand v2 before v1.
- notify bonding once or bonding to bonding.
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.
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; |
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.
client notify twice in different callback
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.
In order to be compatible with the way Local calls are made, the IPC message code cannot be reused.
42ce98e
to
c0a1027
Compare
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. |
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.
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:** |
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.
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) { |
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.
keep
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.
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; |
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.
definition
bug: v/54141