Skip to content
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

[nrfconnect] Introduce BLE advertising arbiter #24637

Merged
merged 2 commits into from
Jan 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 1 addition & 3 deletions config/nrfconnect/chip-module/Kconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,7 @@ config BT_DEVICE_NAME_MAX
default 15

config BT_MAX_CONN
default 2 # a workaround for non-unreferenced BLE connection object
# when restaring the BLE advertising in disconnect callback
# TODO: analyze and revert to 1 if proper fix exists
default 1

config BT_L2CAP_TX_MTU
default 247
Expand Down
10 changes: 0 additions & 10 deletions examples/all-clusters-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,16 +332,6 @@ void AppTask::FunctionTimerEventHandler(const AppEvent & event)
}
}

#ifdef CONFIG_MCUMGR_SMP_BT
void AppTask::RequestSMPAdvertisingStart(void)
{
AppEvent event;
event.Type = AppEventType::StartSMPAdvertising;
event.Handler = [](const AppEvent &) { GetDFUOverSMP().StartBLEAdvertising(); };
PostEvent(event);
}
#endif

void AppTask::FunctionHandler(const AppEvent & event)
{
if (event.ButtonEvent.PinNo != FUNCTION_BUTTON)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ enum class AppEventType : uint8_t
UpdateLedState,
IdentifyStart,
IdentifyStop,
StartSMPAdvertising
};

enum class FunctionEvent : uint8_t
Expand Down
4 changes: 0 additions & 4 deletions examples/all-clusters-app/nrfconnect/main/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ class AppTask
static void FunctionTimerTimeoutCallback(k_timer * timer);
static void UpdateStatusLED();

#ifdef CONFIG_MCUMGR_SMP_BT
static void RequestSMPAdvertisingStart(void);
#endif

FunctionEvent mFunction = FunctionEvent::NoneSelected;
bool mFunctionTimerActive = false;

Expand Down
10 changes: 0 additions & 10 deletions examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,16 +209,6 @@ void AppTask::ButtonEventHandler(uint32_t buttonState, uint32_t hasChanged)
}
}

#ifdef CONFIG_MCUMGR_SMP_BT
void AppTask::RequestSMPAdvertisingStart(void)
{
AppEvent event;
event.Type = AppEventType::StartSMPAdvertising;
event.Handler = [](const AppEvent &) { GetDFUOverSMP().StartBLEAdvertising(); };
PostEvent(event);
}
#endif

void AppTask::FunctionTimerTimeoutCallback(k_timer * timer)
{
if (!timer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ enum class AppEventType : uint8_t
UpdateLedState,
IdentifyStart,
IdentifyStop,
StartSMPAdvertising
};

enum class FunctionEvent : uint8_t
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ class AppTask
static void FunctionTimerTimeoutCallback(k_timer * timer);
static void UpdateStatusLED();

#ifdef CONFIG_MCUMGR_SMP_BT
static void RequestSMPAdvertisingStart(void);
#endif

FunctionEvent mFunction = FunctionEvent::NoneSelected;
bool mFunctionTimerActive = false;

Expand Down
12 changes: 1 addition & 11 deletions examples/light-switch-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ CHIP_ERROR AppTask::Init()

// Initialize DFU
#ifdef CONFIG_MCUMGR_SMP_BT
GetDFUOverSMP().Init(RequestSMPAdvertisingStart);
GetDFUOverSMP().Init();
GetDFUOverSMP().ConfirmNewImage();
#endif

Expand Down Expand Up @@ -646,16 +646,6 @@ void AppTask::FunctionTimerTimeoutCallback(k_timer * timer)
}
}

#ifdef CONFIG_MCUMGR_SMP_BT
void AppTask::RequestSMPAdvertisingStart(void)
{
AppEvent event;
event.Type = AppEventType::StartSMPAdvertising;
event.Handler = [](const AppEvent &) { GetDFUOverSMP().StartBLEAdvertising(); };
PostEvent(event);
}
#endif

