• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 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_GNSSNAVIGATIONMESSAGE_H
18 #define _ANDROID_SERVER_GNSS_GNSSNAVIGATIONMESSAGE_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/IGnssNavigationMessage.h>
27 #include <android/hardware/gnss/BnGnssNavigationMessageInterface.h>
28 #include <log/log.h>
29 
30 #include "GnssNavigationMessageCallback.h"
31 #include "jni.h"
32 
33 namespace android::gnss {
34 
35 class GnssNavigationMessageInterface {
36 public:
~GnssNavigationMessageInterface()37     virtual ~GnssNavigationMessageInterface() {}
38     virtual jboolean setCallback(
39             const std::unique_ptr<GnssNavigationMessageCallback>& callback) = 0;
40     virtual jboolean close() = 0;
41 };
42 
43 class GnssNavigationMessageAidl : public GnssNavigationMessageInterface {
44 public:
45     GnssNavigationMessageAidl(const sp<android::hardware::gnss::IGnssNavigationMessageInterface>&
46                                       iGnssNavigationMessage);
47     jboolean setCallback(const std::unique_ptr<GnssNavigationMessageCallback>& callback) override;
48     jboolean close() override;
49 
50 private:
51     const sp<android::hardware::gnss::IGnssNavigationMessageInterface> mIGnssNavigationMessage;
52 };
53 
54 class GnssNavigationMessageHidl : public GnssNavigationMessageInterface {
55 public:
56     GnssNavigationMessageHidl(const sp<android::hardware::gnss::V1_0::IGnssNavigationMessage>&
57                                       iGnssNavigationMessage);
58     jboolean setCallback(const std::unique_ptr<GnssNavigationMessageCallback>& callback) override;
59     jboolean close() override;
60 
61 private:
62     const sp<android::hardware::gnss::V1_0::IGnssNavigationMessage> mIGnssNavigationMessageHidl;
63 };
64 
65 } // namespace android::gnss
66 
67 #endif // _ANDROID_SERVER_GNSS_GNSSNAVIGATIONMESSAGE_H
68