initial commit to implement internal library for nnstreamer edge based on glib.
Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
/usr/lib/nnstreamer/decoders/libnnstreamer_decoder_octet_stream.so
/usr/lib/nnstreamer/filters/libnnstreamer_filter_cpp.so
/usr/lib/*/libnnstreamer.so
+/usr/lib/*/libnnstreamer-edge.so
/usr/lib/*/gstreamer-1.0/libnnstreamer.so
foreach s : tensor_query_sources
nnstreamer_sources += join_paths(meson.current_source_dir(), s)
endforeach
+
+# nnstreamer-edge
+# TODO:
+# 1. This will be migrated into nnstreamer-edge repogitory.
+# 2. glib dependency will be removed.
+nnstreamer_edge_sources = [
+ join_paths(meson.current_source_dir(), 'nnstreamer_edge_common.c')
+]
+
+nnstreamer_edge_deps = [
+ glib_dep
+]
+
+if aitt_support_is_available
+ nnstreamer_edge_sources += join_paths(meson.current_source_dir(), 'nnstreamer_edge_aitt.c')
+ nnstreamer_edge_deps += aitt_support_deps
+else
+ nnstreamer_edge_sources += join_paths(meson.current_source_dir(), 'nnstreamer_edge_internal.c')
+endif
+
+nns_edge_lib = shared_library('nnstreamer-edge',
+ nnstreamer_edge_sources,
+ dependencies: nnstreamer_edge_deps,
+ install: true,
+ install_dir: nnstreamer_libdir
+)
+
+static_library('nnstreamer-edge',
+ nnstreamer_edge_sources,
+ dependencies: nnstreamer_edge_deps,
+ install: true,
+ install_dir: nnstreamer_libdir
+)
+
+nns_edge_dep = declare_dependency(link_with: nns_edge_lib,
+ dependencies: nnstreamer_edge_deps)
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-only */
+/**
+ * Copyright (C) 2022 Gichan Jang <gichan2.jang@samsung.com>
+ *
+ * @file nnstreamer_edge.h
+ * @date 25 Mar 2022
+ * @brief Common library to support communication among devices.
+ * @see https://github.com/nnstreamer/nnstreamer
+ * @author Gichan Jang <gichan2.jang@samsung.com>
+ * @bug No known bugs except for NYI items
+ *
+ * @note This file will be moved to nnstreamer-edge repo. (https://github.com/nnstreamer/nnstreamer-edge)
+ *
+ * @todo Update document and sample code.
+ * 1. Add sample code when the 1st API set is complete - connection, pub/sub, request, ...
+ * 2. Update license when migrating this into edge repo. (Apache-2.0)
+ */
+
+#ifndef __NNSTREAMER_EDGE_H__
+#define __NNSTREAMER_EDGE_H__
+
+#include <errno.h>
+#include <limits.h>
+#include <stddef.h>
+#include <stdbool.h>
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+typedef void *nns_edge_h;
+typedef void *nns_edge_event_h;
+typedef void *nns_edge_data_h;
+
+/**
+ * @brief The maximum number of data instances that nnstreamer-edge data may have.
+ */
+#define NNS_EDGE_DATA_LIMIT (16)
+
+/**
+ * @brief Enumeration for the error codes of nnstreamer-edge.
+ * @todo define detailed error code later (linux standard error code)
+ */
+typedef enum {
+ NNS_EDGE_ERROR_NONE = 0,
+ NNS_EDGE_ERROR_INVALID_PARAMETER = -EINVAL,
+ NNS_EDGE_ERROR_OUT_OF_MEMORY = -ENOMEM,
+ NNS_EDGE_ERROR_IO = -EIO,
+ NNS_EDGE_ERROR_CONNECTION_FAILURE = -ECONNREFUSED,
+ NNS_EDGE_ERROR_UNKNOWN = -(INT_MIN / 2),
+} nns_edge_error_e;
+
+typedef enum {
+ NNS_EDGE_EVENT_TEMP = 0,
+
+ NNS_EDGE_EVENT_MAX
+} nns_edge_event_e;
+
+typedef enum {
+ NNS_EDGE_PROTOCOL_TCP = 0,
+ NNS_EDGE_PROTOCOL_MQTT,
+ NNS_EDGE_PROTOCOL_AITT,
+ NNS_EDGE_PROTOCOL_AITT_TCP,
+
+ NNS_EDGE_PROTOCOL_MAX
+} nns_edge_protocol_e;
+
+typedef enum {
+ NNS_EDGE_DATA_TYPE_INFO = 0,
+ NNS_EDGE_DATA_TYPE_RAW_DATA,
+
+ NNS_EDGE_DATA_TYPE_MAX
+} nns_edge_data_type_e;
+
+/**
+ * @brief Callback for the nnstreamer edge event.
+ */
+typedef int (*nns_edge_event_cb) (nns_edge_event_h event_h, void *user_data);
+
+/**
+ * @brief Callback called when nnstreamer-edge data is released.
+ */
+typedef void (*nns_edge_data_destroy_cb) (void *data);
+
+/**
+ * @brief Get registered handle. If not registered, create new handle and register it.
+ */
+int
+nns_edge_get_handle (const char *id, const char *topic, nns_edge_h *edge_h);
+
+/**
+ * @brief Release the given handle.
+ */
+int
+nns_edge_release_handle (nns_edge_h edge_h);
+
+/**
+ * @brief Set the event callback.
+ */
+int
+nns_edge_set_event_callback (nns_edge_h edge_h, nns_edge_event_cb cb, void *user_data);
+
+/**
+ * @brief Connect to the destination node.
+ */
+int
+nns_edge_connect (nns_edge_h edge_h, nns_edge_protocol_e protocol, const char *ip, int port);
+
+/**
+ * @brief Disconnect from the destination node.
+ */
+int
+nns_edge_disconnect (nns_edge_h edge_h);
+
+/**
+ * @brief Publish a message to a given topic.
+ */
+int
+nns_edge_publish (nns_edge_h edge_h, nns_edge_data_h data_h);
+
+/**
+ * @brief Request result to the server.
+ */
+int
+nns_edge_request (nns_edge_h edge_h, nns_edge_data_h data_h, void *user_data);
+
+/**
+ * @brief Subscribe a message to a given topic.
+ */
+int
+nns_edge_subscribe (nns_edge_h edge_h, nns_edge_data_h data_h, void *user_data);
+
+/**
+ * @brief Unsubscribe a message to a given topic.
+ */
+int
+nns_edge_unsubscribe (nns_edge_h edge_h);
+
+/**
+ * @brief Get the topic of edge handle. Caller should release returned string using free().
+ */
+int
+nns_edge_get_topic (nns_edge_h edge_h, char **topic);
+
+/**
+ * @brief Create nnstreamer edge data.
+ */
+int
+nns_edge_data_create (nns_edge_data_type_e dtype, nns_edge_data_h *data_h);
+
+/**
+ * @brief Destroy nnstreamer edge data.
+ */
+int
+nns_edge_data_destroy (nns_edge_data_h data_h);
+
+/**
+ * @brief Add raw data into nnstreamer edge data.
+ */
+int
+nns_edge_data_add (nns_edge_data_h data_h, void *data, size_t data_len, nns_edge_data_destroy_cb destroy_cb);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* __NNSTREAMER_EDGE_H__ */
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-only */
+/**
+ * Copyright (C) 2022 Gichan Jang <gichan2.jang@samsung.com>
+ *
+ * @file nnstreamer_edge_aitt.c
+ * @date 28 Mar 2022
+ * @brief Common library to support communication among devices using aitt.
+ * @see https://github.com/nnstreamer/nnstreamer
+ * @author Gichan Jang <gichan2.jang@samsung.com>
+ * @bug No known bugs except for NYI items
+ */
+
+#include <aitt_c.h>
+#include "nnstreamer_edge_common.h"
+
+typedef void *nns_edge_aitt_h;
+typedef void *nns_edge_aitt_msg_h;
+typedef void *nns_edge_aitt_sub_h;
+
+/**
+ * @brief Data structure for aitt handle.
+ * @todo Update AITT-related handle later. This is internal struct to manage edge-handle with AITT.
+ */
+typedef struct
+{
+ nns_edge_protocol_e protocol;
+ struct
+ {
+ nns_edge_aitt_h aitt_h;
+ nns_edge_aitt_msg_h msg_h;
+ nns_edge_aitt_sub_h sub_h;
+ };
+} nns_edge_handle_s;
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-only */
+/**
+ * Copyright (C) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
+ *
+ * @file nnstreamer_edge_internal.c
+ * @date 6 April 2022
+ * @brief Common util functions for nnstreamer edge.
+ * @see https://github.com/nnstreamer/nnstreamer
+ * @author Gichan Jang <gichan2.jang@samsung.com>
+ * @bug No known bugs except for NYI items
+ */
+
+#include "nnstreamer_edge_common.h"
+
+/**
+ * @brief Validate data handle.
+ */
+bool
+nns_edge_data_is_valid (nns_edge_data_h data_h)
+{
+ nns_edge_data_s *ed;
+
+ ed = (nns_edge_data_s *) data_h;
+
+ if (!NNS_EDGE_MAGIC_IS_VALID (ed))
+ return false;
+
+ return true;
+}
+
+/**
+ * @brief Create nnstreamer edge data.
+ */
+int
+nns_edge_data_create (nns_edge_data_type_e dtype, nns_edge_data_h * data_h)
+{
+ nns_edge_data_s *ed;
+
+ if (!data_h) {
+ nns_edge_loge ("Invalid param, data_h should not be null.");
+ return NNS_EDGE_ERROR_INVALID_PARAMETER;
+ }
+
+ if (dtype < 0 || dtype >= NNS_EDGE_DATA_TYPE_MAX) {
+ nns_edge_loge ("Invalid param, given data type is invalid.");
+ return NNS_EDGE_ERROR_INVALID_PARAMETER;
+ }
+
+ ed = g_try_new (nns_edge_data_s, 1);
+ if (!ed) {
+ nns_edge_loge ("Failed to allocate memory for edge data.");
+ return NNS_EDGE_ERROR_OUT_OF_MEMORY;
+ }
+
+ memset (ed, 0, sizeof (nns_edge_data_s));
+ ed->magic = NNS_EDGE_MAGIC;
+ ed->dtype = dtype;
+
+ *data_h = ed;
+ return NNS_EDGE_ERROR_NONE;
+}
+
+/**
+ * @brief Destroy nnstreamer edge data.
+ */
+int
+nns_edge_data_destroy (nns_edge_data_h data_h)
+{
+ nns_edge_data_s *ed;
+ unsigned int i;
+
+ ed = (nns_edge_data_s *) data_h;
+
+ if (!nns_edge_data_is_valid (data_h)) {
+ nns_edge_loge ("Invalid param, given edge data is invalid.");
+ return NNS_EDGE_ERROR_INVALID_PARAMETER;
+ }
+
+ ed->magic = NNS_EDGE_MAGIC_DEAD;
+
+ for (i = 0; i < ed->num; i++) {
+ if (ed->data[i].destroy_cb)
+ ed->data[i].destroy_cb (ed->data[i].data);
+ }
+
+ g_free (ed);
+ return NNS_EDGE_ERROR_NONE;
+}
+
+/**
+ * @brief Add raw data into nnstreamer edge data.
+ */
+int
+nns_edge_data_add (nns_edge_data_h data_h, void *data, size_t data_len,
+ nns_edge_data_destroy_cb destroy_cb)
+{
+ nns_edge_data_s *ed;
+
+ ed = (nns_edge_data_s *) data_h;
+
+ if (!nns_edge_data_is_valid (data_h)) {
+ nns_edge_loge ("Invalid param, given edge data is invalid.");
+ return NNS_EDGE_ERROR_INVALID_PARAMETER;
+ }
+
+ if (ed->num >= NNS_EDGE_DATA_LIMIT) {
+ nns_edge_loge ("Cannot add data, the maximum number of edge data is %d.",
+ NNS_EDGE_DATA_LIMIT);
+ return NNS_EDGE_ERROR_INVALID_PARAMETER;
+ }
+
+ ed->data[ed->num].data = data;
+ ed->data[ed->num].data_len = data_len;
+ ed->data[ed->num].destroy_cb = destroy_cb;
+ ed->num++;
+
+ return NNS_EDGE_ERROR_NONE;
+}
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-only */
+/**
+ * Copyright (C) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
+ *
+ * @file nnstreamer_edge_common.h
+ * @date 6 April 2022
+ * @brief Common util functions for nnstreamer edge.
+ * @see https://github.com/nnstreamer/nnstreamer
+ * @author Gichan Jang <gichan2.jang@samsung.com>
+ * @bug No known bugs except for NYI items
+ * @note This file is internal header for nnstreamer edge utils. DO NOT export this file.
+ */
+
+#ifndef __NNSTREAMER_EDGE_COMMON_H__
+#define __NNSTREAMER_EDGE_COMMON_H__
+
+#include <glib.h> /** @todo remove glib */
+#include "nnstreamer_edge.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/**
+ * @brief Utility to silence unused parameter warning for intentionally unused parameters (e.g., callback functions of a framework)
+ */
+#ifndef UNUSED
+#define UNUSED(expr) do { (void)(expr); } while (0)
+#endif
+
+/**
+ * @brief g_memdup() function replaced by g_memdup2() in glib version >= 2.68
+ */
+#if GLIB_USE_G_MEMDUP2
+#define _g_memdup g_memdup2
+#else
+#define _g_memdup g_memdup
+#endif
+
+#define NNS_EDGE_MAGIC 0xfeedfeed
+#define NNS_EDGE_MAGIC_DEAD 0xdeaddead
+#define NNS_EDGE_MAGIC_IS_VALID(h) ((h) && (h)->magic == NNS_EDGE_MAGIC)
+
+typedef struct {
+ void *data;
+ size_t data_len;
+ nns_edge_data_destroy_cb destroy_cb;
+} nns_edge_raw_data_s;
+
+typedef struct {
+ unsigned int magic;
+ nns_edge_data_type_e dtype;
+ unsigned int num;
+ nns_edge_raw_data_s data[NNS_EDGE_DATA_LIMIT];
+} nns_edge_data_s;
+
+/**
+ * @todo add log util for nnstreamer-edge.
+ * 1. define tag (e.g., "nnstreamer-edge").
+ * 2. consider macros to print function and line.
+ * 3. new API to get last error.
+ */
+#define nns_edge_logi g_info
+#define nns_edge_logw g_warning
+#define nns_edge_loge g_critical
+#define nns_edge_logd g_debug
+#define nns_edge_logf g_error
+
+/**
+ * @brief Validate edge handle.
+ */
+bool
+nns_edge_handle_is_valid (nns_edge_h edge_h);
+
+/**
+ * @brief Check network connection.
+ */
+bool
+nns_edge_is_connected (nns_edge_h edge_h);
+
+/**
+ * @brief Validate data handle.
+ */
+bool
+nns_edge_data_is_valid (nns_edge_data_h data_h);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* __NNSTREAMER_EDGE_COMMON_H__ */
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1-only */
+/**
+ * Copyright (C) 2022 Samsung Electronics Co., Ltd. All Rights Reserved.
+ *
+ * @file nnstreamer_edge_internal.c
+ * @date 6 April 2022
+ * @brief Common library to support communication among devices.
+ * @see https://github.com/nnstreamer/nnstreamer
+ * @author Gichan Jang <gichan2.jang@samsung.com>
+ * @bug No known bugs except for NYI items
+ */
+
+#include "nnstreamer_edge_common.h"
+
+/**
+ * @brief Data structure for edge handle.
+ */
+typedef struct
+{
+ unsigned int magic;
+ char *id;
+ char *topic;
+ nns_edge_protocol_e protocol;
+ char *ip;
+ int port;
+ nns_edge_event_cb event_cb;
+ void *user_data;
+} nns_edge_handle_s;
+
+/**
+ * @brief Validate edge handle.
+ */
+bool
+nns_edge_handle_is_valid (nns_edge_h edge_h)
+{
+ nns_edge_handle_s *eh;
+
+ eh = (nns_edge_handle_s *) edge_h;
+
+ if (!NNS_EDGE_MAGIC_IS_VALID (eh))
+ return false;
+
+ return true;
+}
+
+/**
+ * @brief Check network connection.
+ */
+bool
+nns_edge_is_connected (nns_edge_h edge_h)
+{
+ if (!nns_edge_handle_is_valid (edge_h)) {
+ nns_edge_loge ("Invalid param, given edge handle is invalid.");
+ return false;
+ }
+
+ /** @todo check connection status */
+ return true;
+}
+
+/**
+ * @brief Get registered handle. If not registered, create new handle and register it.
+ */
+int
+nns_edge_get_handle (const char *id, const char *topic, nns_edge_h * edge_h)
+{
+ nns_edge_handle_s *eh;
+
+ if (!id || *id == '\0') {
+ nns_edge_loge ("Invalid param, given ID is invalid.");
+ return NNS_EDGE_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!topic || *topic == '\0') {
+ nns_edge_loge ("Invalid param, given topic is invalid.");
+ return NNS_EDGE_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!edge_h) {
+ nns_edge_loge ("Invalid param, edge_h should not be null.");
+ return NNS_EDGE_ERROR_INVALID_PARAMETER;
+ }
+
+ /**
+ * @todo manage edge handles
+ * 1. consider adding hash table or list to manage edge handles.
+ * 2. compare topic and return error if existing topic in handle is different.
+ */
+ eh = g_try_new (nns_edge_handle_s, 1);
+ if (!eh) {
+ nns_edge_loge ("Failed to allocate memory for edge handle.");
+ return NNS_EDGE_ERROR_OUT_OF_MEMORY;
+ }
+
+ memset (eh, 0, sizeof (nns_edge_handle_s));
+ eh->magic = NNS_EDGE_MAGIC;
+ eh->id = g_strdup (id);
+ eh->topic = g_strdup (topic);
+ eh->protocol = NNS_EDGE_PROTOCOL_MAX;
+
+ *edge_h = eh;
+ return NNS_EDGE_ERROR_NONE;
+}
+
+/**
+ * @brief Release the given handle.
+ */
+int
+nns_edge_release_handle (nns_edge_h edge_h)
+{
+ nns_edge_handle_s *eh;
+
+ eh = (nns_edge_handle_s *) edge_h;
+
+ if (!nns_edge_handle_is_valid (edge_h)) {
+ nns_edge_loge ("Invalid param, given edge handle is invalid.");
+ return NNS_EDGE_ERROR_INVALID_PARAMETER;
+ }
+
+ if (eh->event_cb) {
+ /** @todo send new event (release handle) */
+ eh->event_cb = NULL;
+ }
+
+ eh->magic = NNS_EDGE_MAGIC_DEAD;
+ g_free (eh->id);
+ g_free (eh->topic);
+ g_free (eh->ip);
+ g_free (eh);
+
+ return NNS_EDGE_ERROR_NONE;
+}
+
+/**
+ * @brief Set the event callback.
+ */
+int
+nns_edge_set_event_callback (nns_edge_h edge_h, nns_edge_event_cb cb,
+ void *user_data)
+{
+ nns_edge_handle_s *eh;
+
+ eh = (nns_edge_handle_s *) edge_h;
+
+ if (!nns_edge_handle_is_valid (edge_h)) {
+ nns_edge_loge ("Invalid param, given edge handle is invalid.");
+ return NNS_EDGE_ERROR_INVALID_PARAMETER;
+ }
+
+ if (eh->event_cb) {
+ /** @todo send new event (release callback) */
+ }
+
+ eh->event_cb = cb;
+ eh->user_data = user_data;
+
+ return NNS_EDGE_ERROR_NONE;
+}
+
+/**
+ * @brief Connect to the destination node.
+ */
+int
+nns_edge_connect (nns_edge_h edge_h, nns_edge_protocol_e protocol,
+ const char *ip, int port)
+{
+ nns_edge_handle_s *eh;
+
+ eh = (nns_edge_handle_s *) edge_h;
+
+ if (!nns_edge_handle_is_valid (edge_h)) {
+ nns_edge_loge ("Invalid param, given edge handle is invalid.");
+ return NNS_EDGE_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!ip || *ip == '\0') {
+ nns_edge_loge ("Invalid param, given IP is invalid.");
+ return NNS_EDGE_ERROR_INVALID_PARAMETER;
+ }
+
+ if (nns_edge_is_connected (edge_h)) {
+ nns_edge_loge ("Already connected to %s:%d.", eh->ip, eh->port);
+ return NNS_EDGE_ERROR_CONNECTION_FAILURE;
+ }
+
+ eh->protocol = protocol;
+ eh->ip = g_strdup (ip);
+ eh->port = port;
+
+ /** @todo update code for connection */
+ return NNS_EDGE_ERROR_NONE;
+}
+
+/**
+ * @brief Disconnect from the destination node.
+ */
+int
+nns_edge_disconnect (nns_edge_h edge_h)
+{
+ if (!nns_edge_handle_is_valid (edge_h)) {
+ nns_edge_loge ("Invalid param, given edge handle is invalid.");
+ return NNS_EDGE_ERROR_INVALID_PARAMETER;
+ }
+
+ if (nns_edge_is_connected (edge_h)) {
+ /** @todo update code for disconnection */
+ }
+
+ return NNS_EDGE_ERROR_NONE;
+}
+
+/**
+ * @brief Publish a message to a given topic.
+ */
+int
+nns_edge_publish (nns_edge_h edge_h, nns_edge_data_h data_h)
+{
+ if (!nns_edge_handle_is_valid (edge_h)) {
+ nns_edge_loge ("Invalid param, given edge handle is invalid.");
+ return NNS_EDGE_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!nns_edge_data_is_valid (data_h)) {
+ nns_edge_loge ("Invalid param, given edge data is invalid.");
+ return NNS_EDGE_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!nns_edge_is_connected (edge_h)) {
+ nns_edge_loge ("Connection failure.");
+ return NNS_EDGE_ERROR_CONNECTION_FAILURE;
+ }
+
+ /** @todo update code (publish data) */
+ return NNS_EDGE_ERROR_NONE;
+}
+
+/**
+ * @brief Request result to the server.
+ */
+int
+nns_edge_request (nns_edge_h edge_h, nns_edge_data_h data_h, void *user_data)
+{
+ UNUSED (user_data);
+
+ if (!nns_edge_handle_is_valid (edge_h)) {
+ nns_edge_loge ("Invalid param, given edge handle is invalid.");
+ return NNS_EDGE_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!nns_edge_data_is_valid (data_h)) {
+ nns_edge_loge ("Invalid param, given edge data is invalid.");
+ return NNS_EDGE_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!nns_edge_is_connected (edge_h)) {
+ nns_edge_loge ("Connection failure.");
+ return NNS_EDGE_ERROR_CONNECTION_FAILURE;
+ }
+
+ /** @todo update code (request - send, wait for response) */
+ return NNS_EDGE_ERROR_NONE;
+}
+
+/**
+ * @brief Subscribe a message to a given topic.
+ */
+int
+nns_edge_subscribe (nns_edge_h edge_h, nns_edge_data_h data_h, void *user_data)
+{
+ UNUSED (data_h);
+ UNUSED (user_data);
+
+ if (!nns_edge_handle_is_valid (edge_h)) {
+ nns_edge_loge ("Invalid param, given edge handle is invalid.");
+ return NNS_EDGE_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!nns_edge_is_connected (edge_h)) {
+ nns_edge_loge ("Connection failure.");
+ return NNS_EDGE_ERROR_CONNECTION_FAILURE;
+ }
+
+ /** @todo update code (subscribe) */
+ return NNS_EDGE_ERROR_NONE;
+}
+
+/**
+ * @brief Unsubscribe a message to a given topic.
+ */
+int
+nns_edge_unsubscribe (nns_edge_h edge_h)
+{
+ if (!nns_edge_handle_is_valid (edge_h)) {
+ nns_edge_loge ("Invalid param, given edge handle is invalid.");
+ return NNS_EDGE_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!nns_edge_is_connected (edge_h)) {
+ nns_edge_loge ("Connection failure.");
+ return NNS_EDGE_ERROR_CONNECTION_FAILURE;
+ }
+
+ /** @todo update code (unsubscribe) */
+ return NNS_EDGE_ERROR_NONE;
+}
+
+/**
+ * @brief Get the topic of edge handle. Caller should release returned string using free().
+ * @todo is this necessary?
+ */
+int
+nns_edge_get_topic (nns_edge_h edge_h, char **topic)
+{
+ nns_edge_handle_s *eh;
+
+ eh = (nns_edge_handle_s *) edge_h;
+
+ if (!nns_edge_handle_is_valid (edge_h)) {
+ nns_edge_loge ("Invalid param, given edge handle is invalid.");
+ return NNS_EDGE_ERROR_INVALID_PARAMETER;
+ }
+
+ if (!topic) {
+ nns_edge_loge ("Invalid param, topic should not be null.");
+ return NNS_EDGE_ERROR_INVALID_PARAMETER;
+ }
+
+ *topic = g_strdup (eh->topic);
+
+ return NNS_EDGE_ERROR_NONE;
+}
'trix-engine-support': {
'target': 'npu-engine',
'project_args': { 'ENABLE_TRIX_ENGINE' : 1 }
+ },
+ 'aitt-support': {
+ 'target': 'aitt',
+ 'project_args': { 'ENABLE_AITT' : 1 }
}
}
option('tvm-support', type: 'feature', value: 'auto')
option('query-hybrid-support', type: 'feature', value: 'auto')
option('trix-engine-support', type: 'feature', value: 'auto')
+option('aitt-support', type: 'feature', value: 'auto')
# booleans & other options
option('enable-test', type: 'boolean', value: true)
%{_prefix}/lib/nnstreamer/decoders/libnnstreamer_decoder_octet_stream.so
%{_prefix}/lib/nnstreamer/filters/libnnstreamer_filter_cpp.so
%{gstlibdir}/libnnstreamer.so
+# TODO migrate nnstreamer-edge and remove below library
+%{_libdir}/libnnstreamer-edge.so
%{_libdir}/libnnstreamer.so
%files single