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_SERVER_GNSS_GNSSANTENNAINFO_H 18 #define _ANDROID_SERVER_GNSS_GNSSANTENNAINFO_H 19 20 #pragma once 21 22 #ifndef LOG_TAG 23 #error LOG_TAG must be defined before including this file. 24 #endif 25 26 #include <android/hardware/gnss/2.1/IGnssAntennaInfo.h> 27 #include <android/hardware/gnss/BnGnssAntennaInfo.h> 28 #include <log/log.h> 29 30 #include "GnssAntennaInfoCallback.h" 31 #include "jni.h" 32 33 namespace android::gnss { 34 35 class GnssAntennaInfoInterface { 36 public: ~GnssAntennaInfoInterface()37 virtual ~GnssAntennaInfoInterface() {} 38 virtual jboolean setCallback(const std::unique_ptr<GnssAntennaInfoCallback>& callback) = 0; 39 virtual jboolean close() = 0; 40 }; 41 42 class GnssAntennaInfoAidl : public GnssAntennaInfoInterface { 43 public: 44 GnssAntennaInfoAidl(const sp<android::hardware::gnss::IGnssAntennaInfo>& iGnssAntennaInfo); 45 jboolean setCallback(const std::unique_ptr<GnssAntennaInfoCallback>& callback) override; 46 jboolean close() override; 47 48 private: 49 const sp<android::hardware::gnss::IGnssAntennaInfo> mIGnssAntennaInfoAidl; 50 }; 51 52 class GnssAntennaInfo_V2_1 : public GnssAntennaInfoInterface { 53 public: 54 GnssAntennaInfo_V2_1( 55 const sp<android::hardware::gnss::V2_1::IGnssAntennaInfo>& iGnssAntennaInfo); 56 jboolean setCallback(const std::unique_ptr<GnssAntennaInfoCallback>& callback) override; 57 jboolean close() override; 58 59 private: 60 const sp<android::hardware::gnss::V2_1::IGnssAntennaInfo> mIGnssAntennaInfo_V2_1; 61 }; 62 63 } // namespace android::gnss 64 65 #endif // _ANDROID_SERVER_GNSS_GNSSANTENNAINFO_H 66