Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 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 | |
| 17 | package android.hardware.wifi@1.0; |
| 18 | |
| 19 | import IWifiChip; |
| 20 | import 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 | interface IWifi { |
| 28 | /** |
| 29 | * Requests notifications of significant events for the HAL. Multiple calls to |
| 30 | * this must register multiple callbacks each of which must receive all |
Roshan Pius | 6f31d92 | 2016-10-04 15:08:05 -0700 | [diff] [blame] | 31 | * events. |IWifiEventCallback| object registration must be independent of the |
| 32 | * state of the rest of the HAL and must persist though stops/starts. These |
| 33 | * objects must be deleted when the corresponding client process is dead. |
| 34 | * |
| 35 | * @param callback An instance of the |IWifiEventCallback| HIDL interface |
| 36 | * object. |
Roshan Pius | 02caa1b | 2016-10-26 15:56:17 -0700 | [diff] [blame^] | 37 | * @return status WifiStatus of the operation. |
| 38 | * Possible status codes: |
| 39 | * |WifiStatusCode.SUCCESS|, |
| 40 | * |WifiStatusCode.UNKNOWN| |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 41 | */ |
| 42 | @entry |
| 43 | @callflow(next={"*"}) |
Roshan Pius | 02caa1b | 2016-10-26 15:56:17 -0700 | [diff] [blame^] | 44 | registerEventCallback(IWifiEventCallback callback) |
| 45 | generates (WifiStatus status); |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 46 | |
| 47 | /** |
| 48 | * Get the current state of the HAL. |
Roshan Pius | 6f31d92 | 2016-10-04 15:08:05 -0700 | [diff] [blame] | 49 | * |
| 50 | * @return started true if started, false otherwise. |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 51 | */ |
| 52 | isStarted() generates (bool started); |
| 53 | |
| 54 | /** |
| 55 | * Perform any setup that is required to make use of the module. If the module |
Roshan Pius | a52dc73 | 2016-10-10 11:53:07 -0700 | [diff] [blame] | 56 | * is already started then this must be a noop. |
| 57 | * Must trigger |IWifiEventCallback.onStart| on success. |
| 58 | * |
| 59 | * @return status WifiStatus of the operation. |
| 60 | * Possible status codes: |
| 61 | * |WifiStatusCode.SUCCESS|, |
| 62 | * |WifiStatusCode.NOT_AVAILABLE|, |
| 63 | * |WifiStatusCode.UNKNOWN| |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 64 | */ |
| 65 | @entry |
| 66 | @callflow(next={"registerEventCallback", "start", "stop", "getChip"}) |
Roshan Pius | a52dc73 | 2016-10-10 11:53:07 -0700 | [diff] [blame] | 67 | start() generates (WifiStatus status); |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 68 | |
| 69 | /** |
| 70 | * Tear down any state, ongoing commands, etc. If the module is already |
| 71 | * stopped then this must be a noop. If the HAL is already stopped or it |
Roshan Pius | a52dc73 | 2016-10-10 11:53:07 -0700 | [diff] [blame] | 72 | * succeeds then onStop must be called. After calling this all IWifiChip |
| 73 | * objects will be considered invalid. |
| 74 | * Must trigger |IWifiEventCallback.onStop| on success. |
| 75 | * Must trigger |IWifiEventCallback.onFailure| on failure. |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 76 | * |
| 77 | * Calling stop then start is a valid way of resetting state in the HAL, |
| 78 | * driver, firmware. |
Roshan Pius | a52dc73 | 2016-10-10 11:53:07 -0700 | [diff] [blame] | 79 | * |
| 80 | * @return status WifiStatus of the operation. |
| 81 | * Possible status codes: |
| 82 | * |WifiStatusCode.SUCCESS|, |
Roshan Pius | 02caa1b | 2016-10-26 15:56:17 -0700 | [diff] [blame^] | 83 | * |WifiStatusCode.NOT_STARTED|, |
Roshan Pius | a52dc73 | 2016-10-10 11:53:07 -0700 | [diff] [blame] | 84 | * |WifiStatusCode.UNKNOWN| |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 85 | */ |
| 86 | @exit |
| 87 | @callflow(next={"registerEventCallback", "start", "stop"}) |
Roshan Pius | a52dc73 | 2016-10-10 11:53:07 -0700 | [diff] [blame] | 88 | stop() generates (WifiStatus status); |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 89 | |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 90 | /** |
Roshan Pius | adcfba4 | 2016-10-05 10:19:06 -0700 | [diff] [blame] | 91 | * Retrieve the list of all chip Id's on the device. |
| 92 | * The corresponding |IWifiChip| object for any chip can be |
| 93 | * retrieved using |getChip| method. |
| 94 | * |
Roshan Pius | 02caa1b | 2016-10-26 15:56:17 -0700 | [diff] [blame^] | 95 | * @return status WifiStatus of the operation. |
| 96 | * Possible status codes: |
| 97 | * |WifiStatusCode.SUCCESS|, |
| 98 | * |WifiStatusCode.NOT_STARTED|, |
| 99 | * |WifiStatusCode.UNKNOWN| |
Roshan Pius | adcfba4 | 2016-10-05 10:19:06 -0700 | [diff] [blame] | 100 | * @return chipIds List of all chip Id's on the device. |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 101 | */ |
| 102 | @callflow(next={"*"}) |
Roshan Pius | 02caa1b | 2016-10-26 15:56:17 -0700 | [diff] [blame^] | 103 | getChipIds() generates (WifiStatus status, vec<ChipId> chipIds); |
Roshan Pius | adcfba4 | 2016-10-05 10:19:06 -0700 | [diff] [blame] | 104 | |
| 105 | /** |
| 106 | * Gets a HIDL interface object for the chip corresponding to the |
| 107 | * provided chipId. |
| 108 | * |
Roshan Pius | 02caa1b | 2016-10-26 15:56:17 -0700 | [diff] [blame^] | 109 | * @return status WifiStatus of the operation. |
| 110 | * Possible status codes: |
| 111 | * |WifiStatusCode.SUCCESS|, |
| 112 | * |WifiStatusCode.NOT_STARTED|, |
| 113 | * |WifiStatusCode.UNKNOWN| |
Roshan Pius | adcfba4 | 2016-10-05 10:19:06 -0700 | [diff] [blame] | 114 | * @return chip HIDL interface object representing the chip. |
| 115 | */ |
| 116 | @callflow(next={"*"}) |
Roshan Pius | 02caa1b | 2016-10-26 15:56:17 -0700 | [diff] [blame^] | 117 | getChip(ChipId chipId) generates (WifiStatus status, IWifiChip chip); |
Mitchell Wills | 5443a9f | 2016-08-18 11:44:58 -0700 | [diff] [blame] | 118 | }; |