1 /*
2 *
3 * Copyright 2020 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 */
18 #include "iso_manager.h"
19
20 #include "os/log.h"
21
22 namespace bluetooth {
23 namespace iso {
24
RegisterIsoEstablishedCallback(CisEstablishedCallback cb)25 void IsoManager::RegisterIsoEstablishedCallback(CisEstablishedCallback cb) {
26 iso_handler_->CallOn(iso_manager_impl_, &internal::IsoManagerImpl::RegisterIsoEstablishedCallback, cb);
27 }
28
RegisterIsoDataCallback(IsoDataCallback cb)29 void IsoManager::RegisterIsoDataCallback(IsoDataCallback cb) {
30 iso_handler_->CallOn(iso_manager_impl_, &internal::IsoManagerImpl::RegisterIsoDataCallback, cb);
31 }
32
SetCigParameters(uint8_t cig_id,uint32_t sdu_interval_m_to_s,uint32_t sdu_interval_s_to_m,hci::ClockAccuracy peripherals_clock_accuracy,hci::Packing packing,hci::Enable framing,uint16_t max_transport_latency_m_to_s,uint16_t max_transport_latency_s_to_m,std::vector<hci::CisParametersConfig> cis_config,SetCigParametersCallback command_complete_callback)33 void IsoManager::SetCigParameters(
34 uint8_t cig_id,
35 uint32_t sdu_interval_m_to_s,
36 uint32_t sdu_interval_s_to_m,
37 hci::ClockAccuracy peripherals_clock_accuracy,
38 hci::Packing packing,
39 hci::Enable framing,
40 uint16_t max_transport_latency_m_to_s,
41 uint16_t max_transport_latency_s_to_m,
42 std::vector<hci::CisParametersConfig> cis_config,
43 SetCigParametersCallback command_complete_callback) {
44 iso_handler_->CallOn(
45 iso_manager_impl_,
46 &internal::IsoManagerImpl::SetCigParameters,
47 cig_id,
48 sdu_interval_m_to_s,
49 sdu_interval_s_to_m,
50 peripherals_clock_accuracy,
51 packing,
52 framing,
53 max_transport_latency_m_to_s,
54 max_transport_latency_s_to_m,
55 cis_config,
56 std::move(command_complete_callback));
57 }
58
SetCigParametersTest(uint8_t cig_id,uint32_t sdu_interval_m_to_s,uint32_t sdu_interval_s_to_m,uint8_t ft_m_to_s,uint8_t ft_s_to_m,uint16_t iso_interval,hci::ClockAccuracy peripherals_clock_accuracy,hci::Packing packing,hci::Enable framing,uint16_t max_transport_latency_m_to_s,uint16_t max_transport_latency_s_to_m,std::vector<hci::LeCisParametersTestConfig> cis_config,SetCigParametersCallback command_complete_callback)59 void IsoManager::SetCigParametersTest(
60 uint8_t cig_id,
61 uint32_t sdu_interval_m_to_s,
62 uint32_t sdu_interval_s_to_m,
63 uint8_t ft_m_to_s,
64 uint8_t ft_s_to_m,
65 uint16_t iso_interval,
66 hci::ClockAccuracy peripherals_clock_accuracy,
67 hci::Packing packing,
68 hci::Enable framing,
69 uint16_t max_transport_latency_m_to_s,
70 uint16_t max_transport_latency_s_to_m,
71 std::vector<hci::LeCisParametersTestConfig> cis_config,
72 SetCigParametersCallback command_complete_callback) {
73 iso_handler_->CallOn(
74 iso_manager_impl_,
75 &internal::IsoManagerImpl::SetCigParametersTest,
76 cig_id,
77 sdu_interval_m_to_s,
78 sdu_interval_s_to_m,
79 ft_m_to_s,
80 ft_s_to_m,
81 iso_interval,
82 peripherals_clock_accuracy,
83 packing,
84 framing,
85 max_transport_latency_m_to_s,
86 max_transport_latency_s_to_m,
87 cis_config,
88 std::move(command_complete_callback));
89 }
90
LeCreateCis(std::vector<std::pair<uint16_t,uint16_t>> cis_and_acl_handles)91 void IsoManager::LeCreateCis(std::vector<std::pair<uint16_t, uint16_t>> cis_and_acl_handles) {
92 iso_handler_->CallOn(iso_manager_impl_, &internal::IsoManagerImpl::LeCreateCis, cis_and_acl_handles);
93 }
94
RemoveCig(uint8_t cig_id)95 void IsoManager::RemoveCig(uint8_t cig_id) {
96 iso_handler_->CallOn(iso_manager_impl_, &internal::IsoManagerImpl::RemoveCig, cig_id);
97 }
98
SendIsoPacket(uint16_t cis_handle,std::vector<uint8_t> packet)99 void IsoManager::SendIsoPacket(uint16_t cis_handle, std::vector<uint8_t> packet) {
100 iso_handler_->CallOn(iso_manager_impl_, &internal::IsoManagerImpl::SendIsoPacket, cis_handle, packet);
101 }
102
103 } // namespace iso
104 } // namespace bluetooth
105