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 #define LOG_TAG "AGnssRilAidl"
18
19 #include "AGnssRil.h"
20 #include <inttypes.h>
21 #include <log/log.h>
22
23 namespace aidl::android::hardware::gnss {
24
25 std::shared_ptr<IAGnssRilCallback> AGnssRil::sCallback = nullptr;
26
setCallback(const std::shared_ptr<IAGnssRilCallback> & callback)27 ndk::ScopedAStatus AGnssRil::setCallback(const std::shared_ptr<IAGnssRilCallback>& callback) {
28 ALOGD("AGnssRil::setCallback");
29 std::unique_lock<std::mutex> lock(mMutex);
30 sCallback = callback;
31 return ndk::ScopedAStatus::ok();
32 }
33
setRefLocation(const AGnssRefLocation & agnssReflocation)34 ndk::ScopedAStatus AGnssRil::setRefLocation(const AGnssRefLocation& agnssReflocation) {
35 const AGnssRefLocationCellID& cellInfo = agnssReflocation.cellID;
36 ALOGD("AGnssRil::setRefLocation: type: %s, mcc: %d, mnc: %d, lac: %d, cid: %" PRId64
37 ", tac: %d, pcid: "
38 "%d, arfcn: %d",
39 toString(agnssReflocation.type).c_str(), cellInfo.mcc, cellInfo.mnc, cellInfo.lac,
40 cellInfo.cid, cellInfo.tac, cellInfo.pcid, cellInfo.arfcn);
41 return ndk::ScopedAStatus::ok();
42 }
43
setSetId(SetIdType type,const std::string & setid)44 ndk::ScopedAStatus AGnssRil::setSetId(SetIdType type, const std::string& setid) {
45 ALOGD("AGnssRil::setSetId: type:%s, setid: %s", toString(type).c_str(), setid.c_str());
46 return ndk::ScopedAStatus::ok();
47 }
48
updateNetworkState(const NetworkAttributes & attributes)49 ndk::ScopedAStatus AGnssRil::updateNetworkState(const NetworkAttributes& attributes) {
50 ALOGD("AGnssRil::updateNetworkState: networkHandle:%" PRId64
51 ", isConnected: %d, capabilities: %d, "
52 "apn: %s",
53 attributes.networkHandle, attributes.isConnected, attributes.capabilities,
54 attributes.apn.c_str());
55 return ndk::ScopedAStatus::ok();
56 }
57
58 } // namespace aidl::android::hardware::gnss
59