From 340924fcd3bcf1f0d0ca1e8fd32bfe75b02ab59b Mon Sep 17 00:00:00 2001 From: Rusty Lynch Date: Tue, 10 Sep 2013 11:49:40 -0700 Subject: [PATCH 01/16] Add unit test for sending and recieving notifications Change-Id: Id3c6aa1868a9267d3ffea18a5fcb863bec1f3cf0 --- Makefile.am | 10 ++- packaging/notification-service.spec | 11 +++ sample_display_client.c | 64 +++++++++++++++ send_notification.c | 157 ++++++++++++++++++++++++++++++++++++ 4 files changed, 241 insertions(+), 1 deletion(-) create mode 100644 sample_display_client.c create mode 100644 send_notification.c diff --git a/Makefile.am b/Makefile.am index c0b4bbc..5b7257b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -bin_PROGRAMS = notification-service +bin_PROGRAMS = notification-service sample-display-client send-notification AM_CFLAGS = $(GCC_CFLAGS) AM_CPPFLAGS = $(GCC_CFLAGS) @@ -10,6 +10,14 @@ notification_service_SOURCES = \ notification_service_CFLAGS = -I. $(TIZEN_CFLAGS) notification_service_LDADD = $(TIZEN_LIBS) +send_notification_SOURCES = send_notification.c +send_notification_CFLAGS = -I. $(TIZEN_CFLAGS) +send_notification_LDADD = $(TIZEN_LIBS) + +sample_display_client_SOURCES = sample_display_client.c +sample_display_client_CFLAGS = -I. $(TIZEN_CFLAGS) +sample_display_client_LDADD = $(TIZEN_LIBS) + SCRIPT_IN_FILES = \ notifications.service.in \ notifications.socket.in diff --git a/packaging/notification-service.spec b/packaging/notification-service.spec index 4028a2c..d2e8b4d 100644 --- a/packaging/notification-service.spec +++ b/packaging/notification-service.spec @@ -15,6 +15,12 @@ Headless notification service that collects incoming notifications from the the platform, maintains a database of active notifications, and broadcast updates to all listeners. +%package test +Summary: Test clients for %{name} +Group: Application Framework/Notifications +%description test +This package provides unit test used in the development of the notification service. + %prep %setup -q -n %{name}-%{version} @@ -34,3 +40,8 @@ rm -rf %{buildroot} %{_libdir}/systemd/system/notifications.service %{_libdir}/systemd/system/notifications.socket %{_libdir}/systemd/system/sockets.target.wants/notifications.socket + +%files test +%defattr(-,root,root,-) +%{_bindir}/sample-display-client +%{_bindir}/send-notification diff --git a/sample_display_client.c b/sample_display_client.c new file mode 100644 index 0000000..1f449f0 --- /dev/null +++ b/sample_display_client.c @@ -0,0 +1,64 @@ +#include +#include +#include + +static void __noti_changed_cb(void *data, notification_type_e type) +{ + notification_h noti = NULL; + notification_list_h notification_list = NULL; + notification_list_h get_list = NULL; + int count = 0, group_id = 0, priv_id = 0, show_noti = 0, num = 1; + char *pkgname = NULL; + char *title = NULL; + char *str_count = NULL; + int i = 1; + char buf[512] = {0}; + + notification_get_list(NOTIFICATION_TYPE_NOTI, -1, ¬ification_list); + if (notification_list) { + get_list = notification_list_get_head(notification_list); + noti = notification_list_get_data(get_list); + while(get_list != NULL) { + notification_get_id(noti, &group_id, &priv_id); + notification_get_pkgname(noti, &pkgname); + if(pkgname == NULL){ + notification_get_application(noti, &pkgname); + } + + notification_get_text(noti, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, &str_count); + if (!str_count) { + count = 0; + } else { + count = atoi(str_count); + } + notification_get_title(noti, &title, NULL); + + fprintf(stdout, "NOTIFICATION: %s - %s - %i - %i\n", pkgname, title, count, num); + + get_list = notification_list_get_next(get_list); + noti = notification_list_get_data(get_list); + num++; + } + } + if (notification_list != NULL) { + notification_free_list(notification_list); + notification_list = NULL; + } +} + +int +main(int argc, char **argv) +{ + if (!ecore_init()) { + fprintf(stderr, "ERROR: Cannot init Ecore!\n"); + return -1; + } + + notification_resister_changed_cb(__noti_changed_cb, NULL); + ecore_main_loop_begin(); + + shutdown: + ecore_shutdown(); + return 0; +} + diff --git a/send_notification.c b/send_notification.c new file mode 100644 index 0000000..52e5686 --- /dev/null +++ b/send_notification.c @@ -0,0 +1,157 @@ +#include +#include +#include +#include + +const char *error_to_string(notification_error_e error) +{ + if (error == NOTIFICATION_ERROR_INVALID_DATA) + return "NOTIFICATION_ERROR_INVALID_DATA"; + if (error == NOTIFICATION_ERROR_NO_MEMORY) + return "NOTIFICATION_ERROR_NO_MEMORY"; + if (error == NOTIFICATION_ERROR_FROM_DB) + return "NOTIFICATION_ERROR_FROM_DB"; + if (error == NOTIFICATION_ERROR_ALREADY_EXIST_ID) + return "NOTIFICATION_ERROR_ALREADY_EXIST_ID"; + if (error == NOTIFICATION_ERROR_FROM_DBUS) + return "NOTIFICATION_ERROR_FROM_DBUS"; + if (error == NOTIFICATION_ERROR_NOT_EXIST_ID) + return "NOTIFICATION_ERROR_NOT_EXIST_ID"; + if (error == NOTIFICATION_ERROR_IO) + return "NOTIFICATION_ERROR_IO"; + if (error == NOTIFICATION_ERROR_SERVICE_NOT_READY) + return "NOTIFICATION_ERROR_SERVICE_NOT_READY"; + if (error == NOTIFICATION_ERROR_NONE) + return "NOTIFICATION_ERROR_NONE"; + + return "UNHANDLED ERROR"; +} + +static Eina_Bool remove_all(const Ecore_Getopt *parser, + const Ecore_Getopt_Desc *desc, + const char *str, + void *data, + Ecore_Getopt_Value *storage) +{ + notification_error_e err = NOTIFICATION_ERROR_NONE; + + err = notification_delete_all_by_type("SEND_TEST_PKG", NOTIFICATION_TYPE_NOTI); + if (err != NOTIFICATION_ERROR_NONE) { + fprintf(stderr, "Unable to remove notifications: %s\n", error_to_string(err)); + exit(-1); + } + + exit(0); + + // will never reach here + return 0; +} + +static const Ecore_Getopt optdesc = { + "send notification test utility", + NULL, + "0.0", + "(C) 2013 Intel Corp", + "Flora", + "Test utility for sending notifications", + 0, + { + ECORE_GETOPT_STORE_STR('t', "title", "Title"), + ECORE_GETOPT_STORE_STR('c', "content", "Content"), + ECORE_GETOPT_STORE_STR('i', "icon", "Path to icon"), + ECORE_GETOPT_STORE_STR('m', "image", "Path to image"), + ECORE_GETOPT_STORE_INT('y', "imagetype", "Image type enum value"), + ECORE_GETOPT_CALLBACK_NOARGS('r', "removeall", "Remove all notifications", remove_all, NULL), + ECORE_GETOPT_HELP('h', "help"), + ECORE_GETOPT_SENTINEL + } +}; + +int +main(int argc, char **argv) +{ + char *title = NULL; + char *content = NULL; + char *icon = NULL; + char *image = NULL; + int imageType = 0; + Eina_Bool remove = EINA_FALSE; + notification_h noti = NULL; + notification_error_e err = NOTIFICATION_ERROR_NONE; + + Ecore_Getopt_Value values[] = { + ECORE_GETOPT_VALUE_STR(title), + ECORE_GETOPT_VALUE_STR(content), + ECORE_GETOPT_VALUE_STR(icon), + ECORE_GETOPT_VALUE_STR(image), + ECORE_GETOPT_VALUE_INT(imageType), + ECORE_GETOPT_VALUE_NONE + }; + + if (!ecore_init()) { + fprintf(stderr, "ERROR: Cannot init Ecore!\n"); + return -1; + } + + if (ecore_getopt_parse(&optdesc, values, argc, argv) < 0) { + fprintf(stderr, "Parsing arguments failed!\n"); + return -1; + } + + noti = notification_new(NOTIFICATION_TYPE_NOTI, + NOTIFICATION_GROUP_ID_NONE, + NOTIFICATION_PRIV_ID_NONE); + if (noti == NULL) { + fprintf(stderr, "Failed to create notification: %s\n", error_to_string(err)); + return -1; + } + + err = notification_set_pkgname(noti, "SEND_TEST_PKG"); + if (err != NOTIFICATION_ERROR_NONE) { + fprintf(stderr, "Unable to set pkgname: %s\n", error_to_string(err)); + return -1; + } + + err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, + title ? title : "Default Title", + NULL, NOTIFICATION_VARIABLE_TYPE_NONE); + if (err != NOTIFICATION_ERROR_NONE) { + fprintf(stderr, "Unable to set notification title: %s\n", error_to_string(err)); + return -1; + } + + err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, + title ? title : "Default Content", + NULL, NOTIFICATION_VARIABLE_TYPE_NONE); + if (err != NOTIFICATION_ERROR_NONE) { + fprintf(stderr, "Unable to set notification content: %s\n", error_to_string(err)); + return -1; + } + + if (icon) { + err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_ICON, icon); + if (err != NOTIFICATION_ERROR_NONE) { + fprintf(stderr, "Unable to set notification icon path: %s\n", error_to_string(err)); + return -1; + } + } + + if (image) { + err = notification_set_image(noti, imageType, image); + if (err != NOTIFICATION_ERROR_NONE) { + fprintf(stderr, "Unable to set notification image path: %s\n", error_to_string(err)); + return -1; + } + } + + err = notification_insert(noti, NULL); + if (err != NOTIFICATION_ERROR_NONE) { + fprintf(stderr, "Unable to insert notification: %s\n", error_to_string(err)); + return -1; + } + + fprintf(stdout, "Sent Notification > %s : %s : %s : %s : %i\n", + title, content, icon, image, imageType); + return 0; +} + -- 2.7.4 From a298f8726f54414abf7d1d4adde7e6d72902ded0 Mon Sep 17 00:00:00 2001 From: Rusty Lynch Date: Mon, 16 Sep 2013 14:09:50 -0700 Subject: [PATCH 02/16] Remove socket cleanup code Change-Id: I04d379037991c7e450d7905213b576e12108e08e --- service_common.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/service_common.c b/service_common.c index db79011..b53d1ff 100644 --- a/service_common.c +++ b/service_common.c @@ -575,18 +575,6 @@ struct service_context *service_common_create(const char *addr, int (*service_th return NULL; } - /* - * cleanup old socket file - */ - struct stat tmp; - if (!stat(addr, &tmp)) { - if (unlink(addr)) { - perror("Unable to unlink old socket file"); - free(svc_ctx); - return NULL; - } - } - svc_ctx->fd = secure_socket_create_server(addr); if (svc_ctx->fd < 0) { free(svc_ctx); -- 2.7.4 From 2427a9d9f63e72b5f9b8b1d4b236f441c5e9d872 Mon Sep 17 00:00:00 2001 From: Rusty Lynch Date: Mon, 16 Sep 2013 15:32:50 -0700 Subject: [PATCH 03/16] Update changelog for release Change-Id: Ief212257233fba462330ce3dd3a7db3c6564f4b4 --- packaging/notification-service.changes | 4 ++++ packaging/notification-service.spec | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packaging/notification-service.changes b/packaging/notification-service.changes index b78ee49..0493d52 100644 --- a/packaging/notification-service.changes +++ b/packaging/notification-service.changes @@ -1,3 +1,7 @@ +* Mon Sep 16 2013 Rusty Lynch submit/tizen/20130906.193836@a298f87 +- Remove socket cleanup code +- Add unit test for sending and recieving notifications + * Fri Sep 06 2013 Rusty Lynch 3fb22fc - Initial import diff --git a/packaging/notification-service.spec b/packaging/notification-service.spec index d2e8b4d..8d629db 100644 --- a/packaging/notification-service.spec +++ b/packaging/notification-service.spec @@ -1,6 +1,6 @@ Name: notification-service Summary: Simple notification service -Version: 0.0.1 +Version: 0.0.2 Release: 1 Group: Application Framework/Notifications License: Flora -- 2.7.4 From 06d4a8e7425129958d7b05c6fa6f9965b94e16ec Mon Sep 17 00:00:00 2001 From: Jean-Benoit MARTIN Date: Fri, 20 Sep 2013 14:30:32 +0200 Subject: [PATCH 04/16] Send and display content from notification Change-Id: I609ec048f7ffe34104a0c4cdc2a2bedd2566601d --- sample_display_client.c | 5 ++++- send_notification.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sample_display_client.c b/sample_display_client.c index 1f449f0..ccdd255 100644 --- a/sample_display_client.c +++ b/sample_display_client.c @@ -11,6 +11,7 @@ static void __noti_changed_cb(void *data, notification_type_e type) char *pkgname = NULL; char *title = NULL; char *str_count = NULL; + char *content = NULL; int i = 1; char buf[512] = {0}; @@ -32,8 +33,10 @@ static void __noti_changed_cb(void *data, notification_type_e type) count = atoi(str_count); } notification_get_title(noti, &title, NULL); + notification_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, &content); - fprintf(stdout, "NOTIFICATION: %s - %s - %i - %i\n", pkgname, title, count, num); + + fprintf(stdout, "NOTIFICATION: %s - %s - %s - %i - %i\n", pkgname, title, content, count, num); get_list = notification_list_get_next(get_list); noti = notification_list_get_data(get_list); diff --git a/send_notification.c b/send_notification.c index 52e5686..0a15d86 100644 --- a/send_notification.c +++ b/send_notification.c @@ -121,7 +121,7 @@ main(int argc, char **argv) } err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT, - title ? title : "Default Content", + content ? content : "Default Content", NULL, NOTIFICATION_VARIABLE_TYPE_NONE); if (err != NOTIFICATION_ERROR_NONE) { fprintf(stderr, "Unable to set notification content: %s\n", error_to_string(err)); -- 2.7.4 From 179e82142574e8ce4f86479adf4eb7453306c39f Mon Sep 17 00:00:00 2001 From: Jean-Benoit MARTIN Date: Fri, 20 Sep 2013 14:17:26 +0200 Subject: [PATCH 05/16] Add Bluetooth-client-notification to test bluetooth pairing Change-Id: I1b079a270fe39ca04cb6774e97db19e21f7f9d25 --- Makefile.am | 6 +- bluetooth_notification_client.c | 327 ++++++++++++++++++++++++++++++++++++ configure.ac | 2 +- packaging/notification-service.spec | 5 + 4 files changed, 338 insertions(+), 2 deletions(-) create mode 100644 bluetooth_notification_client.c diff --git a/Makefile.am b/Makefile.am index 5b7257b..28b715c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -bin_PROGRAMS = notification-service sample-display-client send-notification +bin_PROGRAMS = notification-service sample-display-client send-notification bluetooth_notification_client AM_CFLAGS = $(GCC_CFLAGS) AM_CPPFLAGS = $(GCC_CFLAGS) @@ -18,6 +18,10 @@ sample_display_client_SOURCES = sample_display_client.c sample_display_client_CFLAGS = -I. $(TIZEN_CFLAGS) sample_display_client_LDADD = $(TIZEN_LIBS) +bluetooth_notification_client_SOURCES = bluetooth_notification_client.c +bluetooth_notification_client_CFLAGS = -I. $(TIZEN_CFLAGS) +bluetooth_notification_client_LDADD = $(TIZEN_LIBS) + SCRIPT_IN_FILES = \ notifications.service.in \ notifications.socket.in diff --git a/bluetooth_notification_client.c b/bluetooth_notification_client.c new file mode 100644 index 0000000..50a3095 --- /dev/null +++ b/bluetooth_notification_client.c @@ -0,0 +1,327 @@ +#include +#include +#include + +#include +#include +#include +#include + +typedef enum { + BT_AGENT_ACCEPT, + BT_AGENT_REJECT, + BT_AGENT_CANCEL, + BT_CORE_AGENT_TIMEOUT, +} bt_agent_accept_type_t; + + +typedef void (*bt_notification)(DBusGProxy *proxy); + +static DBusGProxy* +__bluetooth_create_agent_proxy(DBusGConnection *sys_conn, const char *path) +{ + return dbus_g_proxy_new_for_name (sys_conn, + "org.projectx.bt", + path, + "org.bluez.Agent"); +} + +static DBusGProxy* +__bluetooth_create_obex_proxy(DBusGConnection *sys_conn) +{ + return dbus_g_proxy_new_for_name(sys_conn, + "org.bluez.frwk_agent", + "/org/obex/ops_agent", + "org.openobex.Agent"); +} + +static void +__notify_passkey_confirm_request_accept_cb( DBusGProxy* agent_proxy) +{ + dbus_g_proxy_call_no_reply( agent_proxy, "ReplyConfirmation", + G_TYPE_UINT, BT_AGENT_ACCEPT, + G_TYPE_INVALID, G_TYPE_INVALID); + +} + +static void +__notify_passkey_confirm_request_cancel_cb(DBusGProxy* agent_proxy) +{ + + dbus_g_proxy_call_no_reply( agent_proxy, "ReplyConfirmation", + G_TYPE_UINT, BT_AGENT_CANCEL, + G_TYPE_INVALID, G_TYPE_INVALID); + +} + +static void +__notify_push_authorize_request_accept_cb(DBusGProxy* obex_proxy) +{ + + dbus_g_proxy_call_no_reply( obex_proxy, "ReplyAuthorize", + G_TYPE_UINT, BT_AGENT_ACCEPT, + G_TYPE_INVALID, G_TYPE_INVALID); + +} + +static void +__notify_push_authorize_request_cancel_cb(DBusGProxy* obex_proxy) +{ + + dbus_g_proxy_call_no_reply( obex_proxy, "ReplyAuthorize", + G_TYPE_UINT, BT_AGENT_CANCEL, + G_TYPE_INVALID, G_TYPE_INVALID); + +} + +static void +__notify_authorize_request_accept_cb(DBusGProxy* agent_proxy) +{ + + dbus_g_proxy_call_no_reply( agent_proxy, "ReplyAuthorize", + G_TYPE_UINT, BT_AGENT_ACCEPT, + G_TYPE_INVALID, G_TYPE_INVALID); +} + +static void +__notify_authorize_request_cancel_cb(DBusGProxy* agent_proxy) +{ + + dbus_g_proxy_call_no_reply( agent_proxy, "ReplyAuthorize", + G_TYPE_UINT, BT_AGENT_CANCEL, + G_TYPE_INVALID, G_TYPE_INVALID); + +} + +static int +__display_notification(bt_notification cb_1, bt_notification cb_2, DBusGProxy *proxy) +{ + + notification_error_e err = NOTIFICATION_ERROR_NONE; + int bt_yesno; + bt_yesno = 1; + char line[256]; + + fprintf(stdout, "Do you confirm yes or no ? "); + while ( bt_yesno != 0){ + gets(line); + if ( strcmp(line,"yes") == 0){ + (cb_1) (proxy); + bt_yesno = 0; + } else if ( strcmp(line,"no") == 0){ + (cb_2) (proxy); + bt_yesno = 0; + } else { + fprintf(stdout," yes or no :"); + } + } + err = notification_delete_all_by_type("bluetooth-frwk-bt-service", NOTIFICATION_TYPE_NOTI); + if (err != NOTIFICATION_ERROR_NONE) { + fprintf(stdout, "Unable to remove notifications"); + } + +} + +static int __noti_changed_cb(void *data, notification_type_e type) +{ + notification_h noti = NULL; + notification_list_h notification_list = NULL; + notification_list_h get_list = NULL; + int count = 0, group_id = 0, priv_id = 0, show_noti = 0, num = 1; + char *pkgname = NULL; + char *title = NULL; + char *str_count = NULL; + char *content= NULL; + bundle *user_data = NULL; + DBusGConnection *sys_conn; + DBusGProxy *agent_proxy; + DBusGProxy *obex_proxy; + + + const char *device_name = NULL; + const char *passkey = NULL; + const char *file = NULL; + const char *agent_path; + const char *event_type = NULL; + + notification_get_list(NOTIFICATION_TYPE_NOTI, -1, ¬ification_list); + if (notification_list) { + get_list = notification_list_get_head(notification_list); + noti = notification_list_get_data(get_list); + notification_get_id(noti, &group_id, &priv_id); + notification_get_pkgname(noti, &pkgname); + if(pkgname == NULL){ + notification_get_application(noti, &pkgname); + } + + notification_get_text(noti, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, &str_count); + if (!str_count) { + count = 0; + } else { + count = atoi(str_count); + } + notification_get_title(noti, &title, NULL); + notification_get_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT , &content); + notification_get_execute_option(noti, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH,NULL, &user_data); + + fprintf(stdout, "NOTIFICATION: %s - %s - %s - %i - %i \n", pkgname, title, content, count, num); + + event_type = bundle_get_val(user_data, "event-type"); + + if(!strcasecmp(event_type, "pin-request")) { + /* Not implemented */ + fprintf(stdout," Not implemented\n"); + + } else if (!strcasecmp(event_type, "passkey-confirm-request")){ + device_name = (gchar*) bundle_get_val(user_data, "device-name"); + passkey = (gchar*) bundle_get_val(user_data, "passkey"); + agent_path = bundle_get_val(user_data, "agent-path"); + + sys_conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL); + if (sys_conn == NULL) { + fprintf(stdout,"ERROR: Can't get on system bus"); + return EXIT_FAILURE; + } + + agent_proxy = __bluetooth_create_agent_proxy(sys_conn, agent_path); + if (!agent_proxy){ + fprintf(stdout,"create new agent_proxy failed\n"); + return EXIT_FAILURE; + } + + __display_notification(__notify_passkey_confirm_request_accept_cb, __notify_passkey_confirm_request_cancel_cb,agent_proxy); + } else if (!strcasecmp(event_type, "passkey-request")) { + /* Not implemented */ + fprintf(stdout," Not implemented\n"); + + } else if (!strcasecmp(event_type, "passkey-display-request")) { + /* Not implemented */ + fprintf(stdout," Not implemented\n"); + + } else if (!strcasecmp(event_type, "authorize-request")) { + device_name = (gchar*) bundle_get_val(user_data, "device-name"); + agent_path = bundle_get_val(user_data, "agent-path"); + + sys_conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL); + if (sys_conn == NULL) { + fprintf(stdout,"ERROR: Can't get on system bus"); + return EXIT_FAILURE; + } + + agent_proxy = __bluetooth_create_agent_proxy(sys_conn, agent_path); + if (!agent_proxy){ + fprintf(stdout,"create new agent_proxy failed\n"); + return EXIT_FAILURE; + } + + __display_notification( __notify_authorize_request_accept_cb, __notify_authorize_request_cancel_cb,agent_proxy); + } else if (!strcasecmp(event_type, "app-confirm-request")) { + /* Not implemented */ + fprintf(stdout," Not implemented\n"); + + } else if (!strcasecmp(event_type, "push-authorize-request")) { + file = (gchar*) bundle_get_val(user_data, "file"); + device_name = (gchar*) bundle_get_val(user_data, "device-name"); + + sys_conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL); + if (sys_conn == NULL) { + fprintf(stdout,"ERROR: Can't get on system bus"); + return EXIT_FAILURE; + } + + obex_proxy = __bluetooth_create_obex_proxy(sys_conn); + if (!obex_proxy){ + fprintf(stdout,"create new obex_proxy failed\n"); + return EXIT_FAILURE; + } + + __display_notification( __notify_push_authorize_request_accept_cb, __notify_push_authorize_request_cancel_cb,obex_proxy); + } else if (!strcasecmp(event_type, "confirm-overwrite-request")) { + /* Not implemented */ + fprintf(stdout," Not implemented\n"); + + } else if (!strcasecmp(event_type, "keyboard-passkey-request")) { + /* Not implemented */ + fprintf(stdout," Not implemented\n"); + + } else if (!strcasecmp(event_type, "bt-information")) { + /* Not implemented */ + fprintf(stdout," Not implemented\n"); + + } else if (!strcasecmp(event_type, "exchange-request")) { + device_name = (gchar*) bundle_get_val(user_data, "device-name"); + agent_path = bundle_get_val(user_data, "agent-path"); + + sys_conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL); + if (sys_conn == NULL) { + fprintf(stdout,"ERROR: Can't get on system bus"); + return EXIT_FAILURE; + } + + agent_proxy = __bluetooth_create_agent_proxy(sys_conn, agent_path); + if (!agent_proxy){ + fprintf(stdout,"create new agent_proxy failed\n"); + return EXIT_FAILURE; + } + + __display_notification( __notify_authorize_request_accept_cb, __notify_authorize_request_cancel_cb,agent_proxy); + } else if (!strcasecmp(event_type, "phonebook-request")) { + device_name = bundle_get_val(user_data, "device-name"); + agent_path = bundle_get_val(user_data, "agent-path"); + + sys_conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL); + if (sys_conn == NULL) { + fprintf(stdout,"ERROR: Can't get on system bus"); + return EXIT_FAILURE; + } + + agent_proxy = __bluetooth_create_agent_proxy(sys_conn, agent_path); + if (!agent_proxy){ + fprintf(stdout,"create new agent_proxy failed\n"); + return EXIT_FAILURE; + } + + __display_notification( __notify_authorize_request_accept_cb, __notify_authorize_request_cancel_cb,agent_proxy); + } else if (!strcasecmp(event_type, "message-request")) { + device_name = bundle_get_val(user_data, "device-name"); + agent_path = bundle_get_val(user_data, "agent-path"); + + sys_conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL); + if (sys_conn == NULL) { + fprintf(stdout,"ERROR: Can't get on system bus"); + return EXIT_FAILURE; + } + + agent_proxy = __bluetooth_create_agent_proxy(sys_conn, agent_path); + if (!agent_proxy){ + fprintf(stdout,"create new agent_proxy failed\n"); + return EXIT_FAILURE; + } + + __display_notification( __notify_authorize_request_accept_cb, __notify_authorize_request_cancel_cb,agent_proxy); + } + } + if (notification_list != NULL) { + notification_free_list(notification_list); + notification_list = NULL; + } + + return EXIT_SUCCESS; +} + +int +main(int argc, char **argv) +{ + if (!ecore_init()) { + fprintf(stderr, "ERROR: Cannot init Ecore!\n"); + return -1; + } + + notification_resister_changed_cb(__noti_changed_cb, NULL); + ecore_main_loop_begin(); + + shutdown: + ecore_shutdown(); + return 0; +} + diff --git a/configure.ac b/configure.ac index 394cdfe..56dec67 100644 --- a/configure.ac +++ b/configure.ac @@ -10,7 +10,7 @@ LT_PREREQ([2.2]) LT_INIT([disable-static]) PKG_PROG_PKG_CONFIG() -PKG_CHECK_MODULES([TIZEN], [eina ecore com-core notification]) +PKG_CHECK_MODULES([TIZEN], [eina ecore com-core notification dbus-1 bluetooth-api]) AC_SUBST(TIZEN_CFLAGS) AC_SUBST(TIZEN_LIBS) diff --git a/packaging/notification-service.spec b/packaging/notification-service.spec index 8d629db..f1657e8 100644 --- a/packaging/notification-service.spec +++ b/packaging/notification-service.spec @@ -9,6 +9,10 @@ BuildRequires: pkgconfig(eina) BuildRequires: pkgconfig(ecore) BuildRequires: pkgconfig(com-core) BuildRequires: pkgconfig(notification) +BuildRequires: dbus-devel +BuildRequires: pkgconfig(dbus-glib-1) +BuildRequires: bluetooth-frwk-devel +BuildRequires: bundle-devel %description Headless notification service that collects incoming notifications from the @@ -45,3 +49,4 @@ rm -rf %{buildroot} %defattr(-,root,root,-) %{_bindir}/sample-display-client %{_bindir}/send-notification +%{_bindir}/bluetooth_notification_client -- 2.7.4 From 9a127c22d26a2c7524f4491c008b07c4a8add6cd Mon Sep 17 00:00:00 2001 From: Rusty Lynch Date: Fri, 20 Sep 2013 11:22:39 -0700 Subject: [PATCH 06/16] Update changelog for release Change-Id: I21f247ec57cfab000a870cf63abe6ec489bff8c5 --- packaging/notification-service.changes | 4 ++++ packaging/notification-service.spec | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packaging/notification-service.changes b/packaging/notification-service.changes index 0493d52..01b10c1 100644 --- a/packaging/notification-service.changes +++ b/packaging/notification-service.changes @@ -1,3 +1,7 @@ +* Fri Sep 20 2013 Rusty Lynch accepted/tizen/20130917.000007@6b2a8d7 +- Add Bluetooth-client-notification to test bluetooth pairing +- Send and display content from notification + * Mon Sep 16 2013 Rusty Lynch submit/tizen/20130906.193836@a298f87 - Remove socket cleanup code - Add unit test for sending and recieving notifications diff --git a/packaging/notification-service.spec b/packaging/notification-service.spec index f1657e8..e48dfa8 100644 --- a/packaging/notification-service.spec +++ b/packaging/notification-service.spec @@ -1,6 +1,6 @@ Name: notification-service Summary: Simple notification service -Version: 0.0.2 +Version: 0.0.3 Release: 1 Group: Application Framework/Notifications License: Flora -- 2.7.4 From 81d8b0c9e8437729b0838433673a4fc1c792f613 Mon Sep 17 00:00:00 2001 From: Rusty Lynch Date: Thu, 24 Oct 2013 12:58:59 -0700 Subject: [PATCH 07/16] Fix build warnings - Stop using deprecated gets - Fix prototype for notification callback Change-Id: I56b088c461d04bf26ae568ce9074e0b680e57847 Signed-off-by: Rusty Lynch --- bluetooth_notification_client.c | 33 +++++++++++++++++---------------- packaging/notification-service.changes | 4 ++++ 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/bluetooth_notification_client.c b/bluetooth_notification_client.c index 50a3095..2ccd5ad 100644 --- a/bluetooth_notification_client.c +++ b/bluetooth_notification_client.c @@ -100,11 +100,12 @@ __display_notification(bt_notification cb_1, bt_notification cb_2, DBusGProxy *p notification_error_e err = NOTIFICATION_ERROR_NONE; int bt_yesno; bt_yesno = 1; - char line[256]; + char line[4]; fprintf(stdout, "Do you confirm yes or no ? "); while ( bt_yesno != 0){ - gets(line); + if (!fgets(line, sizeof(line), stdin)) + continue; if ( strcmp(line,"yes") == 0){ (cb_1) (proxy); bt_yesno = 0; @@ -122,7 +123,7 @@ __display_notification(bt_notification cb_1, bt_notification cb_2, DBusGProxy *p } -static int __noti_changed_cb(void *data, notification_type_e type) +static void __noti_changed_cb(void *data, notification_type_e type) { notification_h noti = NULL; notification_list_h notification_list = NULL; @@ -180,13 +181,13 @@ static int __noti_changed_cb(void *data, notification_type_e type) sys_conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL); if (sys_conn == NULL) { fprintf(stdout,"ERROR: Can't get on system bus"); - return EXIT_FAILURE; + return; } agent_proxy = __bluetooth_create_agent_proxy(sys_conn, agent_path); if (!agent_proxy){ fprintf(stdout,"create new agent_proxy failed\n"); - return EXIT_FAILURE; + return; } __display_notification(__notify_passkey_confirm_request_accept_cb, __notify_passkey_confirm_request_cancel_cb,agent_proxy); @@ -205,13 +206,13 @@ static int __noti_changed_cb(void *data, notification_type_e type) sys_conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL); if (sys_conn == NULL) { fprintf(stdout,"ERROR: Can't get on system bus"); - return EXIT_FAILURE; + return; } agent_proxy = __bluetooth_create_agent_proxy(sys_conn, agent_path); if (!agent_proxy){ fprintf(stdout,"create new agent_proxy failed\n"); - return EXIT_FAILURE; + return; } __display_notification( __notify_authorize_request_accept_cb, __notify_authorize_request_cancel_cb,agent_proxy); @@ -226,13 +227,13 @@ static int __noti_changed_cb(void *data, notification_type_e type) sys_conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL); if (sys_conn == NULL) { fprintf(stdout,"ERROR: Can't get on system bus"); - return EXIT_FAILURE; + return; } obex_proxy = __bluetooth_create_obex_proxy(sys_conn); if (!obex_proxy){ fprintf(stdout,"create new obex_proxy failed\n"); - return EXIT_FAILURE; + return; } __display_notification( __notify_push_authorize_request_accept_cb, __notify_push_authorize_request_cancel_cb,obex_proxy); @@ -255,13 +256,13 @@ static int __noti_changed_cb(void *data, notification_type_e type) sys_conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL); if (sys_conn == NULL) { fprintf(stdout,"ERROR: Can't get on system bus"); - return EXIT_FAILURE; + return; } agent_proxy = __bluetooth_create_agent_proxy(sys_conn, agent_path); if (!agent_proxy){ fprintf(stdout,"create new agent_proxy failed\n"); - return EXIT_FAILURE; + return; } __display_notification( __notify_authorize_request_accept_cb, __notify_authorize_request_cancel_cb,agent_proxy); @@ -272,13 +273,13 @@ static int __noti_changed_cb(void *data, notification_type_e type) sys_conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL); if (sys_conn == NULL) { fprintf(stdout,"ERROR: Can't get on system bus"); - return EXIT_FAILURE; + return; } agent_proxy = __bluetooth_create_agent_proxy(sys_conn, agent_path); if (!agent_proxy){ fprintf(stdout,"create new agent_proxy failed\n"); - return EXIT_FAILURE; + return; } __display_notification( __notify_authorize_request_accept_cb, __notify_authorize_request_cancel_cb,agent_proxy); @@ -289,13 +290,13 @@ static int __noti_changed_cb(void *data, notification_type_e type) sys_conn = dbus_g_bus_get(DBUS_BUS_SYSTEM, NULL); if (sys_conn == NULL) { fprintf(stdout,"ERROR: Can't get on system bus"); - return EXIT_FAILURE; + return; } agent_proxy = __bluetooth_create_agent_proxy(sys_conn, agent_path); if (!agent_proxy){ fprintf(stdout,"create new agent_proxy failed\n"); - return EXIT_FAILURE; + return; } __display_notification( __notify_authorize_request_accept_cb, __notify_authorize_request_cancel_cb,agent_proxy); @@ -306,7 +307,7 @@ static int __noti_changed_cb(void *data, notification_type_e type) notification_list = NULL; } - return EXIT_SUCCESS; + return; } int diff --git a/packaging/notification-service.changes b/packaging/notification-service.changes index 01b10c1..27d4d6b 100644 --- a/packaging/notification-service.changes +++ b/packaging/notification-service.changes @@ -1,3 +1,7 @@ +* Thu Oct 24 2013 Rusty Lynch accepted/tizen/20130920.213625@237321e +- Fix build warnings by no longer using 'gets' and fixing the + prototype for notification callback + * Fri Sep 20 2013 Rusty Lynch accepted/tizen/20130917.000007@6b2a8d7 - Add Bluetooth-client-notification to test bluetooth pairing - Send and display content from notification -- 2.7.4 From 42929a10a04bfe1b91648fad8d12bb6a57ca9364 Mon Sep 17 00:00:00 2001 From: Corentin Lecouvey Date: Thu, 16 Jan 2014 15:28:45 +0100 Subject: [PATCH 08/16] Do not use systemd socket mechanism Notifications daemon discusses with its clients using secure sockets. Secure sockets are not adapted to systemd socket. Now notifications daemon is started at boot time. Change-Id: If6ee8164df1d1db18b973da62d5b066d06c44524 Signed-off-by: Corentin Lecouvey --- Makefile.am | 8 ++------ configure.ac | 2 +- notifications.service.in | 6 ++++++ packaging/notification-service.spec | 25 ++++++++++++++++--------- 4 files changed, 25 insertions(+), 16 deletions(-) diff --git a/Makefile.am b/Makefile.am index 28b715c..60a8844 100644 --- a/Makefile.am +++ b/Makefile.am @@ -23,12 +23,8 @@ bluetooth_notification_client_CFLAGS = -I. $(TIZEN_CFLAGS) bluetooth_notification_client_LDADD = $(TIZEN_LIBS) SCRIPT_IN_FILES = \ - notifications.service.in \ - notifications.socket.in + notifications.service.in install-data-hook: - $(mkinstalldirs) $(DESTDIR)/usr/lib/systemd/system/sockets.target.wants + $(mkinstalldirs) $(DESTDIR)/usr/lib/systemd/system/ install -m 0644 notifications.service $(DESTDIR)/usr/lib/systemd/system/notifications.service - install -m 0644 notifications.socket $(DESTDIR)/usr/lib/systemd/system/notifications.socket - ln -fs ../notifications.socket $(DESTDIR)/usr/lib/systemd/system/sockets.target.wants/notifications.socket - diff --git a/configure.ac b/configure.ac index 56dec67..9f7eae1 100644 --- a/configure.ac +++ b/configure.ac @@ -14,6 +14,6 @@ PKG_CHECK_MODULES([TIZEN], [eina ecore com-core notification dbus-1 bluetooth-ap AC_SUBST(TIZEN_CFLAGS) AC_SUBST(TIZEN_LIBS) -AC_CONFIG_FILES([Makefile notifications.service notifications.socket]) +AC_CONFIG_FILES([Makefile notifications.service]) AC_PROG_RANLIB([ranlib]) AC_OUTPUT diff --git a/notifications.service.in b/notifications.service.in index 47db370..ebbd62c 100644 --- a/notifications.service.in +++ b/notifications.service.in @@ -1,2 +1,8 @@ +[Unit] +Description=Notifications daemon + [Service] ExecStart=/usr/bin/notification-service + +[Install] +WantedBy=graphical.target diff --git a/packaging/notification-service.spec b/packaging/notification-service.spec index e48dfa8..ecea933 100644 --- a/packaging/notification-service.spec +++ b/packaging/notification-service.spec @@ -9,10 +9,11 @@ BuildRequires: pkgconfig(eina) BuildRequires: pkgconfig(ecore) BuildRequires: pkgconfig(com-core) BuildRequires: pkgconfig(notification) -BuildRequires: dbus-devel +BuildRequires: pkgconfig(dbus-1) BuildRequires: pkgconfig(dbus-glib-1) -BuildRequires: bluetooth-frwk-devel -BuildRequires: bundle-devel +BuildRequires: pkgconfig(bluetooth-api) +BuildRequires: pkgconfig(bundle) +%{?systemd_requires} %description Headless notification service that collects incoming notifications from the @@ -28,22 +29,28 @@ This package provides unit test used in the development of the notification serv %prep %setup -q -n %{name}-%{version} -%define PREFIX %{_prefix}/apps/ - %build %autogen make %{?_smp_mflags} %install -rm -rf %{buildroot} %make_install +%install_service graphical.target.wants notifications.service + +%post +%systemd_post notifications.service + +%preun +%systemd_preun notifications.service + +%postun +%systemd_postun notifications.service %files %defattr(-,root,root,-) %{_bindir}/notification-service -%{_libdir}/systemd/system/notifications.service -%{_libdir}/systemd/system/notifications.socket -%{_libdir}/systemd/system/sockets.target.wants/notifications.socket +%{_unitdir}/notifications.service +%{_unitdir}/graphical.target.wants/notifications.service %files test %defattr(-,root,root,-) -- 2.7.4 From 800d8f5c481bda3fd05868f575a9b945e726a2eb Mon Sep 17 00:00:00 2001 From: Corentin Lecouvey Date: Thu, 16 Jan 2014 15:42:04 +0100 Subject: [PATCH 09/16] adapt agent dbus interface to BlueZ 5 in test program Change-Id: Ic17652f6d5dda394c168f892b2452305648f663b Signed-off-by: Corentin Lecouvey --- bluetooth_notification_client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bluetooth_notification_client.c b/bluetooth_notification_client.c index 2ccd5ad..ffe475e 100644 --- a/bluetooth_notification_client.c +++ b/bluetooth_notification_client.c @@ -23,7 +23,7 @@ __bluetooth_create_agent_proxy(DBusGConnection *sys_conn, const char *path) return dbus_g_proxy_new_for_name (sys_conn, "org.projectx.bt", path, - "org.bluez.Agent"); + "org.bluez.Agent1"); } static DBusGProxy* -- 2.7.4 From 5c1deada45c2f66ba1f493bee8bc333914e0ff29 Mon Sep 17 00:00:00 2001 From: Manuel Bachmann Date: Tue, 20 May 2014 11:43:35 +0200 Subject: [PATCH 10/16] send-notification: do not send a notification when using "--help" The "--help" option should make the program display the help text and return directly, not sending a blank notification. Change-Id: Ifb2f9ede3b64338cba792c6b98a9e9f610fd5a11 Signed-off-by: Manuel Bachmann --- send_notification.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/send_notification.c b/send_notification.c index 0a15d86..a42b9dd 100644 --- a/send_notification.c +++ b/send_notification.c @@ -75,6 +75,7 @@ main(int argc, char **argv) char *icon = NULL; char *image = NULL; int imageType = 0; + Eina_Bool quit = EINA_FALSE; Eina_Bool remove = EINA_FALSE; notification_h noti = NULL; notification_error_e err = NOTIFICATION_ERROR_NONE; @@ -85,7 +86,8 @@ main(int argc, char **argv) ECORE_GETOPT_VALUE_STR(icon), ECORE_GETOPT_VALUE_STR(image), ECORE_GETOPT_VALUE_INT(imageType), - ECORE_GETOPT_VALUE_NONE + ECORE_GETOPT_VALUE_NONE, + ECORE_GETOPT_VALUE_BOOL(quit) }; if (!ecore_init()) { @@ -98,6 +100,9 @@ main(int argc, char **argv) return -1; } + if (quit) + return 0; + noti = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE); -- 2.7.4 From 97d87d6956ae90d7bc9988480028cc8d5e647652 Mon Sep 17 00:00:00 2001 From: Stephane Desneux Date: Thu, 22 May 2014 00:44:36 +0200 Subject: [PATCH 11/16] Fix build dependency (notification-service-devel) Commit 38b527f on platform/core/api/notification splitted notification API in two packages. Dependency on notification-service-devel was added. Change-Id: I40cbfd36281275fd89ab4daf671e406db9fb8a49 Signed-off-by: Stephane Desneux --- notification_service.c | 4 ++-- packaging/notification-service.spec | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/notification_service.c b/notification_service.c index 93e8d52..569de48 100644 --- a/notification_service.c +++ b/notification_service.c @@ -16,8 +16,8 @@ #include #include #include -#include -#include +#include +#include #include #include "service_common.h" diff --git a/packaging/notification-service.spec b/packaging/notification-service.spec index ecea933..33aad4f 100644 --- a/packaging/notification-service.spec +++ b/packaging/notification-service.spec @@ -5,10 +5,11 @@ Release: 1 Group: Application Framework/Notifications License: Flora Source0: %{name}-%{version}.tar.bz2 -BuildRequires: pkgconfig(eina) -BuildRequires: pkgconfig(ecore) -BuildRequires: pkgconfig(com-core) +BuildRequires: pkgconfig(eina) +BuildRequires: pkgconfig(ecore) +BuildRequires: pkgconfig(com-core) BuildRequires: pkgconfig(notification) +BuildRequires: pkgconfig(notification-service) BuildRequires: pkgconfig(dbus-1) BuildRequires: pkgconfig(dbus-glib-1) BuildRequires: pkgconfig(bluetooth-api) -- 2.7.4 From 81c3bdc85bb1ca835b41a95c1bca0eef8ac89a86 Mon Sep 17 00:00:00 2001 From: Manuel Bachmann Date: Fri, 29 Aug 2014 10:35:50 +0200 Subject: [PATCH 12/16] send-notification: do not send a notification when using "--help" Change-Id: I5d0b339e0c7e1dca644839d3e5e2061393687c7b Signed-off-by: Manuel Bachmann --- send_notification.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/send_notification.c b/send_notification.c index 0a15d86..a42b9dd 100644 --- a/send_notification.c +++ b/send_notification.c @@ -75,6 +75,7 @@ main(int argc, char **argv) char *icon = NULL; char *image = NULL; int imageType = 0; + Eina_Bool quit = EINA_FALSE; Eina_Bool remove = EINA_FALSE; notification_h noti = NULL; notification_error_e err = NOTIFICATION_ERROR_NONE; @@ -85,7 +86,8 @@ main(int argc, char **argv) ECORE_GETOPT_VALUE_STR(icon), ECORE_GETOPT_VALUE_STR(image), ECORE_GETOPT_VALUE_INT(imageType), - ECORE_GETOPT_VALUE_NONE + ECORE_GETOPT_VALUE_NONE, + ECORE_GETOPT_VALUE_BOOL(quit) }; if (!ecore_init()) { @@ -98,6 +100,9 @@ main(int argc, char **argv) return -1; } + if (quit) + return 0; + noti = notification_new(NOTIFICATION_TYPE_NOTI, NOTIFICATION_GROUP_ID_NONE, NOTIFICATION_PRIV_ID_NONE); -- 2.7.4 From a6677f7ec1ca22e265d02e7d2f2418bd08f7d033 Mon Sep 17 00:00:00 2001 From: Corentin Lecouvey Date: Fri, 29 Aug 2014 14:10:00 +0200 Subject: [PATCH 13/16] bluetooth_notification_client: activate GUI notifications Add a dependency on libwlmessage, which will be used by blueooth_notification_client to display popup messages on both Wayland and X11. dlog some of the error messages. Change-Id: Ic85de8aad4f20f080c6776ded5dd2237b6364271 Signed-off-by: Manuel Bachmann Author: Manuel Bachmann Author: Corentin Lecouvey --- bluetooth_notification_client.c | 42 ++++++++++++++++++++++++++++++------- configure.ac | 2 +- packaging/notification-service.spec | 4 ++++ 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/bluetooth_notification_client.c b/bluetooth_notification_client.c index ffe475e..bffaecd 100644 --- a/bluetooth_notification_client.c +++ b/bluetooth_notification_client.c @@ -6,6 +6,8 @@ #include #include #include +#include +#include typedef enum { BT_AGENT_ACCEPT, @@ -98,27 +100,46 @@ __display_notification(bt_notification cb_1, bt_notification cb_2, DBusGProxy *p { notification_error_e err = NOTIFICATION_ERROR_NONE; - int bt_yesno; - bt_yesno = 1; + int bt_yesno = 1; char line[4]; + struct wlmessage *wlmessage = wlmessage_create(); + wlmessage_set_message(wlmessage, "Do you confirm ?"); + wlmessage_add_button(wlmessage, 1, "Yes"); + wlmessage_add_button(wlmessage, 0, "No"); + wlmessage_set_default_button(wlmessage, 1); + bt_yesno = wlmessage_show(wlmessage, NULL); + wlmessage_destroy(wlmessage); + + if (bt_yesno == 1) { + LOGD("user accepts to pair with device "); + (cb_1) (proxy); + } else if (bt_yesno == 0) { + LOGD("user rejects to pair with device "); + (cb_2) (proxy); + } + +#if 0 fprintf(stdout, "Do you confirm yes or no ? "); while ( bt_yesno != 0){ if (!fgets(line, sizeof(line), stdin)) continue; - if ( strcmp(line,"yes") == 0){ + if (strncmp("yes", line, 3) == 0) { + LOGD("user accepts to pair with device "); (cb_1) (proxy); bt_yesno = 0; - } else if ( strcmp(line,"no") == 0){ + } else if (strncmp("no", line, 2) == 0) { + LOGD("user rejects to pair with device "); (cb_2) (proxy); bt_yesno = 0; } else { - fprintf(stdout," yes or no :"); + fprintf(stdout," yes or no ?\n"); } } +#endif err = notification_delete_all_by_type("bluetooth-frwk-bt-service", NOTIFICATION_TYPE_NOTI); if (err != NOTIFICATION_ERROR_NONE) { - fprintf(stdout, "Unable to remove notifications"); + LOGE("Unable to remove notifications"); } } @@ -169,6 +190,11 @@ static void __noti_changed_cb(void *data, notification_type_e type) event_type = bundle_get_val(user_data, "event-type"); + if (!event_type) { + LOGD("Not a bluetooth-related notification..."); + return; + } + if(!strcasecmp(event_type, "pin-request")) { /* Not implemented */ fprintf(stdout," Not implemented\n"); @@ -314,7 +340,7 @@ int main(int argc, char **argv) { if (!ecore_init()) { - fprintf(stderr, "ERROR: Cannot init Ecore!\n"); + LOGE("ERROR: Cannot init Ecore!\n"); return -1; } @@ -323,6 +349,6 @@ main(int argc, char **argv) shutdown: ecore_shutdown(); - return 0; + return 1; } diff --git a/configure.ac b/configure.ac index 9f7eae1..194baa9 100644 --- a/configure.ac +++ b/configure.ac @@ -10,7 +10,7 @@ LT_PREREQ([2.2]) LT_INIT([disable-static]) PKG_PROG_PKG_CONFIG() -PKG_CHECK_MODULES([TIZEN], [eina ecore com-core notification dbus-1 bluetooth-api]) +PKG_CHECK_MODULES([TIZEN], [eina ecore com-core notification dbus-1 bluetooth-api dlog libwlmessage]) AC_SUBST(TIZEN_CFLAGS) AC_SUBST(TIZEN_LIBS) diff --git a/packaging/notification-service.spec b/packaging/notification-service.spec index 33aad4f..8772d1e 100644 --- a/packaging/notification-service.spec +++ b/packaging/notification-service.spec @@ -1,3 +1,5 @@ +%bcond_with wayland + Name: notification-service Summary: Simple notification service Version: 0.0.3 @@ -13,7 +15,9 @@ BuildRequires: pkgconfig(notification-service) BuildRequires: pkgconfig(dbus-1) BuildRequires: pkgconfig(dbus-glib-1) BuildRequires: pkgconfig(bluetooth-api) +BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(bundle) +BuildRequires: pkgconfig(libwlmessage) %{?systemd_requires} %description -- 2.7.4 From 2e671f2fe8c77fc9b560148f0263f26ec5b88713 Mon Sep 17 00:00:00 2001 From: Corentin Lecouvey Date: Mon, 1 Sep 2014 10:05:17 +0200 Subject: [PATCH 14/16] Create a "notification-display-service" daemon "notification-display-service" is run by a systemd unit named "notifications-display.service" ; if we are running under a Wayland or X11 profile, it will display new notifications under the form of customized popup windows, and delete them once they are validated with "Ok". Otherwise, it will just print the messages to stderr without deleting them. Change-Id: Id33b01d67df4d731f666c2b145262642ca21cdbc Signed-off-by: Manuel Bachmann Author: Manuel Bachmann Author: Corentin Lecouvey --- Makefile.am | 10 ++++- configure.ac | 2 +- notification_display_service.c | 87 +++++++++++++++++++++++++++++++++++++ notifications-display.service.in | 11 +++++ packaging/notification-service.spec | 4 ++ 5 files changed, 111 insertions(+), 3 deletions(-) create mode 100644 notification_display_service.c create mode 100644 notifications-display.service.in diff --git a/Makefile.am b/Makefile.am index 60a8844..3ff5d19 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -bin_PROGRAMS = notification-service sample-display-client send-notification bluetooth_notification_client +bin_PROGRAMS = notification-service notification-display-service sample-display-client send-notification bluetooth_notification_client AM_CFLAGS = $(GCC_CFLAGS) AM_CPPFLAGS = $(GCC_CFLAGS) @@ -10,6 +10,10 @@ notification_service_SOURCES = \ notification_service_CFLAGS = -I. $(TIZEN_CFLAGS) notification_service_LDADD = $(TIZEN_LIBS) +notification_display_service_SOURCES = notification_display_service.c +notification_display_service_CFLAGS = -I. $(TIZEN_CFLAGS) +notification_display_service_LDADD = $(TIZEN_LIBS) + send_notification_SOURCES = send_notification.c send_notification_CFLAGS = -I. $(TIZEN_CFLAGS) send_notification_LDADD = $(TIZEN_LIBS) @@ -23,8 +27,10 @@ bluetooth_notification_client_CFLAGS = -I. $(TIZEN_CFLAGS) bluetooth_notification_client_LDADD = $(TIZEN_LIBS) SCRIPT_IN_FILES = \ - notifications.service.in + notifications.service.in \ + notifications-display.service.in install-data-hook: $(mkinstalldirs) $(DESTDIR)/usr/lib/systemd/system/ install -m 0644 notifications.service $(DESTDIR)/usr/lib/systemd/system/notifications.service + install -m 0644 notifications-display.service $(DESTDIR)/usr/lib/systemd/system/notifications-display.service diff --git a/configure.ac b/configure.ac index 194baa9..edb8edb 100644 --- a/configure.ac +++ b/configure.ac @@ -14,6 +14,6 @@ PKG_CHECK_MODULES([TIZEN], [eina ecore com-core notification dbus-1 bluetooth-ap AC_SUBST(TIZEN_CFLAGS) AC_SUBST(TIZEN_LIBS) -AC_CONFIG_FILES([Makefile notifications.service]) +AC_CONFIG_FILES([Makefile notifications.service notifications-display.service]) AC_PROG_RANLIB([ranlib]) AC_OUTPUT diff --git a/notification_display_service.c b/notification_display_service.c new file mode 100644 index 0000000..df35e42 --- /dev/null +++ b/notification_display_service.c @@ -0,0 +1,87 @@ +#include +#include +#include +#include +#include +#include + + +void display_notifications_cb (void *data, notification_type_e notif_type) +{ + notification_h noti = NULL; + notification_list_h notification_list = NULL; + notification_list_h get_list = NULL; + + char *pkgname = NULL; + char *title = NULL; + char *content = NULL; + char *image_path = NULL; + + notification_get_list (NOTIFICATION_TYPE_NOTI, -1, ¬ification_list); + if (notification_list) { + get_list = notification_list_get_head (notification_list); + while (get_list) { + noti = notification_list_get_data (get_list); + notification_get_pkgname (noti, &pkgname); + if (pkgname == NULL) + notification_get_application (noti, &pkgname); + notification_get_title (noti, &title, NULL); + notification_get_text (noti, NOTIFICATION_TEXT_TYPE_CONTENT, &content); + notification_get_image (noti, NOTIFICATION_IMAGE_TYPE_ICON, &image_path); + + struct wlmessage *wlmessage = wlmessage_create (); + wlmessage_set_title (wlmessage, title); + wlmessage_set_icon (wlmessage, image_path); + wlmessage_set_message (wlmessage, content); + wlmessage_add_button (wlmessage, 0, "Ok"); + if (wlmessage_show (wlmessage, NULL) < 0) { + wlmessage_destroy (wlmessage); + return; + } + wlmessage_destroy (wlmessage); + + LOGD("\nNew Notification : %s\n", title); + LOGD("Icon : %s\n", image_path); + LOGD("Message : %s\n", content); + + get_list = notification_list_remove(get_list, noti); + notification_delete(noti); + } + } +} + +int main (int argc, char **argv) +{ + GMainLoop *mainloop = NULL; + notification_error_e error_n; + int error_s; + struct stat buf; + +retry_socket: + LOGD("Checking if the notifications server socket exists..."); + error_s = stat ("/tmp/.notification.service", &buf); + if (error_s == -1) { + LOGD("Could not find the notifications server socket"); + sleep (5); + goto retry_socket; + } + +retry_service: + LOGD("Checking if the notifications server is available..."); + error_n = notification_resister_changed_cb (display_notifications_cb, NULL); + if (error_n != NOTIFICATION_ERROR_NONE) { + LOGD("Could not register with notifications server"); + sleep (5); + goto retry_service; + } + + mainloop = g_main_loop_new (NULL, FALSE); + if (!mainloop) { + printf ("Failed to create the GLib main loop\n"); + return -1; + } + + g_main_loop_run (mainloop); + + return 0; +} diff --git a/notifications-display.service.in b/notifications-display.service.in new file mode 100644 index 0000000..11481e5 --- /dev/null +++ b/notifications-display.service.in @@ -0,0 +1,11 @@ +[Unit] +Description=Notifications Popup daemon +Requires=notifications.service display-manager-run.service +After=notifications.service display-manager-run.service + +[Service] +ExecStart=/usr/bin/notification-display-service +EnvironmentFile=/etc/sysconfig/weston + +[Install] +WantedBy=graphical.target diff --git a/packaging/notification-service.spec b/packaging/notification-service.spec index 8772d1e..cc557c6 100644 --- a/packaging/notification-service.spec +++ b/packaging/notification-service.spec @@ -41,6 +41,7 @@ make %{?_smp_mflags} %install %make_install %install_service graphical.target.wants notifications.service +%install_service graphical.target.wants notifications-display.service %post %systemd_post notifications.service @@ -54,8 +55,11 @@ make %{?_smp_mflags} %files %defattr(-,root,root,-) %{_bindir}/notification-service +%{_bindir}/notification-display-service %{_unitdir}/notifications.service +%{_unitdir}/notifications-display.service %{_unitdir}/graphical.target.wants/notifications.service +%{_unitdir}/graphical.target.wants/notifications-display.service %files test %defattr(-,root,root,-) -- 2.7.4 From 0a2700ea5288a37c1eaf90fd97116037db4d634b Mon Sep 17 00:00:00 2001 From: Manuel Bachmann Date: Wed, 10 Sep 2014 16:48:55 +0200 Subject: [PATCH 15/16] Introduce the display plugin system At startup, "notification-display-service" will now search for plugins in the "/usr/lib$ARCH/notification-service /plugins" directory. If one is found, it will use it to display notifications on screens. Otherwise, it will fall back to pure text with dlog. There is currently one plugin : wlmessage.so. Change-Id: I663fc24ec2c9fd8c1f0a2f07be08f479f2a4569d Signed-off-by: Manuel Bachmann --- Makefile.am | 7 ++- configure.ac | 7 ++- notification_display_service.c | 112 +++++++++++++++++++++++++----------- packaging/notification-service.spec | 1 + plugins/Makefile.am | 14 +++++ plugins/wlmessage.c | 30 ++++++++++ 6 files changed, 134 insertions(+), 37 deletions(-) create mode 100644 plugins/Makefile.am create mode 100644 plugins/wlmessage.c diff --git a/Makefile.am b/Makefile.am index 3ff5d19..532cab3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,10 @@ +SUBDIRS = plugins +moduledir = $(libdir)/notification-service/plugins + bin_PROGRAMS = notification-service notification-display-service sample-display-client send-notification bluetooth_notification_client AM_CFLAGS = $(GCC_CFLAGS) -AM_CPPFLAGS = $(GCC_CFLAGS) +AM_CPPFLAGS = $(GCC_CFLAGS) -DPLUGINSDIR='"$(moduledir)"' notification_service_SOURCES = \ main.c \ @@ -12,7 +15,7 @@ notification_service_LDADD = $(TIZEN_LIBS) notification_display_service_SOURCES = notification_display_service.c notification_display_service_CFLAGS = -I. $(TIZEN_CFLAGS) -notification_display_service_LDADD = $(TIZEN_LIBS) +notification_display_service_LDADD = $(TIZEN_LIBS) $(DLOPEN_LIBS) send_notification_SOURCES = send_notification.c send_notification_CFLAGS = -I. $(TIZEN_CFLAGS) diff --git a/configure.ac b/configure.ac index edb8edb..2987c6b 100644 --- a/configure.ac +++ b/configure.ac @@ -10,10 +10,15 @@ LT_PREREQ([2.2]) LT_INIT([disable-static]) PKG_PROG_PKG_CONFIG() + +AC_CHECK_FUNC([dlopen], [], + AC_CHECK_LIB([dl], [dlopen], DLOPEN_LIBS="-ldl")) +AC_SUBST(DLOPEN_LIBS) + PKG_CHECK_MODULES([TIZEN], [eina ecore com-core notification dbus-1 bluetooth-api dlog libwlmessage]) AC_SUBST(TIZEN_CFLAGS) AC_SUBST(TIZEN_LIBS) -AC_CONFIG_FILES([Makefile notifications.service notifications-display.service]) +AC_CONFIG_FILES([Makefile plugins/Makefile notifications.service notifications-display.service]) AC_PROG_RANLIB([ranlib]) AC_OUTPUT diff --git a/notification_display_service.c b/notification_display_service.c index df35e42..30211ac 100644 --- a/notification_display_service.c +++ b/notification_display_service.c @@ -1,66 +1,110 @@ #include -#include +#include #include +#include #include +#include #include -#include -void display_notifications_cb (void *data, notification_type_e notif_type) +void load_plugins (char *path, int (**fct)(notification_h)) { - notification_h noti = NULL; - notification_list_h notification_list = NULL; - notification_list_h get_list = NULL; + DIR *dir; + struct dirent *plugins_dir; + char *plugin_path; + void *plugin; + int (*plugin_fct)(notification_h); + + dir = opendir (path); + if (!dir) + return; + + while ((plugins_dir = readdir(dir)) != NULL) { + if (g_str_has_suffix (plugins_dir->d_name, ".so")) { + plugin_path = g_strconcat (path, G_DIR_SEPARATOR_S, plugins_dir->d_name, NULL); + plugin = dlopen (plugin_path, RTLD_NOW | RTLD_LOCAL); + plugin_fct = dlsym (plugin, "display_notification"); + g_free (plugin_path); + if (!plugin) { + LOGD("\"%s\" is not a plugin, continuing", plugins_dir->d_name); + continue; + } else if (!plugin_fct) { + LOGD("Plugin \"%s\" incompatible, continuing", plugins_dir->d_name); + dlclose (plugins_dir->d_name); + continue; + } else { + /* use the first working plugin, if not configured otherwise */ + LOGD("Plugin \"%s\" compatible, loading...", plugins_dir->d_name); + *fct = plugin_fct; + break; + } + } + } + + closedir (dir); +} +int display_notification_text (notification_h noti) +{ char *pkgname = NULL; char *title = NULL; char *content = NULL; char *image_path = NULL; + notification_get_pkgname (noti, &pkgname); + if (pkgname == NULL) + notification_get_application (noti, &pkgname); + notification_get_title (noti, &title, NULL); + notification_get_text (noti, NOTIFICATION_TEXT_TYPE_CONTENT, &content); + notification_get_image (noti, NOTIFICATION_IMAGE_TYPE_ICON, &image_path); + + LOGD("\nNew Notification : %s", title); + LOGD("Icon : %s", image_path); + LOGD("Message : %s", content); + + return 1; +} + +void display_notifications_cb (void *data, notification_type_e notif_type) +{ + int (*fct)(notification_h) = data; + notification_h noti = NULL; + notification_list_h notification_list = NULL; + notification_list_h get_list = NULL; + notification_get_list (NOTIFICATION_TYPE_NOTI, -1, ¬ification_list); if (notification_list) { get_list = notification_list_get_head (notification_list); while (get_list) { noti = notification_list_get_data (get_list); - notification_get_pkgname (noti, &pkgname); - if (pkgname == NULL) - notification_get_application (noti, &pkgname); - notification_get_title (noti, &title, NULL); - notification_get_text (noti, NOTIFICATION_TEXT_TYPE_CONTENT, &content); - notification_get_image (noti, NOTIFICATION_IMAGE_TYPE_ICON, &image_path); - - struct wlmessage *wlmessage = wlmessage_create (); - wlmessage_set_title (wlmessage, title); - wlmessage_set_icon (wlmessage, image_path); - wlmessage_set_message (wlmessage, content); - wlmessage_add_button (wlmessage, 0, "Ok"); - if (wlmessage_show (wlmessage, NULL) < 0) { - wlmessage_destroy (wlmessage); - return; - } - wlmessage_destroy (wlmessage); - - LOGD("\nNew Notification : %s\n", title); - LOGD("Icon : %s\n", image_path); - LOGD("Message : %s\n", content); - get_list = notification_list_remove(get_list, noti); - notification_delete(noti); + /* if the display function was successful, delete the notification */ + if ( (*fct)(noti) ) { + get_list = notification_list_remove(get_list, noti); + notification_delete(noti); + } } } } + int main (int argc, char **argv) { GMainLoop *mainloop = NULL; + gboolean error_s; notification_error_e error_n; - int error_s; - struct stat buf; + int (*disp_fct)(notification_h); + + /* fall back to pure text notification if no plugin works */ + disp_fct = &display_notification_text; + LOGD("Checking for display plugins..."); + if (g_file_test (PLUGINSDIR, G_FILE_TEST_IS_DIR)) + load_plugins (PLUGINSDIR, &disp_fct); retry_socket: LOGD("Checking if the notifications server socket exists..."); - error_s = stat ("/tmp/.notification.service", &buf); - if (error_s == -1) { + error_s = g_file_test ("/tmp/.notification.service", G_FILE_TEST_EXISTS); + if (!error_s) { LOGD("Could not find the notifications server socket"); sleep (5); goto retry_socket; @@ -68,7 +112,7 @@ retry_socket: retry_service: LOGD("Checking if the notifications server is available..."); - error_n = notification_resister_changed_cb (display_notifications_cb, NULL); + error_n = notification_resister_changed_cb (display_notifications_cb, (*disp_fct)); if (error_n != NOTIFICATION_ERROR_NONE) { LOGD("Could not register with notifications server"); sleep (5); diff --git a/packaging/notification-service.spec b/packaging/notification-service.spec index cc557c6..68dd000 100644 --- a/packaging/notification-service.spec +++ b/packaging/notification-service.spec @@ -56,6 +56,7 @@ make %{?_smp_mflags} %defattr(-,root,root,-) %{_bindir}/notification-service %{_bindir}/notification-display-service +%{_libdir}/notification-service/plugins/wlmessage.so %{_unitdir}/notifications.service %{_unitdir}/notifications-display.service %{_unitdir}/graphical.target.wants/notifications.service diff --git a/plugins/Makefile.am b/plugins/Makefile.am new file mode 100644 index 0000000..0d2c4b7 --- /dev/null +++ b/plugins/Makefile.am @@ -0,0 +1,14 @@ +bin_PROGRAMS = +moduledir = $(libdir)/notification-service/plugins + +AM_CFLAGS = $(GCC_CFLAGS) +AM_CPPFLAGS = $(GCC_CFLAGS) + +module_LTLIBRARIES = wlmessage.la + +wlmessage_la_SOURCES = wlmessage.c + +wlmessage_la_LDFLAGS = -module -avoid-version +wlmessage_la_CPPFLAGS = $(AM_CPPFLAGS) +wlmessage_la_CFLAGS = $(TIZEN_CFLAGS) +wlmessage_la_LIBADD = $(TIZEN_LIBS) diff --git a/plugins/wlmessage.c b/plugins/wlmessage.c new file mode 100644 index 0000000..6f691af --- /dev/null +++ b/plugins/wlmessage.c @@ -0,0 +1,30 @@ +#include +#include + + +int display_notification (notification_h noti) +{ + char *pkgname = NULL; + char *title = NULL; + char *content = NULL; + char *image_path = NULL; + + notification_get_pkgname (noti, &pkgname); + if (pkgname == NULL) + notification_get_application (noti, &pkgname); + notification_get_title (noti, &title, NULL); + notification_get_text (noti, NOTIFICATION_TEXT_TYPE_CONTENT, &content); + notification_get_image (noti, NOTIFICATION_IMAGE_TYPE_ICON, &image_path); + + struct wlmessage *wlmessage = wlmessage_create (); + wlmessage_set_title (wlmessage, title); + wlmessage_set_icon (wlmessage, image_path); + wlmessage_set_message (wlmessage, content); + wlmessage_add_button (wlmessage, 0, "Ok"); + if (wlmessage_show (wlmessage, NULL) < 0) { + wlmessage_destroy (wlmessage); + return 0; + } + + return 1; +} -- 2.7.4 From 016f2f96cea05033d91759b9bb67fcf08095e317 Mon Sep 17 00:00:00 2001 From: Manuel Bachmann Date: Wed, 17 Sep 2014 14:55:28 +0200 Subject: [PATCH 16/16] Add an IVI-specific systemd service IVI does not have a systemd setup similar to Common, most notably the Weston part. This makes starting "notifications-display.service" on IVI fail. Fix that. This can safely be reverted in the future. Change-Id: I48f169082a0e12e4b778710a2a34d8a4efcbe87f Signed-off-by: Manuel Bachmann --- Makefile.am | 5 +++-- configure.ac | 7 ++++++- notifications-display-ivi.service.in | 11 +++++++++++ packaging/notification-service.spec | 9 ++++++++- 4 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 notifications-display-ivi.service.in diff --git a/Makefile.am b/Makefile.am index 532cab3..f7ff9f5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -31,9 +31,10 @@ bluetooth_notification_client_LDADD = $(TIZEN_LIBS) SCRIPT_IN_FILES = \ notifications.service.in \ - notifications-display.service.in + notifications-display.service.in \ + notifications-display-ivi.service.in install-data-hook: $(mkinstalldirs) $(DESTDIR)/usr/lib/systemd/system/ install -m 0644 notifications.service $(DESTDIR)/usr/lib/systemd/system/notifications.service - install -m 0644 notifications-display.service $(DESTDIR)/usr/lib/systemd/system/notifications-display.service + install -m 0644 $(notif_display_service) $(DESTDIR)/usr/lib/systemd/system/notifications-display.service diff --git a/configure.ac b/configure.ac index 2987c6b..d9db945 100644 --- a/configure.ac +++ b/configure.ac @@ -15,10 +15,15 @@ AC_CHECK_FUNC([dlopen], [], AC_CHECK_LIB([dl], [dlopen], DLOPEN_LIBS="-ldl")) AC_SUBST(DLOPEN_LIBS) +AC_ARG_WITH(notif-display-service, AS_HELP_STRING([--with-notif-display-service=],[]),, + with_notif_display_service="notifications-display.service") +notif_display_service=$with_notif_display_service +AC_SUBST(notif_display_service) + PKG_CHECK_MODULES([TIZEN], [eina ecore com-core notification dbus-1 bluetooth-api dlog libwlmessage]) AC_SUBST(TIZEN_CFLAGS) AC_SUBST(TIZEN_LIBS) -AC_CONFIG_FILES([Makefile plugins/Makefile notifications.service notifications-display.service]) +AC_CONFIG_FILES([Makefile plugins/Makefile notifications.service notifications-display.service notifications-display-ivi.service]) AC_PROG_RANLIB([ranlib]) AC_OUTPUT diff --git a/notifications-display-ivi.service.in b/notifications-display-ivi.service.in new file mode 100644 index 0000000..6e89495 --- /dev/null +++ b/notifications-display-ivi.service.in @@ -0,0 +1,11 @@ +[Unit] +Description=Notifications Popup daemon +Requires=notifications.service +After=notifications.service + +[Service] +ExecStart=/usr/bin/notification-display-service +Environment=XDG_RUNTIME_DIR=/run/user/5000 + +[Install] +WantedBy=graphical.target diff --git a/packaging/notification-service.spec b/packaging/notification-service.spec index 68dd000..5b552ed 100644 --- a/packaging/notification-service.spec +++ b/packaging/notification-service.spec @@ -35,9 +35,16 @@ This package provides unit test used in the development of the notification serv %setup -q -n %{name}-%{version} %build -%autogen +%if "%{profile}" == "ivi" +notifications_display_service="notifications-display-ivi.service" +%else +notifications_display_service="notifications-display.service" +%endif + +%autogen --with-notif-display-service=$notifications_display_service make %{?_smp_mflags} + %install %make_install %install_service graphical.target.wants notifications.service -- 2.7.4