1/*
2 *  Copyright (c) 2022 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 */
17namespace aidl.android.hardware.bluetooth.audio.le_audio;
18enum CodecSpecificLtvGenericTypes : byte {
19    SUPPORTED_SAMPLING_FREQUENCY = 0x01,
20    SUPPORTED_FRAME_DURATION = 0x02,
21    SUPPORTED_AUDIO_CHANNEL_ALLOCATION = 0x03,
22    SUPPORTED_OCTETS_PER_CODEC_FRAME = 0x04,
23    SUPPORTED_CODEC_FRAME_BLOCKS_PER_SDU = 0x05,
24}
25/// Note: Holds either a single value (when `value_width == 0`) or multiple
26///       values if `value.length()` is no-remainder divisible by the non-zero
27///       `value_width`.
28/// Note: Consider extending it with `flags` field, to hold additional info like
29///       IsBitfield, IsRange, etc. if we need these type-specific validations.
30table CompoundValue {
31    value: [ubyte] (required);
32    value_width: ubyte = 0;
33}
34table CodecSpecificConfiguration {
35    name: string;
36    type: ubyte (key);
37    compound_value: CompoundValue;
38}
39struct CodecId {
40    coding_format: ubyte;
41    vendor_company_id : ushort;
42    vendor_codec_id : ushort;
43}
44enum AudioSetConfigurationStrategy : byte {
45    MONO_ONE_CIS_PER_DEVICE = 0x00,
46    STEREO_TWO_CISES_PER_DEVICE = 0x01,
47    STEREO_ONE_CIS_PER_DEVICE = 0x02,
48}
49enum AudioSetConfigurationDirection : byte {
50    SINK = 0x01,
51    SOURCE = 0x02,
52}
53enum AudioSetConfigurationTargetLatency : byte {
54    LOW = 0x01,
55    BALANCED_RELIABILITY = 0x02,
56    HIGH_RELIABILITY = 0x03,
57}
58table AudioSetSubConfiguration {
59    device_cnt: ubyte;
60    ase_cnt: ubyte;
61    direction: AudioSetConfigurationDirection = SINK;
62    configuration_strategy: AudioSetConfigurationStrategy;
63    codec_id : CodecId (required);
64    codec_configuration: [CodecSpecificConfiguration] (required);
65}
66table CodecConfiguration {
67    name: string (key, required);
68    subconfigurations: [AudioSetSubConfiguration] (required);
69}
70table QosConfiguration {
71    name: string (key, required);
72    target_latency: AudioSetConfigurationTargetLatency = BALANCED_RELIABILITY;
73    retransmission_number: ubyte;
74    max_transport_latency : ushort;
75}
76/// Each set configration can contain multiple logical subconfigurations, which
77/// all must be configurable with the current set of audio devices. For example,
78/// one can define multiple output stream configurations with different
79/// qualities, or assign different configurations to each stream direction.
80table AudioSetConfiguration {
81    name: string (key, required);
82    codec_config_name: string (required);
83    qos_config_name: [string] (required);
84}
85table AudioSetConfigurations {
86    _comments_: [string];
87    configurations: [AudioSetConfiguration] (required);
88    codec_configurations: [CodecConfiguration] (required);
89    qos_configurations: [QosConfiguration] (required);
90}
91root_type AudioSetConfigurations;
92