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 #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
27 namespace android::hardware::radio::compat {
28
29 namespace aidl = ::aidl::android::hardware::radio::data;
30
setResponseFunction(std::shared_ptr<aidl::IRadioDataIndication> dataCb)31 void RadioIndication::setResponseFunction(std::shared_ptr<aidl::IRadioDataIndication> dataCb) {
32 mDataCb = dataCb;
33 }
34
dataCb()35 std::shared_ptr<aidl::IRadioDataIndication> RadioIndication::dataCb() {
36 return mDataCb.get();
37 }
38
dataCallListChanged(V1_0::RadioIndicationType type,const hidl_vec<V1_0::SetupDataCallResult> &)39 Return<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
dataCallListChanged_1_4(V1_0::RadioIndicationType type,const hidl_vec<V1_4::SetupDataCallResult> &)46 Return<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
dataCallListChanged_1_5(V1_0::RadioIndicationType type,const hidl_vec<V1_5::SetupDataCallResult> & dcList)53 Return<void> RadioIndication::dataCallListChanged_1_5(
54 V1_0::RadioIndicationType type, const hidl_vec<V1_5::SetupDataCallResult>& dcList) {
55 LOG_CALL << type;
56 dataCb()->dataCallListChanged(toAidl(type), toAidl(dcList));
57 return {};
58 }
59
dataCallListChanged_1_6(V1_0::RadioIndicationType type,const hidl_vec<V1_6::SetupDataCallResult> & dcList)60 Return<void> RadioIndication::dataCallListChanged_1_6(
61 V1_0::RadioIndicationType type, const hidl_vec<V1_6::SetupDataCallResult>& dcList) {
62 LOG_CALL << type;
63 dataCb()->dataCallListChanged(toAidl(type), toAidl(dcList));
64 return {};
65 }
66
keepaliveStatus(V1_0::RadioIndicationType type,const V1_1::KeepaliveStatus & status)67 Return<void> RadioIndication::keepaliveStatus(V1_0::RadioIndicationType type,
68 const V1_1::KeepaliveStatus& status) {
69 LOG_CALL << type;
70 dataCb()->keepaliveStatus(toAidl(type), toAidl(status));
71 return {};
72 }
73
pcoData(V1_0::RadioIndicationType type,const V1_0::PcoDataInfo & pco)74 Return<void> RadioIndication::pcoData(V1_0::RadioIndicationType type,
75 const V1_0::PcoDataInfo& pco) {
76 LOG_CALL << type;
77 dataCb()->pcoData(toAidl(type), toAidl(pco));
78 return {};
79 }
80
unthrottleApn(V1_0::RadioIndicationType type,const hidl_string & apn)81 Return<void> RadioIndication::unthrottleApn(V1_0::RadioIndicationType type,
82 const hidl_string& apn) {
83 LOG_CALL << type;
84 dataCb()->unthrottleApn(toAidl(type), mContext->getDataProfile(apn));
85 return {};
86 }
87
slicingConfigChanged(V1_0::RadioIndicationType type,const V1_6::SlicingConfig & slicingConfig)88 Return<void> RadioIndication::slicingConfigChanged(V1_0::RadioIndicationType type,
89 const V1_6::SlicingConfig& slicingConfig) {
90 LOG_CALL << type;
91 dataCb()->slicingConfigChanged(toAidl(type), toAidl(slicingConfig));
92 return {};
93 }
94
95 } // namespace android::hardware::radio::compat
96