1 /*
2  * Copyright (C) 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.net.wifi.aware;
18 
19 import android.os.Handler;
20 
21 /**
22  * Base class for Aware attach callbacks. Should be extended by applications and set when calling
23  * {@link WifiAwareManager#attach(AttachCallback, android.os.Handler)}. These are callbacks
24  * applying to the Aware connection as a whole - not to specific publish or subscribe sessions -
25  * for that see {@link DiscoverySessionCallback}.
26  */
27 public class AttachCallback {
28     /**
29      * Called when Aware attach operation
30      * {@link WifiAwareManager#attach(AttachCallback, android.os.Handler)}
31      * is completed and that we can now start discovery sessions or connections.
32      *
33      * @param session The Aware object on which we can execute further Aware operations - e.g.
34      *                discovery, connections.
35      */
onAttached(WifiAwareSession session)36     public void onAttached(WifiAwareSession session) {
37         /* empty */
38     }
39 
40     /**
41      * Called when Aware attach operation
42      * {@link WifiAwareManager#attach(AttachCallback, android.os.Handler)} failed.
43      */
onAttachFailed()44     public void onAttachFailed() {
45         /* empty */
46     }
47 
48     /**
49      * Called when Aware attach session get from {@link #onAttached(WifiAwareSession)} is
50      * terminated. Use {@link WifiAwareManager#attach(AttachCallback, Handler)} or
51      * {@link WifiAwareManager#attach(AttachCallback, IdentityChangedListener, Handler)} to get a
52      * new active session.
53      */
onAwareSessionTerminated()54     public void onAwareSessionTerminated() {
55         /* empty */
56     }
57 }
58