#define MAX_BUFFER_SIZE 512
static GDBusConnection *conn;
+static unsigned int __conn_ref;
static guint s_id;
static int (*_deviced_signal_alpm_handler)(int ambient, void *data);
static void *_deviced_signal_alpm_data;
+static guint __lcd_sid;
+static void (*__deviced_signal_lcd_handler)(void *data);
+static void *__deviced_signal_lcd_data;
/* LCOV_EXCL_START */
static void __dbus_signal_filter(GDBusConnection *connection,
}
g_clear_error(&err);
+ __conn_ref++;
return 0;
}
+static void __dbus_fini(void)
+{
+ if (__conn_ref == 0)
+ return;
+
+ __conn_ref--;
+ if (__conn_ref == 0) {
+ g_object_unref(conn);
+ conn = NULL;
+ }
+}
+
static int __dbus_signal_handler_init(const char *path, const char *interface)
{
s_id = g_dbus_connection_signal_subscribe(conn,
}
/* LCOV_EXCL_STOP */
+/* LCOV_EXCL_START */
+static void __lcd_on_signal_handler(GDBusConnection *connection,
+ const gchar *sender_name,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *signal_name,
+ GVariant *parameters,
+ gpointer user_data)
+{
+ _I("LCD ON");
+ if (__deviced_signal_lcd_handler)
+ __deviced_signal_lcd_handler(__deviced_signal_lcd_data);
+}
+/* LCOV_EXCL_STOP */
+
+int _watch_core_listen_lcd_status_signal(void (*func)(void *), void *data)
+{
+ if (__dbus_init() < 0)
+ return -1;
+
+ __lcd_sid = g_dbus_connection_signal_subscribe(conn,
+ NULL,
+ DEVICED_INTERFACE_DISPLAY,
+ LCD_ON,
+ DEVICED_PATH_DISPLAY,
+ NULL,
+ G_DBUS_SIGNAL_FLAGS_NONE,
+ __lcd_on_signal_handler,
+ NULL,
+ NULL);
+ if (!__lcd_sid) {
+ _E("Failed to subscribe LCD status signal");
+ return -1;
+ }
+
+ __deviced_signal_lcd_handler = func;
+ __deviced_signal_lcd_data = data;
+
+ _D("Listen LCD status signal");
+
+ return 0;
+}
+
+void _watch_core_ignore_lcd_status_signal(void)
+{
+ __deviced_signal_lcd_handler = NULL;
+ __deviced_signal_lcd_data = NULL;
+
+ if (__lcd_sid) {
+ g_dbus_connection_signal_unsubscribe(conn, __lcd_sid);
+ __lcd_sid = 0;
+ }
+
+ __dbus_fini();
+
+ _D("Ignore LCD status signal");
+}
#define CLOCK_START "clockbegin"
#define CLOCK_STOP "clockstop"
+#define DEVICED_PATH_DISPLAY "/Org/Tizen/System/DeviceD/Display"
+#define DEVICED_INTERFACE_DISPLAY "org.tizen.system.deviced.display"
+#define LCD_ON "LCDOn"
+
int _watch_core_listen_alpm_handler(int (*func)(int, void *), void *data);
int _watch_core_send_alpm_update_done(void);
+int _watch_core_listen_lcd_status_signal(void (*func)(void *), void *data);
+void _watch_core_ignore_lcd_status_signal(void);
#ifdef __cplusplus
}
return 0;
}
+static void __lcd_on_handler(void *user_data)
+{
+ if (__pre_resume_called == 0) {
+ _D("Call pre resume tick");
+ __on_pre_resume(NULL);
+ __pre_resume_called = 1;
+ }
+}
+
EXPORT_API int watch_app_main(int argc, char **argv,
watch_app_lifecycle_callback_s *callback, void *user_data)
{
__context.ambient_mode_skip_resume = false;
__context.data = user_data;
__context.state = WATCH_APP_STATE_CREATING;
+ _watch_core_listen_lcd_status_signal(__lcd_on_handler, NULL);
ret = appcore_efl_base_init(ops, argc, argv, NULL, 0);
free(__context.appid);
return watch_app_error(APP_ERROR_INVALID_CONTEXT, __FUNCTION__, NULL);
}
+ _watch_core_ignore_lcd_status_signal();
appcore_efl_base_fini();
__context.state = WATCH_APP_STATE_NOT_RUNNING;