From b24f3635fb1f3d52a1c07e618287694f04fecde0 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Mon, 3 Jun 2024 18:19:38 +0200 Subject: [PATCH] [Tizen] Gracefully terminate example apps (#33712) --- examples/platform/tizen/TizenServiceAppMain.cpp | 16 ++++++++++------ examples/platform/tizen/TizenServiceAppMain.h | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/examples/platform/tizen/TizenServiceAppMain.cpp b/examples/platform/tizen/TizenServiceAppMain.cpp index 778c36960c608b..aed9734ce1aa2f 100644 --- a/examples/platform/tizen/TizenServiceAppMain.cpp +++ b/examples/platform/tizen/TizenServiceAppMain.cpp @@ -18,7 +18,9 @@ #include "TizenServiceAppMain.h" +#include #include +#include #include #include @@ -29,13 +31,13 @@ namespace { bool service_app_create(void * data) { auto app = reinterpret_cast(data); - return app->AppCreated(); + return app->AppCreate(); } void service_app_terminate(void * data) { auto app = reinterpret_cast(data); - app->AppTerminated(); + app->AppTerminate(); } void service_app_control(app_control_h app_control, void * data) @@ -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() diff --git a/examples/platform/tizen/TizenServiceAppMain.h b/examples/platform/tizen/TizenServiceAppMain.h index 20f889e94a8b63..316a6b6a1f7a36 100644 --- a/examples/platform/tizen/TizenServiceAppMain.h +++ b/examples/platform/tizen/TizenServiceAppMain.h @@ -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: