blob: 1d86421a22ee0a68bbee3220690920db4d2b69d5 [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.IWifiChip;
20import android.hardware.wifi.IWifiEventCallback;
21
22/**
23 * This is the root of the HAL module and is the interface returned when
24 * loading an implementation of the Wi-Fi HAL. There must be at most one
25 * module loaded in the system.
26 */
27@VintfStability
28interface IWifi {
29 /**
30 * Gets an AIDL interface object for the chip corresponding to the
31 * provided chipId.
32 *
33 * @param chipId ID of the chip.
34 * @return AIDL interface object representing the chip.
35 * @throws ServiceSpecificException with one of the following values:
36 * |WifiStatusCode.NOT_STARTED|,
37 * |WifiStatusCode.UNKNOWN|
38 */
39 @PropagateAllowBlocking IWifiChip getChip(int chipId);
40
41 /**
42 * Retrieves the list of all chip id's on the device.
43 * The corresponding |IWifiChip| object for any chip can be
44 * retrieved using the |getChip| method.
45 *
46 * @return List of all chip id's on the device.
47 * @throws ServiceSpecificException with one of the following values:
48 * |WifiStatusCode.NOT_STARTED|,
49 * |WifiStatusCode.UNKNOWN|
50 */
51 int[] getChipIds();
52
53 /**
54 * Get the current state of the HAL.
55 *
56 * @return true if started, false otherwise.
57 */
58 boolean isStarted();
59
60 /**
61 * Requests notifications of significant HAL events. Multiple calls to
62 * this must register multiple callbacks, each of which must receive all
63 * events. |IWifiEventCallback| object registration must be independent of the
64 * state of the rest of the HAL and must persist though stops/starts. These
65 * objects must be deleted when the corresponding client process is dead.
66 *
67 * @param callback An instance of the |IWifiEventCallback| AIDL interface
68 * object.
69 * @throws ServiceSpecificException with one of the following values:
70 * |WifiStatusCode.UNKNOWN|
71 */
72 void registerEventCallback(in IWifiEventCallback callback);
73
74 /**
75 * Perform any setup that is required to make use of the module.
76 * If the module is already started then this must be a noop.
77 * Must trigger |IWifiEventCallback.onStart| on success.
78 *
79 * @throws ServiceSpecificException with one of the following values:
80 * |WifiStatusCode.NOT_AVAILABLE|,
81 * |WifiStatusCode.UNKNOWN|
82 */
83 void start();
84
85 /**
86 * Tear down any state, ongoing commands, etc. If the module is already
87 * stopped then this must be a noop. After calling this, all |IWifiChip|
88 * objects will be considered invalid.
89 * Must trigger |IWifiEventCallback.onStop| on success.
90 * Must trigger |IWifiEventCallback.onFailure| on failure.
91 *
92 * Calling stop() and then start() is a valid way of resetting state in
93 * the HAL, driver, and firmware.
94 *
95 * @throws ServiceSpecificException with one of the following values:
96 * |WifiStatusCode.NOT_STARTED|,
97 * |WifiStatusCode.UNKNOWN|
98 */
99 void stop();
100}