Skip to content

Commit 65bedf2

Browse files
committed
Revert "[zephyr] Added several improvements to the BLEMgr implementation (project-chip#33189)"
This reverts commit 2211869. Signed-off-by: Adrian Gielniewski <adrian.gielniewski@nordicsemi.no>
1 parent be5d5dd commit 65bedf2

File tree

4 files changed

+46
-191
lines changed

4 files changed

+46
-191
lines changed

src/platform/Zephyr/BLEAdvertisingArbiter.cpp

+2-29
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ namespace {
2929
// List of advertising requests ordered by priority
3030
sys_slist_t sRequests;
3131

32-
bool sIsInitialized = false;
33-
uint8_t sBtId = 0;
34-
3532
// Cast an intrusive list node to the containing request object
3633
const BLEAdvertisingArbiter::Request & ToRequest(const sys_snode_t * node)
3734
{
@@ -58,9 +55,8 @@ CHIP_ERROR RestartAdvertising()
5855
ReturnErrorOnFailure(System::MapErrorZephyr(bt_le_adv_stop()));
5956
ReturnErrorCodeIf(sys_slist_is_empty(&sRequests), CHIP_NO_ERROR);
6057

61-
const Request & top = ToRequest(sys_slist_peek_head(&sRequests));
62-
bt_le_adv_param params = BT_LE_ADV_PARAM_INIT(top.options, top.minInterval, top.maxInterval, nullptr);
63-
params.id = sBtId;
58+
const Request & top = ToRequest(sys_slist_peek_head(&sRequests));
59+
const bt_le_adv_param params = BT_LE_ADV_PARAM_INIT(top.options, top.minInterval, top.maxInterval, nullptr);
6460
const int result = bt_le_adv_start(&params, top.advertisingData.data(), top.advertisingData.size(), top.scanResponseData.data(),
6561
top.scanResponseData.size());
6662

@@ -74,26 +70,8 @@ CHIP_ERROR RestartAdvertising()
7470

7571
} // namespace
7672

77-
CHIP_ERROR Init(uint8_t btId)
78-
{
79-
if (sIsInitialized)
80-
{
81-
return CHIP_ERROR_INCORRECT_STATE;
82-
}
83-
84-
sBtId = btId;
85-
sIsInitialized = true;
86-
87-
return CHIP_NO_ERROR;
88-
}
89-
9073
CHIP_ERROR InsertRequest(Request & request)
9174
{
92-
if (!sIsInitialized)
93-
{
94-
return CHIP_ERROR_INCORRECT_STATE;
95-
}
96-
9775
CancelRequest(request);
9876

9977
sys_snode_t * prev = nullptr;
@@ -131,11 +109,6 @@ CHIP_ERROR InsertRequest(Request & request)
131109

132110
void CancelRequest(Request & request)
133111
{
134-
if (!sIsInitialized)
135-
{
136-
return;
137-
}
138-
139112
const bool isTopPriority = (sys_slist_peek_head(&sRequests) == &request);
140113
VerifyOrReturn(sys_slist_find_and_remove(&sRequests, &request));
141114

src/platform/Zephyr/BLEAdvertisingArbiter.h

-18
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,6 @@ struct Request : public sys_snode_t
6161
OnAdvertisingStopped onStopped; ///< (Optional) Callback invoked when the request stops being top-priority.
6262
};
6363

64-
/**
65-
* @brief Initialize BLE advertising arbiter
66-
*
67-
* @note This method must be called before trying to insert or cancel any requests.
68-
*
69-
* @param btId Local Bluetooth LE identifier to be used for the advertising parameters. Currently Bluetooth LE identifier used in
70-
* this method will be used for all advertising requests and changing it dynamically is not supported.
71-
* @return error If the module is already initialized.
72-
* @return success Otherwise.
73-
*/
74-
CHIP_ERROR Init(uint8_t btId);
75-
7664
/**
7765
* @brief Request BLE advertising
7866
*
@@ -86,9 +74,6 @@ CHIP_ERROR Init(uint8_t btId);
8674
* @note This method does not take ownership of the request object so the object
8775
* must not get destroyed before it is cancelled.
8876
*
89-
* @note The arbiter module has to be initialized using Init() method before
90-
* invoking this method.
91-
*
9277
* @param request Reference to advertising request that contains priority and
9378
* other advertising parameters.
9479
* @return error If the request is top-priority and failed to restart the
@@ -109,9 +94,6 @@ CHIP_ERROR InsertRequest(Request & request);
10994
* An attempt to cancel a request that has not been registered at the
11095
* advertising arbiter is a no-op. That is, it returns immediately.
11196
*
112-
* @note The arbiter module has to be initialized using Init() method before
113-
* invoking this method.
114-
*
11597
* @param request Reference to advertising request that contains priority and
11698
* other advertising parameters.
11799
*/

0 commit comments

Comments
 (0)