• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #pragma once
18 
19 #include <aidl/android/hardware/radio/messaging/BnRadioMessagingIndication.h>
20 #include <aidl/android/hardware/radio/messaging/BnRadioMessagingResponse.h>
21 #include <aidl/android/hardware/radio/messaging/IRadioMessaging.h>
22 
23 #include "radio_aidl_hal_utils.h"
24 
25 using namespace aidl::android::hardware::radio::messaging;
26 
27 class RadioMessagingTest;
28 
29 /* Callback class for radio messaging response */
30 class RadioMessagingResponse : public BnRadioMessagingResponse {
31   protected:
32     RadioServiceTest& parent_messaging;
33 
34   public:
35     RadioMessagingResponse(RadioServiceTest& parent_messaging);
36     virtual ~RadioMessagingResponse() = default;
37 
38     RadioResponseInfo rspInfo;
39     SendSmsResult sendSmsResult;
40 
41     virtual ndk::ScopedAStatus acknowledgeIncomingGsmSmsWithPduResponse(
42             const RadioResponseInfo& info) override;
43 
44     virtual ndk::ScopedAStatus acknowledgeLastIncomingCdmaSmsResponse(
45             const RadioResponseInfo& info) override;
46 
47     virtual ndk::ScopedAStatus acknowledgeLastIncomingGsmSmsResponse(
48             const RadioResponseInfo& info) override;
49 
50     virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override;
51 
52     virtual ndk::ScopedAStatus deleteSmsOnRuimResponse(const RadioResponseInfo& info) override;
53 
54     virtual ndk::ScopedAStatus deleteSmsOnSimResponse(const RadioResponseInfo& info) override;
55 
56     virtual ndk::ScopedAStatus getCdmaBroadcastConfigResponse(
57             const RadioResponseInfo& info,
58             const std::vector<CdmaBroadcastSmsConfigInfo>& configs) override;
59 
60     virtual ndk::ScopedAStatus getGsmBroadcastConfigResponse(
61             const RadioResponseInfo& info,
62             const std::vector<GsmBroadcastSmsConfigInfo>& configs) override;
63 
64     virtual ndk::ScopedAStatus getSmscAddressResponse(const RadioResponseInfo& info,
65                                                       const std::string& smsc) override;
66 
67     virtual ndk::ScopedAStatus reportSmsMemoryStatusResponse(
68             const RadioResponseInfo& info) override;
69 
70     virtual ndk::ScopedAStatus sendCdmaSmsExpectMoreResponse(const RadioResponseInfo& info,
71                                                              const SendSmsResult& sms) override;
72 
73     virtual ndk::ScopedAStatus sendCdmaSmsResponse(const RadioResponseInfo& info,
74                                                    const SendSmsResult& sms) override;
75 
76     virtual ndk::ScopedAStatus sendImsSmsResponse(const RadioResponseInfo& info,
77                                                   const SendSmsResult& sms) override;
78 
79     virtual ndk::ScopedAStatus sendSmsExpectMoreResponse(const RadioResponseInfo& info,
80                                                          const SendSmsResult& sms) override;
81 
82     virtual ndk::ScopedAStatus sendSmsResponse(const RadioResponseInfo& info,
83                                                const SendSmsResult& sms) override;
84 
85     virtual ndk::ScopedAStatus setCdmaBroadcastActivationResponse(
86             const RadioResponseInfo& info) override;
87 
88     virtual ndk::ScopedAStatus setCdmaBroadcastConfigResponse(
89             const RadioResponseInfo& info) override;
90 
91     virtual ndk::ScopedAStatus setGsmBroadcastActivationResponse(
92             const RadioResponseInfo& info) override;
93 
94     virtual ndk::ScopedAStatus setGsmBroadcastConfigResponse(
95             const RadioResponseInfo& info) override;
96 
97     virtual ndk::ScopedAStatus setSmscAddressResponse(const RadioResponseInfo& info) override;
98 
99     virtual ndk::ScopedAStatus writeSmsToRuimResponse(const RadioResponseInfo& info,
100                                                       int32_t index) override;
101 
102     virtual ndk::ScopedAStatus writeSmsToSimResponse(const RadioResponseInfo& info,
103                                                      int32_t index) override;
104 };
105 
106 /* Callback class for radio messaging indication */
107 class RadioMessagingIndication : public BnRadioMessagingIndication {
108   protected:
109     RadioServiceTest& parent_messaging;
110 
111   public:
112     RadioMessagingIndication(RadioServiceTest& parent_messaging);
113     virtual ~RadioMessagingIndication() = default;
114 
115     virtual ndk::ScopedAStatus cdmaNewSms(RadioIndicationType type,
116                                           const CdmaSmsMessage& msg) override;
117 
118     virtual ndk::ScopedAStatus cdmaRuimSmsStorageFull(RadioIndicationType type) override;
119 
120     virtual ndk::ScopedAStatus newBroadcastSms(RadioIndicationType type,
121                                                const std::vector<uint8_t>& data) override;
122 
123     virtual ndk::ScopedAStatus newSms(RadioIndicationType type,
124                                       const std::vector<uint8_t>& pdu) override;
125 
126     virtual ndk::ScopedAStatus newSmsOnSim(RadioIndicationType type, int32_t recordNumber) override;
127 
128     virtual ndk::ScopedAStatus newSmsStatusReport(RadioIndicationType type,
129                                                   const std::vector<uint8_t>& pdu) override;
130 
131     virtual ndk::ScopedAStatus simSmsStorageFull(RadioIndicationType type) override;
132 };
133 
134 // The main test class for Radio AIDL Messaging.
135 class RadioMessagingTest : public RadioServiceTest {
136   public:
137     void SetUp() override;
138 
139     /* radio messaging service handle */
140     std::shared_ptr<IRadioMessaging> radio_messaging;
141     /* radio messaging response handle */
142     std::shared_ptr<RadioMessagingResponse> radioRsp_messaging;
143     /* radio messaging indication handle */
144     std::shared_ptr<RadioMessagingIndication> radioInd_messaging;
145 };
146