blob: 2b07ec55439905285706bcad9a567f32b9582c6b [file] [log] [blame]
Thomas Nguyen7ea5df62022-11-28 16:41:46 -08001/*
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#pragma once
18
19#include <aidl/android/hardware/radio/satellite/BnRadioSatelliteIndication.h>
20#include <aidl/android/hardware/radio/satellite/BnRadioSatelliteResponse.h>
21#include <aidl/android/hardware/radio/satellite/IRadioSatellite.h>
22
23#include "radio_aidl_hal_utils.h"
24
25using namespace aidl::android::hardware::radio::satellite;
26
27class RadioSatelliteTest;
28
29/* Callback class for Satellite response */
30class RadioSatelliteResponse : public BnRadioSatelliteResponse {
31 protected:
32 RadioServiceTest& parent_satellite;
33
34 public:
35 RadioSatelliteResponse(RadioServiceTest& parent_satellite);
36 virtual ~RadioSatelliteResponse() = default;
37
38 RadioResponseInfo rspInfo;
39
40 virtual ndk::ScopedAStatus acknowledgeRequest(int32_t serial) override;
41
42 virtual ndk::ScopedAStatus getCapabilitiesResponse(
43 const RadioResponseInfo& info, const SatelliteCapabilities& capabilities) override;
44
45 virtual ndk::ScopedAStatus setPowerResponse(const RadioResponseInfo& info) override;
46
47 virtual ndk::ScopedAStatus getPowerStateResponse(const RadioResponseInfo& info,
48 bool on) override;
49
50 virtual ndk::ScopedAStatus provisionServiceResponse(const RadioResponseInfo& info,
51 bool provisioned) override;
52
53 virtual ndk::ScopedAStatus addAllowedSatelliteContactsResponse(
54 const RadioResponseInfo& info) override;
55
56 virtual ndk::ScopedAStatus removeAllowedSatelliteContactsResponse(
57 const RadioResponseInfo& info) override;
58
59 virtual ndk::ScopedAStatus sendMessagesResponse(const RadioResponseInfo& info) override;
60
61 virtual ndk::ScopedAStatus getPendingMessagesResponse(
62 const RadioResponseInfo& info, const std::vector<std::string>& /*messages*/) override;
63
64 virtual ndk::ScopedAStatus getSatelliteModeResponse(
65 const RadioResponseInfo& info, SatelliteMode mode,
66 satellite::NTRadioTechnology technology) override;
67
68 virtual ndk::ScopedAStatus setIndicationFilterResponse(const RadioResponseInfo& info) override;
69
70 virtual ndk::ScopedAStatus startSendingSatellitePointingInfoResponse(
71 const RadioResponseInfo& info) override;
72
73 virtual ndk::ScopedAStatus stopSendingSatellitePointingInfoResponse(
74 const RadioResponseInfo& info) override;
75
76 virtual ndk::ScopedAStatus getMaxCharactersPerTextMessageResponse(const RadioResponseInfo& info,
77 int32_t charLimit) override;
78
79 virtual ndk::ScopedAStatus getTimeForNextSatelliteVisibilityResponse(
80 const RadioResponseInfo& info, int32_t timeInSeconds) override;
81};
82
83/* Callback class for Satellite indication */
84class RadioSatelliteIndication : public BnRadioSatelliteIndication {
85 protected:
86 RadioServiceTest& parent_satellite;
87
88 public:
89 RadioSatelliteIndication(RadioServiceTest& parent_satellite);
90 virtual ~RadioSatelliteIndication() = default;
91
92 virtual ndk::ScopedAStatus onPendingMessageCount(RadioIndicationType type,
93 int32_t count) override;
94
95 virtual ndk::ScopedAStatus onNewMessages(RadioIndicationType type,
96 const std::vector<std::string>& messages) override;
97
98 virtual ndk::ScopedAStatus onMessagesTransferComplete(RadioIndicationType type,
99 bool complete) override;
100
101 virtual ndk::ScopedAStatus onSatellitePointingInfoChanged(
102 RadioIndicationType type, const PointingInfo& pointingInfo) override;
103
104 virtual ndk::ScopedAStatus onSatelliteModeChanged(RadioIndicationType type,
105 SatelliteMode mode) override;
106
107 virtual ndk::ScopedAStatus onSatelliteRadioTechnologyChanged(
108 RadioIndicationType type, satellite::NTRadioTechnology technology) override;
109
110 virtual ndk::ScopedAStatus onProvisionStateChanged(
111 RadioIndicationType type, bool provisioned,
112 const std::vector<SatelliteFeature>& features) override;
113};
114
115// The main test class for AIDL Satellite.
116class RadioSatelliteTest : public ::testing::TestWithParam<std::string>, public RadioServiceTest {
117 public:
118 virtual void SetUp() override;
119
120 /* Radio Satellite service handle */
121 std::shared_ptr<IRadioSatellite> satellite;
122 /* Radio Satellite response handle */
123 std::shared_ptr<RadioSatelliteResponse> rsp_satellite;
124 /* Radio Satellite indication handle */
125 std::shared_ptr<RadioSatelliteIndication> ind_satellite;
126};