1 /*
2  * Copyright (C) 2022 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 "RefRadioIms.h"
18 
19 namespace cf::ril {
20 
21 using ::ndk::ScopedAStatus;
22 using namespace ::aidl::android::hardware::radio;
23 constexpr auto ok = &ScopedAStatus::ok;
24 
responseInfo(int32_t serial)25 static RadioResponseInfo responseInfo(int32_t serial) {
26     return {
27             .type = RadioResponseType::SOLICITED,
28             .serial = serial,
29             .error = RadioError::NONE,
30     };
31 }
32 
setSrvccCallInfo(int32_t serial,const std::vector<::aidl::android::hardware::radio::ims::SrvccCall> & srvccCalls)33 ScopedAStatus RefRadioIms::setSrvccCallInfo(
34         int32_t serial,
35         const std::vector<::aidl::android::hardware::radio::ims::SrvccCall>& srvccCalls) {
36     respond()->setSrvccCallInfoResponse(responseInfo(serial));
37     return ok();
38 }
updateImsRegistrationInfo(int32_t serial,const::aidl::android::hardware::radio::ims::ImsRegistration & imsRegistration)39 ScopedAStatus RefRadioIms::updateImsRegistrationInfo(
40         int32_t serial,
41         const ::aidl::android::hardware::radio::ims::ImsRegistration& imsRegistration) {
42     respond()->updateImsRegistrationInfoResponse(responseInfo(serial));
43     return ok();
44 }
startImsTraffic(int32_t serial,int32_t token,::aidl::android::hardware::radio::ims::ImsTrafficType imsTrafficType,::aidl::android::hardware::radio::AccessNetwork accessNetworkType,::aidl::android::hardware::radio::ims::ImsCall::Direction trafficDirection)45 ScopedAStatus RefRadioIms::startImsTraffic(
46         int32_t serial, int32_t token,
47         ::aidl::android::hardware::radio::ims::ImsTrafficType imsTrafficType,
48         ::aidl::android::hardware::radio::AccessNetwork accessNetworkType,
49         ::aidl::android::hardware::radio::ims::ImsCall::Direction trafficDirection) {
50     respond()->startImsTrafficResponse(responseInfo(serial), {});
51     return ok();
52 }
stopImsTraffic(int32_t serial,int32_t token)53 ScopedAStatus RefRadioIms::stopImsTraffic(int32_t serial, int32_t token) {
54     respond()->stopImsTrafficResponse(responseInfo(serial));
55     return ok();
56 }
triggerEpsFallback(int32_t serial,::aidl::android::hardware::radio::ims::EpsFallbackReason reason)57 ScopedAStatus RefRadioIms::triggerEpsFallback(
58         int32_t serial, ::aidl::android::hardware::radio::ims::EpsFallbackReason reason) {
59     respond()->triggerEpsFallbackResponse(responseInfo(serial));
60     return ok();
61 }
sendAnbrQuery(int32_t serial,::aidl::android::hardware::radio::ims::ImsStreamType mediaType,::aidl::android::hardware::radio::ims::ImsStreamDirection direction,int32_t bitsPerSecond)62 ScopedAStatus RefRadioIms::sendAnbrQuery(
63         int32_t serial, ::aidl::android::hardware::radio::ims::ImsStreamType mediaType,
64         ::aidl::android::hardware::radio::ims::ImsStreamDirection direction,
65         int32_t bitsPerSecond) {
66     respond()->sendAnbrQueryResponse(responseInfo(serial));
67     return ok();
68 }
updateImsCallStatus(int32_t serial,const std::vector<::aidl::android::hardware::radio::ims::ImsCall> & imsCalls)69 ScopedAStatus RefRadioIms::updateImsCallStatus(
70         int32_t serial,
71         const std::vector<::aidl::android::hardware::radio::ims::ImsCall>& imsCalls) {
72     respond()->updateImsCallStatusResponse(responseInfo(serial));
73     return ok();
74 }
75 }  // namespace cf::ril
76