1// Copyright (C) 2024 The Android Open Source Project 2// Licensed under the Apache License, Version 2.0 (the "License"); 3// you may not use this file except in compliance with the License. 4// You may obtain a copy of the License at 5// http://www.apache.org/licenses/LICENSE-2.0 6// Unless required by applicable law or agreed to in writing, software 7// distributed under the License is distributed on an "AS IS" BASIS, 8// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 9// See the License for the specific language governing permissions and 10// limitations under the License. 11 12syntax = "proto3"; 13 14package pandora; 15 16import "pandora/host.proto"; 17option java_outer_classname = "HapProto"; 18import "google/protobuf/empty.proto"; 19 20service HAP { 21 // get the Hearing aid features 22 rpc GetFeatures(GetFeaturesRequest) returns (GetFeaturesResponse); 23 // Set active preset by index 24 rpc SetActivePreset(SetActivePresetRequest) returns (google.protobuf.Empty); 25 // Get active preset record 26 rpc GetActivePresetRecord(GetActivePresetRecordRequest) returns (GetActivePresetRecordResponse); 27 // Set next preset 28 rpc SetNextPreset(SetNextPresetRequest) returns (google.protobuf.Empty); 29 // Set next preset 30 rpc SetPreviousPreset(SetPreviousPresetRequest) returns (google.protobuf.Empty); 31 // Playback audio 32 rpc HaPlaybackAudio(stream HaPlaybackAudioRequest) returns (google.protobuf.Empty); 33 // Set preset name 34 rpc WritePresetName(WritePresetNameRequest) returns (google.protobuf.Empty); 35 // Get preset record 36 rpc GetPresetRecord(GetPresetRecordRequest) returns (GetPresetRecordResponse); 37 // Get all preset 38 rpc GetAllPresetRecords(GetAllPresetRecordsRequest) returns (GetAllPresetRecordsResponse); 39 // Wait for Preset Changed event 40 rpc WaitPresetChanged(google.protobuf.Empty) returns (WaitPresetChangedResponse); 41 // Wait for HAP device to be connected. 42 rpc WaitPeripheral(WaitPeripheralRequest) returns (google.protobuf.Empty); 43} 44 45message GetFeaturesRequest{ 46 Connection connection = 1; 47} 48 49message GetFeaturesResponse{ 50 int32 features = 1; 51} 52 53// Request of the `PlaybackAudio` method. 54message HaPlaybackAudioRequest { 55 // Low Energy connection. 56 Connection connection = 1; 57 // Audio data to playback. 58 // `data` should be interleaved stereo frames with 16-bit signed little-endian 59 // linear PCM samples at 44100Hz sample rate 60 bytes data = 2; 61} 62 63// Request of the `SetActivePreset` method. 64message SetActivePresetRequest { 65 // Connection crafted by grpc server 66 Connection connection = 1; 67 // Preset index 68 uint32 index = 2; 69} 70 71message GetActivePresetRecordRequest { 72 // Connection crafted by grpc server 73 Connection connection = 1; 74} 75 76message GetActivePresetRecordResponse { 77 // Received Preset Record 78 PresetRecord preset_record = 1; 79} 80 81// Request of the `SetNextPreset` method. 82message SetNextPresetRequest { 83 // Connection crafted by grpc server 84 Connection connection = 1; 85} 86 87// Request of the `SetPreviousPreset` method. 88message SetPreviousPresetRequest { 89 // Connection crafted by grpc server 90 Connection connection = 1; 91} 92 93// Request of the `GetPresetRecord` method. 94message GetPresetRecordRequest { 95 // Connection crafted by grpc server 96 Connection connection = 1; 97 // Preset index 98 uint32 index = 2; 99} 100 101// Preset Record format 102message PresetRecord { 103 // Preset index 104 uint32 index = 1; 105 // Preset name 106 string name = 2; 107 // Flag marking preset as writable 108 bool isWritable = 3; 109 // Flag marking preset as available 110 bool isAvailable = 4; 111} 112 113// Response of the `GetPresetRecord` method. 114message GetPresetRecordResponse { 115 // Received Preset Record 116 PresetRecord preset_record = 1; 117} 118 119// Request of the `GetAllPresetRecords` method. 120message GetAllPresetRecordsRequest { 121 // Connection crafted by grpc server 122 Connection connection = 1; 123} 124 125// Response of the `GetAllPresetRecords` method. 126message GetAllPresetRecordsResponse { 127 // List of received Preset Records 128 repeated PresetRecord preset_record_list = 1; 129} 130 131// Request of the `WritePresetName` method. 132message WritePresetNameRequest { 133 // Connection crafted by grpc server 134 Connection connection = 1; 135 // Preset index 136 uint32 index = 2; 137 // Preset name to be set 138 string name = 3; 139} 140 141// Response of the `WaitPresetChangedResponse` method. 142message WaitPresetChangedResponse { 143 // Connection crafted by grpc server 144 Connection connection = 1; 145 // List of current Preset Records 146 repeated PresetRecord preset_record_list = 2; 147 // Reason why the presets were changed 148 uint32 reason = 3; 149} 150 151message WaitPeripheralRequest { 152 Connection connection = 1; 153} 154 155