Yu-Han Yang | 9c6c20b | 2018-11-06 14:12:49 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2018 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 | #define LOG_TAG "Gnss" |
| 18 | |
| 19 | #include "Gnss.h" |
| 20 | #include <log/log.h> |
| 21 | |
| 22 | namespace android { |
| 23 | namespace hardware { |
| 24 | namespace gnss { |
| 25 | namespace V2_0 { |
| 26 | namespace implementation { |
| 27 | |
| 28 | sp<V1_1::IGnssCallback> Gnss::sGnssCallback = nullptr; |
| 29 | |
| 30 | // Methods from V1_0::IGnss follow. |
| 31 | Return<bool> Gnss::setCallback(const sp<V1_0::IGnssCallback>&) { |
| 32 | // TODO implement |
| 33 | return bool{}; |
| 34 | } |
| 35 | |
| 36 | Return<bool> Gnss::start() { |
| 37 | // TODO implement |
| 38 | return bool{}; |
| 39 | } |
| 40 | |
| 41 | Return<bool> Gnss::stop() { |
| 42 | // TODO implement |
| 43 | return bool{}; |
| 44 | } |
| 45 | |
| 46 | Return<void> Gnss::cleanup() { |
| 47 | // TODO implement |
| 48 | return Void(); |
| 49 | } |
| 50 | |
| 51 | Return<bool> Gnss::injectTime(int64_t, int64_t, int32_t) { |
| 52 | // TODO implement |
| 53 | return bool{}; |
| 54 | } |
| 55 | |
| 56 | Return<bool> Gnss::injectLocation(double, double, float) { |
| 57 | // TODO implement |
| 58 | return bool{}; |
| 59 | } |
| 60 | |
| 61 | Return<void> Gnss::deleteAidingData(V1_0::IGnss::GnssAidingData) { |
| 62 | // TODO implement |
| 63 | return Void(); |
| 64 | } |
| 65 | |
| 66 | Return<bool> Gnss::setPositionMode(V1_0::IGnss::GnssPositionMode, |
| 67 | V1_0::IGnss::GnssPositionRecurrence, uint32_t, uint32_t, |
| 68 | uint32_t) { |
| 69 | // TODO implement |
| 70 | return bool{}; |
| 71 | } |
| 72 | |
| 73 | Return<sp<V1_0::IAGnssRil>> Gnss::getExtensionAGnssRil() { |
| 74 | // TODO implement |
| 75 | return sp<V1_0::IAGnssRil>{}; |
| 76 | } |
| 77 | |
| 78 | Return<sp<V1_0::IGnssGeofencing>> Gnss::getExtensionGnssGeofencing() { |
| 79 | // TODO implement |
| 80 | return sp<V1_0::IGnssGeofencing>{}; |
| 81 | } |
| 82 | |
| 83 | Return<sp<V1_0::IAGnss>> Gnss::getExtensionAGnss() { |
| 84 | // TODO implement |
| 85 | return sp<V1_0::IAGnss>{}; |
| 86 | } |
| 87 | |
| 88 | Return<sp<V1_0::IGnssNi>> Gnss::getExtensionGnssNi() { |
| 89 | // TODO implement |
| 90 | return sp<V1_0::IGnssNi>{}; |
| 91 | } |
| 92 | |
| 93 | Return<sp<V1_0::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement() { |
| 94 | // TODO implement |
| 95 | return sp<V1_0::IGnssMeasurement>{}; |
| 96 | } |
| 97 | |
| 98 | Return<sp<V1_0::IGnssNavigationMessage>> Gnss::getExtensionGnssNavigationMessage() { |
| 99 | // TODO implement |
| 100 | return sp<V1_0::IGnssNavigationMessage>{}; |
| 101 | } |
| 102 | |
| 103 | Return<sp<V1_0::IGnssXtra>> Gnss::getExtensionXtra() { |
| 104 | // TODO implement |
| 105 | return sp<V1_0::IGnssXtra>{}; |
| 106 | } |
| 107 | |
| 108 | Return<sp<V1_0::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration() { |
| 109 | // TODO implement |
| 110 | return sp<V1_0::IGnssConfiguration>{}; |
| 111 | } |
| 112 | |
| 113 | Return<sp<V1_0::IGnssDebug>> Gnss::getExtensionGnssDebug() { |
| 114 | // TODO implement |
| 115 | return sp<V1_0::IGnssDebug>{}; |
| 116 | } |
| 117 | |
| 118 | Return<sp<V1_0::IGnssBatching>> Gnss::getExtensionGnssBatching() { |
| 119 | // TODO implement |
| 120 | return sp<V1_0::IGnssBatching>{}; |
| 121 | } |
| 122 | |
| 123 | // Methods from V1_1::IGnss follow. |
| 124 | Return<bool> Gnss::setCallback_1_1(const sp<V1_1::IGnssCallback>& callback) { |
| 125 | ALOGD("Gnss::setCallback_1_1"); |
| 126 | if (callback == nullptr) { |
| 127 | ALOGE("%s: Null callback ignored", __func__); |
| 128 | return false; |
| 129 | } |
| 130 | |
| 131 | sGnssCallback = callback; |
| 132 | |
| 133 | uint32_t capabilities = 0x0; |
| 134 | auto ret = sGnssCallback->gnssSetCapabilitesCb(capabilities); |
| 135 | if (!ret.isOk()) { |
| 136 | ALOGE("%s: Unable to invoke callback", __func__); |
| 137 | } |
| 138 | |
| 139 | V1_1::IGnssCallback::GnssSystemInfo gnssInfo = {.yearOfHw = 2019}; |
| 140 | |
| 141 | ret = sGnssCallback->gnssSetSystemInfoCb(gnssInfo); |
| 142 | if (!ret.isOk()) { |
| 143 | ALOGE("%s: Unable to invoke callback", __func__); |
| 144 | } |
| 145 | |
| 146 | auto gnssName = "Google Mock GNSS Implementation v2.0"; |
| 147 | ret = sGnssCallback->gnssNameCb(gnssName); |
| 148 | if (!ret.isOk()) { |
| 149 | ALOGE("%s: Unable to invoke callback", __func__); |
| 150 | } |
| 151 | |
| 152 | return true; |
| 153 | } |
| 154 | |
| 155 | Return<bool> Gnss::setPositionMode_1_1(V1_0::IGnss::GnssPositionMode, |
| 156 | V1_0::IGnss::GnssPositionRecurrence, uint32_t, uint32_t, |
| 157 | uint32_t, bool) { |
| 158 | // TODO implement |
| 159 | return bool{}; |
| 160 | } |
| 161 | |
| 162 | Return<sp<V1_1::IGnssConfiguration>> Gnss::getExtensionGnssConfiguration_1_1() { |
| 163 | // TODO implement |
| 164 | return sp<V1_1::IGnssConfiguration>{}; |
| 165 | } |
| 166 | |
| 167 | Return<sp<V1_1::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement_1_1() { |
| 168 | // TODO implement |
| 169 | return sp<V1_1::IGnssMeasurement>{}; |
| 170 | } |
| 171 | |
| 172 | Return<bool> Gnss::injectBestLocation(const V1_0::GnssLocation&) { |
| 173 | // TODO implement |
| 174 | return bool{}; |
| 175 | } |
| 176 | |
| 177 | // Methods from V2_0::IGnss follow. |
| 178 | Return<sp<V2_0::IGnssMeasurement>> Gnss::getExtensionGnssMeasurement_2_0() { |
| 179 | // TODO implement |
| 180 | return sp<V2_0::IGnssMeasurement>{}; |
| 181 | } |
| 182 | |
| 183 | } // namespace implementation |
| 184 | } // namespace V2_0 |
| 185 | } // namespace gnss |
| 186 | } // namespace hardware |
| 187 | } // namespace android |