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 17package pandora; 18 19import "google/protobuf/empty.proto"; 20 21option java_outer_classname = "HostProto"; 22 23// Service to trigger Bluetooth Host procedures 24// 25// Requirements for the implementer: 26// At startup, the Host must be in BR/EDR connectable mode 27// (see GAP connectability modes) 28service Host { 29 // Reset the host. 30 // **After** responding to this command, the GRPC server should loose 31 // all its state. 32 // This is comparable to a process restart or an hardware reset. 33 // The GRPC server might take some time to be available after 34 // this command. 35 rpc Reset(google.protobuf.Empty) returns (google.protobuf.Empty); 36 // Create an ACL BR/EDR connection to a peer. 37 // This should send a CreateConnection on the HCI level. 38 // If the two devices have not established a previous bond, 39 // the peer must be discoverable. 40 rpc Connect(ConnectRequest) returns (ConnectResponse); 41 // Get an active ACL BR/EDR connection to a peer. 42 rpc GetConnection(GetConnectionRequest) returns (GetConnectionResponse); 43 // Wait for an ACL BR/EDR connection from a peer. 44 rpc WaitConnection(WaitConnectionRequest) returns (WaitConnectionResponse); 45 // Disconnect an ACL BR/EDR connection. The Connection must not be reused 46 // afterwards. 47 rpc Disconnect(DisconnectRequest) returns (DisconnectResponse); 48 // Read the local Bluetooth device address. 49 // This should return the same value as a Read BD_ADDR HCI command. 50 rpc ReadLocalAddress(google.protobuf.Empty) 51 returns (ReadLocalAddressResponse); 52} 53 54// A Token representing an ACL connection. 55// It's acquired via a Connect on the Host service. 56message Connection { 57 // Opaque value filled by the GRPC server, must not 58 // be modified nor crafted. 59 bytes cookie = 1; 60} 61 62// Request of the `Connect` method. 63message ConnectRequest { 64 // Peer Bluetooth Device Address as array of 6 bytes. 65 bytes address = 1; 66} 67 68// Response of the `Connect` method. 69message ConnectResponse { 70 // Result of the `Connect` call: 71 // - If successful: a Connection 72 oneof result { 73 Connection connection = 1; 74 } 75} 76 77// Request of the `GetConnection` method. 78message GetConnectionRequest { 79 // Peer Bluetooth Device Address as array of 6 bytes. 80 bytes address = 1; 81} 82 83// Response of the `GetConnection` method. 84message GetConnectionResponse { 85 // Result of the `GetConnection` call: 86 // - If successful: a Connection 87 oneof result { 88 Connection connection = 1; 89 } 90} 91 92// Request of the `WaitConnection` method. 93message WaitConnectionRequest { 94 // Peer Bluetooth Device Address as array of 6 bytes. 95 bytes address = 1; 96} 97 98// Response of the `WaitConnection` method. 99message WaitConnectionResponse { 100 // Result of the `WaitConnection` call: 101 // - If successful: a Connection 102 oneof result { 103 Connection connection = 1; 104 } 105} 106 107// Request of the `Disconnect` method. 108message DisconnectRequest { 109 // Connection that should be disconnected. 110 Connection connection = 1; 111} 112 113// Response of the `Disconnect` method. 114message DisconnectResponse {} 115 116// Response of the `ReadLocalAddress` method. 117message ReadLocalAddressResponse { 118 // Local Bluetooth Device Address as array of 6 bytes. 119 bytes address = 1; 120} 121