-
Notifications
You must be signed in to change notification settings - Fork 33
Bugfix/fix bluetooth bt tool async scan moudle cb change to const #440
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
base: dev
Are you sure you want to change the base?
Changes from all commits
102bb26
3a22964
c720266
87e380a
23b4b65
c18022b
b784126
94557a9
620988d
1e6f503
cb1ca15
ed8fc42
52fa65c
acd98bd
8cbc23d
4f8316b
866dc40
2b5a492
d7cf6af
368ba01
7ce6ed8
2e94f8c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -149,7 +149,7 @@ static int zblue_on_link_key_load(bt_addr_le_t* addr, uint8_t* key_value, uint8_ | |||||
|
|
||||||
| static bt_security_t g_security_level = BT_SECURITY_L2; | ||||||
|
|
||||||
| static struct bt_conn_cb g_conn_cbs = { | ||||||
| static const struct bt_conn_cb g_conn_cbs = { | ||||||
| #ifndef CONFIG_BT_CONN_REQ_AUTO_HANDLE | ||||||
| .connect_req = zblue_on_connect_req, | ||||||
| #endif /* CONFIG_BT_CONN_REQ_AUTO_HANDLE */ | ||||||
|
|
@@ -166,13 +166,13 @@ static struct bt_conn_cb g_conn_cbs = { | |||||
| }; | ||||||
|
|
||||||
| #if defined(CONFIG_SETTINGS_ZBLUE) | ||||||
| static struct bt_settings_zblue_cb g_setting_cbs = { | ||||||
| static const struct bt_settings_zblue_cb g_setting_cbs = { | ||||||
| .linkkey_notify = zblue_on_link_key_notify, | ||||||
| .linkkey_load = zblue_on_link_key_load, | ||||||
| }; | ||||||
| #endif | ||||||
|
|
||||||
| static struct bt_conn_auth_info_cb g_conn_auth_info_cbs = { | ||||||
| static const struct bt_conn_auth_info_cb g_conn_auth_info_cbs = { | ||||||
| .pairing_complete = zblue_on_br_pairing_complete, | ||||||
| .pairing_complete_ctkd = zblue_on_br_pairing_complete_ctkd, | ||||||
| .pairing_failed = zblue_on_br_pairing_failed, | ||||||
|
|
@@ -653,27 +653,27 @@ static void zblue_on_discovery_complete_cb(const struct bt_br_discovery_result* | |||||
| adapter_on_discovery_state_changed(BT_DISCOVERY_STOPPED); | ||||||
| } | ||||||
|
|
||||||
| static struct bt_br_discovery_cb g_br_discovery_cb = { | ||||||
| static const struct bt_br_discovery_cb g_br_discovery_cb = { | ||||||
| .recv = zblue_on_discovery_recv_cb, | ||||||
| .timeout = zblue_on_discovery_complete_cb | ||||||
| }; | ||||||
|
|
||||||
| static void zblue_register_callback(void) | ||||||
| { | ||||||
| bt_br_discovery_cb_register(&g_br_discovery_cb); | ||||||
| bt_conn_cb_register(&g_conn_cbs); | ||||||
| bt_conn_auth_cb_register(&g_conn_auth_cbs); | ||||||
| bt_conn_auth_info_cb_register(&g_conn_auth_info_cbs); | ||||||
| bt_br_discovery_cb_register((struct bt_br_discovery_cb *)&g_br_discovery_cb); | ||||||
| bt_conn_cb_register((struct bt_conn_cb *)&g_conn_cbs); | ||||||
| bt_conn_auth_cb_register((struct bt_conn_auth_cb *)&g_conn_auth_cbs); | ||||||
| bt_conn_auth_info_cb_register((struct bt_conn_auth_info_cb *)&g_conn_auth_info_cbs); | ||||||
| #ifdef CONFIG_SETTINGS_ZBLUE | ||||||
| bt_setting_cb_register(&g_setting_cbs); | ||||||
| bt_setting_cb_register((struct bt_settings_zblue_cb *)&g_setting_cbs); | ||||||
| #endif | ||||||
| } | ||||||
|
|
||||||
| static void zblue_unregister_callback(void) | ||||||
| { | ||||||
| bt_br_discovery_cb_unregister(&g_br_discovery_cb); | ||||||
| bt_br_discovery_cb_unregister((struct bt_br_discovery_cb *)&g_br_discovery_cb); | ||||||
| bt_conn_auth_cb_register(NULL); | ||||||
| bt_conn_auth_info_cb_unregister(&g_conn_auth_info_cbs); | ||||||
| bt_conn_auth_info_cb_unregister((struct bt_conn_auth_info_cb *)&g_conn_auth_info_cbs); | ||||||
|
||||||
| bt_conn_auth_info_cb_unregister((struct bt_conn_auth_info_cb *)&g_conn_auth_info_cbs); | |
| bt_conn_auth_info_cb_unregister(NULL); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -107,7 +107,10 @@ static enum bt_security_err zblue_on_pairing_accept(struct bt_conn* conn, const | |
| static void zblue_register_callback(void); | ||
| static void zblue_unregister_callback(void); | ||
|
|
||
| static struct bt_conn_cb g_conn_cbs = { | ||
| static le_conn_info_t* le_conn_add(const bt_address_t* addr); | ||
| static le_conn_info_t* le_conn_find(const bt_address_t* addr); | ||
|
|
||
| static const struct bt_conn_cb g_conn_cbs = { | ||
| .connected = zblue_on_connected, | ||
| .disconnected = zblue_on_disconnected, | ||
| #ifdef CONFIG_BT_SMP | ||
|
|
@@ -119,15 +122,15 @@ static struct bt_conn_cb g_conn_cbs = { | |
| #endif | ||
| }; | ||
|
|
||
| static struct bt_conn_auth_info_cb g_conn_auth_info_cbs = { | ||
| static const struct bt_conn_auth_info_cb g_conn_auth_info_cbs = { | ||
| .pairing_complete_ctkd = zblue_on_pairing_complete_ctkd, | ||
| .pairing_complete = zblue_on_pairing_complete, | ||
| .pairing_failed = zblue_on_pairing_failed, | ||
| .bond_deleted = zblue_on_bond_deleted, | ||
| }; | ||
|
|
||
| #if defined(CONFIG_SETTINGS_ZBLUE) | ||
| static struct bt_settings_zblue_cb g_setting_cbs = { | ||
| static const struct bt_settings_zblue_cb g_setting_cbs = { | ||
| .irk_notify = zblue_on_irk_notify, | ||
| .irk_load = zblue_on_irk_load, | ||
| .ltk_notify = zblue_on_ltk_notify, | ||
|
|
@@ -758,22 +761,22 @@ static void zblue_on_bond_deleted(uint8_t id, const bt_addr_le_t* peer) | |
|
|
||
| static void zblue_register_callback(void) | ||
| { | ||
| bt_conn_cb_register(&g_conn_cbs); | ||
| bt_conn_cb_register((struct bt_conn_cb *)&g_conn_cbs); | ||
| #ifdef CONFIG_BT_SMP | ||
| bt_conn_le_auth_cb_register(&g_conn_auth_cbs); | ||
| bt_conn_auth_info_cb_register(&g_conn_auth_info_cbs); | ||
| bt_conn_le_auth_cb_register((struct bt_conn_auth_cb *)&g_conn_auth_cbs); | ||
| bt_conn_auth_info_cb_register((struct bt_conn_auth_info_cb *)&g_conn_auth_info_cbs); | ||
| #endif | ||
| #ifdef CONFIG_SETTINGS_ZBLUE | ||
| bt_setting_cb_register(&g_setting_cbs); | ||
| bt_setting_cb_register((struct bt_settings_zblue_cb *)&g_setting_cbs); | ||
|
Comment on lines
+764
to
+770
|
||
| #endif | ||
| } | ||
|
|
||
| static void zblue_unregister_callback(void) | ||
| { | ||
| bt_conn_cb_unregister(&g_conn_cbs); | ||
| bt_conn_cb_unregister((struct bt_conn_cb *)&g_conn_cbs); | ||
| #ifdef CONFIG_BT_SMP | ||
| bt_conn_le_auth_cb_register(NULL); | ||
| bt_conn_auth_info_cb_unregister(&g_conn_auth_info_cbs); | ||
| bt_conn_auth_info_cb_unregister((struct bt_conn_auth_info_cb *)&g_conn_auth_info_cbs); | ||
| #endif | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -888,7 +888,7 @@ static void zblue_on_current_call(struct bt_hfp_hf* hf, struct bt_hfp_hf_current | |
| hfp_hf_on_current_call_response(&sal_conn->addr, idx, dir, status, mpty, call->number, call->type); | ||
| } | ||
|
|
||
| static struct bt_hfp_hf_cb hf_callbacks = { | ||
| static const struct bt_hfp_hf_cb hf_callbacks = { | ||
| .connected = zblue_on_connected, | ||
| .disconnected = zblue_hf_disconnected, | ||
| .sco_connected = zblue_on_sco_connected, | ||
|
|
@@ -932,7 +932,7 @@ bt_status_t bt_sal_hfp_hf_init(uint32_t hf_features, uint8_t max_connection) | |
| int err; | ||
| g_sal_hf_conn_list = bt_list_new(free_connection); | ||
|
|
||
| err = Z_API(bt_hfp_hf_register)(&hf_callbacks); | ||
| err = Z_API(bt_hfp_hf_register)((struct bt_hfp_hf_cb *)&hf_callbacks); | ||
|
||
|
|
||
| if (err) { | ||
| bt_list_free(g_sal_hf_conn_list); | ||
|
|
||
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.
Casting away const is unsafe. The stream_ops structure is marked const (line 1107), but this cast removes that protection. Verify that bt_a2dp_stream_cb_register doesn't modify the callback structure. If it truly doesn't modify it, consider submitting a patch to Zephyr to make their API const-correct.