Skip to content

Commit

Permalink
[Tizen] Gracefully terminate example apps (#33712)
Browse files Browse the repository at this point in the history
  • Loading branch information
arkq authored and pull[bot] committed Oct 4, 2024
1 parent 33cc6a3 commit b24f363
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
16 changes: 10 additions & 6 deletions examples/platform/tizen/TizenServiceAppMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@

#include "TizenServiceAppMain.h"

#include <app/server/Server.h>
#include <lib/support/logging/CHIPLogging.h>
#include <platform/PlatformManager.h>

#include <service_app.h>
#include <tizen.h>
Expand All @@ -29,13 +31,13 @@ namespace {
bool service_app_create(void * data)
{
auto app = reinterpret_cast<TizenServiceAppMain *>(data);
return app->AppCreated();
return app->AppCreate();
}

void service_app_terminate(void * data)
{
auto app = reinterpret_cast<TizenServiceAppMain *>(data);
app->AppTerminated();
app->AppTerminate();
}

void service_app_control(app_control_h app_control, void * data)
Expand Down Expand Up @@ -68,15 +70,17 @@ void TizenServiceAppMain::Exit()
service_app_exit();
}

bool TizenServiceAppMain::AppCreated()
bool TizenServiceAppMain::AppCreate()
{
ChipLogProgress(NotSpecified, "Tizen app created");
ChipLogProgress(NotSpecified, "Tizen app create");
return true;
}

void TizenServiceAppMain::AppTerminated()
void TizenServiceAppMain::AppTerminate()
{
ChipLogProgress(NotSpecified, "Tizen app terminated");
ChipLogProgress(NotSpecified, "Tizen app terminate");
chip::Server::GetInstance().GenerateShutDownEvent();
chip::DeviceLayer::PlatformMgr().StopEventLoopTask();
}

static void TizenMainLoopWrapper()
Expand Down
4 changes: 2 additions & 2 deletions examples/platform/tizen/TizenServiceAppMain.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class TizenServiceAppMain
app_error_e RunMainLoop();
void Exit();

virtual bool AppCreated();
virtual void AppTerminated();
virtual bool AppCreate();
virtual void AppTerminate();
virtual void AppControl(app_control_h app_control);

private:
Expand Down

0 comments on commit b24f363

Please sign in to comment.