C/C++ API Reference
Loading...
Searching...
No Matches
controller2.h
1// Copyright 2024 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
17#include "pw_async2/dispatcher.h"
18#include "pw_async2/once_sender.h"
19#include "pw_bluetooth/vendor.h"
20#include "pw_channel/channel.h"
21#include "pw_function/function.h"
22#include "pw_result/result.h"
23#include "pw_status/status.h"
24
25namespace pw::bluetooth {
26
28
34 : public pw::channel::Implement<pw::channel::ReliableDatagramReaderWriter> {
35 public:
37 enum class FeaturesBits : uint32_t {
41 kHciSco = (1 << 0),
43 kSetAclPriorityCommand = (1 << 1),
48 kAndroidVendorExtensions = (1 << 2),
50 };
51
52 enum class ScoCodingFormat : uint8_t {
53 kCvsd,
54 kMsbc,
55 };
56
57 enum class ScoEncoding : uint8_t {
58 k8Bits,
59 k16Bits,
60 };
61
62 enum class ScoSampleRate : uint8_t {
63 k8Khz,
64 k16Khz,
65 };
66
70
76
85 ScoCodingFormat coding_format,
86 ScoEncoding encoding,
87 ScoSampleRate sample_rate) = 0;
88
97
100
107 VendorCommandParameters parameters) = 0;
108};
109
110inline constexpr bool operator&(Controller2::FeaturesBits left,
112 return static_cast<bool>(
113 static_cast<std::underlying_type_t<Controller2::FeaturesBits>>(left) &
114 static_cast<std::underlying_type_t<Controller2::FeaturesBits>>(right));
115}
116
117inline constexpr Controller2::FeaturesBits operator|(
119 return static_cast<Controller2::FeaturesBits>(
120 static_cast<std::underlying_type_t<Controller2::FeaturesBits>>(left) |
121 static_cast<std::underlying_type_t<Controller2::FeaturesBits>>(right));
122}
123
124inline constexpr Controller2::FeaturesBits& operator|=(
126 return left = left | right;
127}
128
129} // namespace pw::bluetooth
Definition: context.h:55
Definition: once_sender.h:43
Definition: poll.h:60
Definition: controller2.h:34
Definition: channel.h:583
virtual async2::Poll< Status > PendError(async2::Context &cx)=0
virtual async2::OnceReceiver< Status > ResetSco()=0
virtual async2::OnceReceiver< FeaturesBits > GetFeatures()=0
virtual async2::OnceReceiver< Result< multibuf::MultiBuf > > EncodeVendorCommand(VendorCommandParameters parameters)=0
FeaturesBits
Bitmask of features the controller supports.
Definition: controller2.h:37
virtual async2::OnceReceiver< Status > ConfigureSco(ScoCodingFormat coding_format, ScoEncoding encoding, ScoSampleRate sample_rate)=0
virtual async2::OnceReceiver< Status > Initialize()=0
@ kSetAclPriorityCommand
Indicates support for the Set Acl Priority command.