xref: /aosp_15_r20/external/pigweed/pw_bluetooth_sapphire/host/gap/peer_metrics.cc (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1 
2 // Copyright 2023 The Pigweed Authors
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 // use this file except in compliance with the License. You may obtain a copy of
6 // the License at
7 //
8 //     https://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, WITHOUT
12 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 // License for the specific language governing permissions and limitations under
14 // the License.
15 
16 #include "pw_bluetooth_sapphire/internal/host/gap/peer_metrics.h"
17 
18 namespace bt::gap {
19 
AttachInspect(inspect::Node & parent)20 void PeerMetrics::AttachInspect(inspect::Node& parent) {
21   metrics_node_ = parent.CreateChild(kInspectNodeName);
22 
23   metrics_le_node_ = metrics_node_.CreateChild("le");
24   le_bond_success_.AttachInspect(metrics_le_node_, "bond_success_events");
25   le_bond_failure_.AttachInspect(metrics_le_node_, "bond_failure_events");
26   le_connections_.AttachInspect(metrics_le_node_, "connection_events");
27   le_disconnections_.AttachInspect(metrics_le_node_, "disconnection_events");
28 
29   metrics_bredr_node_ = metrics_node_.CreateChild("bredr");
30   bredr_bond_success_.AttachInspect(metrics_bredr_node_, "bond_success_events");
31   bredr_bond_failure_.AttachInspect(metrics_bredr_node_, "bond_failure_events");
32   bredr_connections_.AttachInspect(metrics_bredr_node_, "connection_events");
33   bredr_disconnections_.AttachInspect(metrics_bredr_node_,
34                                       "disconnection_events");
35 }
36 
37 }  // namespace bt::gap
38