Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2fb1278
Memory Optimization: Change the bluetooth ble impl module adv_callbac…
huangyulong3 Jan 26, 2026
17c25a0
Memory Optimization: Change the bluetooth gatt feature module s_featu…
huangyulong3 Jan 26, 2026
2e4f8c5
Memory Optimization: Change the bluetooth socket advertiser module ad…
huangyulong3 Jan 26, 2026
d336bd4
Memory Optimization: Change the bluetooth socket scan module adv_call…
huangyulong3 Jan 26, 2026
19129f2
Memory Optimization: Change the bluetooth socket spp module g_spp_soc…
huangyulong3 Jan 26, 2026
a32d4b5
Memory Optimization: Change the bluetooth hid device service module t…
huangyulong3 Jan 26, 2026
09c2a75
Memory Optimization: Change the bluetooth spp service module to const…
huangyulong3 Jan 26, 2026
d4c652a
Memory Optimization: Change the bluetooth sal a2dp interface module t…
huangyulong3 Jan 26, 2026
52a1184
Memory Optimization: Change the bluetooth sal adapter interface modul…
huangyulong3 Jan 26, 2026
66a35aa
Memory Optimization: Change the bluetooth sal le adapter interface mo…
huangyulong3 Feb 3, 2026
9fd2be3
Memory Optimization: Change the bluetooth sal avrcp interface module …
huangyulong3 Feb 3, 2026
a729b92
Memory Optimization: Change the bluetooth sal hfp ag interface module…
huangyulong3 Feb 3, 2026
bfb7fcf
Memory Optimization: Change the bluetooth sal hfp hf interface module…
huangyulong3 Feb 3, 2026
70000ee
Memory Optimization: Change the bluetooth sal hid device interface mo…
huangyulong3 Feb 3, 2026
de903e3
Memory Optimization: Change the bluetooth sal spp device interface mo…
huangyulong3 Feb 3, 2026
0756115
Memory Optimization: Change the bluetooth bt_tool a2dp source module …
huangyulong3 Feb 3, 2026
08f66e4
Memory Optimization: Change the bluetooth bt_tool adv module to const…
huangyulong3 Feb 3, 2026
34752da
Memory Optimization: Change the bluetooth bt_tool async adv module to…
huangyulong3 Feb 3, 2026
76e6d21
Memory Optimization: Change the bluetooth bt_tool async gap module to…
huangyulong3 Feb 3, 2026
6fc9939
Memory Optimization: Change the bluetooth bt_tool async gatt client m…
huangyulong3 Feb 3, 2026
bf2a772
Memory Optimization: Change the bluetooth bt_tool log module to const…
huangyulong3 Feb 4, 2026
e8a1693
Memory Optimization: Change the bluetooth bt_tool scan module to cons…
huangyulong3 Feb 4, 2026
77701d6
Memory Optimization: Change the bluetooth bt_tool module to const for…
huangyulong3 Feb 4, 2026
3e0cc82
Memory Optimization: Change the bluetooth bt_tool gatt client module …
huangyulong3 Feb 4, 2026
967cef6
Memory Optimization: Change the bluetooth bt_tool gatt server module …
huangyulong3 Feb 4, 2026
be55be5
Memory Optimization: Change the bluetooth bt_tool hfp ag module to co…
huangyulong3 Feb 4, 2026
53562ec
Memory Optimization: Change the bluetooth bt_tool hfp hf module to co…
huangyulong3 Feb 4, 2026
b6c4dcf
Memory Optimization: Change the bluetooth bt_tool hid device module t…
huangyulong3 Feb 4, 2026
7a977c2
Memory Optimization: Change the bluetooth bt_tool log module to const…
huangyulong3 Feb 4, 2026
3700404
Memory Optimization: Change the bluetooth bt_tool scan module to cons…
huangyulong3 Feb 4, 2026
a865fae
Memory Optimization: Change the bluetooth bt_tool spp module to const…
huangyulong3 Feb 4, 2026
2334ef7
Memory Optimization: Change the bluetooth bt_tool storage tool module…
huangyulong3 Feb 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions feature/feature_async/src/bluetooth_ble_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ static void on_advertising_stopped_cb(bt_advertiser_t* adv, uint8_t adv_id)
adv_info->busy = false;
}

