1 // 2 // Copyright (C) 2023 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 #pragma once 17 18 #include <android-base/logging.h> 19 #include <fruit/fruit.h> 20 21 #include "common/libs/fs/shared_fd.h" 22 #include "common/libs/utils/result.h" 23 #include "host/libs/config/feature.h" 24 25 #include "host/frontend/webrtc/webrtc_command_channel.h" 26 #include "webrtc_commands.pb.h" 27 28 namespace cuttlefish { 29 30 class WebRtcController : public SetupFeature { 31 public: INJECT(WebRtcController ())32 INJECT(WebRtcController()) {}; Name()33 std::string Name() const override { return "WebRtcController"; } 34 Result<void> ResultSetup() override; 35 36 SharedFD GetClientSocket() const; 37 Result<void> SendStartRecordingCommand(); 38 Result<void> SendStopRecordingCommand(); 39 Result<void> SendScreenshotDisplayCommand(int display_number, 40 const std::string& screenshot_path); 41 42 protected: 43 SharedFD client_socket_; 44 std::optional<WebrtcClientCommandChannel> command_channel_; 45 46 private: Dependencies()47 std::unordered_set<SetupFeature*> Dependencies() const override { return {}; } 48 }; 49 50 fruit::Component<WebRtcController> WebRtcControllerComponent(); 51 52 } // namespace cuttlefish 53