-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
35 lines (33 loc) · 971 Bytes
/
main.cpp
File metadata and controls
35 lines (33 loc) · 971 Bytes
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
#include <iostream>
#include <unistd.h>
#include "handler/Handler.h"
#include "handler/HandlerThread.h"
class HandlerCallback: public handler::Callback
{
public:
virtual bool handleMessage(handler::Message& msg)
{
std::cout << "HandlerCallback handleMessage, msg.what:" << msg.what << std::endl;
switch (msg.what) {
case 0x01:
std::cout << "msg.data:" << msg.data << std::endl;
break;
default:
break;
}
}
};
int main() {
std::cout << "Hello, World!" << std::endl;
handler::HandlerThread* handlerThread = new handler::HandlerThread();
handlerThread->start();
HandlerCallback callback;
handler::Callback* base = &callback;
handler::Handler* handler = new handler::Handler(handlerThread->getLooper(), base);
handler::Message msg;
msg.what = 0x01;
msg.data = "dafds";
handler->sendMessage(msg);
sleep(3);
return 0;
}