1 /*
2  * Copyright (C) 2021 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_hardware_gnss_common_default_GnssRawMeasurementParser_H_
18 #define android_hardware_gnss_common_default_GnssRawMeasurementParser_H_
19 
20 #include <aidl/android/hardware/gnss/BnGnss.h>
21 #include <log/log.h>
22 #include <utils/SystemClock.h>
23 #include <string>
24 #include <unordered_map>
25 
26 #include "Constants.h"
27 #include "ParseUtils.h"
28 
29 namespace android {
30 namespace hardware {
31 namespace gnss {
32 namespace common {
33 
34 struct GnssRawMeasurementParser {
35     static std::unique_ptr<aidl::android::hardware::gnss::GnssData> getMeasurementFromStrs(
36             std::string& rawMeasurementStr);
37     static int getClockFlags(const std::vector<std::string>& rawMeasurementRecordValues,
38                              const std::unordered_map<std::string, int>& columnNameIdMapping);
39     static int getElapsedRealtimeFlags(
40             const std::vector<std::string>& rawMeasurementRecordValues,
41             const std::unordered_map<std::string, int>& columnNameIdMapping);
42     static int getRawMeasurementFlags(
43             const std::vector<std::string>& rawMeasurementRecordValues,
44             const std::unordered_map<std::string, int>& columnNameIdMapping);
45     static std::unordered_map<std::string, int> getColumnIdNameMappingFromHeader(
46             const std::string& header);
47     static aidl::android::hardware::gnss::GnssConstellationType getGnssConstellationType(
48             int constellationType);
49 };
50 
51 }  // namespace common
52 }  // namespace gnss
53 }  // namespace hardware
54 }  // namespace android
55 
56 #endif  // android_hardware_gnss_common_default_GnssRawMeasurementParser_H_