1 /*
2 * Copyright 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 namespace bluetooth {
20 namespace audio {
21 namespace aidl {
22
23 using ::aidl::android::hardware::bluetooth::audio::BluetoothAudioStatus;
24
25 enum class BluetoothAudioCtrlAck : uint8_t {
26 SUCCESS_FINISHED = 0,
27 SUCCESS_RECONFIGURATION,
28 PENDING,
29 FAILURE_UNSUPPORTED,
30 FAILURE_BUSY,
31 FAILURE_DISCONNECTING,
32 FAILURE
33 };
34
35 std::ostream& operator<<(std::ostream& os, const BluetoothAudioCtrlAck& ack);
36
BluetoothAudioCtrlAckToHalStatus(const BluetoothAudioCtrlAck & ack)37 inline BluetoothAudioStatus BluetoothAudioCtrlAckToHalStatus(
38 const BluetoothAudioCtrlAck& ack) {
39 switch (ack) {
40 case BluetoothAudioCtrlAck::SUCCESS_FINISHED:
41 return BluetoothAudioStatus::SUCCESS;
42 case BluetoothAudioCtrlAck::FAILURE_UNSUPPORTED:
43 return BluetoothAudioStatus::UNSUPPORTED_CODEC_CONFIGURATION;
44 case BluetoothAudioCtrlAck::PENDING:
45 return BluetoothAudioStatus::FAILURE;
46 case BluetoothAudioCtrlAck::FAILURE_BUSY:
47 return BluetoothAudioStatus::FAILURE;
48 case BluetoothAudioCtrlAck::FAILURE_DISCONNECTING:
49 return BluetoothAudioStatus::FAILURE;
50 case BluetoothAudioCtrlAck::SUCCESS_RECONFIGURATION:
51 return BluetoothAudioStatus::RECONFIGURATION;
52 default:
53 return BluetoothAudioStatus::FAILURE;
54 }
55 }
56
57 } // namespace aidl
58 } // namespace audio
59 } // namespace bluetooth
60