• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef _ANDROID_SERVER_GNSS_GNSSPSDS_H
18 #define _ANDROID_SERVER_GNSS_GNSSPSDS_H
19 
20 #pragma once
21 
22 #ifndef LOG_TAG
23 #error LOG_TAG must be defined before including this file.
24 #endif
25 
26 #include <android/hardware/gnss/1.0/IGnssXtra.h>
27 #include <android/hardware/gnss/BnGnssPsds.h>
28 #include <log/log.h>
29 
30 #include "GnssPsdsCallback.h"
31 #include "jni.h"
32 
33 namespace android::gnss {
34 
35 class GnssPsdsInterface {
36 public:
~GnssPsdsInterface()37     virtual ~GnssPsdsInterface() {}
38     virtual jboolean setCallback(const std::unique_ptr<GnssPsdsCallback>& callback);
39     virtual void injectPsdsData(const jbyteArray& data, const jint& length, const jint& psdsType);
40 };
41 
42 class GnssPsdsAidl : public GnssPsdsInterface {
43 public:
44     GnssPsdsAidl(const sp<android::hardware::gnss::IGnssPsds>& iGnssPsds);
45     jboolean setCallback(const std::unique_ptr<GnssPsdsCallback>& callback) override;
46     void injectPsdsData(const jbyteArray& data, const jint& length, const jint& psdsType) override;
47 
48 private:
49     const sp<android::hardware::gnss::IGnssPsds> mIGnssPsds;
50 };
51 
52 class GnssPsdsHidl : public GnssPsdsInterface {
53 public:
54     GnssPsdsHidl(const sp<android::hardware::gnss::V1_0::IGnssXtra>& iGnssXtra);
55     jboolean setCallback(const std::unique_ptr<GnssPsdsCallback>& callback) override;
56     void injectPsdsData(const jbyteArray& data, const jint& length, const jint& psdsType) override;
57 
58 private:
59     const sp<android::hardware::gnss::V1_0::IGnssXtra> mIGnssXtra;
60 };
61 
62 } // namespace android::gnss
63 
64 #endif // _ANDROID_SERVER_GNSS_GNSSPSDS_H
65