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

Restyle PostEvents now called from ScheduleWork #19380

Closed
wants to merge 2 commits into from
Closed
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
8 changes: 5 additions & 3 deletions examples/pump-app/cc13x2x7_26x2x7/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,10 @@ void AppTask::DispatchEvent(AppEvent * aEvent)
case AppEvent::kEventType_ButtonLeft:
if (AppEvent::kAppEventButtonType_Clicked == aEvent->ButtonEvent.Type)
{
// Post event for demonstration purposes
sAppTask.PostEvents();
// Post event for demonstration purposes, we must ensure that the
// LogEvent is called in the right context which is the Matter mainloop
// thru ScheduleWork()
chip::DeviceLayer::PlatformMgr().ScheduleWork(sAppTask.PostEvents, reinterpret_cast<intptr_t>(nullptr));

// Toggle BLE advertisements
if (!ConnectivityMgr().IsBLEAdvertisingEnabled())
Expand Down Expand Up @@ -608,7 +610,7 @@ void AppTask::UpdateCluster(intptr_t context)
}
}

void AppTask::PostEvents()
void AppTask::PostEvents(intptr_t context)
{
// Example on posting events - here we post the general fault event on endpoints with PCC Server enabled
for (auto endpoint : EnabledEndpointsWithServerCluster(PumpConfigurationAndControl::Id))
Expand Down
2 changes: 1 addition & 1 deletion examples/pump-app/cc13x2x7_26x2x7/main/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class AppTask
static void ButtonLeftEventHandler(Button_Handle handle, Button_EventMask events);
static void ButtonRightEventHandler(Button_Handle handle, Button_EventMask events);
static void TimerEventHandler(void * p_context);
static void PostEvents();
static void PostEvents(intptr_t context);

enum Function_t
{
Expand Down