1 /*
2 * Copyright (C) 2019 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 #include <Constants.h>
18 #include <Utils.h>
19
20 namespace android {
21 namespace hardware {
22 namespace gnss {
23 namespace common {
24
25 using GnssSvFlags = V1_0::IGnssCallback::GnssSvFlags;
26
getMockLocation()27 GnssLocation Utils::getMockLocation() {
28 GnssLocation location = {.gnssLocationFlags = 0xFF,
29 .latitudeDegrees = kMockLatitudeDegrees,
30 .longitudeDegrees = kMockLongitudeDegrees,
31 .altitudeMeters = kMockAltitudeMeters,
32 .speedMetersPerSec = kMockSpeedMetersPerSec,
33 .bearingDegrees = kMockBearingDegrees,
34 .horizontalAccuracyMeters = kMockHorizontalAccuracyMeters,
35 .verticalAccuracyMeters = kMockVerticalAccuracyMeters,
36 .speedAccuracyMetersPerSecond = kMockSpeedAccuracyMetersPerSecond,
37 .bearingAccuracyDegrees = kMockBearingAccuracyDegrees,
38 .timestamp = kMockTimestamp};
39 return location;
40 }
41
getSvInfo(int16_t svid,GnssConstellationType type,float cN0DbHz,float elevationDegrees,float azimuthDegrees)42 GnssSvInfo Utils::getSvInfo(int16_t svid, GnssConstellationType type, float cN0DbHz,
43 float elevationDegrees, float azimuthDegrees) {
44 GnssSvInfo svInfo = {.svid = svid,
45 .constellation = type,
46 .cN0Dbhz = cN0DbHz,
47 .elevationDegrees = elevationDegrees,
48 .azimuthDegrees = azimuthDegrees,
49 .svFlag = GnssSvFlags::USED_IN_FIX | GnssSvFlags::HAS_EPHEMERIS_DATA |
50 GnssSvFlags::HAS_ALMANAC_DATA};
51 return svInfo;
52 }
53
54 } // namespace common
55 } // namespace gnss
56 } // namespace hardware
57 } // namespace android
58