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