shared: event: Replace event_broadcast_id() with gdbus_signal_emit() directly 58/297358/3
authorChanwoo Choi <cw00.choi@samsung.com>
Thu, 17 Aug 2023 09:21:20 +0000 (18:21 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Thu, 17 Aug 2023 09:49:34 +0000 (18:49 +0900)
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 <cw00.choi@samsung.com>
plugins/iot-headless/input/input-handler.c
src/battery/power-supply.c
src/shared/event.h [deleted file]

index 85a8efc..0c5ae50 100644 (file)
@@ -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(
index d1af11b..e3303b2 100644 (file)
@@ -24,6 +24,7 @@
 #include <eventsystem.h>
 #include <hal/device/hal-battery.h>
 #include <sys/stat.h>
+#include <libsyscommon/libgdbus.h>
 #include <libsyscommon/ini-parser.h>
 #include <libsyscommon/resource-manager.h>
 #include <system/syscommon-plugin-deviced-common-interface.h>
@@ -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 (file)
index 5c29125..0000000
+++ /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 <libsyscommon/libgdbus.h>
-
-#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__