1 /* 2 * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. 3 * Not a Contribution 4 */ 5 /* 6 * Copyright (C) 2016 The Android Open Source Project 7 * 8 * Licensed under the Apache License, Version 2.0 (the "License"); 9 * you may not use this file except in compliance with the License. 10 * You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, software 15 * distributed under the License is distributed on an "AS IS" BASIS, 16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 * See the License for the specific language governing permissions and 18 * limitations under the License. 19 */ 20 21 #ifndef ANDROID_HARDWARE_GNSS_V1_1_GNSSNI_H 22 #define ANDROID_HARDWARE_GNSS_V1_1_GNSSNI_H 23 24 #include <android/hardware/gnss/1.0/IGnssNi.h> 25 #include <hidl/Status.h> 26 27 namespace android { 28 namespace hardware { 29 namespace gnss { 30 namespace V1_1 { 31 namespace implementation { 32 33 using ::android::hardware::gnss::V1_0::IGnssNi; 34 using ::android::hardware::gnss::V1_0::IGnssNiCallback; 35 using ::android::hardware::Return; 36 using ::android::hardware::Void; 37 using ::android::hardware::hidl_vec; 38 using ::android::hardware::hidl_string; 39 using ::android::sp; 40 41 struct Gnss; 42 struct GnssNi : public IGnssNi { 43 GnssNi(Gnss* gnss); 44 ~GnssNi() = default; 45 46 /* 47 * Methods from ::android::hardware::gnss::V1_0::IGnssNi follow. 48 * These declarations were generated from IGnssNi.hal. 49 */ 50 Return<void> setCallback(const sp<IGnssNiCallback>& callback) override; 51 Return<void> respond(int32_t notifId, 52 IGnssNiCallback::GnssUserResponseType userResponse) override; 53 54 private: 55 struct GnssNiDeathRecipient : hidl_death_recipient { GnssNiDeathRecipientGnssNi::GnssNiDeathRecipient56 GnssNiDeathRecipient(sp<GnssNi> gnssNi) : mGnssNi(gnssNi) { 57 } 58 ~GnssNiDeathRecipient() = default; 59 virtual void serviceDied(uint64_t cookie, const wp<IBase>& who) override; 60 sp<GnssNi> mGnssNi; 61 }; 62 63 private: 64 sp<GnssNiDeathRecipient> mGnssNiDeathRecipient = nullptr; 65 sp<IGnssNiCallback> mGnssNiCbIface = nullptr; 66 Gnss* mGnss = nullptr; 67 }; 68 69 } // namespace implementation 70 } // namespace V1_1 71 } // namespace gnss 72 } // namespace hardware 73 } // namespace android 74 75 #endif // ANDROID_HARDWARE_GNSS_V1_1_GNSSNI_H 76