2012-06-29 00:23:19 +08:00
|
|
|
#include "IOpenCVEngine.h"
|
|
|
|
#include "BpOpenCVEngine.h"
|
|
|
|
|
|
|
|
using namespace android;
|
|
|
|
|
|
|
|
BpOpenCVEngine::BpOpenCVEngine(const sp<IBinder>& impl):
|
|
|
|
BpInterface<IOpenCVEngine>(impl)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
BpOpenCVEngine::~BpOpenCVEngine()
|
2012-10-17 07:18:30 +08:00
|
|
|
{
|
2012-06-29 00:23:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Notes about data transaction:
|
|
|
|
// Java Binder Wrapper call readInt32 before reading return data
|
|
|
|
// It treet this in value as exception code
|
|
|
|
// This implementation support this feature
|
|
|
|
|
|
|
|
int BpOpenCVEngine::GetVersion()
|
|
|
|
{
|
|
|
|
Parcel data, reply;
|
2012-10-17 07:18:30 +08:00
|
|
|
|
2012-06-29 00:23:19 +08:00
|
|
|
data.writeInterfaceToken(IOpenCVEngine::descriptor);
|
|
|
|
remote()->transact(OCVE_GET_ENGINE_VERSION, data, &reply, 0);
|
|
|
|
// read exception code
|
|
|
|
reply.readInt32();
|
2012-10-17 07:18:30 +08:00
|
|
|
|
2012-06-29 00:23:19 +08:00
|
|
|
return reply.readInt32();
|
|
|
|
}
|
|
|
|
|
|
|
|
String16 BpOpenCVEngine::GetLibPathByVersion(String16 version)
|
|
|
|
{
|
|
|
|
Parcel data, reply;
|
2012-10-17 07:18:30 +08:00
|
|
|
|
2012-06-29 00:23:19 +08:00
|
|
|
data.writeInterfaceToken(IOpenCVEngine::descriptor);
|
|
|
|
data.writeString16(version);
|
|
|
|
remote()->transact(OCVE_GET_LIB_PATH_BY_VERSION, data, &reply, 0);
|
|
|
|
// read exception code
|
|
|
|
reply.readInt32();
|
2012-10-17 07:18:30 +08:00
|
|
|
|
2012-06-29 00:23:19 +08:00
|
|
|
return reply.readString16();
|
|
|
|
}
|
|
|
|
|
|
|
|
android::String16 BpOpenCVEngine::GetLibraryList(String16 version)
|
|
|
|
{
|
|
|
|
Parcel data, reply;
|
2012-10-17 07:18:30 +08:00
|
|
|
|
2012-06-29 00:23:19 +08:00
|
|
|
data.writeInterfaceToken(IOpenCVEngine::descriptor);
|
|
|
|
data.writeString16(version);
|
|
|
|
remote()->transact(OCVE_GET_LIB_LIST, data, &reply, 0);
|
|
|
|
// read exception code
|
|
|
|
reply.readInt32();
|
2012-10-17 07:18:30 +08:00
|
|
|
|
|
|
|
return reply.readString16();
|
2012-06-29 00:23:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool BpOpenCVEngine::InstallVersion(String16 version)
|
|
|
|
{
|
|
|
|
Parcel data, reply;
|
2012-10-17 07:18:30 +08:00
|
|
|
|
2012-06-29 00:23:19 +08:00
|
|
|
data.writeInterfaceToken(IOpenCVEngine::descriptor);
|
|
|
|
data.writeString16(version);
|
|
|
|
remote()->transact(OCVE_INSTALL_VERSION, data, &reply, 0);
|
|
|
|
// read exception code
|
|
|
|
reply.readInt32();
|
2012-10-17 07:18:30 +08:00
|
|
|
|
2012-06-29 00:23:19 +08:00
|
|
|
return static_cast<bool>(reply.readInt32());
|
|
|
|
}
|
|
|
|
|
2013-08-21 21:26:54 +08:00
|
|
|
IMPLEMENT_META_INTERFACE(OpenCVEngine, OPECV_ENGINE_CLASSNAME)
|