opencv/android/service/engine/jni/NativeService/ServiceMain.cpp

32 lines
891 B
C++
Raw Normal View History

2012-06-21 22:50:05 +08:00
#include "EngineCommon.h"
#include "IOpenCVEngine.h"
#include "OpenCVEngine.h"
#include "IPackageManager.h"
#include "NativePackageManager.h"
#include <sys/types.h>
#include <unistd.h>
#include <grp.h>
#include <binder/IPCThreadState.h>
#include <binder/ProcessState.h>
#include <binder/IServiceManager.h>
#include <utils/Log.h>
using namespace android;
int main(int argc, char *argv[])
{
LOGI("OpenCVEngine native service starting");
IPackageManager* PackageManager = new NativePackageManager();
sp<IBinder> Engine = new OpenCVEngine(PackageManager);
2012-06-21 22:50:05 +08:00
defaultServiceManager()->addService(IOpenCVEngine::descriptor, Engine);
LOGI("OpenCVEngine native service started successfully");
ProcessState::self()->startThreadPool();
IPCThreadState::self()->joinThreadPool();
LOGI("OpenCVEngine native service finished");
2012-06-21 22:50:05 +08:00
delete PackageManager;
2012-06-21 22:50:05 +08:00
return 0;
}