AGnss.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * Copyright (c) 2017-2019, 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. #ifndef ANDROID_HARDWARE_GNSS_V2_0_AGNSS_H
  21. #define ANDROID_HARDWARE_GNSS_V2_0_AGNSS_H
  22. #include <mutex>
  23. #include <android/hardware/gnss/2.0/IAGnss.h>
  24. #include <hidl/Status.h>
  25. #include <gps_extended_c.h>
  26. namespace android {
  27. namespace hardware {
  28. namespace gnss {
  29. namespace V2_0 {
  30. namespace implementation {
  31. using ::android::hardware::Return;
  32. using ::android::hardware::Void;
  33. using ::android::hardware::hidl_vec;
  34. using ::android::hardware::hidl_string;
  35. using ::android::sp;
  36. struct Gnss;
  37. struct AGnss : public V2_0::IAGnss {
  38. AGnss(Gnss* gnss);
  39. ~AGnss();
  40. /*
  41. * Methods from ::android::hardware::gnss::V2_0::IAGnss interface follow.
  42. * These declarations were generated from IAGnss.hal.
  43. */
  44. Return<void> setCallback(const sp<V2_0::IAGnssCallback>& callback) override;
  45. Return<bool> dataConnClosed() override;
  46. Return<bool> dataConnFailed() override;
  47. Return<bool> dataConnOpen(uint64_t networkHandle, const hidl_string& apn,
  48. V2_0::IAGnss::ApnIpType apnIpType) override;
  49. Return<bool> setServer(V2_0::IAGnssCallback::AGnssType type,
  50. const hidl_string& hostname, int32_t port) override;
  51. void statusCb(AGpsExtType type, LocAGpsStatusValue status);
  52. /* Data call setup callback passed down to GNSS HAL implementation */
  53. static void agnssStatusIpV4Cb(AGnssExtStatusIpV4 status);
  54. private:
  55. Gnss* mGnss = nullptr;
  56. std::mutex mMutex;
  57. sp<IAGnssCallback> mAGnssCbIface = nullptr;
  58. };
  59. } // namespace implementation
  60. } // namespace V2_0
  61. } // namespace gnss
  62. } // namespace hardware
  63. } // namespace android
  64. #endif // ANDROID_HARDWARE_GNSS_V2_0_AGNSS_H