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_PIPEREGISTRATION
18 #define ANDROID_AUTOMOTIVE_COMPUTEPIPE_ROUTER_V1_0_PIPEREGISTRATION
19 #include <aidl/android/automotive/computepipe/registry/BnPipeRegistration.h>
20 
21 #include <memory>
22 #include <utility>
23 
24 #include "PipeRunner.h"
25 #include "Registry.h"
26 
27 namespace android {
28 namespace automotive {
29 namespace computepipe {
30 namespace router {
31 namespace V1_0 {
32 namespace implementation {
33 
34 class PipeRegistration
35     : public aidl::android::automotive::computepipe::registry::BnPipeRegistration {
36   public:
37     // Method from ::android::automotive::computepipe::registry::V1_0::IPipeRegistration
38     ndk::ScopedAStatus registerPipeRunner(
39         const std::string& graphName,
40         const std::shared_ptr<aidl::android::automotive::computepipe::runner::IPipeRunner>&
41             graphRunner) override;
42 
PipeRegistration(std::shared_ptr<PipeRegistry<PipeRunner>> r)43     explicit PipeRegistration(std::shared_ptr<PipeRegistry<PipeRunner>> r) : mRegistry(r) {
44     }
45     const char* getIfaceName();
46 
47   private:
48     // Convert internal registry error codes to PipeStatus
49     ndk::ScopedAStatus convertToBinderStatus(Error err);
50     std::shared_ptr<PipeRegistry<PipeRunner>> mRegistry;
51 };
52 
53 }  // namespace implementation
54 }  // namespace V1_0
55 }  // namespace router
56 }  // namespace computepipe
57 }  // namespace automotive
58 }  // namespace android
59 #endif
60