1 // Copyright (C) 2019 The Android Open Source Project 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef COMPUTEPIPE_RUNNER_CLIENT_INTERFACE_INCLUDE_CLIENTINTERFACE_H_ 16 #define COMPUTEPIPE_RUNNER_CLIENT_INTERFACE_INCLUDE_CLIENTINTERFACE_H_ 17 18 #include <memory> 19 20 #include "ClientEngineInterface.h" 21 #include "MemHandle.h" 22 #include "Options.pb.h" 23 #include "RunnerComponent.h" 24 25 namespace android { 26 namespace automotive { 27 namespace computepipe { 28 namespace runner { 29 namespace client_interface { 30 31 /** 32 * ClientInterface: Is the runner component that represents the client of the 33 * runner. This Component exposes communications from engine to the client. 34 */ 35 36 class ClientInterface : public RunnerComponentInterface { 37 public: 38 /** 39 * Used by the runner engine to dispatch Graph output packes to the clients 40 */ 41 virtual Status dispatchPacketToClient(int32_t streamId, 42 const std::shared_ptr<MemHandle> packet) = 0; 43 /** 44 * Used by the runner engine to activate the client interface and open it to 45 * external clients 46 */ 47 virtual Status activate() = 0; 48 49 /* 50 * 51 */ 52 virtual Status deliverGraphDebugInfo(const std::string& debugData) = 0; 53 virtual ~ClientInterface() = default; 54 }; 55 56 class ClientInterfaceFactory { 57 public: 58 std::unique_ptr<ClientInterface> createClientInterface( 59 std::string ifaceName, const proto::Options graphOptions, 60 const std::shared_ptr<ClientEngineInterface>& engine); 61 ClientInterfaceFactory(const ClientInterfaceFactory&) = delete; 62 ClientInterfaceFactory& operator=(const ClientInterfaceFactory&) = delete; 63 ClientInterfaceFactory() = default; 64 }; 65 66 } // namespace client_interface 67 } // namespace runner 68 } // namespace computepipe 69 } // namespace automotive 70 } // namespace android 71 72 #endif // COMPUTEPIPE_RUNNER_CLIENT_INTERFACE_INCLUDE_CLIENTINTERFACE_H_ 73