• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef ANDROID_AUTOMOTIVE_COMPUTEPIPE_ROUTER_V1_0_PIPECLIENT
18 #define ANDROID_AUTOMOTIVE_COMPUTEPIPE_ROUTER_V1_0_PIPECLIENT
19 
20 #include <aidl/android/automotive/computepipe/registry/IClientInfo.h>
21 #include <android/binder_auto_utils.h>
22 
23 #include <functional>
24 #include <memory>
25 #include <mutex>
26 
27 #include "ClientHandle.h"
28 #include "RemoteState.h"
29 
30 namespace android {
31 namespace automotive {
32 namespace computepipe {
33 namespace router {
34 namespace V1_0 {
35 namespace implementation {
36 
37 /**
38  * PipeClient: Encapsulated the IPC interface to the client.
39  *
40  * Allows for querrying the client state
41  */
42 class PipeClient : public ClientHandle {
43   public:
44     explicit PipeClient(
45         const std::shared_ptr<aidl::android::automotive::computepipe::registry::IClientInfo>& info);
46     bool startClientMonitor() override;
47     std::string getClientName() override;
48     bool isAlive() override;
49     ~PipeClient();
50 
51   private:
52     ::ndk::ScopedAIBinder_DeathRecipient mDeathMonitor;
53     std::shared_ptr<RemoteState> mState;
54     const std::shared_ptr<aidl::android::automotive::computepipe::registry::IClientInfo> mClientInfo;
55 };
56 
57 }  // namespace implementation
58 }  // namespace V1_0
59 }  // namespace router
60 }  // namespace computepipe
61 }  // namespace automotive
62 }  // namespace android
63 #endif
64