blob: 1d367d2025011e42b37777d46df41d4c02638ded [file] [log] [blame]
Tomasz Wasilczyk07161692021-11-02 12:14:52 -07001/*
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#include <libradiocompat/RadioIndication.h>
18
19#include "commonStructs.h"
20#include "debug.h"
21#include "structs.h"
22
23#include "collections.h"
24
25#define RADIO_MODULE "DataIndication"
26
27namespace android::hardware::radio::compat {
28
29namespace aidl = ::aidl::android::hardware::radio::data;
30
31void RadioIndication::setResponseFunction(std::shared_ptr<aidl::IRadioDataIndication> dataCb) {
Tomasz Wasilczyk07161692021-11-02 12:14:52 -070032 mDataCb = dataCb;
33}
34
Tomasz Wasilczyk60638572021-12-13 17:13:48 -080035std::shared_ptr<aidl::IRadioDataIndication> RadioIndication::dataCb() {
36 return mDataCb.get();
37}
38
Tomasz Wasilczyk07161692021-11-02 12:14:52 -070039Return<void> RadioIndication::dataCallListChanged(V1_0::RadioIndicationType type,
40 const hidl_vec<V1_0::SetupDataCallResult>&) {
41 LOG_CALL << type;
42 LOG(ERROR) << "IRadio HAL 1.0 not supported";
43 return {};
44}
45
46Return<void> RadioIndication::dataCallListChanged_1_4(V1_0::RadioIndicationType type,
47 const hidl_vec<V1_4::SetupDataCallResult>&) {
48 LOG_CALL << type;
49 LOG(ERROR) << "IRadio HAL 1.4 not supported";
50 return {};
51}
52
53Return<void> RadioIndication::dataCallListChanged_1_5(
54 V1_0::RadioIndicationType type, const hidl_vec<V1_5::SetupDataCallResult>& dcList) {
55 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -080056 dataCb()->dataCallListChanged(toAidl(type), toAidl(dcList));
Tomasz Wasilczyk07161692021-11-02 12:14:52 -070057 return {};
58}
59
60Return<void> RadioIndication::dataCallListChanged_1_6(
61 V1_0::RadioIndicationType type, const hidl_vec<V1_6::SetupDataCallResult>& dcList) {
62 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -080063 dataCb()->dataCallListChanged(toAidl(type), toAidl(dcList));
Tomasz Wasilczyk07161692021-11-02 12:14:52 -070064 return {};
65}
66
67Return<void> RadioIndication::keepaliveStatus(V1_0::RadioIndicationType type,
68 const V1_1::KeepaliveStatus& status) {
69 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -080070 dataCb()->keepaliveStatus(toAidl(type), toAidl(status));
Tomasz Wasilczyk07161692021-11-02 12:14:52 -070071 return {};
72}
73
74Return<void> RadioIndication::pcoData(V1_0::RadioIndicationType type,
75 const V1_0::PcoDataInfo& pco) {
76 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -080077 dataCb()->pcoData(toAidl(type), toAidl(pco));
Tomasz Wasilczyk07161692021-11-02 12:14:52 -070078 return {};
79}
80
81Return<void> RadioIndication::unthrottleApn(V1_0::RadioIndicationType type,
82 const hidl_string& apn) {
83 LOG_CALL << type;
Tomasz Wasilczyk60638572021-12-13 17:13:48 -080084 dataCb()->unthrottleApn(toAidl(type), mContext->getDataProfile(apn));
Tomasz Wasilczyk07161692021-11-02 12:14:52 -070085 return {};
86}
87
88} // namespace android::hardware::radio::compat