Skip to content

Commit

Permalink
ble: fix api for bt_conn_cb_register
Browse files Browse the repository at this point in the history
The api for function bt_conn_cb_register has been changed
this commit applies the change

Signed-off-by: Robert Gałat <robert.galat@nordicsemi.no>
  • Loading branch information
RobertGalatNordic committed Jul 13, 2024
1 parent e9b6596 commit 01acb56
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG DEBIAN_FRONTEND=noninteractive

ARG tools_version_major=10
ARG tools_version_minor=24
ARG tools_version_patch=0
ARG tools_version_patch=2

ARG command_line_tools_name=nrf-command-line-tools_${tools_version_major}.${tools_version_minor}.${tools_version_patch}_amd64.deb
ARG command_line_tools_url=https://nsscprodmedia.blob.core.windows.net/prod/software-and-other-downloads/desktop-software/nrf-command-line-tools/sw/versions-${tools_version_major}-x-x/${tools_version_major}-${tools_version_minor}-${tools_version_patch}/${command_line_tools_name}
Expand Down
11 changes: 10 additions & 1 deletion subsys/sal/sid_pal/src/sid_ble_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,16 @@ void sid_ble_conn_init(void)
static bool bt_conn_registered;

if (!bt_conn_registered) {
bt_conn_cb_register(&conn_callbacks);
int e = bt_conn_cb_register(&conn_callbacks);
switch (e) {
case 0:
case -EEXIST:
break;
default: {
LOG_ERR("bt_conn_cb_register failed with error: %d = %s", e, strerror(e));
return;
}
}
bt_gatt_cb_register(&gatt_callbacks);
bt_conn_registered = true;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/pal_ble_adapter/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ FAKE_VALUE_FUNC(int, bt_le_adv_start, const struct bt_le_adv_param *, const stru
size_t, const struct bt_data *, size_t);

FAKE_VALUE_FUNC(int, bt_le_adv_stop);
FAKE_VOID_FUNC(bt_conn_cb_register, struct bt_conn_cb *);
FAKE_VALUE_FUNC(int, bt_conn_cb_register, struct bt_conn_cb *);
FAKE_VALUE_FUNC(struct bt_conn *, bt_conn_ref, struct bt_conn *);
FAKE_VOID_FUNC(bt_conn_unref, struct bt_conn *);
FAKE_VALUE_FUNC(const bt_addr_le_t *, bt_conn_get_dst, const struct bt_conn *);
Expand Down
2 changes: 1 addition & 1 deletion tests/unit_tests/sid_ble_connection/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

DEFINE_FFF_GLOBALS;

FAKE_VOID_FUNC(bt_conn_cb_register, struct bt_conn_cb *);
FAKE_VALUE_FUNC(int, bt_conn_cb_register, struct bt_conn_cb *);
FAKE_VOID_FUNC(bt_gatt_cb_register, struct bt_gatt_cb *);
FAKE_VALUE_FUNC(struct bt_conn *, bt_conn_ref, struct bt_conn *);
FAKE_VOID_FUNC(bt_conn_unref, struct bt_conn *);
Expand Down

0 comments on commit 01acb56

Please sign in to comment.