Gnss.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*
  2. * Copyright (c) 2021, The Linux Foundation. All rights reserved.
  3. * Not a Contribution
  4. */
  5. /*
  6. * Copyright (C) 2020 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_AIDL_GNSS_H
  21. #define ANDROID_HARDWARE_GNSS_AIDL_GNSS_H
  22. #include <aidl/android/hardware/gnss/BnGnss.h>
  23. #include <aidl/android/hardware/gnss/IGnssCallback.h>
  24. #include <aidl/android/hardware/gnss/BnGnssPowerIndication.h>
  25. #include <aidl/android/hardware/gnss/BnGnssMeasurementInterface.h>
  26. #include <aidl/android/hardware/gnss/BnGnssConfiguration.h>
  27. #include <aidl/android/hardware/gnss/BnGnssPsds.h>
  28. #include "location_api/GnssAPIClient.h"
  29. #include "GnssConfiguration.h"
  30. #include "GnssPowerIndication.h"
  31. #include "GnssMeasurementInterface.h"
  32. namespace android {
  33. namespace hardware {
  34. namespace gnss {
  35. namespace aidl {
  36. namespace implementation {
  37. using ::aidl::android::hardware::gnss::GnssConstellationType;
  38. using ::aidl::android::hardware::gnss::BnGnss;
  39. using ::aidl::android::hardware::gnss::IGnssCallback;
  40. using ::aidl::android::hardware::gnss::IGnssPowerIndication;
  41. using ::aidl::android::hardware::gnss::IGnssMeasurementInterface;
  42. using ::std::shared_ptr;
  43. struct Gnss : public BnGnss {
  44. Gnss();
  45. ~Gnss();
  46. ndk::ScopedAStatus setCallback(const shared_ptr<IGnssCallback>& callback) override;
  47. ndk::ScopedAStatus close() override;
  48. ::ndk::ScopedAStatus getExtensionPsds(
  49. shared_ptr<::aidl::android::hardware::gnss::IGnssPsds>* _aidl_return) override {
  50. return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
  51. }
  52. ::ndk::ScopedAStatus getExtensionGnssConfiguration(
  53. shared_ptr<::aidl::android::hardware::gnss::IGnssConfiguration>* _aidl_return) override;
  54. ::ndk::ScopedAStatus getExtensionGnssPowerIndication(
  55. shared_ptr<IGnssPowerIndication>* _aidl_return) override;
  56. ::ndk::ScopedAStatus getExtensionGnssMeasurement(
  57. shared_ptr<IGnssMeasurementInterface>* _aidl_return) override;
  58. // These methods are not part of the IGnss base class.
  59. GnssAPIClient* getApi();
  60. ndk::ScopedAStatus updateConfiguration(GnssConfig& gnssConfig);
  61. void handleClientDeath();
  62. private:
  63. GnssAPIClient* mApi;
  64. shared_ptr<GnssConfiguration> mGnssConfiguration = nullptr;
  65. shared_ptr<GnssPowerIndication> mGnssPowerIndication = nullptr;
  66. shared_ptr<GnssMeasurementInterface> mGnssMeasurementInterface = nullptr;
  67. GnssConfig mPendingConfig;
  68. shared_ptr<IGnssCallback> mGnssCallback = nullptr;
  69. };
  70. } // namespace implementation
  71. } // namespace aidl
  72. } // namespace gnss
  73. } // namespace hardware
  74. } // namespace android
  75. #endif // ANDROID_HARDWARE_GNSS_AIDL_GNSS_H