1 /*
2  * Copyright (C) 2022 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 androidx.core.uwb.backend.impl.internal;
18 
19 import androidx.annotation.IntDef;
20 
21 /** Callbacks used by startRanging. */
22 public interface RangingSessionCallback {
23 
24     /** Callback when a ranging session has been initiated. */
onRangingInitialized(UwbDevice device)25     void onRangingInitialized(UwbDevice device);
26 
27     /** Callback when a ranging device's position is received. */
onRangingResult(UwbDevice device, RangingPosition position)28     void onRangingResult(UwbDevice device, RangingPosition position);
29 
30     /** Callback when a session has been suspended. */
onRangingSuspended(UwbDevice device, @RangingSuspendedReason int reason)31     void onRangingSuspended(UwbDevice device, @RangingSuspendedReason int reason);
32 
33     /** Reason why ranging was stopped. */
34     @IntDef({
35             REASON_UNKNOWN,
36             REASON_WRONG_PARAMETERS,
37             REASON_FAILED_TO_START,
38             REASON_STOPPED_BY_PEER,
39             REASON_STOP_RANGING_CALLED,
40             REASON_MAX_RANGING_ROUND_RETRY_REACHED,
41             REASON_SYSTEM_POLICY,
42     })
43     @interface RangingSuspendedReason {
44     }
45 
46     int REASON_UNKNOWN = 0;
47     int REASON_WRONG_PARAMETERS = 1;
48     int REASON_FAILED_TO_START = 2;
49     int REASON_STOPPED_BY_PEER = 3;
50     int REASON_STOP_RANGING_CALLED = 4;
51     int REASON_MAX_RANGING_ROUND_RETRY_REACHED = 5;
52     int REASON_SYSTEM_POLICY = 6;
53 }
54