Mikhail Naganov | 3b125b7 | 2022-10-05 02:12:39 +0000 | [diff] [blame] | 1 | /* |
| 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 | #include <android/binder_to_string.h> |
| 18 | #define LOG_TAG "AHAL_Telephony" |
| 19 | #include <android-base/logging.h> |
| 20 | |
| 21 | #include "core-impl/Telephony.h" |
| 22 | |
| 23 | namespace aidl::android::hardware::audio::core { |
| 24 | |
| 25 | ndk::ScopedAStatus Telephony::getSupportedAudioModes(std::vector<AudioMode>* _aidl_return) { |
| 26 | *_aidl_return = mSupportedAudioModes; |
| 27 | LOG(DEBUG) << __func__ << ": returning " << ::android::internal::ToString(*_aidl_return); |
| 28 | return ndk::ScopedAStatus::ok(); |
| 29 | } |
| 30 | |
| 31 | ndk::ScopedAStatus Telephony::switchAudioMode(AudioMode in_mode) { |
| 32 | if (std::find(mSupportedAudioModes.begin(), mSupportedAudioModes.end(), in_mode) != |
| 33 | mSupportedAudioModes.end()) { |
| 34 | LOG(DEBUG) << __func__ << ": " << toString(in_mode); |
| 35 | return ndk::ScopedAStatus::ok(); |
| 36 | } |
| 37 | LOG(ERROR) << __func__ << ": unsupported mode " << toString(in_mode); |
| 38 | return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION); |
| 39 | } |
| 40 | |
| 41 | } // namespace aidl::android::hardware::audio::core |