• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 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
15syntax = "proto3";
16
17package netsim.model;
18
19import "netsim/common.proto";
20import "google/protobuf/timestamp.proto";
21import "rootcanal/configuration.proto";
22
23// A 3D position. A valid Position must have both x and y coordinates.
24// The position coordinates are in meters.
25message Position {
26  // positional value of x axis
27  float x = 1;
28  // positional value of y axis
29  float y = 2;
30  // positional value of z axis
31  float z = 3;
32}
33
34// A 3D orientation. A valid Orientation must have yaw, pitch, and roll.
35// The orientation values are in degrees.
36message Orientation {
37  // Rotational value around vertical axis.
38  float yaw = 1;
39  // Rotational value around side-to-side axis
40  float pitch = 2;
41  // Rotational value around front-to-back axis
42  float roll = 3;
43}
44
45// Radio Type used by netsim-grpc in testing module
46enum PhyKind {
47  // Unknown Chip Kind
48  NONE = 0;
49  BLUETOOTH_CLASSIC = 1;
50  BLUETOOTH_LOW_ENERGY = 2;
51  WIFI = 3;
52  UWB = 4;
53  WIFI_RTT = 5;
54}
55
56// Model of a Chip in netsim
57message Chip {
58  // Type of Radio (BT, WIFI, UWB)
59  netsim.common.ChipKind kind = 1;
60  // Chip Identifier
61  uint32 id = 2;
62  // optional like "rear-right"
63  string name = 3;
64  // optional like Quorvo
65  string manufacturer = 4;
66  // optional like DW300
67  string product_name = 5;
68
69  // Radio state associated with the Chip
70  message Radio {
71    // Boolean state of Radio
72    optional bool state = 1;
73    // Maximum range of Radio
74    float range = 2;
75    // Transmitted packet counts
76    int32 tx_count = 3;
77    // Received packet counts
78    int32 rx_count = 4;
79  }
80
81  // Bluetooth has 2 radios
82  message Bluetooth {
83    // BLE
84    Radio low_energy = 1;
85    // Bluetooth Classic
86    Radio classic = 2;
87    // BD_ADDR address
88    string address = 3;
89    // rootcanal Controller Properties
90    rootcanal.configuration.Controller bt_properties = 4;
91  }
92
93  // BleBeacon has numerous configurable fields.
94  // Address, AdvertiseSetting, AdvertiseData.
95  message BleBeacon {
96    // Advertise Settigns dictate how the beacon functions on the netwwork.
97    message AdvertiseSettings {
98      // How often the beacon sends an advertising packet
99      //
100      // Referenced From
101      // packages/modules/Bluetooth/framework/java/android/bluetooth/le/BluetoothLeAdvertiser.java#151
102      enum AdvertiseMode {
103        // Perform Bluetooth LE advertising in low power mode. This is the
104        // default and preferred advertising mode as it consumes the least power
105        LOW_POWER = 0;
106        // Perform Bluetooth LE advertising in balanced power mode. This is
107        // balanced between advertising frequency and power consumption
108        BALANCED = 1;
109        // Perform Bluetooth LE advertising in low latency, high power mode.
110        // This has the highest power consumption and should not be used for
111        // continuous background advertising
112        LOW_LATENCY = 2;
113      }
114
115      // Amount of power to send transmissions. Correlates with signal strength
116      // and range. Inversely correlates with energy consumption.
117      //
118      // Referenced From
119      // packages/modules/Bluetooth/framework/java/android/bluetooth/le/BluetoothLeAdvertiser.java#159
120      enum AdvertiseTxPower {
121        // Advertise using the lowest transmission (TX) power level. Low
122        // transmission power can be used to restrict the visibility range of
123        // advertising packets
124        ULTRA_LOW = 0;
125        // Advertise using low TX power level. This is the default
126        LOW = 1;
127        // Advertise using medium TX power level
128        MEDIUM = 2;
129        // Advertise using high TX power level. This corresponds to largest
130        // visibility range of the advertising packet
131        HIGH = 3;
132      }
133
134      // Time interval between advertisments.
135      oneof interval {
136        // How often the beacon sends an advertising packet
137        AdvertiseMode advertise_mode = 1;
138        // Numeric time interval between advertisements in ms.
139        uint64 milliseconds = 2;
140      }
141
142      // Transmission power level.
143      oneof tx_power {
144        // Amount of power to send transmission
145        AdvertiseTxPower tx_power_level = 3;
146        // Numeric transmission power in dBm. Must be within [-127, 127].
147        int32 dbm = 4;
148      }
149      // Whether the beacon will respond to scan requests.
150      bool scannable = 5;
151      // Limit adveritising to a given amoutn of time.
152      uint64 timeout = 6;
153    }
154
155    // These parameters dictate which fields are included in advertisements or
156    // scan responses sent by the beacon. Beacons in Betosim will support a
157    // subset of the complete list of fields found in "Supplement to the
158    // Bluetooth Core Specification"
159    message AdvertiseData {
160      // GATT service proto
161      message Service {
162        // UUID of a Bluetooth GATT service for the beacon
163        string uuid = 1;
164        // Bytes of data associated with a GATT service provided by the device
165        bytes data = 2;
166      }
167      // Whether the device name should be included in advertise packet.
168      bool include_device_name = 1;
169      // Whether the transmission power level should be included in the
170      // advertise packet.
171      bool include_tx_power_level = 2;
172      // Manufacturer specific data.
173      bytes manufacturer_data = 3;
174      // GATT services supported by the devices
175      repeated Service services = 4;
176    }
177
178    // Bluetooth Radio
179    Bluetooth bt = 1;
180    // BD_ADDR address
181    string address = 2;
182    // Settings on how beacon functions
183    AdvertiseSettings settings = 3;
184    // Advertising Data
185    AdvertiseData adv_data = 4;
186    // Scan Response Data
187    AdvertiseData scan_response = 5;
188  }
189  oneof chip {
190    // Dual mode of Bluetooth
191    Bluetooth bt = 6;
192    // Bluetooth Beacon Low Energy
193    BleBeacon ble_beacon = 9;
194    // UWB
195    Radio uwb = 7;
196    // WIFI
197    Radio wifi = 8;
198    // Reserved fields 10 to 14
199  }
200  // Offset of the chip position from center of device
201  optional Position offset = 15;
202}
203
204// Protobuf for ChipCreate
205//
206// This is used specifically for CreateDevice
207message ChipCreate {
208  // Protobuf for BleBeaconCreate
209  // Beacon specific information during creation
210  message BleBeaconCreate {
211    // BD_ADDR address
212    string address = 1;
213    // Settings on how beacon functions
214    Chip.BleBeacon.AdvertiseSettings settings = 3;
215    // Advertising Data
216    Chip.BleBeacon.AdvertiseData adv_data = 4;
217    // Scan Response Data
218    Chip.BleBeacon.AdvertiseData scan_response = 5;
219  }
220
221  // Type of Radio (BT, WIFI, UWB)
222  netsim.common.ChipKind kind = 1;
223  // BD_ADDR address
224  string address = 2;
225  // optional like "rear-right"
226  string name = 3;
227  // optional like Quorvo
228  string manufacturer = 4;
229  // optional like DW300
230  string product_name = 5;
231  oneof chip {
232    // BleBeaconCreate protobuf
233    BleBeaconCreate ble_beacon = 6;
234  }
235  // optional rootcanal configuration for bluetooth chipsets.
236  rootcanal.configuration.Controller bt_properties = 7;
237}
238
239// Device model for netsim
240message Device {
241  // Device Identifier
242  uint32 id = 1;
243  // Device name. Settable at creation
244  string name = 2;
245  // Visibility of device in the scene
246  optional bool visible = 3;
247  // Position of Device
248  Position position = 4;
249  // Orientation of Device
250  Orientation orientation = 5;
251  // Chips in Device. Device can have multiple chips of the same kind.
252  repeated Chip chips = 6;
253}
254
255// Protobuf for DeviceCreate
256//
257// This is used specifically for CreateDevice
258message DeviceCreate {
259  // Device name.
260  string name = 1;
261  // Position of Device
262  Position position = 2;
263  // Orientation of Device
264  Orientation orientation = 3;
265  // Chips in Device
266  repeated ChipCreate chips = 4;
267}
268
269// Scene model for netsim
270message Scene {
271  // List of devices in the scene.
272  repeated Device devices = 1;
273}
274
275// Capture model for netsim
276message Capture {
277  // Capture Identifier (Same as Chip Identifier)
278  uint32 id = 1;
279  // Type of Radio (BT, WIFI, UWB)
280  netsim.common.ChipKind chip_kind = 2;
281  // device AVD name
282  string device_name = 3;
283  // capture state
284  optional bool state = 4;
285  // size of current capture
286  int32 size = 5;
287  // number of records in current capture
288  int32 records = 6;
289  // Timestamp of the most recent start_capture
290  // When "state" is set "ON", timestamp is updated.
291  google.protobuf.Timestamp timestamp = 7;
292  // True if capture for the chip is attached to netsim.
293  // False if chip has been detached from netsim.
294  bool valid = 8;
295}
296