1 2 /* 3 * Copyright (C) 2021 The Android Open Source Project 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 #ifndef android_hardware_gnss_common_default_DeviceFileReader_H_ 18 #define android_hardware_gnss_common_default_DeviceFileReader_H_ 19 20 #include <log/log.h> 21 #include <mutex> 22 #include <string> 23 #include <unordered_map> 24 #include "Constants.h" 25 #include "GnssReplayUtils.h" 26 27 namespace android { 28 namespace hardware { 29 namespace gnss { 30 namespace common { 31 class DeviceFileReader { 32 public: Instance()33 static DeviceFileReader& Instance() { 34 static DeviceFileReader reader; 35 return reader; 36 } 37 std::string getLocationData(); 38 std::string getGnssRawMeasurementData(); 39 void getDataFromDeviceFile(const std::string& command, int mMinIntervalMs); 40 41 private: 42 DeviceFileReader(); 43 ~DeviceFileReader(); 44 std::unordered_map<std::string, std::string> data_; 45 std::string s_buffer_; 46 std::mutex mMutex; 47 }; 48 } // namespace common 49 } // namespace gnss 50 } // namespace hardware 51 } // namespace android 52 53 #endif // android_hardware_gnss_common_default_DeviceFileReader_H_