aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-14 14:02:23 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-14 14:02:23 +0000
commitee1c6f047782bf9bce248db6a3c89dad928ecfa8 (patch)
tree665e59b2910e6813d66df6767ec00abd0a9a81bf
parent42d9f064a50384a5f2ced913d62fd2aacb1c7db9 (diff)
parent726e70b5985b779ca95213a9669977fe121c6626 (diff)
downloadbt-test-interfaces-ee1c6f047782bf9bce248db6a3c89dad928ecfa8.tar.gz
Snap for 10497676 from 726e70b5985b779ca95213a9669977fe121c6626 to mainline-art-releaseaml_art_341110110aml_art_341110060aml_art_341010050aml_art_340915060
Change-Id: I72607c2fec82ecba794f8d75a78948179566b6bb
-rw-r--r--.github/workflows/python-publish.yml38
-rw-r--r--.gitignore1
-rw-r--r--Android.bp1
-rw-r--r--README.md4
-rw-r--r--pandora/a2dp.proto85
-rw-r--r--python/Android.bp5
-rw-r--r--python/pandora/__init__.py2
-rw-r--r--python/pyproject.toml12
8 files changed, 116 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 }}
diff --git a/.gitignore b/.gitignore
index 9a071b7..5782913 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
__pycache__
+python/dist
python/pandora/*
!python/pandora/__init__.py
!python/pandora/py.typed
diff --git a/Android.bp b/Android.bp
index 13e9591..aa2f627 100644
--- a/Android.bp
+++ b/Android.bp
@@ -69,6 +69,7 @@ java_library {
filegroup {
name: "pandora-protos",
srcs: [
+ "pandora/a2dp.proto",
"pandora/host.proto",
"pandora/security.proto",
],
diff --git a/README.md b/README.md
index 6d37cb8..e974ce7 100644
--- a/README.md
+++ b/README.md
@@ -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/Android.bp b/python/Android.bp
index 25e8b29..21e3dd0 100644
--- a/python/Android.bp
+++ b/python/Android.bp
@@ -41,6 +41,10 @@ genrule {
"pandora/py.typed",
"pandora/__init__.py",
"pandora/_utils.py",
+ "pandora/a2dp_grpc.py",
+ "pandora/a2dp_grpc_aio.py",
+ "pandora/a2dp_pb2.py",
+ "pandora/a2dp_pb2.pyi",
"pandora/host_grpc.py",
"pandora/host_grpc_aio.py",
"pandora/host_pb2.py",
@@ -66,6 +70,7 @@ filegroup {
name: "pandora-python-stubs",
srcs: [
":pandora-python-gen-src{pandora/py.typed}",
+ ":pandora-python-gen-src{pandora/a2dp_pb2.pyi}",
":pandora-python-gen-src{pandora/host_pb2.pyi}",
":pandora-python-gen-src{pandora/security_pb2.pyi}",
],
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 = ["."]