-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathHelloServer.cpp
More file actions
49 lines (38 loc) · 1.1 KB
/
HelloServer.cpp
File metadata and controls
49 lines (38 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#define LOG_TAG "helloserver"
#include <log/log.h>
#include <unistd.h>
#include <stdlib.h>
#include <utils/RefBase.h>
#include <utils/Log.h>
#include <binder/TextOutput.h>
#include <binder/IInterface.h>
#include <binder/IBinder.h>
#include <binder/ProcessState.h>
#include <binder/IServiceManager.h>
#include <binder/IPCThreadState.h>
#include "com/yuandaima/IHello.h"
#include "com/yuandaima/BnHello.h"
using namespace android;
class MyHelloService : public com::yuandaima::BnHello
{
public:
binder::Status hello()
{
ALOGI("server hello function is running");
return binder::Status();
}
binder::Status sum(int32_t x, int32_t y, int32_t* _aidl_return)
{
ALOGI("server sum function is running");
*_aidl_return = x + y;
return binder::Status();
}
};
int main(int argc, char const *argv[])
{
ALOGD("Hello Server is runing");
defaultServiceManager()->addService(String16("MyHelloService"), new MyHelloService());
ProcessState::self()->startThreadPool();
IPCThreadState::self()->joinThreadPool();
return 0;
}