• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2024 The ChromiumOS Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5syntax = "proto3";
6
7package chromiumos.test.lab.api.btpeerd;
8
9option go_package = "go.chromium.org/chromiumos/config/go/test/lab/api/btpeerd";
10
11import "google/protobuf/timestamp.proto";
12
13// BtpeerManagementService is the service run by go/btpeerd on btpeers for
14// managing the state of the device for testing and maintenance purposes.
15//
16// Note: This API is a work in progress and breaking changes are allowed until
17// btpeers with this service are deployed to the main lab pools.
18service BtpeerManagementService {
19  // DeviceInfo returns basic hardware and software information about the btpeer
20  // that is generally constant for this installation. Useful for logging.
21  rpc DeviceInfo(DeviceInfoRequest) returns (DeviceInfoResponse) {}
22
23  // DeviceStatus returns the current status of things this service manages in
24  // additional to general device health info. Useful for logging.
25  rpc DeviceStatus(DeviceStatusRequest) returns (DeviceStatusResponse) {}
26
27  // Reboot will return a successful response and then reboot the btpeer.
28  // When it reboots, the ssh connection will be severed. Allow up to 2 minutes
29  // for the device to be reachable again.
30  rpc Reboot(RebootRequest) returns (RebootResponse) {}
31
32  // GetActiveBluetoothStack sets the active bluetooth stack.
33  rpc GetActiveBluetoothStack(GetActiveBluetoothStackRequest) returns (GetActiveBluetoothStackResponse) {}
34
35  // SetActiveBluetoothStack sets the active bluetooth stack.
36  rpc SetActiveBluetoothStack(SetActiveBluetoothStackRequest) returns (SetActiveBluetoothStackResponse) {}
37
38  // GetActiveBluetoothStack sets the active bluetooth stack API.
39  rpc GetActiveBluetoothStackAPI(GetActiveBluetoothStackAPIRequest) returns (GetActiveBluetoothStackAPIResponse) {}
40
41  // SetActiveBluetoothStack sets the active bluetooth stack API.
42  rpc SetActiveBluetoothStackAPI(SetActiveBluetoothStackAPIRequest) returns (SetActiveBluetoothStackAPIResponse) {}
43}
44
45message DeviceInfoRequest {}
46message DeviceInfoResponse {
47  // The MAC address of ethernet port 0, used for the identification of the
48  // device in the lab.
49  string mac_eth0 = 1;
50
51  // The IPv4 address of the device in the lab network.
52  string ipv4_address = 2;
53
54  // The version of the operating system running btpeerd.
55  string os_version = 3;
56
57  // The version of the bluez package installed on the system.
58  string bluez_version = 4;
59
60  // The commit of the chameleon repository used to build the chameleond
61  // bundle installed on the device.
62  string chameleond_commit = 5;
63
64  // The commit of the btpeerd repository used to build this service.
65  string btpeerd_commit = 6;
66
67  // The model name of the device (e.g. "Raspberry Pi 4 Model B Rev 1.2").
68  string model = 7;
69}
70
71// SystemdUnitStatus includes a subset of systemd unit properties related to
72// service status.
73message SystemdUnitStatus {
74  string id = 1;
75  string active_state = 2;
76  google.protobuf.Timestamp state_change_timestamp = 3;
77}
78
79message DeviceStatusRequest {}
80message DeviceStatusResponse {
81  // Status of the btpeerd system service (the service running this API).
82  SystemdUnitStatus btpeerd_service_status = 1;
83
84  // Status of the chameleond system service.
85  SystemdUnitStatus chameleond_service_status = 2;
86
87  // Status of the bluetooth system service.
88  SystemdUnitStatus bluetooth_service_status = 3;
89
90  // Result of running 'uptime' on the device.
91  string uptime = 4;
92}
93
94message RebootRequest {}
95message RebootResponse {}
96
97// BluetoothStack refers to a bluetooth stack.
98enum BluetoothStack {
99  // Default value. Bluetooth stack not identified.
100  BLUETOOTH_STACK_UNKNOWN = 0;
101  // The bluez bluetooth stack.
102  BLUETOOTH_STACK_BLUEZ = 1;
103  // The floss bluetooth stack.
104  BLUETOOTH_STACK_FLOSS = 2;
105}
106
107// BluetoothStackAPI refers to an API for a bluetooth stack.
108enum BluetoothStackAPI {
109  // Default value. Bluetooth stack API not identified.
110  BLUETOOTH_STACK_API_UNKNOWN = 0;
111  // The chameleond stack API, used for bluez.
112  BLUETOOTH_STACK_API_CHAMELEOND = 1;
113  // The pandora bluetooth stack API, implemented for floss.
114  BLUETOOTH_STACK_API_PANDORA_FLOSS = 2;
115}
116
117message SetActiveBluetoothStackRequest {
118  BluetoothStack bluetooth_stack = 1;
119}
120message SetActiveBluetoothStackResponse {
121  // True iff the previous active stack was different than the requested stack.
122  bool stack_changed = 1;
123}
124
125message SetActiveBluetoothStackAPIRequest {
126  BluetoothStackAPI bluetooth_stack_api = 1;
127}
128message SetActiveBluetoothStackAPIResponse {
129  // True iff the previous active stack API was different than the requested stack API.
130  bool stack_api_changed = 1;
131  // The port the service for the stack API is listening on.
132  int32 service_port = 2;
133}
134
135message GetActiveBluetoothStackRequest {}
136message GetActiveBluetoothStackResponse {
137  BluetoothStack bluetooth_stack = 1;
138}
139
140message GetActiveBluetoothStackAPIRequest {}
141message GetActiveBluetoothStackAPIResponse {
142  BluetoothStackAPI bluetooth_stack_api = 1;
143}