1 /* 2 * Copyright (C) 2018 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 #include "host/libs/config/adb/adb.h" 17 18 #include <fruit/fruit.h> 19 #include <set> 20 21 namespace cuttlefish { 22 namespace { 23 24 class AdbConfigImpl : public AdbConfig { 25 public: INJECT(AdbConfigImpl ())26 INJECT(AdbConfigImpl()) {} 27 Modes() const28 const std::set<AdbMode>& Modes() const override { return modes_; } SetModes(const std::set<AdbMode> & modes)29 bool SetModes(const std::set<AdbMode>& modes) override { 30 modes_ = modes; 31 return true; 32 } SetModes(std::set<AdbMode> && modes)33 bool SetModes(std::set<AdbMode>&& modes) override { 34 modes_ = std::move(modes); 35 return true; 36 } 37 RunConnector() const38 bool RunConnector() const override { return run_connector_; } SetRunConnector(bool run)39 bool SetRunConnector(bool run) override { 40 run_connector_ = run; 41 return true; 42 } 43 44 private: 45 std::set<AdbMode> modes_; 46 bool run_connector_; 47 }; 48 49 } // namespace 50 AdbConfigComponent()51fruit::Component<AdbConfig> AdbConfigComponent() { 52 return fruit::createComponent().bind<AdbConfig, AdbConfigImpl>(); 53 } 54 55 } // namespace cuttlefish 56