blob: 81b4f2a26e816241e6fe2aeb5e297eb042e91b7b [file] [log] [blame]
Shinru Han0d91cbe2021-12-14 12:06:02 +08001/*
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#define LOG_TAG "AGnssRilAidl"
18
19#include "AGnssRil.h"
Shinru Hana977bcc2022-10-07 14:11:33 +080020#include <aidl/android/hardware/gnss/BnGnss.h>
Shinru Han0d91cbe2021-12-14 12:06:02 +080021#include <inttypes.h>
22#include <log/log.h>
23
24namespace aidl::android::hardware::gnss {
25
26std::shared_ptr<IAGnssRilCallback> AGnssRil::sCallback = nullptr;
27
28ndk::ScopedAStatus AGnssRil::setCallback(const std::shared_ptr<IAGnssRilCallback>& callback) {
29 ALOGD("AGnssRil::setCallback");
30 std::unique_lock<std::mutex> lock(mMutex);
31 sCallback = callback;
32 return ndk::ScopedAStatus::ok();
33}
34
35ndk::ScopedAStatus AGnssRil::setRefLocation(const AGnssRefLocation& agnssReflocation) {
36 const AGnssRefLocationCellID& cellInfo = agnssReflocation.cellID;
37 ALOGD("AGnssRil::setRefLocation: type: %s, mcc: %d, mnc: %d, lac: %d, cid: %" PRId64
38 ", tac: %d, pcid: "
39 "%d, arfcn: %d",
40 toString(agnssReflocation.type).c_str(), cellInfo.mcc, cellInfo.mnc, cellInfo.lac,
41 cellInfo.cid, cellInfo.tac, cellInfo.pcid, cellInfo.arfcn);
42 return ndk::ScopedAStatus::ok();
43}
44
Yu-Han Yang75934f72022-01-24 15:35:25 -080045ndk::ScopedAStatus AGnssRil::setSetId(SetIdType type, const std::string& setid) {
Shinru Han0d91cbe2021-12-14 12:06:02 +080046 ALOGD("AGnssRil::setSetId: type:%s, setid: %s", toString(type).c_str(), setid.c_str());
47 return ndk::ScopedAStatus::ok();
48}
49
50ndk::ScopedAStatus AGnssRil::updateNetworkState(const NetworkAttributes& attributes) {
51 ALOGD("AGnssRil::updateNetworkState: networkHandle:%" PRId64
52 ", isConnected: %d, capabilities: %d, "
53 "apn: %s",
54 attributes.networkHandle, attributes.isConnected, attributes.capabilities,
55 attributes.apn.c_str());
56 return ndk::ScopedAStatus::ok();
57}
58
Shinru Hana977bcc2022-10-07 14:11:33 +080059ndk::ScopedAStatus AGnssRil::injectNiSuplMessageData(const std::vector<uint8_t>& msgData,
60 int slotIndex) {
61 ALOGD("AGnssRil::injectNiSuplMessageData: msgData:%d bytes slotIndex:%d",
62 static_cast<int>(msgData.size()), slotIndex);
63 if (msgData.size() > 0) {
64 return ndk::ScopedAStatus::ok();
65 } else {
66 return ndk::ScopedAStatus::fromServiceSpecificError(IGnss::ERROR_INVALID_ARGUMENT);
67 }
68}
69
Shinru Han0d91cbe2021-12-14 12:06:02 +080070} // namespace aidl::android::hardware::gnss