1 /*
2  * Copyright 2020 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 "l2cap/classic/internal/fixed_channel_impl.h"
20 #include "l2cap/classic/internal/link.h"
21 #include "l2cap/classic/internal/link_manager.h"
22 #include "l2cap/internal/dynamic_channel_allocator.h"
23 #include "l2cap/internal/fixed_channel_allocator.h"
24 #include "l2cap_classic_module_generated.h"
25 
26 namespace bluetooth {
27 namespace l2cap {
28 namespace classic {
29 namespace internal {
30 
31 class DumpsysHelper {
32  public:
33   DumpsysHelper(const LinkManager& link_manager);
34 
35   std::vector<flatbuffers::Offset<ChannelData>> DumpActiveDynamicChannels(
36       flatbuffers::FlatBufferBuilder* fb_builder,
37       const l2cap::internal::DynamicChannelAllocator& channel_allocator) const;
38   std::vector<flatbuffers::Offset<ChannelData>> DumpActiveFixedChannels(
39       flatbuffers::FlatBufferBuilder* fb_builder,
40       const l2cap::internal::FixedChannelAllocator<FixedChannelImpl, Link>& channel_allocator) const;
41   std::vector<flatbuffers::Offset<LinkData>> DumpActiveLinks(flatbuffers::FlatBufferBuilder* fb_builder) const;
42 
43  private:
44   const LinkManager& link_manager_;
45 };
46 
47 }  // namespace internal
48 }  // namespace classic
49 }  // namespace l2cap
50 }  // namespace bluetooth
51