blob: 2bc4c0eb037f62ec8905cd1beb0a5631d4f63eda [file] [log] [blame]
Gabriel Biren910d5df2022-04-08 18:21:22 +00001/*
2 * Copyright (C) 2022 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.hardware.wifi;
18
19import android.hardware.wifi.IfaceType;
20import android.hardware.wifi.WifiBand;
21import android.hardware.wifi.WifiDebugRingBufferStatus;
22import android.hardware.wifi.WifiStatusCode;
23
24/**
25 * Wifi chip event callbacks.
26 */
27@VintfStability
28oneway interface IWifiChipEventCallback {
29 /**
30 * Struct describing the state of each iface operating on the radio chain
31 * (hardware MAC) on the device.
32 */
33 @VintfStability
34 parcelable IfaceInfo {
35 /**
36 * Name of the interface (ex. wlan0).
37 */
38 String name;
39 /**
40 * Wifi channel on which this interface is operating.
41 */
42 int channel;
43 }
44
45 /**
46 * Struct describing the state of each hardware radio chain (hardware MAC)
47 * on the device.
48 */
49 @VintfStability
50 parcelable RadioModeInfo {
51 /**
52 * Identifier for this radio chain. This is vendor dependent and used
53 * only for debugging purposes.
54 */
55 int radioId;
56 /**
57 * List of bands on which this radio chain is operating.
58 * Can be one of:
59 * a) |WifiBand.BAND_24GHZ| => 2.4Ghz.
60 * b) |WifiBand.BAND_5GHZ| => 5Ghz.
61 * c) |WifiBand.BAND_24GHZ_5GHZ| => 2.4Ghz + 5Ghz (Radio is time sharing
62 * across the 2 bands).
63 * d) |WifiBand.BAND_6GHZ| => 6Ghz.
64 * e) |WifiBand.BAND_5GHZ_6GHZ| => 5Ghz + 6Ghz (Radio is time sharing
65 * across the 2 bands).
66 * f) |WifiBand.BAND_24GHZ_5GHZ_6GHZ| => 2.4Ghz + 5Ghz + 6Ghz (Radio is
67 * time sharing across the 3 bands).
68 */
69 WifiBand bandInfo;
70 /**
71 * List of interfaces on this radio chain (hardware MAC).
72 */
73 IfaceInfo[] ifaceInfos;
74 }
75
76 /**
77 * Callback indicating that a chip reconfiguration failed. This is a fatal
78 * error and any iface objects available previously must be considered
79 * invalid. The client can attempt to recover by trying to reconfigure the
80 * chip again using |IWifiChip.configureChip|.
81 *
82 * @param status Failure reason code.
83 */
84 void onChipReconfigureFailure(in WifiStatusCode status);
85
86 /**
87 * Callback indicating that the chip has been reconfigured successfully. At
88 * this point the interfaces available in the mode must be able to be
89 * configured. When this is called, any previous iface objects must be
90 * considered invalid.
91 *
92 * @param modeId The mode that the chip switched to, corresponding to the id
93 * property of the target ChipMode.
94 */
95 void onChipReconfigured(in int modeId);
96
97 /**
98 * Callback indicating that the chip has encountered a fatal error.
99 * Client must not attempt to parse either the errorCode or debugData.
100 * Must only be captured in a bugreport.
101 *
102 * @param errorCode Vendor defined error code.
103 * @param debugData Vendor defined data used for debugging.
104 */
105 void onDebugErrorAlert(in int errorCode, in byte[] debugData);
106
107 /**
108 * Callbacks for reporting debug ring buffer data.
109 *
110 * The ring buffer data collection is event based:
111 * - Driver calls this callback when new records are available, the
112 * |WifiDebugRingBufferStatus| passed up to framework in the callback
113 * indicates to framework if more data is available in the ring buffer.
114 * It is not expected that driver will necessarily always empty the ring
115 * immediately as data is available. Instead the driver will report data
116 * every X seconds, or if N bytes are available, based on the parameters
117 * set via |startLoggingToDebugRingBuffer|.
118 * - In the case where a bug report has to be captured, the framework will
119 * require driver to upload all data immediately. This is indicated to
120 * driver when framework calls |forceDumpToDebugRingBuffer|. The driver
121 * will start sending all available data in the indicated ring by repeatedly
122 * invoking this callback.
123 *
124 * @param status Status of the corresponding ring buffer. This should
125 * contain the name of the ring buffer on which the data is
126 * available.
127 * @param data Raw bytes of data sent by the driver. Must be dumped
128 * out to a bugreport and post processed.
129 */
130 void onDebugRingBufferDataAvailable(in WifiDebugRingBufferStatus status, in byte[] data);
131
132 /**
133 * Callback indicating that a new iface has been added to the chip.
134 *
135 * @param type Type of iface added.
136 * @param name Name of iface added.
137 */
138 void onIfaceAdded(in IfaceType type, in String name);
139
140 /**
141 * Callback indicating that an existing iface has been removed from the chip.
142 *
143 * @param type Type of iface removed.
144 * @param name Name of iface removed.
145 */
146 void onIfaceRemoved(in IfaceType type, in String name);
147
148 /**
149 * Indicates a radio mode change.
150 * Radio mode change could be a result of:
151 * a) Bringing up concurrent interfaces (ex. STA + AP).
152 * b) Change in operating band of one of the concurrent interfaces
153 * ( ex. STA connection moved from 2.4G to 5G)
154 *
155 * @param radioModeInfos List of RadioModeInfo structures for each
156 * radio chain (hardware MAC) on the device.
157 */
158 void onRadioModeChange(in RadioModeInfo[] radioModeInfos);
159}