• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2023 The Pigweed Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 // use this file except in compliance with the License. You may obtain a copy of
5 // the License at
6 //
7 //     https://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 // License for the specific language governing permissions and limitations under
13 // the License.
14 
15 #pragma once
16 #include <cstdint>
17 
18 #include "pw_bluetooth_sapphire/internal/host/transport/acl_data_channel.h"
19 
20 namespace bt::gap {
21 
22 // Stores Bluetooth Low Energy settings and state information.
23 class LowEnergyState final {
24  public:
25   // Returns true if |feature_bit| is set as supported in the local LE features
26   // list.
IsFeatureSupported(hci_spec::LESupportedFeature feature_bit)27   inline bool IsFeatureSupported(
28       hci_spec::LESupportedFeature feature_bit) const {
29     return supported_features_ & static_cast<uint64_t>(feature_bit);
30   }
31 
supported_features()32   uint64_t supported_features() const { return supported_features_; }
33 
34   // Returns the LE ACL data buffer capacity.
acl_data_buffer_info()35   const hci::DataBufferInfo& acl_data_buffer_info() const {
36     return acl_data_buffer_info_;
37   }
38 
39   // Returns the ISO data buffer capacity.
iso_data_buffer_info()40   const hci::DataBufferInfo& iso_data_buffer_info() const {
41     return iso_data_buffer_info_;
42   }
43 
44  private:
45   friend class Adapter;
46   friend class AdapterImpl;
47 
48   // Storage capacity information about the controller's internal ACL data
49   // buffers.
50   hci::DataBufferInfo acl_data_buffer_info_;
51 
52   // Storage capacity information about the controller's internal ISO data
53   // buffers.
54   hci::DataBufferInfo iso_data_buffer_info_;
55 
56   // Local supported LE Features reported by the controller.
57   uint64_t supported_features_ = 0;
58 
59   // Local supported LE states reported by the controller.
60   uint64_t supported_states_ = 0;
61 };
62 
63 }  // namespace bt::gap
64