1 /*
2  * Copyright (C) 2024 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 "core-mock/StreamInMock.h"
18 #include "core-mock/StreamCommonMock.h"
19 
20 namespace aidl::android::hardware::audio::core {
21 
getStreamCommon(std::shared_ptr<IStreamCommon> * _aidl_return)22 ndk::ScopedAStatus StreamInMock::getStreamCommon(std::shared_ptr<IStreamCommon>* _aidl_return) {
23     if (!mStreamCommon) {
24         mStreamCommon = ndk::SharedRefBase::make<StreamCommonMock>();
25     }
26     *_aidl_return = mStreamCommon;
27     return ndk::ScopedAStatus::ok();
28 }
29 
getMicrophoneDirection(IStreamIn::MicrophoneDirection * _aidl_return)30 ndk::ScopedAStatus StreamInMock::getMicrophoneDirection(
31         IStreamIn::MicrophoneDirection* _aidl_return) {
32     *_aidl_return = mMicrophoneDirection;
33     return ndk::ScopedAStatus::ok();
34 }
35 
setMicrophoneDirection(IStreamIn::MicrophoneDirection in_direction)36 ndk::ScopedAStatus StreamInMock::setMicrophoneDirection(
37         IStreamIn::MicrophoneDirection in_direction) {
38     mMicrophoneDirection = in_direction;
39     return ndk::ScopedAStatus::ok();
40 }
41 
getMicrophoneFieldDimension(float * _aidl_return)42 ndk::ScopedAStatus StreamInMock::getMicrophoneFieldDimension(float* _aidl_return) {
43     *_aidl_return = mMicrophoneFieldDimension;
44     return ndk::ScopedAStatus::ok();
45 }
46 
setMicrophoneFieldDimension(float in_zoom)47 ndk::ScopedAStatus StreamInMock::setMicrophoneFieldDimension(float in_zoom) {
48     mMicrophoneFieldDimension = in_zoom;
49     return ndk::ScopedAStatus::ok();
50 }
51 
getHwGain(std::vector<float> * _aidl_return)52 ndk::ScopedAStatus StreamInMock::getHwGain(std::vector<float>* _aidl_return) {
53     *_aidl_return = mHwGains;
54     return ndk::ScopedAStatus::ok();
55 }
56 
setHwGain(const std::vector<float> & in_channelGains)57 ndk::ScopedAStatus StreamInMock::setHwGain(const std::vector<float>& in_channelGains) {
58     mHwGains = in_channelGains;
59     return ndk::ScopedAStatus::ok();
60 }
61 
62 }  // namespace aidl::android::hardware::audio::core
63