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 // Set preset name 32 rpc WritePresetName(WritePresetNameRequest) returns (google.protobuf.Empty); 33 // Get preset record 34 rpc GetPresetRecord(GetPresetRecordRequest) returns (GetPresetRecordResponse); 35 // Get all preset 36 rpc GetAllPresetRecords(GetAllPresetRecordsRequest) returns (GetAllPresetRecordsResponse); 37 // Wait for Preset Changed event 38 rpc WaitPresetChanged(google.protobuf.Empty) returns (WaitPresetChangedResponse); 39 // Wait for HAP device to be connected. 40 rpc WaitPeripheral(WaitPeripheralRequest) returns (google.protobuf.Empty); 41} 42 43message GetFeaturesRequest{ 44 Connection connection = 1; 45} 46 47message GetFeaturesResponse{ 48 int32 features = 1; 49} 50 51// Request of the `SetActivePreset` method. 52message SetActivePresetRequest { 53 // Connection crafted by grpc server 54 Connection connection = 1; 55 // Preset index 56 uint32 index = 2; 57} 58 59message GetActivePresetRecordRequest { 60 // Connection crafted by grpc server 61 Connection connection = 1; 62} 63 64message GetActivePresetRecordResponse { 65 // Received Preset Record 66 PresetRecord preset_record = 1; 67} 68 69// Request of the `SetNextPreset` method. 70message SetNextPresetRequest { 71 // Connection crafted by grpc server 72 Connection connection = 1; 73} 74 75// Request of the `SetPreviousPreset` method. 76message SetPreviousPresetRequest { 77 // Connection crafted by grpc server 78 Connection connection = 1; 79} 80 81// Request of the `GetPresetRecord` method. 82message GetPresetRecordRequest { 83 // Connection crafted by grpc server 84 Connection connection = 1; 85 // Preset index 86 uint32 index = 2; 87} 88 89// Preset Record format 90message PresetRecord { 91 // Preset index 92 uint32 index = 1; 93 // Preset name 94 string name = 2; 95 // Flag marking preset as writable 96 bool isWritable = 3; 97 // Flag marking preset as available 98 bool isAvailable = 4; 99} 100 101// Response of the `GetPresetRecord` method. 102message GetPresetRecordResponse { 103 // Received Preset Record 104 PresetRecord preset_record = 1; 105} 106 107// Request of the `GetAllPresetRecords` method. 108message GetAllPresetRecordsRequest { 109 // Connection crafted by grpc server 110 Connection connection = 1; 111} 112 113// Response of the `GetAllPresetRecords` method. 114message GetAllPresetRecordsResponse { 115 // List of received Preset Records 116 repeated PresetRecord preset_record_list = 1; 117} 118 119// Request of the `WritePresetName` method. 120message WritePresetNameRequest { 121 // Connection crafted by grpc server 122 Connection connection = 1; 123 // Preset index 124 uint32 index = 2; 125 // Preset name to be set 126 string name = 3; 127} 128 129// Response of the `WaitPresetChangedResponse` method. 130message WaitPresetChangedResponse { 131 // Connection crafted by grpc server 132 Connection connection = 1; 133 // List of current Preset Records 134 repeated PresetRecord preset_record_list = 2; 135 // Reason why the presets were changed 136 uint32 reason = 3; 137} 138 139message WaitPeripheralRequest { 140 Connection connection = 1; 141} 142 143