--- /dev/null
+/* SPDX-License-Identifier: Apache-2.0 */
+/**
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
+ *
+ * @file gdbus-util.c
+ * @date 25 June 2022
+ * @brief Internal GDbus utility wrapper of Machine Learning agent daemon
+ * @see https://github.com/nnstreamer/api
+ * @author Sangjung Woo <sangjung.woo@samsung.com>
+ * @bug No known bugs except for NYI items
+ */
+
+#include <errno.h>
+#include <stdbool.h>
+#include <systemd/sd-daemon.h>
+
+#include <gdbus-util.h>
+#include <log.h>
+
+static GDBusConnection *g_dbus_sys_conn = NULL;
+
+/**
+ * @brief Export the DBus interface at the Object path on the bus connection.
+ */
+int
+gdbus_export_interface (gpointer instance, const char *obj_path)
+{
+ if (g_dbus_sys_conn == NULL) {
+ _E ("cannot get the dbus connection to the system message bus\n");
+ return -ENOSYS;
+ }
+
+ if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (instance),
+ g_dbus_sys_conn, obj_path, NULL)) {
+ return -EBUSY;
+ }
+
+ return 0;
+}
+
+/**
+ * @brief Callback function for acquireing the bus name.
+ * @remarks If the daemon is launched by systemd service,
+ * it should notify to the systemd about its status when it is ready.
+ */
+static void
+name_acquired_cb (GDBusConnection * connection,
+ const gchar * name, gpointer user_data)
+{
+ sd_notify (0, "READY=1");
+}
+
+/**
+ * @brief Acquire the given name on the SYSTEM session of the DBus message bus.
+ */
+int
+gdbus_get_name (const char *name)
+{
+ guint id;
+
+ id = g_bus_own_name_on_connection (g_dbus_sys_conn, name,
+ G_BUS_NAME_OWNER_FLAGS_NONE, name_acquired_cb, NULL, NULL, NULL);
+ if (id == 0)
+ return -ENOSYS;
+
+ return 0;
+}
+
+/**
+ * @brief Connects the callback functions for each signal of the particular DBus interface.
+ */
+int
+gdbus_connect_signal (gpointer instance, int num_signals,
+ struct gdbus_signal_info *signal_infos)
+{
+ int i;
+ unsigned long handler_id;
+
+ for (i = 0; i < num_signals; i++) {
+ handler_id = g_signal_connect (instance,
+ signal_infos[i].signal_name,
+ signal_infos[i].cb, signal_infos[i].cb_data);
+ if (handler_id <= 0)
+ goto out_err;
+ signal_infos[i].handler_id = handler_id;
+ }
+ return 0;
+
+out_err:
+ for (i = 0; i < num_signals; i++) {
+ if (signal_infos[i].handler_id > 0) {
+ g_signal_handler_disconnect (instance, signal_infos[i].handler_id);
+ signal_infos[i].handler_id = 0;
+ }
+ }
+
+ return -EINVAL;
+}
+
+/**
+ * @brief Disconnects the callback functions from the particular DBus interface.
+ */
+void
+gdbus_disconnect_signal (gpointer instance, int num_signals,
+ struct gdbus_signal_info *signal_infos)
+{
+ int i;
+
+ for (i = 0; i < num_signals; i++) {
+ if (signal_infos[i].handler_id > 0) {
+ g_signal_handler_disconnect (instance, signal_infos[i].handler_id);
+ signal_infos[i].handler_id = 0;
+ }
+ }
+}
+
+/**
+ * @brief Cleanup the instance of the DBus interface.
+ */
+static void
+put_instance (gpointer * instance)
+{
+ g_object_unref (*instance);
+ *instance = NULL;
+}
+
+/**
+ * @brief Get the skeleton object of the DBus interface.
+ */
+MachinelearningServicePipeline *
+gdbus_get_instance_pipeline (void)
+{
+ return machinelearning_service_pipeline_skeleton_new ();
+}
+
+/**
+ * @brief Put the obtained skeleton object and release the resource.
+ */
+void
+gdbus_put_instance_pipeline (MachinelearningServicePipeline ** instance)
+{
+ put_instance ((gpointer *) instance);
+}
+
+/**
+ * @brief Connect to the DBus message bus, which type is SYSTEM.
+ */
+int
+gdbus_get_system_connection (void)
+{
+ GError *error = NULL;
+
+ g_dbus_sys_conn = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
+ if (g_dbus_sys_conn == NULL) {
+ _E ("cannot connect to the system message bus: %s\n", error->message);
+ return -ENOSYS;
+ }
+
+ return 0;
+}
+
+/**
+ * @brief Disconnect the DBus message bus.
+ */
+void
+gdbus_put_system_connection (void)
+{
+ g_clear_object (&g_dbus_sys_conn);
+}
--- /dev/null
+/* SPDX-License-Identifier: Apache-2.0 */
+/**
+ * NNStreamer API / Machine Learning Agent Daemon
+ * Copyright (C) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
+ */
+
+/**
+ * @file common.h
+ * @date 25 June 2022
+ * @brief Internal common header of Machine Learning agent daemon
+ * @see https://github.com/nnstreamer/api
+ * @author Sangjung Woo <sangjung.woo@samsung.com>
+ * @bug No known bugs except for NYI items
+ *
+ * @details
+ * This provides the common utility macros for Machine Learning agent daemon.
+ */
+#ifndef __COMMON_H__
+#define __COMMON_H__
+
+#define ARRAY_SIZE(name) (sizeof(name)/sizeof(name[0]))
+
+#ifndef __CONSTRUCTOR__
+#define __CONSTRUCTOR__ __attribute__ ((constructor))
+#endif
+
+#ifndef __DESTRUCTOR__
+#define __DESTRUCTOR__ __attribute__ ((destructor))
+#endif
+
+#endif /* __COMMON_H__ */
--- /dev/null
+/* SPDX-License-Identifier: Apache-2.0 */
+/**
+ * NNStreamer API / Machine Learning Agent Daemon
+ * Copyright (C) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
+ */
+
+/**
+ * @file dbus-interface.h
+ * @date 25 June 2022
+ * @brief Internal header for the definition of DBus node and interfaces.
+ * @see https://github.com/nnstreamer/api
+ * @author Sangjung Woo <sangjung.woo@samsung.com>
+ * @bug No known bugs except for NYI items
+ *
+ * @details
+ * This defines the machine learning agent's bus, interface, and method names.
+ */
+
+#ifndef __GDBUS_INTERFACE_H__
+#define __GDBUS_INTERFACE_H__
+
+#define DBUS_ML_BUS_NAME "org.tizen.machinelearning.service"
+#define DBUS_ML_PATH "/Org/Tizen/MachineLearning/Service"
+
+#endif /* __GDBUS_INTERFACE_H__ */
--- /dev/null
+/* SPDX-License-Identifier: Apache-2.0 */
+/**
+ * NNStreamer API / Machine Learning Agent Daemon
+ * Copyright (C) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
+ */
+
+/**
+ * @file gdbus-util.h
+ * @date 25 June 2022
+ * @brief Internal GDbus utility header of Machine Learning agent daemon
+ * @see https://github.com/nnstreamer/api
+ * @author Sangjung Woo <sangjung.woo@samsung.com>
+ * @bug No known bugs except for NYI items
+ *
+ * @details
+ * This provides the wrapper functions to use DBus easily.
+ */
+#ifndef __GDBUS_UTIL_H__
+#define __GDBUS_UTIL_H__
+
+#include <glib.h>
+#include <gio/gio.h>
+#include <stdbool.h>
+
+#include "pipeline-dbus.h"
+
+/**
+ * @brief DBus signal handler information to connect
+ */
+struct gdbus_signal_info
+{
+ const gchar *signal_name; /**< specific signal name to handle */
+ GCallback cb; /**< Callback function to connect */
+ gpointer cb_data; /**< Data to pass to callback function */
+ gulong handler_id; /**< Connected handler ID */
+};
+
+/**
+ * @brief Export the DBus interface at the Object path on the bus connection.
+ *
+ * @param instance The instance of the DBus interface to export.
+ * @param obj_path The path to export the interface at.
+ * @return @c 0 on success. Otherwise a negative error value.
+ */
+int gdbus_export_interface (gpointer instance, const char *obj_path);
+
+/**
+ * @brief Acquire the given name on the SYSTEM session of the DBus message bus.
+ * @remarks If the name is acquired, 'READY=1' signal will be sent to the systemd.
+ * @param name The well-known name to own.
+ * @return @c 0 on success. Otherwise a negative error value.
+ */
+int gdbus_get_name (const char *name);
+
+/**
+ * @brief Connects the callback functions for each signal of the particular DBus interface.
+ * @param instance The instance of the DBus interface.
+ * @param num_signals The number of signals to connect.
+ * @param signal_infos The array of DBus signal handler.
+ * @return @c 0 on success. Otherwise a negative error value.
+ */
+int gdbus_connect_signal (gpointer instance, int num_signals,
+ struct gdbus_signal_info *signal_infos);
+
+/**
+ * @brief Disconnects the callback functions from the particular DBus interface.
+ * @param instance The instance of the DBus interface.
+ * @param num_signals The number of signals to connect.
+ * @param signal_infos The array of DBus signal handler.
+ */
+void gdbus_disconnect_signal (gpointer instance, int num_signals,
+ struct gdbus_signal_info *signal_infos);
+
+/**
+ * @brief Get the skeleton object of the DBus interface.
+ * @remarks If the function succeeds, @a MachinelearningServicePipeline*
+ * should be released using gdbus_put_instance_pipeline().
+ * @return MachinelearningServiceProcess* The skeleton object.
+ */
+MachinelearningServicePipeline *gdbus_get_instance_pipeline (void);
+
+/**
+ * @brief Put the obtained skeleton object and release the resource.
+ * @param instance The obtained skeleton object of the DBus interface.
+ */
+void gdbus_put_instance_pipeline (MachinelearningServicePipeline ** instance);
+
+/**
+ * @brief Connect to the DBus message bus, which type is SYSTEM.
+ * @return @c 0 on success. Otherwise a negative error value.
+ */
+int gdbus_get_system_connection (void);
+
+/**
+ * @brief Disconnect the DBus message bus.
+ */
+void gdbus_put_system_connection (void);
+#endif /* __GDBUS_UTIL_H__ */
--- /dev/null
+/* SPDX-License-Identifier: Apache-2.0 */
+/**
+ * NNStreamer API / Machine Learning Agent Daemon
+ * Copyright (C) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
+ */
+
+/**
+ * @file log.h
+ * @date 25 June 2022
+ * @brief Internal log header of Machine Learning agent daemon
+ * @see https://github.com/nnstreamer/api
+ * @author Sangjung Woo <sangjung.woo@samsung.com>
+ * @bug No known bugs except for NYI items
+ *
+ * @details
+ * This provides the log macro for Machine Learning agent daemon.
+ */
+#ifndef __LOG_H__
+#define __LOG_H__
+
+#include <dlog.h>
+
+#define _D(fmt, arg...) do { SLOGD(fmt, ##arg); } while (0)
+#define _I(fmt, arg...) do { SLOGI(fmt, ##arg); } while (0)
+#define _W(fmt, arg...) do { SLOGW(fmt, ##arg); } while (0)
+#define _E(fmt, arg...) do { SLOGE(fmt, ##arg); } while (0)
+#endif
--- /dev/null
+/* SPDX-License-Identifier: Apache-2.0 */
+/**
+ * NNStreamer API / Machine Learning Agent Daemon
+ * Copyright (C) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
+ */
+
+/**
+ * @file modules.h
+ * @date 25 June 2022
+ * @brief Internal module utility header of Machine Learning agent daemon
+ * @see https://github.com/nnstreamer/api
+ * @author Sangjung Woo <sangjung.woo@samsung.com>
+ * @bug No known bugs except for NYI items
+ *
+ * @details
+ * This provides the DBus module utility functions for the Machine Learning agent daemon.
+ */
+#ifndef __MODULES_H__
+#define __MODULES_H__
+
+/**
+ * @brief Data structure contains the name and callback functions for a specific DBus interface.
+ */
+struct module_ops
+{
+ const char *name; /**< Name of DBus Interface. */
+ int (*probe) (void *data); /**< Callback function for probing the DBus Interface */
+ void (*init) (void *data); /**< Callback function for initializing the DBus Interface */
+ void (*exit) (void *data); /**< Callback function for exiting the DBus Interface */
+};
+
+/**
+ * @brief Utility macro for adding and removing the specific DBus interface.
+ */
+#define MODULE_OPS_REGISTER(module) \
+static void __CONSTRUCTOR__ module_init(void) \
+{ \
+ add_module (module); \
+} \
+static void __DESTRUCTOR__ module_exit(void) \
+{ \
+ remove_module (module); \
+}
+
+/**
+ * @brief Initialize all added modules by calling probe and init callback functions.
+ * @param[in/out] data user data for passing the callback functions.
+ */
+void init_modules (void *data);
+
+/**
+ * @brief Clean up all added modules by calling the exit callback function.
+ * @param[in/out] data user data for passing the callback functions.
+ */
+void exit_modules (void *data);
+
+/**
+ * @brief Add the specific DBus interface into the Machine Learning agent daemon.
+ * @param[in] module DBus interface information.
+ */
+void add_module (const struct module_ops *module);
+
+/**
+ * @brief Remove the specific DBus interface from the Machine Learning agent daemon.
+ * @param[in] module DBus interface information.
+ */
+void remove_module (const struct module_ops *module);
+#endif /* __MODULES_H__ */
--- /dev/null
+/* SPDX-License-Identifier: Apache-2.0 */
+/**
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
+ *
+ * @file main.c
+ * @date 25 June 2022
+ * @brief core module for the Machine Learning agent daemon
+ * @see https://github.com/nnstreamer/api
+ * @author Sangjung Woo <sangjung.woo@samsung.com>
+ * @bug No known bugs except for NYI items
+ */
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <glib.h>
+#include <gio/gio.h>
+
+#include "common.h"
+#include "modules.h"
+#include "gdbus-util.h"
+#include "log.h"
+#include "dbus-interface.h"
+
+static GMainLoop *g_mainloop;
+
+/**
+ * @brief Handle the SIGTERM signal and quit the main loop
+ */
+static void
+handle_sigterm (int signo)
+{
+ _D ("received SIGTERM signal %d", signo);
+ g_main_loop_quit (g_mainloop);
+}
+
+/**
+ * @brief Handle the post init tasks before starting the main loop.
+ * @return @c 0 on success. Otherwise a negative error value.
+ */
+static int
+postinit (void)
+{
+ int ret;
+ /** Register signal handler */
+ signal (SIGTERM, handle_sigterm);
+
+ ret = gdbus_get_name (DBUS_ML_BUS_NAME);
+ if (ret < 0)
+ return ret;
+
+ return 0;
+}
+
+/**
+ * @brief main function of the Machine Learning agent daemon.
+ */
+int
+main (int argc, char **argv)
+{
+ g_mainloop = g_main_loop_new (NULL, FALSE);
+ gdbus_get_system_connection ();
+
+ init_modules (NULL);
+ if (postinit () < 0)
+ _E ("cannot init system\n");
+
+ g_main_loop_run (g_mainloop);
+ exit_modules (NULL);
+
+ gdbus_put_system_connection ();
+ g_main_loop_unref (g_mainloop);
+
+ return 0;
+}
--- /dev/null
+# Machine Learing Agent
+if get_option('enable-machine-learning-agent')
+ nns_ml_agent_srcs = []
+ nns_ml_agent_incs = include_directories('includes')
+
+ # Generate GDbus header and code
+ gdbus_prog = find_program('gdbus-codegen', required : true)
+ gdbus_gen_src = custom_target('gdbus-gencode',
+ input : '../dbus/pipeline-dbus.xml',
+ output : ['pipeline-dbus.h', 'pipeline-dbus.c'],
+ command : [gdbus_prog, '--interface-prefix', 'org.tizen',
+ '--generate-c-code', 'pipeline-dbus',
+ '--output-directory', meson.current_build_dir(),
+ '@INPUT@'])
+
+ nns_ml_agent_srcs += gdbus_gen_src[0]
+ nns_ml_agent_srcs += join_paths('main.c')
+ nns_ml_agent_srcs += join_paths('modules.c')
+ nns_ml_agent_srcs += join_paths('gdbus-util.c')
+
+ gdbus_gen_header_dep = declare_dependency(sources : gdbus_gen_src)
+ dlog_dep = dependency('dlog')
+ libsystemd_dep = dependency('libsystemd')
+ ai_service_daemon_deps = [
+ gdbus_gen_header_dep,
+ glib_dep,
+ gio_dep,
+ gio_unix_dep,
+ dlog_dep,
+ libsystemd_dep
+ ]
+
+ ai_service_daemon = executable('machine-learning-agent',
+ nns_ml_agent_srcs,
+ dependencies : [ai_service_daemon_deps],
+ include_directories: nns_ml_agent_incs,
+ install: true,
+ install_dir: api_install_bindir,
+ )
+
+ # DBus Policy configuration
+ dbus_policy_conf = configuration_data()
+ configure_file(input: '../dbus/machine-learning-agent.conf.in', output: 'machine-learning-agent.conf',
+ install_dir: dbus_policy_dir,
+ configuration: dbus_policy_conf
+ )
+
+ # DBus System Service
+ dbus_system_conf = configuration_data()
+ configure_file(input: '../dbus/org.tizen.machinelearning.service.service.in',
+ output: 'org.tizen.machinelearning.service.service',
+ install_dir: dbus_system_service_dir,
+ configuration: dbus_system_conf
+ )
+
+ # Systemd Service file
+ systemd_conf = configuration_data()
+ configure_file(input: '../dbus/machine-learning-agent.service.in',
+ output: 'machine-learning-agent.service',
+ install_dir: systemd_service_dir,
+ configuration: systemd_conf
+ )
+endif
--- /dev/null
+/* SPDX-License-Identifier: Apache-2.0 */
+/**
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
+ *
+ * @file modules.c
+ * @date 25 June 2022
+ * @brief NNStreamer/Utilities C-API Wrapper.
+ * @see https://github.com/nnstreamer/api
+ * @author Sangjung Woo <sangjung.woo@samsung.com>
+ * @bug No known bugs except for NYI items
+ */
+
+#include <glib.h>
+#include <stdio.h>
+
+#include "common.h"
+#include "modules.h"
+#include "log.h"
+
+static GList *module_head;
+
+/**
+ * @brief Add the specific DBus interface into the Machine Learning agent daemon.
+ */
+void
+add_module (const struct module_ops *module)
+{
+ module_head = g_list_append (module_head, (gpointer) module);
+}
+
+/**
+ * @brief Remove the specific DBus interface from the Machine Learning agent daemon.
+ */
+void
+remove_module (const struct module_ops *module)
+{
+ module_head = g_list_remove (module_head, (gconstpointer) module);
+}
+
+/**
+ * @brief Initialize all added modules by calling probe and init callback functions.
+ */
+void
+init_modules (void *data)
+{
+ GList *elem, *elem_n;
+ const struct module_ops *module;
+
+ elem = module_head;
+ while (elem != NULL) {
+ module = elem->data;
+ elem_n = elem->next;
+
+ if (module->probe && module->probe (data) != 0) {
+ _E ("[%s] probe fail", module->name);
+ module_head = g_list_remove (module_head, (gconstpointer) module);
+ elem = elem_n;
+ continue;
+ }
+
+ if (module->init)
+ module->init (data);
+ elem = elem_n;
+ }
+}
+
+/**
+ * @brief Clean up all added modules by calling the exit callback function.
+ */
+void
+exit_modules (void *data)
+{
+ GList *elem;
+ const struct module_ops *module;
+
+ for (elem = module_head; elem != NULL; elem = elem->next) {
+ module = elem->data;
+ if (module->exit)
+ module->exit (data);
+ }
+}
--- /dev/null
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+ <policy user="root">
+ <allow send_destination="org.tizen.machinelearning.service"
+ send_interface="org.tizen.machinelearning.service.process"/>
+ </policy>
+ <policy user="system_fw">
+ <allow own="org.tizen.machinelearning.service"/>
+ </policy>
+ <policy context="default">
+ <allow own="org.tizen.machinelearning.service"/>
+ <allow send_destination="org.tizen.machinelearning.service" send_type="method_call"/>
+ <allow own="org.tizen.machinelearning.service"/>
+ <allow send_destination="org.tizen.machinelearning.service.process" send_type="method_call"/>
+ </policy>
+</busconfig>
--- /dev/null
+[Unit]
+Description=Machine Learning Agent Daemon
+
+[Service]
+Type=simple
+SmackProcessLabel=System
+ExecStart=/usr/bin/machine-learning-agent
--- /dev/null
+[D-BUS Service]
+Name=org.tizen.machinelearning.service
+Exec=/bin/false
+SystemdService=machine-learning-agent.service
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<node name="/Org/Tizen/MachineLearning/Service">
+ <interface name="org.tizen.machinelearning.service.pipeline">
+ </interface>
+</node>
glib_dep = dependency('glib-2.0')
gobject_dep = dependency('gobject-2.0')
gmodule_dep = dependency('gmodule-2.0')
+gio_dep = dependency('gio-2.0')
+gio_unix_dep = dependency('gio-unix-2.0')
gst_dep = dependency('gstreamer-1.0')
gst_app_dep = dependency('gstreamer-app-1.0')
nnstreamer_single_dep = dependency('nnstreamer-single')
api_install_bindir = join_paths(api_install_prefix, get_option('bindir'))
api_install_includedir = join_paths(api_install_prefix, get_option('includedir'))
api_install_inidir = get_option('sysconfdir')
+dbus_policy_dir = join_paths(get_option('sysconfdir'), 'dbus-1', 'system.d')
+dbus_system_service_dir = join_paths(api_install_prefix, 'share', 'dbus-1', 'system-services')
+systemd_service_dir = join_paths(api_install_prefix, 'lib', 'systemd', 'system')
# Set default configuration
api_conf = configuration_data()
# Build C-API
subdir('c')
+if get_option('enable-machine-learning-agent')
+ subdir('daemon')
+endif
+
# Build JNI wrapper when developer sets java-home
# (e.g., -Djava-home=$JAVA_HOME from environment variables)
java_home = get_option('java-home').strip()
option('tizen-version-minor', type: 'integer', min : 0, max : 9999, value: 0)
option('enable-tizen-feature-check', type: 'boolean', value: false)
option('enable-tizen-privilege-check', type: 'boolean', value: false)
+option('enable-machine-learning-agent', type: 'boolean', value: false)
option('java-home', type: 'string', value: '')
option('service-db-path', type: 'string', value: '.')
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
# touch these values for your needs.
%define enable_tizen_privilege 1
%define enable_tizen_feature 1
+%define enable_machine_learning_agent 1
# Below features are used for unittest.
# Do not add neural network dependency in API source.
License: Apache-2.0
Source0: machine-learning-api-%{version}.tar
Source1001: capi-machine-learning-inference.manifest
+Source1002: machine-learning-agent.manifest
## Define build requirements ##
Requires: capi-machine-learning-common = %{version}-%{release}
%endif
%endif # unit_test
+%if 0%{?enable_machine_learning_agent}
+BuildRequires: pkgconfig(libsystemd)
+%endif
+
%description
Tizen ML(Machine Learning) native API for NNStreamer.
You can construct a data stream pipeline with neural networks easily.
%description -n capi-machine-learning-tizen-internal-devel
Tizen internal headers for Tizen Machine Learning API.
+%if 0%{?enable_machine_learning_agent}
+%package -n machine-learning-agent
+Summary: AI Service Daemon
+Group: Machine Learning/ML Framework
+Requires: capi-machine-learning-service = %{version}-%{release}
+%description -n machine-learning-agent
+AI Service Daemon
+%endif
+
%if 0%{?release_test}
%package -n capi-machine-learning-unittests
Summary: Unittests for Tizen Machine Learning API
%define enable_tizen -Denable-tizen=false
%define enable_tizen_privilege_check -Denable-tizen-privilege-check=false
%define enable_tizen_feature_check -Denable-tizen-feature-check=false
+%define machine_learning_agent_check -Denable-machine-learning-agent=false
%define service_db_path ""
%if %{with tizen}
%define enable_tizen_feature_check -Denable-tizen-feature-check=true
%endif
%define service_db_path -Dservice-db-path=%{TZ_SYS_GLOBALUSER_DB}
+
+%if 0%{?enable_machine_learning_agent}
+%define machine_learning_agent_check -Denable-machine-learning-agent=true
+%endif
%endif # tizen
%if 0%{?release_test}
%setup -q
cp %{SOURCE1001} .
+%if 0%{?enable_machine_learning_agent}
+cp %{SOURCE1002} .
+%endif
+
%build
# Remove compiler flags for meson to decide the cpp version
CXXFLAGS=`echo $CXXFLAGS | sed -e "s|-std=gnu++11||"`
meson --buildtype=plain --prefix=%{_prefix} --sysconfdir=%{_sysconfdir} --libdir=%{_libdir} \
--bindir=%{_bindir} --includedir=%{_includedir} %{install_test} %{enable_test_coverage} \
%{enable_tizen} %{enable_tizen_privilege_check} %{enable_tizen_feature_check} \
- %{service_db_path} \
+ %{service_db_path} %{machine_learning_agent_check} \
build
ninja -C build %{?_smp_mflags}
%files -n capi-machine-learning-service-devel-static
%{_libdir}/libcapi-ml-service.a
+%if 0%{?enable_machine_learning_agent}
+%files -n machine-learning-agent
+%manifest machine-learning-agent.manifest
+%{_bindir}/machine-learning-agent
+%{_unitdir}/machine-learning-agent.service
+%config %{_sysconfdir}/dbus-1/system.d/machine-learning-agent.conf
+%attr(0644,root,root) %{_datadir}/dbus-1/system-services/org.tizen.machinelearning.service.service
+%endif
+
%if 0%{?release_test}
%files -n capi-machine-learning-unittests
%manifest capi-machine-learning-inference.manifest