1// Copyright 2022 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// https://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17option java_outer_classname = "AshaProto"; 18 19package pandora.asha; 20 21import "google/protobuf/empty.proto"; 22import "pandora/host.proto"; 23 24// Service to trigger Audio Streaming for Hearing Aid (ASHA) procedures. 25// ASHA uses connection-oriented L2CAP channels (CoC) and GATT. 26service Asha { 27 // Register ASHA Service. 28 rpc Register(RegisterRequest) returns (google.protobuf.Empty); 29 // Capture Audio. 30 rpc CaptureAudio(CaptureAudioRequest) returns (stream CaptureAudioResponse); 31 // Start a suspended stream. 32 rpc Start(StartRequest) returns (StartResponse); 33 // Playback audio 34 rpc PlaybackAudio(stream PlaybackAudioRequest) returns (PlaybackAudioResponse); 35 // Stop a started stream. 36 rpc Stop(StopRequest) returns (StopResponse); 37 // Wait for ASHA device to be connected. 38 rpc WaitPeripheral(WaitPeripheralRequest) returns (WaitPeripheralResponse); 39} 40 41// Request of the `Register` method. 42message RegisterRequest { 43 uint32 capability = 1; // left or right device, monaural or binaural device. 44 repeated uint32 hisyncid = 2; // id identifying two hearing aids as one pair. 45} 46 47// Request of the `CaptureAudio` method. 48message CaptureAudioRequest { 49 // Low Energy connection. 50 Connection connection = 1; 51} 52 53// Response of the `CaptureAudio` method. 54message CaptureAudioResponse { 55 // Audio data received on peripheral side. 56 // `data` is decoded by G722 decoder. 57 bytes data = 1; 58} 59 60// Request of the `Start` method. 61message StartRequest { 62 // Low Energy connection. 63 Connection connection = 1; 64} 65 66// Response of the `Start` method. 67message StartResponse {} 68 69// Request of the `PlaybackAudio` method. 70message PlaybackAudioRequest { 71 // Low Energy connection. 72 Connection connection = 1; 73 // Audio data to playback. 74 // `data` should be interleaved stereo frames with 16-bit signed little-endian 75 // linear PCM samples at 44100Hz sample rate 76 bytes data = 2; 77} 78 79// Response of the `PlaybackAudio` method. 80message PlaybackAudioResponse {} 81 82// Request of the `Stop` method. 83message StopRequest { 84 // Low Energy connection. 85 Connection connection = 1; 86} 87 88// Response of the `Stop` method. 89message StopResponse {} 90 91// Request for the `WaitPeripheral` method. 92message WaitPeripheralRequest { 93 // The connection that is awaiting the stream. 94 Connection connection = 1; 95} 96 97// Response for the `WaitPeripheral` method. 98message WaitPeripheralResponse { 99 // Result of the `WaitPeripheral` call: 100 // - If successful: the connection to the ASHA device. 101 Connection connection = 1; 102}