• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 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.system.wifi.mainline_supplicant;
18 
19 import android.system.wifi.mainline_supplicant.UsdMessageInfo;
20 import android.system.wifi.mainline_supplicant.UsdServiceProtoType;
21 
22 /**
23  * Callback interface exposed by the mainline supplicant service
24  * for each station mode interface (IStaInterface).
25  *
26  * Clients need to host an instance of this AIDL interface object and
27  * pass a reference of the object to the mainline supplicant via the
28  * corresponding |IStaInterface.registerCallback| method.
29  */
30 interface IStaInterfaceCallback {
31     /**
32      * Information about a USD discovery session with a specific peer.
33      */
34     @VintfStability
35     parcelable UsdServiceDiscoveryInfo {
36         /**
37          * Identifier for this device.
38          */
39         int ownId;
40 
41         /**
42          * Identifier for the discovered peer device.
43          */
44         int peerId;
45 
46         /**
47          * MAC address of the discovered peer device.
48          */
49         byte[6] peerMacAddress;
50 
51         /**
52          * Match filter from the discovery packet (publish or subscribe) which caused service
53          * discovery.
54          */
55         byte[] matchFilter;
56 
57         /**
58          * Service protocol that is being used (ex. Generic, CSA Matter).
59          */
60         UsdServiceProtoType serviceProtoType;
61 
62         /**
63          * Arbitrary service specific information communicated in discovery packets.
64          * There is no semantic meaning to these bytes. They are passed-through from publisher to
65          * subscriber as-is with no parsing.
66          */
67         byte[] serviceSpecificInfo;
68 
69         /**
70          * Whether Further Service Discovery (FSD) is enabled.
71          */
72         boolean isFsd;
73     }
74 
75     /**
76      * Codes indicating the reason for terminating a USD session.
77      * Returned by |onUsdPublishTerminated| and |onUsdSubscribeTerminated|.
78      */
79     @Backing(type="int")
80     enum UsdTerminateReasonCode {
81         /**
82          * Unknown failure occurred.
83          */
84         FAILURE_UNKNOWN = 0,
85 
86         /**
87          * The operation timed out.
88          */
89         TIMEOUT = 1,
90 
91         /**
92          * The operation was requested by the user.
93          */
94         USER_REQUESTED = 2,
95 
96         /**
97          * Invalid arguments were provided.
98          */
99         INVALID_ARGS = 3
100     }
101 
102     /**
103      * Error codes returned by |onUsdPublishConfigFailed| and |onUsdSubscribeConfigFailed|.
104      */
105     @Backing(type="int")
106     enum UsdConfigErrorCode {
107         /**
108          * Unknown failure.
109          */
110         FAILURE_UNKNOWN = 0,
111         /**
112          * The requested operation timed out.
113          */
114         FAILURE_TIMEOUT = 1,
115         /**
116          * The requested operation is currently not available.
117          */
118         FAILURE_NOT_AVAILABLE = 2,
119     }
120 
121     /**
122      * Called in response to |IUsdInterface.startPublish| to indicate that the
123      * publish session was started successfully.
124      *
125      * @param cmdId Identifier for the original request.
126      * @param publishId Identifier for the publish session.
127      */
onUsdPublishStarted(in int cmdId, in int publishId)128     void onUsdPublishStarted(in int cmdId, in int publishId);
129 
130     /**
131      * Called in response to |IUsdInterface.startSubscribe| to indicate that the
132      * subscribe session was started successfully.
133      *
134      * @param cmdId Identifier for the original request.
135      * @param subscribeId Identifier for the subscribe session.
136      */
onUsdSubscribeStarted(in int cmdId, in int subscribeId)137     void onUsdSubscribeStarted(in int cmdId, in int subscribeId);
138 
139     /**
140      * Called in response to |IUsdInterface.startPublish| to indicate that the
141      * publish session could not be configured.
142      *
143      * @param cmdId Identifier for the original request.
144      * @param errorCode Code indicating the failure reason.
145      */
onUsdPublishConfigFailed(in int cmdId, in UsdConfigErrorCode errorCode)146     void onUsdPublishConfigFailed(in int cmdId, in UsdConfigErrorCode errorCode);
147 
148     /**
149      * Called in response to |IUsdInterface.startSubscribe| to indicate that the
150      * subscribe session could not be configured.
151      *
152      * @param cmdId Identifier for the original request.
153      * @param errorCode Code indicating the failure reason.
154      */
onUsdSubscribeConfigFailed(in int cmdId, in UsdConfigErrorCode errorCode)155     void onUsdSubscribeConfigFailed(in int cmdId, in UsdConfigErrorCode errorCode);
156 
157     /**
158      * Called in response to |IUsdInterface.cancelPublish| to indicate that the session
159      * was cancelled successfully. May also be called unsolicited if the session terminated
160      * by supplicant.
161      *
162      * @param publishId Identifier for the publish session.
163      * @param reasonCode Code indicating the reason for the session cancellation.
164      */
onUsdPublishTerminated(in int publishId, in UsdTerminateReasonCode reasonCode)165     void onUsdPublishTerminated(in int publishId, in UsdTerminateReasonCode reasonCode);
166 
167     /**
168      * Called in response to |IUsdInterface.cancelSubscribe| to indicate that the session
169      * was cancelled successfully. May also be called unsolicited if the session terminated
170      * by supplicant.
171      *
172      * @param subscribeId Identifier for the subscribe session.
173      * @param reasonCode Code indicating the reason for the session cancellation.
174      */
onUsdSubscribeTerminated(in int subscribeId, in UsdTerminateReasonCode reasonCode)175     void onUsdSubscribeTerminated(in int subscribeId, in UsdTerminateReasonCode reasonCode);
176 
177     /**
178      * Indicates that the publisher sent solicited publish message to the subscriber.
179      *
180      * @param info Instance of |UsdServiceDiscoveryInfo| containing information about the reply.
181      */
onUsdPublishReplied(in UsdServiceDiscoveryInfo info)182     void onUsdPublishReplied(in UsdServiceDiscoveryInfo info);
183 
184     /**
185      * Indicates that a publisher was discovered. Only called if this device is acting as a
186      * subscriber.
187      *
188      * @param info Instance of |UsdServiceDiscoveryInfo| containing information about the service.
189      */
onUsdServiceDiscovered(in UsdServiceDiscoveryInfo info)190     void onUsdServiceDiscovered(in UsdServiceDiscoveryInfo info);
191 
192     /**
193      * Indicates that a message was received on an active USD link.
194      *
195      * @param messageInfo Information about the message that was received.
196      */
onUsdMessageReceived(in UsdMessageInfo messageInfo)197     void onUsdMessageReceived(in UsdMessageInfo messageInfo);
198 }
199