diff options
author | Charlie Boutier <charliebout@google.com> | 2023-07-13 00:57:52 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2023-07-13 00:57:52 +0000 |
commit | 5e54d6cd54f64cb19afd4ce90b658a18be06d7fb (patch) | |
tree | 220cb6b4fbf5940ab96d2d490a8892c308e0a332 | |
parent | 1a6ebe24537e0cf755f2f5ecad3dc3149af41f07 (diff) | |
parent | c95eb3212151f926833b2a189aed8fe49cfb790e (diff) | |
download | bt-test-interfaces-5e54d6cd54f64cb19afd4ce90b658a18be06d7fb.tar.gz |
Merge remote-tracking branch 'aosp/upstream-main' into HEAD am: c95eb32121
Original change: https://android-review.googlesource.com/c/platform/external/pandora/bt-test-interfaces/+/2652629
Change-Id: I15601cc9bd0672964a3fe0d63f181164dd4c69bb
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r-- | .github/workflows/python-publish.yml | 38 | ||||
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | README.md | 4 | ||||
-rw-r--r-- | pandora/a2dp.proto | 85 | ||||
-rw-r--r-- | python/pandora/__init__.py | 2 | ||||
-rw-r--r-- | python/pyproject.toml | 12 |
6 files changed, 110 insertions, 32 deletions
diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..0f4bbfd --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,38 @@ +name: Upload Python Package + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + deploy: + name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI + runs-on: ubuntu-latest + + steps: + - name: Check out from Git + uses: actions/checkout@v3 + - name: Get history and tags for SCM versioning to work + run: | + git fetch --prune --unshallow + git fetch --depth=1 origin +refs/tags/*:refs/tags/* + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.10' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install build + - name: Build package + run: python -m build python/ + - name: Publish package to PyPI + if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: python/dist/ + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} @@ -1,4 +1,5 @@ __pycache__ +python/dist python/pandora/* !python/pandora/__init__.py !python/pandora/py.typed @@ -9,5 +9,5 @@ A test interface is defined for each Bluetooth profile. ## Supported profiles -* **Host**: interfaces for general methods (pairing, connection...). -* **A2DP**: Advanced Audio Distribution Profile. +* **Host**: Interface for general methods (reset, connection, advertise...). +* **Security**: Interface to trigger Bluetooth Host security pairing procedures. diff --git a/pandora/a2dp.proto b/pandora/a2dp.proto index a2f641e..d262d1b 100644 --- a/pandora/a2dp.proto +++ b/pandora/a2dp.proto @@ -14,15 +14,17 @@ syntax = "proto3"; -option java_outer_classname = "A2dpProto"; - package pandora; import "pandora/host.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/wrappers.proto"; + +option java_outer_classname = "A2DPProto"; // Service to trigger A2DP (Advanced Audio Distribution Profile) procedures. // -// Requirements for the implementor: +// Requirements for the implementer: // - Streams must not be automatically opened, even if discovered. // - The `Host` service must be implemented // @@ -69,17 +71,25 @@ service A2DP { // return it. The server must return the same sink only once. rpc WaitSink(WaitSinkRequest) returns (WaitSinkResponse); // Get if the stream is suspended - rpc IsSuspended(IsSuspendedRequest) returns (IsSuspendedResponse); - // Start a suspended stream. + rpc IsSuspended(IsSuspendedRequest) returns (google.protobuf.BoolValue); + // Start an opened stream. + // + // The rpc must block until the stream has reached the + // AVDTP_STREAMING state (see [AVDTP] 9.1). rpc Start(StartRequest) returns (StartResponse); - // Suspend a started stream. + // Suspend a streaming stream. + // + // The rpc must block until the stream has reached the AVDTP_OPEN + // state (see [AVDTP] 9.1). rpc Suspend(SuspendRequest) returns (SuspendResponse); // Close a stream, the source or sink tokens must not be reused afterwards. rpc Close(CloseRequest) returns (CloseResponse); // Get the `AudioEncoding` value of a stream - rpc GetAudioEncoding(GetAudioEncodingRequest) returns (GetAudioEncodingResponse); + rpc GetAudioEncoding(GetAudioEncodingRequest) + returns (GetAudioEncodingResponse); // Playback audio by a `Source` - rpc PlaybackAudio(stream PlaybackAudioRequest) returns (PlaybackAudioResponse); + rpc PlaybackAudio(stream PlaybackAudioRequest) + returns (PlaybackAudioResponse); // Capture audio from a `Sink` rpc CaptureAudio(CaptureAudioRequest) returns (stream CaptureAudioResponse); } @@ -99,7 +109,7 @@ enum AudioEncoding { message Source { // Opaque value filled by the GRPC server, must not // be modified nor crafted. - Connection connection = 1; + bytes cookie = 1; } // A Token representing a Sink stream (see [A2DP] 2.2). @@ -107,7 +117,7 @@ message Source { message Sink { // Opaque value filled by the GRPC server, must not // be modified nor crafted. - Connection connection = 1; + bytes cookie = 1; } // Request for the `OpenSource` method. @@ -118,10 +128,12 @@ message OpenSourceRequest { // Response for the `OpenSource` method. message OpenSourceResponse { - // Result of the `OpenSource` call: - // - If successful: a Source + // Result of the `OpenSource` call. oneof result { + // Opened stream. Source source = 1; + // The Connection disconnected. + google.protobuf.Empty disconnected = 2; } } @@ -133,10 +145,12 @@ message OpenSinkRequest { // Response for the `OpenSink` method. message OpenSinkResponse { - // Result of the `OpenSink` call: - // - If successful: a Sink + // Result of the `OpenSink` call. oneof result { + // Opened stream. Sink sink = 1; + // The Connection disconnected. + google.protobuf.Empty disconnected = 2; } } @@ -148,10 +162,12 @@ message WaitSourceRequest { // Response for the `WaitSource` method. message WaitSourceResponse { - // Result of the `WaitSource` call: - // - If successful: a Source + // Result of the `WaitSource` call. oneof result { + // Awaited stream. Source source = 1; + // The Connection disconnected. + google.protobuf.Empty disconnected = 2; } } @@ -163,10 +179,12 @@ message WaitSinkRequest { // Response for the `WaitSink` method. message WaitSinkResponse { - // Result of the `WaitSink` call: - // - If successful: a Sink + // Result of the `WaitSink` call. oneof result { + // Awaited stream. Sink sink = 1; + // The Connection disconnected. + google.protobuf.Empty disconnected = 2; } } @@ -179,11 +197,6 @@ message IsSuspendedRequest { } } -// Response for the `IsSuspended` method. -message IsSuspendedResponse { - bool is_suspended = 1; -} - // Request for the `Start` method. message StartRequest { // Target of the start, either a Sink or a Source. @@ -194,7 +207,17 @@ message StartRequest { } // Response for the `Start` method. -message StartResponse {} +message StartResponse { + // Result of the `Start` call. + oneof result { + // Stream successfully started. + google.protobuf.Empty started = 1; + // Stream is already in AVDTP_STREAMING state. + google.protobuf.Empty already_started = 2; + // The Connection disconnected. + google.protobuf.Empty disconnected = 3; + } +} // Request for the `Suspend` method. message SuspendRequest { @@ -206,7 +229,17 @@ message SuspendRequest { } // Response for the `Suspend` method. -message SuspendResponse {} +message SuspendResponse { + // Result of the `Suspend` call. + oneof result { + // Stream successfully suspended. + google.protobuf.Empty suspended = 1; + // Stream is already in AVDTP_OPEN state. + google.protobuf.Empty already_suspended = 2; + // The Connection disconnected. + google.protobuf.Empty disconnected = 3; + } +} // Request for the `Close` method. message CloseRequest { @@ -258,6 +291,6 @@ message CaptureAudioRequest { message CaptureAudioResponse { // Captured audio data. // The audio data is encoded in the specified `AudioEncoding` value - // obained in response of a `GetAudioEncoding` method call. + // obtained in response of a `GetAudioEncoding` method call. bytes data = 1; } diff --git a/python/pandora/__init__.py b/python/pandora/__init__.py index f8a96ae..bc983a5 100644 --- a/python/pandora/__init__.py +++ b/python/pandora/__init__.py @@ -14,4 +14,4 @@ """Pandora gRPC Bluetooth test interfaces.""" -__version__ = "0.0.1" +__version__ = "0.0.3" diff --git a/python/pyproject.toml b/python/pyproject.toml index 0e42956..6b4a236 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -3,15 +3,21 @@ name = "bt-test-interfaces" readme = "../README.md" authors = [{name = "Pandora", email = "pandora-core@google.com"}] dynamic = ["version", "description"] -dependencies = ["protobuf==4.22.0"] +classifiers = [ + "License :: OSI Approved :: Apache Software License" +] +dependencies = ["protobuf>=4.22.0"] + +[project.urls] +Source = "https://github.com/google/bt-test-interfaces" [tool.flit.module] name = "pandora" [tool.flit.sdist] -include = ["_build"] +include = ["_build", ".."] [build-system] -requires = ["flit_core==3.7.1", "grpcio-tools==1.51.1"] +requires = ["flit_core==3.7.1", "grpcio-tools>=1.51.1"] build-backend = "_build.backend" backend-path = ["."] |