void AppTask::PostEvent(const AppEvent & event)
{
if (k_msgq_put(&sAppEventQueue, &event, K_NO_WAIT) != 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ enum class AppEventType : uint8_t
UpdateLedState,
IdentifyStart,
IdentifyStop,
StartSMPAdvertising
};

enum class FunctionEvent : uint8_t
Expand Down
4 changes: 0 additions & 4 deletions examples/light-switch-app/nrfconnect/main/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,6 @@ class AppTask
static void StartTimer(Timer, uint32_t);
static void CancelTimer(Timer);

#ifdef CONFIG_MCUMGR_SMP_BT
static void RequestSMPAdvertisingStart(void);
#endif

FunctionEvent mFunction = FunctionEvent::NoneSelected;

#if CONFIG_CHIP_FACTORY_DATA
Expand Down
12 changes: 1 addition & 11 deletions examples/lighting-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ CHIP_ERROR AppTask::Init()

#ifdef CONFIG_MCUMGR_SMP_BT
// Initialize DFU over SMP
GetDFUOverSMP().Init(RequestSMPAdvertisingStart);
GetDFUOverSMP().Init();
GetDFUOverSMP().ConfirmNewImage();
#endif

Expand Down Expand Up @@ -443,16 +443,6 @@ void AppTask::FunctionTimerEventHandler(const AppEvent & event)
}
}

#ifdef CONFIG_MCUMGR_SMP_BT
void AppTask::RequestSMPAdvertisingStart(void)
{
AppEvent event;
event.Type = AppEventType::StartSMPAdvertising;
event.Handler = [](const AppEvent &) { GetDFUOverSMP().StartBLEAdvertising(); };
PostEvent(event);
}
#endif

void AppTask::FunctionHandler(const AppEvent & event)
{
if (event.ButtonEvent.PinNo != FUNCTION_BUTTON)
Expand Down
1 change: 0 additions & 1 deletion examples/lighting-app/nrfconnect/main/include/AppEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ enum class AppEventType : uint8_t
Lighting,
IdentifyStart,
IdentifyStop,
StartSMPAdvertising
};

enum class FunctionEvent : uint8_t
Expand Down
4 changes: 0 additions & 4 deletions examples/lighting-app/nrfconnect/main/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ class AppTask
static void FunctionHandler(const AppEvent & event);
static void StartBLEAdvertisementAndLightActionEventHandler(const AppEvent & event);

#ifdef CONFIG_MCUMGR_SMP_BT
static void RequestSMPAdvertisingStart(void);
#endif

FunctionEvent mFunction = FunctionEvent::NoneSelected;
bool mFunctionTimerActive = false;
PWMDevice mPWMDevice;
Expand Down
12 changes: 1 addition & 11 deletions examples/lock-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ CHIP_ERROR AppTask::Init()

#ifdef CONFIG_MCUMGR_SMP_BT
// Initialize DFU over SMP
GetDFUOverSMP().Init(RequestSMPAdvertisingStart);
GetDFUOverSMP().Init();
GetDFUOverSMP().ConfirmNewImage();
#endif

Expand Down Expand Up @@ -399,16 +399,6 @@ void AppTask::FunctionTimerEventHandler(const AppEvent & event)
}
}

#ifdef CONFIG_MCUMGR_SMP_BT
void AppTask::RequestSMPAdvertisingStart(void)
{
AppEvent event;
event.Type = AppEventType::StartSMPAdvertising;
event.Handler = [](const AppEvent &) { GetDFUOverSMP().StartBLEAdvertising(); };
PostEvent(event);
}
#endif

void AppTask::FunctionHandler(const AppEvent & event)
{
if (event.ButtonEvent.PinNo != FUNCTION_BUTTON)
Expand Down
1 change: 0 additions & 1 deletion examples/lock-app/nrfconnect/main/include/AppEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ enum class AppEventType : uint8_t
UpdateLedState,
IdentifyStart,
IdentifyStop,
StartSMPAdvertising
};

enum class FunctionEvent : uint8_t
Expand Down
4 changes: 0 additions & 4 deletions examples/lock-app/nrfconnect/main/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ class AppTask

static void LockStateChanged(BoltLockManager::State state, BoltLockManager::OperationSource source);

#ifdef CONFIG_MCUMGR_SMP_BT
static void RequestSMPAdvertisingStart(void);
#endif

FunctionEvent mFunction = FunctionEvent::NoneSelected;
bool mFunctionTimerActive = false;

Expand Down
Loading