Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
55c74ebe
Commit
55c74ebe
authored
Jan 19, 2013
by
Andrey Kamaev
Committed by
OpenCV Buildbot
Jan 19, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #309 from asmorkalov:android_manager_4number_version
parents
101e9bd4
4feae810
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
102 additions
and
118 deletions
+102
-118
AndroidManifest.xml
android/service/engine/AndroidManifest.xml
+2
-2
OpenCVEngine.cpp
android/service/engine/jni/BinderComponent/OpenCVEngine.cpp
+32
-48
OpenCVEngine.h
android/service/engine/jni/BinderComponent/OpenCVEngine.h
+4
-6
CommonPackageManager.cpp
...service/engine/jni/NativeService/CommonPackageManager.cpp
+17
-22
CommonPackageManager.h
...d/service/engine/jni/NativeService/CommonPackageManager.h
+6
-8
PackageInfo.cpp
android/service/engine/jni/NativeService/PackageInfo.cpp
+29
-18
PackageInfo.h
android/service/engine/jni/NativeService/PackageInfo.h
+4
-5
IPackageManager.h
android/service/engine/jni/include/IPackageManager.h
+6
-7
info.xml
android/service/engine/res/layout/info.xml
+1
-1
main.xml
android/service/engine/res/layout/main.xml
+1
-1
No files found.
android/service/engine/AndroidManifest.xml
View file @
55c74ebe
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"org.opencv.engine"
package=
"org.opencv.engine"
android:versionCode=
"2
4
@ANDROID_PLATFORM_VERSION_CODE@"
android:versionCode=
"2
5
@ANDROID_PLATFORM_VERSION_CODE@"
android:versionName=
"2.
4
"
>
android:versionName=
"2.
5
"
>
<uses-sdk
android:minSdkVersion=
"@ANDROID_NATIVE_API_LEVEL@"
/>
<uses-sdk
android:minSdkVersion=
"@ANDROID_NATIVE_API_LEVEL@"
/>
<uses-feature
android:name=
"android.hardware.touchscreen"
android:required=
"false"
/>
<uses-feature
android:name=
"android.hardware.touchscreen"
android:required=
"false"
/>
...
...
android/service/engine/jni/BinderComponent/OpenCVEngine.cpp
View file @
55c74ebe
...
@@ -15,60 +15,44 @@ using namespace android;
...
@@ -15,60 +15,44 @@ using namespace android;
const
int
OpenCVEngine
::
Platform
=
DetectKnownPlatforms
();
const
int
OpenCVEngine
::
Platform
=
DetectKnownPlatforms
();
const
int
OpenCVEngine
::
CpuID
=
GetCpuID
();
const
int
OpenCVEngine
::
CpuID
=
GetCpuID
();
const
int
OpenCVEngine
::
KnownVersions
[]
=
{
2040000
,
2040100
,
2040200
,
2040300
,
2040301
,
2040302
};
std
::
set
<
std
::
string
>
OpenCVEngine
::
InitKnownOpenCVersions
(
)
bool
OpenCVEngine
::
ValidateVersion
(
int
version
)
{
{
std
::
set
<
std
::
string
>
result
;
for
(
size_t
i
=
0
;
i
<
sizeof
(
KnownVersions
)
/
sizeof
(
int
);
i
++
)
if
(
KnownVersions
[
i
]
==
version
)
return
true
;
result
.
insert
(
"240"
);
return
false
;
result
.
insert
(
"241"
);
result
.
insert
(
"242"
);
result
.
insert
(
"243"
);
return
result
;
}
const
std
::
set
<
std
::
string
>
OpenCVEngine
::
KnownVersions
=
InitKnownOpenCVersions
();
bool
OpenCVEngine
::
ValidateVersionString
(
const
std
::
string
&
version
)
{
return
(
KnownVersions
.
find
(
version
)
!=
KnownVersions
.
end
());
}
}
std
::
string
OpenCVEngine
::
NormalizeVersionString
(
std
::
string
version
)
int
OpenCVEngine
::
NormalizeVersionString
(
std
::
string
version
)
{
{
std
::
string
result
=
""
;
int
result
=
0
;
std
::
string
suffix
=
""
;
if
(
version
.
empty
())
if
(
version
.
empty
())
{
{
return
result
;
return
result
;
}
}
if
((
'a'
==
version
[
version
.
size
()
-
1
])
||
(
'b'
==
version
[
version
.
size
()
-
1
]))
{
suffix
=
version
[
version
.
size
()
-
1
];
version
.
erase
(
version
.
size
()
-
1
);
}
std
::
vector
<
std
::
string
>
parts
=
SplitStringVector
(
version
,
'.'
);
std
::
vector
<
std
::
string
>
parts
=
SplitStringVector
(
version
,
'.'
);
if
(
parts
.
size
()
>=
2
)
// Use only 4 digits of the version, i.e. 1.2.3.4.
// Other digits will be ignored.
if
(
parts
.
size
()
>
4
)
parts
.
erase
(
parts
.
begin
()
+
4
,
parts
.
end
());
int
multiplyer
=
1000000
;
for
(
std
::
vector
<
std
::
string
>::
const_iterator
it
=
parts
.
begin
();
it
!=
parts
.
end
();
++
it
)
{
{
if
(
parts
.
size
()
>=
3
)
int
digit
=
atoi
(
it
->
c_str
());
{
result
+=
multiplyer
*
digit
;
result
=
parts
[
0
]
+
parts
[
1
]
+
parts
[
2
]
+
suffix
;
multiplyer
/=
100
;
if
(
!
ValidateVersionString
(
result
))
result
=
""
;
}
else
{
result
=
parts
[
0
]
+
parts
[
1
]
+
"0"
+
suffix
;
if
(
!
ValidateVersionString
(
result
))
result
=
""
;
}
}
}
if
(
!
ValidateVersion
(
result
))
result
=
0
;
return
result
;
return
result
;
}
}
...
@@ -86,19 +70,19 @@ int32_t OpenCVEngine::GetVersion()
...
@@ -86,19 +70,19 @@ int32_t OpenCVEngine::GetVersion()
String16
OpenCVEngine
::
GetLibPathByVersion
(
android
::
String16
version
)
String16
OpenCVEngine
::
GetLibPathByVersion
(
android
::
String16
version
)
{
{
std
::
string
std_version
(
String8
(
version
).
string
());
std
::
string
std_version
(
String8
(
version
).
string
());
std
::
string
norm_version
;
int
norm_version
;
std
::
string
path
;
std
::
string
path
;
LOGD
(
"OpenCVEngine::GetLibPathByVersion(%s) impl"
,
String8
(
version
).
string
());
LOGD
(
"OpenCVEngine::GetLibPathByVersion(%s) impl"
,
String8
(
version
).
string
());
norm_version
=
NormalizeVersionString
(
std_version
);
norm_version
=
NormalizeVersionString
(
std_version
);
if
(
!
norm_version
.
empty
()
)
if
(
0
!=
norm_version
)
{
{
path
=
PackageManager
->
GetPackagePathByVersion
(
norm_version
,
Platform
,
CpuID
);
path
=
PackageManager
->
GetPackagePathByVersion
(
norm_version
,
Platform
,
CpuID
);
if
(
path
.
empty
())
if
(
path
.
empty
())
{
{
LOGI
(
"Package OpenCV of version
%s is not installed. Try to install it :)"
,
norm_version
.
c_str
()
);
LOGI
(
"Package OpenCV of version
\"
%s
\"
(%d) is not installed. Try to install it :)"
,
String8
(
version
).
string
(),
norm_version
);
}
}
else
else
{
{
...
@@ -107,7 +91,7 @@ String16 OpenCVEngine::GetLibPathByVersion(android::String16 version)
...
@@ -107,7 +91,7 @@ String16 OpenCVEngine::GetLibPathByVersion(android::String16 version)
}
}
else
else
{
{
LOGE
(
"OpenCV version
\"
%s
\"
(%
s) is not supported"
,
String8
(
version
).
string
(),
norm_version
.
c_str
()
);
LOGE
(
"OpenCV version
\"
%s
\"
(%
d) is not supported"
,
String8
(
version
).
string
(),
norm_version
);
}
}
return
String16
(
path
.
c_str
());
return
String16
(
path
.
c_str
());
...
@@ -116,11 +100,11 @@ String16 OpenCVEngine::GetLibPathByVersion(android::String16 version)
...
@@ -116,11 +100,11 @@ String16 OpenCVEngine::GetLibPathByVersion(android::String16 version)
android
::
String16
OpenCVEngine
::
GetLibraryList
(
android
::
String16
version
)
android
::
String16
OpenCVEngine
::
GetLibraryList
(
android
::
String16
version
)
{
{
std
::
string
std_version
=
String8
(
version
).
string
();
std
::
string
std_version
=
String8
(
version
).
string
();
std
::
string
norm_version
;
int
norm_version
;
String16
result
;
String16
result
;
norm_version
=
NormalizeVersionString
(
std_version
);
norm_version
=
NormalizeVersionString
(
std_version
);
if
(
!
norm_version
.
empty
()
)
if
(
0
!=
norm_version
)
{
{
std
::
string
tmp
=
PackageManager
->
GetPackagePathByVersion
(
norm_version
,
Platform
,
CpuID
);
std
::
string
tmp
=
PackageManager
->
GetPackagePathByVersion
(
norm_version
,
Platform
,
CpuID
);
if
(
!
tmp
.
empty
())
if
(
!
tmp
.
empty
())
...
@@ -156,12 +140,12 @@ android::String16 OpenCVEngine::GetLibraryList(android::String16 version)
...
@@ -156,12 +140,12 @@ android::String16 OpenCVEngine::GetLibraryList(android::String16 version)
}
}
else
else
{
{
LOGI
(
"Package OpenCV of version
%s is not installed. Try to install it :)"
,
norm_version
.
c_str
()
);
LOGI
(
"Package OpenCV of version
\"
%s
\"
(%d) is not installed. Try to install it :)"
,
std_version
.
c_str
(),
norm_version
);
}
}
}
}
else
else
{
{
LOGE
(
"OpenCV version
\"
%s
\"
is not supported"
,
norm
_version
.
c_str
());
LOGE
(
"OpenCV version
\"
%s
\"
is not supported"
,
std
_version
.
c_str
());
}
}
return
result
;
return
result
;
...
@@ -170,21 +154,21 @@ android::String16 OpenCVEngine::GetLibraryList(android::String16 version)
...
@@ -170,21 +154,21 @@ android::String16 OpenCVEngine::GetLibraryList(android::String16 version)
bool
OpenCVEngine
::
InstallVersion
(
android
::
String16
version
)
bool
OpenCVEngine
::
InstallVersion
(
android
::
String16
version
)
{
{
std
::
string
std_version
=
String8
(
version
).
string
();
std
::
string
std_version
=
String8
(
version
).
string
();
std
::
string
norm_version
;
int
norm_version
;
bool
result
=
false
;
bool
result
=
false
;
LOGD
(
"OpenCVEngine::InstallVersion() begin"
);
LOGD
(
"OpenCVEngine::InstallVersion() begin"
);
norm_version
=
NormalizeVersionString
(
std_version
);
norm_version
=
NormalizeVersionString
(
std_version
);
if
(
!
norm_version
.
empty
()
)
if
(
0
!=
norm_version
)
{
{
LOGD
(
"PackageManager->InstallVersion call"
);
LOGD
(
"PackageManager->InstallVersion call"
);
result
=
PackageManager
->
InstallVersion
(
norm_version
,
Platform
,
CpuID
);
result
=
PackageManager
->
InstallVersion
(
norm_version
,
Platform
,
CpuID
);
}
}
else
else
{
{
LOGE
(
"OpenCV version
\"
%s
\"
is not supported"
,
norm_version
.
c_str
()
);
LOGE
(
"OpenCV version
\"
%s
\"
(%d) is not supported"
,
std_version
.
c_str
(),
norm_version
);
}
}
LOGD
(
"OpenCVEngine::InstallVersion() end"
);
LOGD
(
"OpenCVEngine::InstallVersion() end"
);
...
...
android/service/engine/jni/BinderComponent/OpenCVEngine.h
View file @
55c74ebe
...
@@ -23,16 +23,15 @@ public:
...
@@ -23,16 +23,15 @@ public:
protected
:
protected
:
IPackageManager
*
PackageManager
;
IPackageManager
*
PackageManager
;
static
const
std
::
set
<
std
::
string
>
KnownVersions
;
static
const
int
KnownVersions
[]
;
OpenCVEngine
();
OpenCVEngine
();
static
std
::
set
<
std
::
string
>
InitKnownOpenCVersions
();
bool
ValidateVersion
(
int
version
);
bool
ValidateVersionString
(
const
std
::
string
&
version
);
int
NormalizeVersionString
(
std
::
string
version
);
std
::
string
NormalizeVersionString
(
std
::
string
version
);
bool
FixPermissions
(
const
std
::
string
&
path
);
bool
FixPermissions
(
const
std
::
string
&
path
);
static
const
int
Platform
;
static
const
int
Platform
;
static
const
int
CpuID
;
static
const
int
CpuID
;
};
};
#endif
#endif
\ No newline at end of file
android/service/engine/jni/NativeService/CommonPackageManager.cpp
View file @
55c74ebe
...
@@ -11,22 +11,24 @@
...
@@ -11,22 +11,24 @@
using
namespace
std
;
using
namespace
std
;
set
<
string
>
CommonPackageManager
::
GetInstalledVersions
()
vector
<
int
>
CommonPackageManager
::
GetInstalledVersions
()
{
{
set
<
string
>
result
;
vector
<
int
>
result
;
vector
<
PackageInfo
>
installed_packages
=
GetInstalledPackages
();
vector
<
PackageInfo
>
installed_packages
=
GetInstalledPackages
();
for
(
vector
<
PackageInfo
>::
const_iterator
it
=
installed_packages
.
begin
();
it
!=
installed_packages
.
end
();
++
it
)
result
.
resize
(
installed_packages
.
size
());
for
(
size_t
i
=
0
;
i
<
installed_packages
.
size
();
i
++
)
{
{
string
version
=
it
->
GetVersion
();
int
version
=
installed_packages
[
i
].
GetVersion
();
assert
(
!
version
.
empty
()
);
assert
(
version
);
result
.
insert
(
version
)
;
result
[
i
]
=
version
;
}
}
return
result
;
return
result
;
}
}
bool
CommonPackageManager
::
CheckVersionInstalled
(
const
std
::
string
&
version
,
int
platform
,
int
cpu_id
)
bool
CommonPackageManager
::
CheckVersionInstalled
(
int
version
,
int
platform
,
int
cpu_id
)
{
{
bool
result
=
false
;
bool
result
=
false
;
LOGD
(
"CommonPackageManager::CheckVersionInstalled() begin"
);
LOGD
(
"CommonPackageManager::CheckVersionInstalled() begin"
);
...
@@ -48,14 +50,14 @@ bool CommonPackageManager::CheckVersionInstalled(const std::string& version, int
...
@@ -48,14 +50,14 @@ bool CommonPackageManager::CheckVersionInstalled(const std::string& version, int
return
result
;
return
result
;
}
}
bool
CommonPackageManager
::
InstallVersion
(
const
std
::
string
&
version
,
int
platform
,
int
cpu_id
)
bool
CommonPackageManager
::
InstallVersion
(
int
version
,
int
platform
,
int
cpu_id
)
{
{
LOGD
(
"CommonPackageManager::InstallVersion() begin"
);
LOGD
(
"CommonPackageManager::InstallVersion() begin"
);
PackageInfo
package
(
version
,
platform
,
cpu_id
);
PackageInfo
package
(
version
,
platform
,
cpu_id
);
return
InstallPackage
(
package
);
return
InstallPackage
(
package
);
}
}
string
CommonPackageManager
::
GetPackagePathByVersion
(
const
std
::
string
&
version
,
int
platform
,
int
cpu_id
)
string
CommonPackageManager
::
GetPackagePathByVersion
(
int
version
,
int
platform
,
int
cpu_id
)
{
{
string
result
;
string
result
;
PackageInfo
target_package
(
version
,
platform
,
cpu_id
);
PackageInfo
target_package
(
version
,
platform
,
cpu_id
);
...
@@ -64,7 +66,7 @@ string CommonPackageManager::GetPackagePathByVersion(const std::string& version,
...
@@ -64,7 +66,7 @@ string CommonPackageManager::GetPackagePathByVersion(const std::string& version,
for
(
vector
<
PackageInfo
>::
iterator
it
=
all_packages
.
begin
();
it
!=
all_packages
.
end
();
++
it
)
for
(
vector
<
PackageInfo
>::
iterator
it
=
all_packages
.
begin
();
it
!=
all_packages
.
end
();
++
it
)
{
{
LOGD
(
"Check version
\"
%
s
\"
compatibility with
\"
%s
\"\n
"
,
version
.
c_str
(),
it
->
GetVersion
().
c_str
());
LOGD
(
"Check version
\"
%
d
\"
compatibility with
\"
%d
\"\n
"
,
version
,
it
->
GetVersion
());
if
(
IsVersionCompatible
(
version
,
it
->
GetVersion
()))
if
(
IsVersionCompatible
(
version
,
it
->
GetVersion
()))
{
{
LOGD
(
"Compatible"
);
LOGD
(
"Compatible"
);
...
@@ -79,7 +81,7 @@ string CommonPackageManager::GetPackagePathByVersion(const std::string& version,
...
@@ -79,7 +81,7 @@ string CommonPackageManager::GetPackagePathByVersion(const std::string& version,
if
(
!
packages
.
empty
())
if
(
!
packages
.
empty
())
{
{
int
OptRating
=
-
1
;
int
OptRating
=
-
1
;
std
::
string
OptVersion
=
""
;
int
OptVersion
=
0
;
std
::
vector
<
std
::
pair
<
int
,
int
>
>&
group
=
CommonPackageManager
::
ArmRating
;
std
::
vector
<
std
::
pair
<
int
,
int
>
>&
group
=
CommonPackageManager
::
ArmRating
;
if
((
cpu_id
&
ARCH_X86
)
||
(
cpu_id
&
ARCH_X64
))
if
((
cpu_id
&
ARCH_X86
)
||
(
cpu_id
&
ARCH_X64
))
...
@@ -124,20 +126,13 @@ string CommonPackageManager::GetPackagePathByVersion(const std::string& version,
...
@@ -124,20 +126,13 @@ string CommonPackageManager::GetPackagePathByVersion(const std::string& version,
return
result
;
return
result
;
}
}
bool
CommonPackageManager
::
IsVersionCompatible
(
const
std
::
string
&
target_version
,
const
std
::
string
&
package_version
)
bool
CommonPackageManager
::
IsVersionCompatible
(
int
target_version
,
int
package_version
)
{
{
assert
(
target_version
.
size
()
==
3
);
assert
(
target_version
);
assert
(
package_version
.
size
()
==
3
);
assert
(
package_version
);
bool
result
=
false
;
// major version is the same and minor package version is above or the same as target.
// major version is the same and minor package version is above or the same as target.
if
((
package_version
[
0
]
==
target_version
[
0
])
&&
(
package_version
[
1
]
==
target_version
[
1
])
&&
(
package_version
[
2
]
>=
target_version
[
2
]))
return
(
(
package_version
/
10000
==
target_version
/
10000
)
&&
(
package_version
%
10000
>=
target_version
%
10000
)
);
{
result
=
true
;
}
return
result
;
}
}
int
CommonPackageManager
::
GetHardwareRating
(
int
platform
,
int
cpu_id
,
const
std
::
vector
<
std
::
pair
<
int
,
int
>
>&
group
)
int
CommonPackageManager
::
GetHardwareRating
(
int
platform
,
int
cpu_id
,
const
std
::
vector
<
std
::
pair
<
int
,
int
>
>&
group
)
...
...
android/service/engine/jni/NativeService/CommonPackageManager.h
View file @
55c74ebe
...
@@ -3,17 +3,16 @@
...
@@ -3,17 +3,16 @@
#include "IPackageManager.h"
#include "IPackageManager.h"
#include "PackageInfo.h"
#include "PackageInfo.h"
#include <set>
#include <vector>
#include <vector>
#include <string>
#include <string>
class
CommonPackageManager
:
public
IPackageManager
class
CommonPackageManager
:
public
IPackageManager
{
{
public
:
public
:
std
::
set
<
std
::
string
>
GetInstalledVersions
();
std
::
vector
<
int
>
GetInstalledVersions
();
bool
CheckVersionInstalled
(
const
std
::
string
&
version
,
int
platform
,
int
cpu_id
);
bool
CheckVersionInstalled
(
int
version
,
int
platform
,
int
cpu_id
);
bool
InstallVersion
(
const
std
::
string
&
version
,
int
platform
,
int
cpu_id
);
bool
InstallVersion
(
int
version
,
int
platform
,
int
cpu_id
);
std
::
string
GetPackagePathByVersion
(
const
std
::
string
&
version
,
int
platform
,
int
cpu_id
);
std
::
string
GetPackagePathByVersion
(
int
version
,
int
platform
,
int
cpu_id
);
virtual
~
CommonPackageManager
();
virtual
~
CommonPackageManager
();
protected
:
protected
:
...
@@ -23,7 +22,7 @@ protected:
...
@@ -23,7 +22,7 @@ protected:
static
std
::
vector
<
std
::
pair
<
int
,
int
>
>
InitArmRating
();
static
std
::
vector
<
std
::
pair
<
int
,
int
>
>
InitArmRating
();
static
std
::
vector
<
std
::
pair
<
int
,
int
>
>
InitIntelRating
();
static
std
::
vector
<
std
::
pair
<
int
,
int
>
>
InitIntelRating
();
bool
IsVersionCompatible
(
const
std
::
string
&
target_version
,
const
std
::
string
&
package_version
);
bool
IsVersionCompatible
(
int
target_version
,
int
package_version
);
int
GetHardwareRating
(
int
platform
,
int
cpu_id
,
const
std
::
vector
<
std
::
pair
<
int
,
int
>
>&
group
);
int
GetHardwareRating
(
int
platform
,
int
cpu_id
,
const
std
::
vector
<
std
::
pair
<
int
,
int
>
>&
group
);
virtual
bool
InstallPackage
(
const
PackageInfo
&
package
)
=
0
;
virtual
bool
InstallPackage
(
const
PackageInfo
&
package
)
=
0
;
...
@@ -31,4 +30,4 @@ protected:
...
@@ -31,4 +30,4 @@ protected:
};
};
#endif
#endif
\ No newline at end of file
android/service/engine/jni/NativeService/PackageInfo.cpp
View file @
55c74ebe
...
@@ -124,14 +124,19 @@ inline int SplitIntelFeatures(const vector<string>& features)
...
@@ -124,14 +124,19 @@ inline int SplitIntelFeatures(const vector<string>& features)
return
result
;
return
result
;
}
}
inline
string
SplitVersion
(
const
vector
<
string
>&
features
,
const
string
&
package_version
)
inline
int
SplitVersion
(
const
vector
<
string
>&
features
,
const
string
&
package_version
)
{
{
string
result
;
int
result
=
0
;
if
((
features
.
size
()
>
1
)
&&
(
'v'
==
features
[
1
][
0
]))
if
((
features
.
size
()
>
1
)
&&
(
'v'
==
features
[
1
][
0
]))
{
{
result
=
features
[
1
].
substr
(
1
);
// Taking major and minor mart of library version from package name
result
+=
SplitStringVector
(
package_version
,
'.'
)[
0
];
string
tmp1
=
features
[
1
].
substr
(
1
);
result
+=
atoi
(
tmp1
.
substr
(
0
,
1
).
c_str
())
*
1000000
+
atoi
(
tmp1
.
substr
(
1
,
1
).
c_str
())
*
10000
;
// Taking release and build number from package revision
vector
<
string
>
tmp2
=
SplitStringVector
(
package_version
,
'.'
);
result
+=
atoi
(
tmp2
[
0
].
c_str
())
*
100
+
atoi
(
tmp2
[
1
].
c_str
());
}
}
else
else
{
{
...
@@ -186,9 +191,9 @@ inline int SplitPlatfrom(const vector<string>& features)
...
@@ -186,9 +191,9 @@ inline int SplitPlatfrom(const vector<string>& features)
* Second part is version. Version starts from "v" symbol. After "v" symbol version nomber without dot symbol added.
* Second part is version. Version starts from "v" symbol. After "v" symbol version nomber without dot symbol added.
* If platform is known third part is platform name
* If platform is known third part is platform name
* If platform is unknown it is defined by hardware capabilities using pattern: <arch>_<floating point and vectorization features>_<other features>
* If platform is unknown it is defined by hardware capabilities using pattern: <arch>_<floating point and vectorization features>_<other features>
* Example: armv7_neon
, armv5_vfpv3
* Example: armv7_neon
*/
*/
PackageInfo
::
PackageInfo
(
const
string
&
version
,
int
platform
,
int
cpu_id
,
std
::
string
install_path
)
:
PackageInfo
::
PackageInfo
(
int
version
,
int
platform
,
int
cpu_id
,
std
::
string
install_path
)
:
Version
(
version
),
Version
(
version
),
Platform
(
platform
),
Platform
(
platform
),
CpuID
(
cpu_id
),
CpuID
(
cpu_id
),
...
@@ -198,7 +203,14 @@ InstallPath("")
...
@@ -198,7 +203,14 @@ InstallPath("")
Platform
=
PLATFORM_UNKNOWN
;
Platform
=
PLATFORM_UNKNOWN
;
#endif
#endif
FullName
=
BasePackageName
+
"_v"
+
Version
.
substr
(
0
,
Version
.
size
()
-
1
);
int
major_version
=
version
/
1000000
;
int
minor_version
=
version
/
10000
-
major_version
*
100
;
char
tmp
[
32
];
sprintf
(
tmp
,
"%d%d"
,
major_version
,
minor_version
);
FullName
=
BasePackageName
+
std
::
string
(
"_v"
)
+
std
::
string
(
tmp
);
if
(
PLATFORM_UNKNOWN
!=
Platform
)
if
(
PLATFORM_UNKNOWN
!=
Platform
)
{
{
FullName
+=
string
(
"_"
)
+
JoinPlatform
(
platform
);
FullName
+=
string
(
"_"
)
+
JoinPlatform
(
platform
);
...
@@ -296,7 +308,7 @@ InstallPath("")
...
@@ -296,7 +308,7 @@ InstallPath("")
else
else
{
{
LOGD
(
"PackageInfo::PackageInfo: package arch unknown"
);
LOGD
(
"PackageInfo::PackageInfo: package arch unknown"
);
Version
.
clear
()
;
Version
=
0
;
CpuID
=
ARCH_UNKNOWN
;
CpuID
=
ARCH_UNKNOWN
;
Platform
=
PLATFORM_UNKNOWN
;
Platform
=
PLATFORM_UNKNOWN
;
}
}
...
@@ -304,7 +316,7 @@ InstallPath("")
...
@@ -304,7 +316,7 @@ InstallPath("")
else
else
{
{
LOGD
(
"PackageInfo::PackageInfo: package arch unknown"
);
LOGD
(
"PackageInfo::PackageInfo: package arch unknown"
);
Version
.
clear
()
;
Version
=
0
;
CpuID
=
ARCH_UNKNOWN
;
CpuID
=
ARCH_UNKNOWN
;
Platform
=
PLATFORM_UNKNOWN
;
Platform
=
PLATFORM_UNKNOWN
;
}
}
...
@@ -371,7 +383,7 @@ InstallPath(install_path)
...
@@ -371,7 +383,7 @@ InstallPath(install_path)
{
{
LOGI
(
"Info library not found in package"
);
LOGI
(
"Info library not found in package"
);
LOGI
(
"OpenCV Manager package does not contain any verison of OpenCV library"
);
LOGI
(
"OpenCV Manager package does not contain any verison of OpenCV library"
);
Version
.
clear
()
;
Version
=
0
;
CpuID
=
ARCH_UNKNOWN
;
CpuID
=
ARCH_UNKNOWN
;
Platform
=
PLATFORM_UNKNOWN
;
Platform
=
PLATFORM_UNKNOWN
;
return
;
return
;
...
@@ -383,7 +395,7 @@ InstallPath(install_path)
...
@@ -383,7 +395,7 @@ InstallPath(install_path)
if
(
!
features
.
empty
()
&&
(
BasePackageName
==
features
[
0
]))
if
(
!
features
.
empty
()
&&
(
BasePackageName
==
features
[
0
]))
{
{
Version
=
SplitVersion
(
features
,
package_version
);
Version
=
SplitVersion
(
features
,
package_version
);
if
(
Version
.
empty
()
)
if
(
0
==
Version
)
{
{
CpuID
=
ARCH_UNKNOWN
;
CpuID
=
ARCH_UNKNOWN
;
Platform
=
PLATFORM_UNKNOWN
;
Platform
=
PLATFORM_UNKNOWN
;
...
@@ -410,7 +422,7 @@ InstallPath(install_path)
...
@@ -410,7 +422,7 @@ InstallPath(install_path)
if
(
features
.
size
()
<
3
)
if
(
features
.
size
()
<
3
)
{
{
LOGD
(
"It is not OpenCV library package for this platform"
);
LOGD
(
"It is not OpenCV library package for this platform"
);
Version
.
clear
()
;
Version
=
0
;
CpuID
=
ARCH_UNKNOWN
;
CpuID
=
ARCH_UNKNOWN
;
Platform
=
PLATFORM_UNKNOWN
;
Platform
=
PLATFORM_UNKNOWN
;
return
;
return
;
...
@@ -444,7 +456,7 @@ InstallPath(install_path)
...
@@ -444,7 +456,7 @@ InstallPath(install_path)
else
else
{
{
LOGD
(
"It is not OpenCV library package for this platform"
);
LOGD
(
"It is not OpenCV library package for this platform"
);
Version
.
clear
()
;
Version
=
0
;
CpuID
=
ARCH_UNKNOWN
;
CpuID
=
ARCH_UNKNOWN
;
Platform
=
PLATFORM_UNKNOWN
;
Platform
=
PLATFORM_UNKNOWN
;
return
;
return
;
...
@@ -454,7 +466,7 @@ InstallPath(install_path)
...
@@ -454,7 +466,7 @@ InstallPath(install_path)
else
else
{
{
LOGD
(
"It is not OpenCV library package for this platform"
);
LOGD
(
"It is not OpenCV library package for this platform"
);
Version
.
clear
()
;
Version
=
0
;
CpuID
=
ARCH_UNKNOWN
;
CpuID
=
ARCH_UNKNOWN
;
Platform
=
PLATFORM_UNKNOWN
;
Platform
=
PLATFORM_UNKNOWN
;
return
;
return
;
...
@@ -463,7 +475,7 @@ InstallPath(install_path)
...
@@ -463,7 +475,7 @@ InstallPath(install_path)
bool
PackageInfo
::
IsValid
()
const
bool
PackageInfo
::
IsValid
()
const
{
{
return
!
(
Version
.
empty
(
)
&&
(
PLATFORM_UNKNOWN
==
Platform
)
&&
(
ARCH_UNKNOWN
==
CpuID
));
return
!
(
(
0
==
Version
)
&&
(
PLATFORM_UNKNOWN
==
Platform
)
&&
(
ARCH_UNKNOWN
==
CpuID
));
}
}
int
PackageInfo
::
GetPlatform
()
const
int
PackageInfo
::
GetPlatform
()
const
...
@@ -481,7 +493,7 @@ string PackageInfo::GetFullName() const
...
@@ -481,7 +493,7 @@ string PackageInfo::GetFullName() const
return
FullName
;
return
FullName
;
}
}
string
PackageInfo
::
GetVersion
()
const
int
PackageInfo
::
GetVersion
()
const
{
{
return
Version
;
return
Version
;
}
}
...
@@ -494,4 +506,4 @@ string PackageInfo::GetInstalationPath() const
...
@@ -494,4 +506,4 @@ string PackageInfo::GetInstalationPath() const
bool
PackageInfo
::
operator
==
(
const
PackageInfo
&
package
)
const
bool
PackageInfo
::
operator
==
(
const
PackageInfo
&
package
)
const
{
{
return
(
package
.
FullName
==
FullName
);
return
(
package
.
FullName
==
FullName
);
}
}
\ No newline at end of file
android/service/engine/jni/NativeService/PackageInfo.h
View file @
55c74ebe
...
@@ -30,10 +30,10 @@
...
@@ -30,10 +30,10 @@
class
PackageInfo
class
PackageInfo
{
{
public
:
public
:
PackageInfo
(
const
std
::
string
&
version
,
int
platform
,
int
cpu_id
,
std
::
string
install_path
=
"/data/data/"
);
PackageInfo
(
int
version
,
int
platform
,
int
cpu_id
,
std
::
string
install_path
=
"/data/data/"
);
PackageInfo
(
const
std
::
string
&
fullname
,
const
std
::
string
&
install_path
,
std
::
string
package_version
=
"0.0"
);
PackageInfo
(
const
std
::
string
&
fullname
,
const
std
::
string
&
install_path
,
std
::
string
package_version
=
"0.0"
);
std
::
string
GetFullName
()
const
;
std
::
string
GetFullName
()
const
;
std
::
string
GetVersion
()
const
;
int
GetVersion
()
const
;
int
GetPlatform
()
const
;
int
GetPlatform
()
const
;
int
GetCpuID
()
const
;
int
GetCpuID
()
const
;
std
::
string
GetInstalationPath
()
const
;
std
::
string
GetInstalationPath
()
const
;
...
@@ -43,7 +43,7 @@ public:
...
@@ -43,7 +43,7 @@ public:
protected
:
protected
:
static
std
::
map
<
int
,
std
::
string
>
InitPlatformNameMap
();
static
std
::
map
<
int
,
std
::
string
>
InitPlatformNameMap
();
std
::
string
Version
;
int
Version
;
int
Platform
;
int
Platform
;
int
CpuID
;
int
CpuID
;
std
::
string
FullName
;
std
::
string
FullName
;
...
@@ -51,4 +51,4 @@ protected:
...
@@ -51,4 +51,4 @@ protected:
static
const
std
::
string
BasePackageName
;
static
const
std
::
string
BasePackageName
;
};
};
#endif
#endif
\ No newline at end of file
android/service/engine/jni/include/IPackageManager.h
View file @
55c74ebe
#ifndef __IPACKAGE_MANAGER__
#ifndef __IPACKAGE_MANAGER__
#define __IPACKAGE_MANAGER__
#define __IPACKAGE_MANAGER__
#include <
set
>
#include <
vector
>
#include <string>
#include <string>
class
IPackageManager
class
IPackageManager
{
{
public
:
public
:
virtual
std
::
set
<
std
::
string
>
GetInstalledVersions
()
=
0
;
virtual
std
::
vector
<
int
>
GetInstalledVersions
()
=
0
;
virtual
bool
CheckVersionInstalled
(
const
std
::
string
&
version
,
int
platform
,
int
cpu_id
)
=
0
;
virtual
bool
CheckVersionInstalled
(
int
version
,
int
platform
,
int
cpu_id
)
=
0
;
virtual
bool
InstallVersion
(
const
std
::
string
&
,
int
platform
,
int
cpu_id
)
=
0
;
virtual
bool
InstallVersion
(
int
version
,
int
platform
,
int
cpu_id
)
=
0
;
virtual
std
::
string
GetPackagePathByVersion
(
const
std
::
string
&
,
int
platform
,
int
cpu_id
)
=
0
;
virtual
std
::
string
GetPackagePathByVersion
(
int
version
,
int
platform
,
int
cpu_id
)
=
0
;
virtual
~
IPackageManager
(){};
virtual
~
IPackageManager
(){};
};
};
#endif
#endif
\ No newline at end of file
android/service/engine/res/layout/info.xml
View file @
55c74ebe
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
android:id=
"@+id/textView1"
android:id=
"@+id/textView1"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"
V
ersion: "
android:text=
"
Library v
ersion: "
android:textAppearance=
"?android:attr/textAppearanceSmall"
/>
android:textAppearance=
"?android:attr/textAppearanceSmall"
/>
<TextView
<TextView
...
...
android/service/engine/res/layout/main.xml
View file @
55c74ebe
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
android:id=
"@+id/EngineVersionCaption"
android:id=
"@+id/EngineVersionCaption"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"
V
ersion: "
android:text=
"
OpenCV Manager v
ersion: "
android:textAppearance=
"?android:attr/textAppearanceMedium"
/>
android:textAppearance=
"?android:attr/textAppearanceMedium"
/>
<TextView
<TextView
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment