summaryrefslogtreecommitdiff
path: root/radio/aidl/vts/radio_messaging_utils.h
blob: 7b661926793aa222ab64a0f42faca11fe486b436 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/*
 * Copyright (C) 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

#include <aidl/android/hardware/radio/messaging/BnRadioMessagingIndication.h>
#include <aidl/android/hardware/radio/messaging/BnRadioMessagingResponse.h>
#include <aidl/android/hardware/radio/messaging/IRadioMessaging.h>

#include "radio_aidl_hal_utils.h"

using namespace aidl::android::hardware::radio::messaging;

class RadioMessagingTest;

/* Callback class for radio messaging response */
class RadioMessagingResponse : public BnRadioMessagingResponse {
  protected:
    RadioServiceTest& parent_messaging;

  public:
    RadioMessagingResponse(RadioServiceTest& parent_messaging);
    virtual ~RadioMessagingResponse() = default;

    RadioResponseInfo rspInfo;
    SendSmsResult sendSmsResult;

    virtual ndk::ScopedAStatus acknowledgeIncomingGsmSmsWithPduResponse(
            const RadioResponseInfo& info) override;

    virtual ndk::ScopedAStatus acknowledgeLastIncomingCdmaSmsResponse(
            const RadioResponseInfo& info) override;

    virtual ndk::ScopedAStatus acknowledgeLastIncomingGsmSmsResponse(
            const RadioResponseInfo& info) override;

    virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override;

    virtual ndk::ScopedAStatus deleteSmsOnRuimResponse(const RadioResponseInfo& info) override;

    virtual ndk::ScopedAStatus deleteSmsOnSimResponse(const RadioResponseInfo& info) override;

    virtual ndk::ScopedAStatus getCdmaBroadcastConfigResponse(
            const RadioResponseInfo& info,
            const std::vector<CdmaBroadcastSmsConfigInfo>& configs) override;

    virtual ndk::ScopedAStatus getGsmBroadcastConfigResponse(
            const RadioResponseInfo& info,
            const std::vector<GsmBroadcastSmsConfigInfo>& configs) override;

    virtual ndk::ScopedAStatus getSmscAddressResponse(const RadioResponseInfo& info,
                                                      const std::string& smsc) override;

    virtual ndk::ScopedAStatus reportSmsMemoryStatusResponse(
            const RadioResponseInfo& info) override;

    virtual ndk::ScopedAStatus sendCdmaSmsExpectMoreResponse(const RadioResponseInfo& info,
                                                             const SendSmsResult& sms) override;

    virtual ndk::ScopedAStatus sendCdmaSmsResponse(const RadioResponseInfo& info,
                                                   const SendSmsResult& sms) override;

    virtual ndk::ScopedAStatus sendImsSmsResponse(const RadioResponseInfo& info,
                                                  const SendSmsResult& sms) override;

    virtual ndk::ScopedAStatus sendSmsExpectMoreResponse(const RadioResponseInfo& info,
                                                         const SendSmsResult& sms) override;

    virtual ndk::ScopedAStatus sendSmsResponse(const RadioResponseInfo& info,
                                               const SendSmsResult& sms) override;

    virtual ndk::ScopedAStatus setCdmaBroadcastActivationResponse(
            const RadioResponseInfo& info) override;

    virtual ndk::ScopedAStatus setCdmaBroadcastConfigResponse(
            const RadioResponseInfo& info) override;

    virtual ndk::ScopedAStatus setGsmBroadcastActivationResponse(
            const RadioResponseInfo& info) override;

    virtual ndk::ScopedAStatus setGsmBroadcastConfigResponse(
            const RadioResponseInfo& info) override;

    virtual ndk::ScopedAStatus setSmscAddressResponse(const RadioResponseInfo& info) override;

    virtual ndk::ScopedAStatus writeSmsToRuimResponse(const RadioResponseInfo& info,
                                                      int32_t index) override;

    virtual ndk::ScopedAStatus writeSmsToSimResponse(const RadioResponseInfo& info,
                                                     int32_t index) override;
};

/* Callback class for radio messaging indication */
class RadioMessagingIndication : public BnRadioMessagingIndication {
  protected:
    RadioServiceTest& parent_messaging;

  public:
    RadioMessagingIndication(RadioServiceTest& parent_messaging);
    virtual ~RadioMessagingIndication() = default;

    virtual ndk::ScopedAStatus cdmaNewSms(RadioIndicationType type,
                                          const CdmaSmsMessage& msg) override;

    virtual ndk::ScopedAStatus cdmaRuimSmsStorageFull(RadioIndicationType type) override;

    virtual ndk::ScopedAStatus newBroadcastSms(RadioIndicationType type,
                                               const std::vector<uint8_t>& data) override;

    virtual ndk::ScopedAStatus newSms(RadioIndicationType type,
                                      const std::vector<uint8_t>& pdu) override;

    virtual ndk::ScopedAStatus newSmsOnSim(RadioIndicationType type, int32_t recordNumber) override;

    virtual ndk::ScopedAStatus newSmsStatusReport(RadioIndicationType type,
                                                  const std::vector<uint8_t>& pdu) override;

    virtual ndk::ScopedAStatus simSmsStorageFull(RadioIndicationType type) override;
};

// The main test class for Radio AIDL Messaging.
class RadioMessagingTest : public ::testing::TestWithParam<std::string>, public RadioServiceTest {
  public:
    virtual void SetUp() override;

    /* radio messaging service handle */
    std::shared_ptr<IRadioMessaging> radio_messaging;
    /* radio messaging response handle */
    std::shared_ptr<RadioMessagingResponse> radioRsp_messaging;
    /* radio messaging indication handle */
    std::shared_ptr<RadioMessagingIndication> radioInd_messaging;
};