AGnss.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * Copyright (c) 2017-2020, 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_1 {
  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. using ::android::hardware::gnss::V2_0::IAGnssCallback;
  37. struct Gnss;
  38. struct AGnss : public V2_0::IAGnss {
  39. AGnss(Gnss* gnss);
  40. ~AGnss();
  41. /*
  42. * Methods from ::android::hardware::gnss::V2_0::IAGnss interface follow.
  43. * These declarations were generated from IAGnss.hal.
  44. */
  45. Return<void> setCallback(const sp<V2_0::IAGnssCallback>& callback) override;
  46. Return<bool> dataConnClosed() override;
  47. Return<bool> dataConnFailed() override;
  48. Return<bool> dataConnOpen(uint64_t networkHandle, const hidl_string& apn,
  49. V2_0::IAGnss::ApnIpType apnIpType) override;
  50. Return<bool> setServer(V2_0::IAGnssCallback::AGnssType type,
  51. const hidl_string& hostname, int32_t port) override;
  52. void statusCb(AGpsExtType type, LocAGpsStatusValue status);
  53. /* Data call setup callback passed down to GNSS HAL implementation */
  54. static void agnssStatusIpV4Cb(AGnssExtStatusIpV4 status);
  55. private:
  56. Gnss* mGnss = nullptr;
  57. std::mutex mMutex;
  58. sp<V2_0::IAGnssCallback> mAGnssCbIface = nullptr;
  59. AGpsExtType mType;
  60. };
  61. } // namespace implementation
  62. } // namespace V2_1
  63. } // namespace gnss
  64. } // namespace hardware
  65. } // namespace android
  66. #endif // ANDROID_HARDWARE_GNSS_V2_0_AGNSS_H