-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove id from kconfig, as it should not be concern for the user. collisions are prevented by using enum. Signed-off-by: Robert Gałat <[email protected]>
- Loading branch information
1 parent
5b52afe
commit 871ea7b
Showing
7 changed files
with
129 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright (c) 2024 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
*/ | ||
#include <bt_app_callbacks.h> | ||
#include <zephyr/bluetooth/bluetooth.h> | ||
#include <stdbool.h> | ||
#include <zephyr/kernel.h> | ||
|
||
static uint32_t bt_enable_count = 0; | ||
|
||
int app_bt_enable(bt_ready_cb_t cb) | ||
{ | ||
if (bt_enable_count == 0) { | ||
int ret = bt_enable(cb); | ||
if (ret == 0) { | ||
bt_enable_count++; | ||
} | ||
return ret; | ||
} | ||
|
||
bt_enable_count++; | ||
if (cb) { | ||
cb(0); | ||
return 0; | ||
} | ||
} | ||
|
||
int app_bt_disable() | ||
{ | ||
if (bt_enable_count <= 0) { | ||
bt_enable_count = 0; | ||
return -EALREADY; | ||
} | ||
if (bt_enable_count == 1) { | ||
bt_enable_count = 0; | ||
return bt_disable(); | ||
} else { | ||
bt_enable_count--; | ||
return 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright (c) 2024 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause | ||
*/ | ||
|
||
#ifndef SID_PAL_APP_CALLBACKS_H | ||
#define SID_PAL_APP_CALLBACKS_H | ||
|
||
#include <stdbool.h> | ||
#include <zephyr/bluetooth/bluetooth.h> | ||
|
||
int app_bt_enable(bt_ready_cb_t cb); | ||
|
||
int app_bt_disable(); | ||
|
||
enum BT_id_values{ | ||
_BT_ID_DEFAULT = BT_ID_DEFAULT, | ||
#if defined (CONFIG_SIDEWALK) | ||
BT_ID_SIDEWALK, | ||
#endif | ||
#if defined (CONFIG_SIDEWALK_DFU) | ||
BT_ID_SMP_DFU, | ||
#endif | ||
_BT_ID_MAX = CONFIG_BT_ID_MAX | ||
}; | ||
|
||
BUILD_ASSERT(_BT_ID_MAX <= CONFIG_BT_ID_MAX, "Too many BT Ids! Configured limit is %d, but used %d", CONFIG_BT_ID_MAX, _BT_ID_MAX); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters