Code clean, add internal header and cleanup script for android build.
Signed-off-by: Jaeyun Jung <jy1210.jung@samsung.com>
#ifndef __LOG_H__
#define __LOG_H__
+#define AGENT_LOG_TAG "ml-agent"
+
#if defined(__TIZEN__)
#include <dlog.h>
-#define AGENT_LOG_TAG "ml-agent"
-
#define LOG_V(prio, tag, fmt, arg...) \
({ do { \
dlog_print(prio, tag, "%s: %s(%d) > " fmt, __MODULE__, __func__, __LINE__, ##arg);\
#define ml_logw(fmt, arg...) LOG_V(DLOG_WARN, AGENT_LOG_TAG, fmt, ##arg)
#define ml_loge(fmt, arg...) LOG_V(DLOG_ERROR, AGENT_LOG_TAG, fmt, ##arg)
#define ml_logf(fmt, arg...) LOG_V(DLOG_FATAL, AGENT_LOG_TAG, fmt, ##arg)
+#elif defined(__ANDROID__)
+#include <android/log.h>
+
+#define ml_logd(...) \
+ __android_log_print (ANDROID_LOG_DEBUG, AGENT_LOG_TAG, __VA_ARGS__)
+
+#define ml_logi(...) \
+ __android_log_print (ANDROID_LOG_INFO, AGENT_LOG_TAG, __VA_ARGS__)
+
+#define ml_logw(...) \
+ __android_log_print (ANDROID_LOG_WARN, AGENT_LOG_TAG, __VA_ARGS__)
+
+#define ml_loge(...) \
+ __android_log_print (ANDROID_LOG_ERROR, AGENT_LOG_TAG, __VA_ARGS__)
+
+#define ml_logf(...) \
+ __android_log_print (ANDROID_LOG_FATAL, AGENT_LOG_TAG, __VA_ARGS__)
#else
#include <glib.h>
#include <errno.h>
#include <glib.h>
#include <stdint.h>
-#include "include/mlops-agent-interface.h"
-#define STR_IS_VALID(s) ((s) && (s)[0] != '\0')
-
-typedef enum
-{
- ML_AGENT_SERVICE_PIPELINE = 0,
- ML_AGENT_SERVICE_MODEL,
- ML_AGENT_SERVICE_RESOURCE,
- ML_AGENT_SERVICE_END
-} ml_agent_service_type_e;
+#include "log.h"
+#include "mlops-agent-interface.h"
+#include "mlops-agent-internal.h"
/**
* @brief An interface exported for setting the description of a pipeline.
#include <json-glib/json-glib.h>
#include "log.h"
-#include "include/mlops-agent-interface.h"
+#include "mlops-agent-interface.h"
+#include "mlops-agent-internal.h"
#include "dbus-interface.h"
#include "model-dbus.h"
#include "pipeline-dbus.h"
{
return g_strdup (json_str);
}
-#endif
-
-#define STR_IS_VALID(s) ((s) && (s)[0] != '\0')
-
-typedef enum
-{
- ML_AGENT_SERVICE_PIPELINE = 0,
- ML_AGENT_SERVICE_MODEL,
- ML_AGENT_SERVICE_RESOURCE,
- ML_AGENT_SERVICE_END
-} ml_agent_service_type_e;
+#endif /* __TIZEN__ */
typedef gpointer ml_agent_proxy_h;
--- /dev/null
+/* SPDX-License-Identifier: Apache-2.0 */
+/**
+ * @file mlops-agent-internal.h
+ * @date 14 January 2025
+ * @brief Internal header for ml-agent interface.
+ * @see https://github.com/nnstreamer/deviceMLOps.MLAgent
+ * @author Jaeyun Jung <jy1210.jung@samsung.com>
+ * @bug No known bugs except for NYI items
+ */
+
+#ifndef __MLOPS_AGENT_INTERNAL_H__
+#define __MLOPS_AGENT_INTERNAL_H__
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdint.h>
+
+#define STR_IS_VALID(s) ((s) && (s)[0] != '\0')
+
+/**
+ * @brief Internal enumeration for service type.
+ */
+typedef enum
+{
+ ML_AGENT_SERVICE_PIPELINE = 0,
+ ML_AGENT_SERVICE_MODEL,
+ ML_AGENT_SERVICE_RESOURCE,
+ ML_AGENT_SERVICE_END
+} ml_agent_service_type_e;
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* __MLOPS_AGENT_INTERNAL_H__ */
--- /dev/null
+ifndef MLOPS_AGENT_ROOT
+$(error MLOPS_AGENT_ROOT is not defined!)
+endif
+
+# mlops agent headers
+MLOPS_AGENT_INCLUDE := $(MLOPS_AGENT_ROOT)/daemon/include
+
+# mlops agent sources
+MLOPS_AGENT_SRCS := $(MLOPS_AGENT_ROOT)/daemon/mlops-agent-android.c
+++ /dev/null
-# mlops agent headers
-MLOPS_AGENT_INCLUDE := $(MLOPS_AGENT_ROOT)/daemon/include
-
-# mlops agent sources
-MLOPS_AGENT_SRCS := $(MLOPS_AGENT_ROOT)/daemon/mlops-agent-android.c
-