AGnss.h 2.4 KB

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