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
17package android.hardware.wifi.supplicant@1.0;
18
19import ISupplicantCallback;
20import ISupplicantIface;
21
22/**
23 * Interface exposed by the supplicant HIDL service registered
24 * with the hardware service manager.
25 * This is the root level object for any the supplicant interactions.
26 */
27interface ISupplicant {
28  /**
29   * Debug levels for the supplicant.
30   * Only log messages with a level greater than the set level
31   * (via |setDebugParams|) will be logged.
32   */
33  enum DebugLevel : uint32_t {
34    EXCESSIVE = 0,
35    MSGDUMP = 1,
36    DEBUG = 2,
37    INFO = 3,
38    WARNING = 4,
39    ERROR = 5
40  };
41
42  /**
43   * Structure describing the type and name of an iface
44   * controlled by the supplicant.
45   */
46  struct IfaceInfo {
47    /**
48     * Type of the network interface.
49     */
50    IfaceType type;
51    /**
52     * Name of the network interface, e.g., wlan0
53     */
54    string name;
55  };
56
57  /**
58   * Gets a HIDL interface object for the interface corresponding to iface
59   * name which the supplicant already controls.
60   *
61   * @param ifaceInfo Combination of the iface type and name retrieved
62   *        using |listInterfaces|.
63   * @return status Status of the operation.
64   *         Possible status codes:
65   *         |SupplicantStatusCode.SUCCESS|,
66   *         |SupplicantStatusCode.FAILURE_UNKNOWN|,
67   *         |SupplicantStatusCode.FAILURE_IFACE_UNKOWN|
68   * @return iface HIDL interface object representing the interface if
69   *         successful, null otherwise.
70   */
71  getInterface(IfaceInfo ifaceInfo)
72      generates (SupplicantStatus status, ISupplicantIface iface);
73
74  /**
75   * Retrieve a list of all the interfaces controlled by the supplicant.
76   *
77   * The corresponding |ISupplicantIface| object for any interface can be
78   * retrieved using |getInterface| method.
79   *
80   * @return status Status of the operation.
81   *         Possible status codes:
82   *         |SupplicantStatusCode.SUCCESS|,
83   *         |SupplicantStatusCode.FAILURE_UNKNOWN|
84   * @return ifaces List of all interfaces controlled by the supplicant.
85   */
86  listInterfaces() generates (SupplicantStatus status, vec<IfaceInfo> ifaces);
87
88  /**
89   * Register for callbacks from the supplicant service.
90   *
91   * These callbacks are invoked for global events that are not specific
92   * to any interface or network. Registration of multiple callback
93   * objects is supported. These objects must be deleted when the corresponding
94   * client process is dead.
95   *
96   * @param callback An instance of the |ISupplicantCallback| HIDL interface
97   *        object.
98   * @return status Status of the operation.
99   *         Possible status codes:
100   *         |SupplicantStatusCode.SUCCESS|,
101   *         |SupplicantStatusCode.FAILURE_UNKNOWN|
102   */
103  registerCallback(ISupplicantCallback callback)
104      generates (SupplicantStatus status);
105
106  /**
107   * Set debug parameters for the supplicant.
108   *
109   * @param level Debug logging level for the supplicant.
110   *        (one of |DebugLevel| values).
111   * @param timestamp Determines whether to show timestamps in logs or
112   *        not.
113   * @param showKeys Determines whether to show keys in debug logs or
114   *        not.
115   *        CAUTION: Do not set this param in production code!
116   * @return status Status of the operation.
117   *         Possible status codes:
118   *         |SupplicantStatusCode.SUCCESS|,
119   *         |SupplicantStatusCode.FAILURE_UNKNOWN|
120   */
121  setDebugParams(DebugLevel level, bool showTimestamp, bool showKeys)
122      generates (SupplicantStatus status);
123
124  /**
125   * Get the debug level set.
126   *
127   * @return level one of |DebugLevel| values.
128   */
129  getDebugLevel() generates (DebugLevel level);
130
131  /**
132   * Get whether the timestamps are shown in the debug logs or not.
133   *
134   * @return enabled true if set, false otherwise.
135   */
136  isDebugShowTimestampEnabled() generates (bool enabled);
137
138  /**
139   * Get whether the keys are shown in the debug logs or not.
140   *
141   * @return enabled true if set, false otherwise.
142   */
143  isDebugShowKeysEnabled() generates (bool enabled);
144
145  /**
146   * Set concurrency priority.
147   *
148   * When both P2P and STA mode ifaces are active, this must be used
149   * to prioritize either STA or P2P connection to resolve conflicts
150   * arising during single channel concurrency.
151   *
152   * @param type The type of iface to prioritize.
153   * @return status Status of the operation.
154   *         Possible status codes:
155   *         |SupplicantStatusCode.SUCCESS|,
156   *         |SupplicantStatusCode.FAILURE_UNKNOWN|
157   */
158  setConcurrencyPriority(IfaceType type) generates (SupplicantStatus status);
159};
160