1 /*
2  * Copyright 2022 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 #pragma once
18 
19 #include <memory>
20 #include <string>
21 
22 #include "model/controller/controller_properties.h"
23 #include "model/controller/dual_mode_controller.h"
24 #include "model/hci/hci_transport.h"
25 
26 namespace rootcanal {
27 
28 class HciDevice : public DualModeController {
29  public:
30   HciDevice(std::shared_ptr<HciTransport> transport,
31             ControllerProperties const& properties);
32   ~HciDevice() = default;
33 
Create(std::shared_ptr<HciTransport> transport,ControllerProperties const & properties)34   static std::shared_ptr<HciDevice> Create(
35       std::shared_ptr<HciTransport> transport,
36       ControllerProperties const& properties) {
37     return std::make_shared<HciDevice>(transport, properties);
38   }
39 
GetTypeString()40   std::string GetTypeString() const override { return "hci_device"; }
41 
42   void Tick() override;
43 
44   void Close() override;
45 
46  private:
47   std::shared_ptr<HciTransport> transport_;
48 };
49 
50 }  // namespace rootcanal
51