From 62dec0f0e53869a011b1064df92b29965f04782b Mon Sep 17 00:00:00 2001 From: Charlie Boutier Date: Mon, 25 Apr 2022 08:18:13 +0000 Subject: Pandora: Rename Blueberry to Pandora Add bt-test-interfaces as submodules. Change-Id: I80454669d4cdd722d5faa65792ae3a36c15a289b --- .gitignore | 5 +- .gitmodules | 3 + blueberry/__init__.py | 0 mmi2grpc/__init__.py | 4 +- mmi2grpc/_description.py | 2 +- mmi2grpc/a2dp.py | 8 +- pandora/__init__.py | 0 proto | 1 + proto/blueberry/a2dp.proto | 237 --------------------------------------------- proto/blueberry/host.proto | 101 ------------------- setup.py | 4 +- 11 files changed, 15 insertions(+), 350 deletions(-) create mode 100644 .gitmodules delete mode 100644 blueberry/__init__.py create mode 100644 pandora/__init__.py create mode 160000 proto delete mode 100644 proto/blueberry/a2dp.proto delete mode 100644 proto/blueberry/host.proto diff --git a/.gitignore b/.gitignore index 14ca2c8..54b52ce 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ -virtualenv out/ build __pycache__ -blueberry/* -!blueberry/__init__.py +pandora/* +!pandora/__init__.py .eggs/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..f054688 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "bt-test-interfaces"] + path = proto + url = sso://pandora/bt-test-interfaces diff --git a/blueberry/__init__.py b/blueberry/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/mmi2grpc/__init__.py b/mmi2grpc/__init__.py index d710702..e127348 100644 --- a/mmi2grpc/__init__.py +++ b/mmi2grpc/__init__.py @@ -3,7 +3,7 @@ import grpc import time import sys -from blueberry.host_grpc import Host +from pandora.host_grpc import Host from .a2dp import A2DPProxy from ._description import format_proxy @@ -62,7 +62,7 @@ class IUT: f'Missing {profile} proxy and mmi: {interaction}\n' f'Create a {profile.lower()}.py in mmi2grpc/:\n\n{code}\n' f'Then, instantiate the corresponding proxy in __init__.py\n' - f'Finally, create a {profile.lower()}.proto in proto/blueberry/' + f'Finally, create a {profile.lower()}.proto in proto/pandora/' f'and generate the corresponding interface.' ) assert False, error_msg diff --git a/mmi2grpc/_description.py b/mmi2grpc/_description.py index 0a3c574..c292720 100644 --- a/mmi2grpc/_description.py +++ b/mmi2grpc/_description.py @@ -47,7 +47,7 @@ def format_proxy(profile, id, description): f'from ._description import assert_description\n' f'from ._proxy import ProfileProxy\n' f'\n' - f'from blueberry.{profile.lower()}_grpc import {profile}\n' + f'from pandora.{profile.lower()}_grpc import {profile}\n' f'\n' f'\n' f'class {profile}Proxy(ProfileProxy):\n' diff --git a/mmi2grpc/a2dp.py b/mmi2grpc/a2dp.py index 34f187c..7e51c68 100644 --- a/mmi2grpc/a2dp.py +++ b/mmi2grpc/a2dp.py @@ -1,11 +1,11 @@ import time from typing import Optional -from blueberry.a2dp_grpc import A2DP -from blueberry.host_grpc import Host +from pandora.a2dp_grpc import A2DP +from pandora.host_grpc import Host -from blueberry.a2dp_pb2 import Sink, Source, PlaybackAudioRequest -from blueberry.host_pb2 import Connection +from pandora.a2dp_pb2 import Sink, Source, PlaybackAudioRequest +from pandora.host_pb2 import Connection from ._audio import AudioSignal from ._description import assert_description diff --git a/pandora/__init__.py b/pandora/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/proto b/proto new file mode 160000 index 0000000..05cd39c --- /dev/null +++ b/proto @@ -0,0 +1 @@ +Subproject commit 05cd39cf98b3fdc14699316c69cdaf8e496ee066 diff --git a/proto/blueberry/a2dp.proto b/proto/blueberry/a2dp.proto deleted file mode 100644 index a5e1b1a..0000000 --- a/proto/blueberry/a2dp.proto +++ /dev/null @@ -1,237 +0,0 @@ -syntax = "proto3"; - -package blueberry; - -import "blueberry/host.proto"; -import "google/protobuf/wrappers.proto"; - -// Service to trigger A2DP (Advanced Audio Distribution Profile) procedures. -// -// Requirement for the implementor: -// - Streams must not be automaticaly opened, even if discovered. -// - The `Host` service should be implemented -// -// References: -// - [A2DP] Bluetooth SIG, Specification of the Bluetooth System, -// Advanced Audio Distribution, Version 1.3 or Later -// - [AVDTP] Bluetooth SIG, Specification of the Bluetooth System, -// Audio/Video Distribution Transport Protocol, Version 1.3 or Later -service A2DP { - // Open a stream from a local **Source** endpoint to a remote **Sink** - // endpoint. - // - // The returned source should be in the AVDTP_OPEN state (see [AVDTP] 9.1). - // The function must block until the stream has reached this state - // - // A cancellation of this call must result in aborting the current - // AVDTP procedure (see [AVDTP] 9.9) - rpc OpenSource(OpenSourceRequest) returns (OpenSourceResponse); - // Open a stream from a local **Sink** endpoint to a remote **Source** - // endpoint. - // - // The returned sink must be in the AVDTP_OPEN state (see [AVDTP] 9.1). - // The function must block until the stream has reached this state - // - // A cancellation of this call must result in aborting the current - // AVDTP procedure (see [AVDTP] 9.9) - rpc OpenSink(OpenSinkRequest) returns (OpenSinkResponse); - // Wait for a stream from a local **Source** endpoint to - // a remote **Sink** endpoint to open. - // - // If the peer has opened a source prior to this call, the server will - // return it. The server must return the same source only once. - rpc WaitSource(WaitSourceRequest) returns (WaitSourceResponse); - // Wait for a stream from a local **Sink** endpoint to - // a remote **Source** endpoint to open. - // - // If the peer has opened a sink prior to this call, the server will - // 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 (google.protobuf.BoolValue); - // Start a suspended stream. - rpc Start(StartRequest) returns (StartResponse); - // Suspend a started stream. - 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); - // Playback audio by a `Source` - rpc PlaybackAudio(stream PlaybackAudioRequest) returns (PlaybackAudioResponse); - // Capture audio from a `Sink` - rpc CaptureAudio(CaptureAudioRequest)returns (stream CaptureAudioResponse); -} - -// Audio encoding formats. -enum AudioEncoding { - // Interleaved stereo frames with 16-bit signed little-endian linear PCM - // samples at 44100Hz sample rate - PCM_S16_LE_44K1_STEREO = 0; - // Interleaved stereo frames with 16-bit signed little-endian linear PCM - // samples at 48000Hz sample rate - PCM_S16_LE_48K_STEREO = 1; -} - -// A Token representing a Source stream (see [A2DP] 2.2). -// It's acquired via an OpenSource on the A2DP service. -message Source { - // Opaque value filled by the GRPC server, must not - // be modified nor crafted. - bytes cookie = 1; -} - -// A Token representing a Sink stream (see [A2DP] 2.2). -// It's acquired via an OpenSink on the A2DP service. -message Sink { - // Opaque value filled by the GRPC server, must not - // be modified nor crafted. - bytes cookie = 1; -} - -// Request for the `OpenSource` method. -message OpenSourceRequest { - // The connection that will open the stream. - Connection connection = 1; -} - -// Response for the `OpenSource` method. -message OpenSourceResponse { - // Result of the `OpenSource` call: - // - If successfull: a Source - oneof result { - Source source = 1; - } -} - -// Request for the `OpenSink` method. -message OpenSinkRequest { - // The connection that will open the stream. - Connection connection = 1; -} - -// Response for the `OpenSink` method. -message OpenSinkResponse { - // Result of the `OpenSink` call: - // - If successfull: a Sink - oneof result { - Sink sink = 1; - } -} - -// Request for the `WaitSource` method. -message WaitSourceRequest { - // The connection that is awaiting the stream. - Connection connection = 1; -} - -// Response for the `WaitSource` method. -message WaitSourceResponse { - // Result of the `WaitSource` call: - // - If successfull: a Source - oneof result { - Source source = 1; - } -} - -// Request for the `WaitSink` method. -message WaitSinkRequest { - // The connection that is awaiting the stream. - Connection connection = 1; -} - -// Response for the `WaitSink` method. -message WaitSinkResponse { - // Result of the `WaitSink` call: - // - If successfull: a Sink - oneof result { - Sink sink = 1; - } -} - -// Request for the `IsSuspended` method. -message IsSuspendedRequest { - // The stream on which the function will check if it's suspended - oneof target { - Sink sink = 1; - Source source = 2; - } -} - -// Request for the `Start` method. -message StartRequest { - // Target of the start, either a Sink or a Source. - oneof target { - Sink sink = 1; - Source source = 2; - } -} - -// Response for the `Start` method. -message StartResponse {} - -// Request for the `Suspend` method. -message SuspendRequest { - // Target of the suspend, either a Sink or a Source. - oneof target { - Sink sink = 1; - Source source = 2; - } -} - -// Response for the `Suspend` method. -message SuspendResponse {} - -// Request for the `Close` method. -message CloseRequest { - // Target of the close, either a Sink or a Source. - oneof target { - Sink sink = 1; - Source source = 2; - } -} - -// Response for the `Close` method. -message CloseResponse {} - -// Request for the `GetAudioEncoding` method. -message GetAudioEncodingRequest { - // The stream on which the function will read the `AudioEncoding`. - oneof target { - Sink sink = 1; - Source source = 2; - } -} - -// Response for the `GetAudioEncoding` method. -message GetAudioEncodingResponse { - // Audio encoding of the stream. - AudioEncoding encoding = 1; -} - -// Request for the `PlaybackAudio` method. -message PlaybackAudioRequest { - // Source that will playback audio. - Source source = 1; - // Audio data to playback. - // The audio data must be encoded in the specified `AudioEncoding` value - // obtained in response of a `GetAudioEncoding` method call. - bytes data = 2; -} - -// Response for the `PlaybackAudio` method. -message PlaybackAudioResponse {} - -// Request for the `CaptureAudio` method. -message CaptureAudioRequest { - // Sink that will capture audio - Sink sink = 1; -} - -// Response for the `CaptureAudio` method. -message CaptureAudioResponse { - // Captured audio data. - // The audio data is encoded in the specified `AudioEncoding` value - // obained in response of a `GetAudioEncoding` method call. - bytes data = 1; -} diff --git a/proto/blueberry/host.proto b/proto/blueberry/host.proto deleted file mode 100644 index bf80ab9..0000000 --- a/proto/blueberry/host.proto +++ /dev/null @@ -1,101 +0,0 @@ -syntax = "proto3"; - -package blueberry; - -import "google/protobuf/empty.proto"; - -// Service to trigger Bluetooth Host procedures -// -// At startup, the Host must be in BR/EDR connectable mode -// (see GAP connectability modes) -service Host { - // Reset the host. - // **After** responding to this command, the GRPC server should loose - // all its state. - // This is comparable to a process restart or an hardware reset. - // The GRPC server might take some time to be available after - // this command. - rpc Reset(google.protobuf.Empty) returns (google.protobuf.Empty); - // Create an ACL BR/EDR connection to a peer. - // This should send a CreateConnection on the HCI level. - // If the two devices have not established a previous bond, - // the peer must be discoverable. - rpc Connect(ConnectRequest) returns (ConnectResponse); - // Get an active ACL BR/EDR connection to a peer. - rpc GetConnection(GetConnectionRequest) returns (GetConnectionResponse); - // Wait for an ACL BR/EDR connection from a peer. - rpc WaitConnection(WaitConnectionRequest) returns (WaitConnectionResponse); - // Disconnect an ACL BR/EDR connection. The Connection must not be reused afterwards. - rpc Disconnect(DisconnectRequest) returns (DisconnectResponse); - // Read the local Bluetooth device address. - // This should return the same value as a Read BD_ADDR HCI command. - rpc ReadLocalAddress(google.protobuf.Empty) returns (ReadLocalAddressResponse); -} - -// A Token representing an ACL connection. -// It's acquired via a Connect on the Host service. -message Connection { - // Opaque value filled by the GRPC server, must not - // be modified nor crafted. - bytes cookie = 1; -} - -// Request of the `Connect` method. -message ConnectRequest { - // Peer Bluetooth Device Address as array of 6 bytes. - bytes address = 1; -} - -// Response of the `Connect` method. -message ConnectResponse { - // Result of the `Connect` call: - // - If successfull: a Connection - oneof result { - Connection connection = 1; - } -} - -// Request of the `GetConnection` method. -message GetConnectionRequest { - // Peer Bluetooth Device Address as array of 6 bytes. - bytes address = 1; -} - -// Response of the `GetConnection` method. -message GetConnectionResponse { - // Result of the `GetConnection` call: - // - If successfull: a Connection - oneof result { - Connection connection = 1; - } -} - -// Request of the `WaitConnection` method. -message WaitConnectionRequest { - // Peer Bluetooth Device Address as array of 6 bytes. - bytes address = 1; -} - -// Response of the `WaitConnection` method. -message WaitConnectionResponse { - // Result of the `WaitConnection` call: - // - If successfull: a Connection - oneof result { - Connection connection = 1; - } -} - -// Request of the `Disconnect` method. -message DisconnectRequest { - // Connection that should be disconnected. - Connection connection = 1; -} - -// Response of the `Disconnect` method. -message DisconnectResponse {} - -// Response of the `ReadLocalAddress` method. -message ReadLocalAddressResponse { - // Local Bluetooth Device Address as array of 6 bytes. - bytes address = 1; -} diff --git a/setup.py b/setup.py index a01b877..22f6e9f 100755 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ class BuildGrpc(Command): proto_include = pkg_resources.resource_filename('grpc_tools', '_proto') - files = [f'blueberry/{f}' for f in os.listdir('proto/blueberry') if f.endswith('.proto')] + files = [f'pandora/{f}' for f in os.listdir('proto/pandora') if f.endswith('.proto')] protoc.main([ 'grpc_tools.protoc', '-Iproto', @@ -46,7 +46,7 @@ class BuildPyCommand(build_py): setup( name='mmi2grpc', version='0.0.1', - packages=['mmi2grpc', 'blueberry'], + packages=['mmi2grpc', 'pandora'], install_requires=[ 'grpcio', ], -- cgit v1.2.3