From b52deb269c6ab06e6106616ff15d670c0d935490 Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Thu, 17 Aug 2023 18:21:20 +0900 Subject: [PATCH] shared: event: Replace event_broadcast_id() with gdbus_signal_emit() directly Without event_broadcast_id() wrapper funciton, use gdbus_signal_emit() helper function directly to send the signal of event id. Change-Id: I1545d7a1fb2c70c74c873dd0d2d81342c96aa0f5 Signed-off-by: Chanwoo Choi --- plugins/iot-headless/input/input-handler.c | 6 +++-- src/battery/power-supply.c | 9 +++++-- src/shared/event.h | 39 ------------------------------ 3 files changed, 11 insertions(+), 43 deletions(-) delete mode 100644 src/shared/event.h diff --git a/plugins/iot-headless/input/input-handler.c b/plugins/iot-headless/input/input-handler.c index 85a8efc..0c5ae50 100644 --- a/plugins/iot-headless/input/input-handler.c +++ b/plugins/iot-headless/input/input-handler.c @@ -50,7 +50,8 @@ static gboolean level_event_detected(gpointer data) } if (ieu->broadcast) - event_broadcast_id(ieu->id); + gdbus_signal_emit(NULL, DEVICED_PATH_EVENT, DEVICED_INTERFACE_EVENT, + DEVICED_SIGNAL_EVENT_ID, g_variant_new("(i)", ieu->id)); if (ieu->wakelock_duration > 0) syscommon_resman_set_resource_attr_uint64_2( @@ -74,7 +75,8 @@ static void edge_event_detected(struct input_event_unit *ieu) } if (ieu->broadcast) - event_broadcast_id(ieu->id); + gdbus_signal_emit(NULL, DEVICED_PATH_EVENT, DEVICED_INTERFACE_EVENT, + DEVICED_SIGNAL_EVENT_ID, g_variant_new("(i)", ieu->id)); if (ieu->wakelock_duration > 0) syscommon_resman_set_resource_attr_uint64_2( diff --git a/src/battery/power-supply.c b/src/battery/power-supply.c index d1af11b..e3303b2 100644 --- a/src/battery/power-supply.c +++ b/src/battery/power-supply.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -38,7 +39,6 @@ #include "shared/eventsystem.h" #include "shared/plugin.h" #include "shared/apps.h" -#include "shared/event.h" #include "core.h" #include "display-lock.h" #include "display-ops.h" @@ -672,7 +672,12 @@ static void notify_charger_event(int notifier) if (event_handlers[i]->broadcast) - event_broadcast_id(event_handlers[i]->id); + gdbus_signal_emit(NULL, + DEVICED_PATH_EVENT, + DEVICED_INTERFACE_EVENT, + DEVICED_SIGNAL_EVENT_ID, + g_variant_new("(i)", event_handlers[i]->id)); + } } } diff --git a/src/shared/event.h b/src/shared/event.h deleted file mode 100644 index 5c29125..0000000 --- a/src/shared/event.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * deviced - * - * Copyright (c) 2022 Samsung Electronics Co., Ltd. - * - * Licensed under the Apache License, Version 2.0 (the License); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __DD_EVENT_H__ -#define __DD_EVENT_H__ - -#include - -#define DEVICED_PATH_EVENT "/Org/Tizen/System/DeviceD/Event" -#define DEVICED_INTERFACE_EVENT "org.tizen.system.deviced.Event" -#define DEVICED_SIGNAME_ID "Id" - -static inline void event_broadcast_id(int id) -{ - _I("Broadcast eventid=%d", id); - - gdbus_signal_emit(NULL, - DEVICED_PATH_EVENT, - DEVICED_INTERFACE_EVENT, - DEVICED_SIGNAME_ID, - g_variant_new("(i)", id)); -} - -#endif //__DD_EVENT_H__ -- 2.7.4