Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d1426566 authored by Jakub Tyszkowski's avatar Jakub Tyszkowski Committed by Automerger Merge Worker
Browse files

le_audio: Move audio set configurations to json file am: fa3e4cb6

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/1911879

Change-Id: I3ab9216b81d3fba9fc596c05b2410c2d6612beb2
parents 20af7dc9 fa3e4cb6
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ cc_defaults {
        "libbt-utils",
        "libbtdevice",
        "libcgrouprc",
        "libflatbuffers-cpp",
        "libhidlbase",
        "libbt-stack",
        "libg722codec",
+118 −2
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@ cc_library_static {
        "le_audio/client_parser.cc",
        "le_audio/client_audio.cc",
        "le_audio/le_audio_set_configuration_provider.cc",
        "le_audio/le_audio_set_configuration_provider_json.cc",
        "le_audio/le_audio_types.cc",
        "has/has_client.cc",
        "has/has_ctp.cc",
@@ -141,6 +142,7 @@ cc_library_static {
    ],
    static_libs: [
        "avrcp-target-service",
        "libflatbuffers-cpp",
        "lib-bt-packets",
        "libbt-platform-protos-lite",
    ],
@@ -156,6 +158,9 @@ cc_library_static {
            ],
        },
    },
    generated_headers: [
        "LeAudioSetConfigSchemas_h",
    ],
    host_supported: true,
}

@@ -189,6 +194,12 @@ cc_test {
        "libosi",
        "libbt-common",
    ],
    data: [
        ":audio_set_scenarios_bfbs",
        ":audio_set_scenarios_json",
        ":audio_set_configurations_bfbs",
        ":audio_set_configurations_json",
    ],
}

cc_test {
@@ -431,6 +442,78 @@ cc_test {
    },
}

genrule {
    name: "LeAudioSetConfigSchemas_h",
    tools: [
        "flatc",
    ],
    cmd: "$(location flatc) -I packages/modules/Bluetooth/system/ -o $(genDir) --cpp $(in) ",
    srcs: [
        "le_audio/audio_set_configurations.fbs",
        "le_audio/audio_set_scenarios.fbs",
    ],
    out: [
        "audio_set_configurations_generated.h",
        "audio_set_scenarios_generated.h",
    ],
}

genrule {
    name: "LeAudioSetScenariosSchema_bfbs",
    tools: [
        "flatc",
    ],
    cmd: "$(location flatc) -I packages/modules/Bluetooth/system/ -b --schema -o $(genDir) $(in) ",
    srcs: [
        "le_audio/audio_set_scenarios.fbs",
    ],
    out: [
        "audio_set_scenarios.bfbs",
    ],
}

genrule {
    name: "LeAudioSetConfigsSchema_bfbs",
    tools: [
        "flatc",
    ],
    cmd: "$(location flatc) -I packages/modules/Bluetooth/system/ -b --schema -o $(genDir) $(in) ",
    srcs: [
        "le_audio/audio_set_configurations.fbs",
    ],
    out: [
        "audio_set_configurations.bfbs",
    ],
}

prebuilt_etc {
    name: "audio_set_scenarios_bfbs",
    src: ":LeAudioSetScenariosSchema_bfbs",
    filename: "audio_set_scenarios.bfbs",
    sub_dir: "bluetooth/le_audio",
}

prebuilt_etc {
    name: "audio_set_scenarios_json",
    src: "le_audio/audio_set_scenarios.json",
    filename_from_src: true,
    sub_dir: "bluetooth/le_audio",
}

prebuilt_etc {
    name: "audio_set_configurations_bfbs",
    src: ":LeAudioSetConfigsSchema_bfbs",
    filename: "audio_set_configurations.bfbs",
    sub_dir: "bluetooth/le_audio",
}

prebuilt_etc {
    name: "audio_set_configurations_json",
    src: "le_audio/audio_set_configurations.json",
    filename_from_src: true,
    sub_dir: "bluetooth/le_audio",
}

