From d74cae44b04cd5210fcda083ce96696227e493bb Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 7 Sep 2023 13:12:57 +0900 Subject: [PATCH] Modify service_app_add_event_handler function To support timezone changed event, this patch modifies the function. Change-Id: I5764c1b38572e6ff0c68c57fe5f0ef265530deeb Signed-off-by: Hwankyu Jhun --- src/service_app_main.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/service_app_main.cc b/src/service_app_main.cc index 42ebd46..981f95d 100644 --- a/src/service_app_main.cc +++ b/src/service_app_main.cc @@ -75,7 +75,7 @@ int __on_error(app_error_e error, const char* function, return error; } -constexpr int APP_EVENT_MAX = 7; +constexpr int APP_EVENT_MAX = static_cast(IAppCore::IEvent::Type::END); constexpr IAppCore::IEvent::Type __app_event_converter[APP_EVENT_MAX] = { [APP_EVENT_LOW_MEMORY] = IAppCore::IEvent::Type::LOW_MEMORY, [APP_EVENT_LOW_BATTERY] = IAppCore::IEvent::Type::LOW_BATTERY, @@ -85,6 +85,9 @@ constexpr IAppCore::IEvent::Type __app_event_converter[APP_EVENT_MAX] = { [APP_EVENT_REGION_FORMAT_CHANGED] = IAppCore::IEvent::Type::REGION_CHANGE, [APP_EVENT_SUSPENDED_STATE_CHANGED] = IAppCore::IEvent::Type::SUSPENDED_STATE_CHANGE, + [APP_EVENT_UPDATE_REQUESTED] = IAppCore::IEvent::Type::UPDATE_REQUESTED, + [APP_EVENT_TIME_ZONE_CHANGED] = + IAppCore::IEvent::Type::TIME_ZONE_CHANGED, }; class AppContext : public AppCoreBase { @@ -279,7 +282,7 @@ extern "C" EXPORT_API int service_app_add_event_handler( } if (event_type < APP_EVENT_LOW_MEMORY || - event_type > APP_EVENT_SUSPENDED_STATE_CHANGED || + event_type > APP_EVENT_TIME_ZONE_CHANGED || event_type == APP_EVENT_DEVICE_ORIENTATION_CHANGED) { return __on_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, "invalid event type"); @@ -324,7 +327,7 @@ extern "C" EXPORT_API int service_app_remove_event_handler( auto type = (*eb)->GetType(); if (type < IAppCore::IEvent::Type::LOW_MEMORY || - type > IAppCore::IEvent::Type::SUSPENDED_STATE_CHANGE || + type > IAppCore::IEvent::Type::TIME_ZONE_CHANGED || type == IAppCore::IEvent::Type::DEVICE_ORIENTATION_CHANGED) return __on_error(APP_ERROR_INVALID_PARAMETER, __FUNCTION__, nullptr); // LCOV_EXCL_LINE -- 2.7.4