707afb25ba9bcd00eacf17ac4165dc01daba33ac
[iec.git] / src / type3_AndroidCloud / anbox-master / android / service / host_connector.h
1 /*
2  * Copyright (C) 2016 Simon Fels <morphis@gravedo.de>
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 3, as published
6  * by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranties of
10  * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11  * PURPOSE.  See the GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along
14  * with this program.  If not, see <http://www.gnu.org/licenses/>.
15  *
16  */
17
18 #ifndef ANBOX_ANDROID_HOST_CONNECTOR_H_
19 #define ANBOX_ANDROID_HOST_CONNECTOR_H_
20
21 #include <memory>
22 #include <thread>
23 #include <atomic>
24
25 namespace anbox {
26 namespace rpc {
27 class PendingCallCache;
28 class Channel;
29 } // namespace rpc
30 class LocalSocketConnection;
31 class MessageProcessor;
32 class AndroidApiSkeleton;
33 class PlatformApiStub;
34 class HostConnector {
35 public:
36     HostConnector();
37     ~HostConnector();
38
39     void start();
40     void stop();
41
42     std::shared_ptr<anbox::PlatformApiStub> platform_api_stub() const;
43
44 private:
45     void main_loop();
46
47     std::shared_ptr<LocalSocketConnection> socket_;
48     std::shared_ptr<rpc::PendingCallCache> pending_calls_;
49     std::shared_ptr<AndroidApiSkeleton> android_api_skeleton_;
50     std::shared_ptr<MessageProcessor> message_processor_;
51     std::shared_ptr<rpc::Channel> rpc_channel_;
52     std::shared_ptr<anbox::PlatformApiStub> platform_api_stub_;
53     std::thread thread_;
54     std::atomic<bool> running_;
55 };
56 } // namespace anbox
57
58 #endif