xref: /aosp_15_r20/hardware/interfaces/wifi/1.0/IWifi.hal (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
1*4d7e907cSAndroid Build Coastguard Worker/*
2*4d7e907cSAndroid Build Coastguard Worker * Copyright 2016 The Android Open Source Project
3*4d7e907cSAndroid Build Coastguard Worker *
4*4d7e907cSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
5*4d7e907cSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
6*4d7e907cSAndroid Build Coastguard Worker * You may obtain a copy of the License at
7*4d7e907cSAndroid Build Coastguard Worker *
8*4d7e907cSAndroid Build Coastguard Worker *      http://www.apache.org/licenses/LICENSE-2.0
9*4d7e907cSAndroid Build Coastguard Worker *
10*4d7e907cSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
11*4d7e907cSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
12*4d7e907cSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*4d7e907cSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
14*4d7e907cSAndroid Build Coastguard Worker * limitations under the License.
15*4d7e907cSAndroid Build Coastguard Worker */
16*4d7e907cSAndroid Build Coastguard Worker
17*4d7e907cSAndroid Build Coastguard Workerpackage [email protected];
18*4d7e907cSAndroid Build Coastguard Worker
19*4d7e907cSAndroid Build Coastguard Workerimport IWifiChip;
20*4d7e907cSAndroid Build Coastguard Workerimport IWifiEventCallback;
21*4d7e907cSAndroid Build Coastguard Worker
22*4d7e907cSAndroid Build Coastguard Worker/**
23*4d7e907cSAndroid Build Coastguard Worker * This is the root of the HAL module and is the interface returned when
24*4d7e907cSAndroid Build Coastguard Worker * loading an implementation of the Wi-Fi HAL. There must be at most one
25*4d7e907cSAndroid Build Coastguard Worker * module loaded in the system.
26*4d7e907cSAndroid Build Coastguard Worker */
27*4d7e907cSAndroid Build Coastguard Workerinterface IWifi {
28*4d7e907cSAndroid Build Coastguard Worker  /**
29*4d7e907cSAndroid Build Coastguard Worker   * Requests notifications of significant events for the HAL. Multiple calls to
30*4d7e907cSAndroid Build Coastguard Worker   * this must register multiple callbacks each of which must receive all
31*4d7e907cSAndroid Build Coastguard Worker   * events. |IWifiEventCallback| object registration must be independent of the
32*4d7e907cSAndroid Build Coastguard Worker   * state of the rest of the HAL and must persist though stops/starts. These
33*4d7e907cSAndroid Build Coastguard Worker   * objects must be deleted when the corresponding client process is dead.
34*4d7e907cSAndroid Build Coastguard Worker   *
35*4d7e907cSAndroid Build Coastguard Worker   * @param callback An instance of the |IWifiEventCallback| HIDL interface
36*4d7e907cSAndroid Build Coastguard Worker   *        object.
37*4d7e907cSAndroid Build Coastguard Worker   * @return status WifiStatus of the operation.
38*4d7e907cSAndroid Build Coastguard Worker   *         Possible status codes:
39*4d7e907cSAndroid Build Coastguard Worker   *         |WifiStatusCode.SUCCESS|,
40*4d7e907cSAndroid Build Coastguard Worker   *         |WifiStatusCode.UNKNOWN|
41*4d7e907cSAndroid Build Coastguard Worker   */
42*4d7e907cSAndroid Build Coastguard Worker  @entry
43*4d7e907cSAndroid Build Coastguard Worker  @callflow(next={"*"})
44*4d7e907cSAndroid Build Coastguard Worker  registerEventCallback(IWifiEventCallback callback)
45*4d7e907cSAndroid Build Coastguard Worker      generates (WifiStatus status);
46*4d7e907cSAndroid Build Coastguard Worker
47*4d7e907cSAndroid Build Coastguard Worker  /**
48*4d7e907cSAndroid Build Coastguard Worker   * Get the current state of the HAL.
49*4d7e907cSAndroid Build Coastguard Worker   *
50*4d7e907cSAndroid Build Coastguard Worker   * @return started true if started, false otherwise.
51*4d7e907cSAndroid Build Coastguard Worker   */
52*4d7e907cSAndroid Build Coastguard Worker  isStarted() generates (bool started);
53*4d7e907cSAndroid Build Coastguard Worker
54*4d7e907cSAndroid Build Coastguard Worker  /**
55*4d7e907cSAndroid Build Coastguard Worker   * Perform any setup that is required to make use of the module. If the module
56*4d7e907cSAndroid Build Coastguard Worker   * is already started then this must be a noop.
57*4d7e907cSAndroid Build Coastguard Worker   * Must trigger |IWifiEventCallback.onStart| on success.
58*4d7e907cSAndroid Build Coastguard Worker   *
59*4d7e907cSAndroid Build Coastguard Worker   * @return status WifiStatus of the operation.
60*4d7e907cSAndroid Build Coastguard Worker   *         Possible status codes:
61*4d7e907cSAndroid Build Coastguard Worker   *         |WifiStatusCode.SUCCESS|,
62*4d7e907cSAndroid Build Coastguard Worker   *         |WifiStatusCode.NOT_AVAILABLE|,
63*4d7e907cSAndroid Build Coastguard Worker   *         |WifiStatusCode.UNKNOWN|
64*4d7e907cSAndroid Build Coastguard Worker   */
65*4d7e907cSAndroid Build Coastguard Worker  @entry
66*4d7e907cSAndroid Build Coastguard Worker  @callflow(next={"registerEventCallback", "start", "stop", "getChip"})
67*4d7e907cSAndroid Build Coastguard Worker  start() generates (WifiStatus status);
68*4d7e907cSAndroid Build Coastguard Worker
69*4d7e907cSAndroid Build Coastguard Worker  /**
70*4d7e907cSAndroid Build Coastguard Worker   * Tear down any state, ongoing commands, etc. If the module is already
71*4d7e907cSAndroid Build Coastguard Worker   * stopped then this must be a noop. If the HAL is already stopped or it
72*4d7e907cSAndroid Build Coastguard Worker   * succeeds then onStop must be called. After calling this all IWifiChip
73*4d7e907cSAndroid Build Coastguard Worker   * objects will be considered invalid.
74*4d7e907cSAndroid Build Coastguard Worker   * Must trigger |IWifiEventCallback.onStop| on success.
75*4d7e907cSAndroid Build Coastguard Worker   * Must trigger |IWifiEventCallback.onFailure| on failure.
76*4d7e907cSAndroid Build Coastguard Worker   *
77*4d7e907cSAndroid Build Coastguard Worker   * Calling stop then start is a valid way of resetting state in the HAL,
78*4d7e907cSAndroid Build Coastguard Worker   * driver, firmware.
79*4d7e907cSAndroid Build Coastguard Worker   *
80*4d7e907cSAndroid Build Coastguard Worker   * @return status WifiStatus of the operation.
81*4d7e907cSAndroid Build Coastguard Worker   *         Possible status codes:
82*4d7e907cSAndroid Build Coastguard Worker   *         |WifiStatusCode.SUCCESS|,
83*4d7e907cSAndroid Build Coastguard Worker   *         |WifiStatusCode.NOT_STARTED|,
84*4d7e907cSAndroid Build Coastguard Worker   *         |WifiStatusCode.UNKNOWN|
85*4d7e907cSAndroid Build Coastguard Worker   */
86*4d7e907cSAndroid Build Coastguard Worker  @exit
87*4d7e907cSAndroid Build Coastguard Worker  @callflow(next={"registerEventCallback", "start", "stop"})
88*4d7e907cSAndroid Build Coastguard Worker  stop() generates (WifiStatus status);
89*4d7e907cSAndroid Build Coastguard Worker
90*4d7e907cSAndroid Build Coastguard Worker  /**
91*4d7e907cSAndroid Build Coastguard Worker   * Retrieve the list of all chip Id's on the device.
92*4d7e907cSAndroid Build Coastguard Worker   * The corresponding |IWifiChip| object for any chip can be
93*4d7e907cSAndroid Build Coastguard Worker   * retrieved using |getChip| method.
94*4d7e907cSAndroid Build Coastguard Worker   *
95*4d7e907cSAndroid Build Coastguard Worker   * @return status WifiStatus of the operation.
96*4d7e907cSAndroid Build Coastguard Worker   *         Possible status codes:
97*4d7e907cSAndroid Build Coastguard Worker   *         |WifiStatusCode.SUCCESS|,
98*4d7e907cSAndroid Build Coastguard Worker   *         |WifiStatusCode.NOT_STARTED|,
99*4d7e907cSAndroid Build Coastguard Worker   *         |WifiStatusCode.UNKNOWN|
100*4d7e907cSAndroid Build Coastguard Worker   * @return chipIds List of all chip Id's on the device.
101*4d7e907cSAndroid Build Coastguard Worker   */
102*4d7e907cSAndroid Build Coastguard Worker  @callflow(next={"*"})
103*4d7e907cSAndroid Build Coastguard Worker  getChipIds() generates (WifiStatus status, vec<ChipId> chipIds);
104*4d7e907cSAndroid Build Coastguard Worker
105*4d7e907cSAndroid Build Coastguard Worker  /**
106*4d7e907cSAndroid Build Coastguard Worker   * Gets a HIDL interface object for the chip corresponding to the
107*4d7e907cSAndroid Build Coastguard Worker   * provided chipId.
108*4d7e907cSAndroid Build Coastguard Worker   *
109*4d7e907cSAndroid Build Coastguard Worker   * @return status WifiStatus of the operation.
110*4d7e907cSAndroid Build Coastguard Worker   *         Possible status codes:
111*4d7e907cSAndroid Build Coastguard Worker   *         |WifiStatusCode.SUCCESS|,
112*4d7e907cSAndroid Build Coastguard Worker   *         |WifiStatusCode.NOT_STARTED|,
113*4d7e907cSAndroid Build Coastguard Worker   *         |WifiStatusCode.UNKNOWN|
114*4d7e907cSAndroid Build Coastguard Worker   * @return chip HIDL interface object representing the chip.
115*4d7e907cSAndroid Build Coastguard Worker   */
116*4d7e907cSAndroid Build Coastguard Worker  @callflow(next={"*"})
117*4d7e907cSAndroid Build Coastguard Worker  getChip(ChipId chipId) generates (WifiStatus status, IWifiChip chip);
118*4d7e907cSAndroid Build Coastguard Worker};
119