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