From: Jaeyun Jung Date: Tue, 14 Jan 2025 09:05:15 +0000 (+0900) Subject: [Android] internal header X-Git-Tag: accepted/tizen/unified/x/20250311.211303~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd9e8b136bdebbc9b93df1c8daf9dff623249a7e;p=platform%2Fcore%2Fml%2Fmlops-agent.git [Android] internal header Code clean, add internal header and cleanup script for android build. Signed-off-by: Jaeyun Jung --- diff --git a/daemon/log.h b/daemon/log.h index 2afe4bf..0d40c20 100644 --- a/daemon/log.h +++ b/daemon/log.h @@ -18,11 +18,11 @@ #ifndef __LOG_H__ #define __LOG_H__ +#define AGENT_LOG_TAG "ml-agent" + #if defined(__TIZEN__) #include -#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);\ @@ -33,6 +33,23 @@ #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 + +#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 diff --git a/daemon/mlops-agent-android.c b/daemon/mlops-agent-android.c index 4a9e087..37b391c 100644 --- a/daemon/mlops-agent-android.c +++ b/daemon/mlops-agent-android.c @@ -11,17 +11,10 @@ #include #include #include -#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. diff --git a/daemon/mlops-agent-interface.c b/daemon/mlops-agent-interface.c index 94540b1..d18a029 100644 --- a/daemon/mlops-agent-interface.c +++ b/daemon/mlops-agent-interface.c @@ -14,7 +14,8 @@ #include #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" @@ -126,17 +127,7 @@ _resolve_rpk_path_in_json (const char *json_str) { 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; diff --git a/daemon/mlops-agent-internal.h b/daemon/mlops-agent-internal.h new file mode 100755 index 0000000..b2aead4 --- /dev/null +++ b/daemon/mlops-agent-internal.h @@ -0,0 +1,35 @@ +/* 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 + * @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 + +#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__ */ diff --git a/jni/mlops-agent.mk b/jni/mlops-agent.mk new file mode 100644 index 0000000..706d573 --- /dev/null +++ b/jni/mlops-agent.mk @@ -0,0 +1,9 @@ +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 diff --git a/mlops-agent.mk b/mlops-agent.mk deleted file mode 100644 index 66c8b4c..0000000 --- a/mlops-agent.mk +++ /dev/null @@ -1,6 +0,0 @@ -# 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 -