Initial stub for OpenCVLibraryInfo class added.
authorAlexander Smorkalov <alexander.smorkalov@itseez.com>
Tue, 4 Dec 2012 10:23:25 +0000 (14:23 +0400)
committerAlexander Smorkalov <alexander.smorkalov@itseez.com>
Tue, 4 Dec 2012 11:36:52 +0000 (15:36 +0400)
android/service/engine/build.xml
android/service/engine/jni/Android.mk
android/service/engine/jni/JNIWrapper/OpenCVLibraryInfo.cpp [new file with mode: 0644]
android/service/engine/jni/JNIWrapper/OpenCVLibraryInfo.h [new file with mode: 0644]
android/service/engine/project.properties
android/service/engine/src/org/opencv/engine/OpenCVLibraryInfo.java [new file with mode: 0644]

index a16a4fe..98ddc3e 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project name="ManagerActivity" default="help">
+<project name="OpenCV Manager" default="help">
 
     <!-- The local.properties file is created and updated by the 'android' tool.
          It contains the path to the SDK. It should *NOT* be checked into
index 9ab92a2..71d2c46 100644 (file)
@@ -52,7 +52,8 @@ LOCAL_SRC_FILES := \
     NativeService/CommonPackageManager.cpp \
     JNIWrapper/JavaBasedPackageManager.cpp \
     NativeService/PackageInfo.cpp \
-    JNIWrapper/HardwareDetector_jni.cpp
+    JNIWrapper/HardwareDetector_jni.cpp \
+    JNIWrapper/OpenCVLibraryInfo.cpp
 
 LOCAL_C_INCLUDES := \
     $(LOCAL_PATH)/include \
diff --git a/android/service/engine/jni/JNIWrapper/OpenCVLibraryInfo.cpp b/android/service/engine/jni/JNIWrapper/OpenCVLibraryInfo.cpp
new file mode 100644 (file)
index 0000000..9d9fdbf
--- /dev/null
@@ -0,0 +1,37 @@
+#include "OpenCVLibraryInfo.h"
+
+JNIEXPORT jlong JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_open
+  (JNIEnv * env, jobject, jstring)
+{
+    return 255;
+}
+
+JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getPackageName
+  (JNIEnv* env, jobject, jlong)
+{
+    return env->NewStringUTF("org.opencv.lib_v24_tegra3");
+}
+
+JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getPublicName
+(JNIEnv* env, jobject, jlong)
+{
+    return env->NewStringUTF("OpenCV library for Tegra3");
+}
+
+JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getLibraryList
+  (JNIEnv* env, jobject, jlong)
+{
+    return env->NewStringUTF("");
+}
+
+JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getVersionName
+  (JNIEnv* env, jobject, jlong)
+{
+    return env->NewStringUTF("9.9");
+}
+
+JNIEXPORT void JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_close
+  (JNIEnv* env, jobject, jlong)
+{
+
+}
diff --git a/android/service/engine/jni/JNIWrapper/OpenCVLibraryInfo.h b/android/service/engine/jni/JNIWrapper/OpenCVLibraryInfo.h
new file mode 100644 (file)
index 0000000..ffd29c7
--- /dev/null
@@ -0,0 +1,30 @@
+#include <jni.h>
+
+#ifndef _Included_org_opencv_engine_OpenCVLibraryInfo
+#define _Included_org_opencv_engine_OpenCVLibraryInfo
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+JNIEXPORT jlong JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_open
+  (JNIEnv *, jobject, jstring);
+
+JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getPackageName
+  (JNIEnv *, jobject, jlong);
+
+  JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getPublicName
+  (JNIEnv *, jobject, jlong);
+
+JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getLibraryList
+  (JNIEnv *, jobject, jlong);
+
+JNIEXPORT jstring JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_getVersionName
+  (JNIEnv *, jobject, jlong);
+
+JNIEXPORT void JNICALL Java_org_opencv_engine_OpenCVLibraryInfo_close
+  (JNIEnv *, jobject, jlong);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
index 85aac54..b7c2081 100644 (file)
@@ -11,4 +11,4 @@
 #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
 
 # Project target.
-target=android-8
+target=android-10
diff --git a/android/service/engine/src/org/opencv/engine/OpenCVLibraryInfo.java b/android/service/engine/src/org/opencv/engine/OpenCVLibraryInfo.java
new file mode 100644 (file)
index 0000000..c1709b8
--- /dev/null
@@ -0,0 +1,47 @@
+package org.opencv.engine;
+
+public class OpenCVLibraryInfo {
+    public OpenCVLibraryInfo(String packagePath) {
+        mNativeObj = open(packagePath);
+        if (mNativeObj != 0) {
+            mPackageName = getPackageName(mNativeObj);
+            mLibraryList = getLibraryList(mNativeObj);
+            mVersionName = getVersionName(mNativeObj);
+            mPublicName = getPublicName(mNativeObj);
+            close(mNativeObj);
+        }
+    }
+
+    public boolean status() {
+        return (mNativeObj != 0);
+    }
+
+    public String packageName() {
+        return mPackageName;
+    }
+
+    public String publicName() {
+        return mPublicName;
+    }
+
+    public String libraryList() {
+        return mLibraryList;
+    }
+
+    public String versionName() {
+        return mVersionName;
+    }
+
+    private long mNativeObj;
+    private String mPackageName;
+    private String mPublicName;
+    private String mLibraryList;
+    private String mVersionName;
+
+    private native long open(String packagePath);
+    private native String getPackageName(long obj);
+    private native String getPublicName(long obj);
+    private native String getLibraryList(long obj);
+    private native String getVersionName(long obj);
+    private native void close(long obj);
+}