static advertiser_callback_t adv_callback = {
static const advertiser_callback_t adv_callback = {
sizeof(adv_callback),
on_advertising_start_cb,
on_advertising_stopped_cb
Expand Down Expand Up @@ -595,7 +595,7 @@ void system_bluetooth_ble_Advertiser_interface_adv_startAdvertising(FeatureInter
adv_info->start_userdata = (void*)data;

status = bt_le_start_advertising_async(adv_info->ins, &adv_params,
p_adv_data, adv_len, p_scan_rsp_data, scan_rsp_len, &adv_callback,
p_adv_data, adv_len, p_scan_rsp_data, scan_rsp_len, (advertiser_callback_t*)&adv_callback,
Copy link
Contributor

Choose a reason for hiding this comment

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

why do const cast?

start_adv_cb, (void*)data);

if (status != BT_STATUS_SUCCESS) {
Expand Down Expand Up @@ -1563,7 +1563,7 @@ static void mtu_updated_callback(gattc_handle_t conn_handle, gatt_status_t statu
bt_list_remove(gattc_info->userdata_list, data);
}

static bt_gattc_feature_callbacks_t gattc_cbs = {
static const bt_gattc_feature_callbacks_t gattc_cbs = {
sizeof(gattc_cbs),
.on_connected = connect_callback,
.on_disconnected = disconnect_callback,
Expand Down Expand Up @@ -1761,7 +1761,7 @@ void system_bluetooth_ble_GattClient_interface_gattc_connect(FeatureInterfaceHan
gattc_info->gattc->addr_type, gattc_connect_cb, (void*)data);
} else {
status = bt_gattc_feature_create_client_async(gattc_info->ins, &gattc_info->gattc->remote_address, gattc_create_cb,
&gattc_cbs, (void*)data);
(bt_gattc_feature_callbacks_t*)&gattc_cbs, (void*)data);
Copy link
Contributor

Choose a reason for hiding this comment

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

dito
Suggest fix async api as well

}

if (status != BT_STATUS_SUCCESS) {
Expand Down
4 changes: 2 additions & 2 deletions framework/btwrap/async/bt_gatt_feature.c
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ static void feature_on_mtu_updated(void* conn_handle, gatt_status_t status, uint
client->conn, status, mtu);
}

static gattc_callbacks_t s_feature_gattc_cbs = {
static const gattc_callbacks_t s_feature_gattc_cbs = {
sizeof(s_feature_gattc_cbs),
feature_on_connected,
feature_on_disconnected,
Expand Down Expand Up @@ -806,7 +806,7 @@ bt_status_t bt_gattc_feature_create_client_async(bt_instance_t* ins, bt_address_
bt_list_add_tail(g_gatt_client_list, client);

status = bt_gattc_create_connect_async(
ins, &client->conn, &s_feature_gattc_cbs, create_client_cb, client);
ins, &client->conn, (gattc_callbacks_t*)&s_feature_gattc_cbs, create_client_cb, client);

if (status != BT_STATUS_SUCCESS) {
bt_list_remove(g_gatt_client_list, client);
Expand Down
4 changes: 2 additions & 2 deletions service/ipc/socket/src/bt_socket_advertiser.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ static void on_advertising_stopped_cb(bt_advertiser_t* adv, uint8_t adv_id)
free(adv);
}

static advertiser_callback_t g_advertiser_socket_cb = {
static const advertiser_callback_t g_advertiser_socket_cb = {
sizeof(g_advertiser_socket_cb),
on_advertising_start_cb,
on_advertising_stopped_cb,
Expand All @@ -106,7 +106,7 @@ void bt_socket_server_advertiser_process(service_poll_t* poll,
packet->adv_pl._bt_le_start_advertising.adv_len,
packet->adv_pl._bt_le_start_advertising.scan_rsp_data,
packet->adv_pl._bt_le_start_advertising.scan_rsp_len,
&g_advertiser_socket_cb);
(advertiser_callback_t*)&g_advertiser_socket_cb);

if (!packet->adv_r.remote)
free(adver);
Expand Down
4 changes: 2 additions & 2 deletions service/ipc/socket/src/bt_socket_scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ static void on_scan_stopped_cb(bt_scanner_t* scanner)
free(scanner);
}

static scanner_callbacks_t g_scanner_socket_cb = {
static const scanner_callbacks_t g_scanner_socket_cb = {
sizeof(g_scanner_socket_cb),
on_scan_result_cb,
on_scan_status_cb,
Expand All @@ -221,7 +221,7 @@ void bt_socket_server_scan_process(service_poll_t* poll,

scan->ins = ins;
scan->remote = packet->scan_pl._bt_le_start_scan.remote;
packet->scan_r.remote = PTR2INT(uint64_t) scanner_start_scan(scan, &g_scanner_socket_cb);
packet->scan_r.remote = PTR2INT(uint64_t) scanner_start_scan(scan, (scanner_callbacks_t*)&g_scanner_socket_cb);
if (!packet->scan_r.remote)
free(scan);
break;
Expand Down
4 changes: 2 additions & 2 deletions service/ipc/socket/src/bt_socket_spp.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static void spp_connection_state_cb(void* handle, bt_address_t* addr,

bt_socket_server_send(ins, &packet, BT_SPP_CONNECTION_STATE_CB);
}
static spp_callbacks_t g_spp_socket_cb = {
static const spp_callbacks_t g_spp_socket_cb = {
.size = sizeof(g_spp_socket_cb),
.connection_state_cb = spp_connection_state_cb,
.proxy_state_cb = spp_proxy_state_cb,
Expand All @@ -113,7 +113,7 @@ void bt_socket_server_spp_process(service_poll_t* poll,
switch (packet->code) {
case BT_SPP_REGISTER_APP: {
if (ins->spp_cookie == NULL) {
ins->spp_cookie = profile->register_app(ins, packet->spp_pl._bt_spp_register_app.name_len ? packet->spp_pl._bt_spp_register_app.name : NULL, &g_spp_socket_cb);
ins->spp_cookie = profile->register_app(ins, packet->spp_pl._bt_spp_register_app.name_len ? packet->spp_pl._bt_spp_register_app.name : NULL, (spp_callbacks_t*)&g_spp_socket_cb);
packet->spp_r.handle = PTR2INT(uint64_t) ins->spp_cookie;
} else {
packet->spp_r.handle = 0;
Expand Down
2 changes: 1 addition & 1 deletion service/profiles/hid/hid_device_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ static bt_status_t hid_device_virtual_unplug(bt_address_t* addr)
return status;
}

static hid_device_interface_t deviceInterface = {
static const hid_device_interface_t deviceInterface = {
.size = sizeof(deviceInterface),
.register_callbacks = hid_device_register_callbacks,
.unregister_callbacks = hid_device_unregister_callbacks,
Expand Down
2 changes: 1 addition & 1 deletion service/profiles/spp/spp_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,7 @@ static int spp_dump(void)
return 0;
}

static spp_interface_t sppInterface = {
static const spp_interface_t sppInterface = {
.size = sizeof(sppInterface),
.register_app = spp_register_app,
.unregister_app = spp_unregister_app,
Expand Down
14 changes: 7 additions & 7 deletions service/stacks/zephyr/sal_a2dp_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ NET_BUF_POOL_DEFINE(bt_a2dp_tx_pool, CONFIG_BT_MAX_CONN, CONFIG_ZBLUE_A2DP_SOURC
CONFIG_BT_CONN_TX_USER_DATA_SIZE, NULL);

/* codec information elements for the endpoint */
static struct bt_a2dp_codec_ie sbc_src_ie = {
static const struct bt_a2dp_codec_ie sbc_src_ie = {
.len = 4, /* BT_A2DP_SBC_IE_LENGTH */
.codec_ie = {
0x2B, /* 16000 | 32000 | 44100 | 48000 | mono | dual channel | stereo | join stereo */
Expand Down Expand Up @@ -1104,7 +1104,7 @@ static void zblue_on_stream_recv(struct bt_a2dp_stream* stream,
}
#endif /* CONFIG_BLUETOOTH_A2DP_SINK */

static struct bt_a2dp_stream_ops stream_ops = {
static const struct bt_a2dp_stream_ops stream_ops = {
.configured = zblue_on_stream_configured,
.established = zblue_on_stream_established,
.released = zblue_on_stream_released,
Expand Down Expand Up @@ -1164,7 +1164,7 @@ static uint8_t bt_a2dp_discover_endpoint_cb(struct bt_a2dp* a2dp,
}

a2dp_info->stream = (struct bt_a2dp_stream*)calloc(1, sizeof(struct bt_a2dp_stream));
bt_a2dp_stream_cb_register(a2dp_info->stream, &stream_ops);
bt_a2dp_stream_cb_register(a2dp_info->stream, (struct bt_a2dp_stream_ops*)&stream_ops);

if (a2dp_info->role == SEP_SRC) {
#ifdef CONFIG_BLUETOOTH_A2DP_SOURCE
Expand Down Expand Up @@ -1430,7 +1430,7 @@ static int zblue_on_config_req(struct bt_a2dp* a2dp, struct bt_a2dp_ep* ep,

a2dp_info->stream = (struct bt_a2dp_stream*)calloc(1, sizeof(struct bt_a2dp_stream));
*stream = a2dp_info->stream; /* The a2dp_stream saved in SAL is assigned a value in zblue. */
bt_a2dp_stream_cb_register(a2dp_info->stream, &stream_ops);
bt_a2dp_stream_cb_register(a2dp_info->stream, (struct bt_a2dp_stream_ops*)&stream_ops);
*rsp_err_code = BT_AVDTP_SUCCESS;
return 0;
}
Expand Down Expand Up @@ -1516,7 +1516,7 @@ static void zblue_on_suspend_rsp(struct bt_a2dp_stream* stream, uint8_t rsp_err_
BT_LOGE("%s, suspend fail: %d", __func__, rsp_err_code);
}

static struct bt_a2dp_cb a2dp_cbks = {
static const struct bt_a2dp_cb a2dp_cbks = {
.connected = zblue_on_connected,
.disconnected = zblue_on_disconnected,
.config_req = zblue_on_config_req,
Expand Down Expand Up @@ -1565,7 +1565,7 @@ bt_status_t bt_sal_a2dp_source_init(uint8_t max_connections)
}
#endif /* CONFIG_BLUETOOTH_A2DP_AAC_CODEC */

SAL_CHECK_RET(bt_a2dp_register_cb(&a2dp_cbks), 0);
SAL_CHECK_RET(bt_a2dp_register_cb((struct bt_a2dp_cb*)&a2dp_cbks), 0);

return BT_STATUS_SUCCESS;
#else
Expand Down Expand Up @@ -1605,7 +1605,7 @@ bt_status_t bt_sal_a2dp_sink_init(uint8_t max_connections)
}
#endif /* CONFIG_BLUETOOTH_A2DP_AAC_CODEC */

SAL_CHECK_RET(bt_a2dp_register_cb(&a2dp_cbks), 0);
SAL_CHECK_RET(bt_a2dp_register_cb((struct bt_a2dp_cb*)&a2dp_cbks), 0);

return BT_STATUS_SUCCESS;
#else
Expand Down
22 changes: 11 additions & 11 deletions service/stacks/zephyr/sal_adapter_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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,
Expand Down Expand Up @@ -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);
}
#endif

Expand Down
21 changes: 12 additions & 9 deletions service/stacks/zephyr/sal_adapter_le_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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);
Copy link

Copilot AI Feb 5, 2026

Choose a reason for hiding this comment

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

Casting away const qualifier from g_conn_cbs violates const-correctness. While callback registration functions typically don't modify the callback structures, casting away const when the API expects a non-const pointer is undefined behavior. The proper solution would be to update the bt_conn_cb_register API signature to accept a const struct bt_conn_cb* parameter.

Copilot uses AI. Check for mistakes.
#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);
#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
}

Expand Down
2 changes: 1 addition & 1 deletion service/stacks/zephyr/sal_avrcp_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ static void zblue_on_tg_register_notification_req(struct bt_avrcp_tg* tg, uint8_
static void zblue_on_tg_set_absolute_volume_req(struct bt_avrcp_tg* tg, uint8_t tid, uint8_t absolute_volume);
#endif

static struct bt_avrcp_tg_cb avrcp_tg_cbks = {
static const struct bt_avrcp_tg_cb avrcp_tg_cbks = {
#ifdef CONFIG_BLUETOOTH_AVRCP_TARGET
.unit_info_req = zblue_on_tg_unit_info_req,
.subunit_info_req = zblue_on_tg_subunit_info_req,
Expand Down
4 changes: 2 additions & 2 deletions service/stacks/zephyr/sal_hfp_ag_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ static void zblue_on_ag_transmit_dtmf_code(struct bt_hfp_ag* ag, char code)
hfp_ag_on_received_dtmf(&sal_conn->addr, code);
}

static struct bt_hfp_ag_cb g_hfp_ag_cb = {
static const struct bt_hfp_ag_cb g_hfp_ag_cb = {
.connected = zblue_on_ag_connected,
.disconnected = zblue_on_ag_disconnected,
.sco_connected = zblue_on_ag_sco_connected,
Expand Down Expand Up @@ -992,7 +992,7 @@ bt_status_t bt_sal_hfp_ag_init(uint32_t features, uint8_t max_connection)
BT_LOGD("%s, HFP AG init", __func__);
g_sal_ag_conn_list = bt_list_new(free_connection);

SAL_CHECK_RET(Z_API(bt_hfp_ag_register)(&g_hfp_ag_cb), 0);
SAL_CHECK_RET(Z_API(bt_hfp_ag_register)((struct bt_hfp_ag_cb*)&g_hfp_ag_cb), 0);
return BT_STATUS_SUCCESS;
}

Expand Down
4 changes: 2 additions & 2 deletions service/stacks/zephyr/sal_hfp_hf_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions service/stacks/zephyr/sal_hid_device_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ typedef struct sal_bt_hid_device_mgr {
uint8_t* description;
} sal_bt_hid_device_mgr_t;

static struct bt_sdp_attribute hid_attrs_template[] = {
static const struct bt_sdp_attribute hid_attrs_template[] = {
BT_SDP_NEW_SERVICE,
BT_SDP_LIST(
BT_SDP_ATTR_SVCLASS_ID_LIST,
Expand Down Expand Up @@ -539,7 +539,7 @@ void hid_vc_unplug_callback(struct bt_hid_device* hid)
hid_device_on_virtual_cable_unplug(&hid_conn->addr);
}

static struct bt_hid_device_cb hid_callback = {
static const struct bt_hid_device_cb hid_callback = {
.accept = hid_accept_callback,
.connected = hid_connect_callback,
.disconnected = hid_disconnected_callback,
Expand All @@ -556,7 +556,7 @@ bt_status_t bt_sal_hid_device_init()
int err;
sal_bt_hid_device_mgr_t* hid_mgr = &g_hid_device_mgr;

err = Z_API(bt_hid_device_register)(&hid_callback);
err = Z_API(bt_hid_device_register)((struct bt_hid_device_cb*)&hid_callback);
if (err != 0) {
BT_LOGE("HID register cb fail,err:%d", err);
return BT_STATUS_FAIL;
Expand Down
Loading
Loading