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 #define LOG_TAG "GnssDebug"
18 
19 #include <log/log.h>
20 
21 #include "Constants.h"
22 #include "GnssDebug.h"
23 #include "MockLocation.h"
24 
25 using namespace ::android::hardware::gnss::common;
26 
27 namespace android {
28 namespace hardware {
29 namespace gnss {
30 namespace V1_1 {
31 namespace implementation {
32 
33 // Methods from ::android::hardware::gnss::V1_0::IGnssDebug follow.
getDebugData(V1_0::IGnssDebug::getDebugData_cb _hidl_cb)34 Return<void> GnssDebug::getDebugData(V1_0::IGnssDebug::getDebugData_cb _hidl_cb) {
35     PositionDebug positionDebug = {
36             .valid = true,
37             .latitudeDegrees = gMockLatitudeDegrees,
38             .longitudeDegrees = gMockLongitudeDegrees,
39             .altitudeMeters = gMockAltitudeMeters,
40             .speedMetersPerSec = gMockSpeedMetersPerSec,
41             .bearingDegrees = gMockBearingDegrees,
42             .horizontalAccuracyMeters = kMockHorizontalAccuracyMeters,
43             .verticalAccuracyMeters = kMockVerticalAccuracyMeters,
44             .speedAccuracyMetersPerSecond = kMockSpeedAccuracyMetersPerSecond,
45             .bearingAccuracyDegrees = kMockBearingAccuracyDegrees,
46             .ageSeconds = 0.99};
47 
48     TimeDebug timeDebug = {.timeEstimate = kMockTimestamp,
49                            .timeUncertaintyNs = 1000,
50                            .frequencyUncertaintyNsPerSec = 5.0e4};
51 
52     DebugData data = {.position = positionDebug, .time = timeDebug};
53 
54     _hidl_cb(data);
55 
56     return Void();
57 }
58 
59 }  // namespace implementation
60 }  // namespace V1_1
61 }  // namespace gnss
62 }  // namespace hardware
63 }  // namespace android
64