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