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 bluetooth.fbs.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    ase_channel_cnt: ubyte;
60    ase_cnt: ubyte;
61    direction: AudioSetConfigurationDirection = SINK;
62    codec_id : CodecId (required);
63    codec_configuration: [CodecSpecificConfiguration] (required);
64}
65table CodecConfiguration {
66    name: string (key, required);
67    subconfigurations: [AudioSetSubConfiguration] (required);
68}
69table QosConfiguration {
70    name: string (key, required);
71    target_latency: AudioSetConfigurationTargetLatency = BALANCED_RELIABILITY;
72    retransmission_number: ubyte;
73    max_transport_latency : ushort;
74}
75/// Each set configration can contain multiple logical subconfigurations, which
76/// all must be configurable with the current set of audio devices. For example,
77/// one can define multiple output stream configurations with different
78/// qualities, or assign different configurations to each stream direction.
79table AudioSetConfiguration {
80    name: string (key, required);
81    codec_config_name: string (required);
82    qos_config_name: [string] (required);
83}
84table AudioSetConfigurations {
85    _comments_: [string];
86    configurations: [AudioSetConfiguration] (required);
87    codec_configurations: [CodecConfiguration] (required);
88    qos_configurations: [QosConfiguration] (required);
89}
90root_type AudioSetConfigurations;
91