1 /*
2  * Copyright 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 #ifndef ANDROID_INCLUDE_DISTANCE_MEASUREMENT_INTERFACE_H
18 #define ANDROID_INCLUDE_DISTANCE_MEASUREMENT_INTERFACE_H
19 
20 #include <raw_address.h>
21 
22 /**
23  * Distance measurement callbacks related callbacks invoked from from the
24  * Bluetooth native stack All callbacks are invoked on the JNI thread
25  */
26 class DistanceMeasurementCallbacks {
27  public:
28   virtual ~DistanceMeasurementCallbacks() = default;
29   virtual void OnDistanceMeasurementStarted(RawAddress address,
30                                             uint8_t method) = 0;
31   virtual void OnDistanceMeasurementStartFail(RawAddress address,
32                                               uint8_t reason,
33                                               uint8_t method) = 0;
34   virtual void OnDistanceMeasurementStopped(RawAddress address, uint8_t reason,
35                                             uint8_t method) = 0;
36   virtual void OnDistanceMeasurementResult(
37       RawAddress address, uint32_t centimeter, uint32_t error_centimeter,
38       int azimuth_angle, int error_azimuth_angle, int altitude_angle,
39       int error_altitude_angle, uint8_t method) = 0;
40 };
41 
42 class DistanceMeasurementInterface {
43  public:
44   virtual ~DistanceMeasurementInterface() = default;
45   virtual void RegisterDistanceMeasurementCallbacks(
46       DistanceMeasurementCallbacks* callbacks) = 0;
47   virtual void StartDistanceMeasurement(RawAddress raw_address,
48                                         uint16_t interval, uint8_t method) = 0;
49   virtual void StopDistanceMeasurement(RawAddress raw_address,
50                                        uint8_t method) = 0;
51 };
52 
53 #endif /* ANDROID_INCLUDE_DISTANCE_MEASUREMENT_INTERFACE_H */
54