• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2025 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 #pragma once
18 #include <memory>
19 
20 #include <aidl/android/hardware/radio/voice/BnRadioVoice.h>
21 #include "AtChannel.h"
22 
23 namespace aidl {
24 namespace android {
25 namespace hardware {
26 namespace radio {
27 namespace implementation {
28 using ::ndk::ScopedAStatus;
29 
30 struct RadioVoice : public voice::BnRadioVoice {
31     RadioVoice(std::shared_ptr<AtChannel> atChannel);
32 
33     ScopedAStatus acceptCall(int32_t serial) override;
34     ScopedAStatus cancelPendingUssd(int32_t serial) override;
35     ScopedAStatus conference(int32_t serial) override;
36     ScopedAStatus dial(
37             int32_t serial, const voice::Dial& dialInfo) override;
38     ScopedAStatus emergencyDial(
39             int32_t serial, const voice::Dial& dialInfo,
40             int32_t categories, const std::vector<std::string>& urns,
41             voice::EmergencyCallRouting routing,
42             bool hasKnownUserIntentEmergency, bool isTesting) override;
43     ScopedAStatus exitEmergencyCallbackMode(int32_t serial) override;
44     ScopedAStatus explicitCallTransfer(int32_t serial) override;
45     ScopedAStatus getCallForwardStatus(
46             int32_t serial,
47             const voice::CallForwardInfo& callInfo) override;
48     ScopedAStatus getCallWaiting(int32_t serial, int32_t serviceClass) override;
49     ScopedAStatus getClip(int32_t serial) override;
50     ScopedAStatus getClir(int32_t serial) override;
51     ScopedAStatus getCurrentCalls(int32_t serial) override;
52     ScopedAStatus getLastCallFailCause(int32_t serial) override;
53     ScopedAStatus getMute(int32_t serial) override;
54     ScopedAStatus getPreferredVoicePrivacy(int32_t serial) override;
55     ScopedAStatus getTtyMode(int32_t serial) override;
56     ScopedAStatus handleStkCallSetupRequestFromSim(int32_t serial, bool accept) override;
57     ScopedAStatus hangup(int32_t serial, int32_t gsmIndex) override;
58     ScopedAStatus hangupForegroundResumeBackground(int32_t serial) override;
59     ScopedAStatus hangupWaitingOrBackground(int32_t serial) override;
60     ScopedAStatus isVoNrEnabled(int32_t serial) override;
61     ScopedAStatus rejectCall(int32_t serial) override;
62     ScopedAStatus sendBurstDtmf(int32_t serial, const std::string& dtmf,
63                                 int32_t on, int32_t off) override;
64     ScopedAStatus sendCdmaFeatureCode(int32_t serial, const std::string& fcode) override;
65     ScopedAStatus sendDtmf(int32_t serial, const std::string& s) override;
66     ScopedAStatus sendUssd(int32_t serial, const std::string& ussd) override;
67     ScopedAStatus separateConnection(int32_t serial, int32_t gsmIndex) override;
68     ScopedAStatus setCallForward(
69             int32_t serial, const voice::CallForwardInfo& callInfo) override;
70     ScopedAStatus setCallWaiting(int32_t serial, bool enable, int32_t serviceClass) override;
71     ScopedAStatus setClir(int32_t serial, int32_t status) override;
72     ScopedAStatus setMute(int32_t serial, bool enable) override;
73     ScopedAStatus setPreferredVoicePrivacy(int32_t serial, bool enable) override;
74     ScopedAStatus setTtyMode(int32_t serial, voice::TtyMode mode) override;
75     ScopedAStatus setVoNrEnabled(int32_t serial, bool enable) override;
76     ScopedAStatus startDtmf(int32_t serial, const std::string& s) override;
77     ScopedAStatus stopDtmf(int32_t serial) override;
78     ScopedAStatus switchWaitingOrHoldingAndActive(int32_t serial) override;
79 
80     void atResponseSink(const AtResponsePtr& response);
81     void handleUnsolicited(const AtResponse::RING&);
82     void handleUnsolicited(const AtResponse::WSOS&);
handleUnsolicitedRadioVoice83     template <class IGNORE> void handleUnsolicited(const IGNORE&) {}
84 
85     ScopedAStatus responseAcknowledgement() override;
86     ScopedAStatus setResponseFunctions(
87             const std::shared_ptr<voice::IRadioVoiceResponse>& radioVoiceResponse,
88             const std::shared_ptr<voice::IRadioVoiceIndication>& radioVoiceIndication) override;
89 
90     const std::shared_ptr<AtChannel> mAtChannel;
91     AtChannel::Conversation mAtConversation;
92     std::shared_ptr<voice::IRadioVoiceResponse> mRadioVoiceResponse;
93     std::shared_ptr<voice::IRadioVoiceIndication> mRadioVoiceIndication;
94 };
95 
96 }  // namespace implementation
97 }  // namespace radio
98 }  // namespace hardware
99 }  // namespace android
100 }  // namespace aidl
101