diff options
| author | Josh Wu <joshwu@google.com> | 2021-12-22 06:13:40 -0800 |
|---|---|---|
| committer | Josh Wu <joshwu@google.com> | 2022-01-24 01:04:57 -0800 |
| commit | 28d6da1d2020e6123ec4f1865ba798aebe937dc5 (patch) | |
| tree | a239d0a630c2608a8983150fbbf76a577fd13388 /system/audio_hal_interface/aidl/audio_ctrl_ack.h | |
| parent | 3a9155100e27e3cb800b549aad2d4077f23a7a42 (diff) | |
HAL: Add AIDL interface support
Tag: #refactor
Bug: 203490261
Test: atest BluetoothInstrumentationTests
Change-Id: I866ad2cc5088b7aa691c62a59be091dab1d3f387
Diffstat (limited to 'system/audio_hal_interface/aidl/audio_ctrl_ack.h')
| -rw-r--r-- | system/audio_hal_interface/aidl/audio_ctrl_ack.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/system/audio_hal_interface/aidl/audio_ctrl_ack.h b/system/audio_hal_interface/aidl/audio_ctrl_ack.h new file mode 100644 index 0000000000..4448f8b3ee --- /dev/null +++ b/system/audio_hal_interface/aidl/audio_ctrl_ack.h @@ -0,0 +1,56 @@ +/* + * Copyright 2022 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 + +namespace bluetooth { +namespace audio { +namespace aidl { + +using ::aidl::android::hardware::bluetooth::audio::BluetoothAudioStatus; + +enum class BluetoothAudioCtrlAck : uint8_t { + SUCCESS_FINISHED = 0, + PENDING, + FAILURE_UNSUPPORTED, + FAILURE_BUSY, + FAILURE_DISCONNECTING, + FAILURE +}; + +std::ostream& operator<<(std::ostream& os, const BluetoothAudioCtrlAck& ack); + +inline BluetoothAudioStatus BluetoothAudioCtrlAckToHalStatus( + const BluetoothAudioCtrlAck& ack) { + switch (ack) { + case BluetoothAudioCtrlAck::SUCCESS_FINISHED: + return BluetoothAudioStatus::SUCCESS; + case BluetoothAudioCtrlAck::FAILURE_UNSUPPORTED: + return BluetoothAudioStatus::UNSUPPORTED_CODEC_CONFIGURATION; + case BluetoothAudioCtrlAck::PENDING: + return BluetoothAudioStatus::FAILURE; + case BluetoothAudioCtrlAck::FAILURE_BUSY: + return BluetoothAudioStatus::FAILURE; + case BluetoothAudioCtrlAck::FAILURE_DISCONNECTING: + return BluetoothAudioStatus::FAILURE; + default: + return BluetoothAudioStatus::FAILURE; + } +} + +} // namespace aidl +} // namespace audio +} // namespace bluetooth |
