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 #define LOG_TAG "iso"
18
19 #include <memory>
20 #include "module.h"
21 #include "os/handler.h"
22 #include "os/log.h"
23
24 #include "hci/acl_manager.h"
25 #include "hci/hci_layer.h"
26 #include "iso/iso_module.h"
27
28 namespace bluetooth {
29 namespace iso {
30
__anon1cc491b00102() 31 const ModuleFactory IsoModule::Factory = ModuleFactory([]() { return new IsoModule(); });
32
33 struct IsoModule::impl {
implbluetooth::iso::IsoModule::impl34 impl(os::Handler* iso_handler, hci::HciLayer* hci_layer, hci::Controller* controller)
35 : iso_handler_(iso_handler), hci_layer_(hci_layer), controller_(controller) {}
36
37 os::Handler* iso_handler_;
38 hci::HciLayer* hci_layer_;
39 hci::Controller* controller_;
40
41 internal::IsoManagerImpl iso_manager_impl{iso_handler_, hci_layer_, controller_};
42 };
43
ListDependencies(ModuleList * list)44 void IsoModule::ListDependencies(ModuleList* list) {
45 list->add<hci::HciLayer>();
46 list->add<hci::Controller>();
47 }
48
Start()49 void IsoModule::Start() {
50 pimpl_ = std::make_unique<impl>(GetHandler(), GetDependency<hci::HciLayer>(), GetDependency<hci::Controller>());
51 }
52
Stop()53 void IsoModule::Stop() {
54 pimpl_.reset();
55 }
56
ToString() const57 std::string IsoModule::ToString() const {
58 return "Iso Module";
59 }
60
GetIsoManager()61 std::unique_ptr<IsoManager> IsoModule::GetIsoManager() {
62 return std::unique_ptr<IsoManager>(new IsoManager(pimpl_->iso_handler_, &pimpl_->iso_manager_impl));
63 }
64
65 } // namespace iso
66 } // namespace bluetooth