// bta unit tests for LE Audio
// ========================================================
cc_test {
@@ -441,6 +524,19 @@ cc_test {
        "clang_coverage_bin",
    ],
    host_supported: true,
    target: {
        darwin: {
            enabled: false,
        },
        android: {
            cflags: [
                "-DOS_ANDROID",
            ],
            sanitize: {
                misc_undefined: ["bounds"],
            },
        },
    },
    include_dirs: [
        "packages/modules/Bluetooth/system",
        "packages/modules/Bluetooth/system/bta/include",
@@ -461,7 +557,7 @@ cc_test {
        "le_audio/client_parser_test.cc",
        "le_audio/devices.cc",
        "le_audio/devices_test.cc",
        "le_audio/le_audio_set_configuration_provider.cc",
        "le_audio/le_audio_set_configuration_provider_json.cc",
        "le_audio/le_audio_types.cc",
        "le_audio/le_audio_types_test.cc",
        "le_audio/mock_iso_manager.cc",
@@ -470,6 +566,15 @@ cc_test {
        "le_audio/state_machine_test.cc",
        "le_audio/mock_codec_manager.cc",
    ],
    data: [
        ":audio_set_scenarios_bfbs",
        ":audio_set_scenarios_json",
        ":audio_set_configurations_bfbs",
        ":audio_set_configurations_json"
    ],
    generated_headers: [
        "LeAudioSetConfigSchemas_h",
    ],
    shared_libs: [
        "libprotobuf-cpp-lite",
        "libcrypto",
@@ -479,6 +584,7 @@ cc_test {
        "libgmock",
        "libbt-common",
        "libbt-protos-lite",
        "libflatbuffers-cpp",
        "libosi",
    ],
    sanitize: {
@@ -509,7 +615,7 @@ cc_test {
        "le_audio/client_parser.cc",
        "le_audio/devices.cc",
        "le_audio/le_audio_client_test.cc",
        "le_audio/le_audio_set_configuration_provider.cc",
        "le_audio/le_audio_set_configuration_provider_json.cc",
        "le_audio/le_audio_types.cc",
        "le_audio/mock_iso_manager.cc",
        "le_audio/mock_le_audio_client_audio.cc",
@@ -536,10 +642,20 @@ cc_test {
        "libgmock",
        "libbt-common",
        "libbt-protos-lite",
        "libflatbuffers-cpp",
        "libosi",
        "liblc3codec",
        "liblc3",
    ],
    data: [
        ":audio_set_scenarios_bfbs",
        ":audio_set_scenarios_json",
        ":audio_set_configurations_bfbs",
        ":audio_set_configurations_json",
    ],
    generated_headers: [
        "LeAudioSetConfigSchemas_h",
    ],
    target: {
        android: {
            shared_libs: [
+73 −0
Original line number Diff line number Diff line
/*
 *  Copyright (c) 2022 The Android Open Source Project
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at:
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 */
namespace bluetooth.le_audio;
enum CodecSpecificLtvGenericTypes : byte {
    SUPPORTED_SAMPLING_FREQUENCY = 0x01,
    SUPPORTED_FRAME_DURATION = 0x02,
    SUPPORTED_AUDIO_CHANNEL_ALLOCATION = 0x03,
    SUPPORTED_OCTETS_PER_CODEC_FRAME = 0x04,
    SUPPORTED_CODEC_FRAME_BLOCKS_PER_SDU = 0x05,
}
/// Note: Holds either a single value (when `value_width == 0`) or multiple
///       values if `value.length()` is no-remainder divisible by the non-zero
///       `value_width`.
/// Note: Consider extending it with `flags` field, to hold additional info like
///       IsBitfield, IsRange, etc. if we need these type-specific validations.
table CompoundValue {
    value: [ubyte] (required);
    value_width: ubyte = 0;
}
table CodecSpecificConfiguration {
    name: string;
    type: ubyte (key);
    compound_value: CompoundValue;
}
struct CodecId {
    coding_format: ubyte;
    vendor_company_id : ushort;
    vendor_codec_id : ushort;
}
enum AudioSetConfigurationStrategy : byte {
    MONO_ONE_CIS_PER_DEVICE = 0x00,
    STEREO_TWO_CISES_PER_DEVICE = 0x01,
    STEREO_ONE_CIS_PER_DEVICE = 0x02,
}
enum AudioSetConfigurationDirection : byte {
    SINK = 0x01,
    SOURCE = 0x02,
}
table AudioSetSubConfiguration {
    device_cnt: ubyte;
    ase_cnt: ubyte;
    direction: AudioSetConfigurationDirection = SINK;
    configuration_strategy: AudioSetConfigurationStrategy;
    codec_id : CodecId (required);
    codec_configuration: [CodecSpecificConfiguration] (required);
}
/// Each set configration can contain multiple logical subconfigurations, which
/// all must be configurable with the current set of audio devices. For example,
/// one can define multiple output stream configurations with different
/// qualities, or assign different configurations to each stream direction.
table AudioSetConfiguration {
    name: string (key, required);
    subconfigurations: [AudioSetSubConfiguration] (required);
}
table AudioSetConfigurations {
    _comments_: [string];
    configurations: [AudioSetConfiguration] (required);
}
root_type AudioSetConfigurations;
+2118 −0

File added.

Preview size limit exceeded, changes collapsed.

+36 −0
Original line number Diff line number Diff line
/*
 *  Copyright (c) 2022 The Android Open Source Project
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at:
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 */
namespace bluetooth.le_audio;
/// Scenario represents the use case such as "Media", "Conversation", etc.
/// Each scenario can list any number of codec configurations by their names in
/// the order of preference. That means if the first entry does not meet all
/// the current requirements (such as peer device capabilities etc.) next
/// configurations are being checked.
///
/// The referenced codec configurations are defined by the
/// audio_set_configurations.fbs schema and loaded from a different source file.
/// Multiple scenarios can reference same codec configurations.
table AudioSetScenario {
    _comments_: [string];
    name: string (key, required);
    configurations: [string] (required);
}
table AudioSetScenarios {
    _comments_: [string];
    scenarios: [AudioSetScenario] (required);
}
root_type AudioSetScenarios;
Loading