1// Copyright (C) 2022 The Android Open Source Project 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// http://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 15// Note that if you add/remove methods in this file you must update 16// the metrics sql as well ./android/scripts/gen-grpc-sql.py 17// 18// Please group deleted methods in a block including the date (MM/DD/YY) 19// it was removed. This enables us to easily keep metrics around after removal 20// 21// List of deleted methods 22// rpc iWasDeleted (03/12/12) 23// ... 24syntax = "proto3"; 25 26option java_multiple_files = true; 27option java_package = "com.android.emulator.bluetooth"; 28 29package android.emulation.bluetooth; 30import "emulated_bluetooth_packets.proto"; 31import "emulated_bluetooth_device.proto"; 32 33// An Emulated Bluetooth Service exposes the emulated bluetooth chip from the 34// android emulator. It allows you to register emulated bluetooth devices and 35// control the packets that are exchanged between the device and the world. 36// 37// This service enables you to establish a "virtual network" of emulated 38// bluetooth devices that can interact with each other. 39// 40// Note: This is not yet finalized, it is likely that these definitions will 41// evolve. 42service EmulatedBluetoothService { 43 // Connect device to link layer. This will establish a direct connection 44 // to the emulated bluetooth chip and configure the following: 45 // 46 // - Each connection creates a new device and attaches it to the link layer 47 // - Link Layer packets are transmitted directly to the phy 48 // 49 // This should be used for classic connections. 50 // 51 // This is used to directly connect various android emulators together. 52 // For example a wear device can connect to an android emulator through 53 // this. 54 rpc registerClassicPhy(stream RawData) returns (stream RawData); 55 56 // Connect device to link layer. This will establish a direct connection 57 // to root canal and execute the following: 58 // 59 // - Each connection creates a new device and attaches it to the link layer 60 // - Link Layer packets are transmitted directly to the phy 61 // 62 // This should be used for BLE connections. 63 // 64 // This is used to directly connect various android emulators together. 65 // For example a wear device can connect to an android emulator through 66 // this. 67 rpc registerBlePhy(stream RawData) returns (stream RawData); 68 69 // Connect the device to the emulated bluetooth chip. The device will 70 // participate in the network. You can configure the chip to scan, advertise 71 // and setup connections with other devices that are connected to the 72 // network. 73 // 74 // This is usually used when you have a need for an emulated bluetooth chip 75 // and have a bluetooth stack that can interpret and handle the packets 76 // correctly. 77 // 78 // For example the apache nimble stack can use this endpoint as the 79 // transport layer. 80 rpc registerHCIDevice(stream HCIPacket) returns (stream HCIPacket); 81 82 // Registers an emulated bluetooth device. The emulator will reach out to 83 // the emulated device to read/write and subscribe to properties. 84 // 85 // The following gRPC error codes can be returned: 86 // - FAILED_PRECONDITION (code 9): 87 // - root canal is not available on this device 88 // - unable to reach the endpoint for the GattDevice 89 // - INTERNAL (code 13) if there was an internal emulator failure. 90 // 91 // The device will not be discoverable in case of an error. 92 rpc registerGattDevice(GattDevice) returns (RegistrationStatus); 93}; 94 95message RawData { 96 // A packet of raw bytes that should be delivered. 97 bytes packet = 1; 98}; 99 100message RegistrationStatus { 101 // The identity of the registered device. The emulator will provide this 102 // when executing a request for a CharacteristicValueRequest 103 CallbackIdentifier callback_device_id = 1; 104}